Library Documentation

Pigskin Home
Pigskin Documentation

To use the Pigskin classes directly to update or deploy an application, first you must construct a PigskinClient instance connected to a Pigskin server. You must pass a hostname and a port number to the constructor of PigskinCient. Note that in all the example code presented on this page, some necessary try/catch blocks have been left out for simplicity. If the server is hosted at mypigskinserver.com, the code that creates a PigskinClient might look like:

PigskinClient client = new PigskinClient("mypigskinserver.com", PigskinClient.DEFAULT_PORT);

All actions are performed through the PigskinClient.execute. To perform an action, you must construct a java.util.Hashtable containing information about the action to perform and pass it to this method. The arguments in this hashtable are identical to the arguments that you would pass to the Pigskin program in client mode (minus the arguments for selecting mode and specifying the host name and port). For example, if we want to get the version string of an application name foo, we could use the following code:

Hashtable args = new Hashtable();
args.put("-a", "foo");
args.put("--app-version", "");
    Object ret = client.execute(args);
    System.out.println("Version is: "+(String)ret);
catch(FunctionException ex){
    //will occur if the app is not found

As you can see, the execute function returns an Object. The type of this Object depends on the arguments passed to execute. Valid arguments to the execute method can be determined by figuring out the version of the client module (you can query the Pigskin server for the version of the PIGSKIN application) and checking the documentation for that version.