@Named(value="classpath") public final class ClasspathTransporterFactory extends Object implements TransporterFactory, Service
classpath:
protocol. As example, getting an item named
some/file.txt
from a repository with the URL classpath:/base/dir
results in retrieving the resource
base/dir/some/file.txt
from the classpath. The classpath to load the resources from is given via a
ClassLoader
that can be configured via the configuration property CONFIG_PROP_CLASS_LOADER
.
Note: Such repositories are read-only and uploads to them are generally not supported.
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_PROP_CLASS_LOADER
The key in the repository session's
configuration
properties used to store a ClassLoader from which resources should be retrieved. |
Constructor and Description |
---|
ClasspathTransporterFactory()
Creates an (uninitialized) instance of this transporter factory.
|
Modifier and Type | Method and Description |
---|---|
float |
getPriority()
The priority of this factory.
|
void |
initService(ServiceLocator locator)
Provides the opportunity to initialize this service and to acquire other services for its operation from the
locator.
|
Transporter |
newInstance(RepositorySystemSession session,
RemoteRepository repository)
Tries to create a transporter for the specified remote repository.
|
ClasspathTransporterFactory |
setLoggerFactory(LoggerFactory loggerFactory)
Sets the logger factory to use for this component.
|
ClasspathTransporterFactory |
setPriority(float priority)
Sets the priority of this component.
|
public static final String CONFIG_PROP_CLASS_LOADER
configuration
properties
used to store a ClassLoader
from which resources should be retrieved. If unspecified, the
context class loader
of the current thread will be used.public ClasspathTransporterFactory()
public void initService(ServiceLocator locator)
Service
initService
in interface Service
locator
- The service locator, must not be null
.public ClasspathTransporterFactory setLoggerFactory(LoggerFactory loggerFactory)
loggerFactory
- The logger factory to use, may be null
to disable logging.null
.public float getPriority()
TransporterFactory
getPriority
in interface TransporterFactory
public ClasspathTransporterFactory setPriority(float priority)
priority
- The priority.null
.public Transporter newInstance(RepositorySystemSession session, RemoteRepository repository) throws NoTransporterException
TransporterFactory
RemoteRepository.getProtocol()
to determine whether it can handle a repository.newInstance
in interface TransporterFactory
session
- The repository system session from which to configure the transporter, must not be null
.
In particular, a transporter should obey the timeouts configured for the session.repository
- The remote repository to create a transporter for, must not be null
.null
.NoTransporterException
- If the factory cannot create a transporter for the specified remote repository.Copyright © 2010–2018 The Apache Software Foundation. All rights reserved.