Package org.alfresco.utility.network
Class JmxClient
java.lang.Object
org.alfresco.utility.network.JmxClient
- All Implemented Interfaces:
Jmx
Handles JMX calls to server
use
JmxBuilder to define this service-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteJMXMethod(String objectName, String methodName, Object... pArgs) Use this to invoke operation methodName on mBean objectName Example of usage: executeJMXMethod("Alfresco:Name=DatabaseInformation,Tool=SchemaValidator”, "validateSchema");executeJMXMethod(String objectName, String methodName, String[] signature, 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_");getStringNameFromJmxObject(String objectName) booleanreadProperty(String objectName, String attributeName) Get server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")voidrefreshServerProperty(String objectName, JmxClient.JmxPropertyOperation operation) Use this to perform start/stop operation after changing server propertieswriteProperty(String objectName, String attributeName, 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")
-
Field Details
-
properties
-
-
Constructor Details
-
JmxClient
public JmxClient()
-
-
Method Details
-
readProperty
Get server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")- Specified by:
readPropertyin interfaceJmx- Parameters:
objectName-attributeName-- Returns:
- Throws:
Exception
-
closeConnection
- 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:
writePropertyin interfaceJmx- Parameters:
objectName-attributeName-attributeValue-- Returns:
- Throws:
Exception
-
getStringNameFromJmxObject
- 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:
MalformedObjectNameExceptionReflectionExceptionMBeanExceptionInstanceNotFoundExceptionException
-
isJMXEnabled
public boolean isJMXEnabled()- Specified by:
isJMXEnabledin interfaceJmx
-
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:
executeJMXMethodin interfaceJmx- 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
-