import java.io.*; import java.util.*; import com.perforce.api.*; /** * Convenience class for the examples. This is where the environment gets set * up for all the examples. It's extracted here in an attempt to clarify * the examples. */ public class Common { private static Env env; private static Properties prps; public final static Env setup() { prps = new Properties(System.getProperties()); try { // First, try loading from the properties file. prps.load(new BufferedInputStream(new FileInputStream("p4.properties"))); System.setProperties(prps); env = new Env(prps); } catch (IOException ioex) { Debug.error("Could not load properties."); /* If the properties file failed, we could set the environment manually. * Another option would be to simply fail at this point. */ System.exit(-1); env = new Env(); /* env.setPort("public.perforce.com:1666"); env.setUser("david_markley"); env.setClient("david_markley-pc"); env.setPassword("mylittlesecret"); env.setSystemDrive("D"); env.setSystemRoot("D:\\WINNT"); env.setExecutable("D:\\Program Files\\Perforce\\P4.EXE"); */ } /* Uncomment these lines to turn on stdout debugging info. */ Debug.setDebugLevel(Debug.VERBOSE); Debug.setLogLevel(Debug.LOG_SPLIT); return env; } public Properties getProperties() { return prps; } public Env getEnv() { return env; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5093 | Hari Krishna Dara |
Populating perforce branch. I will be adding p4admin files to it. |
||
//public/perforce/api/java/p4package/examples/Common.java | |||||
#1 | 1149 | David Markley | Added more documentation, a few examples, a cleanUp method, and a server timeout threshold. | ||
//guest/david_markley/p4package/examples/Common.java | |||||
#1 | 1148 | David Markley | Added a few examples and a server connection timeout threshold. |