Author: azeez
Date: Mon Dec 3 06:55:26 2007
New Revision: 10441
Log:
Merging 2.1 branck to trunk
xy
Added:
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Util.java
- copied unchanged from r10353,
branches/wsas/java/2.1/commons/archive-validators/src/main/java/org/wso2/validator/Util.java
Modified:
trunk/commons/archive-validators/pom.xml
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Module.java
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Service.java
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/module_validator.xsl
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/service-validator.xsl
trunk/commons/archive-validators/www/validator.js
trunk/commons/archive-validators/www/validator.xsl
Modified: trunk/commons/archive-validators/pom.xml
==============================================================================
--- trunk/commons/archive-validators/pom.xml (original)
+++ trunk/commons/archive-validators/pom.xml Mon Dec 3 06:55:26 2007
@@ -106,6 +106,20 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.2</version>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@@ -228,6 +242,34 @@
</pluginRepositories>
+ <profiles>
+ <profile>
+ <activation>
+ <property>
+ <name>sign</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
<distributionManagement>
<repository>
<id>wso2-maven2-repository</id>
@@ -242,10 +284,10 @@
</distributionManagement>
<properties>
- <axis2.version>1.3</axis2.version>
+ <axis2.version>SNAPSHOT</axis2.version>
<wso2utils.version>SNAPSHOT</wso2utils.version>
- <axiom.version>1.2.5</axiom.version>
- <neethi.version>2.0.2</neethi.version>
+ <axiom.version>SNAPSHOT</axiom.version>
+ <neethi.version>SNAPSHOT</neethi.version>
<commons.logging.version>1.1</commons.logging.version>
<junit.version>3.8.2</junit.version>
<log4j.version>1.2.13</log4j.version>
Modified:
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Module.java
==============================================================================
---
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Module.java
(original)
+++
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Module.java
Mon Dec 3 06:55:26 2007
@@ -19,25 +19,11 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.wso2.utils.WSO2Constants;
-import org.w3c.dom.Document;
-import javax.xml.transform.Source;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.*;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipEntry;
-import java.util.Map;
-import java.util.Hashtable;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
/**
* This class provide the facility to validate module.xml.
@@ -48,118 +34,70 @@
public static final String MODULE_XSL_FORMATTER_LOCATION =
"org/wso2/validator/module_formatter.xsl";
+ /**
+ * This method will retrun the location of the generated html after
validation of module.xml from
+ * this given module archive. Method will be injected with file id, which
will find the absolute
+ * path from WSO2Constants.FILE_RESOURCE_MAP.
+ *
+ * @param fileId file id
+ * @return String id of the generated html file
+ * @throws AxisFault will be thrown for any fault that could encounter in
the code
+ */
public String validate(String fileId) throws AxisFault {
- String marFileLocation = getFilePathFromFileId(fileId);
+ ConfigurationContext configCtx = MessageContext
+ .getCurrentMessageContext().getConfigurationContext();
+ String marFileLocation = Util.getFilePathFromFileId(fileId, configCtx);
+ if (marFileLocation == null) {
+ throw new AxisFault("Uploaded file is invalid and cannot continue
the validation,");
+ }
+ String s;
+ InputStream in;
try {
- // first whether the archive extension is mar
- if (!marFileLocation.endsWith(".mar")) {
- throw new AxisFault("Axis modules must always be mar files.");
- } else {
- // lets check whether this archive contains a module.xml file
inside the META-INF
- ZipInputStream zin = new ZipInputStream(new
FileInputStream(marFileLocation));
- ZipEntry entry;
- boolean moduleXMLFound = false;
- while ((entry = zin.getNextEntry()) != null) {
- if
(entry.getName().equalsIgnoreCase(DeploymentConstants.MODULE_XML)) {
- moduleXMLFound = true;
- break;
- }
- }
- if (!moduleXMLFound) {
- throw new AxisFault(
- "module.xml not found in " +
DeploymentConstants.MODULE_XML);
- }
- return doTransformation(zin, marFileLocation);
- }
- } catch (Exception e) {
+ in = Util.locateXML(marFileLocation, ".mar",
DeploymentConstants.MODULE_XML);
+ Util.continueProcess(in);
+ in = Util.locateXML(marFileLocation, ".mar",
DeploymentConstants.MODULE_XML);
+ s = Util.doTransformation(in, marFileLocation, MODULE_XSL_LOCATION,
+ MODULE_XSL_FORMATTER_LOCATION,
+ Module.class.getClassLoader());
+ in.close();
+ } catch (AxisFault axisFault) {
+ throw axisFault;
+ } catch (IOException e) {
throw AxisFault.makeFault(e);
}
+ return s;
}
+ /**
+ * This method will generate a html page after validating a module.xml.
+ *
+ * @param fileId file id
+ * @return String id
+ * @throws AxisFault will be thrown
+ */
public String validateModuleXML(String fileId) throws AxisFault {
- String marFileLocation;
- try {
- marFileLocation = getFilePathFromFileId(fileId);
- //Test if the loaded file is XML compatible
- FileInputStream stream = new FileInputStream(marFileLocation);
- StAXOMBuilder builder = new StAXOMBuilder(stream);
- builder.getDocumentElement().build();
- stream = new FileInputStream(marFileLocation);
- return doTransformation(stream, marFileLocation);
- } catch (Exception e) {
- String msg = "module.xml validation cannot be continued. This
might cause due to " +
- "uploading of invalid module.xml or internal server
error. ";
- throw new AxisFault(msg);
- }
- }
-
- private String getFilePathFromFileId(String fileId) {
ConfigurationContext configCtx =
MessageContext.getCurrentMessageContext().getConfigurationContext();
- Map fileResMap =
- (Map) configCtx.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
- return (String) fileResMap.get(fileId);
- }
-
-
- private File getOutputFilePath(String xmlfilePath, String xmlFileName) {
- if (File.separatorChar == '\\') {
- xmlfilePath = xmlfilePath.replace('\\','/');
- }
- int lastIndex = xmlfilePath.lastIndexOf('/');
- String filePath = xmlfilePath.substring(0, lastIndex);
- return new File(filePath, xmlFileName);
- }
-
- private String doTransformation(InputStream xmlStream, String inFilePath)
throws AxisFault {
-
- //ID Generation
- String uuid = String.valueOf(System.currentTimeMillis() +
Math.random());
+ String s;
try {
-// InputStream xslStream =
Thread.currentThread().getContextClassLoader()
-// .getResourceAsStream(MODULE_XSL_LOCATION);
- InputStream xslStream =
-
getClass().getClassLoader().getResourceAsStream(MODULE_XSL_LOCATION);
- InputStream xslForamtterStream =
-
getClass().getClassLoader().getResourceAsStream(MODULE_XSL_FORMATTER_LOCATION);
- Source xmlSource = new StreamSource(xmlStream);
- Source xslSource = new StreamSource(xslStream);
- Source xslForamtterSource = new StreamSource(xslForamtterStream);
- String fileName = uuid + ".html";
- File outFile = getOutputFilePath(inFilePath, fileName);
- DocumentBuilder docB =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = docB.newDocument();
- //do the first transformation
- Result result = new DOMResult(doc);
- Transformer transformer = TransformerFactory.newInstance()
- .newTransformer(xslSource);
- transformer.transform(xmlSource, result);
-
- ///////////////////////////////////////////////////
-// System.out.println(DOM2Writer.nodeToString(doc));
- ////////////////////////////////////////////////////
-
- //the second transformation
- OutputStream outFileStream = new FileOutputStream(outFile);
- Result finalResult = new StreamResult(outFileStream);
- transformer = TransformerFactory.newInstance()
- .newTransformer(xslForamtterSource);
- //setting the FileoutputPath to ConfigurationContext
- transformer.transform(new DOMSource(doc), finalResult);
-
-
- ConfigurationContext configCtx =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
- Map fileResourcesMap =
- (Map)
configCtx.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
- if (fileResourcesMap == null) {
- fileResourcesMap = new Hashtable();
- configCtx.setProperty(WSO2Constants.FILE_RESOURCE_MAP,
fileResourcesMap);
+ String marFileLocation = Util.getFilePathFromFileId(fileId,
configCtx);
+ if (marFileLocation == null) {
+ throw new AxisFault("Uploaded file is invalid and cannot
continue the validation,");
}
- fileResourcesMap.put(uuid, outFile.getAbsolutePath());
- } catch (Exception e) {
+ FileInputStream in = new FileInputStream(marFileLocation);
+ Util.continueProcess(in);
+ in = new FileInputStream(marFileLocation);
+ s = Util.doTransformation(in, marFileLocation, MODULE_XSL_LOCATION,
+ MODULE_XSL_FORMATTER_LOCATION,
+ Module.class.getClassLoader());
+ in.close();
+ } catch (FileNotFoundException e) {
+ String msg = "module.xml validation cannot be continued. This
might cause due to " +
+ "uploading of invalid module.xml or internal server
error. ";
+ throw new AxisFault(msg, e);
+ } catch (IOException e) {
throw AxisFault.makeFault(e);
}
- return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + uuid;
+ return s;
}
}
Modified:
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Service.java
==============================================================================
---
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Service.java
(original)
+++
trunk/commons/archive-validators/src/main/java/org/wso2/validator/Service.java
Mon Dec 3 06:55:26 2007
@@ -19,26 +19,7 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.wso2.utils.WSO2Constants;
-import org.w3c.dom.Document;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Source;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.Map;
-import java.util.Hashtable;
import java.io.*;
/**
@@ -51,125 +32,70 @@
public static final String SERVICES_XSL_FORMATTER_LOCATION =
"org/wso2/validator/service-formatter.xsl";
- private static Log log = LogFactory.getLog(Service.class);
-
+ /**
+ * This method will retrun the location of the generated html after
validation of services.xml from
+ * this given service archive. Method will be injected with file id, which
will find the absolute
+ * path from WSO2Constants.FILE_RESOURCE_MAP.
+ *
+ * @param fileId file id
+ * @return String id of the generated html file
+ * @throws AxisFault will be thrown for any fault that could encounter in
the code
+ */
public String validate(String fileId) throws AxisFault {
- String aarFileLocation = getFilePathFromFileId(fileId);
+ ConfigurationContext configCtx = MessageContext
+ .getCurrentMessageContext().getConfigurationContext();
+ String aarFileLocation = Util.getFilePathFromFileId(fileId, configCtx);
+ if (aarFileLocation == null) {
+ throw new AxisFault("Uploaded file is invalid and cannot continue
the validation,");
+ }
+ String s;
+ InputStream in;
try {
- // first whether the archive extension is mar
- if (!aarFileLocation.endsWith(".aar")) {
- throw new AxisFault("Validate only services with .aar
extension.");
- } else {
- // lets check whether this archive contains a module.xml file
inside the META-INF
- ZipInputStream zin = new ZipInputStream(new
FileInputStream(aarFileLocation));
- ZipEntry entry;
- boolean servicesXMLFound = false;
- while ((entry = zin.getNextEntry()) != null) {
- if
(entry.getName().equalsIgnoreCase(DeploymentConstants.SERVICES_XML)) {
- servicesXMLFound = true;
- break;
- }
- }
- if (!servicesXMLFound) {
- String s = "services.xml not found in " +
DeploymentConstants.SERVICES_XML;
- log.error(s);
- throw new AxisFault(s);
- }
- return doTransformation(zin, aarFileLocation);
-
- }
- } catch (Exception e) {
- log.error(e);
+ in = Util.locateXML(aarFileLocation, ".aar",
DeploymentConstants.SERVICES_XML);
+ Util.continueProcess(in);
+ in = Util.locateXML(aarFileLocation, ".aar",
DeploymentConstants.SERVICES_XML);
+ s = Util.doTransformation(in, aarFileLocation,
SERVICES_XSL_LOCATION,
+ SERVICES_XSL_FORMATTER_LOCATION,
+ Service.class.getClassLoader());
+ in.close();
+ } catch (AxisFault axisFault) {
+ throw axisFault;
+ } catch (IOException e) {
throw AxisFault.makeFault(e);
}
+ return s;
}
+ /**
+ * This method will generate a html page after validating a services.xml.
+ *
+ * @param fileId file id
+ * @return String id
+ * @throws AxisFault will be thrown
+ */
public String validateServicesXML(String fileId) throws AxisFault {
- String marFileLocation;
- try {
- marFileLocation = getFilePathFromFileId(fileId);
- //Test if the loaded file is XML compatible
- FileInputStream stream = new FileInputStream(marFileLocation);
- StAXOMBuilder builder = new StAXOMBuilder(stream);
- builder.getDocumentElement().build();
- stream = new FileInputStream(marFileLocation);
- return doTransformation(stream, marFileLocation);
- } catch (Exception e) {
- String msg = "services.xml validation cannot be continued. This
might cause due to " +
- "uploading of invalid services.xml or internal server
error. ";
- log.error(msg, e);
- throw new AxisFault(msg);
- }
- }
-
- private String getFilePathFromFileId(String fileId) {
ConfigurationContext configCtx =
MessageContext.getCurrentMessageContext().getConfigurationContext();
- Map fileResMap =
- (Map) configCtx.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
- return (String) fileResMap.get(fileId);
- }
-
-
- private File getOutputFilePath(String xmlfilePath, String xmlFileName) {
- if (File.separatorChar == '\\') {
- xmlfilePath = xmlfilePath.replace('\\','/');
- }
- int lastIndex = xmlfilePath.lastIndexOf('/');
- String filePath = xmlfilePath.substring(0, lastIndex);
- return new File(filePath, xmlFileName);
- }
-
- private String doTransformation(InputStream xmlStream, String inFilePath)
throws AxisFault {
-
- //ID Generation
- String uuid = String.valueOf(System.currentTimeMillis() +
Math.random());
+ String s;
try {
-// InputStream xslStream =
Thread.currentThread().getContextClassLoader()
-// .getResourceAsStream(MODULE_XSL_LOCATION);
- InputStream xslStream =
-
getClass().getClassLoader().getResourceAsStream(SERVICES_XSL_LOCATION);
- InputStream xslForamtterStream =
- getClass().getClassLoader()
-
.getResourceAsStream(SERVICES_XSL_FORMATTER_LOCATION);
- Source xmlSource = new StreamSource(xmlStream);
- Source xslSource = new StreamSource(xslStream);
- Source xslForamtterSource = new StreamSource(xslForamtterStream);
- String fileName = uuid + ".html";
- File outFile = getOutputFilePath(inFilePath, fileName);
- DocumentBuilder docB =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = docB.newDocument();
- //do the first transformation
- Result result = new DOMResult(doc);
- Transformer transformer = TransformerFactory.newInstance()
- .newTransformer(xslSource);
- transformer.transform(xmlSource, result);
-
- ///////////////////////////////////////////////////
-// System.out.println(DOM2Writer.nodeToString(doc));
- ////////////////////////////////////////////////////
-
- //the second transformation
- OutputStream outFileStream = new FileOutputStream(outFile);
- Result finalResult = new StreamResult(outFileStream);
- transformer = TransformerFactory.newInstance()
- .newTransformer(xslForamtterSource);
- //setting the FileoutputPath to ConfigurationContext
- transformer.transform(new DOMSource(doc), finalResult);
- ConfigurationContext configCtx =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
- Map fileResourcesMap =
- (Map)
configCtx.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
- if (fileResourcesMap == null) {
- fileResourcesMap = new Hashtable();
- configCtx.setProperty(WSO2Constants.FILE_RESOURCE_MAP,
fileResourcesMap);
+ String aarFileLocation = Util.getFilePathFromFileId(fileId,
configCtx);
+ if (aarFileLocation == null) {
+ throw new AxisFault("Uploaded file is invalid and cannot
continue the validation.");
}
- fileResourcesMap.put(uuid, outFile.getAbsolutePath());
- } catch (Exception e) {
- log.error(e);
+ FileInputStream in = new FileInputStream(aarFileLocation);
+ Util.continueProcess(in);
+ in = new FileInputStream(aarFileLocation);
+ s = Util.doTransformation(in, aarFileLocation,
SERVICES_XSL_LOCATION,
+ SERVICES_XSL_FORMATTER_LOCATION,
+ Service.class.getClassLoader());
+ in.close();
+ } catch (FileNotFoundException e) {
+ String msg = "services.xml validation cannot be continued. This
might cause due to " +
+ "uploading of invalid services.xml or internal server
error. ";
+ throw new AxisFault(msg, e);
+ } catch (IOException e) {
throw AxisFault.makeFault(e);
}
- return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + uuid;
+ return s;
}
-
}
Modified:
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/module_validator.xsl
==============================================================================
---
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/module_validator.xsl
(original)
+++
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/module_validator.xsl
Mon Dec 3 06:55:26 2007
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ exclude-result-prefixes="wsp">
<xsl:output method="xml"/>
<!-- root match -->
<xsl:template match="/">
@@ -22,11 +25,11 @@
<info>Description element is not found</info>
</xsl:if>
- <xsl:if test="not(inflow)">
- <info>inflow element is not found</info>
+ <xsl:if test="not(InFlow)">
+ <info>InFlow element is not found</info>
</xsl:if>
- <xsl:if test="not(outflow)">
- <info>outflow element is not found</info>
+ <xsl:if test="not(OutFlow)">
+ <info>OutFlow element is not found</info>
</xsl:if>
<xsl:if test="not(parameter)">
@@ -36,42 +39,42 @@
<info>operation element is not found</info>
</xsl:if>
- <xsl:if test="not(Outfaultflow)">
- <info>Outfaultflow element is not found</info>
+ <xsl:if test="not(OutFaultFlow)">
+ <info>OutFaultFlow element is not found</info>
</xsl:if>
- <xsl:if test="not(INfaultflow)">
- <info>INfaultflow element is not found</info>
+ <xsl:if test="not(InFaultFlow)">
+ <info>InFaultFlow element is not found</info>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
- <xsl:template match="inflow">
- <info>inflow element is found</info>
+ <xsl:template match="InFlow">
+ <info>InFlow element is found</info>
<xsl:apply-templates/>
</xsl:template>
- <xsl:template match="outflow">
- <info>outflow element is found</info>
+ <xsl:template match="OutFlow">
+ <info>OutFlow element is found</info>
<xsl:apply-templates/>
</xsl:template>
- <xsl:template match="Outfaultflow">
+ <xsl:template match="OutFaultFlow">
<info>Outfaultflow element is found</info>
<xsl:apply-templates/>
</xsl:template>
- <xsl:template match="INfaultflow">
- <info>Outfaultflow element is found</info>
+ <xsl:template match="InFaultFlow">
+ <info>InFaultFlow element is found</info>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="handler">
<info>Element handler is found</info>
- <xsl:if test="not(name)">
+ <xsl:if test="not(@name)">
<warning>Attribute name is not found for handler</warning>
</xsl:if>
<!-- No service element!! -->
@@ -141,4 +144,8 @@
<warning>No Action Mapping Found</warning>
</xsl:if>
</xsl:template>
+
+ <xsl:template match="wsp:Policy">
+ <info>Policy element has found</info>
+ </xsl:template>
</xsl:stylesheet>
Modified:
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/service-validator.xsl
==============================================================================
---
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/service-validator.xsl
(original)
+++
trunk/commons/archive-validators/src/main/resources/org/wso2/validator/service-validator.xsl
Mon Dec 3 06:55:26 2007
@@ -20,7 +20,7 @@
</xsl:when>
<xsl:otherwise>
<!-- No description -->
- <xsl:if test="not(description)">
+ <xsl:if test="not(Description)">
<warning>No description found in
service!</warning>
</xsl:if>
<info>Found <xsl:value-of
select="count(operation)"/> Operation elements in service <xsl:value-of
select="@name"/>
@@ -59,7 +59,7 @@
</xsl:if>
<!-- no mep for the operation -->
<xsl:if test="not(@mep)">
- <error> No mep attribute found in Operation
<xsl:value-of select="@name"/></error>
+ <warning> No mep attribute found in Operation
<xsl:value-of select="@name"/></warning>
</xsl:if>
<!-- no scope for the operation -->
<xsl:if test="not(@scope)">
Modified: trunk/commons/archive-validators/www/validator.js
==============================================================================
--- trunk/commons/archive-validators/www/validator.js (original)
+++ trunk/commons/archive-validators/www/validator.js Mon Dec 3 06:55:26 2007
@@ -52,16 +52,20 @@
},
validateAndSubmitAAR : function() {
- var formObj = document.getElementById('aarValidatorDivFormId')
- var inputObj = document.getElementById('filenameAARId')
- if (inputObj.value == "") {
- wso2.wsf.Util.alertWarning("Please Select a AAR to Validate");
- return false;
+ try {
+ var formObj = document.getElementById('aarValidatorDivFormId')
+ var inputObj = document.getElementById('filenameAARId')
+ if (inputObj.value == "") {
+ wso2.wsf.Util.alertWarning("Please Select a AAR to Validate");
+ return false;
+ }
+ formObj.action = "fileupload/*";
+ FileExcutor.execute = this.aarExecutor;
+ formObj.submit();
+ return true;
+ } catch (e) {
+ wso2.wsf.Util.alertWarning("You have selected an invalid Axis2
serivce archive.");
}
- formObj.action = "fileupload/*";
- FileExcutor.execute = this.aarExecutor;
- formObj.submit();
- return true;
},
aarExecutor : function(uuid) {
@@ -85,29 +89,37 @@
},
validateAndSubmitServicesXml : function() {
- var formObj =
document.getElementById('services_xmlValidatorDivIdFormId')
- var inputObj = document.getElementById('filenameServices_xmlId')
- if (inputObj.value == "") {
- wso2.wsf.Util.alertWarning("Please Select a services.xml to
Validate");
- return false;
+ try {
+ var formObj =
document.getElementById('services_xmlValidatorDivIdFormId')
+ var inputObj = document.getElementById('filenameServices_xmlId')
+ if (inputObj.value == "") {
+ wso2.wsf.Util.alertWarning("Please Select a services.xml to
Validate");
+ return false;
+ }
+ formObj.action = "fileupload/*";
+ FileExcutor.execute = this.aarServicesXMLExecutor;
+ formObj.submit();
+ return true;
+ } catch(e) {
+ wso2.wsf.Util.alertWarning("You have selected an invalid
services.xml file.");
}
- formObj.action = "fileupload/*";
- FileExcutor.execute = this.aarServicesXMLExecutor;
- formObj.submit();
- return true;
},
validateAndSubmitMAR : function() {
- var formObj = document.getElementById('marValidatorDivFormId')
- var inputObj = document.getElementById('filenameMARId')
- if (inputObj.value == "") {
- wso2.wsf.Util.alertWarning("Please Select a MAR to Validate");
- return false;
+ try {
+ var formObj = document.getElementById('marValidatorDivFormId')
+ var inputObj = document.getElementById('filenameMARId')
+ if (inputObj.value == "") {
+ wso2.wsf.Util.alertWarning("Please Select a MAR to Validate");
+ return false;
+ }
+ formObj.action = "fileupload/*";
+ FileExcutor.execute = this.marExecutor;
+ formObj.submit();
+ return true;
+ } catch(e) {
+ wso2.wsf.Util.alertWarning("You have selected an invalid Axis2
module archive.");
}
- formObj.action = "fileupload/*";
- FileExcutor.execute = this.marExecutor;
- formObj.submit();
- return true;
},
marExecutor : function(uuid) {
@@ -121,16 +133,20 @@
},
validateAndSubmitModuleXml : function() {
- var formObj = document.getElementById('module_xmlValidatorDivIdFormId')
- var inputObj = document.getElementById('filenameModule_xmlId')
- if (inputObj.value == "") {
- wso2.wsf.Util.alertWarning("Please Select a module.xml to
Validate");
- return false;
+ try {
+ var formObj =
document.getElementById('module_xmlValidatorDivIdFormId')
+ var inputObj = document.getElementById('filenameModule_xmlId')
+ if (inputObj.value == "") {
+ wso2.wsf.Util.alertWarning("Please Select a module.xml to
Validate");
+ return false;
+ }
+ formObj.action = "fileupload/*";
+ FileExcutor.execute = this.marModuleXMLExecutor;
+ formObj.submit();
+ return true;
+ } catch(e) {
+ wso2.wsf.Util.alertWarning("You have selected an invalid module.xml
file.");
}
- formObj.action = "fileupload/*";
- FileExcutor.execute = this.marModuleXMLExecutor;
- formObj.submit();
- return true;
},
marModuleXMLExecutor : function(uuid) {
Modified: trunk/commons/archive-validators/www/validator.xsl
==============================================================================
--- trunk/commons/archive-validators/www/validator.xsl (original)
+++ trunk/commons/archive-validators/www/validator.xsl Mon Dec 3 06:55:26 2007
@@ -8,9 +8,7 @@
</div>
<fieldset style="border:none;">
<div id="formset">
- <form>
- <xsl:call-template name="servicesTemplate"/>
- </form>
+ <xsl:call-template name="servicesTemplate"/>
</div>
</fieldset>
</xsl:template>
@@ -21,88 +19,119 @@
</div>
<fieldset style="border:none;">
<div id="formset">
- <form>
- <xsl:call-template name="modulesTemplate"/>
- </form>
+ <xsl:call-template name="modulesTemplate"/>
</div>
</fieldset>
</xsl:template>
<xsl:template name="servicesTemplate">
- <fieldset>
- <legend>Select an AAR (Services Archive) </legend>
- <div id='aarValidatorDivId' style="display:inline;">
- <form action="#" id="aarValidatorDivFormId" method="post"
name="wsdlUpload"
- enctype="multipart/form-data"
- target="globalIFrame">
- <input type="file" id="filenameAARId" name="filename"
size="50"/>
- <br/>
- <input type="submit" value="Validate AAR">
+
+ <form method="POST" name="aarValidatorDivFormId"
id="aarValidatorDivFormId"
+ enctype="multipart/form-data"
+ action="fileupload/*"
+ target="globalIFrame">
+ <xsl:attribute name="onSubmit">
+ javascript:
+ return wso2.tool.AV.validateAndSubmitAAR();
+ </xsl:attribute>
+ <fieldset>
+ <legend>Select an AAR (Services Archive)</legend>
+ <label>Select AAR</label>
+ <input type="file" id="filenameAARId" name="filenameAARId"
size="50"/>
+ <br/>
+ <div class="buttonrow">
+ <input name="upload" type="submit" value="Validate AAR">
<xsl:attribute name="onclick">
javascript:
- wso2.tool.AV.validateAndSubmitAAR();
- return false;
+ return wso2.tool.AV.validateAndSubmitAAR();
</xsl:attribute>
</input>
- </form>
- </div>
- </fieldset>
- <fieldset>
- <legend>Select a services.xml </legend>
- <div id='services_xmlValidatorDivId' style="display:inline;">
- <form action="#" id="services_xmlValidatorDivIdFormId"
method="post" name="wsdlUpload"
- enctype="multipart/form-data"
- target="globalIFrame">
- <input type="file" id="filenameServices_xmlId"
name="filename" size="50"/>
- <br/>
+ </div>
+ </fieldset>
+ </form>
+
+
+ <form id="services_xmlValidatorDivIdFormId" method="post"
+ name="services_xmlValidatorDivIdFormId"
+ action="fileupload/*"
+ enctype="multipart/form-data"
+ target="globalIFrame">
+ <xsl:attribute name="onSubmit">
+ javascript:
+ return wso2.tool.AV.validateAndSubmitServicesXml();
+ </xsl:attribute>
+ <fieldset>
+ <legend>Select a services.xml</legend>
+ <label>Select services.xml</label>
+ <input type="file" id="filenameServices_xmlId"
name="filenameServices_xmlId" size="50"/>
+ <br/>
+ <div class="buttonrow">
<input type="submit" value="Validate services.xml">
<xsl:attribute name="onclick">
javascript:
- wso2.tool.AV.validateAndSubmitServicesXml();
- return false;
+ return wso2.tool.AV.validateAndSubmitServicesXml();
</xsl:attribute>
</input>
- </form>
- </div>
- </fieldset>
+ </div>
+ </fieldset>
+ </form>
+
</xsl:template>
<xsl:template name="modulesTemplate">
- <fieldset>
- <legend>Select a MAR (Module Archive)</legend>
- <div id='marValidatorDivId' style="display:inline;">
- <form action="#" id="marValidatorDivFormId" method="post"
name="wsdlUpload"
- enctype="multipart/form-data"
- target="globalIFrame">
- <input type="file" id="filenameMARId" name="filename"
size="50"/>
- <br/>
+
+ <form id="marValidatorDivFormId" method="post"
+ action="fileupload/*"
+ name="marValidatorDivFormId"
+ enctype="multipart/form-data"
+ target="globalIFrame">
+ <xsl:attribute name="onSubmit">
+ javascript:
+ return wso2.tool.AV.validateAndSubmitMAR();
+ </xsl:attribute>
+ <fieldset>
+ <legend>Select a MAR (Module Archive)</legend>
+ <label>Select MAR</label>
+ <input type="file" id="filenameMARId" name="filenameMARId"
size="50"/>
+ <br/>
+ <div class="buttonrow">
<input type="submit" value="Validate MAR">
<xsl:attribute name="onclick">
javascript:
- wso2.tool.AV.validateAndSubmitMAR();
- return false;
+ return wso2.tool.AV.validateAndSubmitMAR();
</xsl:attribute>
</input>
- </form>
- </div>
- </fieldset>
- <fieldset>
- <legend>Select a module.xml </legend>
- <div id='module_xmlValidatorDivId' style="display:inline;">
- <form action="#" id="module_xmlValidatorDivIdFormId"
method="post" name="wsdlUpload"
- enctype="multipart/form-data"
- target="globalIFrame">
- <input type="file" id="filenameModule_xmlId"
name="filename" size="50"/>
+ </div>
+ </fieldset>
+ </form>
+
+
+ <div id='module_xmlValidatorDivId' style="display:inline;">
+ <form id="module_xmlValidatorDivIdFormId" method="post"
+ name="module_xmlValidatorDivIdFormId"
+ action="fileupload/*"
+ enctype="multipart/form-data"
+ target="globalIFrame">
+ <xsl:attribute name="onSubmit">
+ javascript:
+ return wso2.tool.AV.validateAndSubmitModuleXml();
+ </xsl:attribute>
+ <fieldset>
+ <legend>Select a module.xml</legend>
+ <label>Select module.xml</label>
+ <input type="file" id="filenameModule_xmlId"
name="filenameModule_xmlId" size="50"/>
<br/>
- <input type="submit" value="Validate module.xml">
- <xsl:attribute name="onclick">
- javascript:
- wso2.tool.AV.validateAndSubmitModuleXml();
- return false;
- </xsl:attribute>
- </input>
- </form>
- </div>
- </fieldset>
+ <div class="buttonrow">
+ <input type="submit" value="Validate module.xml">
+ <xsl:attribute name="onclick">
+ javascript:
+ return
wso2.tool.AV.validateAndSubmitModuleXml();
+ </xsl:attribute>
+ </input>
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev