/** * Gets the work directory for this web application. * * The work directory is either * generated/jsp/$appID/$moduleID * or * generated/jsp/$moduleID */ public synchronized String getWorkDir() { if (workDir == null) { if (deploymentContext != null && deploymentContext.getScratchDir( "jsp") != null) { workDir = deploymentContext.getScratchDir("jsp").getPath(); } else { workDir = getWebDir(_baseDir); } } return workDir; }
private ZipOutputStream addScratchContentIfPresent(final DeploymentContext dc, final File baseDir, ZipOutputStream zipOS, final File generatedContentZip, final String scratchDirName) throws IOException { final File genDir = dc.getScratchDir(scratchDirName); if (genDir.isDirectory()) { if (zipOS == null) { zipOS = new ZipOutputStream( new BufferedOutputStream(new FileOutputStream(generatedContentZip))); } addFileToZip(zipOS, baseDir, genDir); } return zipOS; }
private ZipOutputStream addScratchContentIfPresent(final DeploymentContext dc, final File baseDir, ZipOutputStream zipOS, final File generatedContentZip, final String scratchDirName) throws IOException { final File genDir = dc.getScratchDir(scratchDirName); if (genDir.isDirectory()) { if (zipOS == null) { zipOS = new ZipOutputStream( new BufferedOutputStream(new FileOutputStream(generatedContentZip))); } addFileToZip(zipOS, baseDir, genDir); } return zipOS; }
private void addArtifactsForAppClient(){ ClientArtifactsManager cArtifactsManager = ClientArtifactsManager.get(context); for (int i = 0; i < files.size(); i ++) { URI baseURI = context.getScratchDir("ejb").toURI(); File file = new File(files.get(i)); URI artifact = baseURI.relativize(file.toURI()); //Fix for issue 9734 if (!cArtifactsManager.contains(baseURI,artifact) ){ cArtifactsManager.add(baseURI, artifact); } } }
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()); } } }
protected static Permission convertTempDirPermission(PermissionCollection revisedPC, DeploymentContext context, FilePermission perm) throws MalformedURLException { if (!isFilePermforTempDir(perm)) { return perm; } String actions = perm.getActions(); if (context.getScratchDir("jsp") != null) { String jspdir = context.getScratchDir("jsp").toURI().toURL().toString(); Permission jspDirPerm = new FilePermission(jspdir, actions); revisedPC.add(jspDirPerm); Permission jspPerm = new FilePermission(jspdir + File.separator + "-", actions); revisedPC.add(jspPerm); return jspPerm; } return perm; }
final File baseDir = dc.getScratchDir("xml").getParentFile().getParentFile();
final File baseDir = dc.getScratchDir("xml").getParentFile().getParentFile();
if (context.getScratchDir("ejb") != null) { cloader.addRepository(context.getScratchDir("ejb").toURI().toURL().toString().concat("/")); if (context.getScratchDir("jsp") != null) { cloader.setWorkDir(context.getScratchDir("jsp"));
classpath.append(ctx.getScratchDir("ejb").toURI().getPath()); classpath.append(File.pathSeparator);
revisedPC.add(rootPerm); if (context.getScratchDir("ejb") != null) { String ejbTmpDir = context.getScratchDir("ejb").toURI().toURL().toString(); Permission ejbDirPerm = new FilePermission(ejbTmpDir, actions); revisedPC.add(ejbDirPerm); if (context.getScratchDir("jsp") != null) { String jspdir = context.getScratchDir("jsp").toURI().toURL().toString(); Permission jpsDirPerm = new FilePermission(jspdir, actions); revisedPC.add(jpsDirPerm);
ctx.getScratchDir("ejb").getCanonicalPath() + File.separator; } catch (Exception e) { throw new RuntimeException(
/** * This is to be used for filepublishing only. Incase of wsdlImports and wsdlIncludes * we need to copy the nested wsdls from applications folder to the generated/xml folder * */ private void copyExtraFilesToGeneratedFolder( DeploymentContext context) throws IOException{ Archivist archivist = habitat.getByContract(Archivist.class); ReadableArchive archive = archiveFactory.openArchive( context.getSourceDir()); WritableArchive archive2 = archiveFactory.createArchive( context.getScratchDir("xml")); // copy the additional webservice elements etc archivist.copyExtraElements(archive, archive2); }
File wsdlDir = dc.getScratchDir("xml"); wsdlDir.mkdirs(); File stubsDir = dc.getScratchDir("ejb"); stubsDir.mkdirs();
cloader.addURL(context.getScratchDir("ejb").toURI().toURL());
/** * @see CMPGenerator#init(org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl, DeploymentContext, String, String) */ public void init(EjbBundleDescriptorImpl bundle, DeploymentContext ctx, String bundlePathName, String generatedXmlsPathName) throws GeneratorException { if (logger.isLoggable(Logger.FINE)) logger.fine("cmp gen init"); // NOI18N this.ctx = ctx; this.generatedXmlsPath = generatedXmlsPathName; this.inputFilesPath = bundlePathName; this.classout = ctx.getScratchDir("ejb"); // "generated/ejb" dir this.appName = ctx.getModuleMetaData(Application.class).getRegistrationName(); init(bundle, ctx.getClassLoader(), bundlePathName, false); }
cloader.addURL(context.getScratchDir("ejb").toURI().toURL());
WebBundleDescriptor.class); try { final File outDir = dc.getScratchDir(env.kCompileJspDirName); final File inDir = dc.getSourceDir(); boolean delegate = true;
File genXmlDir = dc.getScratchDir("xml");
File stubsDir = deploymentCtx.getScratchDir("ejb"); String explodedDir = deploymentCtx.getSource().getURI().getSchemeSpecificPart();