org.gcube.resourcemanagement.support.server.managers.services
Class SWRepositoryUpgrader

java.lang.Object
  extended by org.gcube.resourcemanagement.support.server.managers.services.SWRepositoryUpgrader
All Implemented Interfaces:
Serializable

public class SWRepositoryUpgrader
extends Object
implements Serializable

Responsible to interact with the repository manager to require an update of the infrastructure.

To facilitate the monitoring of main steps involved the UpgradeListener class has been introduced.

Notice that one single update per time can be required. If a pending update is running the next request will be blocked and an exception will be raised.

Three files will be created at update request (the folder in which they will be created depends on the parameter reportsDir).

Usage:
 // [optional]
 // to ensure at least a repository manager is registered in the scope
 new SWRepositoryManager().getSoftwareRepository(scope);
 ServerConsole.info(LOG_PREFIX, "Software repository [FOUND]");

 new SWRepositoryUpgrader(
  // The URL containing the list of packages to update
  "http://acme.org/builds/build.txt",
  // The directory to store report files
  "temp",
  // The scope
  "/gcube/devsec")
  // requires the upgrade
  .doUpgrade();
 

Author:
Daniele Strollo (ISTI-CNR)
See Also:
Serialized Form

Constructor Summary
SWRepositoryUpgrader(String todeployTxtURL, String reportsDir, String scope)
          Builds a new instance of repository update manager.
 
Method Summary
 void addListener(UpgradeListener listener)
           
 void doUpgrade()
          Upgrades a software repository.
 double getProgressStatus()
          Gives the completed upgrade percentage (0...1).
 String getScope()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWRepositoryUpgrader

public SWRepositoryUpgrader(String todeployTxtURL,
                            String reportsDir,
                            String scope)
                     throws Exception
Builds a new instance of repository update manager.

Parameters:
todeployTxtURL - the URL to use to retrieve the list of software to update
reportsDir - where the reports must be stored
Throws:
Exception
Method Detail

getScope

public final String getScope()

doUpgrade

public final void doUpgrade()
                     throws Exception
Upgrades a software repository.

Parameters:
softwareRepositoryURL - the url to contact the service repository
todeployTxtURL - the txt file containing software descriptions
reportFileName - the filename where report must be stored
distributionFileName - the filename where distribution must be stored
scope -
Throws:
Exception

getProgressStatus

public final double getProgressStatus()
Gives the completed upgrade percentage (0...1).

Returns:

addListener

public final void addListener(UpgradeListener listener)


Copyright © 2012. All Rights Reserved.