package com.perforce.spark.artifact.proxy; import java.io.File; import java.io.InputStream; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import org.apache.commons.fileupload.FileUploadException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import spark.Request; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.server.IOptionsServer; import com.perforce.spark.artifact.DefaultArtifact; import com.perforce.spark.artifact.ArtifactFactory; import com.perforce.spark.artifact.ArtifactInterface; import com.perforce.spark.depot.DepotFactory; import com.perforce.spark.depot.DepotModel; public class ProxyArtifact extends DefaultArtifact implements ArtifactInterface { private static Logger logger = LoggerFactory.getLogger(ProxyArtifact.class); private URL proxy; private Path path; public ProxyArtifact(IOptionsServer p4, URL proxy, String depot, String path) { super(p4); this.proxy = proxy; this.path = Paths.get(path); this.repoID = depot; } @Override public Path getPath() { String groupID = path.getParent().toString(); String id[] = { groupID }; Path depotPath = Paths.get(repoID, id); return depotPath; } @Override public DepotModel getDepot() throws P4JavaException { DepotModel depot = DepotFactory.getByName(p4, repoID); return depot; } @Override public List<String> populateWorkspace(File root) throws Exception { List<String> list = new ArrayList<>(); URL url = new URL(proxy, path.toString()); Path filename = path.getFileName(); Path filepath = Paths.get(root.toString(), filename.toString()); logger.info("proxy loading: " + url + " (" + filepath + ")"); InputStream in = url.openStream(); Files.copy(in, filepath); in.close(); list.add(filepath.toString()); return list; } @Override public void processForm(Request request) throws FileUploadException { // No form to process } @Override public void index() throws Exception { ArtifactInterface artifact = ArtifactFactory.getProxy(p4, repoID); artifact.index(); } @Override public void buildIndex() throws Exception { // no indexing } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15801 | Paul Allen | Experimental copy of PAM. | ||
//guest/paul_allen/p4am/src/main/java/com/perforce/spark/artifact/proxy/ProxyArtifact.java | |||||
#5 | 15313 | Paul Allen |
Added Client Workspace pool to manage parallel upload requests by the proxy (configuration set to 50). User uploads are restricted to only one per user. |
||
#4 | 15232 | Paul Allen | Fix on Artifact indexing | ||
#3 | 15221 | Paul Allen | Generate Gem index and submit after a deploy or proxy fetch event. | ||
#2 | 15218 | Paul Allen |
Index/catalog for Ruby. Plus depot names must be lower-case. |
||
#1 | 15094 | Paul Allen | Added support for Proxy and Group. | ||
//guest/paul_allen/p4am/src/main/java/com/perforce/spark/ProxyArtifact.java | |||||
#1 | 14886 | Paul Allen | Asset --> Artifact refactor | ||
//guest/paul_allen/p4am/src/main/java/com/perforce/spark/ProxyAsset.java | |||||
#5 | 14883 | Paul Allen | Submit via preview and redirect to asset | ||
#4 | 14742 | Paul Allen | update - still issues with upload. | ||
#3 | 14741 | Paul Allen | Fix upload for multiple files. | ||
#2 | 14017 | Paul Allen | Proxy caching to Perforce and SLF4J logging. | ||
#1 | 14013 | Paul Allen | Basic proxy |