Package com.sun.enterprise.deployment.archivist

Examples of com.sun.enterprise.deployment.archivist.ApplicationArchivist


                    write(aModule.getDescriptor(),  moduleArchivist, moduleArchive);
                }
            }
           
            // now let's write the application runtime descriptor
            ApplicationArchivist archivist = new ApplicationArchivist();
            archivist.setDescriptor(application);
            archivist.writeRuntimeDeploymentDescriptors(out);                       
        }
    }
View Full Code Here


                    write(aModule.getDescriptor(),  moduleArchivist, moduleArchive2, moduleArchive);
                }
            }
           
            // now let's write the application descriptor
            ApplicationArchivist archivist = new ApplicationArchivist();
            archivist.setDescriptor(application);
            archivist.writeRuntimeDeploymentDescriptors(out);
            if (application.isLoadedFromApplicationXml()) {  
                archivist.copyStandardDeploymentDescriptors(in, out);
            } else {
                archivist.writeStandardDeploymentDescriptors(out);
            }
        }
    }
View Full Code Here

        // 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();
View Full Code Here

        // we need to load this puppy, save it in the cache...
        try {
            String appDir = getLocation(appId);
            FileArchive in = openDDArchive(appId, appDir);

            ApplicationArchivist archivist = new ApplicationArchivist();
            archivist.setClassLoader(application.getClassLoader());
            archivist.readModulesDescriptors(application, in);
            archivist.readRuntimeDeploymentDescriptor(in, application);
            if(!isSystemAdmin(appId) && !isSystem(appId)) {
                // we need to read persistence descriptors separately
                // because they are read from appDir as oppsed to xmlDir.
                readPersistenceDeploymentDescriptors(appDir, application);
            }
            archivist.setDescriptor(application);

            // use temp CL that is set in the application. For details,
            // see https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
            archivist.validate(application.getClassLoader());
           
            application.setGeneratedXMLDirectory(getGeneratedXMLLocation(appId));
           
            if (!application.getWebServiceDescriptors().isEmpty()) {
                ModuleContentLinker visitor = new ModuleContentLinker(in);
View Full Code Here

            return getApplicationFromAppXml(archive);
        }
    }

    private static Application getApplicationFromAppXml(AbstractArchive archive) {
        ApplicationArchivist archivist = new ApplicationArchivist();
        archivist.setXMLValidation(false);

        // read the standard deployment descriptors
        Application application = null;
        try {
            application =
                (Application) archivist.readStandardDeploymentDescriptor(archive);
        } catch (Exception ex) {
            //@@@ i18n
            _logger.log(Level.SEVERE,
                "Error loading application.xml from " + archive.getArchiveUri());
            _logger.log(Level.SEVERE, ex.getMessage());
View Full Code Here

    }

    private void createEar(String explodedDir, String earFilePath)
            throws Exception {
        // create the application object.
        ApplicationArchivist archivist = new ApplicationArchivist();
        FileArchive appArchive = new FileArchive();
        appArchive.open(new File(explodedDir).getAbsolutePath());
        archivist.setManifest(appArchive.getManifest());
        Application application = null;
        if (archivist.hasStandardDeploymentDescriptor(appArchive)) {
            application = (Application)
                    archivist.readStandardDeploymentDescriptor(appArchive);
        } else {
            application = Application.createApplication(appArchive, true, true);
        }
        archivist.setDescriptor(application);

        Iterator<ModuleDescriptor> bundles = application.getModules();
        // archive all the modules first.
        while (bundles.hasNext()) {
            ModuleDescriptor bundle = bundles.next();
View Full Code Here

       
        // first explode the ear file
        explodeJar(source, destination);
       
        // now we need to load the application standard deployment descriptor.
        ApplicationArchivist archivist = new ApplicationArchivist();
        archivist.setXMLValidationLevel(getValidationLevel());
        FileArchive appArchive = new FileArchive();
        appArchive.open(destination.getAbsolutePath());
       
        archivist.setManifest(appArchive.getManifest());
       
        // read the standard deployment descriptors
        Application appDesc = null;
        if (archivist.hasStandardDeploymentDescriptor(appArchive)) {
            appDesc = (Application)
            archivist.readStandardDeploymentDescriptor(appArchive);
        } else {
            appDesc = Application.createApplication(appArchive,true);
        }

        archivist.setDescriptor(appDesc);
       
        // ok we should now have the list of modules, so we can happily explode them...
        Iterator<ModuleDescriptor> bundles = appDesc.getModules();
        while (bundles.hasNext()) {
           
View Full Code Here

    private void createApplicationDescriptor() throws IOException,
            SAXParseException {
// the code below is used by the deploytool GUI.           
        PluggableArchivistsHelper defaultArchivists = new PluggableArchivistsHelper();
        defaultArchivists.registerArchivist(new ApplicationArchivist());
        defaultArchivists.registerArchivist(new WebArchivist());
        defaultArchivists.registerArchivist(new EjbArchivist());
        defaultArchivists.registerArchivist(new ConnectorArchivist());
        defaultArchivists.registerArchivist(new AppClientArchivist());
        AbstractArchive abstractArchive =
View Full Code Here


                // loads application with only the clients
                Application app = null;
                try {
                    ApplicationArchivist arch = new ApplicationArchivist();
                    arch.setAnnotationProcessingRequested(true);

                    // Set class loader here before opening archive
                    // to enable validation.
                    arch.setClassLoader(jcl);
                    app = (Application) arch.open(appClientFile);

                } catch (Throwable t) {
                   _logger.log(Level.WARNING, "acc.failed_load_client_desc",
                        clientJar);
                    throw t;
                }
                app.setClassLoader(jcl);
                appDesc = null;

    int appclientCount = 0;
    for (Iterator itr =
                    app.getApplicationClientDescriptors().iterator();
                    itr.hasNext();) {
        ApplicationClientDescriptor next =
          (ApplicationClientDescriptor) itr.next();
        appclientCount++;
    }

                for (Iterator itr =
                    app.getApplicationClientDescriptors().iterator();
                    itr.hasNext();) {

                    ApplicationClientDescriptor next =
                        (ApplicationClientDescriptor) itr.next();
        if (appclientCount == 1) {         
      //for -mainclass <class name> option
      if (mainClass != null) {
          if (!next.getMainClassName().equals(mainClass)) {
              next.setMainClassName(mainClass);
          }
      }
      appDesc = next;
      break;           
        } else {//app contains multiple app client jars
            if (mainClass != null) {
          if (next.getMainClassName().equals(mainClass)) {
              appDesc = next;
        break;
          }
      } else {
          if (displayName == null) {
              _logger.log(Level.SEVERE,"acc.no_mainclass_or_displayname");
        System.exit(1);
          } else if (displayName != null && next.getName().equals(displayName)) {
              if(appDesc == null) {
            appDesc = next;         
        } else {
            //multiple app duplicated display name
            _logger.log(Level.WARNING, "acc.duplicate_display_name");
            System.exit(1);
        }
          }     
      }
        }
                   
                }
                //construct AppContainer using appDesc
                if (appDesc != null) {
                    container = new AppContainer(appDesc, guiAuth);
                    // the archive uri must have absolute path
                    //f = new File (f, appDesc.getModuleDescriptor().getArchiveUri());
                }
            } else {

                // we are dealing with a class file or a client jar
       
                // reads std & iAS application xml

                try {
                    // Set classloader before opening archive to enable
                    // validation.
                    AppClientArchivist arch = new AppClientArchivist();
                    arch.setAnnotationProcessingRequested(true);
                    arch.setClassLoader(jcl);

                    // for class case, get default bundle
                    if (className!=null) {
                        appDesc = (ApplicationClientDescriptor) arch.getDefaultBundleDescriptor();
                    } else {
                        // for client jar case, do not process annotations.
                        // use AppClientArchivist.open(String) instead of
                        // AppClientArchivist.open(AbstractArchive) since the
                        // open(String) method calls validate.
                        appDesc = (ApplicationClientDescriptor) arch.open(appClientFile.getAbsolutePath());
                    }

                    if (className!=null) {
                        // post masssaging
                        AbstractArchive archive;
                        if (appClientFile.isDirectory()) {
                            archive = new FileArchive();
                            ((FileArchive) archive).open(appClientFile.getAbsolutePath());
                        } else {
                            archive = new InputJarArchive();
                            ((InputJarArchive) archive).open(appClientFile.getAbsolutePath());
                        }

                        if (appDesc.getMainClassName()==null || appDesc.getMainClassName().length()==0) {
                            appDesc.setMainClassName(className);
                            arch.processAnnotations(appDesc, archive);
                           
                            // let's remove our appArgs first element since it was the app client class name
                            //...but only if this is not a Java Web Start launch.
                            if (mainClass==null && ! isJWS) {
                                appArgs.removeElementAt(0);
View Full Code Here

        // now we need to load the application standard deployment descriptor.
        FileArchive appArchive = new FileArchive();
        appArchive.open(tmpDir.getAbsolutePath());

        ApplicationArchivist archivist = new ApplicationArchivist();
        if (archivist.hasStandardDeploymentDescriptor(appArchive)) {
            appDesc = (Application)
            archivist.readStandardDeploymentDescriptor(appArchive);
        } else {
            appDesc = Application.createApplication(appArchive,true);
        }
       
        // explode the sub modules, skipping the ones that do not exist since
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.archivist.ApplicationArchivist

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.