RE: how to get attribute value
"Guijarro, Julio" <[email protected]> Tue, 21 Feb 2006 10:58:13 -0000
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Andreas,
I think the method you are looking for is one that you already know:
sfResolve().
ComponentDescription is similar in structure the SF components and
supports most of its methods for configuration manipulation.
When you use sfResolve() in a CD it has the same behavior that in a
component, resolving links and so on. It also "navigates" transparently
from CD to compononents to CD, in other words, through your
configuration data.
Julio
> -----Original Message-----
> From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Andreas
Unterkircher
> Sent: 21 February 2006 10:46
> To: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [Smartfrog-developer] how to get attribute value
>
>
> Hello,
>
> I'm deveolping a component "RollbackSequence" which might have a
> description as follows (I omit testA's description):
>
> sfConfig extends RollbackSequence {
> action1 extends {
> first extends testA {
> message "first";
> }
> second extends testA {
> message "second";
> }
> third extends testA {
> message "third";
> }
> }
> }
>
> Now in it's sfStart phase RollbackSequence should deploy one of the 3
> descriptions found in "action1" based on some additional information.
My
> problem is how to get the desrciption of first, second or third. In
> RollbackSequence's sfStart() I have the following code:
>
> act = (ComponentDescription) actions.get(componentName);
> System.out.println(act.toString());
> if(act.sfContainsAttribute("first")) System.out.println("Contains
first");
> for(Iterator ii = act.sfAttributes();ii.hasNext();)
> System.out.println(ii.next());
>
> This gives
>
> first extends {
> sfCodeBase "default";
> sfClass "ch.cern.openlab.smartfrog.test.TestA";
> sfExport false;
> sfShouldTerminate true;
> message "first";
> }
> second extends {
> sfCodeBase "default";
> sfClass "ch.cern.openlab.smartfrog.test.TestA";
> sfExport false;
> sfShouldTerminate true;
> message "second";
> }
> third extends {
> sfCodeBase "default";
> sfClass "ch.cern.openlab.smartfrog.test.TestA";
> sfExport false;
> sfShouldTerminate true;
> message "third";
> }
>
> Contains first
> first
> second
> third
>
> act is a ComponentDescription... how can I get the value for an
attribute
> (which describes a component I want to deploy) ? E.g. out of "first",
> "second", "third" I'd like to deploy "second". For
ComponentDescription I
> find the method sfAttributeKeyFor, but I would need somehow the
reverse of
> this. How can I solve this problem ? Thanks for your help !
>
> Best regards,
> Andreas
>
> --
> http://cern.ch/openlab
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Smartfrog-developer mailing list
> Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642