SWRepositoryUpgrader (Resource Management Portlet Common IS Operations Support Library 1.0.0-SNAPSHOT API)
Date: 2012-12-28

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      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).

- swupdt-rept-<timestamp>.txt containing the final report of the sw repository update procedure
- swupdt-dist-<timestamp>.txt that stores the list of packages to update
- swreport.lock represents the lock file and has a double purpose
  i) avoids multiple requests of update
  ii) contains information about the progress status.

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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.