Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.Application


        try {
            WebBundleDescriptor wbd = null;
            if( configBean instanceof WebModule ) {
                WebModulesManager webModulesManager = new WebModulesManager(
                    ApplicationServer.getServerContext().getInstanceEnvironment());
          Application app = webModulesManager.getDescriptor(wmID, location);     
                wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
            } else if ( configBean instanceof ExtensionModule) {
                ModuleType mType = XModuleType.getModuleType(
                            ((ExtensionModule)configBean).getModuleType());
                ExtensionModuleConfigManager extnModulesManager =
                        PluggableDeploymentInfo.getExtensionModuleDeployer(
                                                 mType).getConfigManager();
          Application app =
                        extnModulesManager.getExtensionDescriptor(wmID,
                            location, true);
                // if an app has to be loaded into the web container then it
                // should extend the WebBundleDescriptor
                if(app.getStandaloneBundleDescriptor()
                    instanceof WebBundleDescriptor) {
                    wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();             
                } else {
                    // We return a null since we do not want to process this
                    // app
                    return null;
                }
View Full Code Here


                ApplicationRegistry registry =
                    ApplicationRegistry.getInstance();
                ClassLoader appLoader =
                    registry.getClassLoaderForApplication(appID);
                if (appLoader != null) {
                    Application appDesc = registry.getApplication(appLoader);
                    if (appDesc != null) {
                        Set wbds = appDesc.getWebBundleDescriptors();
                        WebBundleDescriptor wbd = null;
                        for (Iterator itr = wbds.iterator(); itr.hasNext(); ) {
                            wbd = (WebBundleDescriptor) itr.next();
                            String webUri = wbd.getModuleDescriptor().getArchiveUri();
                            if (moduleID.equals(webUri)) {
View Full Code Here

                archive.open(moduleScratchDirectory.getAbsolutePath());
                Archivist moduleArchivist =
                    ArchivistFactory.getArchivistForArchive(archive);
                ClassLoader tcl = (moduleClassLoader instanceof InstrumentableClassLoader) ?  InstrumentableClassLoader.class.cast(moduleClassLoader).copy() : moduleClassLoader;
                moduleArchivist.setClassLoader(tcl);
                Application application = ApplicationArchivist.openArchive(
                    moduleArchivist, archive, true);
                application.setClassLoader(tcl);
                for (BundleDescriptor bd : (Collection <BundleDescriptor>)
                    application.getBundleDescriptors()) {
                    bd.setClassLoader(tcl);
                }
                // we need to read persistence descriptors separately
                // because they are read from appDir as oppsed to xmlDir.
                FileArchive archive2 = new FileArchive();
View Full Code Here

     * @throws   ConfigException  if unable to load the deployment descriptor
     */
    public Application getDescriptor(String modId, ClassLoader cl,
            boolean validateXml) throws ConfigException {

        Application application = getRegisteredDescriptor(modId);
        if (application!=null) {
            application.setClassLoader(cl);
            return application;
        }
        try {
            String moduleDir             = getLocation(modId);
      EjbArchivist ejbArchivist = new EjbArchivist();
      ejbArchivist.setXMLValidation(validateXml);

            // We need to use a temp CL until we are done with validate(),
            // see https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
            ClassLoader tcl = (cl instanceof InstrumentableClassLoader) ?
                    InstrumentableClassLoader.class.cast(cl).copy() : cl;
            ejbArchivist.setClassLoader(tcl);

      FileArchive archive = openDDArchive(modId, moduleDir);
           
            // Try to load the app from the serialized descriptor file.
            SerializedDescriptorHelper.Loader sdLoader =
                    SerializedDescriptorHelper.load(modId, this);
            Application deserializedApplication = sdLoader.getApplication();
            if (deserializedApplication != null) {
                application = deserializedApplication;
            } else {
                application = ApplicationArchivist.openArchive(modId, ejbArchivist, archive, true);
                if(!isSystemAdmin(modId) && !isSystem(modId)) {
View Full Code Here

        WebModuleConfig wmInfo = new WebModuleConfig();
        wmInfo.setBean(wm);
        String wmID = wm.getName();
        String location = wm.getLocation();
        try {
      Application app = getWebModulesManager().getDescriptor(wmID,
                location);
            WebBundleDescriptor wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();               
            wmInfo.setDescriptor(wbd);
            String vs = ServerBeansFactory.getVirtualServersByAppName(
                    config, wmID);
            wmInfo.setVirtualServers(vs);
        } catch (ConfigException ce) {
View Full Code Here

            config, moduleName, false);

        String appName = null;
        WebBundleDescriptor wbd;
        try {
      Application app = getWebModulesManager().getDescriptor(
                webModule.getName(), webModule.getLocation());
            RoleMapper.removeRoleMapper(app.getRoleMapper().getName());
            wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
            appName = app.getRegistrationName();
        } catch (ConfigException ce) {
            throw new AdminEventListenerException(ce);
        }           
        String contextRoot = webModule.getContextRoot();      
        String virtualServers = null;
View Full Code Here

                config, moduleName, true);

            String appName = null;
            WebBundleDescriptor wbd;
            try {
                Application app = getWebModulesManager().getDescriptor(
                    webModule.getName(), webModule.getLocation());
                wbd =
                    (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
                appName = app.getRegistrationName();
            } catch (ConfigException ce) {
                throw new AdminEventListenerException(ce);
            }
            String contextRoot = webModule.getContextRoot();
            String virtualServers = null;
View Full Code Here

     * @throws   ConfigException if unable to load the deployment descriptor
     */
    public Application getDescriptor(String modId, ClassLoader cl,
            String modDir, boolean validateXml) throws ConfigException {

        Application application = getRegisteredDescriptor(modId);
        if (application!=null) {
            application.setClassLoader(cl);
            return application;
        }               
        try {
      ConnectorArchivist connectorArchivist = new ConnectorArchivist();
      connectorArchivist.setXMLValidation(validateXml);
            connectorArchivist.setClassLoader(cl);
     
            FileArchive archive = new FileArchive();
            archive.open(modDir);
            // Try to load the app from the serialized descriptor file.
            SerializedDescriptorHelper.Loader sdLoader = SerializedDescriptorHelper.load(modId, this);
            Application deserializedApplication = sdLoader.getApplication();
            if (deserializedApplication != null) {
                application = deserializedApplication;
            } else {
                application = ApplicationArchivist.openArchive(modId, connectorArchivist, archive, true);
            }
View Full Code Here

     * application object.
     */
    public Application getAppDescriptor(String appID, ClassLoader parentClassLoader)
            throws ConfigException {

        Application application = getRegisteredDescriptor(appID);
        if (application != null) {
            return application;
        }
        Application deserializedApplication = null;

        // Try to load the previously-serialized form of the descriptor.
        SerializedDescriptorHelper.Loader sdLoader =
                SerializedDescriptorHelper.load(appID, this);
        try {
            // partially load the deployment descriptor...
            ApplicationArchivist archivist = new ApplicationArchivist();
            FileArchive appArchive = new FileArchive();
            appArchive.open(getLocation(appID));

            //for upgrade senario, we still load from the original
            //application repository for application.xml first
            if (!archivist.hasStandardDeploymentDescriptor(appArchive)) {
                //read from generated/xml location
                appArchive.open(getGeneratedXMLLocation(appID));
            }

            deserializedApplication = sdLoader.getApplication();
            if (deserializedApplication != null &&
                sdLoader.lastModified() > DOLLoadingContext.defaultWebXMLLastModified()) {
                application = deserializedApplication;
            } else {
                // There was no serialized descriptor file or it could not
                // be loaded, so load the application info from the XML descriptors.
                application = Application.createApplication(appArchive,false);
            }
            application.setRegistrationName(appID);
            String moduleRoot = getLocation(application.getRegistrationName());
            String[] classPaths = (String[]) EJBClassPathUtils.getAppClasspath(
                                                            application, this).toArray(new String[0]);
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "[AppsManager] :: appID " + appID + " classpaths "
                                                + classPaths + " moduleRoot " + moduleRoot
                                                + " parentClassLoader " + parentClassLoader);
            }
            ClassLoader cl = EJBClassPathUtils.createEJBClassLoader(classPaths,
                                                            moduleRoot , appID, parentClassLoader,
                                                            application.getModuleType());
            application.setClassLoader(cl);
        } catch (Exception confEx) {
            _logger.log(Level.SEVERE,"loader.error_while_loading_app_desc", confEx);
            throw new ConfigException(confEx);
        }

        Application fullyLoadedApp = getAppDescriptor(application);
       
        // If needed, write out the new app into the serialized descriptor file.
        sdLoader.store(fullyLoadedApp);
       
        return fullyLoadedApp;
View Full Code Here

    }
   
    public static EntityManagerFactory lookupEntityManagerFactory(int invType,
            String emfUnitName, Object descriptor) {

        Application app = null;
        BundleDescriptor module = null;

        EntityManagerFactory emf = null;

        switch (invType) {

        case ComponentInvocation.EJB_INVOCATION:

            EjbDescriptor ejbDesc = (EjbDescriptor) descriptor;
            module = ejbDesc.getEjbBundleDescriptor();
            app = module.getApplication();

            break;

        case ComponentInvocation.SERVLET_INVOCATION:

            module = (WebBundleDescriptor) descriptor;
            app = module.getApplication();

            break;

        case ComponentInvocation.APP_CLIENT_INVOCATION:

            module = (ApplicationClientDescriptor) descriptor;
            app = module.getApplication();

            break;

        default:

            break;
        }

        // First check module-level for a match.
        if (module != null) {
            if (emfUnitName != null) {
                emf = module.getEntityManagerFactory(emfUnitName);
            } else {
                Set<EntityManagerFactory> emFactories = module
                        .getEntityManagerFactories();
                if (emFactories.size() == 1) {
                    emf = emFactories.iterator().next();
                }
            }
        }

        // If we're in an .ear and no module-level persistence unit was
        // found, check for an application-level match.
        if ((app != null) && (emf == null)) {
            if (emfUnitName != null) {

                emf = app.getEntityManagerFactory(emfUnitName, module);

            } else {
                Set<EntityManagerFactory> emFactories = app
                        .getEntityManagerFactories();
                if (emFactories.size() == 1) {
                    emf = emFactories.iterator().next();
                }
            }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.Application

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.