org.netbeans.modules.server/0 1.20

org.netbeans.api.server.properties
Class InstancePropertiesManager

java.lang.Object
  extended by org.netbeans.api.server.properties.InstancePropertiesManager

public final class InstancePropertiesManager
extends Object

This class acts as a manager of the properties. It manages the set of properties and they persistence.

Single InstanceProperties instance created by the manager usually serves to persist properties of single server instance. By definition many InstanceProperties can be created in the same namespace. For common use case client module will use one namespace with several InstanceProperties.

The namespace used in both non-static methods is just the symbolic name for the InstanceProperties logically connected (like instances of the same server type for example) and retrievable by calling getProperties(String) respectively.

Typical use case:

     // we have some instance to persist
     InstancePropertiesManager manager = InstancePropertiesManager.getInstance();
     InstanceProperties props1 = manager.createProperties("myspace");
     props1.put("property", "value");

     // we want to persist yet another instance
     InstanceProperties props2 = manager.createProperties("myspace");
     props2.put("property", "value");

     // we want to retrieve all InstanceProperties from "myspace"
     // the list will have two elements
     List<InstanceProperties> props = manager.getInstanceProperties("myspace");
 

This class is ThreadSafe.


Method Summary
 InstanceProperties createProperties(String namespace)
          Creates and returns properties in the given namespace.
static InstancePropertiesManager getInstance()
          Returns the instance of the default manager.
 List<InstanceProperties> getProperties(String namespace)
          Returns all existing properties created in the given namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static InstancePropertiesManager getInstance()
Returns the instance of the default manager.

Returns:
the instance of the default manager

createProperties

public InstanceProperties createProperties(String namespace)
Creates and returns properties in the given namespace. It is perfectly legal to call this method multiple times with the same namespace as a parameter - it will always create new instance of InstanceProperties. Returned properties should serve for persistence of the single server instance.

Parameters:
namespace - string identifying the namespace of created InstanceProperties
Returns:
new InstanceProperties logically placed in the given namespace

getProperties

public List<InstanceProperties> getProperties(String namespace)
Returns all existing properties created in the given namespace.

Parameters:
namespace - string identifying the namespace
Returns:
list of all existing properties created in the given namespace

org.netbeans.modules.server/0 1.20

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.