org.gcube.common.vremanagement.deployer.impl.operators.deployment
Class Downloader

java.lang.Object
  extended by org.gcube.common.vremanagement.deployer.impl.operators.deployment.Downloader

public class Downloader
extends Object

Download manager for gCube Packages

Author:
Manuele Simi (CNR)

Nested Class Summary
static class Downloader.PackageType
           
static class Downloader.UnreachablePackageException
          Unreachable package exception
 
Field Summary
 File downloadedFile
          File name of the package downloaded from the Repository service
protected  org.gcube.common.core.utils.logging.GCUBELog logger
          local logger
protected  String packagedir
          The folder where the package tarball is uncompressed
 String packagename
          Name of the package to download
protected  Downloader.PackageType packagetype
           
protected  String packageVersion
          Version of the package to download
protected static String REPOSITORY_CLASS
          Target service class.
protected static String REPOSITORY_ENDPOINT
          Target port-type name.
protected static String REPOSITORY_NAME
          Target service name.
protected  AntRunner run
          Local Ant runner
protected  String serviceClass
          Service class of the package's service
protected  String serviceID
          Service ID of the package's service
protected  String serviceKey
          Service key of the package's service
protected  String serviceName
          Service name of the package's service
protected  String serviceVersion
          Service version of the package's service
protected  boolean update
           
 
Constructor Summary
Downloader(org.gcube.common.vremanagement.deployer.stubs.common.PackageInfo deployable_package, boolean... update)
           
 
Method Summary
 String downloadPackage(File file)
          Downloads the package from a local path
 String downloadPackage(org.gcube.common.core.scope.GCUBEScope... scope)
          Downloads the package tarball.
 String downloadPackage(URI uri)
          Downloads the package
 String downloadPatch(URI uri)
          Downloads the patch
protected  Set<org.apache.axis.message.addressing.EndpointReferenceType> findInstances(org.gcube.common.core.scope.GCUBEScope scopeToCheckIn)
          Finds instances of the Software Repository service in the current scope(s)
 String getPackagedir()
           
 String getPackageFilesDir()
           
 String getPackagename()
           
 Downloader.PackageType getPackagetype()
           
 String getServiceKey()
           
protected  String internalHTTPdownload(String baseDir, URI uri)
           
 boolean isUpdate()
           
protected  void removeFiles()
          Removes the package files
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

run

protected AntRunner run
Local Ant runner


logger

protected final org.gcube.common.core.utils.logging.GCUBELog logger
local logger


packagename

public String packagename
Name of the package to download


packageVersion

protected String packageVersion
Version of the package to download


downloadedFile

public File downloadedFile
File name of the package downloaded from the Repository service


serviceID

protected String serviceID
Service ID of the package's service


serviceName

protected String serviceName
Service name of the package's service


serviceKey

protected String serviceKey
Service key of the package's service


REPOSITORY_ENDPOINT

protected static final String REPOSITORY_ENDPOINT
Target port-type name.

See Also:
Constant Field Values

REPOSITORY_NAME

protected static final String REPOSITORY_NAME
Target service name.

See Also:
Constant Field Values

REPOSITORY_CLASS

protected static final String REPOSITORY_CLASS
Target service class.

See Also:
Constant Field Values

serviceClass

protected String serviceClass
Service class of the package's service


serviceVersion

protected String serviceVersion
Service version of the package's service


packagedir

protected String packagedir
The folder where the package tarball is uncompressed


update

protected boolean update

packagetype

protected Downloader.PackageType packagetype
Constructor Detail

Downloader

public Downloader(org.gcube.common.vremanagement.deployer.stubs.common.PackageInfo deployable_package,
                  boolean... update)
           throws DeployException,
                  Exception
Parameters:
serviceID - the service ID of the package
packageName - the name of the package
update - it states if the package is going to be updated or not
Throws:
DeployException
Exception
Method Detail

downloadPackage

public String downloadPackage(org.gcube.common.core.scope.GCUBEScope... scope)
                       throws Downloader.UnreachablePackageException,
                              Exception
Downloads the package tarball. It tries to download following this priority list:

Parameters:
scope - the scope where to look for the package
Returns:
the full path of the downloaded file
Throws:
VOException - if an error occurs in the download operation
Downloader.UnreachablePackageException
Exception

downloadPackage

public String downloadPackage(File file)
                       throws DeployException,
                              IOException,
                              InvalidPackageArchiveException
Downloads the package from a local path

Parameters:
file - the tarball on the local file system
Returns:
the full path of the downloaded file
Throws:
InvalidPackageArchiveException
IOException
DeployException

downloadPatch

public String downloadPatch(URI uri)
                     throws Downloader.UnreachablePackageException,
                            DeployException,
                            InvalidPackageArchiveException
Downloads the patch

Parameters:
uri - the uri from which the patch has to be downloaded
Returns:
the full path of the downloaded file
Throws:
Downloader.UnreachablePackageException - it the download fails
InvalidPackageArchiveException
DeployException

downloadPackage

public String downloadPackage(URI uri)
                       throws Downloader.UnreachablePackageException,
                              DeployException,
                              InvalidPackageArchiveException
Downloads the package

Parameters:
uri - the uri from which the package has to be downloaded
Returns:
the full path of the downloaded file
Throws:
Downloader.UnreachablePackageException - it the download fails
InvalidPackageArchiveException
DeployException

internalHTTPdownload

protected String internalHTTPdownload(String baseDir,
                                      URI uri)
                               throws Downloader.UnreachablePackageException,
                                      DeployException,
                                      InvalidPackageArchiveException
Throws:
Downloader.UnreachablePackageException
DeployException
InvalidPackageArchiveException

removeFiles

protected void removeFiles()
                    throws DeployException
Removes the package files

Throws:
DeployException - if the delete operation fails

findInstances

protected Set<org.apache.axis.message.addressing.EndpointReferenceType> findInstances(org.gcube.common.core.scope.GCUBEScope scopeToCheckIn)
Finds instances of the Software Repository service in the current scope(s)

Returns:
the list of scopes and the EPR of the available SR
Throws:
Exception

getPackagename

public String getPackagename()

getPackagedir

public String getPackagedir()

getPackageFilesDir

public String getPackageFilesDir()

getServiceKey

public String getServiceKey()

getPackagetype

public Downloader.PackageType getPackagetype()
Returns:
the packagetype

isUpdate

public boolean isUpdate()
Returns:
true if the operation is an update, false if it is a new deployment


Copyright © 2013. All Rights Reserved.