org.rhq.enterprise.server.plugin.pc.content
Class ContentServerPluginContainer

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer
      extended by org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer

public class ContentServerPluginContainer
extends AbstractTypeServerPluginContainer

The container responsible for managing the lifecycle of content server-side plugins.

Author:
John Mazzitelli

Constructor Summary
ContentServerPluginContainer(MasterServerPluginContainer master)
           
 
Method Summary
 void cancelRepoSync(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.Repo repo)
           
protected  ContentProviderManager createAdapterManager()
          Creates the adapter manager that the PC will use.
protected  ServerPluginManager createPluginManager()
          This will be called when its time for this plugin container to create its plugin manager.
 ContentProviderManager getAdapterManager()
          Returns the object that is responsible for managing all adapters which are the things that know how to download content from a specific ContentSource.
 ServerPluginType getSupportedServerPluginType()
          Each plugin container will tell the master which plugins it can support via this method; this method returns the type of plugin that the plugin container can process.
 void initialize()
          The initialize method that prepares the plugin container.
 void scheduleAllPluginJobs()
          If a plugin has scheduled jobs, this method will schedule them now.
 void scheduleProviderSyncJob(org.rhq.core.domain.content.ContentSource contentSource)
          This will schedule the sync job for the given content source.
 void scheduleRepoSyncJob(org.rhq.core.domain.content.Repo repo)
          This will schedule the sync job for the given repository.
 void scheduleSyncJobs()
          It will schedule one job per adapter such that each adapter is scheduled to be synchronized as per its defined sync schedule.
 void shutdown()
          The shutdown method that will stop and unload all plugins.
 void start()
          This method informs the plugin container that all of its plugins have been loaded.
 void syncProviderNow(org.rhq.core.domain.content.ContentSource contentSource)
          This will syncronize the given content source, meaning its PackageVersions will be updated and, if not lazy-loading, will load the package versions that are not loaded yet.
 void syncRepoNow(org.rhq.core.domain.content.Repo repo)
          Causes the given repo to be scheduled for an immediate sync.
 void unscheduleProviderSyncJob(org.rhq.core.domain.content.ContentSource contentSource)
          This will unschedule the sync job for the given content source.
 void unscheduleRepoSyncJob(org.rhq.core.domain.content.Repo repo)
          This will unschedule the sync job for the given Repo.
 
Methods inherited from class org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer
getLog, getMasterServerPluginContainer, getPluginLoadTime, getPluginManager, invokePluginControl, isPluginEnabled, isPluginLoaded, loadPlugin, reloadPlugin, scheduleJob, schedulePluginJobs, stop, unloadPlugin, unschedulePluginJobs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentServerPluginContainer

public ContentServerPluginContainer(MasterServerPluginContainer master)
Method Detail

initialize

public void initialize()
                throws Exception
Description copied from class: AbstractTypeServerPluginContainer
The initialize method that prepares the plugin container. This should get the plugin container ready to accept plugins. Subclasses are free to perform additional tasks by overriding this method.

Overrides:
initialize in class AbstractTypeServerPluginContainer
Throws:
Exception - if the plugin container failed to initialize for some reason

start

public void start()
Description copied from class: AbstractTypeServerPluginContainer
This method informs the plugin container that all of its plugins have been loaded. Once this is called, the plugin container can assume all plugins that it will ever know about have been AbstractTypeServerPluginContainer.loadPlugin(ServerPluginEnvironment, boolean) loaded}.

Overrides:
start in class AbstractTypeServerPluginContainer

shutdown

public void shutdown()
Description copied from class: AbstractTypeServerPluginContainer
The shutdown method that will stop and unload all plugins. Subclasses are free to perform additional tasks by overriding this method.

Overrides:
shutdown in class AbstractTypeServerPluginContainer

scheduleAllPluginJobs

public void scheduleAllPluginJobs()
                           throws Exception
Description copied from class: AbstractTypeServerPluginContainer
If a plugin has scheduled jobs, this method will schedule them now. This particular method implementation schedules the global jobs as defined in the plugin descriptors. Subclasses are free to extend this method to schedule additional plugin jobs, but must ensure they call this method so the global scheduled jobs get added to the scheduler. Note that this is separate from the AbstractTypeServerPluginContainer.start() method because it is possible that the plugin container has been started before the scheduler has. In this case, the caller must wait for the scheduler to be started before this method is called to schedule jobs.

Overrides:
scheduleAllPluginJobs in class AbstractTypeServerPluginContainer
Throws:
Exception - if failed to schedule jobs

getSupportedServerPluginType

public ServerPluginType getSupportedServerPluginType()
Description copied from class: AbstractTypeServerPluginContainer
Each plugin container will tell the master which plugins it can support via this method; this method returns the type of plugin that the plugin container can process. Only one plugin container can support a plugin type.

Specified by:
getSupportedServerPluginType in class AbstractTypeServerPluginContainer
Returns:
the type of plugin that this plugin container instance can support

getAdapterManager

public ContentProviderManager getAdapterManager()
Returns the object that is responsible for managing all adapters which are the things that know how to download content from a specific ContentSource.

Returns:
adapter manager

syncProviderNow

public void syncProviderNow(org.rhq.core.domain.content.ContentSource contentSource)
                     throws org.quartz.SchedulerException
This will syncronize the given content source, meaning its PackageVersions will be updated and, if not lazy-loading, will load the package versions that are not loaded yet.

Note that this will perform the sync asynchronously in a separate thread. This is because this sync operation can potentially run for hours and we do not want to block the calling thread.

Parameters:
contentSource - the content source to sync
Throws:
org.quartz.SchedulerException - if failed to schedule the job for immediate execution

syncRepoNow

public void syncRepoNow(org.rhq.core.domain.content.Repo repo)
                 throws org.quartz.SchedulerException
Causes the given repo to be scheduled for an immediate sync. The sync will take place through the scheduler, causing this call to be asynchronous and return before the sync itself takes place.

Parameters:
repo - cannot be null
Throws:
org.quartz.SchedulerException - if the job cannot be scheduled

cancelRepoSync

public void cancelRepoSync(org.rhq.core.domain.auth.Subject subject,
                           org.rhq.core.domain.content.Repo repo)
                    throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

scheduleProviderSyncJob

public void scheduleProviderSyncJob(org.rhq.core.domain.content.ContentSource contentSource)
                             throws org.quartz.SchedulerException
This will schedule the sync job for the given content source. Once the scheduling is complete, the content source's adapter will be asked to synchronize with the remote content source according to the time(s) specified in the schedule.

If the content source's sync schedule is empty, this method assumes it should not be automatically sync'ed, so no schedule will be created, and this method simply returns.

Parameters:
contentSource - provider to sync
Throws:
org.quartz.SchedulerException - if failed to schedule the job

scheduleRepoSyncJob

public void scheduleRepoSyncJob(org.rhq.core.domain.content.Repo repo)
                         throws org.quartz.SchedulerException
This will schedule the sync job for the given repository. Once the scheduling is complete, the repository's adapter will be asked to synchronize with the remote repository according to the time(s) specified in the schedule.

If the repository's sync schedule is empty, this method assumes it should not be automatically sync'ed, so no schedule will be created, and this method simply returns.

Parameters:
repo - repository to sync
Throws:
org.quartz.SchedulerException - if failed to schedule the job

scheduleSyncJobs

public void scheduleSyncJobs()
It will schedule one job per adapter such that each adapter is scheduled to be synchronized as per its defined sync schedule. This must only be called when all content source adapters have been initialized.


unscheduleProviderSyncJob

public void unscheduleProviderSyncJob(org.rhq.core.domain.content.ContentSource contentSource)
                               throws org.quartz.SchedulerException
This will unschedule the sync job for the given content source. Once unscheduled, the content source's adapter will not be asked to synchronize with the remote content source.

Parameters:
contentSource - cannot be null
Throws:
org.quartz.SchedulerException - if failed to unschedule the job

unscheduleRepoSyncJob

public void unscheduleRepoSyncJob(org.rhq.core.domain.content.Repo repo)
                           throws org.quartz.SchedulerException
This will unschedule the sync job for the given Repo.

Parameters:
repo - cannot be null
Throws:
org.quartz.SchedulerException - if failed to unschedule the job

createPluginManager

protected ServerPluginManager createPluginManager()
Description copied from class: AbstractTypeServerPluginContainer
This will be called when its time for this plugin container to create its plugin manager. Subclasses are free to override this if they need their own specialized plugin manager.

Overrides:
createPluginManager in class AbstractTypeServerPluginContainer
Returns:
the plugin manager for use by this plugin container

createAdapterManager

protected ContentProviderManager createAdapterManager()
Creates the adapter manager that the PC will use.

This is protected scope so subclasses can define their own adapter manager to use. This is mainly to support tests.

Returns:
the new adapter manager


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.