net.sf.panoptes.model.component.registry
Class ComponentRegistry

java.lang.Object
  |
  +--net.sf.panoptes.model.component.registry.ComponentRegistry

public class ComponentRegistry
extends java.lang.Object

The registry for component name - component reference mapping. Original code from JBoss.

See Also:
IComponent, ComponentEntry

Constructor Summary
ComponentRegistry()
          Constructs a new ComponentRegistry.
 
Method Summary
protected  void add(ComponentEntry entry)
          Adds an MBeanComponent entry WARNING: The object name should be fully qualified.
 boolean contains(ComponentName name)
           
protected  boolean domainMatches(char[] src, int spos, char[] pat, int ppos)
          Compare the src and pat char arrays where ?
protected  boolean domainMatches(java.lang.String src, java.lang.String pat)
          Compare the src and pat strings where ?
 java.util.List findEntries(ComponentName pattern)
           
 ComponentEntry get(ComponentName name)
           
 java.lang.String getDefaultDomain()
           
 Node getObjectInstance(ComponentName name)
           
 int getSize()
           
protected  ComponentName qualifyName(ComponentName name)
           
 void registerComponent(Component component, ComponentName name)
           
protected  void remove(ComponentName name)
          Removes an MBeanComponent entry WARNING: The object name should be fully qualified.
 void unregisterMBean(ComponentName name)
           
protected  ComponentName validateAndQualifyName(ComponentName name)
          Validates and qualifies an MBeanComponent Validates the name is not a pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentRegistry

public ComponentRegistry()
Constructs a new ComponentRegistry.

Method Detail

registerComponent

public void registerComponent(Component component,
                              ComponentName name)
                       throws ComponentAlreadyExistsException
ComponentAlreadyExistsException

unregisterMBean

public void unregisterMBean(ComponentName name)
                     throws ComponentNotFoundException
ComponentNotFoundException

get

public ComponentEntry get(ComponentName name)
                   throws ComponentNotFoundException
ComponentNotFoundException

getDefaultDomain

public java.lang.String getDefaultDomain()

getObjectInstance

public Node getObjectInstance(ComponentName name)
                       throws ComponentNotFoundException
ComponentNotFoundException

contains

public boolean contains(ComponentName name)

getSize

public int getSize()

findEntries

public java.util.List findEntries(ComponentName pattern)

domainMatches

protected boolean domainMatches(java.lang.String src,
                                java.lang.String pat)
Compare the src and pat strings where ? and * chars are significant.


domainMatches

protected boolean domainMatches(char[] src,
                                int spos,
                                char[] pat,
                                int ppos)
Compare the src and pat char arrays where ? and * chars are significant. I arrived at this solution after quite a bit of trial and error - it's all a bit interwoven. Obviously I'm no good at parsers and there must be a clearer or more elegant way to do this. I'm suitably in awe of the perl regex hackers now.


add

protected void add(ComponentEntry entry)
            throws ComponentAlreadyExistsException
Adds an MBeanComponent entry

WARNING: The object name should be fully qualified.

Parameters:
entry - the MBeanComponent entry to add
Throws:
InstanceAlreadyExistsException - when the MBeanComponent's object name is already registered
ComponentAlreadyExistsException

remove

protected void remove(ComponentName name)
               throws ComponentNotFoundException
Removes an MBeanComponent entry WARNING: The object name should be fully qualified.

Parameters:
name - the object name of the entry to remove
Throws:
InstanceNotFoundException - when the object name is not registered
ComponentNotFoundException

validateAndQualifyName

protected ComponentName validateAndQualifyName(ComponentName name)
Validates and qualifies an MBeanComponent

Validates the name is not a pattern.

Adds the default domain if no domain is specified.

Checks the name is not in the reserved domain JMImplementation when the magicToken is not JMI_DOMAIN

Parameters:
name - the name to validate
Returns:
the original name or the name prepended with the default domain if no domain is specified.
Throws:
RuntimeOperationException - containing an IllegalArgumentException for a problem with the name

qualifyName

protected ComponentName qualifyName(ComponentName name)


Copyright © 2003 . All Rights Reserved.