geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gromar <mgrof...@pflow.sk>
Subject Re: Load stand alone deployment plan
Date Wed, 24 Oct 2007 10:36:50 GMT

Thank you for answer.

I can not find 
http://cwiki.apache.org/GMOxSAMPLES/apache-geronimo-v20-samples.html there 
any sample for GBeans.

When I am trying to deploy J2EE application to geronimo app. server there is
posibility to deploy GBeans deployment plan by geronimo configuration
(geronimo-application.xml, geronimo-web.xml).
Problem is that I would like to develop stand alone applcation or
application independent from App. Server.

I have downloaded geronimo sources mean time.
in the org.apache.geronimo.system.main.Daemon there is a start up sequence
for different configurations. How can I load my deployment plan there?
....

   private void doStartup() {
        try {
            String tmpDir = System.getProperty("java.io.tmpdir");
....
            // Determine the geronimo installation directory
            File geronimoInstallDirectory =
DirectoryUtils.getGeronimoInstallDirectory();
...			
            
            ClassLoader classLoader = Daemon.class.getClassLoader();

            // create the kernel
            final Kernel kernel =
KernelFactory.newInstance().createKernel("geronimo");

            // boot the kernel
            try {
                kernel.boot();
            } catch (Exception e) {
   ...
         // add our shutdown hook
            Runtime.getRuntime().addShutdownHook(new Thread("Geronimo
shutdown thread") {
...
            // load this configuration
            InputStream in =
classLoader.getResourceAsStream("META-INF/config.ser");
            try {
                ConfigurationUtil.loadBootstrapConfiguration(kernel, in,
classLoader);
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException ignored) {
                        // ignored
                    }
                }
            }

            monitor.systemStarted(kernel);

            AbstractNameQuery query = new
AbstractNameQuery(PersistentConfigurationList.class.getName());

            if (configs.isEmpty()) {
                // --override wasn't used (nothing explicit), see what was
running before
...
            }

            monitor.foundModules((Artifact[]) configs.toArray(new
Artifact[configs.size()]));
...
            // load the rest of the configurations
            try {
                ConfigurationManager configurationManager =
ConfigurationUtil.getConfigurationManager(kernel);
                try {
                    for (Iterator i = configs.iterator(); i.hasNext();) {
                        Artifact configID = (Artifact) i.next();
                        monitor.moduleLoading(configID);
                        configurationManager.loadConfiguration(configID);
                        monitor.moduleLoaded(configID);
                        monitor.moduleStarting(configID);
                        configurationManager.startConfiguration(configID);
                        monitor.moduleStarted(configID);
                    }
                } finally {
                    ConfigurationUtil.releaseConfigurationManager(kernel,
configurationManager);
                }
            } catch (Exception e) {
                //Exception caught when starting configurations, starting
kernel shutdown
                monitor.serverStartFailed(e);
                try {
                    kernel.shutdown();
                } catch (Exception e1) {
                    System.err.println("Exception caught during kernel
shutdown");
                    e1.printStackTrace();
                }
                System.exit(1);
                throw new AssertionError();
            }

            // Tell every persistent configuration list that the kernel is
now fully started
            Set configLists = kernel.listGBeans(query);
            for (Iterator i = configLists.iterator(); i.hasNext();) {
                AbstractName configListName = (AbstractName) i.next();
                kernel.setAttribute(configListName, "kernelFullyStarted",
Boolean.TRUE);
            }

            // Startup sequence is finished
            monitor.startupFinished();
            monitor = null;
.....


I am not sure, but 

  configurationManager.loadConfiguration(configID);

is able to load configuration based on deployment plan (Is it true?). But
when I am starting geronimo from sources there is no configuration manager. 
I think at first I have to configure geronimo kernel to obtain
ConfigurationManager's GBean. (How can I do it?)

Thank you in advance for answer.

Regards,
Martin


prasad wrote:
> 
> There are a lot more samples here
> http://cwiki.apache.org/GMOxSAMPLES/apache-geronimo-v20-samples.html
> 
> The plan.xml as you know it is also called by different names in these
> samples.
> * geronimo-application.xml (when packaged in the EARs META-INF)
> * geronimo-web.xml (when packaged at WAR's WEB-INF)
> 
> Is this what you are looking for ?
> 
> Cheers
> Prasad
> 
> 
> On 10/22/07, gromar <mgrofcik@pflow.sk> wrote:
>>
>> Hi,
>>
>> I would like to develop stand alone application based GBeans. I would
>> like
>> to use deployment plan (plan.xml) for GBeans configuration deployment How
>> can I do it? Is there any example? if yes, where?
>>
>>
>> I saw an example
>> http:/www.ibm.com/developerworks/opensource/library/os-ag-ioc2
>>
>> there is writen how to instantiate GBeans in runtime.
>>
>> GBeanMBean gmb = new GBeanMBean(Customer.getGBeanInfo());
>> gmb.setAttribute("name","Homer");
>> gmb.setAttribute("salary", 2500.00);
>> ObjectName myGbeanName = ObjectName.newInstance(
>>         "Geronimo.my:Customer=customer1");
>> kernel.loadGBean(myGbeanName, gmb);
>> kernel.startGBean(myGbeanName);
>>
>> //do some work with Customers
>>
>> kernel.stopGBean(myGbeanName);
>> kernel.unloadGBean(myGbeanName);
>>
>>
>>
>> But I would like to load plan.xml  in my stand alone application.
>>
>> Thank you for answer.
>>
>> regards
>> Martin
>> --
>> View this message in context:
>> http://www.nabble.com/Load-stand-alone-deployment-plan-tf4670360s134.html#a13341748
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
> 

-- 
View this message in context: http://www.nabble.com/Load-stand-alone-deployment-plan-tf4670360s134.html#a13383190
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message