Class JmxClient

  • All Implemented Interfaces:
    Jmx

    @Service
    public class JmxClient
    extends java.lang.Object
    implements Jmx
    Handles JMX calls to server use JmxBuilder to define this service
    • Constructor Summary

      Constructors 
      Constructor Description
      JmxClient()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeConnection()  
      java.lang.Object executeJMXMethod​(java.lang.String objectName, java.lang.String methodName, java.lang.Object... pArgs)
      Use this to invoke operation methodName on mBean objectName Example of usage: executeJMXMethod("Alfresco:Name=DatabaseInformation,Tool=SchemaValidator”, "validateSchema");
      java.lang.Object executeJMXMethod​(java.lang.String objectName, java.lang.String methodName, java.lang.String[] signature, java.lang.Object... pArgs)
      Use this to invoke operation methodName with specified signature on mBean objectName Example of usage: executeJMXMethod("Alfresco:Name=DatabaseInformation,Tool=SchemaExport", "dumpSchemaToXML", new String[]{"java.lang.String"}, "alf_node_, alf_acl_");
      java.lang.String getStringNameFromJmxObject​(java.lang.String objectName)  
      boolean isJMXEnabled()  
      java.lang.Object readProperty​(java.lang.String objectName, java.lang.String attributeName)
      Get server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")
      void refreshServerProperty​(java.lang.String objectName, JmxClient.JmxPropertyOperation operation)
      Use this to perform start/stop operation after changing server properties
      java.lang.Object writeProperty​(java.lang.String objectName, java.lang.String attributeName, java.lang.Object attributeValue)
      Set property value on server side, for example if you want to disable email server, you'll use the following parameters:
      setServerProperty("Alfresco:Type=Configuration,Category=email,id1=inbound", "email.server.enabled", "false")
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JmxClient

        public JmxClient()
    • Method Detail

      • readProperty

        public java.lang.Object readProperty​(java.lang.String objectName,
                                             java.lang.String attributeName)
                                      throws java.lang.Exception
        Get server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")
        Specified by:
        readProperty in interface Jmx
        Parameters:
        objectName -
        attributeName -
        Returns:
        Throws:
        java.lang.Exception
      • closeConnection

        public void closeConnection()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeProperty

        public java.lang.Object writeProperty​(java.lang.String objectName,
                                              java.lang.String attributeName,
                                              java.lang.Object attributeValue)
                                       throws java.lang.Exception
        Set property value on server side, for example if you want to disable email server, you'll use the following parameters:
        setServerProperty("Alfresco:Type=Configuration,Category=email,id1=inbound", "email.server.enabled", "false")
        Specified by:
        writeProperty in interface Jmx
        Parameters:
        objectName -
        attributeName -
        attributeValue -
        Returns:
        Throws:
        java.lang.Exception
      • getStringNameFromJmxObject

        public java.lang.String getStringNameFromJmxObject​(java.lang.String objectName)
                                                    throws java.lang.Exception
        Parameters:
        objectName -
        Returns:
        String name from JMX with expected date in accordance with params
        Throws:
        java.lang.Exception
      • refreshServerProperty

        public void refreshServerProperty​(java.lang.String objectName,
                                          JmxClient.JmxPropertyOperation operation)
                                   throws java.lang.Exception
        Use this to perform start/stop operation after changing server properties
        Parameters:
        objectName -
        operation -
        Throws:
        javax.management.MalformedObjectNameException
        javax.management.ReflectionException
        javax.management.MBeanException
        javax.management.InstanceNotFoundException
        java.lang.Exception
      • isJMXEnabled

        public boolean isJMXEnabled()
        Specified by:
        isJMXEnabled in interface Jmx
      • executeJMXMethod

        public java.lang.Object executeJMXMethod​(java.lang.String objectName,
                                                 java.lang.String methodName,
                                                 java.lang.Object... pArgs)
                                          throws java.lang.Exception
        Use this to invoke operation methodName on mBean objectName Example of usage: executeJMXMethod("Alfresco:Name=DatabaseInformation,Tool=SchemaValidator”, "validateSchema");
        Specified by:
        executeJMXMethod in interface Jmx
        Parameters:
        objectName -
        methodName -
        pArgs -
        Returns:
        Throws:
        java.lang.Exception
      • executeJMXMethod

        public java.lang.Object executeJMXMethod​(java.lang.String objectName,
                                                 java.lang.String methodName,
                                                 java.lang.String[] signature,
                                                 java.lang.Object... pArgs)
                                          throws java.lang.Exception
        Use this to invoke operation methodName with specified signature on mBean objectName Example of usage: executeJMXMethod("Alfresco:Name=DatabaseInformation,Tool=SchemaExport", "dumpSchemaToXML", new String[]{"java.lang.String"}, "alf_node_, alf_acl_");
        Parameters:
        objectName -
        methodName -
        signature -
        pArgs -
        Returns:
        Throws:
        java.lang.Exception