站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 varia API Documentation 英文版文档

SystemPropertiesService (Various API) - JBoss 4.0.1 sp1 varia API Documentation 英文版文档


org.jboss.varia.property
Class SystemPropertiesService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.varia.property.SystemPropertiesService
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, SystemPropertiesServiceMBean

public class SystemPropertiesService
extends org.jboss.system.ServiceMBeanSupport
implements SystemPropertiesServiceMBean

A service to access system properties.

Version:
$Revision: 1.11 $
Author:
Jason Dillon, Scott.Stark@jboss.org

Nested Class Summary
protected static class SystemPropertiesService.HTMLMap
          A helper to render a map as HTML on toString()
 
Field Summary
protected  String serverHome
          The server's home dir as a string (for making urls).
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.varia.property.SystemPropertiesServiceMBean
OBJECT_NAME
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
SystemPropertiesService()
           
 
Method Summary
 void addListener(org.jboss.util.property.PropertyListener listener)
          Add a property listener.
 void addListener(String typename)
          Construct and add a property listener.
 void addListeners(org.jboss.util.property.PropertyListener[] listeners)
          Add an array of property listeners.
 boolean exists(String name)
          Check if a system property of the given name exists.
 String get(String name)
          Get a system property.
 String get(String name, String defaultValue)
          Get a system property.
 List getArray(String name)
          Get an array style system property.
 List getArray(String base, List defaultValues)
          Get an array style system property.
 org.jboss.util.property.PropertyGroup getGroup(String basename)
          Get a property group for under the given system property base.
 org.jboss.util.property.PropertyGroup getGroup(String basename, int index)
          Get a property group for under the given system property base at the given index.
 void load(String url)
          Load some system properties from the given URL.
 void load(URL url)
          Load some system properties from the given URL.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          Setup our reference to the server's home directory.
 String remove(String name)
          Remove a system property.
 boolean removeListener(org.jboss.util.property.PropertyListener listener)
          Remove a property listener.
 String set(String name, String value)
          Set a system property.
 void setProperties(Properties props)
          Set system properties by merging the given properties object.
 void setURLList(String list)
          Load system properties for each of the given comma separated urls.
 Map showAll()
          Return a Map of System.getProperties() with a toString implementation that provides an html table of the key/value pairs.
 Map showGroup(String basename)
          Return a Map of the property group for under the given system property base with a toString implementation that provides an html table of the key/value pairs.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, start, startService, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

serverHome

protected String serverHome
The server's home dir as a string (for making urls).

Constructor Detail

SystemPropertiesService

public SystemPropertiesService()
Method Detail

set

public String set(String name,
                  String value)
Set a system property.

Specified by:
set in interface SystemPropertiesServiceMBean
Parameters:
name - The name of the property to set.
value - The value of the property.
Returns:
Previous property value or null

get

public String get(String name,
                  String defaultValue)
Get a system property.

Specified by:
get in interface SystemPropertiesServiceMBean
Parameters:
name - Property name
defaultValue - Default property value
Returns:
Property value or default

get

public String get(String name)
Get a system property.

Specified by:
get in interface SystemPropertiesServiceMBean
Parameters:
name - Property name
Returns:
Property value or null

remove

public String remove(String name)
Remove a system property.

Specified by:
remove in interface SystemPropertiesServiceMBean
Parameters:
name - The name of the property to remove.
Returns:
Removed property value or null

getArray

public List getArray(String base,
                     List defaultValues)
Get an array style system property.

Specified by:
getArray in interface SystemPropertiesServiceMBean
Parameters:
base - Base property name
defaultValues - Default property values
Returns:
ArrayList of property values or default

getArray

public List getArray(String name)
Get an array style system property.

Specified by:
getArray in interface SystemPropertiesServiceMBean
Parameters:
name - Property name
Returns:
ArrayList of property values or empty array

exists

public boolean exists(String name)
Check if a system property of the given name exists.

Specified by:
exists in interface SystemPropertiesServiceMBean
Parameters:
name - Property name
Returns:
True if property exists

getGroup

public org.jboss.util.property.PropertyGroup getGroup(String basename)
Get a property group for under the given system property base.

Specified by:
getGroup in interface SystemPropertiesServiceMBean
Parameters:
basename - Base property name
Returns:
Property group

getGroup

public org.jboss.util.property.PropertyGroup getGroup(String basename,
                                                      int index)
Get a property group for under the given system property base at the given index.

Specified by:
getGroup in interface SystemPropertiesServiceMBean
Parameters:
basename - Base property name
index - Array property index
Returns:
Property group

addListener

public void addListener(org.jboss.util.property.PropertyListener listener)
Add a property listener.

Specified by:
addListener in interface SystemPropertiesServiceMBean
Parameters:
listener - Property listener to add

addListeners

public void addListeners(org.jboss.util.property.PropertyListener[] listeners)
Add an array of property listeners.

Specified by:
addListeners in interface SystemPropertiesServiceMBean
Parameters:
listeners - Array of property listeners to add

removeListener

public boolean removeListener(org.jboss.util.property.PropertyListener listener)
Remove a property listener.

Specified by:
removeListener in interface SystemPropertiesServiceMBean
Parameters:
listener - Property listener to remove
Returns:
True if listener was removed

load

public void load(URL url)
          throws IOException
Load some system properties from the given URL.

Specified by:
load in interface SystemPropertiesServiceMBean
Parameters:
url - The url to load properties from.
Throws:
IOException

load

public void load(String url)
          throws IOException,
                 MalformedURLException
Load some system properties from the given URL.

Specified by:
load in interface SystemPropertiesServiceMBean
Parameters:
url - The url to load properties from.
Throws:
IOException
MalformedURLException

addListener

public void addListener(String typename)
                 throws ClassNotFoundException,
                        IllegalAccessException,
                        InstantiationException
Construct and add a property listener.

Specified by:
addListener in interface SystemPropertiesServiceMBean
Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException

setURLList

public void setURLList(String list)
                throws MalformedURLException,
                       IOException
Load system properties for each of the given comma separated urls.

Specified by:
setURLList in interface SystemPropertiesServiceMBean
Parameters:
list - A list of comma separated urls.
Throws:
MalformedURLException
IOException

setProperties

public void setProperties(Properties props)
                   throws IOException
Set system properties by merging the given properties object. This will replace valid references to properties of the form ${x} in 'props' or a System property with the value of x.

Specified by:
setProperties in interface SystemPropertiesServiceMBean
Parameters:
props - Properties object to merge.
Throws:
IOException

showAll

public Map showAll()
Return a Map of System.getProperties() with a toString implementation that provides an html table of the key/value pairs.

Specified by:
showAll in interface SystemPropertiesServiceMBean

showGroup

public Map showGroup(String basename)
Return a Map of the property group for under the given system property base with a toString implementation that provides an html table of the key/value pairs.

Specified by:
showGroup in interface SystemPropertiesServiceMBean
Parameters:
basename - Base property name
Returns:
Property group

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws Exception
Setup our reference to the server's home directory. This is done here because one or more attribute setters makes use of this value.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.