org.gcube.common.vremanagement.deployer.impl.operators.common
Class RebootScheduler

java.lang.Object
  extended by org.gcube.common.vremanagement.deployer.impl.operators.common.BaseScheduler
      extended by org.gcube.common.vremanagement.deployer.impl.operators.common.RebootScheduler
All Implemented Interfaces:
Scheduler

public class RebootScheduler
extends BaseScheduler

Scheduler to execute the packages' reboot scripts.
These script are meant to prepare the environment for the package that brings each of them. Therefore, they must be executed from an external process, immediately before the gContainer process is going to start. The scheduler serializes the list of packages on this file: ServiceContext.getContext().getFile("reboot_scripts") It is expected that the gcore-start-container-* scripts take care of this list by executing them before to start the gContainer itself.

Author:
Manuele Simi (ISTI-CNR)
See Also:
Scheduler

Field Summary
 
Fields inherited from class org.gcube.common.vremanagement.deployer.impl.operators.common.BaseScheduler
logger, scripts
 
Constructor Summary
RebootScheduler()
           
 
Method Summary
 void add(BasePackage target)
          Adds the scripts belonging to the given package to the scheduler.
static Scheduler getScheduler()
          Creates and returns a valid scheduler
protected  List<String> getScriptsToSchedule(BasePackage target)
          Extracts the scripts to schedule from the given package
 void remove(BasePackage target)
          Removes all the scripts of the given package from the scheduler
 void run(KeyData key)
          Executes all the scripts stored in the Scheduler for the given package
 
Methods inherited from class org.gcube.common.vremanagement.deployer.impl.operators.common.BaseScheduler
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RebootScheduler

public RebootScheduler()
Method Detail

getScheduler

public static Scheduler getScheduler()
                              throws DeployException
Creates and returns a valid scheduler

Returns:
a reboot scheduler instance
Throws:
DeployException - if the scheduler initialization fails

add

public void add(BasePackage target)
         throws DeployException
Adds the scripts belonging to the given package to the scheduler.

Specified by:
add in interface Scheduler
Overrides:
add in class BaseScheduler
Parameters:
target - the package
Throws:
DeployException - if the methods fails when adding the script

remove

public void remove(BasePackage target)
            throws DeployException
Removes all the scripts of the given package from the scheduler

Specified by:
remove in interface Scheduler
Overrides:
remove in class BaseScheduler
Parameters:
target - the package
Throws:
DeployException - if the methods fails when removing all the scripts

run

public void run(KeyData key)
         throws DeployException
Executes all the scripts stored in the Scheduler for the given package

Specified by:
run in interface Scheduler
Overrides:
run in class BaseScheduler
Parameters:
key - the package key
Throws:
DeployException - if one of the scripts fails

getScriptsToSchedule

protected List<String> getScriptsToSchedule(BasePackage target)
Extracts the scripts to schedule from the given package

Specified by:
getScriptsToSchedule in class BaseScheduler
Parameters:
target - the package
Returns:
the scripts to schedule


Copyright © 2012. All Rights Reserved.