FileDocCategorySizeDatePackage
OfflineDottedNamesRegistry.javaAPI DocGlassfish v2 API4851Fri May 04 22:23:40 BST 2007com.sun.enterprise.management.offline

OfflineDottedNamesRegistry

public final class OfflineDottedNamesRegistry extends Object

Fields Summary
private Map
mPrefixToObjectName
Maps from dotted name prefxi to ObjectName
private Map
mObjectNameToPrefix
Maps from ObjectName to all dotted name prefixes.
private Map
mLegalAttributes
The legal attribute names
Constructors Summary
public OfflineDottedNamesRegistry()

	    mPrefixToObjectName   = new HashMap<String,ObjectName>();
	    mObjectNameToPrefix   = new HashMap<ObjectName,String>();
	    mLegalAttributes      = new HashMap<ObjectName,Set<String>>();
	
Methods Summary
public synchronized voidaddMapping(javax.management.ObjectName objectName, java.lang.String prefix, java.util.Set legalAttributes)
Add a mapping from an ObjectName to its dotted name prefixes.

param
objectName the ObjectName in question
param
prefix one or more prefixes associated with this ObjectName
param
legalAttributes the legal attributes, as found in the MBeanInfo of the ObjectName

	    if ( objectName == null || prefix == null )
	    {
	        throw new IllegalArgumentException( "null" );
	    }
	    
	    if ( mObjectNameToPrefix.containsKey( objectName ) )
	    {
	        throw new IllegalArgumentException( "Already registered: " + objectName );
	    }
	    
	    mObjectNameToPrefix.put( objectName, prefix );
	    mPrefixToObjectName.put( prefix, objectName );
	    mLegalAttributes.put( objectName, Collections.unmodifiableSet( legalAttributes ) );
	
public java.util.SetgetLegalAttributes(javax.management.ObjectName objectName)

	    return mLegalAttributes.get( objectName );
	
public javax.management.ObjectNamegetObjectName(java.lang.String prefix)

	    return mPrefixToObjectName.get( prefix );
	
public java.util.SetgetObjectNames()

	    final Set<ObjectName>   result  = new HashSet<ObjectName>();
	    
	    result.addAll( mObjectNameToPrefix.keySet() );
	    return result;
	
public java.lang.StringgetPrefix(javax.management.ObjectName objectName)

	    return mObjectNameToPrefix.get( objectName );
	
public java.util.SetgetPrefixes()

	    final Set<String>   result  = new HashSet<String>();
	    
	    result.addAll( mObjectNameToPrefix.values() );
	    return result;
	
public synchronized voidremoveMapping(javax.management.ObjectName objectName)

	    final String  prefix    = mObjectNameToPrefix.get( objectName );
	    if ( prefix != null )
	    {
	        mObjectNameToPrefix.remove( objectName );
	        mLegalAttributes.remove( objectName );
            mPrefixToObjectName.remove( prefix );
	    }