org.objectweb.fractal.adl.components
Class ComponentLoader

java.lang.Object
  extended by org.objectweb.fractal.adl.AbstractLoader
      extended by org.objectweb.fractal.adl.components.ComponentLoader
All Implemented Interfaces:
ComponentLoaderAttributes, Loader, org.objectweb.fractal.api.control.AttributeController, org.objectweb.fractal.api.control.BindingController
Direct Known Subclasses:
ArgumentComponentLoader

public class ComponentLoader
extends AbstractLoader
implements ComponentLoaderAttributes

A Loader to check Component nodes in definitions. This loader checks sub component names, loads the definitions referenced by the component nodes (and the "extends" attribute), and merges all these definitions into a single one (by following inheritance rules).


Field Summary
protected static java.util.logging.Logger logger
           
protected  java.util.Map<java.lang.String,java.lang.String> nameAttributes
          The names of the "name" attribute for each AST node type.
 NodeMerger nodeMergerItf
          The node merger component used to merge AST.
 
Fields inherited from class org.objectweb.fractal.adl.AbstractLoader
clientLoader, LOADER_BINDING
 
Constructor Summary
ComponentLoader()
          Default constructor.
 
Method Summary
 void bindFc(java.lang.String s, java.lang.Object o)
           
protected  Component getComponent(ComponentContainer container, java.lang.String name)
           
 java.lang.String getNameAttributes()
           
protected  Component getPathComponent(ComponentContainer container, java.lang.String name)
           
protected  boolean isShared(java.lang.String definition)
           
 java.lang.String[] listFc()
           
protected  Definition load(java.util.Set<java.lang.String> loaded, java.lang.String name, java.util.Map<java.lang.Object,java.lang.Object> context)
           
 Definition load(java.lang.String name, java.util.Map<java.lang.Object,java.lang.Object> context)
          Loads the ADL definition whose name is given.
 java.lang.Object lookupFc(java.lang.String s)
           
protected  void normalizeComponentContainer(ComponentContainer container)
           
protected  java.util.List<java.lang.String> parseDefinitions(java.lang.String nameList, Node n)
           
protected  ComponentContainer replaceComponents(ComponentContainer container, java.util.Map<Node,Node> replacements)
           
protected  void resolveComponentContainer(java.util.Set<java.lang.String> loaded, ComponentContainer topLevelDefinition, ComponentContainer container, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  ComponentDefinition resolveDefinitionExtension(java.util.Set<java.lang.String> loaded, ComponentDefinition def, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  Definition resolveDefinitions(java.util.Set<java.lang.String> loaded, java.util.List<java.lang.String> nameList, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  void resolveSharedComponentContainer(ComponentContainer topLevelDefinition, ComponentContainer container, java.util.Map<java.lang.Object,java.lang.Object> context)
           
 void setNameAttributes(java.lang.String nameAttributes)
           
 void unbindFc(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger

nodeMergerItf

public NodeMerger nodeMergerItf
The node merger component used to merge AST.


nameAttributes

protected final java.util.Map<java.lang.String,java.lang.String> nameAttributes
The names of the "name" attribute for each AST node type. This map associates the names of the "name" attribute, used to detect overridden elements, to each AST node type that has such an attribute.

Constructor Detail

ComponentLoader

public ComponentLoader()
Default constructor.

Method Detail

getNameAttributes

public java.lang.String getNameAttributes()
Specified by:
getNameAttributes in interface ComponentLoaderAttributes

setNameAttributes

public void setNameAttributes(java.lang.String nameAttributes)
Specified by:
setNameAttributes in interface ComponentLoaderAttributes

load

public Definition load(java.lang.String name,
                       java.util.Map<java.lang.Object,java.lang.Object> context)
                throws ADLException
Description copied from interface: Loader
Loads the ADL definition whose name is given.

Specified by:
load in interface Loader
Parameters:
name - the name of an ADL definition.
context - optional additional information.
Returns:
the ADL definition whose name is given.
Throws:
ADLException - if the definition cannot be found, or if it contains errors.

load

protected Definition load(java.util.Set<java.lang.String> loaded,
                          java.lang.String name,
                          java.util.Map<java.lang.Object,java.lang.Object> context)
                   throws ADLException
Throws:
ADLException

normalizeComponentContainer

protected void normalizeComponentContainer(ComponentContainer container)
                                    throws ADLException
Throws:
ADLException

resolveComponentContainer

protected void resolveComponentContainer(java.util.Set<java.lang.String> loaded,
                                         ComponentContainer topLevelDefinition,
                                         ComponentContainer container,
                                         java.util.Map<java.lang.Object,java.lang.Object> context)
                                  throws ADLException
Throws:
ADLException

resolveDefinitionExtension

protected ComponentDefinition resolveDefinitionExtension(java.util.Set<java.lang.String> loaded,
                                                         ComponentDefinition def,
                                                         java.util.Map<java.lang.Object,java.lang.Object> context)
                                                  throws ADLException
Throws:
ADLException

resolveSharedComponentContainer

protected void resolveSharedComponentContainer(ComponentContainer topLevelDefinition,
                                               ComponentContainer container,
                                               java.util.Map<java.lang.Object,java.lang.Object> context)
                                        throws ADLException
Throws:
ADLException

parseDefinitions

protected java.util.List<java.lang.String> parseDefinitions(java.lang.String nameList,
                                                            Node n)
                                                     throws ADLException
Throws:
ADLException

isShared

protected boolean isShared(java.lang.String definition)

resolveDefinitions

protected Definition resolveDefinitions(java.util.Set<java.lang.String> loaded,
                                        java.util.List<java.lang.String> nameList,
                                        java.util.Map<java.lang.Object,java.lang.Object> context)
                                 throws ADLException
Throws:
ADLException

getComponent

protected Component getComponent(ComponentContainer container,
                                 java.lang.String name)

getPathComponent

protected Component getPathComponent(ComponentContainer container,
                                     java.lang.String name)

replaceComponents

protected ComponentContainer replaceComponents(ComponentContainer container,
                                               java.util.Map<Node,Node> replacements)

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)
            throws org.objectweb.fractal.api.NoSuchInterfaceException,
                   org.objectweb.fractal.api.control.IllegalBindingException
Specified by:
bindFc in interface org.objectweb.fractal.api.control.BindingController
Overrides:
bindFc in class AbstractLoader
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException
org.objectweb.fractal.api.control.IllegalBindingException

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface org.objectweb.fractal.api.control.BindingController
Overrides:
listFc in class AbstractLoader

lookupFc

public java.lang.Object lookupFc(java.lang.String s)
                          throws org.objectweb.fractal.api.NoSuchInterfaceException
Specified by:
lookupFc in interface org.objectweb.fractal.api.control.BindingController
Overrides:
lookupFc in class AbstractLoader
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException

unbindFc

public void unbindFc(java.lang.String s)
              throws org.objectweb.fractal.api.NoSuchInterfaceException,
                     org.objectweb.fractal.api.control.IllegalBindingException
Specified by:
unbindFc in interface org.objectweb.fractal.api.control.BindingController
Overrides:
unbindFc in class AbstractLoader
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException
org.objectweb.fractal.api.control.IllegalBindingException


Copyright © 2001-2010 ObjectWeb Consortium. All Rights Reserved.