adm
Class CDirectory

java.lang.Object
  |
  +--adm.CDirectory

public class CDirectory
extends java.lang.Object
implements java.lang.Runnable

CDirectory is an invisible bean used to query the control system for lists of devices, properties, or classes. It is an introspection widget -- it doesn't monitor any value in the control system.

This bean is configured by specifing a regular expression for one or more of class name, device name, or property name. Depending upon a flag set by the user, an array of device names, property names or class names can be retrieved. The property name retrived are all the properties for the class. The property expression pattern match (set/getPropertyExpression method) will not be included in this release (0.4).

The setQueryType method must be called after set*Expression to trigger the DirectoryEvent. The query type may be one of: CLASS_QUERY, DEVICE_QUERY or PROPERTY_QUERY defined in CConstants class. When the query type is set to CLASS_QUERY or PROPERTY_QUERY, the classExpression must be set using setClassExpression. When the query type is DEVICE_QUERY, either classExpression or deviceExpression need be set.

To receive the directory service response, an object must implement the CDirectoryListener interface and add itself as a listener to this bean. There is one method, receivedNames (CDirectoryEvent e), in the CDirectoryListener interface. This method takes CDirectoryEvent as an argument. By calling getNames() in the CDirectoryEvent class, the name array (device names, property names or class names) can be obtained.

Since:
adm0.3

Constructor Summary
CDirectory()
          Null Constructor
 
Method Summary
 void addDirectoryListener(CDirectoryListener dl)
          Add the directory listener to receive the notification
 java.lang.String getClassExpression()
          Return class expression.
 java.lang.String getDeviceExpression()
          Return device expression.
 java.lang.String getPropertyExpression()
          Return property expression.
 int getQueryType()
          Return query type.
 void removeDirectoryListener(CDirectoryListener dl)
          Remove the directory listener service
 void run()
          Process the directory service and notify the listener
 void setClassExpression(java.lang.String s)
          Set the class expression
 void setDeviceExpression(java.lang.String s)
          Set the device expression
 void setPropertyExpression(java.lang.String s)
          Set the property expression
 void setQueryType(int type_id)
          Set the queryType.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDirectory

public CDirectory()
Null Constructor
Method Detail

setClassExpression

public void setClassExpression(java.lang.String s)
Set the class expression
Parameters:
s - the regular expression for class name

getClassExpression

public java.lang.String getClassExpression()
Return class expression. If not set, return null.

setDeviceExpression

public void setDeviceExpression(java.lang.String s)
Set the device expression
Parameters:
s - the regular expression for device name

getDeviceExpression

public java.lang.String getDeviceExpression()
Return device expression. If not set, return null.

setPropertyExpression

public void setPropertyExpression(java.lang.String s)
Set the property expression
Parameters:
s - the regular expression for property name

getPropertyExpression

public java.lang.String getPropertyExpression()
Return property expression. If not set, return null.

setQueryType

public void setQueryType(int type_id)
Set the queryType. It must be called after the expressions are set.
Parameters:
type_id - the query type, which may be one of:
  1. CConstants.DEVICE_QUERY
  2. CConstants.PROPERTY_QUERY
  3. CConstants.CLASS_QUERY

getQueryType

public int getQueryType()
Return query type. If not set, return -1.

run

public void run()
Process the directory service and notify the listener
Specified by:
run in interface java.lang.Runnable

addDirectoryListener

public void addDirectoryListener(CDirectoryListener dl)
Add the directory listener to receive the notification

removeDirectoryListener

public void removeDirectoryListener(CDirectoryListener dl)
Remove the directory listener service