Source:
public String deploy(BaseArtifactType artifact, Target target, SrampAtomApiClient client) throws Exception { InputStream is = null; OutputStream os = null; try { is = client.getArtifactContent(ArtifactType.valueOf(artifact), artifact.getUuid()); String deployDirProperty = target.getProperty(CUSTOM_DEPLOY_DIR_PROPERTY); File deployDir = new File(deployDirProperty); if (!deployDir.exists()) { logger.info(Messages.i18n.format("DeploymentResource.CreatingDeployDir", deployDir)); deployDir.mkdirs(); } String deploymentName = artifact.getName(); String mavenId = SrampModelUtils.getCustomProperty(artifact, "maven.artifactId"); String version = SrampModelUtils.getCustomProperty(artifact, "maven.version"); String classifier = SrampModelUtils.getCustomProperty(artifact, "maven.classifier"); String type = SrampModelUtils.getCustomProperty(artifact, "maven.type"); if (mavenId != null) { StringBuilder nameBuilder = new StringBuilder(); nameBuilder.append(mavenId); nameBuilder.append("-"); nameBuilder.append(version); if (classifier != null) { nameBuilder.append("-"); nameBuilder.append(classifier); } nameBuilder.append("."); nameBuilder.append(type); deploymentName = nameBuilder.toString(); } File file = new File(deployDir + "/" + deploymentName); if (file.exists()) file.delete(); file.createNewFile(); os = new FileOutputStream(file); IOUtils.copy(is, os); Map<String, String> props = new HashMap<String, String>(); props.put("deploy.copy.file", file.getCanonicalPath()); recordUndeploymentInfo(artifact, target, props, client); logger.info(Messages.i18n.format("CopyFileDeployer.deploymentSuccessfully", artifact.getUuid())); return file.getAbsolutePath(); } finally { IOUtils.closeQuietly(os); IOUtils.closeQuietly(is); } }

Target:
public String deploy(BaseArtifactType artifact, Target target, SrampAtomApiClient client) throws Exception { InputStream is = null; OutputStream os = null; try { is = client.getArtifactContent(ArtifactType.valueOf(artifact), artifact.getUuid()); String deployDirProperty = target.getProperty(CUSTOM_DEPLOY_DIR_PROPERTY); File deployDir = new File(deployDirProperty); if (!deployDir.exists()) { logger.info("Creating Directory for deployment:"+ deployDir); deployDir.mkdirs(); } String deploymentName = artifact.getName(); String mavenId = SrampModelUtils.getCustomProperty(artifact, "maven.artifactId"); String version = SrampModelUtils.getCustomProperty(artifact, "maven.version"); String classifier = SrampModelUtils.getCustomProperty(artifact, "maven.classifier"); String type = SrampModelUtils.getCustomProperty(artifact, "maven.type"); if (mavenId != null) { StringBuilder nameBuilder = new StringBuilder(); nameBuilder.append(mavenId); nameBuilder.append("-"); nameBuilder.append(version); if (classifier != null) { nameBuilder.append("-"); nameBuilder.append(classifier); } nameBuilder.append("."); nameBuilder.append(type); deploymentName = nameBuilder.toString(); } File file = new File(deployDir + "/" + deploymentName); if (file.exists()) file.delete(); file.createNewFile(); os = new FileOutputStream(file); IOUtils.copy(is, os); Map<String, String> props = new HashMap<String, String>(); props.put("deploy.copy.file", file.getCanonicalPath()); recordUndeploymentInfo(artifact, target, props, client); logger.info("The deployment of the artifact with UUID=" + artifact.getUuid() + " has been successfully done."); return file.getAbsolutePath(); } finally { IOUtils.closeQuietly(os); IOUtils.closeQuietly(is); } }