com.inline.feature
Interface FeatureModel

All Known Implementing Classes:
AbstractFeatureModel

public interface FeatureModel

FeatureModel is the container of a Feature tree. It plays several roles:

Container of a feature tree.
You can obtain the root feature of tree from FeatureModel and then recursively traverse the whole tree. You can also obtain any model Feature using its URL.
Container of various factories.
FeatureModel manages lists of FeatureFactories, FeatureActionFactories, FeatureConstructorFactories, DisplayPropertyFactories.
Manager of the model configuration process
FeatureModel maintains a list of FeatureConfigurators and consults those to resolve conflicts between factories coming from different sources.
Manager of the resource parsing process
FeatureModel maintains lists of ResourceAdapters and ResourceSetAdapters. It registers itself as an observer on those adapters and invalidates dependent features when a resource or a resource set changes.
Manager of the commit process
FeatureModel.commit() sends commit() to all modified features, then to all modified resources.


Field Summary
static java.lang.String DISPLAY_MODE
          Property that determines the type of UI used to display this model.
static java.lang.String STANDARD_DISPLAY_MODE
          Property that identifies the default type of UI.
static java.lang.String TYPE
          Property that determines the type of model, for example "EJB1.1 Assembly", "J2EE Assembly", "EDOC Subsystem" etc.
 
Method Summary
 void commit()
          Invokes the commit() method on all changed, new and removed features.
 void featureChanged(Feature feature, java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
          Invoked by a feature when it changes, except when it changes during the resource parsing process.
 void featureDeleted(Feature feature)
          Invoked by a feature when it is deleted from the model, except as a result of the resource parsing process.
 void featureInserted(Feature feature)
          Invoked by a feature set when a new feature is inserted, except as a result of the resource parsing process.
 com.sun.java.util.collections.Set getAdditionalActions(Feature feature)
          Returns a set of FeatureActions provided by FeatureActionFactories for the supplied feature.
 com.sun.java.util.collections.Set getAdditionalFeatureConstructors(Feature parent, java.lang.String childType)
          Returns a set of FeatureConstructors for the supplied parent and child type.
 FeatureSet getChildFeatureSet(Feature parent)
          Returns a FeatureSet that represents all children of the supplied feature.
 DisplayProperties getDisplayProperties(Displayable displayable)
          Returns DisplayProperties for the Displayable object (feature, action, constructor, etc).
 Feature getFeature(java.net.URL url)
          Returns the feature for the specified URL.
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns the value of the specified property.
 ResourceAdapter getResourceAdapter(com.inline.resources.ResourceReference reference)
          Resource adaptor will do a lot of resource management: create resources, post events when the resources change, maintain timestamps etc.
 com.inline.resources.ResourceRepository getResourceRepository()
          Resource repository will provide access to various resources the model is base upon.
 ResourceSetAdapter getResourceSetAdapter(java.lang.String type, com.inline.resources.ResourceQualifier qualifier)
          Will post events when a resource of the corresponding type satisfying the qualifier is created/removed.
 Feature getRootFeature()
          Returns the root feature.
 boolean isDefaultFeatureConstructor(Feature parent, java.lang.String childType, FeatureConstructor constructor)
          The model can veto the choice of a particular constructor as the default one.
 boolean isFeatureActionEnabled(Feature feature, FeatureAction action)
          If the model returns false, the action will not be added to the list of enbaled actions for the supplied feature.
 boolean isFeatureActionFactoryEnabled(Feature feature, FeatureActionFactory factory)
          The model can veto action allocation by a factory.
 boolean isFeatureConstructorEnabled(Feature parent, java.lang.String childType, FeatureConstructor constructor)
          The model can veto use of a particular constructor.
 boolean isFeatureConstructorFactoryEnabled(Feature parent, java.lang.String childType, FeatureConstructorFactory factory)
          The model can veto feature constructor allocation by a factory
 boolean isFeatureFactoryEnabled(Feature parent, java.lang.String type, FeatureFactory factory)
          The model can veto child recognition by a factory
 boolean isFeatureRecognitionEnabled(Feature parent, java.net.URL url, FeatureFactory factory)
          The model can veto feature recognition by a feature set associated with a particular feature factory.
 void reparse()
          Sends the reparse() method to all registered resource and resource set adapters.
 void resourceModified(ResourceAdapter adapter)
          Invoked by a feature during the commit process to indicate that the feature may have changed the specified resource.
 

Field Detail

TYPE

public static final java.lang.String TYPE
Property that determines the type of model, for example "EJB1.1 Assembly", "J2EE Assembly", "EDOC Subsystem" etc.

DISPLAY_MODE

public static final java.lang.String DISPLAY_MODE
Property that determines the type of UI used to display this model.

STANDARD_DISPLAY_MODE

public static final java.lang.String STANDARD_DISPLAY_MODE
Property that identifies the default type of UI.
Method Detail

getRootFeature

public Feature getRootFeature()
Returns the root feature.

getFeature

public Feature getFeature(java.net.URL url)
Returns the feature for the specified URL.

getChildFeatureSet

public FeatureSet getChildFeatureSet(Feature parent)
Returns a FeatureSet that represents all children of the supplied feature. Do not call this method directly, call Feature.getChildren() instead.

getAdditionalFeatureConstructors

public com.sun.java.util.collections.Set getAdditionalFeatureConstructors(Feature parent,
                                                                          java.lang.String childType)
Returns a set of FeatureConstructors for the supplied parent and child type. The list only includes additional FeatureConstructors provided by FeatureConstructorFactories, not the primitive ones created directly by FeatureSets. Do not call this method directly, call FeatureSet.getFeatureConstructors(type) instead.
See Also:
FeatureConstructor, FeatureConstructorFactory, AbstractFeatureSet.getFeatureConstructors(String)

getAdditionalActions

public com.sun.java.util.collections.Set getAdditionalActions(Feature feature)
Returns a set of FeatureActions provided by FeatureActionFactories for the supplied feature. It does not include the primitive actions produced by features themselves and their child feature sets. Do not call this method directly, call Feature.getActions() instead.
See Also:
FeatureAction, FeatureActionFactory, AbstractFeature.getActions()

getDisplayProperties

public DisplayProperties getDisplayProperties(Displayable displayable)
Returns DisplayProperties for the Displayable object (feature, action, constructor, etc). This method is called primarily by the displayable's implementation of getDisplayProperties.

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Returns the value of the specified property. Used by feature factories, display property factories and can also be used by individual features.

isFeatureFactoryEnabled

public boolean isFeatureFactoryEnabled(Feature parent,
                                       java.lang.String type,
                                       FeatureFactory factory)
The model can veto child recognition by a factory

isFeatureRecognitionEnabled

public boolean isFeatureRecognitionEnabled(Feature parent,
                                           java.net.URL url,
                                           FeatureFactory factory)
The model can veto feature recognition by a feature set associated with a particular feature factory.

isFeatureConstructorFactoryEnabled

public boolean isFeatureConstructorFactoryEnabled(Feature parent,
                                                  java.lang.String childType,
                                                  FeatureConstructorFactory factory)
The model can veto feature constructor allocation by a factory

isFeatureConstructorEnabled

public boolean isFeatureConstructorEnabled(Feature parent,
                                           java.lang.String childType,
                                           FeatureConstructor constructor)
The model can veto use of a particular constructor.

isDefaultFeatureConstructor

public boolean isDefaultFeatureConstructor(Feature parent,
                                           java.lang.String childType,
                                           FeatureConstructor constructor)
The model can veto the choice of a particular constructor as the default one.

isFeatureActionFactoryEnabled

public boolean isFeatureActionFactoryEnabled(Feature feature,
                                             FeatureActionFactory factory)
The model can veto action allocation by a factory.

isFeatureActionEnabled

public boolean isFeatureActionEnabled(Feature feature,
                                      FeatureAction action)
If the model returns false, the action will not be added to the list of enbaled actions for the supplied feature.

getResourceRepository

public com.inline.resources.ResourceRepository getResourceRepository()
Resource repository will provide access to various resources the model is base upon.

getResourceAdapter

public ResourceAdapter getResourceAdapter(com.inline.resources.ResourceReference reference)
Resource adaptor will do a lot of resource management: create resources, post events when the resources change, maintain timestamps etc.

getResourceSetAdapter

public ResourceSetAdapter getResourceSetAdapter(java.lang.String type,
                                                com.inline.resources.ResourceQualifier qualifier)
Will post events when a resource of the corresponding type satisfying the qualifier is created/removed.

reparse

public void reparse()
Sends the reparse() method to all registered resource and resource set adapters. Each adapter checks the status of the corresponding resource(s) and sends an event if the status or contents have changed. This check is only performed if the adapter has at least one observer. The adapter observers are features and feature sets, they will reparse the resources when they receive a notification.

commit

public void commit()
            throws InvalidFeatureException
Invokes the commit() method on all changed, new and removed features. Then invokes commit(SHALLOW_COMMIT) on all modified resource adapters. Then invokes reparse() on itself.

featureChanged

public void featureChanged(Feature feature,
                           java.lang.String property,
                           java.lang.Object oldValue,
                           java.lang.Object newValue)
Invoked by a feature when it changes, except when it changes during the resource parsing process.

featureInserted

public void featureInserted(Feature feature)
Invoked by a feature set when a new feature is inserted, except as a result of the resource parsing process.

featureDeleted

public void featureDeleted(Feature feature)
Invoked by a feature when it is deleted from the model, except as a result of the resource parsing process.

resourceModified

public void resourceModified(ResourceAdapter adapter)
Invoked by a feature during the commit process to indicate that the feature may have changed the specified resource.