public abstract class Program
extends java.lang.Object
Constructor and Description |
---|
Program() |
Modifier and Type | Method and Description |
---|---|
protected static void |
closeDown()
Release any resources held by this class.
|
protected static java.lang.String |
formatThrowable(java.lang.Throwable thrown)
Provide a suitable error message from an exception.
|
protected static java.lang.String |
formatTSV(java.lang.Object... values)
Format values as tab-separated text
|
protected static Action |
getAction(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String actionId)
Locate a saved action on the server.
|
protected static java.security.cert.X509Certificate |
getCertificate()
Loads the X509 certificate to be used for authentication.
|
protected static java.lang.String |
getCertificatePath()
Returns the certificate path set using setCertificatePath()
|
protected static Export |
getExport(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String exportId)
Locate a saved export on the server.
|
protected static Import |
getImport(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String importId)
Locate a import definition on the server.
|
protected static java.lang.String |
getKeyStoreAlias()
Returns the key store alias set using setKeyStoreAlias()
|
protected static java.lang.String |
getKeyStorePassword()
Returns the key store password set using setKeyStorePassword().
|
protected static java.lang.String |
getKeyStorePath()
Returns the key store path set using setKeyStorePath()
|
protected static Model |
getModel(java.lang.String workspaceId,
java.lang.String modelId)
Locate a model on the server.
|
protected static Module |
getModule(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String moduleId)
Locate a module on the server.
|
protected static java.lang.String |
getPassphrase()
Returns the password set using setPassword().
|
protected static Process |
getProcess(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String processId)
Locate a process definition on the server.
|
protected static Credentials |
getProxyCredentials()
Gathers the proxy credentials if set.
|
protected static java.lang.String |
getProxyPassphrase()
Returns the proxy password set using setProxyPassword().
|
protected static java.lang.String |
getProxyUsername()
Returns the proxy username set using setProxyUsername().
|
protected static ServerFile |
getServerFile(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String fileId,
boolean create)
Locate or optionally create a server file on the server.
|
protected static Service |
getService()
Returns the client service instance.
|
protected static Credentials |
getServiceCredentials()
Gathers the Anaplan service credentials.
|
protected static java.lang.String |
getUsername()
Returns the username set using setUsername().
|
protected static View |
getView(java.lang.String workspaceId,
java.lang.String modelId,
java.lang.String moduleId,
java.lang.String viewId)
Locate a saved view on the server.
|
protected static Workspace |
getWorkspace(java.lang.String workspaceId)
Locate a workspace on the server.
|
static void |
main(java.lang.String... args)
Parse and process the command line.
|
protected static java.lang.String |
promptForValue(java.lang.String propertyName,
java.lang.String propertyValue,
boolean password)
Check and if necessary prompt for a value.
|
protected static void |
retrieveOutput(TaskResult taskResult,
java.io.File outputLocation)
Retrieve any dump file(s) from the server following an import or process
containing 1+ imports.
|
protected static TaskResult |
runTask(Task task)
Track the progress of a task on the server until completion.
|
protected static void |
setCertificatePath(java.lang.String certificatePath)
Set the path to the certificate
|
protected static void |
setDebugLevel(int debugLevel)
Set the debug level.
|
protected static void |
setKeyStoreAlias(java.lang.String keyStoreAlias)
Set the alias of the key store entry referring to the public
certificate and private key pair used by the client to authenticate
with the server
|
protected static void |
setKeyStorePassword(java.lang.String keyStorePassword)
Set the password of the key store
|
protected static void |
setKeyStorePath(java.lang.String keyStorePath)
Set the path to the key store
|
protected static void |
setPassphrase(java.lang.String passphrase)
Set the passphrase of the Anaplan account for the service to use.
|
protected static void |
setProxyLocation(java.net.URI proxyLocation)
Set the proxy location.
|
protected static void |
setProxyPassphrase(java.lang.String passphrase)
Set the passphrase for an authenticating proxy
|
protected static void |
setProxyUsername(java.lang.String username)
Set the username for an authenticating proxy
|
protected static void |
setServiceLocation(java.net.URI serviceLocation)
Set the service location.
|
protected static void |
setUsername(java.lang.String username)
Set the username of the Anaplan account for the service to use.
|
public static void main(java.lang.String... args)
args
- the list of command-line argumentsprotected static void closeDown()
protected static TaskResult runTask(Task task) throws AnaplanAPIException, java.lang.InterruptedException
task
- The task to runAnaplanAPIException
java.lang.InterruptedException
protected static void retrieveOutput(TaskResult taskResult, java.io.File outputLocation) throws AnaplanAPIException, java.io.IOException
taskResult
- the result of running the taskoutputLocation
- the location in which to store the dataAnaplanAPIException
java.io.IOException
protected static java.lang.String formatThrowable(java.lang.Throwable thrown)
thrown
- the exceptionprotected static java.lang.String formatTSV(java.lang.Object... values)
values
- a list of valuesprotected static ServerFile getServerFile(java.lang.String workspaceId, java.lang.String modelId, java.lang.String fileId, boolean create) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelfileId
- the name or ID of the server filecreate
- if true and the file does not exist on the server, create a
new fileAnaplanAPIException
protected static Import getImport(java.lang.String workspaceId, java.lang.String modelId, java.lang.String importId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelimportId
- the name or ID of the import definitionAnaplanAPIException
protected static Export getExport(java.lang.String workspaceId, java.lang.String modelId, java.lang.String exportId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelexportId
- the name or ID of the saved exportAnaplanAPIException
protected static Action getAction(java.lang.String workspaceId, java.lang.String modelId, java.lang.String actionId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelactionId
- the name or ID of the saved actionAnaplanAPIException
protected static Process getProcess(java.lang.String workspaceId, java.lang.String modelId, java.lang.String processId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelprocessId
- the name or ID of the process definitionAnaplanAPIException
protected static View getView(java.lang.String workspaceId, java.lang.String modelId, java.lang.String moduleId, java.lang.String viewId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelmoduleId
- the name or ID of the moduleviewId
- the name or ID of the saved viewAnaplanAPIException
protected static Module getModule(java.lang.String workspaceId, java.lang.String modelId, java.lang.String moduleId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelmoduleId
- the name or ID of the moduleAnaplanAPIException
protected static Model getModel(java.lang.String workspaceId, java.lang.String modelId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspacemodelId
- the name or ID of the modelAnaplanAPIException
protected static Workspace getWorkspace(java.lang.String workspaceId) throws AnaplanAPIException
workspaceId
- the name or ID of the workspaceAnaplanAPIException
protected static Service getService() throws AnaplanAPIException
AnaplanAPIException
protected static Credentials getServiceCredentials() throws AnaplanAPIException
AnaplanAPIException
protected static Credentials getProxyCredentials()
protected static java.lang.String getUsername()
protected static java.lang.String getPassphrase()
protected static void setServiceLocation(java.net.URI serviceLocation)
serviceLocation
- the URI of the API service endpointprotected static void setProxyLocation(java.net.URI proxyLocation)
proxyLocation
- the URI of the proxy, or null if no proxy is to be usedprotected static java.lang.String getProxyUsername()
protected static java.lang.String getProxyPassphrase()
protected static void setDebugLevel(int debugLevel)
debugLevel
- an integer debug level, nominally in the range 0..2protected static void setUsername(java.lang.String username)
username
- the email address of the Anaplan userprotected static void setPassphrase(java.lang.String passphrase)
passphrase
- the passphrase of the Anaplan userprotected static void setProxyUsername(java.lang.String username)
username
- the username for the authenticating proxyprotected static void setProxyPassphrase(java.lang.String passphrase)
passphrase
- the passphrase for the authenticating proxyprotected static java.security.cert.X509Certificate getCertificate() throws java.security.cert.CertificateException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.io.IOException
java.security.cert.CertificateException
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
protected static java.lang.String getCertificatePath()
protected static void setCertificatePath(java.lang.String certificatePath)
certificatePath
- protected static java.lang.String getKeyStorePath()
protected static void setKeyStorePath(java.lang.String keyStorePath)
keyStorePath
- protected static java.lang.String getKeyStoreAlias()
protected static void setKeyStoreAlias(java.lang.String keyStoreAlias)
keyStoreAlias
- protected static java.lang.String getKeyStorePassword()
protected static void setKeyStorePassword(java.lang.String keyStorePassword)
keyStorePassword
- protected static java.lang.String promptForValue(java.lang.String propertyName, java.lang.String propertyValue, boolean password)
propertyName
- the value to be displayed to the user if promptedpropertyValue
- the value suppliedpassword
- flag to suppress echoingjava.lang.UnsupportedOperationException
- if there is no terminal associated with the program and a
value was not supplied.