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/03/27 19:47:04 UTC
svn commit: r1788995 - in /axis/axis2/java/core/trunk/modules:
tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/
transport/testkit/
transport/testkit/src/main/java/org/apache/axis2/transport/
transport/testkit/src/main/resources/...
Author: veithen
Date: Mon Mar 27 19:47:04 2017
New Revision: 1788995
URL: http://svn.apache.org/viewvc?rev=1788995&view=rev
Log:
Generate the axis2.xml file used by axis2-transport-testkit.
Added:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java (with props)
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java (with props)
Removed:
axis/axis2/java/core/trunk/modules/transport/testkit/src/main/resources/org/
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
axis/axis2/java/core/trunk/modules/transport/testkit/pom.xml
axis/axis2/java/core/trunk/modules/transport/testkit/src/main/java/org/apache/axis2/transport/CustomAxisConfigurator.java
Modified: axis/axis2/java/core/trunk/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/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java?rev=1788995&r1=1788994&r2=1788995&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java Mon Mar 27 19:47:04 2017
@@ -104,11 +104,11 @@ public abstract class AbstractCreateRepo
private File axis2xml;
/**
- * Specifies whether an <tt>axis2.xml</tt> file should be generated (Experimental).
+ * If present, an <tt>axis2.xml</tt> file will be generated (Experimental).
*
* @parameter
*/
- private boolean generateAxis2xml;
+ private GeneratedAxis2Xml generatedAxis2xml;
/**
* The directory (relative to the repository root) where the <tt>axis2.xml</tt> file will be
@@ -200,6 +200,15 @@ public abstract class AbstractCreateRepo
protected abstract File[] getClassDirectories();
+ private void addMessageHandlers(OMElement root, MessageHandler[] handlers, String localName) {
+ OMElement parent = root.getFirstChildWithName(new QName(localName + "s"));
+ for (MessageHandler handler : handlers) {
+ OMElement element = parent.getOMFactory().createOMElement(localName, null, parent);
+ element.addAttribute("contentType", handler.getContentType(), null);
+ element.addAttribute("class", handler.getClassName(), null);
+ }
+ }
+
public void execute() throws MojoExecutionException, MojoFailureException {
Log log = getLog();
File inputDirectory = getInputDirectory();
@@ -288,7 +297,7 @@ public abstract class AbstractCreateRepo
}
}
}
- if (generateAxis2xml || axis2xml != null) {
+ if (generatedAxis2xml != null || axis2xml != null) {
File targetDirectory = configurationDirectory == null
? outputDirectory : new File(outputDirectory, configurationDirectory);
targetDirectory.mkdirs();
@@ -317,7 +326,8 @@ public abstract class AbstractCreateRepo
}
try {
OMDocument axis2xmlDoc = OMXMLBuilderFactory.createOMBuilder(in).getDocument();
- for (Iterator<OMNode> it = axis2xmlDoc.getOMDocumentElement().getDescendants(false); it.hasNext(); ) {
+ OMElement root = axis2xmlDoc.getOMDocumentElement();
+ for (Iterator<OMNode> it = root.getDescendants(false); it.hasNext(); ) {
OMNode node = it.next();
if (node instanceof OMElement) {
OMElement element = (OMElement)node;
@@ -331,6 +341,8 @@ public abstract class AbstractCreateRepo
}
}
}
+ addMessageHandlers(root, generatedAxis2xml.getMessageBuilders(), "messageBuilder");
+ addMessageHandlers(root, generatedAxis2xml.getMessageFormatters(), "messageFormatter");
OutputStream out = new FileOutputStream(axis2xmlFile);
try {
axis2xmlDoc.serialize(out);
Added: axis/axis2/java/core/trunk/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/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java?rev=1788995&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java Mon Mar 27 19:47:04 2017
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.maven2.repo;
+
+public class GeneratedAxis2Xml {
+ private MessageHandler[] messageBuilders;
+ private MessageHandler[] messageFormatters;
+
+ public MessageHandler[] getMessageBuilders() {
+ return messageBuilders;
+ }
+
+ public void setMessageBuilders(MessageHandler[] messageBuilders) {
+ this.messageBuilders = messageBuilders;
+ }
+
+ public MessageHandler[] getMessageFormatters() {
+ return messageFormatters;
+ }
+
+ public void setMessageFormatters(MessageHandler[] messageFormatters) {
+ this.messageFormatters = messageFormatters;
+ }
+}
Propchange: axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java?rev=1788995&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java Mon Mar 27 19:47:04 2017
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.maven2.repo;
+
+public class MessageHandler {
+ private String contentType;
+ private String className;
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+}
Propchange: axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/MessageHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis2/java/core/trunk/modules/transport/testkit/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/testkit/pom.xml?rev=1788995&r1=1788994&r2=1788995&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/testkit/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/transport/testkit/pom.xml Mon Mar 27 19:47:04 2017
@@ -164,6 +164,28 @@
<configuration>
<outputDirectory>${project.build.directory}/generated-resources/org/apache/axis2/transport/repo</outputDirectory>
<generateFileLists>true</generateFileLists>
+ <generatedAxis2xml>
+ <messageFormatters>
+ <messageFormatter>
+ <contentType>text/plain</contentType>
+ <className>org.apache.axis2.format.PlainTextFormatter</className>
+ </messageFormatter>
+ <messageFormatter>
+ <contentType>application/octet-stream</contentType>
+ <className>org.apache.axis2.format.BinaryFormatter</className>
+ </messageFormatter>
+ </messageFormatters>
+ <messageBuilders>
+ <messageBuilder>
+ <contentType>text/plain</contentType>
+ <className>org.apache.axis2.format.PlainTextBuilder</className>
+ </messageBuilder>
+ <messageBuilder>
+ <contentType>application/octet-stream</contentType>
+ <className>org.apache.axis2.format.BinaryBuilder</className>
+ </messageBuilder>
+ </messageBuilders>
+ </generatedAxis2xml>
</configuration>
</execution>
</executions>
Modified: axis/axis2/java/core/trunk/modules/transport/testkit/src/main/java/org/apache/axis2/transport/CustomAxisConfigurator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/testkit/src/main/java/org/apache/axis2/transport/CustomAxisConfigurator.java?rev=1788995&r1=1788994&r2=1788995&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/testkit/src/main/java/org/apache/axis2/transport/CustomAxisConfigurator.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/testkit/src/main/java/org/apache/axis2/transport/CustomAxisConfigurator.java Mon Mar 27 19:47:04 2017
@@ -21,7 +21,6 @@ package org.apache.axis2.transport;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import org.apache.axis2.AxisFault;
@@ -32,19 +31,16 @@ import org.apache.axis2.util.Loader;
public class CustomAxisConfigurator extends DeploymentEngine implements AxisConfigurator {
public AxisConfiguration getAxisConfiguration() throws AxisFault {
- InputStream configStream = Loader.getResourceAsStream("org/apache/axis2/transport/axis2.xml");
+ URL axis2Url = Loader.getResource("org/apache/axis2/transport/repo/axis2.xml");
try {
- axisConfig = populateAxisConfiguration(configStream);
- } finally {
+ InputStream configStream = axis2Url.openStream();
try {
+ axisConfig = populateAxisConfiguration(configStream);
+ } finally {
configStream.close();
- } catch (IOException ex) {
- throw AxisFault.makeFault(ex);
}
- }
- try {
- loadRepositoryFromURL(new URL(Loader.getResource("org/apache/axis2/transport/repo/__root__"), "."));
- } catch (MalformedURLException ex) {
+ loadRepositoryFromURL(new URL(axis2Url, "."));
+ } catch (IOException ex) {
throw AxisFault.makeFault(ex);
}
axisConfig.setConfigurator(this);