org.eclipse.wst.common.componentcore
Class ComponentCore

java.lang.Object
  extended byorg.eclipse.wst.common.componentcore.ComponentCore

public class ComponentCore
extends java.lang.Object

Provides a handle creation factory for the Virtual Path API. Clients may use this class to convert Platform IResource model elements to IVirtualResource model elements.

ComponentCore provides a consistent entry point to the IVirtual Path model that allows clients to group resources together in logical collections with a path structure that varies from their actual source location structures.

Since:
1.0

Constructor Summary
ComponentCore()
           
 
Method Summary
static IVirtualComponent createComponent(IProject aProject, java.lang.String aComponentName)
          Return an IVirtualComponent with the given name (aComponentName) contained by the given project (aProject).
static IVirtualFile createFile(IProject aProject, java.lang.String aComponentName, IPath aRuntimePath)
          Return an IVirtualFile with a runtime path specified by aRuntimePath contained by aProject, in a component named aComponentName.
static IFlexibleProject createFlexibleProject(IProject aProject)
          Return an IFlexibleProject that provides an entry-point to the components stored within the given project.
static IVirtualFolder createFolder(IProject aProject, java.lang.String aComponentName, IPath aRuntimePath)
          Return an IVirtualFolder with a runtime path specified by aRuntimePath contained by aProject, in a component named aComponentName.
static IVirtualReference createReference(IVirtualComponent aComponent, IVirtualComponent aReferencedComponent)
          Return an IVirtualReference that captures a relationship between aComponent and aReferencedComponent.
static IVirtualResource[] createResources(IResource aResource)
          Return an array of IVirtualResources that represent the given IResource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentCore

public ComponentCore()
Method Detail

createFlexibleProject

public static IFlexibleProject createFlexibleProject(IProject aProject)
Return an IFlexibleProject that provides an entry-point to the components stored within the given project. The returned IFlexibleProject may not contain any components, which could mean that the supplied IProject is either not flexible or empty.

Parameters:
aProject - A valid, accessible IProject
Returns:
A valid IFlexibleProject

createComponent

public static IVirtualComponent createComponent(IProject aProject,
                                                java.lang.String aComponentName)
Return an IVirtualComponent with the given name (aComponentName) contained by the given project (aProject). Component names should be unique across a project.

Parameters:
aProject - A valid, accessible project to contain the component
aComponentName - A name to identify the component within the project.
Returns:
A handle to an IVirtualComponent that may or may not exist.
See Also:
IVirtualContainer.create(int, IProgressMonitor)

createFolder

public static IVirtualFolder createFolder(IProject aProject,
                                          java.lang.String aComponentName,
                                          IPath aRuntimePath)
Return an IVirtualFolder with a runtime path specified by aRuntimePath contained by aProject, in a component named aComponentName. The resultant IVirtualFolder may or may not exist.

Parameters:
aProject - A valid, accessible project to contain the component
aComponentName - A name to identify the component within the project.
aRuntimePath - The runtime path of the IVirtualFolder to return.
Returns:
An IVirtualFolder contained by the specified component with the given runtime path
See Also:
IVirtualContainer.create(int, IProgressMonitor), IVirtualResource.createLink(IPath, int, IProgressMonitor)

createFile

public static IVirtualFile createFile(IProject aProject,
                                      java.lang.String aComponentName,
                                      IPath aRuntimePath)
Return an IVirtualFile with a runtime path specified by aRuntimePath contained by aProject, in a component named aComponentName. IVirtualFiles can only be created as links. Use IVirtualResource.getUnderlyingResource() or IVirtualFile.getUnderlyingFile() to create a resource with real contents.

Parameters:
aProject - A valid, accessible project to contain the component
aComponentName - A name to identify the component within the project.
aRuntimePath - The runtime path of the IVirtualFolder to return.
Returns:
An IVirtualFile contained by the specified component with the given runtime path
See Also:
IVirtualResource.createLink(IPath, int, IProgressMonitor)

createReference

public static IVirtualReference createReference(IVirtualComponent aComponent,
                                                IVirtualComponent aReferencedComponent)
Return an IVirtualReference that captures a relationship between aComponent and aReferencedComponent. The IVirtualReference will be stored with aComponent and target aReferencedComponent. IVirtualReferences may span projects.

Parameters:
aComponent - A valid, existing IVirtualComponent
aReferencedComponent - A valid, existing IVirtualComponent
Returns:
An IVirtualReference that captures the relationship between aComponent and aReferencedComponent.
See Also:
IVirtualReference.create(int, IProgressMonitor)

createResources

public static IVirtualResource[] createResources(IResource aResource)
Return an array of IVirtualResources that represent the given IResource. Each IResource could be mapped to multiple components, and thus an array of each IVirtualResource that represents the IResource will be returned. Each IVirtualResource may also map to other existing IResources, so the mapping is not 1:1.

Parameters:
aResource - An accessible IResource
Returns:
An array of IVirtualResources from the model that represent the IResource.