Package com.sun.enterprise.deployment.archivist

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


    public void write(Application application, AbstractArchive out)
        throws IOException
    {
        if (application.isVirtual()) {
            ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().next();
            Archivist moduleArchivist = ArchivistFactory.getArchivistForType(aModule.getModuleType());
            write(aModule.getDescriptor(), moduleArchivist,  out);
        } else {
            // this is a real application.
           
            // let's start by writing out all submodules deployment descriptors
            for (Iterator modules = application.getModules();modules.hasNext();) {
                ModuleDescriptor aModule = (ModuleDescriptor) modules.next();
                Archivist moduleArchivist = ArchivistFactory.getArchivistForType(aModule.getModuleType());
                if (aModule.getAlternateDescriptor()!=null) {
                    // the application is using alternate deployment descriptors
                    String runtimeDDPath = "sun-" + aModule.getAlternateDescriptor();
                    DeploymentDescriptorFile ddFile = moduleArchivist.getConfigurationDDFile();
                    if (ddFile!=null) {
                        OutputStream os = out.putNextEntry(runtimeDDPath);
                        ddFile.write(aModule.getDescriptor(), os);
                        out.closeEntry();
                    }
View Full Code Here


     * @param the abstract archive
     */
    public void write(BundleDescriptor bundle, AbstractArchive out)
        throws IOException
    {
        Archivist archivist = ArchivistFactory.getArchivistForArchive(out);
        write(bundle, archivist, out);
    }
View Full Code Here

     */
    public void write(Application application, AbstractArchive in,
        AbstractArchive out) throws IOException {
        if (application.isVirtual()) {
            ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().next();
            Archivist moduleArchivist = ArchivistFactory.getArchivistForType(aModule.getModuleType());
            write(aModule.getDescriptor(), moduleArchivist, in, out);
        } else {
            // this is a real application.
           
            // let's start by writing out all submodules deployment descriptors
            for (Iterator modules = application.getModules();modules.hasNext();) {
                ModuleDescriptor aModule = (ModuleDescriptor) modules.next();
                Archivist moduleArchivist = ArchivistFactory.getArchivistForType(aModule.getModuleType());
                if (aModule.getAlternateDescriptor()!=null) {
                    // the application is using alternate deployment descriptors

                    // write or copy standard deployment descriptor
                    String ddPath = aModule.getAlternateDescriptor();
                    DeploymentDescriptorFile ddFile =
                        moduleArchivist.getStandardDDFile();           
                    
                    BundleDescriptor bundle =
                            (BundleDescriptor)aModule.getDescriptor();
                    if (!bundle.isFullFlag()) {
                        if (ddFile != null) {
                            OutputStream os = out.putNextEntry(ddPath);
                            ddFile.write(bundle, os);
                            out.closeEntry();
                        }
                    } else {
                        if (aModule.getModuleType().equals(ModuleType.WAR)) {
                            WebBundleDescriptor webBundle =
                                (WebBundleDescriptor) aModule.getDescriptor();
                            if (webBundle.hasWebServices()) {
                                if (ddFile != null) {
                                    OutputStream os = out.putNextEntry(ddPath);
                                    ddFile.write(webBundle, os);
                                    out.closeEntry();
                                }
                            } else {
                                Archivist.copyAnEntry(in, out, ddPath);
                            }
                        } else {
                            Archivist.copyAnEntry(in, out, ddPath);
                        }
                    }

                    String runtimeDDPath = "sun-" + ddPath;
                    DeploymentDescriptorFile confDDFile = moduleArchivist.getConfigurationDDFile();
                    if (confDDFile!=null) {
                        OutputStream os = out.putNextEntry(runtimeDDPath);
                        confDDFile.write(aModule.getDescriptor(), os);
                        out.closeEntry();
                    }
View Full Code Here

     * @param the abstract archive
     */
    public void write(BundleDescriptor bundle, AbstractArchive in, AbstractArchive out)
        throws IOException
    {
        Archivist archivist = ArchivistFactory.getArchivistForArchive(out);
        write(bundle, archivist, in, out);
    }
View Full Code Here

     *
     * @return the extension module archivist for the module type
     */
    public static ExtensionModuleArchivist getExtensionModuleArchivist(
        ModuleType moduleType) {
        Archivist archivist =  ArchivistFactory.getArchivistForType(moduleType);
        return (ExtensionModuleArchivist)archivist;
    }
View Full Code Here

                // If this is deployment scenario, we should process JavaEE
                // annotations and all deployment descriptors should be loaded
                // from module root directory

                archive.open(moduleRootDirectory.getAbsolutePath());
                Archivist moduleArchivist =
                    ArchivistFactory.getArchivistForArchive(archive);
                moduleArchivist.setAnnotationProcessingRequested(true);
                moduleArchivist.setClassLoader(moduleClassLoader);
                return ApplicationArchivist.openArchive(moduleArchivist,
                    archive, true);
            } else {
                // If this is server start up scenario, we do not need to
                // process JavaEE annotations again. The application
                // deployment descriptors will be loaded from
                // moduleScratchDirectory and persistence descriptors from
                // moduleRootDirectory

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

                    result.add(dirFile);
                } else if( fileType != null && !(fileType.endsWith("_deployed") ||
                       fileType.endsWith("_undeployed"))) {
                    try{
                        JarFile jarFile = new JarFile(dirFile);
                        Archivist archivist =
                               ArchivistFactory.getArchivistForArchive(dirFile);
                        if(archivist != null &&
                                archivist instanceof ExtensionModuleArchivist) {
                               result.add(dirFile);
                               addToExtensionFileType(dirFile);
View Full Code Here

                    sLogger.log(Level.WARNING, e.getMessage(), e);
                    return DeployableObjectType.WEB;
                }
            }

            Archivist archivist =
                ArchivistFactory.getArchivistForArchive(filePath);
            ModuleType moduleType = archivist.getModuleType();
            return getDeployableObjectType(moduleType);
        } catch (IOException ioe) {
            DeploymentException de = new DeploymentException(
                localStrings.getString(
                    "enterprise.deployment.ioexc_getting_archtype", filePath));
View Full Code Here

     * compatibility and clarity (uploaded file name is not descriptive).
     * @param file the deployed file
     * @return the moduleID derived from this file using the dd's display name
     */
    public String getModuleIDFromDD (File file) throws Exception {
        Archivist source = ArchivistFactory.getArchivistForArchive(file);
        InputJarArchive archive = new InputJarArchive();
        archive.open(file.getAbsolutePath());
        Descriptor descriptor = null;
        String moduleID = null;
        String displayName = null;
        try {
            descriptor = source.readStandardDeploymentDescriptor(archive);
        } catch (Exception ex) {
            //ignore
        }
        if (descriptor != null) {
            displayName = descriptor.getDisplayName();
View Full Code Here

    // START : Utility methods.
   
    private String createArchive(String dir, String archiveName) {
        String archivePath;
        try {
            Archivist archivist = ArchivistFactory.getArchivistForArchive(dir);
            ModuleType moduleType = archivist.getModuleType();
            String pathExtn = ".jar";
            if (ModuleType.EAR.equals(moduleType)) {
                pathExtn = ".ear";
            } else if (ModuleType.WAR.equals(moduleType)) {
                pathExtn = ".war";
View Full Code Here

TOP

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

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.