Interface AdminItf

  • All Known Implementing Classes:
    AdminWrapper, JoramAdmin

    public interface AdminItf
    The AdminItf interface defines the set of methods needed for administration and monitoring of the Joram platform.
    • Method Detail

      • setTimeOutToAbortRequest

        void setTimeOutToAbortRequest​(long timeOut)
                               throws ConnectException
        Set the maximum time in ms before aborting request.
        Parameters:
        timeOut - the maximum time in ms before aborting request.
        Throws:
        ConnectException - if the connection is not established.
      • getTimeOutToAbortRequest

        long getTimeOutToAbortRequest()
                               throws ConnectException
        Returns the maximum time in ms before aborting request.
        Returns:
        the maximum time in ms before aborting request.
        Throws:
        ConnectException - if the connection is not established.
      • close

        void close()
        Closes the underlying requestor.
      • isClosed

        boolean isClosed()
        Returns true if the underlying requestor is closed.
        Returns:
        true if the underlying requestor is closed.
      • stopServer

        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

        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

        void addDomain​(String domain,
                       int sid,
                       int port)
                throws ConnectException,
                       AdminException
        Adds a domain to the platform.

        The domain will use the default network component "SimpleNetwork".

        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

        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

        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

        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.
      • getDefaultDMQId

        String getDefaultDMQId​(int serverId)
                        throws ConnectException,
                               AdminException
        Returns the unique identifier of 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.
        Returns:
        The unique identifier of the default dead message queue for the local server, null if not set.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultDMQId

        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.
      • getDefaultDMQ

        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.
        Returns:
        The default dead message queue for the local server, null if not set.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultDMQ

        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.
      • getDefaultThreshold

        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.

        Returns:
        The default threshold value for the local server, -1 if not set.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setDefaultThreshold

        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

        int[] getServersIds​(String domain)
                     throws ConnectException,
                            AdminException
        Returns the list of the servers' identifiers that belong to the specified domain
        Parameters:
        domain - Name of the domain.
        Returns:
        An array containing the list of server's identifiers of the specified domain.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • getServersNames

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

        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 description of the corresponding servers.
        Throws:
        ConnectException - If the connection fails.
        AdminException - Never thrown.
      • getDestinations

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

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

        Parameters:
        serverId - Unique identifier of the server.
        Returns:
        An array containing all destinations defined on the given server or null if none exists.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • createQueue

        Destination createQueue​(int serverId,
                                String name,
                                String className,
                                Properties prop)
                         throws ConnectException,
                                AdminException
        Creates or retrieves a queue destination on a given JORAM server.

        First a destination with the specified name is searched on the given server, if it does not exist it is created.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        name - The name of the queue.
        className - The queue class name.
        prop - The queue properties.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • createTopic

        Destination createTopic​(int serverId,
                                String name,
                                String className,
                                Properties prop)
                         throws ConnectException,
                                AdminException
        Creates or retrieves a topic destination on a given JORAM server.

        First a destination with the specified name is searched on the given server, if it does not exist it is created.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Parameters:
        serverId - The identifier of the server where deploying the topic.
        name - The name of the topic.
        className - The topic class name.
        prop - The topic properties.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • getUsers

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

        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.
      • createUser

        User createUser​(String name,
                        String password,
                        int serverId,
                        String identityClassName)
                 throws ConnectException,
                        AdminException
        Admin method creating a user for a given server and instantiating the corresponding User object.

        If the user has already been set on this server, the method simply returns the corresponding User object. Its fails if the target server does not belong to the platform, or if a proxy could not be deployed server side for a new user.

        Parameters:
        name - Name of the user.
        password - Password of the user.
        serverId - The identifier of the user's server.
        identityClassName - By default user/password for SimpleIdentity.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • createUser

        User createUser​(String name,
                        String password,
                        int serverId,
                        String identityClassName,
                        Properties prop)
                 throws ConnectException,
                        AdminException
        Admin method creating a user for a given server and instantiating the corresponding User object.

        If the user has already been set on this server, the method simply returns the corresponding User object. Its fails if the target server does not belong to the platform, or if a proxy could not be deployed server side for a new user.

        Parameters:
        name - Name of the user.
        password - Password of the user.
        serverId - The identifier of the user's server.
        identityClassName - By default user/password for SimpleIdentity.
        prop - properties
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • processAdmin

        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.
      • doRequest

        org.objectweb.joram.shared.admin.AdminReply doRequest​(org.objectweb.joram.shared.admin.AdminRequest request)
                                                       throws AdminException,
                                                              ConnectException
        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.
      • invokeStaticServerMethod

        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
      • addAMQPBridgeConnection

        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

        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

        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

        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
      • deleteJMSPBridgeConnection

        String deleteJMSPBridgeConnection​(int serverId,
                                          String names)
                                   throws ConnectException,
                                          AdminException
        Deprecated.
        Use deleteJMSBridgeConnection instead.
        Removes the live connection to the specified JMS server (Use deleteJMSBridgeConnection instead).
        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

        String deleteJMSBridgeConnection​(int serverId,
                                         String names,
                                         boolean async)
                                  throws ConnectException,
                                         AdminException
        Removes the live connection to the specified JMS 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

        String deleteJMSPBridgeConnection​(int serverId,
                                          String names,
                                          boolean async)
                                   throws ConnectException,
                                          AdminException
        Deprecated.
        Use deleteJMSBridgeConnection instead.
        Removes the live connection to the specified JMS server (Use deleteJMSBridgeConnection instead).
        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