public class ConnectionHelper extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected AuthorisationConfig |
authorisationConfig |
protected com.perforce.p4java.server.IOptionsServer |
connection |
protected ConnectionConfig |
connectionConfig |
protected hudson.model.TaskListener |
listener |
protected P4BaseCredentials |
p4credential |
protected Validate |
validate |
Constructor and Description |
---|
ConnectionHelper(hudson.model.ItemGroup context,
String credentialID,
hudson.model.TaskListener listener) |
ConnectionHelper(hudson.model.Item job,
String credentialID,
hudson.model.TaskListener listener) |
ConnectionHelper(P4BaseCredentials credential) |
ConnectionHelper(P4BaseCredentials credential,
hudson.model.TaskListener listener) |
ConnectionHelper(hudson.model.Run run,
String credentialID,
hudson.model.TaskListener listener) |
ConnectionHelper(String credentialID,
hudson.model.TaskListener listener)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
abort() |
boolean |
checkVersion(int min)
Checks the Perforce server version number and returns true if greater
than or equal to the min version.
|
void |
close() |
void |
deleteClient(String name)
Delete a client workspace
|
void |
disconnect()
Disconnect from the Perforce Server.
|
static P4BaseCredentials |
findCredential(String id)
Deprecated.
|
static P4BaseCredentials |
findCredential(String credentialsId,
hudson.model.Item item)
Finds a Perforce Credential based on credentials ID and
Item . |
static P4BaseCredentials |
findCredential(String credentialsId,
hudson.model.ItemGroup context)
Finds a Perforce Credential based on the String id.
|
static P4BaseCredentials |
findCredential(String credentialsId,
hudson.model.Run run)
Finds a Perforce Credential based on the String id and
Run . |
List<com.perforce.p4java.core.file.IFileSpec> |
getChangeFiles(int id,
int limit) |
com.perforce.p4java.core.IChangelistSummary |
getChangeSummary(long id) |
List<com.perforce.p4java.core.file.IFileSpec> |
getCommitFiles(String repo,
String sha) |
com.perforce.p4java.server.IOptionsServer |
getConnection() |
String |
getCounter(String id)
Get Perforce Counter
|
List<com.perforce.p4java.core.file.IFileSpec> |
getDirs(List<String> paths)
Gets a list of Dirs given a path (multi-branch?)
|
String |
getEmail(String userName) |
com.perforce.p4java.graph.ICommit |
getGraphCommit(String sha,
String repo) |
P4Ref |
getGraphHead(String repo)
Get the last SHA commited to the specified repo.
|
List<com.perforce.p4java.core.IFix> |
getJobs(int id) |
com.perforce.p4java.impl.generic.core.Label |
getLabel(String id)
Get Perforce Label
|
List<com.perforce.p4java.core.file.IFileSpec> |
getLabelFiles(String id,
int limit)
Find all files within a label or change.
|
protected int |
getMaxChangeLimit() |
String |
getPort() |
int |
getRetry() |
List<com.perforce.p4java.core.file.IFileSpec> |
getShelvedFiles(int id)
Find all files within a shelf.
|
List<com.perforce.p4java.core.IStreamSummary> |
getStreams(List<String> paths)
Gets a list of Dirs given a path (multi-stream?)
|
String |
getSwarm() |
String |
getTicket() |
String |
getTrust() |
String |
getUser() |
boolean |
hasAborted() |
boolean |
isClient(String name)
Test if given name is a client
|
boolean |
isConnected() |
boolean |
isCounter(String name)
Test if given name is a counter
|
boolean |
isLabel(String name)
Test if given name is a label
|
boolean |
isUnicode() |
List<com.perforce.p4java.core.IRepo> |
listAllRepos()
List all Graph Repos
|
List<P4Ref> |
listCommits(List<P4Ref> fromRefs,
P4Ref to)
List graph Commits with in range of SHAs
|
List<com.perforce.p4java.core.IRepo> |
listRepos(String path)
List of Graph Repos based on a path
|
void |
log(String msg) |
boolean |
login() |
void |
logout() |
void |
setLabel(com.perforce.p4java.impl.generic.core.Label label)
Create/Update a Perforce Label
|
protected final ConnectionConfig connectionConfig
protected final AuthorisationConfig authorisationConfig
protected com.perforce.p4java.server.IOptionsServer connection
protected final hudson.model.TaskListener listener
protected final P4BaseCredentials p4credential
protected final Validate validate
@Deprecated public ConnectionHelper(String credentialID, hudson.model.TaskListener listener)
public ConnectionHelper(hudson.model.ItemGroup context, String credentialID, hudson.model.TaskListener listener)
public ConnectionHelper(hudson.model.Item job, String credentialID, hudson.model.TaskListener listener)
public ConnectionHelper(hudson.model.Run run, String credentialID, hudson.model.TaskListener listener)
public ConnectionHelper(P4BaseCredentials credential, hudson.model.TaskListener listener)
public ConnectionHelper(P4BaseCredentials credential)
public com.perforce.p4java.server.IOptionsServer getConnection()
public int getRetry()
public String getUser()
public String getPort()
public String getTicket()
public boolean isConnected()
public boolean isUnicode()
public boolean checkVersion(int min)
min
- Minimum server versionpublic List<com.perforce.p4java.core.file.IFileSpec> getDirs(List<String> paths) throws Exception
paths
- list of paths to look for dirs (only takes * as wildcard)Exception
- push up stackpublic List<com.perforce.p4java.core.IStreamSummary> getStreams(List<String> paths) throws Exception
paths
- list of path to look for streams (takes ... or * as wildcard)Exception
- push up stackpublic com.perforce.p4java.core.IChangelistSummary getChangeSummary(long id) throws com.perforce.p4java.exception.P4JavaException
com.perforce.p4java.exception.P4JavaException
public List<com.perforce.p4java.core.IFix> getJobs(int id) throws com.perforce.p4java.exception.P4JavaException
com.perforce.p4java.exception.P4JavaException
public boolean isCounter(String name) throws Exception
name
- Couner nameException
- push up stackpublic String getCounter(String id) throws Exception
id
- Counter nameException
- push up stackpublic boolean isLabel(String name) throws Exception
name
- Label nameException
- push up stackpublic boolean isClient(String name) throws Exception
name
- Client nameException
- push up stackpublic void deleteClient(String name) throws Exception
name
- Client nameException
- push up stackpublic com.perforce.p4java.impl.generic.core.Label getLabel(String id) throws Exception
id
- Label nameException
- push up stackpublic void setLabel(com.perforce.p4java.impl.generic.core.Label label) throws Exception
label
- Label nameException
- push up stackpublic List<com.perforce.p4java.core.file.IFileSpec> getLabelFiles(String id, int limit) throws Exception
id
- Label name or change number (as string)limit
- Max results (-m value)Exception
- push up stackpublic List<com.perforce.p4java.core.file.IFileSpec> getChangeFiles(int id, int limit) throws Exception
Exception
public List<com.perforce.p4java.core.file.IFileSpec> getShelvedFiles(int id) throws Exception
id
- Shelf IDException
- push up stackpublic String getSwarm() throws com.perforce.p4java.exception.P4JavaException
com.perforce.p4java.exception.P4JavaException
public com.perforce.p4java.graph.ICommit getGraphCommit(String sha, String repo) throws com.perforce.p4java.exception.P4JavaException
com.perforce.p4java.exception.P4JavaException
public List<com.perforce.p4java.core.file.IFileSpec> getCommitFiles(String repo, String sha) throws com.perforce.p4java.exception.P4JavaException
com.perforce.p4java.exception.P4JavaException
public P4Ref getGraphHead(String repo)
repo
- a graph repopublic List<P4Ref> listCommits(List<P4Ref> fromRefs, P4Ref to) throws Exception
fromRefs
- Array of potential SHAs (include other repos)to
- The last SHA to list commitsException
- push up stackpublic List<com.perforce.p4java.core.IRepo> listAllRepos() throws Exception
Exception
- push up stackpublic List<com.perforce.p4java.core.IRepo> listRepos(String path) throws Exception
path
- Path filterException
- push up stackpublic void disconnect()
@Deprecated public static P4BaseCredentials findCredential(String id)
findCredential(String, ItemGroup)
or findCredential(String, Item)
id
- Credential IDpublic static P4BaseCredentials findCredential(String credentialsId, hudson.model.ItemGroup context)
credentialsId
- Credential IDcontext
- The contextpublic static P4BaseCredentials findCredential(String credentialsId, hudson.model.Item item)
Item
.
This also tracks usage of the credentials.credentialsId
- Credential IDitem
- The Item
public static P4BaseCredentials findCredential(String credentialsId, hudson.model.Run run)
Run
.
This also tracks usage of the credentials.credentialsId
- Credential IDrun
- The Run
protected int getMaxChangeLimit()
public void log(String msg)
public boolean hasAborted()
public void abort()
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2016–2017. All rights reserved.