org.ow2.petals.system.repository
Class RepositoryServiceImpl

java.lang.Object
  extended by org.ow2.petals.system.repository.RepositoryServiceImpl
All Implemented Interfaces:
RepositoryService

public class RepositoryServiceImpl
extends java.lang.Object
implements RepositoryService

Platform Component Repository service implementation.

Since:
Petals 1.0
Version:
$Rev: 27860 $ $Date: 2009-08-03 10:08:35 +0200 (lun., 03 août 2009) $
Author:
Rafael Marins, alouis - EBM Websourcing, ofabre - EBM Websourcing, ddesjardins - eBMWebsourcing

Nested Class Summary
static class RepositoryServiceImpl.EntityType
          Entity types (components, shared libs or service assemblies)
 
Field Summary
protected  org.ow2.petals.util.LoggingUtil log
          logger wrapper
 
Fields inherited from interface org.ow2.petals.system.repository.RepositoryService
DEFAULT_REPOSITORY_PATH
 
Constructor Summary
RepositoryServiceImpl()
           
 
Method Summary
 java.io.File addComponent(java.lang.String componentId, java.io.File tempFile)
          Install a component package into the local Petals repository.
 java.io.File addServiceAssembly(java.lang.String serviceAssemblyId, java.io.File tempFile)
          Copy a service assembly package into petals repository
 java.io.File addSharedLibrary(java.lang.String sharedLibraryId, java.lang.String version, java.io.File tempFile)
          Copy a shared library package into petals repository
 java.io.File explodeSUIntoSAInstallDirectory(java.lang.String serviceUnitId, java.net.URL suZipLocation, java.lang.String serviceAssemblyId)
          Explode a given service unit archive into a SU install root created into the SA install root
 java.io.File getComponentDirectory(java.lang.String componentId)
          Returns the root directory of this component
 java.io.File getComponentInstallDirectory(java.lang.String componentId)
          Returns the install directory of the component
 java.io.File getComponentsDirectory()
          Retrieve the components directory absolute path from the Petals repository.
 java.io.File getComponentWorkDirectory(java.lang.String componentId)
          Returns the work directory of the component
 java.io.File getLostPlusFoundDirectory()
          Retrieve the "lost+found" directory absolute path from the Petals repository.
 java.io.File getRepositoryDirectory()
          Return petals repository folder.
 java.io.File getServiceAssembliesDirectory()
          Retrieve the ServiceAssemblies directory absolute path from the Petals repository.
 java.io.File getServiceAssemblyDirectory(java.lang.String serviceAssemblyId)
          Returns the root directory of the service assembly
 java.io.File getServiceAssemblyInstallDirectory(java.lang.String serviceAssemblyId)
          Returns the install directory of the service assembly
 java.io.File getServiceAssemblyWorkDirectory(java.lang.String serviceAssemblyId)
          Returns the work directory of the service assembly
 java.io.File getSharedLibrariesDirectory()
          Retrieve the SharedLibraries directory absolute path from the Petals repository.
 java.io.File getSharedLibraryDirectory(java.lang.String sharedLibraryId)
          Returns the root directory of the shared library
 java.io.File getSharedLibraryInstallDirectory(java.lang.String sharedLibraryId)
          Returns the install directory of the shared library
 java.io.File getSharedLibraryWorkDirectory(java.lang.String sharedLibraryId)
          Returns the work directory of the shared library
 void removeComponent(java.lang.String componentId)
          Delete and clean all directories and related data from the Petals repository, for the given component identifier.
 void removeServiceAssembly(java.lang.String serviceAssemblyId)
          Delete and clean all directories and related data from the Petals repository, for the given sa identifier.
 void removeSharedLibrary(java.lang.String sharedLibraryId, java.lang.String version)
          Delete and clean all directories and related data from the Petals repository, for the given sl identifier.
protected  void start()
           
protected  void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.ow2.petals.util.LoggingUtil log
logger wrapper

Constructor Detail

RepositoryServiceImpl

public RepositoryServiceImpl()
Method Detail

addComponent

public java.io.File addComponent(java.lang.String componentId,
                                 java.io.File tempFile)
                          throws java.io.IOException,
                                 ComponentAlreadyExistsException
Description copied from interface: RepositoryService
Install a component package into the local Petals repository.

Specified by:
addComponent in interface RepositoryService
Parameters:
componentId - The component name (as JBI identifier, unique into the local repository. Must be non null and non empty.
tempFile - The root directory of teh exploded component archive. Must be non null.
Returns:
the component installation root File
Throws:
java.io.IOException - if it fails to create install and work dirs for the component or if it fails to copy package into install dir
ComponentAlreadyExistsException - The component already exists in the repository.

addServiceAssembly

public java.io.File addServiceAssembly(java.lang.String serviceAssemblyId,
                                       java.io.File tempFile)
                                throws java.io.IOException,
                                       ServiceAssemblyAlreadyExistsException
Description copied from interface: RepositoryService
Copy a service assembly package into petals repository

Specified by:
addServiceAssembly in interface RepositoryService
Parameters:
serviceAssemblyId - String unique sa id that identifies an unique sa directory into the petals repository. Must be non null and non empty
tempFile - File the service assembly package file to add into the repository. Must be non null
Returns:
the sa installation root File
Throws:
java.io.IOException - if it fails to create install and work dirs for the sa or if it fails to copy package into install dir
ServiceAssemblyAlreadyExistsException - The serviced assembly already exists in the repository.

addSharedLibrary

public java.io.File addSharedLibrary(java.lang.String sharedLibraryId,
                                     java.lang.String version,
                                     java.io.File tempFile)
                              throws java.io.IOException,
                                     SharedLibraryAlreadyExistsException
Description copied from interface: RepositoryService
Copy a shared library package into petals repository

Specified by:
addSharedLibrary in interface RepositoryService
Parameters:
sharedLibraryId - String unique sl id that identifies an unique sl directory into the petals repository. Must be non null and non empty
version - Version of the shared library as defined by JBI.
tempFile - File the shared lib package file to add into the repository. Must be non null
Returns:
the sl installation root File
Throws:
java.io.IOException - if it fails to create install and work dirs for the sl or if it fails to copy package into install dir
SharedLibraryAlreadyExistsException - The sl already exists in the repository.

explodeSUIntoSAInstallDirectory

public java.io.File explodeSUIntoSAInstallDirectory(java.lang.String serviceUnitId,
                                                    java.net.URL suZipLocation,
                                                    java.lang.String serviceAssemblyId)
                                             throws java.io.IOException
Description copied from interface: RepositoryService
Explode a given service unit archive into a SU install root created into the SA install root

Specified by:
explodeSUIntoSAInstallDirectory in interface RepositoryService
suZipLocation - URL the SU Zip archive file to add flatten into the repository.
Returns:
File installation root of su in the repository. Must be a valid directory.
Throws:
java.io.IOException - if SU install root can't be created or SU archive can't be unzipped

getComponentDirectory

public java.io.File getComponentDirectory(java.lang.String componentId)
                                   throws java.io.IOException
Description copied from interface: RepositoryService
Returns the root directory of this component

Specified by:
getComponentDirectory in interface RepositoryService
Parameters:
componentId - String unique component id that identifies an unique component directory into the petals repository.
Returns:
the root directory of this component, null if it doesn't exist
Throws:
java.io.IOException - if an error occurred during component root retrieval

getComponentInstallDirectory

public java.io.File getComponentInstallDirectory(java.lang.String componentId)
                                          throws java.io.IOException
Description copied from interface: RepositoryService
Returns the install directory of the component

Specified by:
getComponentInstallDirectory in interface RepositoryService
Parameters:
componentId - String unique component id that identifies an unique component directory into the petals repository.
Returns:
the install directory of the component
Throws:
java.io.IOException - if an error occurred during component root retrieval

getComponentsDirectory

public java.io.File getComponentsDirectory()
Description copied from interface: RepositoryService
Retrieve the components directory absolute path from the Petals repository. This directory contains all installed components.

Specified by:
getComponentsDirectory in interface RepositoryService
Returns:
the components directory URL from the Petals repository

getComponentWorkDirectory

public java.io.File getComponentWorkDirectory(java.lang.String componentId)
                                       throws java.io.IOException
Description copied from interface: RepositoryService
Returns the work directory of the component

Specified by:
getComponentWorkDirectory in interface RepositoryService
Parameters:
componentId - String unique component id that identifies an unique component directory into the petals repository.
Returns:
the work directory of the component
Throws:
java.io.IOException - if an error occurred during component root retrieval

getLostPlusFoundDirectory

public java.io.File getLostPlusFoundDirectory()
Description copied from interface: RepositoryService
Retrieve the "lost+found" directory absolute path from the Petals repository. This directory contains all unknown SharedLibraries, Components and ServiceAssemblies.

Specified by:
getLostPlusFoundDirectory in interface RepositoryService
Returns:
the lost+found directory

getRepositoryDirectory

public java.io.File getRepositoryDirectory()
Description copied from interface: RepositoryService
Return petals repository folder. The repository folder contains extracted component, service assembly and shared library packages. It will be created when this method is called for the first time

Specified by:
getRepositoryDirectory in interface RepositoryService
Returns:
PEtALS repository directory

getServiceAssembliesDirectory

public java.io.File getServiceAssembliesDirectory()
Description copied from interface: RepositoryService
Retrieve the ServiceAssemblies directory absolute path from the Petals repository. This directory contains all deployed ServiceAssemblies.

Specified by:
getServiceAssembliesDirectory in interface RepositoryService
Returns:
the ServiceAssemblies directory

getServiceAssemblyDirectory

public java.io.File getServiceAssemblyDirectory(java.lang.String serviceAssemblyId)
                                         throws java.io.IOException
Description copied from interface: RepositoryService
Returns the root directory of the service assembly

Specified by:
getServiceAssemblyDirectory in interface RepositoryService
Returns:
the root directory of this sa, null if it doesn't exist
Throws:
java.io.IOException - if an error occured during service assembly root retrieval

getServiceAssemblyInstallDirectory

public java.io.File getServiceAssemblyInstallDirectory(java.lang.String serviceAssemblyId)
                                                throws java.io.IOException
Description copied from interface: RepositoryService
Returns the install directory of the service assembly

Specified by:
getServiceAssemblyInstallDirectory in interface RepositoryService
Parameters:
serviceAssemblyId - String unique sa id that identifies an unique sa directory into the petals repository.
Returns:
the install directory of the sa
Throws:
java.io.IOException - if an error occured during service assembly root retrieval

getServiceAssemblyWorkDirectory

public java.io.File getServiceAssemblyWorkDirectory(java.lang.String serviceAssemblyId)
                                             throws java.io.IOException
Description copied from interface: RepositoryService
Returns the work directory of the service assembly

Specified by:
getServiceAssemblyWorkDirectory in interface RepositoryService
Returns:
the work directory of the sa
Throws:
java.io.IOException - if an error occured during service assembly root retrieval

getSharedLibrariesDirectory

public java.io.File getSharedLibrariesDirectory()
Description copied from interface: RepositoryService
Retrieve the SharedLibraries directory absolute path from the Petals repository. This directory contains all installed SharedLibraries.

Specified by:
getSharedLibrariesDirectory in interface RepositoryService
Returns:
the SharedLibs directory URL from the Petals repository

getSharedLibraryDirectory

public java.io.File getSharedLibraryDirectory(java.lang.String sharedLibraryId)
                                       throws java.io.IOException
Description copied from interface: RepositoryService
Returns the root directory of the shared library

Specified by:
getSharedLibraryDirectory in interface RepositoryService
Parameters:
sharedLibraryId - String unique sl id that identifies an unique sl directory into the petals repository.
Returns:
the root directory of this sl, null if it doesn't exist
Throws:
java.io.IOException - if an error occured during shared lib root retrieval

getSharedLibraryInstallDirectory

public java.io.File getSharedLibraryInstallDirectory(java.lang.String sharedLibraryId)
                                              throws java.io.IOException
Description copied from interface: RepositoryService
Returns the install directory of the shared library

Specified by:
getSharedLibraryInstallDirectory in interface RepositoryService
Returns:
the install directory of the sl
Throws:
java.io.IOException - if an error occured during shared lib root retrieval

getSharedLibraryWorkDirectory

public java.io.File getSharedLibraryWorkDirectory(java.lang.String sharedLibraryId)
                                           throws java.io.IOException
Description copied from interface: RepositoryService
Returns the work directory of the shared library

Specified by:
getSharedLibraryWorkDirectory in interface RepositoryService
Returns:
the work directory of the sl
Throws:
java.io.IOException - if an error occured during shared lib root retrieval

removeComponent

public void removeComponent(java.lang.String componentId)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Description copied from interface: RepositoryService
Delete and clean all directories and related data from the Petals repository, for the given component identifier.

Specified by:
removeComponent in interface RepositoryService
Parameters:
componentId - String unique component id that identifies an unique component directory into the petals repository.
Throws:
java.io.FileNotFoundException - the component does not exist in the repository.
java.io.IOException - if an error occurred during the delete of related files

removeServiceAssembly

public void removeServiceAssembly(java.lang.String serviceAssemblyId)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException
Description copied from interface: RepositoryService
Delete and clean all directories and related data from the Petals repository, for the given sa identifier.

Specified by:
removeServiceAssembly in interface RepositoryService
Parameters:
serviceAssemblyId - String unique sa id that identifies an unique sa directory into the petals repository.
Throws:
java.io.FileNotFoundException - the service assembly does not exist in the repository.
java.io.IOException - if an error occurred during the delete of related files

removeSharedLibrary

public void removeSharedLibrary(java.lang.String sharedLibraryId,
                                java.lang.String version)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Description copied from interface: RepositoryService
Delete and clean all directories and related data from the Petals repository, for the given sl identifier.

Specified by:
removeSharedLibrary in interface RepositoryService
Parameters:
sharedLibraryId - unique sl id that identifies an unique sl directory into the petals repository.
version - Version of the shared library as defined by JBI.
Throws:
java.io.FileNotFoundException - the shared library does not exist in the repository.
java.io.IOException - if an error occurred during the delete of related files

start

protected void start()
              throws java.io.IOException
Throws:
java.io.IOException

stop

protected void stop()


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.