/** * writes a bundle descriptor * @param the bundle descriptor * @param the abstract archive */ public void write(BundleDescriptor bundle, ReadableArchive in, WritableArchive out) throws IOException { Archivist archivist = archivistFactory.getArchivist(in, bundle.getClassLoader()); write(bundle, archivist, in, out); }
protected void saveAppDescriptor(Application application, DeploymentContext context) throws IOException { if (application != null) { ReadableArchive archive = archiveFactory.openArchive( context.getSourceDir()); boolean isMkdirs = context.getScratchDir("xml").mkdirs(); if (isMkdirs) { WritableArchive archive2 = archiveFactory.createArchive( context.getScratchDir("xml")); descriptorArchivist.write(application, archive, archive2); // copy the additional webservice elements etc applicationArchivist.copyExtraElements(archive, archive2); } else { context.getLogger().log(Level.WARNING, "Error in creating directory " + context.getScratchDir("xml").getAbsolutePath()); } } }
/** * writes an application deployment descriptors * @param the application object * @param the abstract archive */ public void write(Application application, ReadableArchive in, WritableArchive out) throws IOException { if (application.isVirtual()) { ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next(); Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out); } else { // this is a real application. // let's start by writing out all submodules deployment descriptors for (ModuleDescriptor aModule : application.getModules()) { Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri()); ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive); } // now let's write the application descriptor ApplicationArchivist archivist = archivistProvider.get(); archivist.setDescriptor(application); archivist.writeDeploymentDescriptors(in, out); } }
Archivist ejbArchivist = archivistFactory.getArchivist(XModuleType.EJB); write(ejbBundle, ejbArchivist, in, out);
ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next(); Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out); } else { WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri()); ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive);