RE: Problem in the function resolution phase
"Goldsack, Patrick" <[email protected]> Wed, 9 Nov 2005 13:42:36 -0000
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm sorry, you are of course correct - my memory failed me. You can easily turn the context (the hash table of attributes) back into an appropriate component description if required (there is a CD constructor to do so). Copy the context, then wrap it in a CD. You will have to set the parent parameter to the constructor to null at this point as you do not have the description of your parent, just the object reference. Patrick -----Original Message----- From: Gustavo Wagner D Mendes / Pos. COPIN [mailto:gustavo-y04Q/[email protected]] Sent: 09 November 2005 12:35 To: Goldsack, Patrick; smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: aandrade-y04Q/[email protected] Subject: RE: [Smartfrog-developer] Problem in the function resolution phase Hello Patrick. Trying to override the sfDeployWith(Prim parent, ComponentDescritpion Cd) method, we have not found this method signature on any class. There is public void sfDeployWith(Prim parent, Context context), but not public void sfDeployWith(Prim parent, ComponentDescritpion Cd). Am I wrong in anyway? Thanks, Gustavo and Alisson On Mon, 7 Nov 2005 15:51:41 -0000, Goldsack, Patrick wrote > A number of points. > > 1) The phase list should read "type, place, sfconfig (sfConfig?), > link, function". In this way, you don't link and apply functions to > anything other than sfConfig. > > 2) If you want to keep a copy of the component description, overwrite > the definition of sfDeployWith(ComponentDescritpion) and define it to > be the following: > > ComponentDescription myCd; > public void sfDeployWith(Prim parent, ComponentDescritpion Cd) > throws ... { myCd = cd.copy(); // must copy, as original gets > changed by side-effect during deployment super(parent, cd); } > > Hopes this helps, > > Patrick > > -----Original Message----- > From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > [mailto:smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of > Gustavo Wagner D Mendes / Pos. COPIN Sent: 07 November 2005 15:10 > To: Goldsack, Patrick; smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: > aandrade-y04Q/[email protected] Subject: RE: [Smartfrog-developer] Problem in > the function resolution phase > > Hello Patrick. How are you? > > I have faced this problem when I have tried to parse a component to > get its ComponentDescription. I do not know another way to get the > ComponentDescription after the component is running. So, as I need the > ComponentDescription to redeploy a component on a remote > machine, I have developed the util paserDescription method below: > > public static ComponentDescription parseDescription (InputStream > stream) throws RemoteException, SmartFrogException, > FileNotFoundException { Phases phases = new SFParser() > .sfParse(stream); > > /* Resolving the phases. We don't resolve the 'sfConfig' phase because > * it isn't a deployable component. > */ > phases.sfResolvePhase("type"); > phases.sfResolvePhase("place"); > phases.sfResolvePhase("link"); > phases.sfResolvePhase("function"); > > return phases.sfAsComponentDescription(); > } > > To test it, I have developed a simple component to be parsed: > > #include "org/smartfrog/components.sf" > #include "org/smartfrog/functions.sf" > > Teste1 extends { > sfClass "org.ourgrid.serviceprofile.teste.TesteImpl"; > } > > sfConfig extends Compound { > teste1 extends Teste1; > } > > I have noticed that the problem is the inclusion of the functions.sf > file. Even if you don't use any function in the function.sf file, the > problem will occur. > > Am I right? > > Cheers, > > Gustavo > > ps.: The stacktrace of the error is below: > > SmartFrogCompileResolutionException:: java.lang.NullPointerException, > resolutionPhase: function > at > org.smartfrog.sfcore.languages.sf.SmartFrogCompileResolutionException.forward(SmartFrogCompileResolutionException.java:294) at org.smartfrog.sfcore.languages.sf.sfcomponentdescription.SFComponentDescriptionImpl.sfResolvePhases(SFComponentDescriptionImpl.java:662) at org.smartfrog.sfcore.languages.sf.sfcomponentdescription.SFComponentDescriptionImpl.sfResolvePhase(SFComponentDescriptionImpl.java:621) at org.ourgrid.serviceprofile.util.Util.parseDescription(Util.java:328) at org.ourgrid.serviceprofile.util.UtilTest.testGetUndoComponent(UtilTest.java:254) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.NullPointerException at java.util.Hashtable.put(Unknown Source) at org.smartfrog.sfcore.common.OrderedHashtable.primPut(OrderedHashtable.java:170) at org.smartfrog.sfcore.common.OrderedHashtable.put(OrderedHashtable.java:182) at org.smartfrog.sfcore.languages.sf.functions.BaseFunction.doit(BaseFunction.java:63) at org.smartfrog.sfcore.languages.sf.Phase.actOn(Phase.java:97) at org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl.visit(ComponentDescriptionImpl.java:604) at org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl.visit(ComponentDescriptionImpl.java:599) at org.smartfrog.sfcore.languages.sf.sfcomponentdescription.SFComponentDescriptionImpl.sfResolvePhases(SFComponentDescriptionImpl.java:659) ... 18 more > > On Thu, 3 Nov 2005 22:17:55 -0000, Goldsack, Patrick wrote > > Gustavo, > > > > Thanks for pointing this out. I wonder how this slipped through - it > > must have been sitting there for ages without anyone noticing. The > > correct function for adding its attributes is sum, not plus. The > > definition of plus should probably be removed, or made to point to > > the class Sum for possible backward compatability. I will consider > > this and fix... > > > > I am somewhat surprised that unless you actually try to use it you > > get an error (or if you try to include the file directly into sfConfig). > > Only the functions used within sfConfig should be evaulated, so a > > file included at the top level will be ignored. > > > > Eliminating the function phase enirely will of course remove the > > problem, but I wouldn't recommend it! > > > > Can you send me some more details as to why you are getting the > > error message? The file you are parsing would do. > > > > Thanks > > Patrick > > > > -----Original Message----- > > From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > [mailto:smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf > > Of Gustavo Wagner D Mendes / Pos. COPIN Sent: 03 November 2005 21:49 > > To: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: [Smartfrog- > > developer] Problem in the function resolution phase > > > > Hello all. > > > > In the org/smartfrog/functions.sf file there is the following component: > > > > plus extends { > > phase.function > > "org.smartfrog.sfcore.languages.sf.functions.Plus"; } > > > > Note that it links to the > > org/smartfrog/sfcore/languages/sf/functions/Plus.class class, but it > > does not exists in any smartfrog distribution. If we try to parse > > any component, in the function phase occurs a ClassNotFoundException. > > > > When I comment the function phase - > > //phases.sfResolvePhase("function");, it works well. > > > > If you dont have the Plus class, I can do it and send to you. > > > > Cheers, > > > > Gustavo > > > > ############################################# > > # GUSTAVO WAGNER DINIZ MENDES # > > # Graduado pela UFCG # > > # Curso: Ciência da Computação # > > # Mestrando pela COPIN-UFCG # > > # * Integrante do projeto OurGrid # > > # Fones: (83)88246910 / 32358355 # > > # 33333453 # > > > > ------------------------------------------------------- > > SF.Net email is sponsored by: > > Tame your development challenges with Apache's Geronimo App Server. > > Download it for free - -and be entered to win a 42" plasma tv or > > your very own Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > > _______________________________________________ > > Smartfrog-developer mailing list > > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer > > > > ------------------------------------------------------- > > SF.Net email is sponsored by: > > Tame your development challenges with Apache's Geronimo App Server. > > Download it for free - -and be entered to win a 42" plasma tv or > > your very own Sony(tm)PSP. Click here to play: > > http://sourceforge.net/geronimo.php > > _______________________________________________ > > Smartfrog-developer mailing list > > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer > > ############################################# > # GUSTAVO WAGNER DINIZ MENDES # > # Graduado pela UFCG # > # Curso: Ciência da Computação # > # Mestrando pela COPIN-UFCG # > # * Integrante do projeto OurGrid # > # Fones: (83)88246910 / 32358355 # > # 33333453 # > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or your > very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Smartfrog-developer mailing list > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or your > very own Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > _______________________________________________ > Smartfrog-developer mailing list > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer ############################################# # GUSTAVO WAGNER DINIZ MENDES # # Graduado pela UFCG # # Curso: Ciência da Computação # # Mestrando pela COPIN-UFCG # # * Integrante do projeto OurGrid # # Fones: (83)88246910 / 32358355 # # 33333453 # ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php