use of org.commonjava.maven.galley.filearc.internal.FilePublish in project galley by Commonjava.
the class FileTransport method createPublishJob.
@Override
public PublishJob createPublishJob(final ConcreteResource resource, final InputStream stream, final long length, final String contentType, final int timeoutSeconds) throws TransferException {
final File pubDir = config.getPubDir();
if (pubDir == null) {
throw new TransferException("This transport is read-only!");
}
final File dest = new File(pubDir, config.getGenerator().getFilePath(resource));
final File dir = dest.getParentFile();
if (dir != null && !dir.exists() && !dir.mkdirs()) {
throw new TransferException("Cannot create directory: %s", dir);
}
return new FilePublish(dest, stream);
}
Aggregations