PTP
Release 7.0

org.eclipse.ptp.pldt.common
Class ArtifactManager

java.lang.Object
  extended by org.eclipse.ptp.pldt.common.ArtifactManager

public class ArtifactManager
extends Object

Manage the artifacts: be able to retrieve an artifact from the id in a marker, for example.

Note that there can be more than one ArtifactManager, distinguished by an ID, probably a markerID. That is, all artifacts of the same markerID (probably shown in the same view) are managed by the same (distinct) ArtifactManager. TODO Question: why can't we just store the objects in an attribute??


Field Summary
static HashMap registry
          Registry of artifact managers.
 
Constructor Summary
ArtifactManager(String id)
          Create ArtifactManager from id
 
Method Summary
 void addArtifactToHash(IArtifact a)
          Add an artifact to the hashtable for future lookup
 void clear()
          Remove all the artifacts
static IArtifact getArtifact(IMarker marker)
          return the artifact for a marker; involves looking up the Artifact Manager, then the Artifact within that.
 HashMap getArtifactMap()
          get hashtable of artifact map
 Object[] getArtifacts()
           
static ArtifactManager getManager(String id)
          return the ArtifactManager used for managing artifacts of type "id" (probably a marker id)
 boolean removeArtifact(IArtifact a)
          Remove artifact by artifact object
 boolean removeArtifact(String key)
          Remove artifact by key
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

registry

public static HashMap registry
Registry of artifact managers. IDs are probably markerIDs for the type of artifacts that this ArtifactManager holds.

Constructor Detail

ArtifactManager

public ArtifactManager(String id)
Create ArtifactManager from id

Parameters:
id -
Method Detail

getManager

public static ArtifactManager getManager(String id)
return the ArtifactManager used for managing artifacts of type "id" (probably a marker id)

Parameters:
id -
Returns:

getArtifact

public static IArtifact getArtifact(IMarker marker)
                             throws CoreException
return the artifact for a marker; involves looking up the Artifact Manager, then the Artifact within that. Maybe we just need a big hashtable or other big Map instead???

Parameters:
marker -
Returns:
Throws:
CoreException

addArtifactToHash

public void addArtifactToHash(IArtifact a)
Add an artifact to the hashtable for future lookup

Parameters:
artifact -

getArtifacts

public Object[] getArtifacts()

getArtifactMap

public HashMap getArtifactMap()
get hashtable of artifact map

Returns:

removeArtifact

public boolean removeArtifact(IArtifact a)
Remove artifact by artifact object

Parameters:
a - the artifact to remove
Returns:
true if it was removed

removeArtifact

public boolean removeArtifact(String key)
Remove artifact by key

Parameters:
key -
Returns:

clear

public void clear()
Remove all the artifacts


toString

public String toString()
Overrides:
toString in class Object

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.