package org.jenkinsci.plugins.p4.workspace; import hudson.model.AutoCompletionCandidates; import hudson.model.Descriptor; import hudson.util.FormValidation; import hudson.util.ListBoxModel; import java.util.List; import java.util.logging.Logger; import org.jenkinsci.plugins.p4.client.ConnectionFactory; import org.kohsuke.stapler.QueryParameter; import com.perforce.p4java.client.IClient; import com.perforce.p4java.client.IClientSummary; import com.perforce.p4java.server.IOptionsServer; public abstract class WorkspaceDescriptor extends Descriptor<Workspace> { private static Logger logger = Logger.getLogger(WorkspaceDescriptor.class .getName()); public WorkspaceDescriptor(Class<? extends Workspace> clazz) { super(clazz); } protected WorkspaceDescriptor() { } /** * Magic Stapler method; provides list of Charset types. */ public ListBoxModel doFillCharsetItems() { ListBoxModel list = new ListBoxModel(); try { IOptionsServer p4 = ConnectionFactory.getConnection(); for (String set : p4.getKnownCharsets()) { list.add(set); } } catch (Exception e) { } if (list.isEmpty()) { list.add("none"); } return list; } public FormValidation checkClientName(String value) { try { IOptionsServer p4 = ConnectionFactory.getConnection(); if (p4 == null) { // refresh issue; sometimes not available return FormValidation.ok(); } IClient client = p4.getClient(value); if (client != null) { return FormValidation.ok(); } return FormValidation.warning("Unknown Client: " + value); } catch (Exception e) { return FormValidation.error(e.getMessage()); } } public AutoCompletionCandidates autoCompleteName( @QueryParameter String value) { AutoCompletionCandidates c = new AutoCompletionCandidates(); try { IOptionsServer iserver = ConnectionFactory.getConnection(); if (iserver != null && value.length() > 0) { String user = iserver.getUserName(); List<IClientSummary> list; list = iserver.getClients(user, value + "*", 10); for (IClientSummary l : list) { c.add(l.getName()); } } } catch (Exception e) { } return c; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11053 | Paul Allen | Branching using p4-jenkins | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/workspace/WorkspaceDescriptor.java | |||||
#1 | 9690 | Paul Allen |
[Branching using p4-jenkins] Release 1.0.1 |
||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4/workspace/WorkspaceDescriptor.java | |||||
#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/WorkspaceDescriptor.java | |||||
#6 | 9133 | Paul Allen |
Added Workspace mode for versioned Client Specs. Client Spec can be specified by depot path and used to configure workspace for build. - Includes fix for removing header when using p4 print. |
||
#5 | 9038 | Paul Allen |
Improved error messages for Form Validate field checks. Uses Perforce Server messages (TPI-80) |
||
#4 | 8929 | Paul Allen |
Clean up doCheck Warnings on configuration page (TPI-80). - Added check exceptions to log as warnings. |
||
#3 | 8896 | Paul Allen | Moved common method 'doFillCharsetItems' into abstract class 'WorkspaceDescriptor'. | ||
#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. |