Package org.alfresco.utility.network
Class JmxClient
- java.lang.Object
-
- org.alfresco.utility.network.JmxClient
-
- All Implemented Interfaces:
Jmx
@Service public class JmxClient extends java.lang.Object implements Jmx
Handles JMX calls to server useJmxBuilderto define this service
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJmxClient.JmxPropertyOperation
-
Field Summary
Fields Modifier and Type Field Description protected TasPropertiesproperties
-
Constructor Summary
Constructors Constructor Description JmxClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()java.lang.ObjectexecuteJMXMethod(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.ObjectexecuteJMXMethod(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.StringgetStringNameFromJmxObject(java.lang.String objectName)booleanisJMXEnabled()java.lang.ObjectreadProperty(java.lang.String objectName, java.lang.String attributeName)Get server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")voidrefreshServerProperty(java.lang.String objectName, JmxClient.JmxPropertyOperation operation)Use this to perform start/stop operation after changing server propertiesjava.lang.ObjectwriteProperty(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")
-
-
-
Field Detail
-
properties
@Autowired protected TasProperties properties
-
-
Method Detail
-
readProperty
public java.lang.Object readProperty(java.lang.String objectName, java.lang.String attributeName) throws java.lang.ExceptionGet server property value Example: Alfresco:Name=FileServerConfig, CIFSServerEnabled getServerProperty("Alfresco:Name=FileServerConfig", "CIFSServerEnabled")- Specified by:
readPropertyin interfaceJmx- 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.ExceptionSet 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:
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.ExceptionUse this to perform start/stop operation after changing server properties- Parameters:
objectName-operation-- Throws:
javax.management.MalformedObjectNameExceptionjavax.management.ReflectionExceptionjavax.management.MBeanExceptionjavax.management.InstanceNotFoundExceptionjava.lang.Exception
-
isJMXEnabled
public boolean isJMXEnabled()
- Specified by:
isJMXEnabledin interfaceJmx
-
executeJMXMethod
public java.lang.Object executeJMXMethod(java.lang.String objectName, java.lang.String methodName, java.lang.Object... pArgs) throws java.lang.ExceptionUse 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:
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.ExceptionUse 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
-
-