package com.perforce.p4java_ext; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.server.IOptionsServer; import java.util.Map; /** * We use a very small subset of the "p4 set" command, that is mostly used to * just initialize a new perforce installation. These commands generally * expect to be run by a superuser. */ public interface P4Configure extends P4Connection, P4Errors { static P4Configure create(P4Connection conn) { return new DefaultP4Configure(conn); } /** * Runs "p4 set security=[level]". * <p/> * see: http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html#DB5-49899 * * @param level An integer in the range [1,5] */ default void setSecurity(int level) { if (level < 0 || 5 < level) { throw new IllegalArgumentException("level < 0 || 5 < level"); } try { IOptionsServer server = getOptionsServer(); String[] options = {"set", "security=" + level}; Map<String, Object>[] results = server.execMapCmd("configure", options, null); checkError(results); } catch (P4JavaException e) { throw new P4Exception(e); } } /** * Runs "p4 set dm.keys.hide=[level]" * <p/> * This is used to restrict the usage of Commons counters to admins only. * <p/> * see http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_key.html * <p/> * see http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_keys.html * * @param level An integer in the range [0, 2] */ default void setDmKeysHide(int level) { if (level < 0 || 2 < level) { throw new IllegalArgumentException("level < 0 || 2 < level"); } try { IOptionsServer server = getOptionsServer(); String[] options = {"set", "dm.keys.hide=" + level}; Map<String, Object>[] results = server.execMapCmd("configure", options, null); checkError(results); } catch (P4JavaException e) { throw new P4Exception(e); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9086 | tjuricek |
0.1.0 Initial release of p4java_ext Mostly just contains enough of the P4 API to build the test data initializer. About 4 commands have minimal testing, so it works. Kind of. |
||
#1 | 9085 | tjuricek | First import of the project, before package refactoring. |