Using JMX Client to Change Settings Dynamically - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

You can reconfigure Content Services by shutting down the server, editing the relevant property in the configuration files, and then restarting the server. If you’ve installed the Oracle Java SE Development Kit (JDK), and have enabled JMX in your configuration files, there are some support operations that can be performed at runtime without needing to restart the server.

The Java Management Extension (JMX) interface allows you to access Content Services through a standard JMX console that supports JMX Remoting (JSR-160). This lets you:

  • Manage subsystems
  • Change log levels
  • Enable or disable file servers (FTP)
  • Set server read-only mode
  • Set server single-user mode
  • Set server maximum user limit (including ability to prevent further logins)
  • Count user sessions/tickets
  • User session/ticket invalidation
CAUTION: The JMX connection provides full access to the JVM and the Alfresco system running within it, including the ability to execute code. You should consider this connection the same level of access like an SSH connection with the user account running Tomcat.

Example consoles include:

  • JConsole (supplied with Java SE 5.0 and higher)
  • MC4J
  • JManage

Some of these consoles also provide basic graphs and/or alerts for monitoring JMX-managed attributes.

There are two types of property that you can edit using a JMX interface:

  • Type 1: Properties specified directly in XML files

    For example:

      <beanid="wcm_deployment_receiver"class="org.alfresco.repo.management.subsystems.ChildApplicationContextFactory"
              <parent="abstractPropertyBackedBean">
              <property name="autoStart">
                      <value>true</value>
              </property>
      </bean>
    

    The value for the property autoStart is set to true directly in the wcm-bootstrap-context.xml file.

  • Type 2: Properties set by variables in XML files

    For example:

      <beanid="googledocsService"class="org.alfresco.integrations.google.docs.service.GoogleDocsServiceImpl"init-method="init">
          ...
          <property name="enabled">
              <value>${googledocs.enabled}</value>
          </property>
          ...
      </bean>
    

    The value for the property enabled is replaced with a variable ${googledocs.enabled}.

When Content Services starts up:

  • Type 1 properties are read from the XML file.
  • Type 2 properties get their values read from all the various property files.
  • IMPORTANT! Then, the database is checked to see if there are any property values set there, and if any property has been changed, this value is used instead.

Some of the type 2 properties can be viewed and changed by the JMX console, but some can’t. For example, googledocs.enabled can be viewed and changed using the JMX client; index.recovery.mode can’t be viewed or changed using the JMX client.

In a new installation, none of these properties are stored in the database. If you set a property using the JMX interface, Content Services stores the value of the property in the database. If you never use JMX to set the value of a property, you can continue using the alfresco-global.properties file to set the value of the property. Once you change the property setting using JMX, and it’s stored in the database, and you can’t use the properties files to change the value of that property.

Note: For advanced configuration, you can also extend or override the Spring bean definitions that control the Java classes. To do so, add or copy a Spring bean file named *-context.xml to the <extension> directory, or <web-extension> directory to extend Alfresco Share. For examples of the Spring bean extensions, download the sample extension files.