|
Sonic Management API | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IHostManagerProxy
Provides remote access to the Host Manager. Used, in particular, for Centralized Install related management. The following is an example of connecting to 'AutoTestContainer' (a root container); Setting up the new container '/Containers/AutoTestContainer'; and launching it:
Hashtable env = new Hashtable(); env.put(IContainerConstants.CONNECTIONURLS_ATTR, "tcp://localhost:2506"); JMSConnectorAddress address = new JMSConnectorAddress(env); JMSConnectorClient connector = new JMSConnectorClient(); connector.connect(address); System.out.println("Connected..."); //Create a proxy to the Host Manager in the AutoTestContainer container IHostManagerProxy hostManager = MFProxyFactory.createHostManagerProxy(connector, new ObjectName("Domain1.AutoTestContainer:ID=HOST MANAGER")); //Setup the SonicRemote container Properties containerProps = new Properties(); containerProps.put("WINDOWS_SERVICE_NAME", "AutoTestContainer"); containerProps.put("DOMAIN_NAME", "Domain1"); containerProps.put("CREATE_IF_DOES_NOT_EXIST", "true"); containerProps.put("CONTAINER_PATH", "/Containers/AutoTestContainer"); containerProps.put("ConnectionURLs", "tcp://localhost:2506"); containerProps.put("DefaultPassword", "Administrator"); containerProps.put("DefaultUser", "Administrator"); System.out.println("Setup result: " + hostManager.setupContainer(containerProps, null)); //Launch the SonicRemote container from a script System.out.println("Launch result: " + hostManager.launchContainer("AutoTestContainer", false));
Method Summary | |
---|---|
IRemoteCallResult |
deleteFiles(java.lang.String pathOfdirectoryOrFile,
boolean deleteContent)
Delete the file or directory. |
IRemoteCallResult |
downloadFileFromDS(java.lang.String dsFilePath,
java.lang.String destinationFilePath,
boolean rewriteIfExists,
boolean expandZip)
Download a file from the Directory Service into the container's file-system. |
java.lang.String[] |
getAllHostnamesAndIPs(boolean includeLoopback)
Gets all known hostnames and ip addresses of this machine. |
IRemoteCallResult |
getFiles(java.lang.String srcFilePath,
java.lang.String destinationFilePath,
boolean rewriteIfExists)
Copy a file from the container's file-system to the client's file system. |
java.util.Properties |
getJVMProperties()
Returns the system properties of the container. |
IRemoteCallResult |
installLauncher(java.lang.String targetSonicHome)
Install the launcher that launched the container that hosts this HM under targetSonicHome |
IRemoteCallResult |
launchContainer(java.lang.String containerName,
boolean launchAsWindowsService)
Launches a container that was previously setup. |
IRemoteCallResult |
launchContainer(java.lang.String sonicHome,
java.lang.String containerName,
boolean launchAsWindowsService)
Launches a container that was previously setup in a different home. |
IFileDescriptor[] |
listDirectory(java.lang.String directoryPath)
Return the list of files and directories under directoryPath |
IRemoteCallResult |
putFiles(java.lang.String sourceFilePath,
java.lang.String destinationFilePath,
boolean rewriteIfExists)
Copy a file or a directory from the client's file system to the container's file-system. |
void |
reload()
Invokes the reload operation. |
IRemoteExecResult |
remoteExec(java.lang.String[] cmdarray,
java.lang.String[] envp,
java.lang.String workDirPath,
byte[] inputBytes)
The remoteExec call executes java.lang.Runtime.exec on the target container. |
IRemoteCallResult |
removeContainer(java.lang.String containerName)
Uninstall the Windows Service (if installed) and remove the files from the working directory. |
IRemoteCallResult |
setupContainer(java.util.Properties properties,
java.lang.String INIEncryptionPassword)
Setup a new container by generating the launch and Windows Service scripts and the container.ini file. |
IRemoteCallResult |
setupContainer(java.lang.String containerDSPath,
java.util.Properties unConfiguredProps,
java.lang.String INIEncryptionPassword)
Setup a new container by generating the launch and Windows Service scripts and the container.ini file. |
IRemoteCallResult |
setupContainer(java.lang.String sonicHome,
java.lang.String launcherVersion,
java.util.Properties properties,
java.lang.String INIEncryptionPassword)
Setup a new container under the specified soniv home. |
void |
start()
Invokes the start operation. |
void |
stop()
Invokes the stop operation. |
Method Detail |
---|
IRemoteCallResult deleteFiles(java.lang.String pathOfdirectoryOrFile, boolean deleteContent)
pathOfdirectoryOrFile
- the path of a directory or a filedeleteContent
- if true and 'pathOfdirectoryOrFile' is a directory, deletes the directory's content
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult downloadFileFromDS(java.lang.String dsFilePath, java.lang.String destinationFilePath, boolean rewriteIfExists, boolean expandZip)
dsFilePath
- File path in the DSdestinationFilePath
- destination path on the container siderewriteIfExists
- fails if false and the file already existsexpandZip
- if 'true' expand the zip file after downloading it
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultjava.lang.String[] getAllHostnamesAndIPs(boolean includeLoopback)
Hostnames are added as strings to the set as lower case values.
Warning: this method can be slow, since for each known address of each network interface we do reverse dns lookup twice.
includeLoopback
- if the loopback address and hostnames should be included or
not
ProxyRuntimeException
IRemoteCallResult getFiles(java.lang.String srcFilePath, java.lang.String destinationFilePath, boolean rewriteIfExists)
srcFilePath
- The file path on the container sidedestinationFilePath
- The file path on the client siderewriteIfExists
- fails if false and the file already exists
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultjava.util.Properties getJVMProperties()
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult installLauncher(java.lang.String targetSonicHome)
targetSonicHome
- install the launcher under this directory
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult launchContainer(java.lang.String containerName, boolean launchAsWindowsService)
containerName
- Container namelaunchAsWindowsService
- if true and on Windows will launch the container as Windows Service
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult launchContainer(java.lang.String sonicHome, java.lang.String containerName, boolean launchAsWindowsService)
sonicHome
- the home of this containercontainerName
- Container namelaunchAsWindowsService
- if true and on Windows will launch the container as Windows Service
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIFileDescriptor[] listDirectory(java.lang.String directoryPath)
directoryPath
- an absolute path or a path relative to the working directory of the container
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult putFiles(java.lang.String sourceFilePath, java.lang.String destinationFilePath, boolean rewriteIfExists)
sourceFilePath
- Client side pathdestinationFilePath
- destination path on the container siderewriteIfExists
- fails if false and the file already exists
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultvoid reload()
Asynchronously reload the component and restart the component if it was previously online.
Impact: ACTION
IRemoteExecResult remoteExec(java.lang.String[] cmdarray, java.lang.String[] envp, java.lang.String workDirPath, byte[] inputBytes)
cmdarray
- a specified system command.envp
- array of strings, each element of which
has environment variable settings in the format
name=value, or
null if the subprocess should inherit
the environment of the current process.workDirPath
- the working directory of the subprocess, or
null if the subprocess should inherit
the working directory of the current process.inputBytes
- Standrd input for the process (or null if there is no input)
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult removeContainer(java.lang.String containerName)
containerName
- Container name
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution resultIRemoteCallResult setupContainer(java.util.Properties properties, java.lang.String INIEncryptionPassword)
properties
- the container setup propertiesINIEncryptionPassword
- an optional password for INI file encryption
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution result
Example
Properties containerProps = new Properties();
containerProps.put("WINDOWS_SERVICE_NAME", "SonicRemote");
containerProps.put("DOMAIN_NAME", "Domain1");
containerProps.put("CREATE_IF_DOES_NOT_EXIST", "true");
containerProps.put("CONTAINER_PATH", "/Containers/SonicRemote");
containerProps.put("ConnectionURLs", "tcp://localhost:2506");
containerProps.put("DefaultPassword", "Administrator");
containerProps.put("DefaultUser", "Administrator");IRemoteCallResult setupContainer(java.lang.String containerDSPath, java.util.Properties unConfiguredProps, java.lang.String INIEncryptionPassword)
containerDSPath
- the path of the container configuration in the DSunConfiguredProps
- the container unconfigured setup propertiesINIEncryptionPassword
- an optional password for INI file encryption
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution result
Properties Example
Properties unConfiguredProps = new Properties();
unConfiguredProps.put("WINDOWS_SERVICE_NAME", "SonicRemote");IRemoteCallResult setupContainer(java.lang.String sonicHome, java.lang.String launcherVersion, java.util.Properties properties, java.lang.String INIEncryptionPassword)
sonicHome
- the sonic home used by the new containerlauncherVersion
- the launcher version used by the new container. If 'null' will use the same launcher version used to launch the remote container.properties
- the container setup propertiesINIEncryptionPassword
- an optional password for INI file encryption
ProxyRuntimeException
- thrown due to communication failure that prevented the remote execution or the reception of the execution result
Example
Properties containerProps = new Properties();
containerProps.put("WINDOWS_SERVICE_NAME", "SonicRemote");
containerProps.put("DOMAIN_NAME", "Domain1");
containerProps.put("CREATE_IF_DOES_NOT_EXIST", "true");
containerProps.put("CONTAINER_PATH", "/Containers/SonicRemote");
containerProps.put("ConnectionURLs", "tcp://localhost:2506");
containerProps.put("DefaultPassword", "Administrator");
containerProps.put("DefaultUser", "Administrator");void start()
Start providing service.
Impact: ACTION
stop()
void stop()
Stop providing service.
Impact: ACTION
start()
|
Sonic Management API | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |