public class ContentProviderManager extends Object
ContentProvider implementations. These
implementations come from the content plugins themselves.| Constructor and Description |
|---|
ContentProviderManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createInitialAdaptersMap()
This is protected so only the plugin container and subclasses can use it.
|
Set<org.rhq.core.domain.content.ContentSource> |
getAllContentSources()
Returns a set of all content sources whose adapters are managed by this
object.
|
ContentProvider |
getIsolatedContentProvider(int contentProviderId)
Given a ID to a content source, this returns the adapter that is
responsible for communicating with that content source where that adapter
object will ensure invocations on it are isolated to its plugin
classloader.
|
protected ContentProvider |
getIsolatedContentSourceAdapter(org.rhq.core.domain.content.ContentSource contentSource)
This returns the adapter that is responsible for communicating with the
given content source where that adaptor object will ensure invocations on
it are isolated to its plugin classloader.
|
protected void |
initialize(ContentServerPluginManager pluginManager)
Tells this manager to initialize itself which will initialize all the
adapters.
|
protected ContentProvider |
instantiateAdapter(org.rhq.core.domain.content.ContentSource contentSource)
Creates a provider instance that will service the give
ContentSource. |
InputStream |
loadDistributionFileBits(int contentSourceId,
String location)
Asks that the adapter responsible for the given content source return a
stream to the DistributionFile bits for the DistributionFile at the given
location.
|
InputStream |
loadPackageBits(int contentSourceId,
String location)
Asks that the adapter responsible for the given content source return a
stream to the package bits for the package at the given location.
|
void |
restartAdapter(org.rhq.core.domain.content.ContentSource contentSource)
Convienence method that simply
shuts down the adapter and then restarts it. |
protected void |
shutdown()
Tells this manager to shutdown.
|
void |
shutdownAdapter(org.rhq.core.domain.content.ContentSource contentSource)
Call this method when a content source is removed from the system during
runtime or if you just want to shutdown the adapter for whatever reason.
|
void |
startAdapter(org.rhq.core.domain.content.ContentSource contentSource)
Call this method when a new content source is added to the system during
runtime.
|
boolean |
synchronizeContentProvider(int contentSourceId)
Asks the provider responsible for the given content source to synchronize
with its remote repository.
|
boolean |
synchronizeRepo(int repoId)
Asks each content source associated with the given repo to synchronize
the following information for the given repo:
Package Metadata
Package Bits
Distribution Tree Metadata
Distribution Tree Bits
|
void |
testConnection(int contentSourceId)
Tests the connection to the content source that has the given ID.
|
public InputStream loadPackageBits(int contentSourceId, String location) throws Exception
contentSourceId - the adapter for this content source will be used to stream the
bitslocation - where the adapter can find the package bits on the content
sourceException - if the adapter failed to load the bitspublic InputStream loadDistributionFileBits(int contentSourceId, String location) throws Exception
contentSourceId - the adapter for this content source will be used to stream the
bitslocation - where the adapter can find the DistributionFile bits on the
sourceException - if the adapter failed to load the bitspublic boolean synchronizeContentProvider(int contentSourceId)
throws Exception
false (in effect, will
let the currently running synchronization continue; we try not to step on
it). If this method does actually do a sync, true will be
returned.contentSourceId - identifies the database entry of the providertrue if the synchronization completed;
false if there was already a synchronization
happening and this method abortedExceptionpublic boolean synchronizeRepo(int repoId)
repoId - must indicate a valid repo in the databasetrue if the synchronize took place;
false if it did not (for instance, if there is
already a sync taking place for this repo)Exception - if the data required to perform the sync is missing or
invalidpublic void testConnection(int contentSourceId)
throws Exception
contentSourceId - the id of the content source to be testedException - if the test connection to the specified content source failedpublic Set<org.rhq.core.domain.content.ContentSource> getAllContentSources()
public void startAdapter(org.rhq.core.domain.content.ContentSource contentSource)
throws InitializationException
shutdown.
If there is already an adapter currently started for the given content source, this returns silently.
contentSource - the new content source that was addedInitializationException - if the provider throws an error on its startuppublic void shutdownAdapter(org.rhq.core.domain.content.ContentSource contentSource)
startAdapter(ContentSource).
If there are no adapters currently started for the given content source, this returns silently.
contentSource - the content source being deletedpublic void restartAdapter(org.rhq.core.domain.content.ContentSource contentSource)
throws Exception
shuts down the adapter and then restarts it. Call this when, for example, a content source's
configuration has changed.contentSource - the content source whose adapter is to be restartedException - if there is an error asking the provider to shutdown or startpublic ContentProvider getIsolatedContentProvider(int contentProviderId) throws RuntimeException
contentProviderId - an ID to a ContentSourceRuntimeException - if there is no content source with the given IDprotected void initialize(ContentServerPluginManager pluginManager)
This is protected so only the plugin container and subclasses can use it.
pluginManager - the plugin manager this object can use to obtain information
from (like classloaders)protected void shutdown()
This is protected so only the plugin container and subclasses can use it.
protected void createInitialAdaptersMap()
protected ContentProvider getIsolatedContentSourceAdapter(org.rhq.core.domain.content.ContentSource contentSource) throws RuntimeException
contentSource - the returned adapter communicates with this content sourceRuntimeException - if there is no content source adapter availableprotected ContentProvider instantiateAdapter(org.rhq.core.domain.content.ContentSource contentSource)
ContentSource.contentSource - the source that the adapter will connect tonull if failed to
create adapterCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.