org.objectweb.dsrg.sofa.repository
Class RepositoryFacade

java.lang.Object
  extended by org.objectweb.dsrg.sofa.repository.RepositoryFacade

public class RepositoryFacade
extends java.lang.Object

An object simplifying access to the repository.


Nested Class Summary
static class RepositoryFacade.RepositoryFacadeException
          Repository facade exception.
static class RepositoryFacade.UnsupportedSchemeException
          Unsupported scheme exception.
 class RepositoryFacade.VersionMap
          Maps element names to their current versions.
 
Method Summary
 VersionedEntity[] cloneEntities(RepositoryConfiguration developmentRC, VersionedEntity[] entities)
          Clones entity from source repository into destination repository honoring dependencies between entities.
 VersionedEntity[] cloneEntities(RepositoryConfiguration developmentRC, VersionedEntity[] entities, boolean dryRun, boolean seekDeps)
          Clones entity from source repository into destination repository.
 VersionedEntity[] cloneEntity(RepositoryConfiguration developmentRC, VersionedEntity entity)
          Clones entity from source repository into destination repository honoring dependencies between entities.
 VersionedEntity[] cloneEntity(RepositoryConfiguration developmentRC, VersionedEntity entity, boolean dryRun, boolean seekDeps)
          Clones entity from source repository into destination repository.
 Architecture createArchitecture(Architecture previous, Frame _implements)
          Creates new version of already existing architecture.
 Architecture createArchitecture(java.lang.String name, Frame _implements)
          Creates new architecture
 Aspect createAspect(Aspect prev)
          Creates new version of the already existing aspect.
 Aspect createAspect(java.lang.String name)
          Creates new aspect.
 AssemblyDescriptor createAssemblyDesc(AssemblyDescriptor previous, Architecture topLevelArch)
          Creates new version of already existing assembly descriptor.
 AssemblyDescriptor createAssemblyDesc(java.lang.String name, Architecture topLevelArch)
          Creates new assembly descriptor.
 CodeBundle createCodeBundle(java.lang.String name, VersionedEntity entity)
          Creates code bundle for the given entity.
 DeploymentPlan createDeploymentPlan(DeploymentPlan plan, AssemblyDescriptor assembly)
          Creates new version of the already existing deplplan plan for the given assembly descriptor.
 DeploymentPlan createDeploymentPlan(java.lang.String name, AssemblyDescriptor assembly)
          Creates new deplplan plan for the given assembly descriptor.
 RepositoryFacade.VersionMap createEmptyVersionMap()
          Creates an empty version map.
 Frame createFrame(Frame previous)
          Creates new version of already existing frame.
 Frame createFrame(java.lang.String name)
          Creates new frame.
 InterfaceType createInterfaceType(InterfaceType previous, java.lang.String signature)
          Creates new version of already existing interface type.
 InterfaceType createInterfaceType(java.lang.String name, java.lang.String signature)
          Creates new interface type.
 MicroComponent createMicroComponent(MicroComponent prev)
          Creates new version of the already existing micro component.
 MicroComponent createMicroComponent(java.lang.String name)
          Creates new micro component.
 MicroInterfaceType createMicroInterfaceType(MicroInterfaceType prev)
          Creates new version of the already existing micro interface type.
 MicroInterfaceType createMicroInterfaceType(java.lang.String name)
          Creates new micro interface type.
 CodeBundle createStandaloneCodeBundle(CodeBundle previous)
          Creates new version of already existing code bundle.
 CodeBundle createStandaloneCodeBundle(java.lang.String name)
          Creates standalone code bundle.
 boolean deleteEntities(VersionedEntity[] entityArray, boolean deleteDependencies)
          Deletes entities in the repository
 boolean deleteEntity(VersionedEntity entity, boolean deleteDependencies)
          Deletes an entity in the repository
 VersionedEntity[] getDeletingDependencies(VersionedEntity entity)
          Gets the dependencies to be deleted with the entity.
 VersionedEntity[] getDeletingDependencies(VersionedEntity[] entities)
          Gets the dependencies to be deleted with the entities.
 VersionedEntity getLastHeadVersion(java.lang.String name)
          Deprecated. Nothing like head version exists anymore.
 boolean isLocked()
          Returns the status of the lock on the repository.
 boolean lock()
          Locks the lock on repository.
 boolean lock(long timeout)
          Locks the lock on repository.
 boolean lock(long timeout, long spinTime)
          Locks the lock on repository.
 DeploymentPlan lookupDeploymentPlanByVersion(java.lang.String name, java.lang.String version)
          Looks up deployment plan.
 java.util.List<VersionedEntity> lookupEntityByName(java.lang.String name)
          Looks up all entities with the given name.
 VersionedEntity lookupEntityByTag(java.lang.String name, java.lang.String tag)
          Looks up entity with given name and version tag.
 VersionedEntity lookupEntityByVersion(java.lang.String name, java.lang.String version)
          Looks up entity.
 VersionedEntity lookupEntityByVersionOrTag(java.lang.String name, java.lang.String versionOrTag)
          Looks up entity.
 VersionedEntity[] mergeEntities(RepositoryConfiguration developmentRC, VersionedEntity[] entities)
          Merges entity from development repository into production repository honoring dependencies between entities.
 VersionedEntity[] mergeEntities(RepositoryConfiguration developmentRC, VersionedEntity[] entities, boolean dryRun, boolean seekDeps)
          Merges entity from development repository into production repository.
 VersionedEntity[] mergeEntity(RepositoryConfiguration developmentRC, VersionedEntity entity)
          Merges entity from development repository into production repository honoring dependencies between entities.
 VersionedEntity[] mergeEntity(RepositoryConfiguration developmentRC, VersionedEntity entity, boolean dryRun, boolean seekDeps)
          Merges entity from development repository into production repository.
 boolean unlock()
          Unlocks the lock on repository.
 Architecture updateArchitecture(java.io.File srcxmi, Architecture orig, RepositoryFacade.VersionMap vm)
          Updates the given architecture according to info obtained from the xmi file - WARNING: it can return a different instance.
 Aspect updateAspect(java.io.File srcxmi, Aspect orig, RepositoryFacade.VersionMap vm)
          Updates the given aspect according to info obtained from the xmi file - WARNING: it can return a different instance.
 AssemblyDescriptor updateAssembly(java.io.File srcxmi, AssemblyDescriptor orig, RepositoryFacade.VersionMap vm)
          Updates the given assembly descriptor according to info obtained from the xmi file - WARNING: it can return a different instance.
 Frame updateFrame(java.io.File srcxmi, Frame orig, RepositoryFacade.VersionMap vm)
          Updates the given frame according to info obtained from the xmi file - WARNING: it can return a different instance.
 InterfaceType updateInterfaceType(java.io.File srcxmi, InterfaceType orig)
          Updates the given interface type according to info obtained from the xmi file - WARNING: it can return a different instance.
 MicroComponent updateMicroComponent(java.io.File srcxmi, MicroComponent orig, RepositoryFacade.VersionMap vm)
          Updates the given micro component according to info obtained from the xmi file - WARNING: it can return a different instance.
 MicroInterfaceType updateMicroInterfaceType(java.io.File srcxmi, MicroInterfaceType orig)
          Updates the given micro interface type according to info obtained from the xmi file - WARNING: it can return a different instance.
 CodeBundle updateStandaloneCodeBundle(java.io.File srcxmi, CodeBundle orig, RepositoryFacade.VersionMap vm)
          Updates the given standalone code bundle according to info obtained from the xmi file - WARNING: it can return a different instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInterfaceType

public InterfaceType createInterfaceType(java.lang.String name,
                                         java.lang.String signature)
Creates new interface type.

Parameters:
name - name of the interface type
signature - signature
Returns:
interface type

createInterfaceType

public InterfaceType createInterfaceType(InterfaceType previous,
                                         java.lang.String signature)
Creates new version of already existing interface type.

Parameters:
previous - previous version
signature - signature
Returns:
interface type

createFrame

public Frame createFrame(java.lang.String name)
Creates new frame.

Parameters:
name - name
Returns:
frame

createFrame

public Frame createFrame(Frame previous)
Creates new version of already existing frame.

Parameters:
previous - previous version
Returns:
frame

createArchitecture

public Architecture createArchitecture(java.lang.String name,
                                       Frame _implements)
Creates new architecture

Parameters:
name - name
_implements - frame implemented by the architecture
Returns:
architecture

createArchitecture

public Architecture createArchitecture(Architecture previous,
                                       Frame _implements)
Creates new version of already existing architecture.

Parameters:
previous - previous version
_implements - frame implemented by the architecture
Returns:
architecture

createAssemblyDesc

public AssemblyDescriptor createAssemblyDesc(java.lang.String name,
                                             Architecture topLevelArch)
Creates new assembly descriptor.

Parameters:
name - name
topLevelArch - top level architecture
Returns:
assembly descriptor

createAssemblyDesc

public AssemblyDescriptor createAssemblyDesc(AssemblyDescriptor previous,
                                             Architecture topLevelArch)
Creates new version of already existing assembly descriptor.

Parameters:
previous - previous version
topLevelArch - top level architecture
Returns:
assembly descriptor

createCodeBundle

public CodeBundle createCodeBundle(java.lang.String name,
                                   VersionedEntity entity)
Creates code bundle for the given entity.

Parameters:
name - name of the code bundle
entity - entity for which code bundle has to be created
Returns:
code bundle

createStandaloneCodeBundle

public CodeBundle createStandaloneCodeBundle(java.lang.String name)
Creates standalone code bundle.

Parameters:
name - name of the code bundle
Returns:
code bundle

createStandaloneCodeBundle

public CodeBundle createStandaloneCodeBundle(CodeBundle previous)
Creates new version of already existing code bundle.

Parameters:
previous - previous version
Returns:
code bundle

createDeploymentPlan

public DeploymentPlan createDeploymentPlan(java.lang.String name,
                                           AssemblyDescriptor assembly)
Creates new deplplan plan for the given assembly descriptor.

Parameters:
name - name of the deployment plan
assembly - assembly
Returns:
deployment plan

createDeploymentPlan

public DeploymentPlan createDeploymentPlan(DeploymentPlan plan,
                                           AssemblyDescriptor assembly)
Creates new version of the already existing deplplan plan for the given assembly descriptor.

Parameters:
plan - previous version
assembly - assembly
Returns:
deployment plan

createMicroComponent

public MicroComponent createMicroComponent(java.lang.String name)
Creates new micro component.

Parameters:
name - name of the micro component
Returns:
micro component

createMicroComponent

public MicroComponent createMicroComponent(MicroComponent prev)
Creates new version of the already existing micro component.

Parameters:
prev - previous version
Returns:
micro component

createMicroInterfaceType

public MicroInterfaceType createMicroInterfaceType(java.lang.String name)
Creates new micro interface type.

Parameters:
name - name of the micro interface type
Returns:
micro interface type

createMicroInterfaceType

public MicroInterfaceType createMicroInterfaceType(MicroInterfaceType prev)
Creates new version of the already existing micro interface type.

Parameters:
prev - previous version
Returns:
micro interface type

createAspect

public Aspect createAspect(java.lang.String name)
Creates new aspect.

Parameters:
name - name of the aspect
Returns:
aspect

createAspect

public Aspect createAspect(Aspect prev)
Creates new version of the already existing aspect.

Parameters:
prev - previous version
Returns:
aspect

lookupEntityByName

public java.util.List<VersionedEntity> lookupEntityByName(java.lang.String name)
Looks up all entities with the given name. It just calls RepositoryUtil.lookupNamedEntityByName(String, RepositoryQuery).

Parameters:
name - name of an entity
Returns:
list with all entities with the given name or null

lookupEntityByTag

public VersionedEntity lookupEntityByTag(java.lang.String name,
                                         java.lang.String tag)
Looks up entity with given name and version tag. It just calls RepositoryUtil.lookupNamedEntityByTag(String, String, RepositoryQuery).

Parameters:
name - entity name
tag - version tag
Returns:
entity with appropriate name and version tag or null

lookupEntityByVersion

public VersionedEntity lookupEntityByVersion(java.lang.String name,
                                             java.lang.String version)
Looks up entity.

Parameters:
name - name of an entity
version - version identifier of an entity
Returns:
entity or null

lookupEntityByVersionOrTag

public VersionedEntity lookupEntityByVersionOrTag(java.lang.String name,
                                                  java.lang.String versionOrTag)
Looks up entity.

Parameters:
name - name of an entity
versionOrTag - version or version tag identifier of an entity
Returns:
entity or null

lookupDeploymentPlanByVersion

public DeploymentPlan lookupDeploymentPlanByVersion(java.lang.String name,
                                                    java.lang.String version)
Looks up deployment plan.

Parameters:
name - name of the deployment plan
version - version of the deployment plan
Returns:
deployment plan or null

getLastHeadVersion

public VersionedEntity getLastHeadVersion(java.lang.String name)
Deprecated. Nothing like head version exists anymore.

Returns the last head version of the given object or null if object does not exist.

Parameters:
name - name of the given object
Returns:
last head version or null

createEmptyVersionMap

public RepositoryFacade.VersionMap createEmptyVersionMap()
Creates an empty version map.

Returns:
an empty version map

updateInterfaceType

public InterfaceType updateInterfaceType(java.io.File srcxmi,
                                         InterfaceType orig)
                                  throws RepositoryFacade.RepositoryFacadeException
Updates the given interface type according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateFrame

public Frame updateFrame(java.io.File srcxmi,
                         Frame orig,
                         RepositoryFacade.VersionMap vm)
                  throws RepositoryFacade.RepositoryFacadeException
Updates the given frame according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateArchitecture

public Architecture updateArchitecture(java.io.File srcxmi,
                                       Architecture orig,
                                       RepositoryFacade.VersionMap vm)
                                throws RepositoryFacade.RepositoryFacadeException
Updates the given architecture according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateAssembly

public AssemblyDescriptor updateAssembly(java.io.File srcxmi,
                                         AssemblyDescriptor orig,
                                         RepositoryFacade.VersionMap vm)
                                  throws RepositoryFacade.RepositoryFacadeException
Updates the given assembly descriptor according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateStandaloneCodeBundle

public CodeBundle updateStandaloneCodeBundle(java.io.File srcxmi,
                                             CodeBundle orig,
                                             RepositoryFacade.VersionMap vm)
                                      throws RepositoryFacade.RepositoryFacadeException
Updates the given standalone code bundle according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateMicroInterfaceType

public MicroInterfaceType updateMicroInterfaceType(java.io.File srcxmi,
                                                   MicroInterfaceType orig)
                                            throws RepositoryFacade.RepositoryFacadeException
Updates the given micro interface type according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateMicroComponent

public MicroComponent updateMicroComponent(java.io.File srcxmi,
                                           MicroComponent orig,
                                           RepositoryFacade.VersionMap vm)
                                    throws RepositoryFacade.RepositoryFacadeException
Updates the given micro component according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

updateAspect

public Aspect updateAspect(java.io.File srcxmi,
                           Aspect orig,
                           RepositoryFacade.VersionMap vm)
                    throws RepositoryFacade.RepositoryFacadeException
Updates the given aspect according to info obtained from the xmi file - WARNING: it can return a different instance.

Parameters:
srcxmi - xmi with new info
orig - original object to be updated
vm - version map for translating entities without given version
Returns:
updated object
Throws:
RepositoryFacade.RepositoryFacadeException - if something bad happened

deleteEntity

public boolean deleteEntity(VersionedEntity entity,
                            boolean deleteDependencies)
                     throws java.io.IOException
Deletes an entity in the repository

Parameters:
entity - The entity to be deleted
deleteDependencies - Should also the dependencies of the entity be deleted?
Returns:
true if deleted otherwise false
Throws:
java.io.IOException

deleteEntities

public boolean deleteEntities(VersionedEntity[] entityArray,
                              boolean deleteDependencies)
                       throws java.io.IOException
Deletes entities in the repository

Parameters:
entityArray - The entities to be deleted
deleteDependencies - Should also the dependencies of the entities be deleted?
Returns:
true if deleted otherwise false
Throws:
java.io.IOException

getDeletingDependencies

public VersionedEntity[] getDeletingDependencies(VersionedEntity entity)
Gets the dependencies to be deleted with the entity.

Parameters:
entity - the entity that's dependencies are to be returned
Returns:
the list of the dependencies.

getDeletingDependencies

public VersionedEntity[] getDeletingDependencies(VersionedEntity[] entities)
Gets the dependencies to be deleted with the entities.

Parameters:
entities - the entities of which the dependencies are to be returned
Returns:
the list of the dependencies.

cloneEntity

public VersionedEntity[] cloneEntity(RepositoryConfiguration developmentRC,
                                     VersionedEntity entity)
                              throws RepositoryCloner.RepositoryClonerException
Clones entity from source repository into destination repository honoring dependencies between entities.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entity - VersionedEntity to be cloned.
Returns:
Entities, that were be cloned.
Throws:
RepositoryCloner.RepositoryClonerException

cloneEntity

public VersionedEntity[] cloneEntity(RepositoryConfiguration developmentRC,
                                     VersionedEntity entity,
                                     boolean dryRun,
                                     boolean seekDeps)
                              throws RepositoryCloner.RepositoryClonerException
Clones entity from source repository into destination repository.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entity - VersionedEntity to be cloned.
dryRun - Don't clone anything, only return, what should be cloned.
seekDeps - Seek dependencies hierarchically?
Returns:
Entities, that were/should be cloned.
Throws:
RepositoryCloner.RepositoryClonerException

mergeEntity

public VersionedEntity[] mergeEntity(RepositoryConfiguration developmentRC,
                                     VersionedEntity entity)
                              throws RepositoryCloner.RepositoryClonerException
Merges entity from development repository into production repository honoring dependencies between entities.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entity - VersionedEntity to be merged.
Returns:
Entities, that were be merged.
Throws:
RepositoryCloner.RepositoryClonerException

mergeEntity

public VersionedEntity[] mergeEntity(RepositoryConfiguration developmentRC,
                                     VersionedEntity entity,
                                     boolean dryRun,
                                     boolean seekDeps)
                              throws RepositoryCloner.RepositoryClonerException
Merges entity from development repository into production repository.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entity - VersionedEntity to be merged.
dryRun - Don't clone anything, only return, what should be merged.
seekDeps - Seek dependencies hierarchically?
Returns:
Entities, that were/should be merged.
Throws:
RepositoryCloner.RepositoryClonerException

cloneEntities

public VersionedEntity[] cloneEntities(RepositoryConfiguration developmentRC,
                                       VersionedEntity[] entities)
                                throws RepositoryCloner.RepositoryClonerException
Clones entity from source repository into destination repository honoring dependencies between entities.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entities - VersionedEntity to be cloned.
Returns:
Entities, that were be cloned.
Throws:
RepositoryCloner.RepositoryClonerException

cloneEntities

public VersionedEntity[] cloneEntities(RepositoryConfiguration developmentRC,
                                       VersionedEntity[] entities,
                                       boolean dryRun,
                                       boolean seekDeps)
                                throws RepositoryCloner.RepositoryClonerException
Clones entity from source repository into destination repository.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entities - VersionedEntity to be cloned.
dryRun - Don't clone anything, only return, what should be cloned.
seekDeps - Seek dependencies hierarchically?
Returns:
Entities, that were/should be cloned.
Throws:
RepositoryCloner.RepositoryClonerException

mergeEntities

public VersionedEntity[] mergeEntities(RepositoryConfiguration developmentRC,
                                       VersionedEntity[] entities)
                                throws RepositoryCloner.RepositoryClonerException
Merges entity from development repository into production repository honoring dependencies between entities.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entities - VersionedEntity to be merged.
Returns:
Entities, that were be merged.
Throws:
RepositoryCloner.RepositoryClonerException

mergeEntities

public VersionedEntity[] mergeEntities(RepositoryConfiguration developmentRC,
                                       VersionedEntity[] entities,
                                       boolean dryRun,
                                       boolean seekDeps)
                                throws RepositoryCloner.RepositoryClonerException
Merges entity from development repository into production repository.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
entities - VersionedEntity to be merged.
dryRun - Don't clone anything, only return, what should be merged.
seekDeps - Seek dependencies hierarchically?
Returns:
Entities, that were/should be merged.
Throws:
RepositoryCloner.RepositoryClonerException

isLocked

public boolean isLocked()
Returns the status of the lock on the repository.

Returns:
True if locked.
See Also:
lock(), unlock(), SofaServlet

lock

public boolean lock()
Locks the lock on repository.

Returns:
True on success.
See Also:
isLocked(), unlock(), SofaServlet

lock

public boolean lock(long timeout)
Locks the lock on repository.

Parameters:
timeout - In seconds
Returns:
True on success.
See Also:
isLocked(), unlock(), SofaServlet

lock

public boolean lock(long timeout,
                    long spinTime)
Locks the lock on repository.

Parameters:
timeout - In seconds
spinTime - Spin time in milliseconds - retry interval
Returns:
True on success.
See Also:
isLocked(), unlock(), SofaServlet

unlock

public boolean unlock()
Unlocks the lock on repository.

Returns:
True on success.
See Also:
isLocked(), lock(), SofaServlet