Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvbhadrir2005-04-12 19:36:01 +0000
committervbhadrir2005-04-12 19:36:01 +0000
commitbaad640b1f06861407365daddb7d95265e7ca56e (patch)
treedb611242bf27df4428c684337ed7f00d6c952f5e /plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst
parentc8cc679d3ff697bf9379836897fe2b7a108f16a9 (diff)
downloadwebtools.common-baad640b1f06861407365daddb7d95265e7ca56e.tar.gz
webtools.common-baad640b1f06861407365daddb7d95265e7ca56e.tar.xz
webtools.common-baad640b1f06861407365daddb7d95265e7ca56e.zip
Validation api changes: IValidator and IFileDelta and IValidationContext
Diffstat (limited to 'plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst')
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IFileDelta.java59
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IMetaModelContext.java7
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidationContext.java6
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidator.java4
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/ValidationException.java161
5 files changed, 15 insertions, 222 deletions
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IFileDelta.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IFileDelta.java
deleted file mode 100644
index e15f4286d..000000000
--- a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IFileDelta.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.provisional.core;
-
-/**
- * <p>
- * This interface is used, for incremental validation, to encapsulate the change
- * status of a resource. IFileDelta contains the name of the file which has
- * changed, and a flag which indicates the type of change which has occurred.
- *
- * @since 1.0
- * </p>
- * [issue: LM - From speaking with Vijay the name IFileDelta doesn't really capture
- * what this interface is for. Validation may occur of files, it may occur on resources,
- * or it may occur on something more abstract simply known as an artifact. The delta part
- * of the name also seems misleading as this interface doesn't provide the delta but
- * rather provides the type of change. I suggest renaming this interface to IModifiedArtifact
- * or something along those lines to better capture its use. ]
- */
-public interface IFileDelta {
- public static final int ADDED = 1; // the file has been added
- public static final int CHANGED = 2; // the file has been changed
- public static final int DELETED = 3; // the file has been deleted
-
- /**
- * <p>
- * Returns the flag which indicates the type of change which has occurred:
- * IFileDelta.ADDED, IFileDelta.CHANGED, or IFileDelta.DELETED.
- * </p>
- * @return returns the delta type.
- * @since WTP 1.0
- *
- * [issue: LM - From my experience a validator simply needs to know what artifact needs
- * to be validated. Can you provide a use case where the type of change is needed for
- * validation? ]
- */
- public int getDeltaType();
-
- /**
- * <p>
- * Returns the name of the eclipse resource file which has changed. The return value must not be
- * null or the empty string ("").
- * </p>
- * @return returns the file name.
- * @since WTP 1.0
- *
- * [issue: LM - Following my comments above this method should be renamed to getArtifactName or
- * something that follows along with the interface rename. ]
- */
- public String getFileName();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IMetaModelContext.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IMetaModelContext.java
new file mode 100644
index 000000000..2e8975578
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IMetaModelContext.java
@@ -0,0 +1,7 @@
+package org.eclipse.wst.validation.internal.provisional.core;
+
+public interface IMetaModelContext extends IValidationContext {
+
+ public Object getModel(String URI);
+
+}
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidationContext.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidationContext.java
index 32c6978ab..338df8934 100644
--- a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidationContext.java
+++ b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidationContext.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.wst.validation.internal.provisional.core;
+import java.util.List;
+
/**
* <p>
@@ -43,7 +45,7 @@ public interface IValidationContext {
* IValidatorContext. For an example our internal implementation of the loadModel use
* method names for symbolicNames to load the model object to be validated. Users can
* use their own model load mechanism.
- * @see <code>AWorkbenchHelper</code>
+ * @see <code>WorkbenchContext</code>
*
* </p>
* @since 1.0
@@ -72,4 +74,6 @@ public interface IValidationContext {
* supplied and queried in a generic manner.]
*/
public Object loadModel(String symbolicName, Object[] parms);
+
+ public String[] getURIs();
} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidator.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidator.java
index 0be53fdf0..63035472d 100644
--- a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidator.java
+++ b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/IValidator.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.wst.validation.internal.provisional.core;
+import org.eclispe.wst.validation.internal.core.ValidationException;
+
/**
* This is the base interface for all Validators. A Validator is a class which verifies that objects
* follow some rules. For example, in a MOF model which represents an EJB jar, the EJB specification
@@ -65,5 +67,5 @@ public interface IValidator {
* domain of another API to manage manage incremental file changes and triggering validations accordingly.
* Do we have a current use case in WTP where the validator does anything more validate a file from the changedFiles list?]
*/
- public void validate(IValidationContext helper, IReporter reporter, IFileDelta[] changedFiles) throws ValidationException;
+ public void validate(IValidationContext helper, IReporter reporter) throws ValidationException;
} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/ValidationException.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/ValidationException.java
deleted file mode 100644
index fc6262498..000000000
--- a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/provisional/core/ValidationException.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.provisional.core;
-
-
-import java.util.Locale;
-
-/**
- * <p>
- * This exception is the only exception which should be thrown by IValidators. The message in this
- * exception must be suitable for showing to the user. All ValidationExceptions will have their
- * message extracted when they're caught, and the message will be shown to the user.
- *
- * @since 1.0
- * </p>
- */
-public class ValidationException extends Exception {
- private Throwable _lowLevelException = null;
- private IMessage _message = null;
- private ClassLoader _loader = null;
- private final static long serialVersionUID = -3387516993124229949L;
-
- /**
- * Constructs a new exception with a given message string. <br>
- * <br>
- *
- * @param message
- * IMessage, which is Locale-independent, which contains the message to be shown to
- * be shown to the user.
- */
- public ValidationException(IMessage message) {
- this(message, null);
- }
-
- /**
- * Constructs a new exception with a given message string, and low-level exception. <br>
- * <br>
- *
- * @param message
- * IMessage Locale-independent message to be shown to the user.
- * @param exception
- * relevant low-level exception, or <code>null</code> if none. <br>
- * &nbsp;&nbsp;&nbsp For example, when a method fails because of a network
- * communications &nbsp;&nbsp;&nbsp problem, this would be the
- * <code>java.io.IOException</code> &nbsp;&nbsp;&nbsp describing the exact nature
- * of the problem.
- */
- public ValidationException(IMessage message, Throwable exception) {
- super();
- _message = message;
- _lowLevelException = exception;
- }
-
- /**
- * @return the low-level exception associated with this ValidationException.
- */
- public Throwable getAssociatedException() {
- return _lowLevelException;
- }
-
- /**
- * @return the IMessage to be shown to the user, or null if this exception should be handled
- * internally.
- */
- public IMessage getAssociatedMessage() {
- return _message;
- }
-
- /**
- * @return if the IValidator which threw this exception was loaded by a different ClassLoader than the
- * framework, this method returns the ClassLoader of the IValidator.
- */
- public ClassLoader getClassLoader() {
- return _loader;
- }
-
- /**
- * @return the error message string of this <code>Throwable</code> object if it was
- * {@link java.lang.Throwable#Throwable(String) created}with an error message string;
- * or <code>null</code> if it was {@link java.lang.Throwable#Throwable() created}with
- * no error message.
- *
- */
- public String getMessage() {
- return _message.getText(getClassLoader());
- }
-
- /**
- * @param locale
- * The locale of which to get the message.
- * @return the error message string of this <code>Throwable</code> object if it was
- * {@link java.lang.Throwable#Throwable(String) created}with an error message string;
- * or <code>null</code> if it was {@link java.lang.Throwable#Throwable() created}with
- * no error message.
- */
- public String getMessage(Locale locale) {
- return _message.getText(locale, getClassLoader());
- }
-
- /**
- * <p>
- * If the IValidator which threw this exception was loaded by a different ClassLoader than the
- * framework, this method should set the ClassLoader to be the ClassLoader of the IValidator.
- * </p>
- * @param loader
- * ClassLoader of the validator
- */
- public void setClassLoader(ClassLoader loader) {
- _loader = loader;
- }
-
- /**
- * <p>
- * Returns a short description of this throwable object. If this <code>Throwable</code> object
- * was {@link java.lang.Throwable#Throwable(String) created}with an error message string, then
- * the result is the concatenation of three strings:
- * <ul>
- * <li>The name of the actual class of this object
- * <li>": " (a colon and a space)
- * <li>The result of the {@link #getMessage}method for this object
- * </ul>
- * If this <code>Throwable</code> object was {@link java.lang.Throwable#Throwable() created}
- * with no error message string, then the name of the actual class of this object is returned.
- * </p>
- *
- * @return a string representation of this <code>Throwable</code>.
- */
- public String toString() {
- return toString(Locale.getDefault());
- }
-
- /**
- * <p>
- * Returns a short description of this throwable object. If this <code>Throwable</code> object
- * was {@link java.lang.Throwable#Throwable(String) created}with an error message string, then
- * the result is the concatenation of three strings:
- * <ul>
- * <li>The name of the actual class of this object
- * <li>": " (a colon and a space)
- * <li>The result of the {@link #getMessage}method for this object
- * </ul>
- * If this <code>Throwable</code> object was {@link java.lang.Throwable#Throwable() created}
- * with no error message string, then the name of the actual class of this object is returned.
- * </p>
- *
- * @return a string representation of this <code>Throwable</code>.
- */
- public String toString(Locale locale) {
- String s = getClass().getName();
- String message = getMessage(locale);
- return (message != null) ? (s + ": " + message) : s; //$NON-NLS-1$
- }
-} \ No newline at end of file

Back to the top