- p4java_ext
- ==========
-
- This is not a supported API.
-
- This is a project started after realizing that the easiest way to use P4Java
- was simply to use these methods from `IOptionsServer`:
-
- * `execMapCommand`
- * `execInputStringMapCommand`
-
- If you build around these calls, the API functions very closely to how the
- C++ API works, which is how most of the other Perforce applications function.
- Importantly, this makes it very clear which commands actually issue network
- requests and which do not.
-
- Anyhow, this API sits on top of these commands (and may eventually use the
- streaming commands) to provide fewer abstractions on top of the fundamental
- API.
-
- Keep in mind this API really was built to set up another project (the data
- initializer we use for tests), so it hasn't really been reasoned or hardened
- just yet.
-
-
- ## Usage
-
- P4Connection p4Connection = P4Connection.create(...);
-
- try {
- p4Connection.connectAs("user");
-
- // Create a new user
-
- // Interfaces in this API basically map to command line usage, e.g.,
- // the P4User interface here maps to the "p4 user" command.
- //
- // We provide some basic default implementations of these interfaces
- // that basically bind simply to the connection object.
- P4User p4User = P4User.create(p4Connection);
-
- // Many commands return "Spec" objects, that wrap the Map<String, Object>
- // with common expected methods. In fact, you usually load a "template spec",
- // even in cases where the object doesn't exist, edit, and then save.
- UserSpec userSpec = p4User.load("newuserlogin");
-
- userSpec.setFullName(user.getName());
- userSpec.setEmail(user.getEmail());
-
- p4User.forceSave(userSpec);
-
- } finally {
-
- // An alias for disconnect
- p4Connection.close();
- }
-
-
- ## To Do
-
- This is a very, very early attempt at the API, extremely likely to change at the
- moment.
# |
Change |
User |
Description |
Committed |
|
#1
|
9085 |
tjuricek |
First import of the project, before package refactoring. |
11 years ago
|
|