public abstract class AbstractPathFactory extends AbstractLoggableComponent implements PathFactory
PathFactory
interface.Modifier and Type | Field and Description |
---|---|
private Map<String,PathProvider> |
schema2providerMap |
CDI_NAME
Constructor and Description |
---|
AbstractPathFactory()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
Path |
createPath(Path basePath,
String resourcePath)
This method creates a new
Path for the given parameters. |
private Path |
createPath(PathUri uri) |
Path |
createPath(String resourceUri)
This method creates a new
Path for the given resourceUri . |
protected PathProvider |
getProvider(PathUri pathUri)
This method gets the
PathProvider for the given PathUri . |
void |
registerProvider(PathProvider provider)
This method registers the given
PathProvider . |
void |
registerProvider(PathProvider provider,
String schemePrefix)
This method registers the given
PathProvider . |
createLogger, doInitialize, getLogger
doInitialized, getInitializationState, initialize
private final Map<String,PathProvider> schema2providerMap
public void registerProvider(PathProvider provider) throws DuplicateObjectException
PathProvider
.provider
- is the PathProvider
to register.DuplicateObjectException
- if a PathProvider
is already registered for one of the
scheme-prefixes
.public void registerProvider(PathProvider provider, String schemePrefix) throws DuplicateObjectException
PathProvider
.provider
- is the PathProvider
to register.schemePrefix
- is the scheme-prefix
for which the PathProvider
shall
be registered.DuplicateObjectException
- if a PathProvider
is already registered for one of the
scheme-prefixes
.protected PathProvider getProvider(PathUri pathUri) throws ResourceUriUndefinedException
PathProvider
for the given PathUri
.pathUri
- is the PathUri
.PathProvider
responsible
for the given PathUri
.ResourceUriUndefinedException
- if no provider
is registered
that is responsible.public Path createPath(String resourceUri)
PathFactory
Path
for the given resourceUri
. The following URI-schemes are guaranteed
to be supported:
scheme | example URI |
---|---|
file |
file:///tmp/foo.xml |
classpath |
classpath:net/sf/mmm/util/beans-core.xml |
http |
http://m-m-m.sourceforge.net/maven/ |
https |
https://github.com/m-m-m/mmm/ |
createPath
in interface PathFactory
resourceUri
- is the absolute URI
pointing to the location of the requested Path
.Path
.private Path createPath(PathUri uri)
uri
- is the PathUri
.Path
.createPath(String)
public Path createPath(Path basePath, String resourcePath)
PathFactory
Path
for the given parameters. If the given resourcePath
is absolute
(including scheme
), then this method returns the same result as
createPath
(resourcePath)
. Otherwise the resource path will be treated relative
to the given basePath
.createPath
in interface PathFactory
basePath
- is the Path
to use if resourcePath
is relative. You typically want to provide the
parent directory
of a resource to navigate from.resourcePath
- is the absolute or relative path to the requested resource.Copyright © 2001–2016 mmm-Team. All rights reserved.