Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.Application$DirectoryIntrospectionFilter


    public Application getApplication(String moduleName,
                                         File moduleRootDirectory,
                                           File moduleScratchDirectory,
                                               ModuleType moduleType) {
        try {
            Application app = null;
            BaseManager emMgr =
               (BaseManager)PluggableDeploymentInfo.
                    getExtensionModuleDeployer(moduleType).getConfigManager();
            FileArchive archive = emMgr.openDDArchive(moduleName,
                                         moduleRootDirectory.getAbsolutePath());          

            WebArchivist webArchivist = new WebArchivist();
            app = ApplicationArchivist.openArchive(moduleName,
                                               webArchivist, archive, true);
            //if(!isSystemAdmin(moduleName) && !isSystem(moduleName)) {
                // we need to read persistence descriptors separately
                    // because they are read from appDir as oppsed to xmlDir.
            emMgr.readPersistenceDeploymentDescriptors(
                                     moduleRootDirectory.getAbsolutePath(),
                                                                app);
            //}
                
            app.setGeneratedXMLDirectory(
                              moduleScratchDirectory.getAbsolutePath());
            if (!app.getWebServiceDescriptors().isEmpty()) {
            ModuleContentLinker visitor = new ModuleContentLinker(archive);
            app.visit(
                  (com.sun.enterprise.deployment.util.ApplicationVisitor) visitor);
            }
            return app;
        } catch (IOException ioe) {
            logger.log(Level.SEVERE,ioe.toString());
View Full Code Here


        
            // environment object for this server instance
            InstanceEnvironment env = ctx.getInstanceEnvironment();
        
            // application object associated with this ejb
            Application application = desc.getApplication();
            String dirName = null;
            String componentSeparator = "_";
            if (application.isVirtual()) {
                // ejb is part of a stand alone ejb module
    String archURI = desc.getEjbBundleDescriptor().
        getModuleDescriptor().getArchiveUri();
                passivationDirName = env.getModulePassivatedEjbPath()
        + File.separator + FileUtils.makeFriendlyFilename(archURI)
        + componentSeparator + desc.getName();
            } else {
                // ejb is part of an application
                passivationDirName = env.getApplicationPassivatedEjbPath()
        + File.separator + application.getRegistrationName()
        + componentSeparator + desc.getName()
        + componentSeparator + desc.getUniqueId();
            }
        
        } catch (Throwable th) {
View Full Code Here

                        boolean isSystemApp,
                        String realmName) {

        this.isSystemApp = isSystemApp;
        webDesc = descriptor;
        Application app = descriptor.getApplication();
        mapper = app.getRoleMapper();
        LoginConfiguration loginConfig = descriptor.getLoginConfiguration();
        _realmName = app.getRealm();
        if (_realmName == null && loginConfig != null) {
            _realmName = loginConfig.getRealmName();
        }
        if (realmName != null
                && (_realmName == null || _realmName.equals(""))) {
            _realmName = realmName;
        }

        // BEGIN IASRI 4747594
     CONTEXT_ID = WebSecurityManager.getContextID(descriptor);
        runAsPrincipals = new HashMap();
        Iterator bundle = webDesc.getWebComponentDescriptorsSet().iterator();
 
        while(bundle.hasNext()) {
           
            WebComponentDescriptor wcd = (WebComponentDescriptor)bundle.next();
            RunAsIdentityDescriptor runAsDescriptor = wcd.getRunAsIdentity();
     
            if (runAsDescriptor != null) {
                String principal = runAsDescriptor.getPrincipal();
                String servlet = wcd.getCanonicalName();
   
                if (principal == null || servlet == null) {
                    _logger.warning("web.realmadapter.norunas");
                } else {
                    runAsPrincipals.put(servlet, principal);
                    _logger.fine("Servlet "+servlet+
                     " will run-as: "+principal);
    }
      }
  } 
  // END IASRI 4747594

  this.appID = app.getRegistrationName();
        // helper are set until setVirtualServer is invoked
    }
View Full Code Here

     * @throws CmpCompilerException  if any other error occurs while generating concrete impls
     */
    void compile() throws CmpCompilerException, GeneratorException {
       
        // deployment descriptor object representation for the archive
        Application application = null;

        // deployment descriptor object representation for each module
        EjbBundleDescriptor bundle = null;

        // ejb name
        String beanName = null;

        // GeneratorException message if any
        StringBuffer generatorExceptionMsg = null;

        try {
            // scratchpad variable
            long time;

            // stubs dir for the current deployment
            File stubsDir = this._ejbcCtx.getStubsDir();

            application = this._ejbcCtx.getDescriptor();

            _logger.log(Level.FINE, "ejbc.processing_cmp",
                        application.getRegistrationName());

            Vector cmpFiles = new Vector();
            final ClassLoader jcl = application.getClassLoader();

            // For each Bundle  descriptor generate concrete class.
            Iterator bundleItr =
                application.getEjbBundleDescriptors().iterator();

            while ( bundleItr.hasNext() ) {

                bundle = (EjbBundleDescriptor)bundleItr.next();

                if (!bundle.containsCMPEntity()) {
                    continue;
                }
               
                // If it is a stand alone module then the srcDir is
                // the ModuleDirectory
                String archiveUri = (!application.isVirtual()) ?
                    DeploymentUtils.getEmbeddedModulePath(
                            this._ejbcCtx.getSrcDir().getCanonicalPath(),
                            bundle.getModuleDescriptor().getArchiveUri()):
                    this._ejbcCtx.getSrcDir().getCanonicalPath();

                if (com.sun.enterprise.util.logging.Debug.enabled) {
                    _logger.log(Level.FINE,"[CMPC] Module Dir name is "
                            + archiveUri);
                }

                String generatedXmlsPath = (!application.isVirtual()) ?
                    DeploymentUtils.getEmbeddedModulePath(
                            this._ejbcCtx.getDeploymentRequest().
                            getGeneratedXMLDirectory().getCanonicalPath(),
                            bundle.getModuleDescriptor().getArchiveUri()):
                    this._ejbcCtx.getDeploymentRequest().
                        getGeneratedXMLDirectory().getCanonicalPath();

                if (com.sun.enterprise.util.logging.Debug.enabled) {
                    _logger.log(Level.FINE,"[CMPC] Generated XML Dir name is "
                            + generatedXmlsPath);
                }

                IASPersistenceManagerDescriptor pmDesc =
                    bundle.getPreferredPersistenceManager();

                String  generatorName = null;
                if (null == pmDesc) {
                    generatorName = IASPersistenceManagerDescriptor.PM_CLASS_GENERATOR_DEFAULT;

                } else {
                    generatorName = pmDesc.getPersistenceManagerClassGenerator();

                    // Backward compatability:
                    // Support existing settings that have the old name.
                    if (generatorName.equals(
      IASPersistenceManagerDescriptor.PM_CLASS_GENERATOR_DEFAULT_OLD)) {

                        generatorName = IASPersistenceManagerDescriptor.PM_CLASS_GENERATOR_DEFAULT;
                    }
                }

                CMPGenerator gen = null;

                try {
        Class generator = getClass().getClassLoader().loadClass(generatorName);
                    gen = (CMPGenerator)generator.newInstance();

                } catch (Throwable e) {
                    String msg = localStrings.getString("cmpc.cmp_generator_class_error",
                            application.getRegistrationName(),
                            bundle.getModuleDescriptor().getArchiveUri());
                    _logger.log(Level.SEVERE, msg, e);
                    generatorExceptionMsg = addGeneratorExceptionMessage(msg,
                            generatorExceptionMsg);

                    continue;
                }

                try {
                    time = now();
                    gen.init(bundle, _ejbcCtx, archiveUri, generatedXmlsPath);
                    this._ejbcCtx.getTiming().cmpGeneratorTime += (now() - time);
         
                    Iterator ejbs=bundle.getEjbs().iterator();
   
                    while ( ejbs.hasNext() ) {
   
                        EjbDescriptor desc = (EjbDescriptor) ejbs.next();
                        beanName = desc.getName();

                        if (com.sun.enterprise.util.logging.Debug.enabled) {
                            _logger.log(Level.FINE,"[CMPC] Ejb Class Name: "
                                               + desc.getEjbClassName());
                        }
   
                        if ( desc instanceof IASEjbCMPEntityDescriptor ) {
   
                            // generate concrete CMP class implementation
                            IASEjbCMPEntityDescriptor entd =
                                (IASEjbCMPEntityDescriptor)desc;
   
                            if (com.sun.enterprise.util.logging.Debug.enabled) {
                                _logger.log(Level.FINE,
                                    "[CMPC] Home Object Impl name  is "
                                    + entd.getLocalHomeImplClassName());
                            }
   
                            // generate persistent class
                            entd.setClassLoader(jcl);
           
                            try {
                                time = now();
                                gen.generate(entd, stubsDir, stubsDir);
                                this._ejbcCtx.getTiming().cmpGeneratorTime +=
                                                                (now() - time);
   
                            } catch (GeneratorException e) {
                                String msg = e.getMessage();
                                _logger.log(Level.WARNING, msg);
                                generatorExceptionMsg = addGeneratorExceptionMessage(
                                        msg, generatorExceptionMsg);
                            }

                        /* WARNING: IASRI 4683195
                         * JDO Code failed when there was a relationship involved
                         * because it depends upon the orginal ejbclasname and hence
                         * this code is shifted to just before the Remote Impl is
                         * generated.Remote/Home Impl generation depends upon this
                         * value
                         */
   
                        } else if (desc instanceof EjbCMPEntityDescriptor ) {
                                //RI code here
                        }

                    } // end while ejbs.hasNext()

                    beanName = null;

                    time = now();
                    Collection col = gen.cleanup();
                    this._ejbcCtx.getTiming().cmpGeneratorTime += (now() - time);
   
                    for (Iterator fileIter=col.iterator();fileIter.hasNext();) {
                        File file=(File)fileIter.next();
                        String fileName=file.getPath();
                        _logger.log(Level.FINE,"[CMPC] File name is "+fileName);
                        cmpFiles.addElement(fileName);
                    }
                   
                } catch (GeneratorException e) {
                    String msg = e.getMessage();
                    _logger.log(Level.WARNING, msg);
                    generatorExceptionMsg = addGeneratorExceptionMessage(msg,
                            generatorExceptionMsg);
                }

            } // end of bundle

            bundle = null;

            if (generatorExceptionMsg == null) {
                // class path for javac
                String classPath =
                    getClassPath(this._ejbcCtx.getClasspathUrls(), stubsDir);

                time = now();
                IASEJBC.compileClasses(classPath, cmpFiles, stubsDir,
                                   stubsDir.getCanonicalPath(),
                                   this._ejbcCtx.getJavacOptions());

                this._ejbcCtx.getTiming().javaCompileTime += (now() - time);

                _logger.log(Level.FINE, "ejbc.done_processing_cmp",
                        application.getRegistrationName());
             }

        } catch (GeneratorException e) {
            _logger.log(Level.WARNING, e.getMessage());
            throw e;

        } catch (Throwable e) {
            String eType = e.getClass().getName();
            String appName = application.getRegistrationName();
            String exMsg = e.getMessage();

            String msg = null;
            if (bundle == null) {
                // Application or compilation error
View Full Code Here

    /** Calculate module name from a bundle.
     * @return module name.
     */
    public static String getModuleName(EjbBundleDescriptor bundle) {
        String moduleName = null;
        Application application = bundle.getApplication();
        if (application.isVirtual()) {
            // Stand-alone module is deployed.
            moduleName = application.getRegistrationName();

        } else {
            // Module is deployed as a part of an Application.
            String jarName = bundle.getModuleDescriptor().getArchiveUri();
            int l = jarName.length();
View Full Code Here

            } catch(java.io.IOException e) {
                throw new IASDeploymentException(e);
            }
           
            // loads the deployment descriptors
      Application app = loadDescriptors();
            // Set the generated XML directory in application desc
            request.getDescriptor().setGeneratedXMLDirectory(xmlDir.getAbsolutePath());
     
            WebBundleDescriptor bundleDesc = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();

            // The priority order of how the context root should be used:
            // 1. Context root specified by user (via --contextRoot option
            // or via gui), i.e. request.getContextRoot()
            // 2. Context root specified in sun-web.xml i.e.
View Full Code Here

            if(webModulesMgr == null){
                webModulesMgr =
                    (WebModulesManager)createConfigManager(getInstanceEnv(),
                                                           moduleEnv);
            }
      Application app = request.getDescriptor();
            WebBundleDescriptor wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
          
            // other things like creating the WebSecurityManager
            // this should create all permissions
            WebSecurityManager.createManager(wbd,true);
           
View Full Code Here

     */
    private ZipItem[] preDeployApp() throws Exception
    {
        ZipItem[] clientStubs = null;

        Application application = request.getDescriptor();

        String appRoot = ejbcContext.getSrcDir().getCanonicalPath();
      setEjbClasspath(request.getModuleClasspath());
        ejbcContext.setDescriptor(application);

        /*
         *Bug 4980750 - See also the comments in WebModuleDeployer
         *for a discussion of the root cause of this bug.  Use the List of classpath entries set by the
         *constructor (either by default to preserve the old behavior or via an explicit argument passed from
         *the method that instantiated EJBCompiler to supply an alternate classpath List).
         */
        // converts all the class paths to an array
        String[] classPathUrls = new String[this.classpathForCompilation.size()];
        classPathUrls = (String[]) this.classpathForCompilation.toArray(classPathUrls);
       
        ejbcContext.setClasspathUrls(classPathUrls);

        // verify ejbc context
        verifyContext();

        // calls ejbc
        clientStubs = IASEJBC.ejbc(this.ejbcContext);

        UniqueIdGenerator uidGenerator = UniqueIdGenerator.getInstance();
        long uid = uidGenerator.getNextUniqueId();

        application.setUniqueId(uid);

        this.appManager.saveAppDescriptor(this.name, application,
            request.getDeployedDirectory().getCanonicalPath(),
            request.getGeneratedXMLDirectory().getCanonicalPath(), false);

View Full Code Here

     */
    private ZipItem[] preDeployModule() throws Exception
    {
        ZipItem[] clientStubs = null;

        Application application = request.getDescriptor();
        ejbcContext.setDescriptor(application);

        /*
         *Bug 4980750 - See also the comments in WebModuleDeployer
         *for a discussion of the root cause of this bug.  Use the List of classpath entries set by the
         *constructor (either by default to preserve the old behavior or via an explicit argument passed from
         *the method that instantiated EJBCompiler to supply an alternate classpath List).
         */
        // converts all the class paths to an array
        String[] classPathUrls = new String[this.classpathForCompilation.size()];
        classPathUrls = (String[]) this.classpathForCompilation.toArray(classPathUrls);
       
        ejbcContext.setClasspathUrls(classPathUrls);

        // verify ejbc context
        verifyContext();

        // calls ejbc
        clientStubs = IASEJBC.ejbc(this.ejbcContext);
       
       
       
        UniqueIdGenerator uidGenerator = UniqueIdGenerator.getInstance();
        long uid = uidGenerator.getNextUniqueId();
       
        for (Iterator itr = application.getEjbBundleDescriptors().iterator();
            itr.hasNext();)
        {
           
            // for stand alone ejb module, there will be
            // one EjbBundleDescriptor
View Full Code Here

    protected HandlerContext getHandlerContext(Map map) {
        String realmName = null;
        WebServiceEndpoint wSE = (WebServiceEndpoint)
                map.get(PipeConstants.SERVICE_ENDPOINT);
        if (wSE != null) {
            Application app = wSE.getBundleDescriptor().getApplication();
            if (app != null) {
                realmName = app.getRealm();
            }
            if (realmName == null) {
                realmName = wSE.getRealm();
            }
        }
View Full Code Here

TOP

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

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.