net.sf.mmm.util.resource.base
Class AbstractBrowsableResourceFactory

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.resource.base.AbstractDataResourceFactory
              extended by net.sf.mmm.util.resource.base.AbstractBrowsableResourceFactory
All Implemented Interfaces:
BrowsableResourceFactory, DataResourceFactory
Direct Known Subclasses:
BrowsableResourceFactoryImpl

public abstract class AbstractBrowsableResourceFactory
extends AbstractDataResourceFactory
implements BrowsableResourceFactory

This is the abstract base implementation of the BrowsableResourceFactory interface.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Nested Class Summary
protected  class AbstractBrowsableResourceFactory.BrowsableResourceAdapter
          This is an implementation of the BrowsableResource interface, that adapts another BrowsableResource and enhances the AbstractBrowsableResourceFactory.BrowsableResourceAdapter.navigate(String)-method to support switching schemes via the BrowsableResourceFactory that created this BrowsableResource.
 
Nested classes/interfaces inherited from class net.sf.mmm.util.resource.base.AbstractDataResourceFactory
AbstractDataResourceFactory.DataResourceAdapter
 
Field Summary
private  Map<String,DataResourceProvider<? extends DataResource>> schema2providerMap
           
 
Constructor Summary
AbstractBrowsableResourceFactory()
          The constructor.
 
Method Summary
protected  BrowsableResource createBrowsableResource(ResourceUri resourceUri)
          This method creates the actual raw BrowsableResource.
 BrowsableResource createBrowsableResource(String resourceUri)
          This method creates a new BrowsableResource from the given resourceUri.
protected  DataResource createDataResource(ResourceUri resourceUri)
          This method creates the actual raw DataResource.
protected  DataResourceProvider<? extends DataResource> getProvider(ResourceUri resourceUri)
          This method gets the provider for the given resourceUri.
 void registerProvider(DataResourceProvider<? extends DataResource> provider)
          This method registers the given provider.
 void registerProvider(DataResourceProvider<? extends DataResource> provider, String schemaPrefix)
          This method registers the given provider for the given schemaPrefix.
 
Methods inherited from class net.sf.mmm.util.resource.base.AbstractDataResourceFactory
createDataResource
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
doInitialize, getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.resource.api.DataResourceFactory
createDataResource
 

Field Detail

schema2providerMap

private final Map<String,DataResourceProvider<? extends DataResource>> schema2providerMap
See Also:
createBrowsableResource(ResourceUri)
Constructor Detail

AbstractBrowsableResourceFactory

public AbstractBrowsableResourceFactory()
The constructor.

Method Detail

registerProvider

public void registerProvider(DataResourceProvider<? extends DataResource> provider)
                      throws DuplicateObjectException
This method registers the given provider.

Parameters:
provider - is the DataResourceProvider to register.
Throws:
DuplicateObjectException - if a DataResourceProvider is already registered for one of the scheme-prefixes.

registerProvider

public void registerProvider(DataResourceProvider<? extends DataResource> provider,
                             String schemaPrefix)
                      throws DuplicateObjectException
This method registers the given provider for the given schemaPrefix.

Parameters:
provider - is the DataResourceProvider to register.
schemaPrefix - is the scheme-prefix for which the provider shall be registered.
Throws:
DuplicateObjectException - if a DataResourceProvider is already registered with the same scheme-prefix.

getProvider

protected DataResourceProvider<? extends DataResource> getProvider(ResourceUri resourceUri)
                                                            throws ResourceUriUndefinedException
This method gets the provider for the given resourceUri.

Parameters:
resourceUri - is the ResourceUriImpl.
Returns:
the DataResourceProvider responsible for the given resourceUri.
Throws:
ResourceUriUndefinedException - if no provider is registered that is responsible.

createDataResource

protected DataResource createDataResource(ResourceUri resourceUri)
                                   throws ResourceUriUndefinedException
This method creates the actual raw DataResource.

Specified by:
createDataResource in class AbstractDataResourceFactory
Parameters:
resourceUri - is the parsed and qualified ResourceUriImpl.
Returns:
the created DataResource.
Throws:
ResourceUriUndefinedException - if the given resourceUri is undefined, e.g. the scheme-prefix is NOT supported by this factory.

createBrowsableResource

protected BrowsableResource createBrowsableResource(ResourceUri resourceUri)
                                             throws ResourceUriUndefinedException
This method creates the actual raw BrowsableResource.

Parameters:
resourceUri - is the parsed and qualified ResourceUriImpl.
Returns:
the created BrowsableResource.
Throws:
ResourceUriUndefinedException - if the given resourceUri is undefined, e.g. the scheme-prefix is NOT supported by this factory.

createBrowsableResource

public BrowsableResource createBrowsableResource(String resourceUri)
                                          throws ResourceUriUndefinedException
This method creates a new BrowsableResource from the given resourceUri. The following URI-schemes are guaranteed to be supported:
scheme example URI default implementation
file file:///tmp/foo.xml FileResource

Specified by:
createBrowsableResource in interface BrowsableResourceFactory
Parameters:
resourceUri - is the absolute URI pointing to the location of the requested BrowsableResource.
Returns:
the requested BrowsableResource.
Throws:
ResourceUriUndefinedException - if the given resourceUri is undefined (e.g. the scheme is NOT supported).


Copyright © 2001-2010 mmm-Team. All Rights Reserved.