g-Eclipse
Release 1.0.0

eu.geclipse.core.model.impl
Class AbstractGridContainer

java.lang.Object
  extended by PlatformObject
      extended by eu.geclipse.core.model.impl.AbstractGridElement
          extended by eu.geclipse.core.model.impl.AbstractGridContainer
All Implemented Interfaces:
IGridContainer, IGridElement
Direct Known Subclasses:
AbstractVirtualOrganization, GridGlueComputing, JSDLJobDescriptionModel, ResourceGridContainer

public abstract class AbstractGridContainer
extends AbstractGridElement
implements IGridContainer

Base implementation of the IGridContainer interface that implements basic functionalities of a grid container.


Method Summary
 boolean canContain(IGridElement element)
          Determines if this may contain the specified element.
 boolean contains(IGridElement element)
          Determines if this container holds the specified element as child.
 IGridElement create(IGridElementCreator creator)
          Create a new Grid element from the specified IGridElementCreator and add the newly created element to the list of children.
 void delete(IGridElement child)
          Delete the specified child.
 void deleteAll()
          Remove all children from this container and call their dispose() methods.
 void dispose()
          Clean up all resources that this element uses internally.
 IGridElement findChild(java.lang.String name)
          Search for a child with the specified name and return it.
 IGridElement findChildWithResource(java.lang.String resourceName)
          Search for a child that has an IResource with the specified name.
 int getChildCount()
          Get the number of children currently contained in this container.
 IGridElement[] getChildren(IProgressMonitor monitor)
          Get the children that are currently contained in this container.
 boolean hasChildren()
          Determine if this container contains any children.
 boolean isDirty()
          Returns if this container is dirty.
 void refresh(IProgressMonitor monitor)
          Refresh the content of this container.
 void setDirty()
          Mark this container as dirty.
 
Methods inherited from class eu.geclipse.core.model.impl.AbstractGridElement
getAdapter, getProject, isHidden, isVirtual
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.geclipse.core.model.IGridContainer
isLazy
 
Methods inherited from interface eu.geclipse.core.model.IGridElement
getFileStore, getName, getParent, getPath, getProject, getResource, isHidden, isLocal, isVirtual
 

Method Detail

canContain

public boolean canContain(IGridElement element)
Description copied from interface: IGridContainer
Determines if this may contain the specified element. This method works type specific, i.e. a container may or may not contain elements of a specified type.

Specified by:
canContain in interface IGridContainer
Parameters:
element - The element that may be contained in this container.
Returns:
If this container may contain the specified element.

contains

public boolean contains(IGridElement element)
Description copied from interface: IGridContainer
Determines if this container holds the specified element as child.

Specified by:
contains in interface IGridContainer
Parameters:
element - The element to be checked if it is contained in this container.
Returns:
True if the specified element is defined as a child of this container.

create

public IGridElement create(IGridElementCreator creator)
                    throws ProblemException
Description copied from interface: IGridContainer
Create a new Grid element from the specified IGridElementCreator and add the newly created element to the list of children. If a child with the same name already exists this old child is replaced by the new child. Note that this is the only way to add children to an IGridContainer.

Specified by:
create in interface IGridContainer
Parameters:
creator - The IGridElementCreator from which to create the new element.
Returns:
The element itself or the old element if the specified element is null and there was such an old element found. null in all other cases.
Throws:
ProblemException

delete

public void delete(IGridElement child)
            throws ProblemException
Description copied from interface: IGridContainer
Delete the specified child. Deletion in the terms of an means removing the specified element from the list of children and calling the element's dispose method.

Specified by:
delete in interface IGridContainer
Parameters:
child - The element to be deleted.
Throws:
ProblemException - If a problem occurs during the deletion.
See Also:
IGridElement.dispose()

dispose

public void dispose()
Description copied from interface: IGridElement
Clean up all resources that this element uses internally.

Specified by:
dispose in interface IGridElement
Overrides:
dispose in class AbstractGridElement

getChildCount

public int getChildCount()
Description copied from interface: IGridContainer
Get the number of children currently contained in this container.

Specified by:
getChildCount in interface IGridContainer
Returns:
The number of children in this container.

getChildren

public IGridElement[] getChildren(IProgressMonitor monitor)
                           throws ProblemException
Description copied from interface: IGridContainer
Get the children that are currently contained in this container.

Specified by:
getChildren in interface IGridContainer
Parameters:
monitor - A progress monitor that is used to indicate progress for lazy containers. May be null.
Returns:
This container's children.
Throws:
ProblemException - If this is a lazy container it may be possible that an exception occurs while the children are fetched.

hasChildren

public boolean hasChildren()
Description copied from interface: IGridContainer
Determine if this container contains any children.

Specified by:
hasChildren in interface IGridContainer
Returns:
True if this container is not empty and contains at least one child.

findChild

public IGridElement findChild(java.lang.String name)
Description copied from interface: IGridContainer
Search for a child with the specified name and return it. Returns null if no such element was found.

Specified by:
findChild in interface IGridContainer
Parameters:
name - The name of the element to be searched for.
Returns:
The element with the specified name or null.

findChildWithResource

public IGridElement findChildWithResource(java.lang.String resourceName)
Description copied from interface: IGridContainer
Search for a child that has an IResource with the specified name. If the child is not virtual this method is equivalent to IGridContainer.findChild(String).

Specified by:
findChildWithResource in interface IGridContainer
Parameters:
resourceName - The name of the corresponding resource of the child.
Returns:
The child containing a corresponding resource with the specified name or null.

isDirty

public boolean isDirty()
Description copied from interface: IGridContainer
Returns if this container is dirty. This has no meaning if this is not a lazy container. For lazy containers it means that the list of children will be reloaded the next time when IGridContainer.getChildren(IProgressMonitor monitor) is called. To avoid confusions non-lazy containers should always return true here.

Specified by:
isDirty in interface IGridContainer
Returns:
True if the container is dirty. Does not have a meaning for non-lazy containers.

refresh

public void refresh(IProgressMonitor monitor)
             throws ProblemException
Description copied from interface: IGridContainer
Refresh the content of this container. This method re-fetches the children of this container even if it is a non-lazy container.

Specified by:
refresh in interface IGridContainer
Parameters:
monitor - A progress monitor used to give the caller feedback about the progress of the operation.
Throws:
ProblemException - If a problem occurs during the refresh operation.

setDirty

public void setDirty()
Description copied from interface: IGridContainer
Mark this container as dirty. A dirty and lazy container will reload its children when IGridContainer.getChildren(IProgressMonitor monitor) is called. This methods does not affect non-lazy containers.

Specified by:
setDirty in interface IGridContainer

deleteAll

public void deleteAll()
Remove all children from this container and call their dispose() methods.

Specified by:
deleteAll in interface IGridContainer
See Also:
IGridContainer.delete(IGridElement)

g-Eclipse
Release 1.0.0