[jboss-cvs] jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector ...
Takuro Okada
t2-okada at nri.co.jp
Mon Feb 19 05:50:17 EST 2007
User: tokada
Date: 07/02/19 05:50:17
Modified: java/src/expansion/org/jboss/profiler/exp/agent/collector
Tag: JBossProfiler_Expansion CollectorConfig.java
Log:
Added some properties for agent connection.
Revision Changes Path
No revision
No revision
1.1.2.3 +72 -15 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/CollectorConfig.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CollectorConfig.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/CollectorConfig.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- CollectorConfig.java 13 Dec 2006 10:11:42 -0000 1.1.2.2
+++ CollectorConfig.java 19 Feb 2007 10:50:17 -0000 1.1.2.3
@@ -13,12 +13,11 @@
import javolution.xml.stream.XMLStreamException;
import javolution.xml.stream.XMLStreamReader;
-import org.apache.log4j.Logger;
+import org.jboss.profiler.exp.adaptor.AgentConfig;
public class CollectorConfig implements Serializable {
- private static Logger logger = Logger.getLogger(CollectorConfig.class);
-
+ private AgentConfig agent = new AgentConfig();
private Map<String, String> jdbcImplementationMap = new FastMap<String, String>();
private Set<String> frameworkExpressionSet = new FastSet<String>();
@@ -26,12 +25,16 @@
* Loads the configuration file specified and fills properties.
* @param filePath
*/
- public CollectorConfig(String filePath) throws XMLStreamException, IOException {
- try {
+ public CollectorConfig(String filePath) throws IOException {
load(filePath);
- } catch (Exception e) {
- logger.error("failed to load collector-config file.");
}
+
+ /**
+ * Gets setting of agent connection.
+ * @return
+ */
+ public AgentConfig getAgent() {
+ return agent;
}
/**
@@ -43,14 +46,14 @@
}
/**
- * Get expressions of framework objects
+ * Gets expressions of framework objects.
* @return set object
*/
public Set<String> getFrameworkExpressionSet() {
return frameworkExpressionSet;
}
- private void load(String filePath) throws XMLStreamException, IOException {
+ private void load(String filePath) throws IOException {
InputStream is = null;
XMLStreamReader reader = null;
try {
@@ -61,14 +64,61 @@
while(reader.getEventType() != XMLStreamConstants.END_DOCUMENT) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
- if(reader.getLocalName().equals("jdbc")) state = "jdbc";
+ if(reader.getLocalName().equals("agent")) state = "agent";
+ else if(reader.getLocalName().equals("jdbc")) state = "jdbc";
else if(reader.getLocalName().equals("framework")) state = "framework";
+
+ else if(state.equals("agent")) {
+ if(reader.getLocalName().equals("service-name")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setServiceName(reader.getText().toString());
+ }
+ }
+ }else if(reader.getLocalName().equals("jmx-connector-url")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setJmxConnectorUrl(reader.getText().toString());
+ }
+ }
+ }else if(reader.getLocalName().equals("jmx-connector-jndi-name")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setJmxConnectorJndiName(reader.getText().toString());
+ }
+ }
+ }else if(reader.getLocalName().equals("jmx-connector-jndi-context-factory")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setJmxConnectorJndiContextFactory(reader.getText().toString());
+ }
+ }
+ }else if(reader.getLocalName().equals("jaas-user-name")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setJaasUserName(reader.getText().toString());
+ }
+ }
+ }else if(reader.getLocalName().equals("jaas-password")) {
+ if(reader.hasNext()) {
+ reader.next();
+ if(reader.hasText()) {
+ agent.setJaasPassword(reader.getText().toString());
+ }
+ }
+ }
+ }
else if(state.equals("jdbc") && reader.getLocalName().equals("impl-mapping")) {
String key = reader.getAttributeValue(null, "impl").toString();
String value = reader.getAttributeValue(null, "interface").toString();
jdbcImplementationMap.put(key, value);
}
- if(state.equals("framework") && reader.getLocalName().equals("expression")) {
+ else if(state.equals("framework") && reader.getLocalName().equals("expression")) {
if(reader.hasNext()) {
reader.next();
if(reader.hasText()) {
@@ -78,9 +128,16 @@
}
}
}
+ } catch (XMLStreamException e) {
+ throw new IOException(e.getMessage());
} finally {
if(is!=null) is.close();
+ try {
if(reader!=null) reader.close();
+ } catch (XMLStreamException e) {
+ throw new IOException(e.getMessage());
}
}
+ }
+
}
More information about the jboss-cvs-commits
mailing list