public abstract class HCImporter extends java.lang.Object implements Importer
HCImporter
is an abstract implementation of the
Importer
service interface supporting access to data using the HTTP
protocol.
Extensions of this base class must implement the
importData(String, InputStream, String, Resource)
method to actually
import the retrieved data.
Instances of this base class must be initialized before being used and
be destroyed when not used any more. If the extension is registered as an
Declarative Services Component, this initialization and destroyal is being
taken care of. Otherwise, the extension class must explicitly call the
init()
and destroy()
methods respectively.
The activate(ComponentContext)
and
deactivate(ComponentContext)
methods may be overwritten by extension
classes but the base class implementation must called in this case to
ensure proper initialization and destroyal.
SCHEME_PROPERTY, SERVICE_NAME
Constructor and Description |
---|
HCImporter() |
Modifier and Type | Method and Description |
---|---|
void |
importData(java.lang.String scheme,
java.lang.String dataSource,
Resource target)
Imports data from the given
source which is expected to be
an HTTP URL. |
void |
importData(java.lang.String scheme,
java.lang.String dataSource,
Resource target,
java.lang.String login,
java.lang.String password)
Imports data from the given
source which is expected to be
an HTTP URL. |
public void importData(java.lang.String scheme, java.lang.String dataSource, Resource target)
source
which is expected to be
an HTTP URL. This method uses the Apache Http Client library to
request the source with a method provided by newHttpMethod(String)
the
response stream is then provided to the
importData(String, InputStream, String, Resource)
method, which
must be implemented by the extension.importData
in interface Importer
scheme
- The scheme of the data source. This parameter is handed
over to the
importData(String, InputStream, String, Resource)
method.dataSource
- The HTTP URL to the data to be imported.target
- The Resource
into which the data is to be
imported.ImportException
- If an error occurs while accessing the source or
if this class has not been initialized or if an error occurs
while importing the actual data through
importData(String, InputStream, String, Resource)
.public void importData(java.lang.String scheme, java.lang.String dataSource, Resource target, java.lang.String login, java.lang.String password)
source
which is expected to be
an HTTP URL. This method uses the Apache Http Client library to
request the source with a method provided by newHttpMethod(String)
the
response stream is then provided to the
importData(String, InputStream, String, Resource)
method, which
must be implemented by the extension.importData
in interface Importer
scheme
- The scheme of the data source. This parameter is handed
over to the
importData(String, InputStream, String, Resource)
method.dataSource
- The HTTP URL to the data to be imported.target
- The Resource
into which the data is to be
imported.login
- The login to authenticate the request.password
- The password to authenticate the request.ImportException
- If an error occurs while accessing the source or
if this class has not been initialized or if an error occurs
while importing the actual data through
importData(String, InputStream, String, Resource)
."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"