package com.perforce.jbrown.utils; import java.net.URISyntaxException; import java.util.Properties; import com.perforce.p4java.PropertyDefs; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.impl.mapbased.rpc.RpcPropertyDefs; import com.perforce.p4java.server.IOptionsServer; import com.perforce.p4java.server.ServerFactory; public class LameServerFactory { /** * This method is for example purposes only. Everything hard coded, should * use a properties file or alternate. * * @return server instance * @throws URISyntaxException */ public static IOptionsServer getServer() throws P4JavaException, URISyntaxException { // hard code the serverUrl final String serverUrl = "p4java://jbrown:20191"; final String username = "jbrown"; IOptionsServer server = ServerFactory.getOptionsServer(serverUrl, getProperties()); server.setUserName(username); server.connect(); return server; } private static Properties getProperties() { return defaultProps; } private static final Properties defaultProps = new Properties(); static { // Set program name so that it appears in the p4d log file. defaultProps.put(PropertyDefs.PROG_NAME_KEY, "Test Program"); defaultProps.put(PropertyDefs.PROG_VERSION_KEY, "6.9"); // lengthen 30 sec read timeout for slow WANs. Units are milliseconds defaultProps.put(RpcPropertyDefs.RPC_SOCKET_SO_TIMEOUT_NICK, 120000); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 26419 | Joel Brown | Add simple example for created a stream client. | ||
#2 | 19914 | Joel Brown |
Example for updating a user's AuthMethod in p4java 2015.2. P4Java 2015.2 doesn't know squat about field AuthMethod. |
||
#1 | 19893 | Joel Brown | getting perforce Groups sample, including workaround for job087545 |