Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [tigerstripe-dev] Can I run global rules conditionally?

Richard, Duncan,
 
thanks. The solution shared by you solves my question.
 
regards,
Jinzhai
From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Richard Craddock (rcraddoc)
Sent: 2010年1月22日 17:33
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

So.. if your “file to be copied” contains

 

<xml>

whatever

</xml>

 

 

You would create a template that says

 

#if $conditon

<xml>

whatever

</xml>

#end

 

Then simply use a global template rule for that. There is no need for a copy rule in this case.

 

Remember though you will need one template rule PER FILE.

 

Richard

 

 

From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Zhang, Jin-Zhai (TSG-BAS-China-SH)
Sent: 22 January 2010 09:29
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

 

Richard,

thanks for clarification. so to enforce some global conditions, finally we should put these conditions on top of VM templates, whatever we use 'copy rule+template rule' or use only 'template rule'.

Am I correct?

 

Jinzhai


From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Richard Craddock (rcraddoc)
Sent: 2010
122 17:22
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

I think Duncan missed a step out in his explanation…

 

What you would need to do is create a template for each file from your copy rule, and make a Template rule for each of the files that you change in this way (instead of one global rule).

 

It effectively would be a template rule with “plain text” in side.

 

 

Richard

 

From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Zhang, Jin-Zhai (TSG-BAS-China-SH)
Sent: 22 January 2010 08:37
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

 

Hi Richard, Hi Duncan

 

Thanks again for your help.

 

The copy rule trully copies things. If we copy a VM template, the script in it will not run.

The template rule + supressing empty file work in some cases.

 

best regards,

Jinzhai


From: Zhang, Jin-Zhai (TSG-BAS-China-SH)
Sent: 2010
119 22:43
To: 'Tigerstripe developers list'
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

Hi Richard, Hi Duncan,

 

Thanks for your suggestions!  I'll try and back to you.

 

best regards,

Jinzhai

 

晋寨 (ZHANG Jinzhai)

Next Generation OSS and Services
Best Shore Application Services China
HP Enterprise Services
Office:  +86   21 6081 3327
mobile: +86 139 1731 0846

 

 


From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Duncan Keysell (dkeysell)
Sent: 2010
119 20:43
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

There is a workaround to the copy rule limitation: by copying the contents of the file you were copying to a velocity template and adding the condition at the top of the template. Then the template contents will be copied to the output file you specify depending on whether the condition is satisfied.

 

Duncan

 


From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Richard Craddock (rcraddoc)
Sent: 19 January 2010 12:30
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: RE: [tigerstripe-dev] Can I run global rules conditionally?

Hi Jinzhai,

 

There is no way to trigger a global rule conditionally at present.

 

For template rules, you can mimic this behavior:

 

a)      Add a condition at the top of the template prior to generating any output. In this condition you could for example, check the size of the $sessions collection.

b)      This would then create an empty file if the condition is not met, so you can then clear up empty files in the rule definition using the “Suppress Empty Files” check box.  

c)       NOTE : This would potentially overwrite existing files, but I don’t think that is what you are trying to avoid here.

 

I don’t know of any way of getting round the copy rule limitation though.

 

 

Hope this helps,

 

Richard

 

 

 

From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Zhang, Jin-Zhai (TSG-BAS-China-SH)
Sent: 19 January 2010 10:56
To: Tigerstripe developers list
Cc: Flauw, Marc
Subject: [tigerstripe-dev] Can I run global rules conditionally?

 

Hi team,

Would please help me in following question:

the question is: can I run global rules conditionally? I'm working with Tigerstripe workbench 0.5.0.x

 

- Global Rules - File/Directory Copy Rule:

  For example, , I want to generate web servcies definitions (XSD and WSDL) from tigerstripe models. Now given a model, IF the model is relevant with notification, THEN I will copy existing WS-notification XSD/WSDL files to target folder; ELSE IF the model is not relevant with notification, THEN nothing will be copied.

 

- Global Rules - Global Template Rule:

The case is: I have one VM template in my tigerstripe generator, when I run the generator agaist a model, the VM should run only IF the model meets some global condition (e.g. the model contains at least one SessionFacade).

 

best regards,

Jinzhai

 

ZHANG Jinzhai
HP Enterprise Services

 


Back to the top