Package org.apache.geronimo.j2ee.deployment

Examples of org.apache.geronimo.j2ee.deployment.BundleDeploymentContext


                if (webModuleBuilder == null) {
                    throw new DeploymentException("Unable to deploy " + bundle + " WAB. No web module builders found.");
                }
                WebModule webModule = (WebModule) webModuleBuilder.createModule(bundle, naming, idBuilder);

                BundleDeploymentContext deploymentContext =
                    new BundleDeploymentContext(
                        webModule.getEnvironment(),
                        ConfigurationModuleType.WAB,
                        naming,
                        configurationManager,
                        bundle.getBundleContext(),
                        extender.getServerName(),
                        webModule.getModuleName(),
                        extender.getTransactionManagerObjectName(),
                        extender.getConnectionTrackerObjectName(),
                        extender.getCorbaGBeanObjectName(),
                        new HashMap(),
                        bundle);
                webModule.setEarContext(deploymentContext);
                webModule.setRootEarContext(deploymentContext);

                deploymentContext.flush();
                deploymentContext.initializeConfiguration();

                webModule.getJndiScope(JndiScope.app).put("app/AppName", webModule.getName());

                webModuleBuilder.initContext(deploymentContext, webModule, bundle);

                AbstractName appJndiName = naming.createChildName(deploymentContext.getModuleName(), "ApplicationJndi", "ApplicationJndi");
                deploymentContext.getGeneralData().put(EARContext.APPLICATION_JNDI_NAME_KEY, appJndiName);

                webModuleBuilder.addGBeans(deploymentContext, webModule, bundle, extender.getRepositories());

                GBeanData appContexts = new GBeanData(appJndiName, ApplicationJndi.class);
                appContexts.setAttribute("globalContextSegment", webModule.getJndiScope(JndiScope.global));
                appContexts.setAttribute("applicationContextMap", webModule.getJndiScope(JndiScope.app));
                appContexts.setReferencePattern("GlobalContext", extender.getGlobalContextAbstractName());
                deploymentContext.addGBean(appContexts);

                configurationData = deploymentContext.getConfigurationData();
                FileOutputStream configSerOut =  null;
                try {
                    configSerOut = new FileOutputStream(configSer);
                    ConfigurationUtil.writeConfigurationData(configurationData, configSerOut);
                } finally {
                    IOUtils.close(configSerOut);
                }

                // set config.ser last modified time to be of the bundle
                configSer.setLastModified(bundle.getLastModified());

                File geronimoPlugin = bundle.getBundleContext().getDataFile("geronimo-plugin.xml");
                FileOutputStream geronimoPluginOut = null;
                try {
                    geronimoPluginOut = new FileOutputStream(geronimoPlugin);
                    PluginType pluginMetadata = deploymentContext.getPluginMetadata();
                    PluginXmlUtil.writePluginMetadata(pluginMetadata, geronimoPluginOut);
                    DependencyManager.updatePluginMetadata(bundle.getBundleContext(), bundle);
                } finally {
                    IOUtils.close(geronimoPluginOut);
                }
                deploymentContext.close();
            }

            configurationData.setUseEnvironment(true);
            configurationData.setBundleContext(bundle.getBundleContext());
View Full Code Here


                if (webModuleBuilder == null) {
                    throw new DeploymentException("Unable to deploy " + bundle + " WAB. No web module builders found.");
                }
                WebModule webModule = (WebModule) webModuleBuilder.createModule(bundle, naming, idBuilder);

                BundleDeploymentContext deploymentContext =
                    new BundleDeploymentContext(
                        webModule.getEnvironment(),
                        ConfigurationModuleType.WAB,
                        naming,
                        configurationManager,
                        bundle.getBundleContext(),
                        extender.getServerName(),
                        webModule.getModuleName(),
                        extender.getTransactionManagerObjectName(),
                        extender.getConnectionTrackerObjectName(),
                        extender.getCorbaGBeanObjectName(),
                        new HashMap(),
                        bundle);
                webModule.setEarContext(deploymentContext);
                webModule.setRootEarContext(deploymentContext);

                deploymentContext.flush();
                deploymentContext.initializeConfiguration();

                webModule.getJndiScope(JndiScope.app).put("app/AppName", webModule.getName());

                webModuleBuilder.initContext(deploymentContext, webModule, bundle);

                AbstractName appJndiName = naming.createChildName(deploymentContext.getModuleName(), "ApplicationJndi", "ApplicationJndi");
                deploymentContext.getGeneralData().put(EARContext.APPLICATION_JNDI_NAME_KEY, appJndiName);

                webModuleBuilder.addGBeans(deploymentContext, webModule, bundle, extender.getRepositories());

                GBeanData appContexts = new GBeanData(appJndiName, ApplicationJndi.class);
                appContexts.setAttribute("globalContextSegment", webModule.getJndiScope(JndiScope.global));
                appContexts.setAttribute("applicationContextMap", webModule.getJndiScope(JndiScope.app));
                appContexts.setReferencePattern("GlobalContext", extender.getGlobalContextAbstractName());
                deploymentContext.addGBean(appContexts);

                configurationData = deploymentContext.getConfigurationData();
                FileOutputStream configSerOut =  null;
                try {
                    configSerOut = new FileOutputStream(configSer);
                    ConfigurationUtil.writeConfigurationData(configurationData, configSerOut);
                } finally {
                    IOUtils.close(configSerOut);
                }

                // set config.ser last modified time to be of the bundle
                configSer.setLastModified(bundle.getLastModified());

                File geronimoPlugin = bundle.getBundleContext().getDataFile("geronimo-plugin.xml");
                FileOutputStream geronimoPluginOut = null;
                try {
                    geronimoPluginOut = new FileOutputStream(geronimoPlugin);
                    PluginType pluginMetadata = deploymentContext.getPluginMetadata();
                    PluginXmlUtil.writePluginMetadata(pluginMetadata, geronimoPluginOut);
                    DependencyManager.updatePluginMetadata(bundle.getBundleContext(), bundle);
                } finally {
                    IOUtils.close(geronimoPluginOut);
                }
                deploymentContext.close();
            }

            configurationData.setUseEnvironment(true);
            configurationData.setBundleContext(bundle.getBundleContext());
View Full Code Here

                if (webModuleBuilder == null) {
                    throw new DeploymentException("Unable to deploy " + bundle + " WAB. No web module builders found.");
                }
                WebModule webModule = (WebModule) webModuleBuilder.createModule(bundle, naming, idBuilder);

                BundleDeploymentContext deploymentContext =
                    new BundleDeploymentContext(
                        webModule.getEnvironment(),
                        webModule.getType(),
                        naming,
                        configurationManager,
                        bundle.getBundleContext(),
                        extender.getServerName(),
                        webModule.getModuleName(),
                        extender.getTransactionManagerObjectName(),
                        extender.getConnectionTrackerObjectName(),
                        extender.getCorbaGBeanObjectName(),
                        new HashMap(),
                        bundle);
                webModule.setEarContext(deploymentContext);
                webModule.setRootEarContext(deploymentContext);
               
                deploymentContext.flush();
                deploymentContext.initializeConfiguration();

                Map<JndiKey, Map<String, Object>> contexts = NamingBuilder.JNDI_KEY.get(deploymentContext.getGeneralData());
                Map<String, Object> app = new HashMap<String, Object>();
                app.put("app/AppName", webModule.getName());
                contexts.put(JndiScope.app, app);
               
                webModuleBuilder.initContext(deploymentContext, webModule, bundle);

                AbstractName appJndiName = naming.createChildName(deploymentContext.getModuleName(), "ApplicationJndi", "ApplicationJndi");
                deploymentContext.getGeneralData().put(EARContext.APPLICATION_JNDI_NAME_KEY, appJndiName);

                webModuleBuilder.addGBeans(deploymentContext, webModule, bundle, extender.getRepositories());

                GBeanData appContexts = new GBeanData(appJndiName, ApplicationJndi.class);
                appContexts.setAttribute("globalContextSegment", contexts.get(JndiScope.global));
                appContexts.setAttribute("applicationContextMap", contexts.get(JndiScope.app));
                appContexts.setReferencePattern("GlobalContext", extender.getGlobalContextAbstractName());
                deploymentContext.addGBean(appContexts);

                configurationData = deploymentContext.getConfigurationData();
                FileOutputStream out = new FileOutputStream(configSer);
                try {
                    ConfigurationUtil.writeConfigurationData(configurationData, out);
                } finally {
                    out.close();
                }

                deploymentContext.close();

                // set config.ser last modified time to be of the bundle
                configSer.setLastModified(bundle.getLastModified());
            }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.j2ee.deployment.BundleDeploymentContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.