Class AdminModule


  • public final class AdminModule
    extends Object
    The AdminModule class allows to set an administrator connection to a given JORAM server, and provides administration and monitoring methods at a server/platform level.

    The AdminModule class uses a unique static connection to the Joram server, the connection is opened through connect method and closed by calling disconnect.

    See Also:
    AdminWrapper
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String ADM_NAME_PROPERTY  
      private static Connection cnx
      The connection used to link the administrator and the platform.
      static String DEFAULT_ADM_NAME  
      protected static String localHost
      The host name or IP address of the server the module is connected to.
      protected static int localPort
      The port number of the client connection.
      private static Object lock
      Lock object used to avoid multiple connections in case of concurrent connect.
      static org.objectweb.util.monolog.api.Logger logger  
      (package private) static AdminWrapper wrapper
      The administration wrapper needed to interact with the Joram server.
    • Constructor Summary

      Constructors 
      Constructor Description
      AdminModule()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void abortRequest()  
      static String addAMQPBridgeConnection​(int serverId, String urls)
      Adds an AMQP server and starts a live connection with it, accessible via the url provided.
      static void addDomain​(String domain, int sid, int port)
      Adds a domain to the platform.
      static void addDomain​(String domain, String network, int sid, int port)
      Adds a domain to the platform using a specific network component.
      static String addJMSBridgeConnection​(int serverId, String urls)
      Adds a JMS server and starts a live connection with it, accessible via the url provided.
      static void addServer​(int sid, String host, String domain, int port, String server)
      Adds a server to the platform.
      static void addServer​(int sid, String host, String domain, int port, String server, String[] services, String[] args)
      Adds a server to the platform.
      static void collocatedConnect()
      Opens a connection with the collocated Joram server.
      static void collocatedConnect​(String name, String password)
      Opens a connection with the collocated JORAM server.
      static void collocatedConnect​(String name, String password, String identityClass)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect()
      Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.
      static void connect​(String host, int port, String name, String password)
      Opens a TCP connection with the Joram server running on a given host and listening to a given port.
      static void connect​(String host, int port, String name, String password, int cnxTimer)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect​(String host, int port, String name, String password, int cnxTimer, String reliableClass)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect​(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect​(String name, String password)
      Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.
      static void connect​(String name, String password, int cnxTimer)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect​(String name, String password, int cnxTimer, String reliableClass)
      Deprecated.
      Next to Joram 5.2 use connect methods with ConnectionFactory.
      static void connect​(ConnectionFactory cf)
      Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
      static void connect​(ConnectionFactory cf, String name, String password)
      Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
      static void connect​(ConnectionFactory cf, String name, String password, String identityClass)
      Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
      static void connect​(TopicConnectionFactory cf, String name, String password)
      Deprecated.
      No longer use TopicConnectionFactory next to Joram 5.2.
      static void connect​(TopicConnectionFactory cf, String name, String password, String identityClass)
      Deprecated.
      No longer use TopicConnectionFactory next to Joram 5.2.
      static Destination createQueue​(int serverId, String name, String className, Properties prop)
      Creates or retrieves a queue destination on a given JORAM server.
      static Destination createTopic​(int serverId, String name, String className, Properties prop)
      Creates or retrieves a topic destination on a given JORAM server.
      static User createUser​(String name, String password, int serverId, String identityClassName)
      Admin method creating a user for a given server and instantiating the corresponding User object.
      static String deleteAMQPBridgeConnection​(int serverId, String names)
      Removes the live connection to the specified AMQP server.
      static String deleteJMSBridgeConnection​(int serverId, String names)
      Removes the live connection to the specified AMQP server.
      static String deleteJMSBridgeConnection​(int serverId, String names, boolean async)
      Removes the live connection to the specified AMQP server.
      static String deleteJMSPBridgeConnection​(int serverId, String names)
      Deprecated. 
      static String deleteJMSPBridgeConnection​(int serverId, String names, boolean async)
      Deprecated. 
      static void disconnect()
      Closes the administration connection.
      static void doCollocatedConnect​(String name, String password, String identityClass)
      Opens a connection with the collocated JORAM server.
      private static void doConnect​(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass)
      Opens a TCP connection with the Joram server running on a given host and listening to a given port.
      private static void doConnect​(AbstractConnectionFactory cf, String name, String password, String identityClass)
      Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
      static org.objectweb.joram.shared.admin.AdminReply doRequest​(org.objectweb.joram.shared.admin.AdminRequest request)
      Deprecated. 
      static void executeAdmin​(Reader reader)  
      static void executeXMLAdmin​(String path)
      This method execute the XML script file that the pathname is given in parameter.
      static void executeXMLAdmin​(String cfgDir, String cfgFileName)
      This method execute the XML script file that the location is given in parameter.
      static void exportRepositoryToFile​(String exportDir, String exportFilename)
      Export the repository content to an XML file - only the destinations objects are retrieved in this version - xml script format of the admin objects (joramAdmin.xml)
      static String getConfiguration()
      Returns the current servers configuration (a3servers.xml).
      static Queue getDefaultDMQ()
      Returns the default dead message queue for the local server, null if not set.
      static Queue getDefaultDMQ​(int serverId)
      Returns the default dead message queue for a given server, null if not set.
      static String getDefaultDMQId()
      Returns the default dead message queue for the local server, null if not set.
      static String getDefaultDMQId​(int serverId)
      Returns the default dead message queue for a given server, null if not set.
      static int getDefaultThreshold()
      Returns the default threshold value for the local server, -1 if not set.
      static int getDefaultThreshold​(int serverId)
      Returns the default threshold value for a given server, -1 if not set.
      static Destination[] getDestinations()
      Returns the list of all destinations that exist on the local server, or null if none exist.
      static Destination[] getDestinations​(int serverId)
      Returns the list of all destinations that exist on a given server, or null if none exist.
      static List getDestinationsList()
      Deprecated.
      No longer supported next to Joram 5.2
      static List getDestinationsList​(int serverId)
      Deprecated.
      No longer supported next to Joram 5.2
      static String[] getDomainNames​(int serverId)
      Returns the list of the domain names that contains the specified server.
      static Hashtable getJMXAttribute​(int serverId, String attname)
      Returns JMX attribute value for the specified server.
      static Hashtable getJMXAttribute​(String attname)
      Returns JMX attribute value for the local server.
      static String getLocalHost()
      Returns the host name of the server the module is connected to.
      static int getLocalPort()
      Returns the port number of the server the module is connected to.
      static Server getLocalServer()  
      static int getLocalServerId()
      Returns the identifier of the server the module is connected to.
      static Server[] getServers()  
      static Server[] getServers​(String domain)
      Returns the list of the servers' that belong to the specified domain
      static List getServersIds()
      Deprecated.
      No longer supported next to Joram 5.2
      static List getServersIds​(String domain)
      Deprecated.
      No longer supported next to Joram 5.2
      static Hashtable getStatistics()
      Returns statistics for the local server.
      static Hashtable getStatistics​(int serverId)
      Returns statistics for the the specified server.
      static long getTimeOutToAbortRequest()
      Gets the timeout in ms before abortion of administration requests.
      static User[] getUsers()
      Returns the list of all users that exist on the local server, or null if none exist.
      static User[] getUsers​(int serverId)
      Returns the list of all users that exist on a given server, or null if none exist.
      static List getUsersList()
      Deprecated.
      No longer supported next to Joram 5.2
      static List getUsersList​(int serverId)
      Deprecated.
      No longer supported next to Joram 5.2
      static AdminWrapper getWrapper()
      Returns the administration wrapper.
      static String invokeStaticServerMethod​(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args)
      Invokes the specified static method with the specified parameters on the chosen server.
      static String invokeStaticServerMethod​(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async)
      Invokes the specified static method with the specified parameters on the chosen server.
      static String invokeStaticServerMethod​(String className, String methodName, Class<?>[] parameterTypes, Object[] args)
      Invokes the specified static method with the specified parameters on the local server.
      static String invokeStaticServerMethod​(String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async)
      Invokes the specified static method with the specified parameters on the local server.
      static void main​(String[] args)
      This method execute the XML script file that the path is given in parameter.
      static org.objectweb.joram.shared.admin.AdminReply processAdmin​(String targetId, int command, Properties prop)
      The method send the admin JMS message on JORAM server (AdminTopic).
      static void removeDomain​(String domain)
      Removes a domain from the platform.
      static void removeServer​(int sid)
      Removes a server from the platform.
      static void setDefaultDMQ​(int serverId, Queue dmq)
      Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).
      static void setDefaultDMQ​(Queue dmq)
      Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
      static void setDefaultDMQId​(int serverId, String dmqId)
      Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).
      static void setDefaultDMQId​(String dmqId)
      Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
      static void setDefaultThreshold​(int threshold)
      Sets a given value as the default threshold for the local server (-1 for unsetting previous value).
      static void setDefaultThreshold​(int serverId, int threshold)
      Sets a given value as the default threshold for a given server (-1 for unsetting previous value).
      static void setTimeOutToAbortRequest​(long timeOut)
      Sets the timeout in ms before abortion of administration requests.
      static void stopServer()
      Stops the platform local server.
      static void stopServer​(int serverId)
      Stops a given server of the platform.
    • Field Detail

      • localHost

        protected static String localHost
        The host name or IP address of the server the module is connected to.
      • localPort

        protected static int localPort
        The port number of the client connection.
      • lock

        private static Object lock
        Lock object used to avoid multiple connections in case of concurrent connect.
      • cnx

        private static Connection cnx
        The connection used to link the administrator and the platform.
      • wrapper

        static AdminWrapper wrapper
        The administration wrapper needed to interact with the Joram server.
      • logger

        public static org.objectweb.util.monolog.api.Logger logger
    • Constructor Detail

      • AdminModule

        public AdminModule()
    • Method Detail

      • main

        public static void main​(String[] args)
        This method execute the XML script file that the path is given in parameter.
        Since:
        4.3.12
      • connect

        public static void connect​(ConnectionFactory cf,
                                   String name,
                                   String password)
                            throws ConnectException,
                                   AdminException
        Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
        Parameters:
        cf - The Joram's ConnectionFactory to use for connecting.
        name - Administrator's name.
        password - Administrator's password.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
        ClassCastException - If the ConnectionFactory is not a Joram ConnectionFactory.
      • connect

        public static void connect​(ConnectionFactory cf,
                                   String name,
                                   String password,
                                   String identityClass)
                            throws ConnectException,
                                   AdminException
        Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
        Parameters:
        cf - The Joram's ConnectionFactory to use for connecting.
        name - Administrator's name.
        password - Administrator's password.
        identityClass - identity class name.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
        ClassCastException - If the ConnectionFactory is not a Joram ConnectionFactory.
      • connect

        public static void connect​(TopicConnectionFactory cf,
                                   String name,
                                   String password)
                            throws ConnectException,
                                   AdminException
        Deprecated.
        No longer use TopicConnectionFactory next to Joram 5.2.
        Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given TopicConnectionFactory.
        Parameters:
        cf - The TopicConnectionFactory to use for connecting.
        name - Administrator's name.
        password - Administrator's password.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
        ClassCastException - If the ConnectionFactory is not a Joram ConnectionFactory.
      • connect

        public static void connect​(TopicConnectionFactory cf,
                                   String name,
                                   String password,
                                   String identityClass)
                            throws ConnectException,
                                   AdminException
        Deprecated.
        No longer use TopicConnectionFactory next to Joram 5.2.
        Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given TopicConnectionFactory.
        Parameters:
        cf - The TopicConnectionFactory to use for connecting.
        name - Administrator's name.
        password - Administrator's password.
        identityClass - identity class name.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
        ClassCastException - If the ConnectionFactory is not a Joram ConnectionFactory.
      • connect

        public static void connect​(String name,
                                   String password,
                                   int cnxTimer)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.
        Parameters:
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        Throws:
        UnknownHostException - Never thrown.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • connect

        public static void connect​(String host,
                                   int port,
                                   String name,
                                   String password)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Opens a TCP connection with the Joram server running on a given host and listening to a given port.
        Parameters:
        host - The name or IP address of the host the server is running on.
        port - The number of the port the server is listening to.
        name - Administrator's name.
        password - Administrator's password.
        Throws:
        UnknownHostException - If the host is invalid.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • connect

        public static void connect​(String host,
                                   int port,
                                   String name,
                                   String password,
                                   int cnxTimer)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a TCP connection with the Joram server running on a given host and listening to a given port.
        Parameters:
        host - The name or IP address of the host the server is running on.
        port - The number of the port the server is listening to.
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        Throws:
        UnknownHostException - If the host is invalid.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • connect

        public static void connect​(String name,
                                   String password,
                                   int cnxTimer,
                                   String reliableClass)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a TCP connection with the Joram server running on the default "locahost" host and listening to the default 16010 port.
        Parameters:
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        reliableClass - Reliable class name.
        Throws:
        UnknownHostException - Never thrown.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • connect

        public static void connect​(String host,
                                   int port,
                                   String name,
                                   String password,
                                   int cnxTimer,
                                   String reliableClass)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a TCP connection with the Joram server running on a given host and listening to a given port.
        Parameters:
        host - The name or IP address of the host the server is running on.
        port - The number of the port the server is listening to.
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        reliableClass - Reliable class name.
        Throws:
        UnknownHostException - If the host is invalid.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • connect

        public static void connect​(String host,
                                   int port,
                                   String name,
                                   String password,
                                   int cnxTimer,
                                   String reliableClass,
                                   String identityClass)
                            throws UnknownHostException,
                                   ConnectException,
                                   AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a TCP connection with the Joram server running on a given host and listening to a given port.
        Parameters:
        host - The name or IP address of the host the server is running on.
        port - The number of the port the server is listening to.
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        reliableClass - Reliable class name.
        identityClass - identity class name.
        Throws:
        UnknownHostException - If the host is invalid.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • doConnect

        private static void doConnect​(String host,
                                      int port,
                                      String name,
                                      String password,
                                      int cnxTimer,
                                      String reliableClass,
                                      String identityClass)
                               throws UnknownHostException,
                                      ConnectException,
                                      AdminException
        Opens a TCP connection with the Joram server running on a given host and listening to a given port.
        Parameters:
        host - The name or IP address of the host the server is running on.
        port - The number of the port the server is listening to.
        name - Administrator's name.
        password - Administrator's password.
        cnxTimer - Timer in seconds during which connecting to the server is attempted.
        reliableClass - Reliable class name.
        identityClass - identity class name.
        Throws:
        UnknownHostException - If the host is invalid.
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • collocatedConnect

        public static void collocatedConnect​(String name,
                                             String password)
                                      throws ConnectException,
                                             AdminException
        Opens a connection with the collocated JORAM server.
        Parameters:
        name - Administrator's name.
        password - Administrator's password.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • collocatedConnect

        public static void collocatedConnect​(String name,
                                             String password,
                                             String identityClass)
                                      throws ConnectException,
                                             AdminException
        Deprecated.
        Next to Joram 5.2 use connect methods with ConnectionFactory.
        Opens a connection with the collocated JORAM server.
        Parameters:
        name - Administrator's name.
        password - Administrator's password.
        identityClass - identity class name.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • doCollocatedConnect

        public static void doCollocatedConnect​(String name,
                                               String password,
                                               String identityClass)
                                        throws ConnectException,
                                               AdminException
        Opens a connection with the collocated JORAM server.
        Parameters:
        name - Administrator's name.
        password - Administrator's password.
        identityClass - identity class name.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • doConnect

        private static void doConnect​(AbstractConnectionFactory cf,
                                      String name,
                                      String password,
                                      String identityClass)
                               throws ConnectException,
                                      AdminException
        Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given ConnectionFactory.
        Parameters:
        cf - The Joram's ConnectionFactory to use for connecting.
        name - Administrator's name.
        password - Administrator's password.
        identityClass - identity class name.
        Throws:
        ConnectException - If connecting fails.
        AdminException - If the administrator identification is incorrect.
      • doRequest

        public static org.objectweb.joram.shared.admin.AdminReply doRequest​(org.objectweb.joram.shared.admin.AdminRequest request)
                                                                     throws AdminException,
                                                                            ConnectException
        Deprecated.
        Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.
        Parameters:
        request - the administration request to send
        Returns:
        the reply message
        Throws:
        ConnectException - If the connection to the platform fails.
        AdminException - If the platform's reply is invalid, or if the request failed.
      • disconnect

        public static void disconnect()
        Closes the administration connection.
      • stopServer

        public static void stopServer​(int serverId)
                               throws ConnectException,
                                      AdminException
        Stops a given server of the platform.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - Identifier of the server to stop.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • addServer

        public static void addServer​(int sid,
                                     String host,
                                     String domain,
                                     int port,
                                     String server)
                              throws ConnectException,
                                     AdminException
        Adds a server to the platform.
        Parameters:
        sid - Id of the added server
        host - Address of the host where the added server is started
        domain - Name of the domain where the server is added
        port - Listening port of the server in the specified domain
        server - Name of the added server
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • addServer

        public static void addServer​(int sid,
                                     String host,
                                     String domain,
                                     int port,
                                     String server,
                                     String[] services,
                                     String[] args)
                              throws ConnectException,
                                     AdminException
        Adds a server to the platform.
        Parameters:
        sid - Id of the added server
        host - Address of the host where the added server is started
        domain - Name of the domain where the server is added
        port - Listening port of the server in the specified domain
        server - Name of the added server
        services - Names of the service to start within the server
        args - Services' arguments
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • addDomain

        public static void addDomain​(String domain,
                                     int sid,
                                     int port)
                              throws ConnectException,
                                     AdminException
        Adds a domain to the platform.
        Parameters:
        domain - Name of the added domain.
        sid - Id of the router server that gives access to the added domain.
        port - Listening port in the added domain of the router server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • addDomain

        public static void addDomain​(String domain,
                                     String network,
                                     int sid,
                                     int port)
                              throws ConnectException,
                                     AdminException
        Adds a domain to the platform using a specific network component.
        Parameters:
        domain - Name of the added domain.
        network - Classname of the network component to use.
        sid - Id of the router server that gives access to the added domain.
        port - Listening port in the added domain of the router server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getStatistics

        public static Hashtable getStatistics​(int serverId)
                                       throws ConnectException,
                                              AdminException
        Returns statistics for the the specified server.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - Unique identifier of the server.
        Returns:
        the statistics for the the specified server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getJMXAttribute

        public static Hashtable getJMXAttribute​(int serverId,
                                                String attname)
                                         throws ConnectException,
                                                AdminException
        Returns JMX attribute value for the specified server.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - Unique identifier of the server.
        Returns:
        the statistics for the the specified server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getDefaultDMQ

        public static Queue getDefaultDMQ​(int serverId)
                                   throws ConnectException,
                                          AdminException
        Returns the default dead message queue for a given server, null if not set.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - Unique identifier of the server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultDMQ

        public static void setDefaultDMQ​(Queue dmq)
                                  throws ConnectException,
                                         AdminException
        Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
        Parameters:
        dmq - The dmq to be set as the default one.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • setDefaultDMQ

        public static void setDefaultDMQ​(int serverId,
                                         Queue dmq)
                                  throws ConnectException,
                                         AdminException
        Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - The identifier of the server.
        dmq - The dmq to be set as the default one.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getDefaultDMQId

        public static String getDefaultDMQId​(int serverId)
                                      throws ConnectException,
                                             AdminException
        Returns the default dead message queue for a given server, null if not set.

        The request fails if the target server does not belong to the platform.

        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultDMQId

        public static void setDefaultDMQId​(String dmqId)
                                    throws ConnectException,
                                           AdminException
        Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
        Parameters:
        dmqId - The dmqId (AgentId) to be set as the default one.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • setDefaultDMQId

        public static void setDefaultDMQId​(int serverId,
                                           String dmqId)
                                    throws ConnectException,
                                           AdminException
        Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - The identifier of the server.
        dmqId - The dmqId (AgentId) to be set as the default one.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getDefaultThreshold

        public static int getDefaultThreshold​(int serverId)
                                       throws ConnectException,
                                              AdminException
        Returns the default threshold value for a given server, -1 if not set.

        The request fails if the target server does not belong to the platform.

        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultThreshold

        public static void setDefaultThreshold​(int threshold)
                                        throws ConnectException,
                                               AdminException
        Sets a given value as the default threshold for the local server (-1 for unsetting previous value).
        Parameters:
        threshold - The threshold value to be set.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • setDefaultThreshold

        public static void setDefaultThreshold​(int serverId,
                                               int threshold)
                                        throws ConnectException,
                                               AdminException
        Sets a given value as the default threshold for a given server (-1 for unsetting previous value).

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - The identifier of the server.
        threshold - The threshold value to be set.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getServersIds

        public static List getServersIds​(String domain)
                                  throws ConnectException,
                                         AdminException
        Deprecated.
        No longer supported next to Joram 5.2
        Returns the list of the servers' identifiers that belong to the specified domain
        Parameters:
        domain - Name of the domain.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • getServers

        public static Server[] getServers​(String domain)
                                   throws ConnectException,
                                          AdminException
        Returns the list of the servers' that belong to the specified domain
        Parameters:
        domain - Name of the domain.
        Returns:
        An array containing the list of the servers of the specified domain.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • getDestinationsList

        public static List getDestinationsList()
                                        throws ConnectException,
                                               AdminException
        Deprecated.
        No longer supported next to Joram 5.2
        Returns the list of all destinations that exist on the local server, or an empty list if none exist.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - Never thrown.
      • getDestinationsList

        public static List getDestinationsList​(int serverId)
                                        throws ConnectException,
                                               AdminException
        Deprecated.
        No longer supported next to Joram 5.2
        Returns the list of all destinations that exist on a given server, or an empty list if none exist.

        The request fails if the target server does not belong to the platform.

        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • getDestinations

        public static Destination[] getDestinations()
                                             throws ConnectException,
                                                    AdminException
        Returns the list of all destinations that exist on the local server, or null if none exist.
        Returns:
        An array containing the list of all destinations of the local server or null if none exists.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - Never thrown.
      • getDestinations

        public static Destination[] getDestinations​(int serverId)
                                             throws ConnectException,
                                                    AdminException
        Returns the list of all destinations that exist on a given server, or null if none exist.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - The unique identifier of the selected server.
        Returns:
        An array containing the list of all destinations of the local server or null if none exists.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • getUsersList

        public static List getUsersList​(int serverId)
                                 throws ConnectException,
                                        AdminException
        Deprecated.
        No longer supported next to Joram 5.2
        Returns the list of all users that exist on a given server, or an empty list if none exist.

        The request fails if the target server does not belong to the platform.

        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getUsers

        public static User[] getUsers()
                               throws ConnectException,
                                      AdminException
        Returns the list of all users that exist on the local server, or null if none exist.
        Returns:
        An array containing all users defined on the local server, or null if none exist.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • getUsers

        public static User[] getUsers​(int serverId)
                               throws ConnectException,
                                      AdminException
        Returns the list of all users that exist on a given server, or null if none exist.

        The request fails if the target server does not belong to the platform.

        Parameters:
        serverId - Unique identifier of the given server.
        Returns:
        An array containing all users defined on the local server, or null if none exist.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • getLocalHost

        public static String getLocalHost()
                                   throws ConnectException
        Returns the host name of the server the module is connected to.
        Throws:
        ConnectException - If the admin connection is not established.
      • getLocalPort

        public static int getLocalPort()
                                throws ConnectException
        Returns the port number of the server the module is connected to.
        Throws:
        ConnectException - If the admin connection is not established.
      • executeXMLAdmin

        public static void executeXMLAdmin​(String cfgDir,
                                           String cfgFileName)
                                    throws Exception
        This method execute the XML script file that the location is given in parameter.
        Parameters:
        cfgDir - The directory containing the file.
        cfgFileName - The script filename.
        Throws:
        Exception
        Since:
        4.3.10
      • executeXMLAdmin

        public static void executeXMLAdmin​(String path)
                                    throws Exception
        This method execute the XML script file that the pathname is given in parameter.
        Parameters:
        path - The script pathname.
        Throws:
        Exception
        Since:
        4.3.10
      • exportRepositoryToFile

        public static void exportRepositoryToFile​(String exportDir,
                                                  String exportFilename)
                                           throws AdminException
        Export the repository content to an XML file - only the destinations objects are retrieved in this version - xml script format of the admin objects (joramAdmin.xml)
        Parameters:
        exportDir - target directory where the export file will be put
        exportFilename - filename of the export file
        Throws:
        AdminException - if an error occurs
      • setTimeOutToAbortRequest

        public static void setTimeOutToAbortRequest​(long timeOut)
                                             throws ConnectException
        Sets the timeout in ms before abortion of administration requests.

        Be careful, the value can be changed prior to the connection only using the AdminRequestor.REQUEST_TIMEOUT_PROP property.

        Parameters:
        timeOut - The timeout
        Throws:
        ConnectException - if the connection is not established.
        Since:
        5.2.2
      • getTimeOutToAbortRequest

        public static long getTimeOutToAbortRequest()
                                             throws ConnectException
        Gets the timeout in ms before abortion of administration requests.
        Returns:
        the timeout
        Throws:
        ConnectException - if the connection is not established.
        Since:
        5.2.2
      • processAdmin

        public static org.objectweb.joram.shared.admin.AdminReply processAdmin​(String targetId,
                                                                               int command,
                                                                               Properties prop)
                                                                        throws ConnectException,
                                                                               AdminException
        The method send the admin JMS message on JORAM server (AdminTopic).
        Parameters:
        targetId - agent Id target.
        command - the command to execute.
        prop - the properties.
        Returns:
        the reply.
        Throws:
        AdminException
        ConnectException - If the connection fails.
      • invokeStaticServerMethod

        public static String invokeStaticServerMethod​(String className,
                                                      String methodName,
                                                      Class<?>[] parameterTypes,
                                                      Object[] args)
                                               throws ConnectException,
                                                      AdminException
        Invokes the specified static method with the specified parameters on the local server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type.
        Parameters:
        className - the name of the class holding the static method
        methodName - the name of the invoked method
        parameterTypes - the list of parameters
        args - the arguments used for the method call
        Returns:
        the result of the invoked method after applying the toString method.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • invokeStaticServerMethod

        public static String invokeStaticServerMethod​(String className,
                                                      String methodName,
                                                      Class<?>[] parameterTypes,
                                                      Object[] args,
                                                      boolean async)
                                               throws ConnectException,
                                                      AdminException
        Invokes the specified static method with the specified parameters on the local server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type. The method can be invoked either asynchronously or not by the server depending of the parameter async.
        Parameters:
        className - the name of the class holding the static method
        methodName - the name of the invoked method
        parameterTypes - the list of parameters
        args - the arguments used for the method call
        async - if true the method is invoked asynchronously by the server and the result is lost.
        Returns:
        the result of the invoked method after applying the toString method.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • invokeStaticServerMethod

        public static String invokeStaticServerMethod​(int serverId,
                                                      String className,
                                                      String methodName,
                                                      Class<?>[] parameterTypes,
                                                      Object[] args)
                                               throws ConnectException,
                                                      AdminException
        Invokes the specified static method with the specified parameters on the chosen server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type.
        Parameters:
        serverId - the identifier of the server.
        className - the name of the class holding the static method
        methodName - the name of the invoked method
        parameterTypes - the list of parameters
        args - the arguments used for the method call
        Returns:
        the result of the invoked method after applying the toString method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • invokeStaticServerMethod

        public static String invokeStaticServerMethod​(int serverId,
                                                      String className,
                                                      String methodName,
                                                      Class<?>[] parameterTypes,
                                                      Object[] args,
                                                      boolean async)
                                               throws ConnectException,
                                                      AdminException
        Invokes the specified static method with the specified parameters on the chosen server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type. The method can be invoked either asynchronously or not by the server depending of the parameter async.
        Parameters:
        serverId - the identifier of the server.
        className - the name of the class holding the static method
        methodName - the name of the invoked method
        parameterTypes - the list of parameters
        args - the arguments used for the method call
        async - if true the method is invoked asynchronously by the server and the result is lost.
        Returns:
        the result of the invoked method after applying the toString method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • addAMQPBridgeConnection

        public static String addAMQPBridgeConnection​(int serverId,
                                                     String urls)
                                              throws ConnectException,
                                                     AdminException
        Adds an AMQP server and starts a live connection with it, accessible via the url provided. A server is uniquely identified by the given name. Adding an existing server won't do anything.
        Parameters:
        serverId - the serverId
        urls - the amqp url list identifying the servers separate by space, for example: "amqp://user:pass@localhost:5672/?name=serv1 amqp://user:pass@localhost:5678/?name=serv2"
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • deleteAMQPBridgeConnection

        public static String deleteAMQPBridgeConnection​(int serverId,
                                                        String names)
                                                 throws ConnectException,
                                                        AdminException
        Removes the live connection to the specified AMQP server.
        Parameters:
        serverId - the serverId
        names - the name identifying the server or list of name separate by space
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • addJMSBridgeConnection

        public static String addJMSBridgeConnection​(int serverId,
                                                    String urls)
                                             throws ConnectException,
                                                    AdminException
        Adds a JMS server and starts a live connection with it, accessible via the url provided. A server is uniquely identified by the given name. Adding an existing server won't do anything.
        Parameters:
        serverId - the serverId
        urls - the jms url list identifying the servers separate by space, for example: "jndi_url/?name=cnx1&cf=cfName&jndiFactoryClass=com.xxx.yyy&user=user1&pass=pass1&clientID=clientID"
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • deleteJMSBridgeConnection

        public static String deleteJMSBridgeConnection​(int serverId,
                                                       String names)
                                                throws ConnectException,
                                                       AdminException
        Removes the live connection to the specified AMQP server.
        Parameters:
        serverId - the serverId
        names - the name identifying the server or list of name separate by space
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • deleteJMSBridgeConnection

        public static String deleteJMSBridgeConnection​(int serverId,
                                                       String names,
                                                       boolean async)
                                                throws ConnectException,
                                                       AdminException
        Removes the live connection to the specified AMQP server.
        Parameters:
        serverId - the serverId
        names - the name identifying the server or list of name separate by space
        async - invoke asynchronously
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • deleteJMSPBridgeConnection

        public static String deleteJMSPBridgeConnection​(int serverId,
                                                        String names)
                                                 throws ConnectException,
                                                        AdminException
        Deprecated.
        Removes the live connection to the specified AMQP server.
        Parameters:
        serverId - the serverId
        names - the name identifying the server or list of name separate by space
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails
      • deleteJMSPBridgeConnection

        public static String deleteJMSPBridgeConnection​(int serverId,
                                                        String names,
                                                        boolean async)
                                                 throws ConnectException,
                                                        AdminException
        Deprecated.
        Removes the live connection to the specified AMQP server.
        Parameters:
        serverId - the serverId
        names - the name identifying the server or list of name separate by space
        async - invoke asynchronously
        Returns:
        the result of the method
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the invocation can't be done or fails