org.gcube.common.vremanagement.deployer.impl.resources.undeployment
Class UndeployablePackage

java.lang.Object
  extended by org.gcube.common.vremanagement.deployer.impl.resources.BasePackage
      extended by org.gcube.common.vremanagement.deployer.impl.resources.BaseTypedPackage
          extended by org.gcube.common.vremanagement.deployer.impl.resources.undeployment.UndeployablePackage
All Implemented Interfaces:
Serializable, Undeployable
Direct Known Subclasses:
UndeployableApplicationPackage, UndeployableLibraryPackage, UndeployableMainPackage, UndeployablePlatformApplication, UndeployablePluginPackage

public abstract class UndeployablePackage
extends BaseTypedPackage
implements Undeployable

Base undeployable package

Author:
Manuele Simi (ISTI-CNR)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.vremanagement.deployer.impl.resources.BaseTypedPackage
BaseTypedPackage.TYPE
 
Field Summary
 
Fields inherited from class org.gcube.common.vremanagement.deployer.impl.resources.BasePackage
dependencies, installScripts, key, logger, packageFiles, properties, rebootScripts, targetsToAdd, uninstallScripts
 
Constructor Summary
UndeployablePackage(BaseTypedPackage base)
           
 
Method Summary
 void addDependencies(Set<KeyData> dependencies)
          Adds new depencencies to the package
 void addFile2Package(File file)
          Adds a file to the list of package files.
 void addInstallScript(String installScript)
          
 void addRebootScript(String rebootScript)
          
 void addScope(org.gcube.common.core.scope.GCUBEScope scope)
          Adds a new scope to the package
 void addUninstallScript(String uninstallScript)
          
 Set<KeyData> getDependencies()
          Gets the list of dependencies of the package
 List<String> getInstallScripts()
          
 KeyData getKey()
          Gets the package unique key.
 List<File> getPackageFileList()
          Gets the list of files installed with the package
 String getProperty(String name)
          Gets a property from the package
 List<String> getRebootScripts()
          
 Set<org.gcube.common.core.scope.GCUBEScope> getScopes()
          Gets the target scopes to which the package is joined
 Set<org.gcube.common.core.scope.GCUBEScope> getScopesToAdd()
          Gets the target scopes to add to the package at the next restart
 File getSerializationFile()
          
 org.gcube.common.core.resources.common.PlatformDescription getTargetPlatform()
          Gets the target platform of this package
 BaseTypedPackage.TYPE getType()
          
 List<String> getUninstallScripts()
          
protected abstract  void packageUndeploy(Set<org.gcube.common.core.scope.GCUBEScope> scopes, boolean cleanState)
          Performs package-specific undeployment actions
 void postUndeploy()
          Performs the following post-undeployment operations execute the uninstall scripts from the unistall remove all the reboot scripts from the reboot
 void preUndeploy()
          Performs the pre-undeployment operations
 void printFiles()
          
 void removeFileFromPackage(File file)
          Removes a file from the list of package files
 void removeScope(org.gcube.common.core.scope.GCUBEScope scope)
          Removes a scope from the package
 void removeScopes(Set<org.gcube.common.core.scope.GCUBEScope> scopes)
          Removes the given scopes from the package
 boolean requireRestart()
          States if after the undeployment, it is required to restart the container
 void setProperty(String name, String value)
          Adds a property to the packge
 void setScopes(Set<org.gcube.common.core.scope.GCUBEScope> scopes)
          Sets the target scopes to which the package is joined
 void setScopesToAdd(Set<org.gcube.common.core.scope.GCUBEScope> scopesToAdd)
          Sets the target scopes to add to the package at the next restart
 void setTargetPlatform(org.gcube.common.core.resources.common.PlatformDescription description)
          Sets the target platform of this package
 void setType(BaseTypedPackage.TYPE type)
          
 void undeploy(Set<org.gcube.common.core.scope.GCUBEScope> scopes, boolean cleanState)
          Undeploys the package from the scopes
 boolean verify()
          Verifies if the package has been correctly undeployed
 
Methods inherited from class org.gcube.common.vremanagement.deployer.impl.resources.BasePackage
getTargetsToAdd, notifiyTargetsAdded, setTargetsToAdd, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndeployablePackage

public UndeployablePackage(BaseTypedPackage base)
Method Detail

postUndeploy

public void postUndeploy()
                  throws InvalidPackageArchiveException,
                         DeployException
Performs the following post-undeployment operations

Specified by:
postUndeploy in interface Undeployable
Throws:
DeployException
InvalidPackageArchiveException

preUndeploy

public void preUndeploy()
                 throws InvalidPackageArchiveException,
                        DeployException
Performs the pre-undeployment operations

Specified by:
preUndeploy in interface Undeployable
Throws:
DeployException
InvalidPackageArchiveException

undeploy

public void undeploy(Set<org.gcube.common.core.scope.GCUBEScope> scopes,
                     boolean cleanState)
              throws DeployException,
                     InvalidPackageArchiveException
Undeploys the package from the scopes

Specified by:
undeploy in interface Undeployable
Parameters:
scopes - scopes from which the package has to be undeployed
cleanState - states if the package's state must be also removed after undeployment
Throws:
DeployException
InvalidPackageArchiveException

packageUndeploy

protected abstract void packageUndeploy(Set<org.gcube.common.core.scope.GCUBEScope> scopes,
                                        boolean cleanState)
                                 throws DeployException,
                                        InvalidPackageArchiveException
Performs package-specific undeployment actions

Parameters:
scopes - scopes from which the package has to be undeployed
cleanState - states if the package's state must be also removed after undeployment
Throws:
DeployException
InvalidPackageArchiveException

addDependencies

public void addDependencies(Set<KeyData> dependencies)
Adds new depencencies to the package

Overrides:
addDependencies in class BasePackage
Parameters:
dependencies - the dependencies to add

addFile2Package

public void addFile2Package(File file)
Adds a file to the list of package files. The file will be removed when the package is undeployed,

Overrides:
addFile2Package in class BasePackage
Parameters:
file - the new file belonging the package

addInstallScript

public void addInstallScript(String installScript)

Overrides:
addInstallScript in class BasePackage

addRebootScript

public void addRebootScript(String rebootScript)

Overrides:
addRebootScript in class BasePackage

addUninstallScript

public void addUninstallScript(String uninstallScript)

Overrides:
addUninstallScript in class BasePackage

getDependencies

public Set<KeyData> getDependencies()
Gets the list of dependencies of the package

Overrides:
getDependencies in class BasePackage
Returns:
the dependencies

getInstallScripts

public List<String> getInstallScripts()

Overrides:
getInstallScripts in class BasePackage
Returns:
the installScripts

getKey

public KeyData getKey()
Gets the package unique key. The package key holds the quintuple: serviceclass, servicename, serviceversion, packagename, packageversion

Overrides:
getKey in class BasePackage
Returns:
the package key

getPackageFileList

public List<File> getPackageFileList()
Gets the list of files installed with the package

Overrides:
getPackageFileList in class BasePackage
Returns:
the list of files installed with the package

getRebootScripts

public List<String> getRebootScripts()

Overrides:
getRebootScripts in class BasePackage
Returns:
the rebootScripts

getScopes

public Set<org.gcube.common.core.scope.GCUBEScope> getScopes()
Gets the target scopes to which the package is joined

Overrides:
getScopes in class BasePackage
Returns:
the targets scopes to which the package is joined

getScopesToAdd

public Set<org.gcube.common.core.scope.GCUBEScope> getScopesToAdd()
Gets the target scopes to add to the package at the next restart

Overrides:
getScopesToAdd in class BasePackage
Returns:
the scopes to add

getSerializationFile

public File getSerializationFile()

Overrides:
getSerializationFile in class BasePackage

getType

public BaseTypedPackage.TYPE getType()

Overrides:
getType in class BaseTypedPackage
Returns:
the type

getUninstallScripts

public List<String> getUninstallScripts()

Overrides:
getUninstallScripts in class BasePackage
Returns:
the uninstallScripts

printFiles

public void printFiles()

Overrides:
printFiles in class BasePackage

removeFileFromPackage

public void removeFileFromPackage(File file)
Removes a file from the list of package files

Overrides:
removeFileFromPackage in class BasePackage
Parameters:
file - the file to remove

removeScopes

public void removeScopes(Set<org.gcube.common.core.scope.GCUBEScope> scopes)
Removes the given scopes from the package

Overrides:
removeScopes in class BasePackage
Parameters:
scopes - the scopes to remove

setScopes

public void setScopes(Set<org.gcube.common.core.scope.GCUBEScope> scopes)
Sets the target scopes to which the package is joined

Overrides:
setScopes in class BasePackage
Parameters:
scopes - the targets to set

setScopesToAdd

public void setScopesToAdd(Set<org.gcube.common.core.scope.GCUBEScope> scopesToAdd)
Sets the target scopes to add to the package at the next restart

Overrides:
setScopesToAdd in class BasePackage
Parameters:
scopesToAdd - the scopesToAdd to set

addScope

public void addScope(org.gcube.common.core.scope.GCUBEScope scope)
Adds a new scope to the package

Overrides:
addScope in class BasePackage
Parameters:
scope - the new scope

removeScope

public void removeScope(org.gcube.common.core.scope.GCUBEScope scope)
Removes a scope from the package

Overrides:
removeScope in class BasePackage
Parameters:
scope - the scope to remove

setType

public void setType(BaseTypedPackage.TYPE type)

Overrides:
setType in class BaseTypedPackage
Parameters:
type - the type to set

setProperty

public void setProperty(String name,
                        String value)
Adds a property to the packge

Overrides:
setProperty in class BasePackage
Parameters:
name - the property to set
value - the value of the property

getProperty

public String getProperty(String name)
Gets a property from the package

Overrides:
getProperty in class BasePackage
Returns:
the value of the property

verify

public boolean verify()
               throws InvalidPackageArchiveException
Description copied from interface: Undeployable
Verifies if the package has been correctly undeployed

Specified by:
verify in interface Undeployable
Returns:
true if the packages has been correctly undeployed, false otherwise
Throws:
InvalidPackageArchiveException - if the package cannot be verified

requireRestart

public boolean requireRestart()
Description copied from interface: Undeployable
States if after the undeployment, it is required to restart the container

Specified by:
requireRestart in interface Undeployable
Returns:
true if the container needs to be restarted, false otherwise

getTargetPlatform

public org.gcube.common.core.resources.common.PlatformDescription getTargetPlatform()
Description copied from class: BasePackage
Gets the target platform of this package

Overrides:
getTargetPlatform in class BasePackage
Returns:
the platform on which the package is supposed to run

setTargetPlatform

public void setTargetPlatform(org.gcube.common.core.resources.common.PlatformDescription description)
Description copied from class: BasePackage
Sets the target platform of this package

Overrides:
setTargetPlatform in class BasePackage
Parameters:
description - the description of the target platform


Copyright © 2012. All Rights Reserved.