package com.perforce.api; import java.util.*; /* * Copyright (c) 2001, Perforce Software, All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * An abstract base class for all source control objects. * * @author <a href="mailto:david@markley.cc">David Markley</a> * @version $Date: 2007/05/17 $ $Revision: #1 $ */ public abstract class SourceControlObject implements Cacheable { private long update_time = 0; private long sync_time = 0; private Env environ; /** Default, no-argument constructor. */ public SourceControlObject() { update_time = 0; sync_time = 0; } /** * Constructor that takes an environment for this object to use. * * @param env source control environement to use. */ public SourceControlObject(Env env) { this(); setEnv(env); } /** * Sets the P4 environment to be used when working with this object. This * environment is required to store, sync, or otherwise work with the * P4 depot. It is passed to the P4Process used in each of these * transactions. * * @see Env * @see P4Process * @param env user environment to use. */ public void setEnv(Env env) { this.environ = env; } /** * Returns the P4 environment associated with this instance. * * @return P4 environment. */ public Env getEnv() { return this.environ; } /** Returns the time, in milliseconds, for this object's last update. */ public synchronized long getUpdateTime() { return update_time; } /** Sets the update time for this object to the current time. */ public synchronized void refreshUpdateTime() { update_time = (new Date()).getTime(); } /** Returns the time, in milliseconds, that this object was synchronized. */ public synchronized long getSyncTime() { return sync_time; } /** * Tests this object to see if it is out of sync. Checks to see if the * expiration time is within the specified number of milliseconds. * * @param threshold Number of milliseconds. * @return True if the object will be out of sync within the threshold. */ public synchronized boolean outOfSync(long threshold) { return (threshold < ((new Date()).getTime() - sync_time)); } /** Invalidates this object. */ public synchronized void invalidate() { sync_time = 0; } /** Marks this object as being in in sync or valid. */ public synchronized void inSync() { sync_time = (new Date()).getTime(); } /** Removes any cached objects. */ public void clearCache() { getCache().clear(); } /** Returns the HashDecay instance for this class */ public abstract HashDecay getCache(); /** * Stores this object back into Perforce, creating it if it * didn't already exist. */ public abstract void commit() throws CommitException; /** * Brings this object back into sync with Perforce. This also sets the * sets the update and sync time for this object. */ public abstract void sync() throws PerforceException; /** * Returns a string containing the object in XML form. */ public abstract String toXML(); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5939 | David Jones |
Rename/Move: //guest/david_jones/p4package/com/perforce/api/Branch.java To: //guest/david_jones/p4package/src/com/perforce/api/Branch.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Cacheable.java To: //guest/david_jones/p4package/src/com/perforce/api/Cacheable.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Change.java To: //guest/david_jones/p4package/src/com/perforce/api/Change.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Client.java To: //guest/david_jones/p4package/src/com/perforce/api/Client.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/CommitException.java To: //guest/david_jones/p4package/src/com/perforce/api/CommitException.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Counter.java To: //guest/david_jones/p4package/src/com/perforce/api/Counter.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Debug.java To: //guest/david_jones/p4package/src/com/perforce/api/Debug.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/DirEntry.java To: //guest/david_jones/p4package/src/com/perforce/api/DirEntry.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Env.java To: //guest/david_jones/p4package/src/com/perforce/api/Env.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/EventLog.java To: //guest/david_jones/p4package/src/com/perforce/api/EventLog.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/FileEntry.java To: //guest/david_jones/p4package/src/com/perforce/api/FileEntry.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/HashDecay.java To: //guest/david_jones/p4package/src/com/perforce/api/HashDecay.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Job.java To: //guest/david_jones/p4package/src/com/perforce/api/Job.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/JobField.java To: //guest/david_jones/p4package/src/com/perforce/api/JobField.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Label.java To: //guest/david_jones/p4package/src/com/perforce/api/Label.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Mapping.java To: //guest/david_jones/p4package/src/com/perforce/api/Mapping.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/P4JNI.java To: //guest/david_jones/p4package/src/com/perforce/api/P4JNI.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/P4Process.java To: //guest/david_jones/p4package/src/com/perforce/api/P4Process.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/PerforceException.java To: //guest/david_jones/p4package/src/com/perforce/api/PerforceException.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/RobotMessage.java To: //guest/david_jones/p4package/src/com/perforce/api/RobotMessage.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/SourceControlObject.java To: //guest/david_jones/p4package/src/com/perforce/api/SourceControlObject.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/SubmitException.java To: //guest/david_jones/p4package/src/com/perforce/api/SubmitException.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/User.java To: //guest/david_jones/p4package/src/com/perforce/api/User.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/Utils.java To: //guest/david_jones/p4package/src/com/perforce/api/Utils.java Rename/Move: //guest/david_jones/p4package/com/perforce/api/doc-files/LICENSE.TXT To: //guest/david_jones/p4package/src/com/perforce/api/doc-files/LICENSE.TXT Rename/Move: //guest/david_jones/p4package/com/perforce/api/doc-files/perforce_logo.gif To: //guest/david_jones/p4package/src/com/perforce/api/doc-files/perforce_logo.gif Rename/Move: //guest/david_jones/p4package/com/perforce/api/package.html To: //guest/david_jones/p4package/src/com/perforce/api/package.html |
||
//guest/david_jones/p4package/com/perforce/api/SourceControlObject.java | |||||
#2 | 5937 | David Jones | Cleaning up java warnings. | ||
#1 | 5702 | David Jones | Initial integration of the p4package | ||
//public/perforce/api/java/p4package/com/perforce/api/SourceControlObject.java | |||||
#2 | 1334 | David Markley |
Added more example code. Added the Counter class. Corrected the filelog methods for the FileEntry class. |
||
#1 | 1043 | David Markley | Initial branch to public area. | ||
//guest/david_markley/p4package/com/perforce/api/SourceControlObject.java | |||||
#2 | 1035 | David Markley | Changed the file type to provide for keyword expansion. | ||
#1 | 1034 | David Markley |
Added P4Package sources as subset of the P4WebPublisher project. Copyright (c) 2001, Perforce Software, All rights reserved. |