|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.inline.feature.common.AbstractResourceListener
A common base class for AbstractFeature and AbstractFeatureSet. Its responsibility is to manage sets of listeners and dependencies and the state of being active/passive.
A subclass of AbstractResourceListener overrided the registerDepencies()
method to register interest in resources and resource sets. Most implementations
of the registerDependencies()
method call the AbstractResourceListener's
methods registerResourceAdapter()
and registerResourceSetAdapter()
methods. For example,
protected void registerDependencies(){ classDescriptorAdapter = registerResourceAdapter( new ResourceReference(Constants.CLASS_DESCRIPTOR_RESOURCE_TYPE, "com.acme.MyClass")); sourceDocumentSetAdapter = registerResourceSetAdapter(Constants.SOURCE_DOCUMENT_RESOURCE_TYPE, new ResourceSuffixQualifier(".doc")); }
Field Summary | |
protected boolean |
active
|
protected FeatureModel |
featureModel
|
protected Feature |
parent
|
protected com.sun.java.util.collections.Set |
resourceAdapters
|
protected com.sun.java.util.collections.Set |
resourceSetAdapters
|
protected boolean |
revalidate
|
Constructor Summary | |
|
AbstractResourceListener(Feature parent)
|
protected |
AbstractResourceListener(FeatureModel featureModel)
Only use this for the root feature |
Method Summary | |
protected void |
activate()
Registers this object as an observer on all registered resource adapters and resource set adapters, then it calls invalidate() on self
to restart the resource parsing process. |
FeatureModel |
getFeatureModel()
|
Feature |
getParent()
|
void |
invalidate()
Restarts the resource parsing process. |
protected void |
passivate()
Unregisters this object as an observer from all registered resource adapters and resource set adapters. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Event handler for resource adapter. |
protected void |
registerDependencies()
Override to register all resource adapters this feature set depends upon. |
protected void |
registerResourceAdapter(ResourceAdapter adapter)
|
protected ResourceAdapter |
registerResourceAdapter(com.inline.resources.ResourceReference reference)
Acquires the ResourceAdapter for the specified reference from the FeatureModel and calls registerResourceAdapter(adapter) |
protected void |
registerResourceSetAdapter(ResourceSetAdapter adapter)
|
protected ResourceSetAdapter |
registerResourceSetAdapter(java.lang.String type,
com.inline.resources.ResourceQualifier qualifier)
Acquires the ResourceSetAdapter for the specified type and qualifier from the FeatureModel and calls registerResourceSetAdapter(adapter) |
void |
release()
If the object is active, passivates it. |
void |
resourceAdded(ResourceSetAdapter source,
com.inline.resources.ResourceReference ref)
Event handler for resource set adapters. |
protected void |
resourceChanged(ResourceAdapter adapter,
java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Event handler for resource adapters. |
void |
resourceRemoved(ResourceSetAdapter source,
com.inline.resources.ResourceReference ref)
Event handler for resource set adapters. |
protected void |
unregisterResourceAdapter(ResourceAdapter adapter)
|
protected void |
unregisterResourceSetAdapter(ResourceSetAdapter adapter)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Feature parent
protected FeatureModel featureModel
protected boolean active
protected boolean revalidate
protected com.sun.java.util.collections.Set resourceSetAdapters
protected com.sun.java.util.collections.Set resourceAdapters
Constructor Detail |
public AbstractResourceListener(Feature parent)
protected AbstractResourceListener(FeatureModel featureModel)
Method Detail |
public FeatureModel getFeatureModel()
public Feature getParent()
protected void registerDependencies()
protected ResourceSetAdapter registerResourceSetAdapter(java.lang.String type, com.inline.resources.ResourceQualifier qualifier)
registerResourceSetAdapter(adapter)
protected ResourceAdapter registerResourceAdapter(com.inline.resources.ResourceReference reference)
registerResourceAdapter(adapter)
protected void registerResourceSetAdapter(ResourceSetAdapter adapter)
protected void registerResourceAdapter(ResourceAdapter adapter)
protected void unregisterResourceSetAdapter(ResourceSetAdapter adapter)
protected void unregisterResourceAdapter(ResourceAdapter adapter)
protected void activate()
invalidate()
on self
to restart the resource parsing process.AbstractFeature.addPropertyChangeListener(PropertyChangeListener)
,
AbstractFeatureSet.addFeatureSetListener(FeatureSetListener)
protected void passivate()
AbstractFeature.removePropertyChangeListener(PropertyChangeListener)
,
AbstractFeatureSet.removeFeatureSetListener(FeatureSetListener)
public void invalidate()
public void release()
public void resourceAdded(ResourceSetAdapter source, com.inline.resources.ResourceReference ref)
this.invalidate()
.public void resourceRemoved(ResourceSetAdapter source, com.inline.resources.ResourceReference ref)
this.invalidate()
.public void propertyChange(java.beans.PropertyChangeEvent event)
this.resourceChanged(...)
protected void resourceChanged(ResourceAdapter adapter, java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
this.invalidate()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |