[jboss-cvs] JBossAS SVN: r81829 - trunk/system-jmx/src/main/org/jboss/system/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Nov 30 09:39:40 EST 2008
Author: emuckenhuber
Date: 2008-11-30 09:39:40 -0500 (Sun, 30 Nov 2008)
New Revision: 81829
Modified:
trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
Log:
[JBAS-3768] parse serviceMetaData already in the SarDeployer, so that the ServiceMetaData can be updated with the persisted values.
Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java 2008-11-30 14:38:20 UTC (rev 81828)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java 2008-11-30 14:39:40 UTC (rev 81829)
@@ -32,10 +32,14 @@
import org.jboss.system.metadata.ServiceDeployment;
import org.jboss.system.metadata.ServiceDeploymentClassPath;
import org.jboss.system.metadata.ServiceDeploymentParser;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.system.metadata.ServiceMetaDataParser;
import org.jboss.system.server.ServerConfigLocator;
+import org.jboss.util.xml.DOMWriter;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
/**
* SARDeployer.<p>
@@ -81,6 +85,32 @@
List<ServiceDeploymentClassPath> classPaths = parsed.getClassPaths();
if (classPaths != null)
processXMLClasspath(unit, classPaths);
+
+ List<ServiceMetaData> services = parsed.getServices();
+ if (services == null)
+ {
+ Element config = parsed.getConfig();
+ if (config == null)
+ {
+ log.debug("Service deployment has no services: " + parsed.getName());
+ return parsed;
+ }
+ if (log.isDebugEnabled())
+ {
+ String docStr = DOMWriter.printNode(config, true);
+ int index = docStr.toLowerCase().indexOf("password");
+ if (index != -1)
+ {
+ docStr = maskPasswords(docStr, index);
+ }
+ log.debug(docStr);
+ }
+ ServiceMetaDataParser SMDparser = new ServiceMetaDataParser(config);
+ services = SMDparser.parse();
+ parsed.setServices(services);
+ }
+
+
return parsed;
}
@@ -131,4 +161,30 @@
classpath.addAll(origClassPath);
unit.setClassPath(classpath);
}
+
+ private String maskPasswords(String original, int index)
+ {
+ StringBuilder sb = new StringBuilder(original);
+ String modified = null;
+ int startPasswdStringIndex = sb.indexOf(">", index);
+ if (startPasswdStringIndex != -1)
+ {
+ // checks if the keyword 'password' was not in a comment
+ if (sb.charAt(startPasswdStringIndex - 1) != '-')
+ {
+ int endPasswdStringIndex = sb.indexOf("<", startPasswdStringIndex);
+ if (endPasswdStringIndex != -1) // shouldn't happen, but check anyway
+ {
+ sb.replace(startPasswdStringIndex + 1, endPasswdStringIndex, "****");
+ }
+ }
+ modified = sb.toString();
+ // unlikely event of more than one password
+ index = modified.toLowerCase().indexOf("password", startPasswdStringIndex);
+ if (index != -1)
+ return maskPasswords(modified, index);
+ return modified;
+ }
+ return original;
+ }
}
More information about the jboss-cvs-commits
mailing list