From: Jason D. <us...@us...> - 2002-05-18 03:23:33
|
User: user57 Date: 02/05/17 20:23:33 Modified: varia/src/main/org/jboss/varia/property Tag: Branch_3_0 SystemPropertiesService.java Log: o Merged changes from HEAD; changes to get relative paths resolved Revision Changes Path No revision No revision 1.2.2.3 +24 -7 contrib/varia/src/main/org/jboss/varia/property/SystemPropertiesService.java Index: SystemPropertiesService.java =================================================================== RCS file: /cvsroot/jboss/contrib/varia/src/main/org/jboss/varia/property/SystemPropertiesService.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- SystemPropertiesService.java 18 May 2002 01:51:33 -0000 1.2.2.2 +++ SystemPropertiesService.java 18 May 2002 03:23:33 -0000 1.2.2.3 @@ -28,6 +28,8 @@ import javax.management.MalformedObjectNameException; import org.jboss.system.ServiceMBeanSupport; +import org.jboss.system.server.ServerConfig; +import org.jboss.system.server.ServerConfigLocator; import org.jboss.util.property.Property; import org.jboss.util.property.PropertyGroup; @@ -48,6 +50,9 @@ extends ServiceMBeanSupport implements SystemPropertiesServiceMBean { + /** The server's home dir as a string (for making urls). */ + protected String serverHome; + /////////////////////////////////////////////////////////////////////////// // Property/PropertyManager Access // /////////////////////////////////////////////////////////////////////////// @@ -250,7 +255,7 @@ */ public void load(final URL url) throws IOException { - log.debug("Loading system properties from: " + url); + log.trace("Loading system properties from: " + url); Properties props = System.getProperties(); props.load(url.openConnection().getInputStream()); @@ -267,7 +272,7 @@ */ public void load(final String url) throws IOException, MalformedURLException { - load(Strings.toURL(url)); + load(Strings.toURL(url, serverHome)); } @@ -343,8 +348,7 @@ */ public Map showGroup(final String basename) { - PropertyGroup group = getGroup(basename); - return new HTMLMap(group); + return new HTMLMap(getGroup(basename)); } /** @@ -372,9 +376,9 @@ while (iter.hasNext()) { String key = (String)iter.next(); - buff.append("<tr><td align=\"left\">") + buff.append("<tr><td align=\"left\"><b>") .append(key) - .append("</td><td align=\"left\">") + .append("</b></td><td align=\"left\">") .append(this.get(key)) .append("</td></tr>\n\r"); } @@ -394,5 +398,18 @@ throws MalformedObjectNameException { return name == null ? OBJECT_NAME : name; + } + + /** + * Setup our reference to the server's home directory. This is done + * here because one or more attribute setters makes use of this value. + */ + public ObjectName preRegister(final MBeanServer server, final ObjectName name) + throws Exception + { + // get server's home for relative paths, need this for making urls + serverHome = ServerConfigLocator.locate().getServerHomeDir().getPath(); + + return super.preRegister(server, name); } } |