Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Flattened JMX resources discovery

  • Loading branch information...
commit 20ed100b73c0614f3567731b361f8eb8b26f871f 1 parent 372c8a2
@stoiczek authored
View
2  gui/src/main/resources/spring/uiContext.xml
@@ -295,11 +295,11 @@ http://www.springframework.org/schema/context http://www.springframework.org/sch
<property name="enabled" value="true"/>
<property name="closeListener" ref="ontologySelectedListener"/>
<property name="owner" ref="mainWindowController"/>
- <property name="exceptionHandler" ref="promptExceptionHandler"/>
</bean>
<bean id="ontologySelectedListener" class="pl.edu.agh.semsimmon.gui.controllers.action.OntologyFileSelectedListener">
<property name="connectionsManager" ref="coreConnectionsManager"/>
+ <property name="exceptionHandler" ref="promptExceptionHandler"/>
</bean>
<bean id="addOcmgResourceAction" class="pl.edu.agh.semsimmon.gui.action.ReflectionAction">
View
16 transports/jmx/src/main/java/pl/edu/agh/semsimmon/registries/jmx/JmxTransportProxy.java
@@ -37,7 +37,7 @@
/**
*
*/
- private Map<String, Map<String, DiscoveryAgent>> discoveryAgents;
+ private Map<String, DiscoveryAgent> discoveryAgents;
/**
*
@@ -145,17 +145,13 @@ public void discoverChildren(Resource resource, List<String> types) throws Trans
if (!isResourceSupported(resource)) {
throw new TransportException("Given resource is unsupported with this proxy");
}
- if (!discoveryAgents.containsKey(resource.getTypeUri())) {
- log.error("Cannot discover child resources from given parent: " + resource.getUri() + "(" + resource.getTypeUri() + ")");
- return;
- }
- Map<String, DiscoveryAgent> agents = discoveryAgents.get(resource.getTypeUri());
+
final List<Resource> children = new LinkedList<Resource>();
final String connectionUri = resource.getProperty(JmxRegistryConsts.SERVICE_URL_PROPERTY).toString();
final MBeanServerConnection connection = connections.get(connectionUri);
for (final String type : types) {
- if (agents.containsKey(type)) {
- final DiscoveryAgent agent = agents.get(type);
+ if (discoveryAgents.containsKey(type)) {
+ final DiscoveryAgent agent = discoveryAgents.get(type);
List<Resource> childResources = null;
try {
childResources = agent.discoveryChildren(connection, resource, type);
@@ -181,7 +177,7 @@ public void discoverChildren(Resource resource, List<String> types) throws Trans
}
registerResource(resource);
final String transportUri = (String) resource.getProperty(JmxRegistryConsts.SERVICE_URL_PROPERTY);
- DiscoveryAgent agent = discoveryAgents.get(resource.getTypeUri()).get(type);
+ DiscoveryAgent agent = discoveryAgents.get(type);
try {
return agent.discoveryChildren(connections.get(transportUri), resource, type);
} catch (IOException e) {
@@ -189,7 +185,7 @@ public void discoverChildren(Resource resource, List<String> types) throws Trans
}
}
- public void setDiscoveryAgents(Map<String, Map<String, DiscoveryAgent>> discoveryAgents) {
+ public void setDiscoveryAgents(Map<String, DiscoveryAgent> discoveryAgents) {
this.discoveryAgents = discoveryAgents;
}
View
87 transports/jmx/src/main/resources/jmxtransport-context.xml
@@ -21,86 +21,19 @@ http://www.springframework.org/schema/context http://www.springframework.org/sch
<util:map id="jmxDiscoveryAgents" key-type="java.lang.String" value-type="java.util.HashMap">
- <entry value-ref="nodeDiscoveryAgents">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.NODE_URI"/>
- </key>
- </entry>
- <entry value-ref="jvmDiscoveryAgents">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.JVM_URI"/>
- </key>
- </entry>
+ <entry key-ref="osUri" value-ref="osDiscoveryAgent"/>
+ <entry key-ref="cpuUri" value-ref="cpuDiscoveryAgent"/>
+ <entry key-ref="jvmUri" value-ref="jvmDiscoveryAgent"/>
+ <entry key-ref="physicalMemoryUri" value-ref="genericDiscoveryAgent"/>
+ <entry key-ref="virtualMemUri" value-ref="genericDiscoveryAgent"/>
+ <entry key-ref="hardDriveUri" value-ref="genericDiscoveryAgent"/>
+ <entry key-ref="netfaceUri" value-ref="genericDiscoveryAgent"/>
+ <entry key-ref="classLoaderUri" value-ref="genericDiscoveryAgent"/>
+ <entry key-ref="threadUri" value-ref="threadDiscoveryAgent"/>
+ <entry key-ref="gcUri" value-ref="gcDiscoveryAgent"/>
</util:map>
- <util:map id="nodeDiscoveryAgents" key-type="java.lang.String"
- value-type="pl.edu.agh.semsimmon.registries.jmx.discovery.DiscoveryAgent" map-class="java.util.HashMap">
- <entry value-ref="osDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.OS_URI"/>
- </key>
- </entry>
- <entry value-ref="cpuDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.CPU_URI"/>
- </key>
- </entry>
- <entry value-ref="jvmDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.JVM_URI"/>
- </key>
- </entry>
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.PHYSICAL_MEMORY_URI"/>
- </key>
- </entry>
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.VIRTUAL_MEMORY_URI"/>
- </key>
- </entry>
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.HARD_DRIVE_URI"/>
- </key>
- </entry>
-
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.NETWORK_INTERFACE_URI"/>
- </key>
- </entry>
-
-
- </util:map>
- <util:map id="jvmDiscoveryAgents" key-type="java.lang.String"
- value-type="pl.edu.agh.semsimmon.registries.jmx.discovery.DiscoveryAgent" map-class="java.util.HashMap">
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.CLASS_LOADER_URI"/>
- </key>
- </entry>
- <entry value-ref="genericDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.GC_URI"/>
- </key>
- </entry>
-
- <entry value-ref="threadDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.THREAD_URI"/>
- </key>
- </entry>
-
- <entry value-ref="gcDiscoveryAgent">
- <key>
- <util:constant static-field="pl.edu.agh.semsimmon.common.api.knowledge.KnowledgeConstants.GC_URI"/>
- </key>
- </entry>
-
- </util:map>
<bean id="genericDiscoveryAgent" class="pl.edu.agh.semsimmon.registries.jmx.discovery.GenericDiscoveryAgent"/>
Please sign in to comment.
Something went wrong with that request. Please try again.