/** * Just a convienence method to return the key cast to the appropriate type. * * @return the key cast to the appropriate sub-type */ public ContentProviderPackageDetailsKey getContentProviderPackageDetailsKey() { return (ContentProviderPackageDetailsKey) super.getKey(); }
/** * Creates a new package described by the specified details. The destination of the content in the provided input * stream will be determined by the package name. * * @param details describes the package being created * @param content content to be written for the package. NOTE this Stream will be closed by this method. * @param unzip if <code>true</code>, the content stream will be treated like a ZIP file and be unzipped as * it is written, using the package name as the base directory; if <code>false</code> the * @param createBackup If <code>true</code>, the original file will be backed up to file.bak */ public void createContent(PackageDetails details, File content, boolean unzip) { File destination = getPath(details); try { if (unzip) { ZipUtil.unzipFile(content, destination); } else { FileUtil.copyFile(content, destination); } details.setFileName(destination.getPath()); } catch (IOException e) { throw new RuntimeException("Error creating artifact from details: " + destination, e); } }
public File getPath(PackageDetails details) { /* JBNADM-2022 - It still needs to be determined if it is the responsibility of the plugin container or the * plugin to be concerned with path information in the package name. For now, it's the plugin's * responsibility. We strip out the path information to keep control of where the JARs are * deployed to. Note: when we add support for more package types, we'll need to refactor this * out on a package type basis. * * jdobies, Sep 20, 2007 */ PackageDetailsKey key = details.getKey(); String fileName = key.getName(); int lastPathStart = fileName.lastIndexOf(File.separatorChar); if (lastPathStart > -1) { fileName = fileName.substring(lastPathStart + 1); } return new File(this.deployDirectory, fileName); }
/** * JBNADM-2022 - It still needs to be determined if it is the responsibility of the plugin container or the * plugin to be concerned with path information in the package name. For now, it's the plugin's * responsibility. We strip out the path information to keep control of where the JARs are * deployed to. Note: when we add support for more package types, we'll need to refactor this * out on a package type basis. * @param details package details * @return destination path */ private File getPath(PackageDetails details) { String fileName = details.getKey().getName(); int lastPathStart = fileName.lastIndexOf(File.separatorChar); if (lastPathStart > -1) { fileName = fileName.substring(lastPathStart + 1); } if (this.fileEnding != null && !fileName.endsWith(this.fileEnding)) { fileName = fileName + this.fileEnding; } return new File(this.directory, fileName); } }