package org.jenkinsci.plugins.p4.workspace; import hudson.DescriptorExtensionList; import hudson.ExtensionPoint; import hudson.model.Describable; import hudson.model.Hudson; import java.util.HashMap; import java.util.Map; import java.util.Set; import com.perforce.p4java.client.IClient; import com.perforce.p4java.server.IOptionsServer; public abstract class Workspace implements ExtensionPoint, Describable<Workspace> { private String charset; private String rootPath; private String hostname; private Map<String, String> formatTags; public Workspace(String charset) { this.charset = charset; } public abstract WorkspaceType getType(); public abstract String getName(); public String getCharset() { return charset; } /** * Setup/Create a Perforce workspace for this mode. * * @param connection * @param user * @return Perforce client * @throws Exception */ public abstract IClient setClient(IOptionsServer connection, String user) throws Exception; public WorkspaceDescriptor getDescriptor() { return (WorkspaceDescriptor) Hudson.getInstance().getDescriptor( getClass()); } public static DescriptorExtensionList<Workspace, WorkspaceDescriptor> all() { return Hudson.getInstance() .<Workspace, WorkspaceDescriptor> getDescriptorList( Workspace.class); } public String getRootPath() { return rootPath; } public void setHostName(String hostname) { this.hostname = hostname; } public String getHostName() { return hostname; } public void setRootPath(String rootPath) { this.rootPath = rootPath; } public Set<String> getTags() { return formatTags.keySet(); } public String getFormattedName(String format) { String name = format; for (String tag : formatTags.keySet()) { String value = formatTags.get(tag); if (value != null) { name = name.replace("${" + tag + "}", value); } } return name; } public void set(String tag, String value) { if (formatTags == null) formatTags = new HashMap<String, String>(); formatTags.put(tag, value); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 9964 | Paul Allen | More updates to code for new 1.569 plugin version. | ||
#6 | 9798 | Paul Allen |
Clone Workspace as Build Matrix was using the same object. https://issues.jenkins-ci.org/browse/JENKINS-24027 |
||
#5 | 9797 | Paul Allen |
Workspace name filter Replace restricted characters with "-" as per the old plugin |
||
#4 | 9754 | Paul Allen | Clear Workspace environment betweeen builds. | ||
#3 | 9750 | Paul Allen |
Add support for Environment variables. Includes cleanup of Perforce exception reporting for Connections and Workspaces. |
||
#2 | 9736 | Paul Allen |
Custom build args for Workspace names. Takes `${parameter}` and replaces it with the value if defined or uses the tag (`parameter` in this case). Includes substitution for a space ` ` with `_` as per P4 behaviour. |
||
#1 | 9672 | Paul Allen | Refactor name from 'p4_client' to 'p4'. | ||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4_client/workspace/Workspace.java | |||||
#7 | 9495 | Paul Allen |
Fix Polling issue; using the wrong client. Removed static classes and internal referenced to PerforceScm attributes, to avoid threading issues. |
||
#6 | 8902 | Paul Allen |
Updated test cases: Pushed Workspace 'charset' to abstract Workspace class. Minor bugfixes in Workspace AutoCompletionCandidates method. |
||
#5 | 8899 | Paul Allen | Move Workspace setup/creation code to Implementation class. | ||
#4 | 8738 | Paul Allen |
Workspace Name Formatter. For Template and Stream workspaces it allows the substitution of the following tags: ${node} The name given to the slave Jenkins node. ${hostname} The hostname for the slave Jenkins node. ${project} The name of the Jenkins build Job. ${hash} Unique hash code of the Jenkins node. |
||
#3 | 8663 | Paul Allen | Rollout of charset for all Workspace modes. | ||
#2 | 8641 | Paul Allen | Added workspace helper (setClient) and template/stream types. | ||
#1 | 8640 | Paul Allen |
Added Workspace and Singleton descriptor. Removed old connection code. |