[nobug]: Updating ModuleCore API. Committed for MDE.
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
index 55d5262..958c7e7 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
@@ -38,6 +38,7 @@
private String toString;
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private IVirtualComponent component;
+ private String resourceType;
protected VirtualResource(ComponentHandle aComponentHandle, IPath aRuntimePath) {
@@ -197,6 +198,16 @@
public IResource getUnderlyingResource() {
return null;
}
+
+ //TODO Persist the resource type to the model
+ public void setResourceType(String aResourceType) {
+ resourceType = aResourceType;
+ }
+
+ //TODO Fetch the resource type from the model.
+ public String getResourceType() {
+ return resourceType;
+ }
protected ComponentHandle getComponentHandle() {
return componentHandle;
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
index 8156165..2e44a66 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
@@ -1,13 +1,11 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
package org.eclipse.wst.common.componentcore.resources;
import java.util.Properties;
@@ -15,31 +13,123 @@
import org.eclipse.core.runtime.IPath;
/**
- * Represents a component as defined by the .wtpmodules file.
+ * Represents a component as defined by the .wtpmodules file.
* <p>
- * A component
- * is a container of virtual resources which has other features
- * that describe the component including:
+ * A component is a container of virtual resources which has other features that describe the
+ * component including:
* <ul>
- * <li>{@link #getComponentTypeId()}
+ * <li>{@link #getComponentTypeId()}
* </p>
*/
public interface IVirtualComponent extends IVirtualContainer {
-
+
+ /**
+ * The name of the component must be unique within its enclosing project.
+ *
+ * @return The name of the component.
+ */
String getName();
-
+
+ /**
+ * The componentTypeId is used to understand how this component should be edited and deployed.
+ * Examples include "jst.web" or "jst.utility". The componentTypeId can be set to any value when
+ * created so long as that value makes sense to the clients. Standard componentTypeIds may be
+ * available for common component types.
+ *
+ * @return The componentTypeId, a string based identifier that indicates the component
+ */
String getComponentTypeId();
+
+ /**
+ *
+ * The componentTypeId is used to understand how this component should be edited and deployed.
+ * Examples include "jst.web" or "jst.utility". The componentTypeId can be set to any value when
+ * created so long as that value makes sense to the clients. Standard componentTypeIds may be
+ * available for common component types.
+ *
+ * @param aComponentTypeId
+ * A value which is either standard for a common component type or client-defined for
+ * a custom component type
+ */
void setComponentTypeId(String aComponentTypeId);
-
+
+ /**
+ * MetaProperties are String-based name-value pairs that include information about this
+ * component that may be relevant to clients or the way that clients edit or deploy components.
+ *
+ * @return A by-reference instance of the properties for this component.
+ */
Properties getMetaProperties();
-
+
+ /**
+ * MetaResources provide a loose mechanism for components that would like to list off the
+ * metadata-resources available in the component which can aid or expedite searching for this
+ * resources.
+ * <p>
+ * Clients are not required to get or set the MetaResources for a component.
+ * </p>
+ *
+ * @return A by-value copy of the MetaResources array
+ * @see #setMetaResources(IPath[])
+ */
IPath[] getMetaResources();
+
+ /**
+ *
+ * MetaResources provide a loose mechanism for components that would like to list off the
+ * metadata-resources available in the component which can aid or expedite searching for this
+ * resources.
+ * <p>
+ * Clients are not required to get or set the MetaResources for a component. The existing
+ * MetaResources will be overwritten after the call to this method.
+ * </p>
+ *
+ * @param theMetaResourcePaths
+ * An array of paths that will become the new MetaResource array.
+ */
void setMetaResources(IPath[] theMetaResourcePaths);
-
+
+ /**
+ * Returns all virtual resources of a given type.
+ * <p>
+ * Virtual Resources can have a
+ * {@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getResourceType() type}
+ * associated with them. This method will find those resources
+ * which are tagged with a given resource type The returned array
+ * could be a mix of {@link IVirtualFile}s or {@link IVirtualFolder}s
+ * </p>
+ * <p><b>null</b> may be supplied to this method, which will return all resources without a resourceType.</p>
+ *
+ * @param aResourceType A client-defined resource type that was used to create 0 or more resources within this component
+ * @return An array of those resources which matched the resourceType
+ */
IVirtualResource[] getResources(String aResourceType);
-
+
+ /**
+ * Virtual components may reference other virtual components to build logical dependency trees.
+ * <p>
+ * Each virtual reference will indicate how the content of the reference will be absorbed
+ * by this component. Each virtual reference will always specify an enclosing component that will
+ * be this component.
+ * </p>
+ * @return A by-value copy of the virtual reference array
+ */
IVirtualReference[] getReferences();
- void setReferences(IVirtualReference[] references);
+ /**
+ * Virtual components may reference other virtual components to build logical dependency trees.
+ * <p>
+ * Each virtual reference will indicate how the content of the reference will be absorbed
+ * by this component. Each virtual reference will always specify an enclosing component that will
+ * be this component. Any references specified in the array which do not specify an enclosing
+ * component that matches this component will be modified to specify this virtual component.
+ * </p>
+ * <p>
+ * Existing virtual references will be overwritten when this method is called.
+ * </p>
+ * @param theReferences A by-value copy of the virtual reference array
+ */
+ void setReferences(IVirtualReference[] theReferences);
+
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualReference.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualReference.java
index ae7865c..fa11c14 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualReference.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualReference.java
@@ -14,25 +14,76 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.common.componentcore.internal.DependencyType;
+/**
+ * Represents a dependency between two components: EnclosingComponent->ReferencedComponent.
+ * <p>
+ * The ReferencedComponent may exist in another project or as a binary form on the classpath
+ * of the project.
+ * </p>
+ */
public interface IVirtualReference {
+ /**
+ * Indicates that the dependency should be archived into a *.?ar format before being absorbed.
+ */
int DEPENDENCY_TYPE_USES = DependencyType.USES;
+ /**
+ * Indicates that the dependency will be absorbed as is without archiving.
+ */
int DEPENDENCY_TYPE_CONSUMES = DependencyType.CONSUMES;
+ /**
+ * Creates this virtual reference in model, if it doesn't already exist.
+ * @param updateFlags Currently no update flags apply.
+ * @param aMonitor A progress monitor to track the completion of the operation
+ */
public void create(int updateFlags, IProgressMonitor aMonitor);
+ /**
+ * Returns whether this reference actual exists in the model
+ * @return whether this reference actual exists in the model
+ */
public boolean exists();
+ /**
+ * The runtime path indicates where the contents of the referenced
+ * component will be absorbed within the context of the enclosing component.
+ * @param aRuntimePath A value component-relative path.
+ */
public void setRuntimePath(IPath aRuntimePath);
-
+ /**
+ * The runtime path indicates where the contents of the referenced
+ * component will be absorbed within the context of the enclosing component.
+ * @return A value component-relative path.
+ */
public IPath getRuntimePath();
+ /**
+ * The dependencyType indicates how the contents of the referenced component will be absorbed.
+ * @param aDependencyType One of DEPENDENCY_TYPE_USES or DEPENDENCY_TYPE_CONSUMES
+ * @see #DEPENDENCY_TYPE_CONSUMES
+ * @see #DEPENDENCY_TYPE_USES
+ */
public void setDependencyType(int aDependencyType);
+
+ /**
+ * @return One of DEPENDENCY_TYPE_USES or DEPENDENCY_TYPE_CONSUMES
+ * @see #DEPENDENCY_TYPE_CONSUMES
+ * @see #DEPENDENCY_TYPE_USES
+ */
public int getDependencyType();
+ /**
+ * The enclosing component contains this reference, and will absorb the contents of the referenced component
+ * @return The enclosing component
+ */
public IVirtualComponent getEnclosingComponent();
+ /**
+ * The referenced component is "targeted" by the reference, and will be absorbed by the enclosing component.
+ * @return the referenced component.
+ */
public IVirtualComponent getReferencedComponent();
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualResource.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualResource.java
index bce3aa2..26c3c0e 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualResource.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualResource.java
@@ -364,5 +364,25 @@
* @see IProject#isOpen()
*/
public boolean isAccessible();
+
+ /**
+ * The resourceType provides meta-information about the types of content this virtual resource may represent. Examples
+ * include "java", "resources", "bpel", etc.
+ * <p>
+ * The resourceType may be null, and {@link IVirtualComponent} will always return null for this method.
+ * </p>
+ * @return A client-set resourceType string
+ */
+ public String getResourceType();
+
+ /**
+ * The resourceType provides meta-information about the types of content this virtual resource may represent. Examples
+ * include "java", "resources", "bpel", etc.
+ * <p>
+ * The resourceType may be null, and {@link IVirtualComponent} will always return null for this method.
+ * </p>
+ * @param A client-set resourceType string
+ */
+ public void setResourceType(String aResourceType);
}