Perforce

Package com.perforce.api

Provides classes for accessing Perforce objects (LICENSE).

See:
          Description

Interface Summary
Cacheable An interface that indicates the implementing class can be cached for some period of time.
 

Class Summary
Branch Representation of a source control branch.
Change Representation of a source control change.
Client Representation of a source control client.
Counter Representation of perforce counters.
Debug Utility class used for debugging.
DirEntry Representation of a source control directory.
Env Representation of a source control environment.
EventLog This class controls an event log.
FileEntry Representation of a source control file.
HashDecay This hashtable build to contain objects that will decay over time.
Job Representation of a source control job.
JobField Data class for p4 jobspec field information.
Label Representation of a source control lablel.
Mapping Representation of a source control mapping.
P4JNI This class handles the Java Native Interface to the P4 libraries.
P4Process Handles the execution of all perforce commands.
SourceControlObject An abstract base class for all source control objects.
User Representation of a source control user.
Utils Class that contains static utility methods.
 

Exception Summary
CommitException Signals that an exception occurred during the process of committing a cacheable object to perforce.
PerforceException Signals that a general exception occurred when working with Perforce.
SubmitException Signals that an exception occurred during a submit to Perforce.
 

Package com.perforce.api Description

Provides classes for accessing Perforce objects (LICENSE). These classes can be used to write higher-level scripts and applications in Java, which is the definition of an API.

This software is provided 'AS IS' with NO WARRANTY!

The current implementation acts as a wrapper around the execution of command line requests. There has been some development done in an attempt to utilize the P4API directly through the Java Native Interface. When this work is completed, it will be possible convert to its use without changing the underlying objects.

Usage Overview

The key classes in this package are Env and P4Process. All the remaining object representation rely on these two. The Env must be instantiated and configured before using it with other classes. The P4Process may never be instantiated directly, but it is where the actual command is executed. This is extremely useful, if the classes provided do not provide the functionality you need.

Example

In this example, the method performs and integration and commits the change.
public void doIt() {
  Env env;
  Change chng;
  StringBuffer sb;

  env = new Env();
  env.setUser("jdoe");
  env.setPassword("secret");
  env.setClient("jdoe-pc");

  chng = new Change(env);
  chng.setDescription("Integration from staging to release.");
  try {
    chng.store();
    sb = new StringBuffer();
    chng = Branch.integrate(env, "//depot/docs/stage/...",
                            "stage2release", sb, chng);
    chng.submit();
  } catch (CommitException e) {
    System.err.println("Unable to store new change.");
  } catch (SubmitException e) {
    System.err.println("Unable to submit changelist into Perforce.");
  } catch (PerforceException e) {
    System.err.println("Unable to integrate files: "+sb);
  }
}
Last Updated: $Date: 2002/08/05 $ $Revision: #6 $

See Also:
LICENSE

Perforce

Copyright © 2001, Perforce Software, All rights reserved.