Skip to content

Commit ab333a9

Browse files
committed
Merge remote-tracking branch 'origin/master'
Conflicts: .gitignore samples/activemq/queues.json src/com/googlecode/jmxtrans/util/JmxUtils.java
2 parents 40a421a + 96cc548 commit ab333a9

File tree

9 files changed

+343
-369
lines changed

9 files changed

+343
-369
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.classpath
2+
.project
3+
_eclipse
14
.idea
25
logs
36
out

build.xml

+312-322
Large diffs are not rendered by default.

jar.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ commons-pool.src=lib/commons-pool-1.5.6-sources.jar
1414
jackson-core.jar=lib/jackson-core-asl-1.6.3.jar
1515
jackson-mapper.jar=lib/jackson-mapper-asl-1.6.3.jar
1616
jackson.src=lib/jackson-1.6.3-sources.jar
17+
jgit.jar=lib/org.eclipse.jgit-1.1.0.201109151100-r.jar
1718
jpathwatch.jar=lib/jpathwatch-0-94.jar
1819
jrobin.jar=lib/jrobin-1.5.9.jar
1920
jrobin.src=lib/jrobin-1.5.9-sources.jar
@@ -25,8 +26,6 @@ slf4j-api.jar=lib/slf4j-api-1.6.1.jar
2526
slf4j-api.src=lib/slf4j-api-1.6.1-sources.jar
2627
slf4j-log4j.jar=lib/slf4j-log4j12-1.6.1.jar
2728
slf4j-log4j.src=lib/slf4j-log4j12-1.6.1-sources.jar
28-
svnkit.jar=lib/svnkit.jar
29-
svntask.jar=lib/svntask.jar
3029
sweetened.jar=lib/sweetened.jar
3130
velocity.jar=lib/velocity-1.7.jar
3231
velocity.src=lib/velocity-1.7-sources.jar
1.32 MB
Binary file not shown.

lib/svnkit.jar

-1.75 MB
Binary file not shown.

lib/svntask.jar

-20 KB
Binary file not shown.

lib/sweetened.jar

3 Bytes
Binary file not shown.

samples/activemq/queues.json

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
],
2222
"typeNames" : ["Destination"],
2323
"resultAlias" : "ActiveMQ.Queue",
24-
2524
"outputWriters":[
2625
{
2726
"@class":"com.googlecode.jmxtrans.model.output.KeyOutWriter",

src/com/googlecode/jmxtrans/util/JmxUtils.java

+27-44
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
import java.io.File;
44
import java.io.IOException;
5-
import java.io.InputStream;
6-
import java.lang.management.ManagementFactory;
75
import java.lang.reflect.Array;
86
import java.rmi.UnmarshalException;
97
import java.util.ArrayList;
108
import java.util.HashMap;
11-
import java.util.HashSet;
129
import java.util.List;
1310
import java.util.Map;
1411
import java.util.Map.Entry;
@@ -22,7 +19,6 @@
2219
import javax.management.AttributeList;
2320
import javax.management.MBeanAttributeInfo;
2421
import javax.management.MBeanInfo;
25-
import javax.management.MBeanServer;
2622
import javax.management.MBeanServerConnection;
2723
import javax.management.ObjectInstance;
2824
import javax.management.ObjectName;
@@ -61,7 +57,7 @@ public class JmxUtils {
6157

6258
private static final Logger log = LoggerFactory.getLogger(JmxUtils.class);
6359

64-
/**
60+
/**
6561
* Merges two lists of servers (and their queries). Based on the equality of both sets of objects.
6662
* Public for testing purposes.
6763
*/
@@ -335,10 +331,6 @@ private static void runOutputWritersForQuery(Query query) throws Exception {
335331
* Helper method for connecting to a Server. You need to close the resulting connection.
336332
*/
337333
public static JMXConnector getServerConnection(Server server) throws Exception {
338-
if (server.isLocal()) {
339-
MBeanServer mbeanServer = server.getLocalMBeanServer();
340-
return new LocalJMXConnector(mbeanServer);
341-
}
342334
JMXServiceURL url = new JMXServiceURL(server.getUrl());
343335

344336
if (server.getProtocolProviderPackages() != null && server.getProtocolProviderPackages().contains("weblogic"))
@@ -348,7 +340,7 @@ public static JMXConnector getServerConnection(Server server) throws Exception {
348340

349341
}
350342

351-
/**
343+
/**
352344
* Generates the proper username/password environment for JMX connections.
353345
*/
354346
public static Map<String, String> getWebLogicEnvironment(Server server) {
@@ -491,17 +483,6 @@ public static JmxProcess getJmxProcess(File file) throws JsonParseException, Jso
491483
return jmx;
492484
}
493485

494-
/**
495-
* Uses jackson to load json configuration from a File into a full object
496-
* tree representation of that json.
497-
*/
498-
public static JmxProcess getJmxProcess(String name, InputStream in) throws JsonParseException, JsonMappingException, IOException {
499-
ObjectMapper mapper = new ObjectMapper();
500-
JmxProcess jmx = mapper.readValue(in, JmxProcess.class);
501-
jmx.setName(name);
502-
return jmx;
503-
}
504-
505486
/**
506487
* Useful for figuring out if an Object is a number.
507488
*/
@@ -659,7 +640,7 @@ public static String getKeyString2(Query query, Result result, Entry<String, Obj
659640
}
660641

661642

662-
/**
643+
/**
663644
* Replaces all . with _ and removes all spaces and double/single quotes.
664645
*/
665646
public static String cleanupStr(String name) {
@@ -698,28 +679,30 @@ public static String getConcatedTypeNameValues(List<String> typeNames, String ty
698679
}
699680

700681

701-
/**
702-
* Given a typeName string, get the first match from the typeNames setting.
703-
* In other words, suppose you have:
704-
*
705-
* typeName=name=PS Eden Space,type=MemoryPool
706-
*
707-
* If you addTypeName("name"), then it'll retrieve 'PS Eden Space' from the string
708-
*/
709-
public static String getConcatedTypeNameValues(Query query, List<String> typeNames, String typeName) {
710-
Set<String> queryTypeNames = query.getTypeNames();
711-
if (queryTypeNames != null && queryTypeNames.size() > 0) {
712-
List<String> allNames = new ArrayList<String>(queryTypeNames);
713-
for (String name : typeNames) {
714-
if (!allNames.contains(name)) {
715-
allNames.add(name);
716-
}
717-
}
718-
return getConcatedTypeNameValues(allNames, typeName);
719-
} else {
720-
return getConcatedTypeNameValues(typeNames, typeName);
721-
}
722-
}
682+
/**
683+
* Given a typeName string, get the first match from the typeNames setting.
684+
* In other words, suppose you have:
685+
*
686+
* typeName=name=PS Eden Space,type=MemoryPool
687+
*
688+
* If you addTypeName("name"), then it'll retrieve 'PS Eden Space' from the
689+
* string
690+
*/
691+
public static String getConcatedTypeNameValues(Query query, List<String> typeNames, String typeName) {
692+
Set<String> queryTypeNames = query.getTypeNames();
693+
if (queryTypeNames != null && queryTypeNames.size() > 0) {
694+
List<String> allNames = new ArrayList<String>(queryTypeNames);
695+
for (String name : typeNames) {
696+
if (!allNames.contains(name)) {
697+
allNames.add(name);
698+
}
699+
}
700+
return getConcatedTypeNameValues(allNames, typeName);
701+
} else {
702+
return getConcatedTypeNameValues(typeNames, typeName);
703+
}
704+
}
705+
723706
/** */
724707
private static String getTypeNameValue(String typeName, String[] tokens) {
725708
boolean foundIt = false;

0 commit comments

Comments
 (0)