Package org.apache.geronimo.j2ee.deployment

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


        File outputPath = new File(basedir, "target/test-resources/deployables/war4");
        recursiveDelete(outputPath);
        outputPath.mkdirs();
        File path = new File(basedir, "src/test-resources/deployables/war4");
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile);
        URI id = new URI("war4");
        EARContext earContext = createEARContext(outputPath, id);
        ObjectName serverName = earContext.getServerObjectName();
        GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
        start(server);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl);
        earContext.close();
        module.close();

        GBeanData configData = earContext.getConfigurationGBeanData();
        ObjectName configName = configData.getName();
        configData.setAttribute("baseURL", path.toURL());
        kernel.loadGBean(configData, cl);
View Full Code Here


            ClassLoader cl = new URLClassLoader(new URL[]{rarFile.toURL()}, oldCl);

            Thread.currentThread().setContextClassLoader(cl);

            JarFile rarJarFile = DeploymentUtil.createJarFile(rarFile);
            Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile, j2eeContext.getJ2eeModuleName(), action.getSpecDD(), null, null);
            if (module == null) {
                throw new DeploymentException("Was not a connector module");
            }
            assertEquals(j2eeContext.getJ2eeModuleName(), module.getConfigId().toString());

            File tempDir = null;
            try {
                tempDir = DeploymentUtil.createTempDir();
                EARContext earContext = new EARContext(tempDir,
                        module.getConfigId(),
                        module.getType(),
                        module.getParentId(),
                        kernel,
                        j2eeContext.getJ2eeApplicationName(),
                        null,
                        connectionTrackerName,
                        null,
                        null,
                        null, new RefContext(ejbReferenceBuilder,
                                moduleBuilder,
                                serviceReferenceBuilder, kernel));

                action.install(moduleBuilder, earContext, module);
                earContext.getClassLoader(null);
                moduleBuilder.initContext(earContext, module, cl);
                moduleBuilder.addGBeans(earContext, module, cl);
                earContext.close();

                verifyDeployment(earContext.getConfigurationData(), tempDir, oldCl, j2eeContext, resourceAdapterName, is15);
            } finally {
                module.close();
                DeploymentUtil.recursiveDelete(tempDir);
            }
        } finally {
            kernel.shutdown();
        }
View Full Code Here

        environmentConfig = new EnvironmentConfigData(getEnterpriseApp().addNewEnvironment());
        environmentConfig.parseEnvironment(applicationInfo.getEnvironment());

        LinkedHashSet modules = applicationInfo.getModules();
        for (Object module1 : modules) {
            Module module = (Module) module1;
            if (ConfigurationModuleType.WAR == module.getType()) {
                WARConfigData warConfig = new WARConfigData();
                warConfig.parseReferences(module.getAnnotatedApp());
                warConfig.parseSecurity(module.getAnnotatedApp());
                webModules.put(module.getName(), warConfig);
            } else if (ConfigurationModuleType.EJB == module.getType()) {
                EjbConfigData ejbConfig = new EjbConfigData();
                ejbModules.put(module.getName(), ejbConfig);
            } else {
                System.out.println("Module Type = " + module.getType());
            }
        }
    }
View Full Code Here

        File path = new File(BASEDIR, "src/test/resources/deployables/" + warName);
        //File dest = new File(BASEDIR, "target/test-resources/deployables/" + warName + "/war");
        File dest = new File(BASEDIR, "target/test-resources/deployables/" + warName);
        recursiveCopy(path, dest);
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
        Repository repository = null;

        AbstractName moduleName = module.getModuleName();
        EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
        AbstractName jaccBeanName = kernel.getNaming().createChildName(moduleName, "foo", SecurityNames.JACC_MANAGER);
        GBeanData jaccBeanData = new GBeanData(jaccBeanName, ApplicationPolicyConfigurationManager.GBEAN_INFO);
        PermissionCollection excludedPermissions = new Permissions();
        PermissionCollection uncheckedPermissions = new Permissions();
        ComponentPermissions componentPermissions = new ComponentPermissions(excludedPermissions, uncheckedPermissions, new HashMap());
        Map contextIDToPermissionsMap = new HashMap();
        contextIDToPermissionsMap.put("test_J2EEApplication=null_J2EEServer=bar_j2eeType=WebModule_name=geronimo/test/1.0/war", componentPermissions);
        jaccBeanData.setAttribute("contextIdToPermissionsMap", contextIDToPermissionsMap);
//        jaccBeanData.setAttribute("principalRoleMap", new HashMap());
        jaccBeanData.setAttribute("roleDesignates", new HashMap());
        earContext.addGBean(jaccBeanData);
        earContext.getGeneralData().put(TomcatModuleBuilder.ROLE_MAPPER_DATA_NAME, jaccBeanName);
        module.setEarContext(earContext);
        module.setRootEarContext(earContext);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl, null);
        ConfigurationData configurationData = earContext.getConfigurationData();
        earContext.close();
        module.close();

        Artifact configurationId = configurationData.getId();
        configurationManager.loadConfiguration(configurationData);
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        configurationManager.startConfiguration(configurationId);
View Full Code Here

            throws Exception {
        WebDeployable webDeployable = new WebDeployable(warUrl);
        ClassLoader classLoader = webDeployable.getModuleLoader();

        ApplicationInfo applicationInfo = createApplicationInfo(request, warUrl);
        Module module = (Module) (applicationInfo.getModules().toArray()[0]);
        WebAppType webApp = (WebAppType) module.getSpecDD();

        ClassFinder classFinder = null;
        try {
            classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader);
            // classFinder = new ClassFinder(classLoader);
        } catch (DeploymentException e1) {
            // Some of the class types referred in the WAR cannot be resolved.
            // A typical case would be references to EJBs already deployed into the system, and
            // hence not packaged inside WEB-INF/lib directory of WAR.
            // try adding all EJBs deployed in the system as parents of this WAR, and
            // see if referred classes can now be successfully resolved

            classLoader = new WebDeployable(warUrl, getEjbClassLoaders(request)).getModuleLoader();
            try {
                classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader);
            } catch (DeploymentException e2) {
                throw e2;
            }
        }
        AnnotatedApp annotatedApp = module.getAnnotatedApp();
        parseAnnotations(annotatedApp, classFinder);

        //DDBeanRoot ddBeanRoot = webDeployable.getDDBeanRoot();
        //DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
View Full Code Here

        recursiveDelete(outputPath);
        outputPath.mkdirs();
        new File(outputPath, "war").mkdir();
        File path = new File(BASEDIR, "src/test/resources/deployables/war4");
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
        Repository repository = null;

        AbstractName moduleName = module.getModuleName();
        EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
        module.setEarContext(earContext);
        module.setRootEarContext(earContext);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
        ConfigurationData configurationData = earContext.getConfigurationData();
        earContext.close();
        module.close();

        Artifact configurationId = configurationData.getId();
        configurationManager.loadConfiguration(configurationData);
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        configurationManager.startConfiguration(configurationId);
View Full Code Here

        recursiveDelete(outputPath);
        outputPath.mkdirs();
        new File(outputPath, "war").mkdir();
        File path = new File(BASEDIR, "src/test/resources/deployables/war-spaces-in-context");
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
        Repository repository = null;

        AbstractName moduleName = module.getModuleName();
        EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
        module.setEarContext(earContext);
        module.setRootEarContext(earContext);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
        ConfigurationData configurationData = earContext.getConfigurationData();
        earContext.close();
        module.close();

        Artifact configurationId = configurationData.getId();
        configurationManager.loadConfiguration(configurationData);
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        configurationManager.startConfiguration(configurationId);
View Full Code Here

        File outputPath = new File(basedir, "target/test-resources/deployables/war4");
        recursiveDelete(outputPath);
        outputPath.mkdirs();
        File path = new File(basedir, "src/test-resources/deployables/war4");
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile);
        URI id = new URI("war4");
        EARContext earContext = createEARContext(outputPath, id);
        ObjectName serverName = earContext.getServerObjectName();
        GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
        start(server);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl);
        earContext.close();
        module.close();
        GBeanData configData = earContext.getConfigurationGBeanData();
        configData.setAttribute("baseURL", path.toURL());
        kernel.loadGBean(configData, cl);

        kernel.startRecursiveGBean(configData.getName());
View Full Code Here

                                } catch (IOException e) {
                                    throw new DeploymentException("Could not locate connector inside ear", e);
                                }
                            }
                            XmlObject connectorPlan = resource.getConnector();
                            Module connectorModule = connectorModuleBuilder.createModule(connectorPlan, connectorFile, path, null, null, null);
                            resourceModules.add(connectorModule);
                            connectorModuleBuilder.installModule(connectorFile, appClientDeploymentContext, connectorModule);
                        }
                        //the install step could have added more dependencies... we need a new cl.
                        appClientClassLoader = appClientDeploymentContext.getClassLoader(repository);
                        for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
                            Module connectorModule = (Module) iterator.next();
                            connectorModuleBuilder.initContext(appClientDeploymentContext, connectorModule, appClientClassLoader);
                        }

                        for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
                            Module connectorModule = (Module) iterator.next();
                            connectorModuleBuilder.addGBeans(appClientDeploymentContext, connectorModule, appClientClassLoader);
                        }
                    } finally {
                        for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
                            Module connectorModule = (Module) iterator.next();
                            connectorModule.close();
                        }
                    }
                }

                // add the app client static jndi provider
View Full Code Here

        outputPath.mkdirs();
        File path = new File(basedir, "src/test-resources/deployables/" + warName);
        File dest = new File(basedir, "target/test-resources/deployables/" + warName + "/war");
        recursiveCopy(path, dest);
        UnpackedJarFile jarFile = new UnpackedJarFile(path);
        Module module = builder.createModule(null, jarFile);
        URI id = new URI(warName);
       
        ObjectName jaccBeanName = NameFactory.getComponentName(null, null, null, null, "foo", NameFactory.JACC_MANAGER, moduleContext);
        GBeanData jaccBeanData = new GBeanData(jaccBeanName, ApplicationPolicyConfigurationManager.GBEAN_INFO);
        PermissionCollection excludedPermissions= new Permissions();
        PermissionCollection uncheckedPermissions= new Permissions();
        ComponentPermissions componentPermissions = new ComponentPermissions(excludedPermissions, uncheckedPermissions, new HashMap());
        Map contextIDToPermissionsMap = new HashMap();
        contextIDToPermissionsMap.put("test_J2EEApplication=null_J2EEServer=bar_j2eeType=WebModule_name=org/apache/geronimo/test", componentPermissions);
        jaccBeanData.setAttribute("contextIdToPermissionsMap", contextIDToPermissionsMap);
        jaccBeanData.setAttribute("principalRoleMap", new HashMap());
        jaccBeanData.setAttribute("roleDesignates", new HashMap());
        start(jaccBeanData);       
       
        EARContext earContext = createEARContext(outputPath, id);
        earContext.setJaccManagerName(jaccBeanName);
        ObjectName serverName = earContext.getServerObjectName();
        GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
        start(server);
        builder.initContext(earContext, module, cl);
        builder.addGBeans(earContext, module, cl);
        earContext.close();
        module.close();
        GBeanData configData = earContext.getConfigurationGBeanData();
        configData.setAttribute("baseURL", path.toURL());
        kernel.loadGBean(configData, cl);

        kernel.startRecursiveGBean(configData.getName());
View Full Code Here

TOP

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

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.