Skip to content

Commit

Permalink
Merge pull request #3692 from apache/CAMEL-14811
Browse files Browse the repository at this point in the history
CAMEL-14811 - Remove JMX Connector configuration
  • Loading branch information
coheigea committed Mar 30, 2020
2 parents 13ed009 + b954402 commit 36b55f9
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 788 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
/**
* Test that verifies JMX properties can be configured via Spring.
*/
public class JMXAgentPropertiesTest extends JMXAgentTest {

@Override
protected int getPort() {
return 20009;
}
public class JMXAgentPropertiesTest extends DefaultJMXAgentTest {

@Override
protected AbstractXmlApplicationContext createApplicationContext() {
Expand All @@ -45,4 +40,4 @@ public void testEnableUseHostIPAddress() throws Exception {
assertTrue(agent.getUseHostIPAddress());
}

}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
<propertyPlaceholder id="properties" location="org/apache/camel/spring/jmx.properties"/>

<!-- we can use propery placeholders when we define the JMX agent -->
<jmxAgent id="agent" registryPort="{{myjmx.port}}" disabled="{{myjmx.disabled}}"
<jmxAgent id="agent" disabled="{{myjmx.disabled}}"
usePlatformMBeanServer="{{myjmx.usePlatform}}"
createConnector="true"
statisticsLevel="RoutesOnly"
useHostIPAddress="true"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
public interface ManagementAgent extends Service {

/**
* Registers object with management infrastructure with a specific name. Object must be annotated or
* Registers object with management infrastructure with a specific name. Object must be annotated or
* implement standard MBean interface.
*
* @param obj the object to register
* @param name the name
* @throws JMException is thrown if the registration failed
*/
void register(Object obj, ObjectName name) throws JMException;

/**
* Registers object with management infrastructure with a specific name. Object must be annotated or
* Registers object with management infrastructure with a specific name. Object must be annotated or
* implement standard MBean interface.
*
* @param obj the object to register
Expand All @@ -49,7 +49,7 @@ public interface ManagementAgent extends Service {
* @throws JMException is thrown if the registration failed
*/
void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException;

/**
* Unregisters object based upon registered name
*
Expand Down Expand Up @@ -80,7 +80,7 @@ public interface ManagementAgent extends Service {
* <p/>
* <b>Notice:</b> If the JMXEnabled configuration is not set to <tt>true</tt>,
* this method will return <tt>null</tt>.
*
*
* @return the MBeanServer
*/
MBeanServer getMBeanServer();
Expand All @@ -96,39 +96,11 @@ public interface ManagementAgent extends Service {
* Get domain name for Camel MBeans.
* <p/>
* <b>Notice:</b> That this can be different that the default domain name of the MBean Server.
*
*
* @return domain name
*/
String getMBeanObjectDomainName();

/**
* Sets the port used by {@link java.rmi.registry.LocateRegistry}.
*
* @param port the port
*/
void setRegistryPort(Integer port);

/**
* Gets the port used by {@link java.rmi.registry.LocateRegistry}.
*
* @return the port
*/
Integer getRegistryPort();

/**
* Sets the port clients must use to connect
*
* @param port the port
*/
void setConnectorPort(Integer port);

/**
* Gets the port clients must use to connect
*
* @return the port
*/
Integer getConnectorPort();

/**
* Sets the default domain on the MBean server
*
Expand All @@ -150,34 +122,6 @@ public interface ManagementAgent extends Service {
*/
void setMBeanObjectDomainName(String domainName);

/**
* Sets the service url
*
* @param url the service url
*/
void setServiceUrlPath(String url);

/**
* Gets the service url
*
* @return the url
*/
String getServiceUrlPath();

/**
* Whether connector should be created, allowing clients to connect remotely
*
* @param createConnector <tt>true</tt> to create connector
*/
void setCreateConnector(Boolean createConnector);

/**
* Whether connector is created, allowing clients to connect remotely
*
* @return <tt>true</tt> if connector is created
*/
Boolean getCreateConnector();

/**
* Whether to use the platform MBean Server.
*
Expand Down Expand Up @@ -351,7 +295,7 @@ public interface ManagementAgent extends Service {
* @return the level
*/
ManagementStatisticsLevel getStatisticsLevel();

/**
* Gets whether host IP Address to be used instead of host name.
*
Expand All @@ -360,7 +304,7 @@ public interface ManagementAgent extends Service {
Boolean getUseHostIPAddress();

/**
* Sets whether to use host IP Address
* Sets whether to use host IP Address
* @param useHostIPAddress <tt>true</tt> to use IP Address.
*/
void setUseHostIPAddress(Boolean useHostIPAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
"properties": {
"disabled": { "kind": "attribute", "displayName": "Disabled", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Disable JMI (default false)" },
"onlyRegisterProcessorWithCustomId": { "kind": "attribute", "displayName": "Only Register Processor With Custom Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Only register processor if a custom id was defined for it." },
"registryPort": { "kind": "attribute", "displayName": "Registry Port", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "1099", "description": "RMI connector registry port (default 1099)" },
"connectorPort": { "kind": "attribute", "displayName": "Connector Port", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "-1", "description": "RMI connector server port (default -1 not used)" },
"mbeanServerDefaultDomain": { "kind": "attribute", "displayName": "Mbean Server Default Domain", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "org.apache.camel", "description": "MBean server default domain name (default org.apache.camel)" },
"mbeanObjectDomainName": { "kind": "attribute", "displayName": "Mbean Object Domain Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "org.apache.camel", "description": "MBean object domain name (default org.apache.camel)" },
"serviceUrlPath": { "kind": "attribute", "displayName": "Service Url Path", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "\/jmxrmi", "description": "JMX Service URL path (default \/jmxrmi)" },
"createConnector": { "kind": "attribute", "displayName": "Create Connector", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "false", "description": "A flag that indicates whether the agent should be created" },
"usePlatformMBeanServer": { "kind": "attribute", "displayName": "Use Platform MBean Server", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "true", "description": "A flag that indicates whether the platform mbean server should be used" },
"registerAlways": { "kind": "attribute", "displayName": "Register Always", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "false", "description": "A flag that indicates whether to register mbeans always" },
"registerNewRoutes": { "kind": "attribute", "displayName": "Register New Routes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "false", "description": "A flag that indicates whether to register mbeans when starting new routes" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,21 +552,9 @@ protected void initJMXAgent() throws Exception {
LOG.info("JMXAgent enabled: {}", camelJMXAgent);

Map<String, Object> properties = new HashMap<>();
if (camelJMXAgent.getConnectorPort() != null) {
properties.put("connectorPort", CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getConnectorPort()));
}
if (camelJMXAgent.getCreateConnector() != null) {
properties.put("createConnector", CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getCreateConnector()));
}
if (camelJMXAgent.getMbeanObjectDomainName() != null) {
properties.put("mbeanObjectDomainName", CamelContextHelper.parseText(getContext(), camelJMXAgent.getMbeanObjectDomainName()));
}
if (camelJMXAgent.getRegistryPort() != null) {
properties.put("registryPort", CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getRegistryPort()));
}
if (camelJMXAgent.getServiceUrlPath() != null) {
properties.put("serviceUrlPath", CamelContextHelper.parseText(getContext(), camelJMXAgent.getServiceUrlPath()));
}
if (camelJMXAgent.getUsePlatformMBeanServer() != null) {
properties.put("usePlatformMBeanServer", CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getUsePlatformMBeanServer()));
}
Expand Down
Loading

0 comments on commit 36b55f9

Please sign in to comment.