Methods Summary |
---|
public boolean | containsDomain(DomainEntry de)
refreshRegistry();
return registry.containsDomain(de);
|
public DomainEntry | getDomain(java.lang.String name)
refreshRegistry();
return registry.getDomain(name);
|
private Registry | getRegistryFromStore()
Registry br;
br = (Registry) store.readObject();
return (br != null ? br : new Registry());
|
private void | init()
try {
store = LockingStoreFactory.getInstance();
registry = getRegistryFromStore();
}
catch (Exception e){
throw new DomainRegistryException("couldn't initialize registry. Error message: "+ e.getMessage());
}
|
public java.util.Iterator | iterator()
refreshRegistry();
return registry.iterator();
|
public static synchronized com.sun.enterprise.admin.common.domains.registry.DomainRegistry | newInstance()Return an instance of the DomainRegistry
if (instance == null){
instance = new DomainRegistry();
instance.init();
}
return instance;
|
private void | prepareForUpdate()
try {
store.lock();
}
catch (Exception e){
throw new DomainRegistryException("problem locking store ", e);
}
refreshRegistry();
|
private void | refreshRegistry()
if (lastModified < store.lastModified()){
try {
registry = getRegistryFromStore();
}
catch (Exception te){
throw new DomainRegistryException("problem reading from store", te);
}
}
|
public synchronized void | registerDomain(DomainEntry de)
prepareForUpdate();
try {
registry.registerDomain(de);
}
catch (DomainRegistryException e){
store.unlock();
throw e;
}
saveRegistry();
|
public void | reregisterDomain(DomainEntry de)
prepareForUpdate();
try {
registry.reregisterDomain(de);
}
catch (DomainRegistryException e){
store.unlock();
throw e;
}
saveRegistry();
|
synchronized void | reset()
store.unlock();
registry = null;
store = null;
instance = null;
|
private void | saveRegistry()
try {
store.writeObject(registry);
store.unlock();
lastModified = store.lastModified();
}
catch (Exception e){
e.printStackTrace();
throw new DomainRegistryException("couldn't save registry", e);
}
|
public int | size()
refreshRegistry();
return registry.size();
|
public void | unregisterDomain(java.lang.String domain_name)
prepareForUpdate();
try{
registry.unregisterDomain(domain_name);
}
catch (DomainRegistryException e){
store.unlock();
throw e;
}
saveRegistry();
|
public void | unregisterDomain(DomainEntry de)
this.unregisterDomain(de.getName());
|