com.ibm.carma.ui.adapter
Class ResourceUtils

java.lang.Object
  extended by com.ibm.carma.ui.adapter.ResourceUtils

public class ResourceUtils
extends java.lang.Object

Helper class for working with CARMA reference objects

Since:
7.0

Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
static CARMAResource getCarmaResource(java.lang.Object resource)
          Helper method to map the given object to a CARMA resource.
static ICARMAResourceReference getCarmaResourceReference(java.lang.Object resource)
          Locates the CARMA resource reference for the given object
static java.util.Collection<ICARMAResourceReference> getCarmaResourceReferences(java.util.Collection<?> resources)
          Converts the list of objects to a list of CARMA resource references
static java.util.Collection<ICARMAResourceReference> getCarmaResourceReferences(java.lang.Object[] resources)
          Converts the arrat of objects to a list of CARMA resource references
static boolean isManaged(java.lang.Object resource)
          Determines if the given object is associated with (managed by) CARMA.
static void manageReference(org.eclipse.core.runtime.IProgressMonitor monitor, ICARMAResourceReference reference, CARMAResource cResource)
          Mark the given reference as "managed" (associated) with CARMA.
static void removeMapping(org.eclipse.core.runtime.IProgressMonitor monitor, java.lang.Object resource)
          Removes the association between the resource and any CARMA resource referenced by the resource.
static ICARMAResourceReference storeMapping(org.eclipse.core.runtime.IProgressMonitor monitor, java.lang.Object resource, CARMAResource cResource)
          Stores the association between the object and the CARMA resource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

getCarmaResource

public static CARMAResource getCarmaResource(java.lang.Object resource)
Helper method to map the given object to a CARMA resource. If no resource is associated with the object, then null will be returned.

Parameters:
resource - resource to find the associated CARMA resource for.
Returns:
the associated CARMA resource, or null

getCarmaResourceReference

public static ICARMAResourceReference getCarmaResourceReference(java.lang.Object resource)
Locates the CARMA resource reference for the given object

Parameters:
resource - the object to find the CARMA resource reference for
Returns:
the resourc reference associated with the given resource

getCarmaResourceReferences

public static java.util.Collection<ICARMAResourceReference> getCarmaResourceReferences(java.util.Collection<?> resources)
Converts the list of objects to a list of CARMA resource references

Parameters:
resources - the list of objects to locate references for
Returns:
list of CARMA resource references
See Also:
getCarmaResourceReference(Object)

getCarmaResourceReferences

public static java.util.Collection<ICARMAResourceReference> getCarmaResourceReferences(java.lang.Object[] resources)
Converts the arrat of objects to a list of CARMA resource references

Parameters:
resources - array of objects to locate references for
Returns:
list of CARMA resource references
See Also:
getCarmaResourceReferences(Collection)

storeMapping

public static ICARMAResourceReference storeMapping(org.eclipse.core.runtime.IProgressMonitor monitor,
                                                   java.lang.Object resource,
                                                   CARMAResource cResource)
                                            throws org.eclipse.core.runtime.CoreException
Stores the association between the object and the CARMA resource

Parameters:
monitor - monitor for the operation
resource - the object to associate to a CARMA resource
cResource - the CARMA resource to associate to
Returns:
the resulting CARMA resource reference between the two objects
Throws:
org.eclipse.core.runtime.CoreException - the association could not be stored.

manageReference

public static void manageReference(org.eclipse.core.runtime.IProgressMonitor monitor,
                                   ICARMAResourceReference reference,
                                   CARMAResource cResource)
                            throws org.eclipse.core.runtime.CoreException
Mark the given reference as "managed" (associated) with CARMA.

Parameters:
monitor - monitor for the operation
reference - the reference to mark as managed
cResource - the resource to associate with the reference
Throws:
org.eclipse.core.runtime.CoreException - the management operation could not be completed
See Also:
ICARMAResourceReference.manage(IProgressMonitor)

removeMapping

public static void removeMapping(org.eclipse.core.runtime.IProgressMonitor monitor,
                                 java.lang.Object resource)
                          throws org.eclipse.core.runtime.CoreException
Removes the association between the resource and any CARMA resource referenced by the resource.

Parameters:
monitor - monitor for the operation
resource - the resource to remove the mapping from
Throws:
org.eclipse.core.runtime.CoreException - the operation could not be completed.

isManaged

public static boolean isManaged(java.lang.Object resource)
Determines if the given object is associated with (managed by) CARMA. A return of true means that the resource IS associated with CARMA.

Parameters:
resource - the object to determine the association status of
Returns:
true if the resource is currently associated with CARMA, false otherwise.