RE: correctly using sfProcessClass
"Guijarro, Julio" <[email protected]>
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <8D5B24B83C6A2E4B9E7EE5FA82627DC9B2C6E9@sdcexcea01.emea.cpqcorp.net> |
Hi Hal,
I don't really understand what you are trying to do. Could you elaborate
your question a bit more or give an example use case?
In any case, I am going to try to give you some possible answers.
A)
In your example, you are trying to change the class that is used to
start a ProcessCompound. There are several problems with your example
code:
- ProcessCompound implements the daemon and the subdaemons. Every
ProcessCompound runs in its own JVM. Only the class used to start the
new sub-daemon is read from sfProcessClass but not for the main daemon
because this class is called using the command line. The method that
reads the attribute and deploys a sub-daemon is: ProcessCompoundImpl.
addNewProcessCompound().
A new sub-daemon is created when a sfProcessName attribute is found in a
description, but only if the named sub-daemon is not already deployed.
- Because ProcessCompund is a JVM, it will read its configuration from
the description file processcompound.sf merging it with the appropriate
environment system properties:
org.smartfrog.sfcore.processcompound.X
So to change the process class used when deploying a SUB-process you
will need to define
org.smartfrog.sfcore.processcompound.sfProcessClass =
oracle.foo.MyStartupWrapper;
before the sub-process is created, for ex. before deploying your
description:
> sfConfig extends Compound {
> // sfProcessClass "oracle.foo.MyStartupWrapper";
> sfProcessName "bar";
> MyTest extends Foo {
> config-file "some/path";
> }
> }
You can define that property adding it to the file default.ini
org.smartfrog.sfcore.processcompound.sfProcessClass="com.oracle.wrapper"
from java using
System.setProperty("org.smartfrog.sfcore.processcompound.sfProcessClass"
,"oracle.foo.MyStartupWrapper");
or to the system environment before starting your application command
line.
You cannot redefine it from inside a description.
B)
If what you are trying to do is to use SmartFrog (SF) inside another
main class, you can start the daemon inside your own code in the
following ways:
1. - Use the SFSystem.runConfigurationDescriptor() methods or
2.-
// Set any required new system properties
// to get a daemon with rmi registry
System.setProperty("org.smartfrog.sfcore.processcompound.sfProcessName",
"rootProcess");
//ex.To define the iniFile that will be loaded
System.setProperty("org.smartfrog.iniFile",iniFile);
// ex.To define the default.sf file that will be loaded
System.setProperty("org.smartfrog.sfcore.processcompound.sfDefault.sfDef
ault",sfDefault);
//Init system
SFSystem.initSystem();
//Deploy daemon
ProcessCompound sfDaemon = SFProcess.deployProcessCompound(true);
//"sfDaemon" now has a handle to the daemon.
//You could for example now deploy a description using
// Prim p = sfDaemon.sfCreateNewApp(name,componentDesc,null);
In any case, I would not recommend you to do any tweaks with
ProcessCompound unless you absolutely know what you are doing, the same
applies to the classloader. Wrapping the SFClassLoader inside another
classloader can have implications in the SF security model.
I hope this answers your question. Let me know if it doesn't
BTW, we just about to publish a new release in www.smartfrog.org
Regards,
Julio Guijarro
> -----Original Message-----
> From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Hal Hildebrand
> Sent: 26 May 2005 15:43
> To: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [Smartfrog-developer] correctly using sfProcessClass
>
> I need to wrap the Smartfrog system due to complicating class loader
> issues.
> I believe I can handle this simply if the new process spawned calls my
> main() instead of the SFSystem.main(). I found the "sfProcessClass",
but
> I'm wondering how to override it, as it's an attribute of the
> ProcessCompound.
>
> For example, in my test, I can do:
>
>
> sfConfig extends Compound {
> sfProcessClass "oracle.foo.MyStartupWrapper";
> sfProcessName "bar";
> MyTest extends Foo {
> config-file "some/path";
> }
> }
>
> The sfProcessName will trigger the new process. However, the
> sfProcessClass
> in this scope does nothing to call the wrapper.
>
> I know this is a scoping issue, but I'm clueless as to how to express
> this.
> Sorry if this a silly question...
>
> Thanks in advance....
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit
http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> 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 Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005