Class JmxClient

java.lang.Object
org.alfresco.utility.network.JmxClient
All Implemented Interfaces:
Jmx

@Service public class JmxClient extends Object implements Jmx
Handles JMX calls to server use JmxBuilder to define this service
  • Field Details

  • Constructor Details

    • JmxClient

      public JmxClient()
  • Method Details

    • readProperty

      public Object readProperty(String objectName, String attributeName) throws 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:
      Exception
    • closeConnection

      public void closeConnection() throws IOException
      Throws:
      IOException
    • writeProperty

      public Object writeProperty(String objectName, String attributeName, Object attributeValue) throws 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:
      Exception
    • getStringNameFromJmxObject

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

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

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

      public Object executeJMXMethod(String objectName, String methodName, Object... pArgs) throws 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:
      Exception
    • executeJMXMethod

      public Object executeJMXMethod(String objectName, String methodName, String[] signature, Object... pArgs) throws 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:
      Exception