FileDocCategorySizeDatePackage
Registry.javaAPI DocGlassfish v2 API4998Fri May 04 22:33:32 BST 2007com.sun.enterprise.admin.common.domains.registry

Registry

public class Registry extends Object implements Serializable, Cloneable, DomainRegistryI

Fields Summary
TreeMap
roots
HashMap
entries
Constructors Summary
Methods Summary
protected java.lang.Objectclone()

	try {
	  Registry lhs = (Registry) super.clone();
	  lhs.roots = (TreeMap) this.roots.clone();
	  lhs.entries = (HashMap) this.entries.clone();
	  return lhs;
	}
	catch (CloneNotSupportedException cne){
	  return null;
	}
  
public booleancontainsDomain(DomainEntry de)

	return entries.values().contains(de);
  
private booleancontainsRoot(java.io.File root)

	return roots.containsValue(root);
  
private voiddelete(java.lang.String name)

	roots.remove(name);
	entries.remove(name);
  
public DomainEntrygetDomain(java.lang.String name)

	return (DomainEntry) entries.get(name);
  
public booleanisRegistered(java.lang.String name)


     
	return roots.containsKey(name);
  
public java.util.Iteratoriterator()

	return new RegistryIterator(this);
  
public voidregisterDomain(DomainEntry de)

	if (isRegistered(de.getName())) {
	  throw new AlreadyRegisteredException(de.getName());
	}
	if (containsRoot(de.getRoot())){
	  throw new InvalidRootException("The root \""+de.getRoot()+"\" is already registered");
	}
	roots.put(de.getName(), de.getRoot());
	entries.put(de.getName(), de);
  
public voidreregisterDomain(DomainEntry de)

	if (isRegistered(de.getName())) {
	  if (!roots.get(de.getName()).equals(de.getRoot())){
		throw new InvalidRootException("The given root ("+de.getRoot()+") of domain "+de.getName()+" doesn't match the already registered root for this domain");
	  }
	} else {
	  if (containsRoot(de.getRoot())){
		throw new InvalidRootException("The given root ("+de.getRoot()+") of domain "+de.getName()+" is already registered with a different domain");
	  }
	};

	entries.put(de.getName(), de);
  
public intsize()

	return roots.size();
  
public voidunregisterDomain(java.lang.String domain_name)

   if (!isRegistered(domain_name)){
	 throw new UnregisteredDomainException(domain_name);
   }
	delete(domain_name);
  
public voidunregisterDomain(DomainEntry de)

	unregisterDomain(de.getName());