Source:
public static void main(String[] args) { if (args.length < 2) { System.err .println("Usage: " + RemoteAPI.class.getName() + "<class> <appid> [serviceAccount] [serviceAccountPrivatekey path] [args ...]\n" + "<class> can be a fully qualified class or just a class name." + " Defaults to package org.akvo.gae.remoteapi"); System.exit(1); } final boolean isLocalDevelopmentServer = "localhost".equals(args[1]); final String className = args[0]; final String instanceUrl = isLocalDevelopmentServer ? "localhost" : args[1] + ".appspot.com"; final int port = isLocalDevelopmentServer ? 8888 : 443; String serviceAccount = null; String serviceAccountPvk = null; if (!isLocalDevelopmentServer) { serviceAccount = args[2]; serviceAccountPvk = args[3]; } final RemoteApiOptions options = new RemoteApiOptions().server(instanceUrl, port); if (isLocalDevelopmentServer) { options.useDevelopmentServerCredential(); } else { options.useServiceAccountCredential(serviceAccount, serviceAccountPvk); } final RemoteApiInstaller installer = new RemoteApiInstaller(); String orgId = args[1]; try { installer.install(options); String clz = className.indexOf(".") != -1 ? className : "org.akvo.gae.remoteapi." + className; DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); DataStoreWithUnilog datastoreServiceWithUnilog = new DataStoreWithUnilog(ds, orgId); Process p = (Process) Class.forName(clz).newInstance(); if (isLocalDevelopmentServer) { p.execute(datastoreServiceWithUnilog, Arrays.copyOfRange(args, 2, args.length)); } else { p.execute(datastoreServiceWithUnilog, Arrays.copyOfRange(args, 4, args.length)); if (datastoreServiceWithUnilog.hasToNotifyUnilog()) { notifyUnilog(orgId, serviceAccountPvk); } } System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } finally { installer.uninstall(); } }

Target:
public static void main(String[] args) { if (args.length < 2) { System.err .println("Usage: " + RemoteAPI.class.getName() + "<class> <appid> [serviceAccount] [serviceAccountPrivatekey path] [args ...]\n" + "<class> can be a fully qualified class or just a class name." + " Defaults to package org.akvo.gae.remoteapi"); System.exit(1); } String orgId = args[1]; final boolean isLocalDevelopmentServer = "localhost".equals(orgId); final String className = args[0]; final String instanceUrl = isLocalDevelopmentServer ? "localhost" : orgId + ".appspot.com"; final int port = isLocalDevelopmentServer ? 8888 : 443; String serviceAccount = null; String serviceAccountPvk = null; if (!isLocalDevelopmentServer) { serviceAccount = args[2]; serviceAccountPvk = args[3]; } final RemoteApiOptions options = new RemoteApiOptions().server(instanceUrl, port); if (isLocalDevelopmentServer) { options.useDevelopmentServerCredential(); } else { options.useServiceAccountCredential(serviceAccount, serviceAccountPvk); } final RemoteApiInstaller installer = new RemoteApiInstaller(); try { installer.install(options); String clz = className.indexOf(".") != -1 ? className : "org.akvo.gae.remoteapi." + className; DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); DataStoreWithUnilog datastoreServiceWithUnilog = new DataStoreWithUnilog(ds, orgId); Process p = (Process) Class.forName(clz).newInstance(); if (isLocalDevelopmentServer) { p.execute(datastoreServiceWithUnilog, Arrays.copyOfRange(args, 2, args.length)); } else { p.execute(datastoreServiceWithUnilog, Arrays.copyOfRange(args, 4, args.length)); if (datastoreServiceWithUnilog.hasToNotifyUnilog()) { notifyUnilog(orgId, serviceAccountPvk); } } System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } finally { installer.uninstall(); } }