jaugment2.directory
Class DirectoryService

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--jaugment2.jini.simpleService.simpleService
                          |
                          +--jaugment2.directory.DirectoryService

public class DirectoryService
extends simpleService
implements java.rmi.Remote, net.jini.discovery.DiscoveryListener, LookupEventListener

a service providing access to a number of directory-service-context

See Also:
Serialized Form

Inner Class Summary
private  class DirectoryService.asyncadd
          Thread-class to create contexts asyncronously
static class DirectoryService.DirectoryServiceEvent
          Class for events thrown here
 
Inner classes inherited from class jaugment2.jini.simpleService.simpleService
simpleService.myServiceIDListener
 
Field Summary
private  boolean cacheResults
          Cache results I got from directories on the network on local ones?
private  java.util.LinkedList[] contexts
           
private static boolean debugMessages
           
private static boolean experimental
          enable exoperimental code
private  SimpleLandlord landLord
           
private  java.util.LinkedList[] listenerRegistrations
           
private  DirectoryServiceProxy myproxy
           
private  java.util.Hashtable Name2Context
           
private  java.util.Hashtable serviceID2ActionsEntry
           
private  SimpleLandlord.LeaseListener simpleLeaselistener
          Helper-class for our Landlord.
 
Fields inherited from class jaugment2.jini.simpleService.simpleService
bindings, fallback_attrSets, jmngr, ldm, lrm, persistentState, proxy, sid, simpleservicedebugMessages
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname, serialVersionUID
 
Fields inherited from class java.rmi.server.RemoteObject
ref, serialVersionUID
 
Constructor Summary
DirectoryService()
           
DirectoryService(net.jini.core.discovery.LookupLocator locallocator)
           
 
Method Summary
 void addContext(java.util.Hashtable env, int level, java.lang.String name)
          Add a new context
 net.jini.core.lease.Lease addListener(net.jini.core.event.RemoteEventListener listener, java.rmi.MarshalledObject handback, int registerfor)
          Subscribe for events
private  void bindEntries(javax.naming.directory.SearchResult[] entries)
          Internal function used for caching
 void destroy()
          stop this service, destroy any persistent storage and exit
 void discarded(net.jini.discovery.DiscoveryEvent e)
          Called when one or more lookup service registrars has been discarded.
 void discovered(net.jini.discovery.DiscoveryEvent e)
          Called when one or more lookup service registrars has been discovered.
private  void fireEvent(int type)
           
 Directory.ActionsEntry[] getActionsEntries()
          Returns all valid actions found
 RemoteContextIF getContext(java.lang.String name)
          Get a remote-wrapper around the named context
private  void init()
          load the configuration from System-properties and create our contexts
 java.lang.String[] listContexts()
          list all contexts
private  void loadMe()
          Load our state (e.g.
 void restart()
          restart this service once it has been stopped
 void ServiceChangedEvent(LookupEventEvent e)
           
 void ServiceFoundEvent(LookupEventEvent e)
           
 void ServiceGoneEvent(LookupEventEvent e)
           
 javax.naming.directory.SearchResult[] simpleSearch(java.lang.String query, int level)
           
 void stop(boolean exit)
          stop this service.
 
Methods inherited from class jaugment2.jini.simpleService.simpleService
, deinit, deinitBindings, finalize, getProxy, getServiceItem, getStorageLocation, init, initBindings, initBindings, load, save, setStorageLocation
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

debugMessages

private static final boolean debugMessages

experimental

private static final boolean experimental
enable exoperimental code

serviceID2ActionsEntry

private java.util.Hashtable serviceID2ActionsEntry

myproxy

private DirectoryServiceProxy myproxy

listenerRegistrations

private java.util.LinkedList[] listenerRegistrations

simpleLeaselistener

private SimpleLandlord.LeaseListener simpleLeaselistener
Helper-class for our Landlord.

landLord

private SimpleLandlord landLord

contexts

private java.util.LinkedList[] contexts

Name2Context

private java.util.Hashtable Name2Context

cacheResults

private boolean cacheResults
Cache results I got from directories on the network on local ones?
Constructor Detail

DirectoryService

public DirectoryService()
                 throws java.rmi.RemoteException

DirectoryService

public DirectoryService(net.jini.core.discovery.LookupLocator locallocator)
                 throws java.rmi.RemoteException
Method Detail

ServiceFoundEvent

public void ServiceFoundEvent(LookupEventEvent e)
Specified by:
ServiceFoundEvent in interface LookupEventListener

ServiceGoneEvent

public void ServiceGoneEvent(LookupEventEvent e)
Specified by:
ServiceGoneEvent in interface LookupEventListener

ServiceChangedEvent

public void ServiceChangedEvent(LookupEventEvent e)
Specified by:
ServiceChangedEvent in interface LookupEventListener

getActionsEntries

public Directory.ActionsEntry[] getActionsEntries()
                                           throws java.rmi.RemoteException
Returns all valid actions found

loadMe

private void loadMe()
Load our state (e.g. attrubutes, service-id) from persistent storage

discovered

public void discovered(net.jini.discovery.DiscoveryEvent e)
Called when one or more lookup service registrars has been discovered. The method should return quickly; e.g., it should not make remote calls.
Specified by:
discovered in interface net.jini.discovery.DiscoveryListener
Parameters:
e - the event that describes the discovered registrars

discarded

public void discarded(net.jini.discovery.DiscoveryEvent e)
Called when one or more lookup service registrars has been discarded. The method should return quickly; e.g., it should not make remote calls.
Specified by:
discarded in interface net.jini.discovery.DiscoveryListener
Parameters:
e - the event that describes the discarded registrars

restart

public void restart()
             throws java.lang.Exception
restart this service once it has been stopped
Overrides:
restart in class simpleService
See Also:
stop

stop

public void stop(boolean exit)
          throws java.lang.Exception
stop this service. If exit is false all references to this service are still valid but it has deregistered everywhere. (this includes the RMI-activation-daemon)
Overrides:
stop in class simpleService
Parameters:
exit - stop running
See Also:
restart, destroy

destroy

public void destroy()
             throws java.rmi.RemoteException
stop this service, destroy any persistent storage and exit
Overrides:
destroy in class simpleService

fireEvent

private void fireEvent(int type)

addListener

public net.jini.core.lease.Lease addListener(net.jini.core.event.RemoteEventListener listener,
                                             java.rmi.MarshalledObject handback,
                                             int registerfor)
                                      throws java.rmi.RemoteException,
                                             net.jini.core.lease.LeaseDeniedException,
                                             java.lang.IllegalStateException
Subscribe for events

init

private void init()
load the configuration from System-properties and create our contexts

simpleSearch

public javax.naming.directory.SearchResult[] simpleSearch(java.lang.String query,
                                                          int level)

bindEntries

private void bindEntries(javax.naming.directory.SearchResult[] entries)
Internal function used for caching

addContext

public void addContext(java.util.Hashtable env,
                       int level,
                       java.lang.String name)
Add a new context

listContexts

public java.lang.String[] listContexts()
list all contexts

getContext

public RemoteContextIF getContext(java.lang.String name)
                           throws java.rmi.RemoteException
Get a remote-wrapper around the named context