org.objectweb.dsrg.sofa.repository
Class DeleteDependencyCalculator

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

public class DeleteDependencyCalculator
extends java.lang.Object

Class for going through the whole repository and getting the list of entities to be deleted.


Nested Class Summary
protected  class DeleteDependencyCalculator.DeletingNode
          Class for keeping info about the structure of the repository.
 
Field Summary
protected  NodeConfiguration nodeConfiguration
          Used to access the repository.
protected  java.util.HashMap<org.eclipse.emf.common.util.URI,DeleteDependencyCalculator.DeletingNode> nodesCache
          A map for accessing the references of the nodes as fast as possible.
protected  RepositoryQuery repositoryQuery
          Used to access the repository.
protected  DeleteDependencyCalculator.DeletingNode root
          Not really needed.
 
Constructor Summary
DeleteDependencyCalculator(NodeConfiguration nodeConfiguration)
          Constructor.
 
Method Summary
protected  void addCodeBundleNode(DeleteDependencyCalculator.DeletingNode node, CodeBundle codeBundle)
          Inserts the code bundle into the dependencies of the node, depending on the standalone status of the code bundle.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(Architecture entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(Aspect entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(AssemblyDescriptor entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(CodeBundle entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(ConnectorUnitDeploymentDescription entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(DeploymentPlan entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(Frame entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(InstanceAssemblyDescription entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(InstanceDeploymentDescription entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(Interface entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(InterfaceType entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(MicroComponent entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(MicroInterfaceType entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(SubcomponentDeploymentInstance entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
protected  DeleteDependencyCalculator.DeletingNode cacheEntity(SubcomponentInstance entity)
          Goes through all the dependencies of the entity and caches it into memory of this data structure.
static void ContainerContainmentRelation(DeleteDependencyCalculator.DeletingNode container, DeleteDependencyCalculator.DeletingNode containment)
          Specifies a container-containment relation between the two nodes.
 java.util.Set<VersionedEntity> getAllDependencies()
          Just for debugging purposes.
 java.util.Set<VersionedEntity> getDeletingDependencies(org.eclipse.emf.common.util.URI uri)
          Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.
 java.util.Set<VersionedEntity> getDeletingDependencies(VersionedEntity entity)
          Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.
 java.util.Set<VersionedEntity> getDeletingDependencies(VersionedEntity[] entityArr)
          Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.
 java.util.Set<VersionedEntity> getDeletingParents(org.eclipse.emf.common.util.URI uri)
          Gets all "dependencies" which the entity should be deleted with for keeping the repository consistent.
protected  void indent(int indent)
          Simple indentation function when printing information about the nodes.
static void ParentChildRelation(DeleteDependencyCalculator.DeletingNode parent, DeleteDependencyCalculator.DeletingNode child)
          Specifies a parent-child relation between the two given nodes.
 void printResult()
          Prints the results of dependency seeking - the siblings of the root node.
protected  org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject e)
          Just until I find out why EcoreUtil.resolveAll works only for some entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodesCache

protected java.util.HashMap<org.eclipse.emf.common.util.URI,DeleteDependencyCalculator.DeletingNode> nodesCache
A map for accessing the references of the nodes as fast as possible.


root

protected DeleteDependencyCalculator.DeletingNode root
Not really needed. Holds all VersionedEntity nodes as its direct children.


nodeConfiguration

protected NodeConfiguration nodeConfiguration
Used to access the repository.


repositoryQuery

protected RepositoryQuery repositoryQuery
Used to access the repository.

Constructor Detail

DeleteDependencyCalculator

public DeleteDependencyCalculator(NodeConfiguration nodeConfiguration)
Constructor. Connects to the repository and caches all the needed information.

Parameters:
nodeConfiguration - the configuration of the repository.
Method Detail

resolve

protected org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject e)
Just until I find out why EcoreUtil.resolveAll works only for some entities.

Parameters:
e - The EObject to be resolved
Returns:
EObject with all properties resolved

ParentChildRelation

public static void ParentChildRelation(DeleteDependencyCalculator.DeletingNode parent,
                                       DeleteDependencyCalculator.DeletingNode child)
Specifies a parent-child relation between the two given nodes. (Adds the child to parent's children and parent to child's parents) If the parent is being deleted, the child must be deleted also.


ContainerContainmentRelation

public static void ContainerContainmentRelation(DeleteDependencyCalculator.DeletingNode container,
                                                DeleteDependencyCalculator.DeletingNode containment)
Specifies a container-containment relation between the two nodes. If either of the two nodes is being deleted, the second one must be deleted also.


getDeletingDependencies

public java.util.Set<VersionedEntity> getDeletingDependencies(VersionedEntity entity)
Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.

Parameters:
entity - the entity to be deleted and which's dependencies to find.
Returns:
the list of dependencies to be deleted with the entity or null when the entity is not present

getDeletingDependencies

public java.util.Set<VersionedEntity> getDeletingDependencies(VersionedEntity[] entityArr)
Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.

Parameters:
entityArr - the entities to be deleted and which's dependencies to find.
Returns:
the list of dependencies to be deleted with the entity or null when the entity is not present

getDeletingDependencies

public java.util.Set<VersionedEntity> getDeletingDependencies(org.eclipse.emf.common.util.URI uri)
Gets all dependencies which should be deleted with a VersionedEntity for keeping the repository consistent.

Parameters:
uri - the entity to be deleted and which's dependencies to find.
Returns:
the list of dependencies to be deleted with the entity or null when the entity is not present

getDeletingParents

public java.util.Set<VersionedEntity> getDeletingParents(org.eclipse.emf.common.util.URI uri)
Gets all "dependencies" which the entity should be deleted with for keeping the repository consistent.

Parameters:
uri - the entity and which's dependencies to find.
Returns:
the list of dependencies with which the entity should be deleted with or null when the entity is not present.

getAllDependencies

public java.util.Set<VersionedEntity> getAllDependencies()
Just for debugging purposes.

Returns:
dependencies for the node

indent

protected void indent(int indent)
Simple indentation function when printing information about the nodes.

Parameters:
indent - How many spaces it should indent.

printResult

public void printResult()
Prints the results of dependency seeking - the siblings of the root node.


addCodeBundleNode

protected void addCodeBundleNode(DeleteDependencyCalculator.DeletingNode node,
                                 CodeBundle codeBundle)
Inserts the code bundle into the dependencies of the node, depending on the standalone status of the code bundle.

Parameters:
node -
codeBundle -

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(Architecture entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(Aspect entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(AssemblyDescriptor entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(CodeBundle entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(DeploymentPlan entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(InstanceDeploymentDescription entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(ConnectorUnitDeploymentDescription entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(SubcomponentDeploymentInstance entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(Frame entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(InterfaceType entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(MicroComponent entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure. Note: It is better not to cache this object for a long time.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(InstanceAssemblyDescription entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(Interface entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(SubcomponentInstance entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.

cacheEntity

protected DeleteDependencyCalculator.DeletingNode cacheEntity(MicroInterfaceType entity)
Goes through all the dependencies of the entity and caches it into memory of this data structure.

Returns:
the entity as DeletingNode with all dependencies.