You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/20 08:35:39 UTC
svn commit: r1818749 - in /axis/axis2/java/core/branches/schema-validation:
./ modules/adb-tests/ modules/adb-tests/src/test/xslt/ modules/jibx/
modules/jibx/src/test/java/org/apache/axis2/jibx/
modules/jibx/src/test/java/org/apache/axis2/jibx/library/...
Author: veithen
Date: Wed Dec 20 08:35:38 2017
New Revision: 1818749
URL: http://svn.apache.org/viewvc?rev=1818749&view=rev
Log:
Merge latest changes from trunk.
Added:
axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Handler.java
- copied unchanged from r1818748, axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Handler.java
axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Parameter.java
- copied unchanged from r1818748, axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Parameter.java
axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ServiceDescription.java
- copied unchanged from r1818748, axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ServiceDescription.java
Removed:
axis/axis2/java/core/branches/schema-validation/modules/adb-tests/src/test/xslt/
axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Echo.java
axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/repo/
axis/axis2/java/core/branches/schema-validation/modules/json/test-repository/gson/axis2.xml
axis/axis2/java/core/branches/schema-validation/modules/json/test-repository/json/axis2.xml
Modified:
axis/axis2/java/core/branches/schema-validation/ (props changed)
axis/axis2/java/core/branches/schema-validation/modules/adb-tests/pom.xml
axis/axis2/java/core/branches/schema-validation/modules/jibx/pom.xml
axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java
axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
axis/axis2/java/core/branches/schema-validation/modules/json/pom.xml
axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
Propchange: axis/axis2/java/core/branches/schema-validation/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec 20 08:35:38 2017
@@ -3,3 +3,4 @@
/axis/axis2/java/core/branches/AXIS2-4318:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
/axis/axis2/java/core/branches/AXIS2-5785:1793298-1793391
/axis/axis2/java/core/branches/google-java-format:1800516-1800554
+/axis/axis2/java/core/trunk:1818704-1818748
Modified: axis/axis2/java/core/branches/schema-validation/modules/adb-tests/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/adb-tests/pom.xml?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/adb-tests/pom.xml (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/adb-tests/pom.xml Wed Dec 20 08:35:38 2017
@@ -366,42 +366,68 @@
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xml-maven-plugin</artifactId>
- <version>1.0.1</version>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis2-repo-maven-plugin</artifactId>
+ <version>${project.version}</version>
<executions>
<execution>
- <phase>generate-test-resources</phase>
+ <id>repo-axis2-5741</id>
<goals>
- <goal>transform</goal>
+ <goal>create-test-repository</goal>
</goals>
<configuration>
- <transformationSets>
- <transformationSet>
- <dir>${project.build.directory}/wsdl2code/AXIS2-5741/resources</dir>
- <includes>
- <include>services.xml</include>
- </includes>
- <stylesheet>src/test/xslt/AXIS2-5741.xsl</stylesheet>
- <outputDir>${project.build.directory}/repo/AXIS2-5741/services/FiverxLinkService/META-INF</outputDir>
- </transformationSet>
- <transformationSet>
- <dir>${project.build.directory}/wsdl2code/AXIS2-5749/resources</dir>
- <includes>
- <include>services.xml</include>
- </includes>
- <stylesheet>src/test/xslt/AXIS2-5749.xsl</stylesheet>
- <outputDir>${project.build.directory}/repo/AXIS2-5749/services/ColorService/META-INF</outputDir>
- </transformationSet>
- <transformationSet>
- <dir>${project.build.directory}/wsdl2code/AXIS2-5809/resources</dir>
- <includes>
- <include>services.xml</include>
- </includes>
- <stylesheet>src/test/xslt/AXIS2-5809.xsl</stylesheet>
- <outputDir>${project.build.directory}/repo/AXIS2-5809/services/EchoService/META-INF</outputDir>
- </transformationSet>
- </transformationSets>
+ <outputDirectory>${project.build.directory}/repo/AXIS2-5741</outputDirectory>
+ <serviceDescriptions>
+ <serviceDescription>
+ <directory>${project.build.directory}/wsdl2code/AXIS2-5741/resources</directory>
+ <parameters>
+ <parameter>
+ <name>ServiceClass</name>
+ <value>org.apache.axis2.databinding.axis2_5741.service.FiverxLinkServiceImpl</value>
+ </parameter>
+ </parameters>
+ </serviceDescription>
+ </serviceDescriptions>
+ </configuration>
+ </execution>
+ <execution>
+ <id>repo-axis2-5749</id>
+ <goals>
+ <goal>create-test-repository</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/repo/AXIS2-5749</outputDirectory>
+ <serviceDescriptions>
+ <serviceDescription>
+ <directory>${project.build.directory}/wsdl2code/AXIS2-5749/resources</directory>
+ <parameters>
+ <parameter>
+ <name>ServiceClass</name>
+ <value>org.apache.axis2.databinding.axis2_5749.service.ColorServiceImpl</value>
+ </parameter>
+ </parameters>
+ </serviceDescription>
+ </serviceDescriptions>
+ </configuration>
+ </execution>
+ <execution>
+ <id>repo-axis2-5809</id>
+ <goals>
+ <goal>create-test-repository</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/repo/AXIS2-5809</outputDirectory>
+ <serviceDescriptions>
+ <serviceDescription>
+ <directory>${project.build.directory}/wsdl2code/AXIS2-5809/resources</directory>
+ <parameters>
+ <parameter>
+ <name>ServiceClass</name>
+ <value>org.apache.axis2.databinding.axis2_5809.EchoServiceImpl</value>
+ </parameter>
+ </parameters>
+ </serviceDescription>
+ </serviceDescriptions>
</configuration>
</execution>
</executions>
Modified: axis/axis2/java/core/branches/schema-validation/modules/jibx/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/jibx/pom.xml?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/jibx/pom.xml (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/jibx/pom.xml Wed Dec 20 08:35:38 2017
@@ -69,6 +69,13 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>echo</artifactId>
+ <version>${project.version}</version>
+ <type>aar</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
@@ -168,47 +175,71 @@
</executions>
</plugin>
<plugin>
- <artifactId>maven-resources-plugin</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis2-repo-maven-plugin</artifactId>
+ <version>${project.version}</version>
<executions>
<execution>
+ <id>echo-repo</id>
+ <goals>
+ <goal>create-test-repository</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/repo/echo</outputDirectory>
+ <services>echo</services>
+ </configuration>
+ </execution>
+ <execution>
<id>library-unwrapped-repo</id>
- <phase>generate-test-resources</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>create-test-repository</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/repo/library-unwrapped</outputDirectory>
- <resources>
- <resource>
- <directory>src/test/repo</directory>
- </resource>
- <resource>
+ <includeServices>false</includeServices>
+ <serviceDescriptions>
+ <serviceDescription>
<directory>${project.build.directory}/gen/library-unwrapped/resources</directory>
- <targetPath>services/library.aar/META-INF</targetPath>
- </resource>
- </resources>
+ <parameters>
+ <parameter>
+ <name>ServiceClass</name>
+ <value>org.apache.axis2.jibx.library.unwrapped.service.LibraryImpl</value>
+ </parameter>
+ </parameters>
+ </serviceDescription>
+ </serviceDescriptions>
</configuration>
</execution>
<execution>
<id>library-wrapped-repo</id>
- <phase>generate-test-resources</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>create-test-repository</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/repo/library-wrapped</outputDirectory>
- <resources>
- <resource>
- <directory>src/test/repo</directory>
- </resource>
- <resource>
+ <includeServices>false</includeServices>
+ <serviceDescriptions>
+ <serviceDescription>
<directory>${project.build.directory}/gen/library-wrapped/resources</directory>
- <targetPath>services/library.aar/META-INF</targetPath>
- </resource>
- </resources>
+ <parameters>
+ <parameter>
+ <name>ServiceClass</name>
+ <value>org.apache.axis2.jibx.library.wrapped.service.LibraryImpl</value>
+ </parameter>
+ </parameters>
+ </serviceDescription>
+ </serviceDescriptions>
</configuration>
</execution>
</executions>
+ <configuration>
+ <configurationDirectory>conf</configurationDirectory>
+ <generatedAxis2xml>
+ <modules>
+ <module>checker</module>
+ </modules>
+ </generatedAxis2xml>
+ </configuration>
</plugin>
</plugins>
</build>
Modified: axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java Wed Dec 20 08:35:38 2017
@@ -20,12 +20,8 @@
package org.apache.axis2.jibx;
import junit.framework.TestCase;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.jibx.customer.EchoCustomerServiceStub;
import org.apache.axis2.testutils.UtilServer;
-import org.apache.axis2.util.Utils;
-
-import javax.xml.namespace.QName;
/**
* Full code generation and runtime test for JiBX data binding extension. This is based on the
@@ -33,22 +29,13 @@ import javax.xml.namespace.QName;
*/
public class Test extends TestCase {
private static final String REPOSITORY_DIR =
- System.getProperty("basedir", ".") + "/src/test/repo/";
-
- public static final QName serviceName = new QName("EchoCustomerService");
- public static final QName operationName = new QName("echo");
-
- private AxisService service;
+ System.getProperty("basedir", ".") + "/target/repo/echo";
private void startServer() throws Exception {
- service = Utils.createSimpleService(serviceName,
- Echo.class.getName(), operationName);
UtilServer.start(REPOSITORY_DIR);
- UtilServer.deployService(service);
}
private void stopServer() throws Exception {
- UtilServer.unDeployService(serviceName);
UtilServer.stop();
/* File outputFile = new File(OUTPUT_LOCATION_BASE);
if (outputFile.exists() && outputFile.isDirectory()){
@@ -64,7 +51,7 @@ public class Test extends TestCase {
Customer customer = new Customer("Redmond", person, "+14258858080",
"WA", "14619 NE 80th Pl.", new Integer(98052));
EchoCustomerServiceStub stub = new EchoCustomerServiceStub(UtilServer.getConfigurationContext(),
- "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/EchoCustomerService/echo");
+ "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Echo/echo");
Customer result = stub.echo(customer);
stopServer();
assertEquals("Result object does not match request object",
Modified: axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java Wed Dec 20 08:35:38 2017
@@ -26,7 +26,6 @@ import org.apache.axis2.description.Axis
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jibx.beans.Book;
import org.apache.axis2.jibx.library.unwrapped.client.LibraryStub;
-import org.apache.axis2.jibx.library.unwrapped.service.LibraryImpl;
import org.apache.axis2.testutils.UtilServer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -38,7 +37,6 @@ public class LibraryTest {
UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/library-unwrapped");
AxisConfiguration axisConfiguration = UtilServer.getConfigurationContext().getAxisConfiguration();
AxisService service = axisConfiguration.getService("library");
- service.getParameter(Constants.SERVICE_CLASS).setValue(LibraryImpl.class.getName());
service.setScope(Constants.SCOPE_APPLICATION);
}
Modified: axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java Wed Dec 20 08:35:38 2017
@@ -23,7 +23,6 @@ import org.apache.axis2.description.Axis
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jibx.beans.Book;
import org.apache.axis2.jibx.library.wrapped.client.LibraryStub;
-import org.apache.axis2.jibx.library.wrapped.service.LibraryImpl;
import org.apache.axis2.jibx.wrappers.AddBookRequest;
import org.apache.axis2.testutils.UtilServer;
import org.junit.AfterClass;
@@ -36,7 +35,6 @@ public class LibraryTest {
UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/library-wrapped");
AxisConfiguration axisConfiguration = UtilServer.getConfigurationContext().getAxisConfiguration();
AxisService service = axisConfiguration.getService("library");
- service.getParameter(Constants.SERVICE_CLASS).setValue(LibraryImpl.class.getName());
service.setScope(Constants.SCOPE_APPLICATION);
}
Modified: axis/axis2/java/core/branches/schema-validation/modules/json/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/json/pom.xml?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/json/pom.xml (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/json/pom.xml Wed Dec 20 08:35:38 2017
@@ -173,6 +173,36 @@
<configuration>
<inputDirectory>test-repository/json</inputDirectory>
<outputDirectory>${project.build.directory}/repo/json</outputDirectory>
+ <generatedAxis2xml>
+ <messageFormatters>
+ <messageFormatter>
+ <contentType>application/json</contentType>
+ <className>org.apache.axis2.json.JSONMessageFormatter</className>
+ </messageFormatter>
+ <messageFormatter>
+ <contentType>application/json+badgerfish</contentType>
+ <className>org.apache.axis2.json.JSONBadgerfishMessageFormatter</className>
+ </messageFormatter>
+ <messageFormatter>
+ <contentType>text/javascript</contentType>
+ <className>org.apache.axis2.json.JSONMessageFormatter</className>
+ </messageFormatter>
+ </messageFormatters>
+ <messageBuilders>
+ <messageBuilder>
+ <contentType>application/json</contentType>
+ <className>org.apache.axis2.json.JSONOMBuilder</className>
+ </messageBuilder>
+ <messageBuilder>
+ <contentType>application/json+badgerfish</contentType>
+ <className>org.apache.axis2.json.JSONBadgerfishOMBuilder</className>
+ </messageBuilder>
+ <messageBuilder>
+ <contentType>text/javascript</contentType>
+ <className>org.apache.axis2.json.JSONOMBuilder</className>
+ </messageBuilder>
+ </messageBuilders>
+ </generatedAxis2xml>
</configuration>
</execution>
<execution>
@@ -183,27 +213,39 @@
<configuration>
<inputDirectory>test-repository/gson</inputDirectory>
<outputDirectory>${project.build.directory}/repo/gson</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>repo</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/repo/gson</outputDirectory>
- <resources>
- <resource>
+ <generatedAxis2xml>
+ <messageFormatters>
+ <messageFormatter>
+ <contentType>application/json</contentType>
+ <className>org.apache.axis2.json.gson.JsonFormatter</className>
+ </messageFormatter>
+ </messageFormatters>
+ <messageBuilders>
+ <messageBuilder>
+ <contentType>application/json</contentType>
+ <className>org.apache.axis2.json.gson.JsonBuilder</className>
+ </messageBuilder>
+ </messageBuilders>
+ <handlers>
+ <handler>
+ <flow>InFlow</flow>
+ <phase>Transport</phase>
+ <name>RequestURIOperationDispatcher</name>
+ <className>org.apache.axis2.dispatchers.RequestURIOperationDispatcher</className>
+ </handler>
+ <handler>
+ <flow>InFlow</flow>
+ <phase>Transport</phase>
+ <name>JSONMessageHandler</name>
+ <className>org.apache.axis2.json.gson.JSONMessageHandler</className>
+ </handler>
+ </handlers>
+ </generatedAxis2xml>
+ <serviceDescriptions>
+ <serviceDescription>
<directory>${project.build.directory}/gen/resources</directory>
- <targetPath>services/json_adb_test.aar/META-INF</targetPath>
- </resource>
- </resources>
+ </serviceDescription>
+ </serviceDescriptions>
</configuration>
</execution>
</executions>
Modified: axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java Wed Dec 20 08:35:38 2017
@@ -20,6 +20,7 @@
package org.apache.axis2.maven2.repo;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -192,6 +193,13 @@ public abstract class AbstractCreateRepo
*/
private JAXWSService[] jaxwsServices;
+ /**
+ * A list of service descriptions that should be processed to build exploded AARs.
+ *
+ * @parameter
+ */
+ private ServiceDescription[] serviceDescriptions;
+
protected abstract String getScope();
protected abstract File getInputDirectory();
@@ -201,6 +209,9 @@ public abstract class AbstractCreateRepo
protected abstract File[] getClassDirectories();
private void addMessageHandlers(OMElement root, MessageHandler[] handlers, String localName) {
+ if (handlers == null) {
+ return;
+ }
OMElement parent = root.getFirstChildWithName(new QName(localName + "s"));
for (MessageHandler handler : handlers) {
OMElement element = parent.getOMFactory().createOMElement(localName, null, parent);
@@ -297,6 +308,76 @@ public abstract class AbstractCreateRepo
}
}
}
+ if (serviceDescriptions != null) {
+ File parentDirectory = new File(outputDirectory, servicesDirectory);
+ for (ServiceDescription serviceDescription : serviceDescriptions) {
+ File servicesFile = new File(serviceDescription.getDirectory(), "services.xml");
+ File metaInfDirectory;
+ try {
+ InputStream in = new FileInputStream(servicesFile);
+ try {
+ OMDocument doc = OMXMLBuilderFactory.createOMBuilder(in).getDocument();
+ OMElement serviceElement;
+ {
+ Iterator<OMElement> it = doc.getOMDocumentElement().getChildrenWithLocalName("service");
+ if (!it.hasNext()) {
+ throw new MojoFailureException("No service found in " + servicesFile);
+ }
+ serviceElement = it.next();
+ if (it.hasNext()) {
+ throw new MojoFailureException(servicesFile + " contains more than one service");
+ }
+ }
+ String serviceName = serviceElement.getAttributeValue(new QName("name"));
+ log.info("Building service " + serviceName);
+ metaInfDirectory = new File(new File(parentDirectory, serviceName), "META-INF");
+ metaInfDirectory.mkdirs();
+ if (serviceDescription.getParameters() != null) {
+ for (Parameter parameter : serviceDescription.getParameters()) {
+ OMElement parameterElement = null;
+ for (Iterator<OMElement> it = serviceElement.getChildrenWithLocalName("parameter"); it.hasNext(); ) {
+ OMElement candidate = it.next();
+ if (candidate.getAttributeValue(new QName("name")).equals(parameter.getName())) {
+ parameterElement = candidate;
+ break;
+ }
+ }
+ if (parameterElement == null) {
+ parameterElement = doc.getOMFactory().createOMElement("parameter", null, serviceElement);
+ parameterElement.addAttribute("name", parameter.getName(), null);
+ }
+ parameterElement.setText(parameter.getValue());
+ }
+ }
+ FileOutputStream out = new FileOutputStream(new File(metaInfDirectory, "services.xml"));
+ try {
+ doc.serialize(out);
+ } finally {
+ out.close();
+ }
+ } finally {
+ in.close();
+ }
+ DirectoryScanner ds = new DirectoryScanner();
+ ds.setBasedir(serviceDescription.getDirectory());
+ ds.setExcludes(new String[] { "services.xml" });
+ ds.scan();
+ for (String relativePath : ds.getIncludedFiles()) {
+ try {
+ FileUtils.copyFile(
+ new File(serviceDescription.getDirectory(), relativePath),
+ new File(metaInfDirectory, relativePath));
+ } catch (IOException ex) {
+ throw new MojoExecutionException("Failed to copy " + relativePath, ex);
+ }
+ }
+ } catch (IOException ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
+ } catch (XMLStreamException ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
+ }
+ }
+ }
if (generatedAxis2xml != null || axis2xml != null) {
File targetDirectory = configurationDirectory == null
? outputDirectory : new File(outputDirectory, configurationDirectory);
@@ -343,6 +424,35 @@ public abstract class AbstractCreateRepo
}
addMessageHandlers(root, generatedAxis2xml.getMessageBuilders(), "messageBuilder");
addMessageHandlers(root, generatedAxis2xml.getMessageFormatters(), "messageFormatter");
+ if (generatedAxis2xml.getHandlers() != null) {
+ for (Handler handler : generatedAxis2xml.getHandlers()) {
+ boolean handlerInserted = false;
+ for (Iterator<OMElement> phaseOrderIterator = root.getChildrenWithLocalName("phaseOrder"); phaseOrderIterator.hasNext(); ) {
+ OMElement phaseOrder = phaseOrderIterator.next();
+ if (phaseOrder.getAttributeValue(new QName("type")).equals(handler.getFlow())) {
+ for (Iterator<OMElement> phaseIterator = phaseOrder.getChildrenWithLocalName("phase"); phaseIterator.hasNext(); ) {
+ OMElement phase = phaseIterator.next();
+ if (phase.getAttributeValue(new QName("name")).equals(handler.getPhase())) {
+ OMElement handlerElement = axis2xmlDoc.getOMFactory().createOMElement("handler", null, phase);
+ handlerElement.addAttribute("name", handler.getName(), null);
+ handlerElement.addAttribute("class", handler.getClassName(), null);
+ handlerInserted = true;
+ break;
+ }
+ }
+ break;
+ }
+ }
+ if (!handlerInserted) {
+ throw new MojoFailureException("Flow " + handler.getFlow() + " and phase " + handler.getPhase() + " not found");
+ }
+ }
+ }
+ if (generatedAxis2xml.getModules() != null) {
+ for (String module : generatedAxis2xml.getModules()) {
+ axis2xmlDoc.getOMFactory().createOMElement("module", null, root).addAttribute("ref", module, null);
+ }
+ }
OutputStream out = new FileOutputStream(axis2xmlFile);
try {
axis2xmlDoc.serialize(out);
Modified: axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java?rev=1818749&r1=1818748&r2=1818749&view=diff
==============================================================================
--- axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java (original)
+++ axis/axis2/java/core/branches/schema-validation/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java Wed Dec 20 08:35:38 2017
@@ -21,6 +21,8 @@ package org.apache.axis2.maven2.repo;
public class GeneratedAxis2Xml {
private MessageHandler[] messageBuilders;
private MessageHandler[] messageFormatters;
+ private Handler[] handlers;
+ private String[] modules;
public MessageHandler[] getMessageBuilders() {
return messageBuilders;
@@ -37,4 +39,20 @@ public class GeneratedAxis2Xml {
public void setMessageFormatters(MessageHandler[] messageFormatters) {
this.messageFormatters = messageFormatters;
}
+
+ public Handler[] getHandlers() {
+ return handlers;
+ }
+
+ public void setHandlers(Handler[] handlers) {
+ this.handlers = handlers;
+ }
+
+ public String[] getModules() {
+ return modules;
+ }
+
+ public void setModules(String[] modules) {
+ this.modules = modules;
+ }
}