Class SessionImpl
- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteServer
-
- java.rmi.server.UnicastRemoteObject
-
- com.ibm.di.api.remote.impl.APIRemoteObject
-
- com.ibm.di.api.remote.impl.SessionImpl
-
- All Implemented Interfaces:
Session,java.io.Serializable,java.rmi.Remote
public class SessionImpl extends APIRemoteObject implements Session
This class implements methods for managing remote Session.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SessionImpl(java.lang.String aUserId, java.rmi.server.RMIClientSocketFactory aClientSF, java.rmi.server.RMIServerSocketFactory aServerSF)Constructor.SessionImpl(java.rmi.server.RMIClientSocketFactory aClientSF, java.rmi.server.RMIServerSocketFactory aServerSF)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(ConfigurationFileListener listener)Registers a Event Listener to monitor for Configuration File changes.voidaddEventListener(DIEventListener aListener, java.lang.String aTypeFilter, java.lang.String aIdFilter)Registers an Event Listener with the Session.voidcheckInAndLeaveCheckedOut(MetamergeConfig aConfiguration, java.lang.String aRelativePath)Checks in the specified configuration and leaves it checked out.voidcheckInAndLeaveCheckedOut(MetamergeConfig configuration, java.lang.String relativePathOrSolutionName, boolean encrypt)Checks in the specified configuration and leaves it checked out.voidcheckInConfiguration(MetamergeConfig aConfiguration, java.lang.String aRelativePath)Saves the specified configuration and releases the lock.voidcheckInConfiguration(MetamergeConfig aConfiguration, java.lang.String aRelativePath, boolean aEncrypt)Encrypts and saves the specified configuration and releases the lock.MetamergeConfigcheckOutConfiguration(java.lang.String aRelativePath)Checks out the specified configuration.MetamergeConfigcheckOutConfiguration(java.lang.String aRelativePath, java.lang.String aPassword)Checks out the specified password protected configuration.ConfigInstancecheckOutConfigurationAndLoad(java.lang.String aRelativePath)Checks out the specified configuration and starts a temporary Config Instance on the Server.ConfigInstancecheckOutConfigurationAndLoad(java.lang.String aRelativePath, java.lang.String aPassword)Checks out the specified configuration and starts a temporary Config Instance on the Server.ConfigInstancecreateNewConfigInstance(java.lang.String aConfigUrl)ConfigInstancecreateNewConfigInstance(java.lang.String aConfigUrl, java.lang.String aPassword)MetamergeConfigcreateNewConfiguration(java.lang.String aRelativePath, boolean aOverwrite)Creates a new empty configuration and immediately checks it out.ConfigInstancecreateNewConfigurationAndLoad(java.lang.String aRelativePath, boolean aOverwrite)Creates a new empty configuration, immediately checks it out and loads a temporary Config Instance on the Server.voiddeleteConfiguration(java.lang.String relativePathOrSolutionName)Delete a file from the configuration codebase folder.java.lang.ObjectdeletePersistentObject(java.lang.String key)This method deletes a named object in the default system property store.AssemblyLine[]getAssemblyLines()Returns started AssemblyLines corresponding to the currently started configurations.java.lang.StringgetConfigFolderPath()Gets the value of the api.config.folder property in the remote server as a complete path.ConfigInstancegetConfigInstance(java.lang.String aConfigId)Returns configuration instance corresponding to a specific configuration ID.ConfigInstance[]getConfigInstances()Returns all currently started configuration instances.java.util.List<java.lang.String>getConfigInstancesIDs()Returns the IDs of all currently started configuration instances.IdentitygetIdentity()Returns the Identity;java.lang.StringgetJavaProperty(java.lang.String prop)Returns the value of a Java System property.java.lang.ObjectgetPersistentObject(java.lang.String key)This method retrieves a named object from the default system property store.SecurityRegistrygetSecurityRegistry()Returns information about the restrictions the current user has.ServerInfogetServerInfo()Retrieves the Server information.SystemLoggetSystemLog()Returns information about the System logging.SystemQueuegetSystemQueue()Gets the remote Server API SystemQueue representation objectTombstoneManagergetTombstoneManager()Returns the TombstoneManager object.java.lang.ObjectinvokeCustom(java.lang.String aCustomClassName, java.lang.String aMethodName, java.lang.Object[] aParams)Invokes the specified method from the specified class.java.lang.ObjectinvokeCustom(java.lang.String aCustomClassName, java.lang.String aMethodName, java.lang.Object[] aParamsValue, java.lang.String[] aParamsClass)Invokes the specified method from the specified class.booleanisConfigurationCheckedOut(java.lang.String aRelativePath)Checks if the specified configuration is checked out on the Server.booleanisSSLon()Checks if current session is over SSL.java.util.ArrayListlistAllConfigurations()Returns a list all configurations in the directory subtree of the Server configuration codebase folder.java.util.ArrayListlistConfigurations(java.lang.String aRelativePath)Returns a list of all configurations in the specified folder.java.util.ArrayListlistFolders(java.lang.String aRelativePath)Returns a list of the child folders of the specified folder.booleanreleaseConfigurationLock(java.lang.String aRelativePath)Administratively releases the lock of the specified configuration.booleanremoveEventListener(ConfigurationFileListener listener)Unregisters an Event Listener with the Session.booleanremoveEventListener(DIEventListener aListener)Unregisters an Event Listener with the Session.voidsendCustomNotification(java.lang.String aType, java.lang.String aId, java.lang.Object aData)Sends a custom, user defined notification to all registered listeners.voidsetJavaProperty(java.lang.String prop, java.lang.String value)Sets the value of a Java System property.java.lang.ObjectsetPersistentObject(java.lang.String key, java.lang.Object value)This method stores a named object in the default system property store.voidshutDownServer()Shuts down the TDI server.voidshutDownServer(int aExitCode)Shuts down the TDI Server with the specified exit code.voidshutDownServer(int aExitCode, boolean sync)Shuts down the TDI Server with the specified exit code, after stopping all AssemblyLines and waiting a while for them to finish.ConfigInstancestartConfigInstance(java.lang.String aConfigUrl)Starts a new Config Instance on the Server with the configuration given.ConfigInstancestartConfigInstance(java.lang.String aConfigUrl, boolean aKeepAlive, java.lang.String aPassword)Starts a new Config Instance on the Server with the configuration given.ConfigInstancestartConfigInstance(java.lang.String configPathOrSolutionName, boolean keepAlive, java.lang.String password, java.lang.String runName, java.lang.String overrideProps)Starts a new Config Instance on the Server with the configuration given.ConfigInstancestartConfigInstance(java.lang.String configPathOrSolutionName, boolean keepAlive, java.lang.String password, java.lang.String runName, java.lang.String overrideProps, LogListener logListener)Starts a new Config Instance on the Server with the configuration given.ConfigInstancestartTempConfigInstance(java.lang.String xmlConfig, boolean keepAlive, java.lang.String runName, java.lang.String overrideProps)Start a configuration instance which has no associated configuration file.ConfigInstancestartTempConfigInstance(java.lang.String xmlConfig, boolean keepAlive, java.lang.String runName, java.lang.String overrideProps, LogListener logListener)Start a configuration instance which has no associated configuration file.voidstartTombstoneManager()Starts the TombstoneManager.booleanundoCheckOut(java.lang.String aRelativePath)Releases the lock on the specified configuration, thus aborting all changes being done.-
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
-
-
-
-
Constructor Detail
-
SessionImpl
public SessionImpl(java.rmi.server.RMIClientSocketFactory aClientSF, java.rmi.server.RMIServerSocketFactory aServerSF) throws DIException, java.rmi.RemoteExceptionConstructor.- Parameters:
aClientSF- client socket factoryaServerSF- server socket factory- Throws:
DIException- if an error occurs while creating a SessionImpljava.rmi.RemoteException
-
SessionImpl
public SessionImpl(java.lang.String aUserId, java.rmi.server.RMIClientSocketFactory aClientSF, java.rmi.server.RMIServerSocketFactory aServerSF) throws DIException, java.rmi.RemoteExceptionConstructor.- Parameters:
aUserId- the user idaClientSF- client socket factoryaServerSF- server socket factory- Throws:
DIException- if an error occurs while creating a SessionImpljava.rmi.RemoteException
-
-
Method Detail
-
getServerInfo
public ServerInfo getServerInfo() throws DIException, java.rmi.RemoteException
Retrieves the Server information.- Specified by:
getServerInfoin interfaceSession- Returns:
- ServerInfo object representing the information gathered from the Server.
- Throws:
DIException- if an error occurs while retrieving the Server information.java.rmi.RemoteException- if a communication-related exception occurs.
-
getConfigInstances
public ConfigInstance[] getConfigInstances() throws DIException, java.rmi.RemoteException
Returns all currently started configuration instances.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var ci = session.getConfigInstances(); for (i=0; i<ci.length; i++) { task.logmsg("Config instance: " + ci[i]);- Specified by:
getConfigInstancesin interfaceSession- Returns:
- ConfigInstance array each value representing currently started configuration instance.
- Throws:
DIException- if an error occurs while retrieving the information about the currently started configuration instances.java.rmi.RemoteException- if a communication-related exception occurs.
-
getConfigInstancesIDs
public java.util.List<java.lang.String> getConfigInstancesIDs() throws DIException, java.rmi.RemoteExceptionReturns the IDs of all currently started configuration instances.Example:
var session = (new com.ibm.di.api.local.impl.SessionFactoryImpl).createSession(); var ciIds = session.getConfigInstancesIDs(); for (i=0; i<ciIds.length; i++) { task.logmsg("Config instance: " + ciIds[i]); }- Specified by:
getConfigInstancesIDsin interfaceSession- Returns:
- a List of the IDs of the all the active configuration instances. If none, then an empty list is returned.
- Throws:
DIException- if an error occurs while retrieving the information about the currently started configuration instances.java.rmi.RemoteException
-
getConfigInstance
public ConfigInstance getConfigInstance(java.lang.String aConfigId) throws DIException, java.rmi.RemoteException
Returns configuration instance corresponding to a specific configuration ID.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var cID = "testconfig.xml"; var ci = session.getConfigInstance(cID); //do something with ci- Specified by:
getConfigInstancein interfaceSession- Parameters:
aConfigId- the ID of the wanted configuration.- Returns:
- ConfigInstance object corresponding to the specified configuration ID or null if the configuration ID is not found in the list of currently started configurations.
- Throws:
DIException- if an error occurs while retrieving the information.java.rmi.RemoteException- if a communication-related exception occurs.
-
getAssemblyLines
public AssemblyLine[] getAssemblyLines() throws DIException, java.rmi.RemoteException
Returns started AssemblyLines corresponding to the currently started configurations.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var assemblyLines = session.getAssemblyLines(); for (i = 0; i < assemblyLines.length; i++) { task.logmsg("AL name: " + assemblyLines[i].getName()); // do someting with assemblyLines[i] }- Specified by:
getAssemblyLinesin interfaceSession- Returns:
- AssemblyLine array each value corresponding to a started AssemblyLine.
- Throws:
DIException- if an error occurs while retrieving the information about the AssemblyLines.java.rmi.RemoteException- if a communication-related exception occurs.
-
startConfigInstance
public ConfigInstance startConfigInstance(java.lang.String aConfigUrl) throws DIException, java.rmi.RemoteException
Starts a new Config Instance on the Server with the configuration given.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); session.startConfigInstance("testconfig.xml");- Specified by:
startConfigInstancein interfaceSession- Parameters:
aConfigUrl- The URL where the configuration file is loaded from or the Solution Name of the configuration file. Only configuration files located in the configuration codebase folder can be referenced by Solution Name.- Returns:
- ConfigInstance object representing currently started configuration instance.
- Throws:
DIException- if an error occurs on starting the new Config Instance.java.rmi.RemoteException- if a communication-related exception occurs.
-
startConfigInstance
public ConfigInstance startConfigInstance(java.lang.String aConfigUrl, boolean aKeepAlive, java.lang.String aPassword) throws DIException, java.rmi.RemoteException
Starts a new Config Instance on the Server with the configuration given.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var pass = "Difficult password"; session.startConfigInstance("testconfig.xml", false, pass);- Specified by:
startConfigInstancein interfaceSession- Parameters:
aConfigUrl- The URL where the configuration file is loaded from or the Solution Name of the configuration file.aKeepAlive- Whentruethe Config Instance will stay alive even when no threads are running, whenfalsethe Config Instance will automatically terminate when its last thread terminates.aPassword- Specify the password of the configuration when it is password-protected; specifynullwhen the configuration is not password-protected.- Returns:
- ConfigInstance object representing currently started configuration instance.
- Throws:
DIException- if an error occurs on starting the new Config Instance.java.rmi.RemoteException- if a communication-related exception occurs.
-
startConfigInstance
public ConfigInstance startConfigInstance(java.lang.String configPathOrSolutionName, boolean keepAlive, java.lang.String password, java.lang.String runName, java.lang.String overrideProps) throws DIException, java.rmi.RemoteException
Starts a new Config Instance on the Server with the configuration given.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var pass = "Difficult password"; session.startConfigInstance("testconfig.xml", false, pass, "myrunname", "mystore=mynewstore.properties");- Specified by:
startConfigInstancein interfaceSession- Parameters:
configPathOrSolutionName- The URL where the configuration file is loaded from or the Solution Name of the configuration file. Only configuration files located in the configuration codebase folder can be referenced by Solution Name.keepAlive- Whentruethe Config Instance will stay alive even when no threads are running, whenfalsethe Config Instance will automatically terminate when its last thread terminates.password- Specify the password of the configuration when it is password-protected; specifynullwhen the configuration is not password-protected.runName- A name which will be used as the configuration instance id. It must not coincide with any of the ids of running configuration instances. It must be a valid file name on the file system, on which TDI is running, because the configuration instance id (which is the same as the run name) is used when storing certain configuration-instance-specific information, such as the System Logs. To avoid file system problems, TDI forbids the following symbols to appear inside a run name: '\' '/' ':' '*' '?' '"' '<' '>' '|'. The run name is an optional parameter that can be null.overrideProps- Use to redirect property stores to load their contents from files different from the ones specified in the configuration file. Property stores and their corresponding files are specified as key-value pairs separated with spaces, e.g.: "mystore1=file1.properties mystore2=file2.properties". You cannot override a property store from an included configuration file, because its property stores are not directly accessible in the including file. This is an optional parameter that can be null.- Returns:
- ConfigInstance object representing currently started configuration instance.
- Throws:
DIException- If an error occurs on starting the new Config Instance or if the run name contains any of the following symbols: '\' '/' ':' '*' '"' '<' '>' '|'.java.rmi.RemoteException- if a communication-related exception occurs.
-
createNewConfigInstance
public ConfigInstance createNewConfigInstance(java.lang.String aConfigUrl) throws DIException, java.rmi.RemoteException
- Specified by:
createNewConfigInstancein interfaceSession- Parameters:
aConfigUrl- The URL of the new configuration file to be created.- Throws:
DIException- if an error occurs while creating the new Config Instance.java.rmi.RemoteException- if a communication-related exception occurs.
-
createNewConfigInstance
public ConfigInstance createNewConfigInstance(java.lang.String aConfigUrl, java.lang.String aPassword) throws DIException, java.rmi.RemoteException
- Specified by:
createNewConfigInstancein interfaceSession- Parameters:
aConfigUrl- The URL of the new configuration file to be created.aPassword- If this parameter is notnull, the new configuration will be protected with the given password.- Throws:
DIException- if an error occurs while creating the new Config Instance.java.rmi.RemoteException- if a communication-related exception occurs.
-
shutDownServer
public void shutDownServer() throws DIException, java.rmi.RemoteExceptionShuts down the TDI server.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); session.shutDownServer();- Specified by:
shutDownServerin interfaceSession- Throws:
DIException- if an error occurs while shutting down the server.java.rmi.RemoteException- if a communication-related exception occurs.
-
shutDownServer
public void shutDownServer(int aExitCode) throws DIException, java.rmi.RemoteExceptionShuts down the TDI Server with the specified exit code.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); session.shutDownServer(2);- Specified by:
shutDownServerin interfaceSession- Parameters:
aExitCode- the exit code used to shut down TDI Server.- Throws:
DIException- if an error occurs while shutting down the server.java.rmi.RemoteException- if a communication-related exception occurs.
-
shutDownServer
public void shutDownServer(int aExitCode, boolean sync) throws DIException, java.rmi.RemoteExceptionShuts down the TDI Server with the specified exit code, after stopping all AssemblyLines and waiting a while for them to finish.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); session.shutDownServer(0, false);- Specified by:
shutDownServerin interfaceSession- Parameters:
aExitCode- the exit code used to shut down TDI Server.sync- If true, do the waiting in separate Threads on the server.- Throws:
DIException- if an error occurs while shutting down the server.java.rmi.RemoteException- if a communication-related exception occurs.
-
getSecurityRegistry
public SecurityRegistry getSecurityRegistry() throws DIException, java.rmi.RemoteException
Returns information about the restrictions the current user has.- Specified by:
getSecurityRegistryin interfaceSession- Returns:
- SecurityRegistry object which represents the restrictions to the current user.
- Throws:
DIException- if an error occurs while retrieving security information.java.rmi.RemoteException- if a communication-related exception occurs.
-
getSystemLog
public SystemLog getSystemLog() throws DIException, java.rmi.RemoteException
Returns information about the System logging.- Specified by:
getSystemLogin interfaceSession- Returns:
- SystemLog object containing log information.
- Throws:
DIException- if an error occurs while retrieving the System logging information.java.rmi.RemoteException- if a communication-related exception occurs.
-
getTombstoneManager
public TombstoneManager getTombstoneManager() throws DIException, java.rmi.RemoteException
Returns the TombstoneManager object. Tombstones can be queried and cleared through this object.- Specified by:
getTombstoneManagerin interfaceSession- Returns:
- The TombstoneManager object or null if TombstoneManeger is switched off.
- Throws:
DIException- if an error occurs while getting the TombstoneManager.java.rmi.RemoteException- if a communication-related exception occurs.
-
addEventListener
public void addEventListener(DIEventListener aListener, java.lang.String aTypeFilter, java.lang.String aIdFilter) throws DIException, java.rmi.RemoteException
Registers an Event Listener with the Session.- Specified by:
addEventListenerin interfaceSession- Parameters:
aListener- The Event Listener to register with the Session.aTypeFilter- A filter for the type of events.aIdFilter- A filter for the id of events.- Throws:
DIException- if an error occurs while registering the listener.java.rmi.RemoteException- if a communication-related exception occurs.
-
removeEventListener
public boolean removeEventListener(DIEventListener aListener) throws DIException, java.rmi.RemoteException
Unregisters an Event Listener with the Session.- Specified by:
removeEventListenerin interfaceSession- Parameters:
aListener- The Event Listener to unregister.- Returns:
- true if the EventListener is successfully unregistered, false otherwise.
- Throws:
DIException- if an error occurs while unregistering the listener.java.rmi.RemoteException- if a communication-related exception occurs.
-
addEventListener
public void addEventListener(ConfigurationFileListener listener) throws DIException, java.rmi.RemoteException
Description copied from interface:SessionRegisters a Event Listener to monitor for Configuration File changes.- Specified by:
addEventListenerin interfaceSession- Parameters:
listener- the listener to register- Throws:
DIException- if an error occurs while registering the listener.java.rmi.RemoteException- if a communication-related exception occurs.
-
removeEventListener
public boolean removeEventListener(ConfigurationFileListener listener) throws DIException, java.rmi.RemoteException
Description copied from interface:SessionUnregisters an Event Listener with the Session.- Specified by:
removeEventListenerin interfaceSession- Parameters:
listener- the listener to unregister.- Returns:
- true if the listener is successfully unregistered, false otherwise.
- Throws:
DIException- if an error occurs while unregistering the listener.java.rmi.RemoteException- if a communication-related exception occurs.
-
isSSLon
public boolean isSSLon() throws DIException, java.rmi.RemoteExceptionChecks if current session is over SSL.- Specified by:
isSSLonin interfaceSession- Returns:
- true if current session is over SSL.
- Throws:
DIException- if an error occurs while retrieving the information.java.rmi.RemoteException- if a communication-related exception occurs.
-
releaseConfigurationLock
public boolean releaseConfigurationLock(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteExceptionAdministratively releases the lock of the specified configuration. This call can be only executed by users with the admin role.- Specified by:
releaseConfigurationLockin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Returns:
- true if the configuration lock has been release, false otherwise.
- Throws:
DIException- If an error occurs during releasing the lock.java.rmi.RemoteException- if a communication-related exception occurs.
-
undoCheckOut
public boolean undoCheckOut(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteExceptionReleases the lock on the specified configuration, thus aborting all changes being done. This call can only be executed from a user that has previously checked out the configuration and only if the configuration lock has not timed out.- Specified by:
undoCheckOutin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Returns:
- true if the undo operation is successful, false otherwise.
- Throws:
DIException- If an error occurs during releasing the lock.java.rmi.RemoteException- if a communication-related exception occurs.
-
listConfigurations
public java.util.ArrayList listConfigurations(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteExceptionReturns a list of all configurations in the specified folder. If a configuration has a Solution Name, this name appears in the list, otherwise in the list appears the file path of the configuration. The configurations file paths returned are relative to the Server configuration codebase folder. The returned list is based on information, gathered by the Server on startup. If a new configuration file is added in the configuration codebase folder when the Server is already running, that configuration will not be listed by the method.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); for(alcfg in session.listConfigurations("test_folder")){ task.logmsg("getting name"); task.logmsg("Conf: " + alcfg); }- Specified by:
listConfigurationsin interfaceSession- Parameters:
aRelativePath- A folder relative to the Server configuration codebase folder.- Returns:
- A list of all configurations in the specified folder.
- Throws:
DIException- If an error occurs while retrieving configurations.java.rmi.RemoteException- if a communication-related exception occurs.
-
listFolders
public java.util.ArrayList listFolders(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteExceptionReturns a list of the child folders of the specified folder.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); for(p in session.listFolders("test_folder")){ task.logmsg("getting name"); task.logmsg("Folder: " + p); }- Specified by:
listFoldersin interfaceSession- Parameters:
aRelativePath- A folder relative to the Server configuration codebase folder.- Returns:
- A list of the child folders of the specified folder.
- Throws:
DIException- If an error occurs while retrieving child folder.java.rmi.RemoteException- if a communication-related exception occurs.
-
listAllConfigurations
public java.util.ArrayList listAllConfigurations() throws DIException, java.rmi.RemoteExceptionReturns a list all configurations in the directory subtree of the Server configuration codebase folder. If a configuration has a Solution Name, this name appears in the list, otherwise in the list appears the file path of the configuration. The configurations file paths returned are relative to the TDI Server configuration codebase folder. The returned list is based on information, gathered by the Server on startup. If a new configuration file is added in the configuration codebase folder when the Server is already running, that configuration will not be listed by the method.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); for(alcfg in session.listAllConfigurations()){ task.logmsg("getting name:"); task.logmsg("Conf: " + alcfg); }- Specified by:
listAllConfigurationsin interfaceSession- Returns:
- A list of all configurations from the whole configuration codebase directory subtree.
- Throws:
DIException- If an error occurs while retrieving configurations.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkOutConfiguration
public MetamergeConfig checkOutConfiguration(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteException
Checks out the specified configuration. Returns the MetamergeConfig object representing the configuration and locks that configuration on the Server.- Specified by:
checkOutConfigurationin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Returns:
- The MetamergeConfig object representing the specified configuration.
- Throws:
DIException- If an error occurs while checking out the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkOutConfiguration
public MetamergeConfig checkOutConfiguration(java.lang.String aRelativePath, java.lang.String aPassword) throws DIException, java.rmi.RemoteException
Checks out the specified password protected configuration. Returns the MetamergeConfig object representing the configuration and locks that configuration on the Server.- Specified by:
checkOutConfigurationin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).aPassword- Specify the password for password protected configurations.- Returns:
- The MetamergeConfig object representing the specified configuration.
- Throws:
DIException- If an error occurs while checking out the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkOutConfigurationAndLoad
public ConfigInstance checkOutConfigurationAndLoad(java.lang.String aRelativePath, java.lang.String aPassword) throws DIException, java.rmi.RemoteException
Checks out the specified configuration and starts a temporary Config Instance on the Server.- Specified by:
checkOutConfigurationAndLoadin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).aPassword- Specify the password for password protected configurations.- Returns:
- The ConfigInstance object representing the temporary ConfigIsntance started on the Server.
- Throws:
DIException- If an error occurs while checking out the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkOutConfigurationAndLoad
public ConfigInstance checkOutConfigurationAndLoad(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteException
Checks out the specified configuration and starts a temporary Config Instance on the Server.- Specified by:
checkOutConfigurationAndLoadin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Returns:
- The ConfigInstance object representing the temporary ConfigIsntance started on the Server.
- Throws:
DIException- If an error occurs while checking out the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkInConfiguration
public void checkInConfiguration(MetamergeConfig aConfiguration, java.lang.String aRelativePath) throws DIException, java.rmi.RemoteException
Saves the specified configuration and releases the lock. If a temporary ConfigInstance has been started on check out, it will be stopped as well.- Specified by:
checkInConfigurationin interfaceSession- Parameters:
aConfiguration- The MetamergeConfig object representing the configuration to be checked in.aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Throws:
DIException- If an error occurs while checking in the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkInConfiguration
public void checkInConfiguration(MetamergeConfig aConfiguration, java.lang.String aRelativePath, boolean aEncrypt) throws DIException, java.rmi.RemoteException
Encrypts and saves the specified configuration and releases the lock. If a temporary Config Instance has been started on check out, it will be stopped as well.- Specified by:
checkInConfigurationin interfaceSession- Parameters:
aConfiguration- The MetamergeConfig object representing the configuration to be checked in.aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).aEncrypt- If set to true, the configuration will be encrypted on the Server.- Throws:
DIException- If an error occurs while checking in the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkInAndLeaveCheckedOut
public void checkInAndLeaveCheckedOut(MetamergeConfig aConfiguration, java.lang.String aRelativePath) throws DIException, java.rmi.RemoteException
Checks in the specified configuration and leaves it checked out. The timeout for the lock on the configuration is reset.- Specified by:
checkInAndLeaveCheckedOutin interfaceSession- Parameters:
aConfiguration- The MetamergeConfig object representing the configuration to be checked in.aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Throws:
DIException- If an error occurs while checking in the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
checkInAndLeaveCheckedOut
public void checkInAndLeaveCheckedOut(MetamergeConfig configuration, java.lang.String relativePathOrSolutionName, boolean encrypt) throws DIException, java.rmi.RemoteException
Checks in the specified configuration and leaves it checked out. The timeout for the lock on the configuration is reset.- Specified by:
checkInAndLeaveCheckedOutin interfaceSession- Parameters:
configuration- The MetamergeConfig object representing the configuration to be checked in.relativePathOrSolutionName- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).encrypt- If set to true, the configuration will be encrypted on the Server.- Throws:
DIException- If an error occurs while checking in the configuration.java.rmi.RemoteException
-
createNewConfiguration
public MetamergeConfig createNewConfiguration(java.lang.String aRelativePath, boolean aOverwrite) throws DIException, java.rmi.RemoteException
Creates a new empty configuration and immediately checks it out. If a configuration with the specified path already exists and the aOverwrite parameter is set to false the operation will fail and an Exception will be thrown.- Specified by:
createNewConfigurationin interfaceSession- Parameters:
aRelativePath- The path of the new configuration file relative to the Server configuration codebase folder.aOverwrite- Specify whether to overwrite or not an already exising configuration file.- Returns:
- The MetamergeConfig object representing the newly created configuration.
- Throws:
DIException- If an error occurs while creating the new configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
createNewConfigurationAndLoad
public ConfigInstance createNewConfigurationAndLoad(java.lang.String aRelativePath, boolean aOverwrite) throws DIException, java.rmi.RemoteException
Creates a new empty configuration, immediately checks it out and loads a temporary Config Instance on the Server. If a configuration with the specified path already exists and the aOverwrite parameter is set to false the operation will fail and an Exception will be thrown.- Specified by:
createNewConfigurationAndLoadin interfaceSession- Parameters:
aRelativePath- The path of the new configuration file relative to the Server configuration codebase folder.aOverwrite- Specify whether to overwrite or not an already existing configuration file.- Returns:
- The ConfigInstance object representing the temporary ConfigIsntance started on the Server.
- Throws:
DIException- If an error occurs while creating the new configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
isConfigurationCheckedOut
public boolean isConfigurationCheckedOut(java.lang.String aRelativePath) throws DIException, java.rmi.RemoteExceptionChecks if the specified configuration is checked out on the Server.- Specified by:
isConfigurationCheckedOutin interfaceSession- Parameters:
aRelativePath- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Returns:
- true if the specified configuration is checked out, false otherwise.
- Throws:
DIException- If an error occurs while checking the configuration.java.rmi.RemoteException- if a communication-related exception occurs.
-
sendCustomNotification
public void sendCustomNotification(java.lang.String aType, java.lang.String aId, java.lang.Object aData) throws DIException, java.rmi.RemoteExceptionSends a custom, user defined notification to all registered listeners.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var t = work.getAttribute("event.type"); var id = work.getAttribute("event.id"); var data = work.getAttribute("event.userData"); session.sendCustomNotification(t, id, data);- Specified by:
sendCustomNotificationin interfaceSession- Parameters:
aType- Notification type, will be automatically prefixed with "user."aId- Notification ID, usually identifies the object this event originated from.aData- Custom user data. Make sure the object passed is serializable if you want to send this event notification in a remote context.- Throws:
DIException- If an error occurs while sending the notification.java.rmi.RemoteException- if a communication-related exception occurs.
-
getSystemQueue
public SystemQueue getSystemQueue() throws DIException, java.rmi.RemoteException
Gets the remote Server API SystemQueue representation object- Specified by:
getSystemQueuein interfaceSession- Returns:
- the remote Server API SystemQueue representation object
- Throws:
DIException- If the System Queue is turned off or the System Queue cannot be initializedjava.rmi.RemoteException- If the Server API RMI connection fails
-
getConfigFolderPath
public java.lang.String getConfigFolderPath()
Gets the value of the api.config.folder property in the remote server as a complete path. If not set, then returns an empty string.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var p = session.getConfigFolderPath(); var f = new java.io.File(p); if (f.exists()) task.logmsg("Folder path: " + p);- Specified by:
getConfigFolderPathin interfaceSession- Returns:
- The path of the config folder on the remote machine.
-
getIdentity
public Identity getIdentity()
Returns the Identity;- Returns:
- Identity object
-
invokeCustom
public java.lang.Object invokeCustom(java.lang.String aCustomClassName, java.lang.String aMethodName, java.lang.Object[] aParams) throws DIException, java.rmi.RemoteExceptionInvokes the specified method from the specified class. The method must be static. This method cannot invoke methods with null parameter values. All parameter values in the parameter object array MUST be non-null. If any value is null an Exception is thrown. If a user wants to invoke a method with a null parameter, he/she must use the otherinvokeCustommethod. The usage of this method can be turned on/off. There is a property in the global.properties file called api.custom.method.invoke.on. If this property is set to true then this method can be invoked, otherwise an exception is thrown if this method is invoked. There is a restriction on the classes which can be directly invoked. The allowed classes are described in another property in the global.properties file called api.custom.method.invoke.allowed.classes. Only classes listed in this property can be directly invoked by this method. If a user tries to invoke a class which is not in this list then an exception is thrown.Example: Suppose the following class is packaged in a jar file, which is then placed in the 'jars' folder of TDI:
public class MyClass {Suppose the global.properties TDI configuration file contains the following lines:
public static Integer multiply(Integer a , Integer b){
return new Integer(a.intValue() * b.intValue());
}
}
api.custom.method.invoke.on=true
api.custom.method.invoke.allowed.classes=MyClass
Now we can do the following:var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var result = session.invokeCustom("MyClass", "multiply", new Array(3, 5));- Specified by:
invokeCustomin interfaceSession- Parameters:
aCustomClassName- The class containing the method to be invoked.aMethodName- The name of the method to be invoked.aParams- Array of parameters used by the invoked method.- Returns:
- the result of dispatching the method represented with parameters aParams
- Throws:
DIException- If an error occurs while invoking the method.java.rmi.RemoteException- If a communication-related exception occurs.
-
invokeCustom
public java.lang.Object invokeCustom(java.lang.String aCustomClassName, java.lang.String aMethodName, java.lang.Object[] aParamsValue, java.lang.String[] aParamsClass) throws DIException, java.rmi.RemoteExceptionInvokes the specified method from the specified class. The method must be static. This method is used when the user wants to invoke the specified method with a null parameter value. The main difference between these twoinvokeCustommethods is that when using this method the user MUST specify the parameters' type. The usage of this method can be turned on/off. There is a property in the global.properties file called api.custom.method.invoke.on. If this property is set to true then this method can be invoked, otherwise an exception is thrown if this method is invoked. There is a restriction on the classes which can be directly invoked. The allowed classes are described in another property in the global.properties file called api.custom.method.invoke.allowed.classes. Only classes listed in this property can be directly invoked by this method. If the user tries to invoke a class which is not in this list then an exception is thrown.Example: Suppose the following class is packaged in a jar file, which is then placed in the 'jars' folder of TDI:
public class MyClass {Suppose the global.properties TDI configuration file contains the following lines:
public static Integer multiply(Integer a , Integer b){
return new Integer(a.intValue() * b.intValue());
}
}
api.custom.method.invoke.on=true
api.custom.method.invoke.allowed.classes=MyClass
Now we can do the following:var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var result = session.invokeCustom("MyClass", "multiply", new Array(3, 5), new Array("java.lang.Integer", "java.lang.Integer"));- Specified by:
invokeCustomin interfaceSession- Parameters:
aCustomClassName- The class containing the method to be invoked.aMethodName- The name of the method to be invoked.aParamsValue- Array of parameters used by the invoked method.aParamsClass- The type of the parameters used by the invoked method.- Returns:
- the result of dispatching the method represented with parameters' types aParamsClass.
- Throws:
DIException- If an error occurs while invoking the method.java.rmi.RemoteException- If a communication-related exception occurs.
-
deleteConfiguration
public void deleteConfiguration(java.lang.String relativePathOrSolutionName) throws DIException, java.rmi.RemoteExceptionDelete a file from the configuration codebase folder. You must be admin to execute this method.- Specified by:
deleteConfigurationin interfaceSession- Parameters:
relativePathOrSolutionName- The path to the configuration relative to the Server configuration codebase folder or the Solution Name of the configuration (the configuration must be inside the configuration codebase folder).- Throws:
DIException- The file is currently checked-out or deletion failed (e.g. the file does not exist).java.rmi.RemoteException- If a communication-related exception occurs.
-
startTempConfigInstance
public ConfigInstance startTempConfigInstance(java.lang.String xmlConfig, boolean keepAlive, java.lang.String runName, java.lang.String overrideProps) throws DIException, java.rmi.RemoteException
Start a configuration instance which has no associated configuration file. You must be admin to execute this method.- Specified by:
startTempConfigInstancein interfaceSession- Parameters:
xmlConfig- A configuration as a XML string.keepAlive- Whentruethe Config Instance will stay alive even when no threads are running, whenfalsethe Config Instance will automatically terminate when its last thread terminates.runName- A name which will be used as the configuration instance id. It must not coincide with any of the id's of running configuration instances. It must not contain forward or back slashes or colons. This is an optional parameter that can be null.overrideProps- Use to redirect property stores to load their contents from files different from the ones specified in the configuration. Property stores and their corresponding files are specified as key-value pairs separated with spaces, e.g.: "mystore1=file1.properties mystore2=file2.properties". You cannot override a property store from an included configuration, because its property stores are not directly accessible. This is an optional parameter that can be null.- Returns:
- A handle to the started configuration instance.
- Throws:
DIException- If an error occurs on starting the new Config Instance or if the run name is not a valid file name.java.rmi.RemoteException- If a communication-related exception occurs.
-
startConfigInstance
public ConfigInstance startConfigInstance(java.lang.String configPathOrSolutionName, boolean keepAlive, java.lang.String password, java.lang.String runName, java.lang.String overrideProps, LogListener logListener) throws DIException, java.rmi.RemoteException
Starts a new Config Instance on the Server with the configuration given.Example:
var sf = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory"); var session = sf.createSession(); var pass = "Difficult password"; session.startConfigInstance("testconfig.xml", false, pass, "myrunname", "mystore=mynewstore.properties", null);- Specified by:
startConfigInstancein interfaceSession- Parameters:
configPathOrSolutionName- The URL where the configuration file is loaded from or the Solution Name of the configuration file. Only configuration files located in the configuration codebase folder can be referenced by Solution Name.keepAlive- Whentruethe Config Instance will stay alive even when no threads are running, whenfalsethe Config Instance will automatically terminate when its last thread terminates.password- Specify the password of the configuration when it is password-protected; specifynullwhen the configuration is not password-protected.runName- A name which will be used as the configuration instance id. It must not coincide with any of the ids of running configuration instances. It must be a valid file name on the file system, on which TDI is running, because the configuration instance id (which is the same as the run name) is used when storing certain configuration-instance-specific information, such as the System Logs. To avoid file system problems, TDI forbids the following symbols to appear inside a run name: '\' '/' ':' '*' '?' '"' '<' '>' '|'. The run name is an optional parameter that can be null.overrideProps- Use to redirect property stores to load their contents from files different from the ones specified in the configuration file. Property stores and their corresponding files are specified as key-value pairs separated with spaces, e.g.: "mystore1=file1.properties mystore2=file2.properties". You cannot override a property store from an included configuration file, because its property stores are not directly accessible in the including file. This is an optional parameter that can be null.logListener- Listener for messages logged by the configuration instance.- Returns:
- ConfigInstance object representing currently started configuration instance.
- Throws:
DIException- If an error occurs on starting the new Config Instance or if the run name contains any of the following symbols: '\' '/' ':' '*' '"' '<' '>' '|'.java.rmi.RemoteException- if a communication-related exception occurs.
-
startTempConfigInstance
public ConfigInstance startTempConfigInstance(java.lang.String xmlConfig, boolean keepAlive, java.lang.String runName, java.lang.String overrideProps, LogListener logListener) throws DIException, java.rmi.RemoteException
Start a configuration instance which has no associated configuration file. You must be admin to execute this method.- Specified by:
startTempConfigInstancein interfaceSession- Parameters:
xmlConfig- A configuration as a XML string.keepAlive- Whentruethe Config Instance will stay alive even when no threads are running, whenfalsethe Config Instance will automatically terminate when its last thread terminates.runName- A name which will be used as the configuration instance id. It must not coincide with any of the id's of running configuration instances. It must not contain forward or back slashes or colons. This is an optional parameter that can be null.overrideProps- Use to redirect property stores to load their contents from files different from the ones specified in the configuration. Property stores and their corresponding files are specified as key-value pairs separated with spaces, e.g.: "mystore1=file1.properties mystore2=file2.properties". You cannot override a property store from an included configuration, because its property stores are not directly accessible. This is an optional parameter that can be null.logListener- Listener for messages logged by this configuration instance.- Returns:
- A handle to the started configuration instance.
- Throws:
DIException- If an error occurs on starting the new Config Instance or if the run name is not a valid file name.java.rmi.RemoteException- If a communication-related exception occurs.
-
startTombstoneManager
public void startTombstoneManager() throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionStarts the TombstoneManager.- Specified by:
startTombstoneManagerin interfaceSession- Throws:
DIExceptionjava.rmi.RemoteException- If a communication-related exception occurs.
-
getPersistentObject
public java.lang.Object getPersistentObject(java.lang.String key) throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionThis method retrieves a named object from the default system property store.- Specified by:
getPersistentObjectin interfaceSession- Parameters:
key- The unique key- Returns:
- Object
- Throws:
DIExceptionjava.rmi.RemoteException
-
setPersistentObject
public java.lang.Object setPersistentObject(java.lang.String key, java.lang.Object value) throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionThis method stores a named object in the default system property store.- Specified by:
setPersistentObjectin interfaceSession- Parameters:
key- The unique keyvalue- The object to store (must be java serializable)- Returns:
- The old object if any
- Throws:
DIExceptionjava.rmi.RemoteException
-
deletePersistentObject
public java.lang.Object deletePersistentObject(java.lang.String key) throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionThis method deletes a named object in the default system property store.- Specified by:
deletePersistentObjectin interfaceSession- Parameters:
key- The unique key- Returns:
- The old object if any
- Throws:
DIExceptionjava.rmi.RemoteException
-
getJavaProperty
public java.lang.String getJavaProperty(java.lang.String prop) throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionReturns the value of a Java System property.- Specified by:
getJavaPropertyin interfaceSession- Parameters:
prop- The property name- Returns:
- The property value or null if no such property exists
- Throws:
DIExceptionjava.rmi.RemoteException
-
setJavaProperty
public void setJavaProperty(java.lang.String prop, java.lang.String value) throws DIException, java.rmi.RemoteExceptionDescription copied from interface:SessionSets the value of a Java System property.- Specified by:
setJavaPropertyin interfaceSession- Parameters:
prop- The property namevalue- The property value- Throws:
DIExceptionjava.rmi.RemoteException
-
-