Interface IServerResource
- All Known Subinterfaces:
IBranchSpec,IBranchSpecSummary,IChangelist,IClient,IClientSummary,IDepot,IExtendedFileSpec,IExtension,IFileOperationResult,IFileSpec,IFix,IJob,IJobSpec,ILabel,ILabelSummary,ILicenseLimits,IRepo,IServerIPMACAddress,IServerProcess,IStream,IStreamSummary,IUser,IUserGroup,IUserSummary
- All Known Implementing Classes:
BranchSpec,BranchSpecSummary,Changelist,ChangelistSummary,Client,ClientSummary,Depot,ExtendedFileSpec,Extension,ExtensionSummary,FileSpec,Fix,Job,JobSpec,Label,LabelSummary,License,LicenseLimits,Repo,ServerIPMACAddress,ServerProcess,ServerResource,Stream,Streamlog,StreamSummary,User,UserGroup,UserSummary
The general intention here is to allow the underlying P4Java plumbing to use lightweight metadata-only objects where possible (or full-strength objects only partially-implemented or filled-out), and allow the consumer to determine the status of the underlying object and act accordingly.
This approach requires all participating P4Java interfaces to spell out what both "updateable" and "refreshable" mean, and whether the associated methods are implemented or not.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the underlying object is refreshable from the Perforce server.booleanReturns true if the underlying object can be updated back to (or on) the associated Perforce server.voidCreate new map and clear all fields.voidcomplete()Old method called used to call refresh when completing a spec.getRawField(String field) Fetch a value from the raw spec map.Fetch the whole raw spec map.booleanhasRawField(String field) Look for field in map.voidrefresh()Refresh the underlying object from the Perforce server.voidsetRawField(String field, Object value) Enter Key/Pair for a spec field.voidsetRawFields(Map<String, Object> map) Add all elements in a map to the specvoidSet the server associated with this resource.voidupdate()Update the Perforce server object associated with the underlying P4Java object, if possible.voidupdate(boolean force) Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible.voidUpdate the Perforce server object associated with the underlying P4Java object and its options, if possible.
-
Method Details
-
canRefresh
boolean canRefresh()Returns true if the underlying object is refreshable from the Perforce server.The details of what "refreshable" means in this context are always object-dependent, but typically mean that "live" data and metadata will be updated from the server. This is especially useful on objects like changelists, where the underlying server-side data may change often outside P4Java's control.
- Returns:
- true if the underlying the object is refreshable.
-
refresh
Refresh the underlying object from the Perforce server.The details of what "refreshable" means in this context are always object-dependent, but typically mean that "live" data and metadata will be updated from the server.
The results of calling this method on objects whose canRefresh method returns false are undefined (but will generally result in a UnimplementedError being thrown).
- Throws:
ConnectionException- if the Perforce server is unreachable or is not connected.RequestException- if the Perforce server encounters an error during its processing of the requestAccessException- if the Perforce server denies access to the caller
-
canUpdate
boolean canUpdate()Returns true if the underlying object can be updated back to (or on) the associated Perforce server. The semantics of server updates are generally object-specific.- Returns:
- true if the underlying object can be updated back to (or on) the associated Perforce server
-
complete
Old method called used to call refresh when completing a spec.- Throws:
ConnectionException- when there is an error talking to the Helix serverRequestException- when there is a problem with the data provided in the requestAccessException- when access to the branch command is not authorised
-
update
Update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).
- Throws:
ConnectionException- if the Perforce server is unreachable or is not connected.RequestException- if the Perforce server encounters an error during its processing of the requestAccessException- if the Perforce server denies access to the caller
-
update
Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.Note, in order to force the change it may require super user / admin privileges to work properly.
The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).
- Parameters:
force- if true, force the update of the object on the server.- Throws:
ConnectionException- if the Perforce server is unreachable or is not connected.RequestException- if the Perforce server encounters an error during its processing of the requestAccessException- if the Perforce server denies access to the caller
-
update
Update the Perforce server object associated with the underlying P4Java object and its options, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).
- Parameters:
opts- Options object describing optional parameters; if null, no options are set.- Throws:
ConnectionException- if the Perforce server is unreachable or is not connected.RequestException- if the Perforce server encounters an error during its processing of the requestAccessException- if the Perforce server denies access to the caller
-
setServer
Set the server associated with this resource. Setting this null can have bad effects down the line...- Parameters:
server- IServer to be used for refresh, update, etc.
-
getRawField
Fetch a value from the raw spec map.- Parameters:
field- spec field- Returns:
- valuse as an Object
-
setRawField
Enter Key/Pair for a spec field.- Parameters:
field- field kayvalue- value
-
getRawFields
Fetch the whole raw spec map.- Returns:
- Spec Map
-
setRawFields
Add all elements in a map to the spec- Parameters:
map- field map
-
clearRawFields
void clearRawFields()Create new map and clear all fields. -
hasRawField
Look for field in map.- Parameters:
field- field name- Returns:
- true if field exists.
-