[Registry-dev] svn commit r16730 - in
trunk/registry/modules/core/src/main/java/org/wso2/registry:
jdbc/handlers/builtin utils
svn at wso2.org
svn at wso2.org
Fri May 9 01:53:05 PDT 2008
Author: deepal
Date: Fri May 9 01:52:58 2008
New Revision: 16730
Log:
forgot to add the changed resource back
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/WSDLValidationHandler.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/XSDValidationHandler.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/SchemaValidator.java
Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/WSDLValidationHandler.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/WSDLValidationHandler.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/WSDLValidationHandler.java Fri May 9 01:52:58 2008
@@ -57,6 +57,10 @@
private static final String WSDL_VALIDATION_ERROR = "ValidationMessages";
+ private static final String WSDL_STATUS = "WSDL Status ";
+ private static final String WSDL_VALID = "WSDL is valid";
+ private static final String WSDL_IN_VALID = "WSDL is invalid ";
+
public Resource get(RequestContext requestContext) throws RegistryException {
return null;
}
@@ -122,6 +126,11 @@
System.out.println("=========================");
validator.validate(wsdlDefinition, new ArrayList(), info);
messages = validateInfo.getValidationMessages();
+ if (messages.length >0) {
+ resource.setProperty(WSDL_STATUS , WSDL_IN_VALID);
+ } else {
+ resource.setProperty(WSDL_STATUS , WSDL_VALID);
+ }
for (int i = 0; i < messages.length; i++) {
ValidationMessage message = messages[i];
String messageString = "[" + message.getLine() + "][" + message.getColumn() + "]"
Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/XSDValidationHandler.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/XSDValidationHandler.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/handlers/builtin/XSDValidationHandler.java Fri May 9 01:52:58 2008
@@ -41,6 +41,7 @@
InputStream in = new ByteArrayInputStream((byte[]) resourceContent);
validator.validate(in, resource);
}
+ requestContext.getRegistry().put(resource.getPath() ,resource);
}
public void importResource(RequestContext requestContext) throws RegistryException {
@@ -51,6 +52,7 @@
InputStream in = new ByteArrayInputStream((byte[]) resourceContent);
validator.validate(in, resource);
}
+ requestContext.getRegistry().put(resource.getPath() ,resource);
}
public void delete(RequestContext requestContext) throws RegistryException {
Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/SchemaValidator.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/SchemaValidator.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/SchemaValidator.java Fri May 9 01:52:58 2008
@@ -34,6 +34,10 @@
private static final String XMLSCHEMA_XSD_LOCATION = "org/wso2/registry/utils/XMLSchema.xsd";
private static final String XSD_VALIDATION_ERROR = "ValidationMessages";
+ private static final String XSD_STATUS = "Schema Status ";
+ private static final String XSD_VALID = "Schema is valid";
+ private static final String XSD_IN_VALID = "Schema is invalid ";
+
/**
* This will valide the given schema againts the w3c.XMLSchema.
*
@@ -54,7 +58,9 @@
Validator validator = schema.newValidator();
// validate the DOM tree
validator.validate(scoure);
+ resource.setProperty(XSD_STATUS ,XSD_VALID);
} catch (Exception e) {
+ resource.setProperty(XSD_STATUS ,XSD_IN_VALID);
resource.addProperty(XSD_VALIDATION_ERROR, e.getMessage());
throw new RegistryException(e.getMessage());
}
More information about the Registry-dev
mailing list