You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by pd...@apache.org on 2006/08/08 20:26:04 UTC
svn commit: r429759 - in /incubator/servicemix/trunk:
servicemix-common/src/main/java/org/apache/servicemix/common/packaging/
servicemix-common/src/main/java/org/apache/servicemix/common/xbean/
servicemix-http/src/main/java/org/apache/servicemix/http/p...
Author: pdodds
Date: Tue Aug 8 11:26:03 2006
New Revision: 429759
URL: http://svn.apache.org/viewvc?rev=429759&view=rev
Log:
Implemented basic infrastructure for generating the services element of a service unit.
Added:
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalyzer.java
- copied, changed from r429390, incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalzyer.java
Removed:
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalzyer.java
Modified:
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/packaging/Consumes.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/packaging/HttpServiceUnitAnalyzer.java
incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java
incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java
incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java
Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/packaging/Consumes.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/packaging/Consumes.java?rev=429759&r1=429758&r2=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/packaging/Consumes.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/packaging/Consumes.java Tue Aug 8 11:26:03 2006
@@ -74,4 +74,8 @@
public void setServiceName(QName serviceName) {
this.serviceName = serviceName;
}
+
+ public boolean isValid() {
+ return (getInterfaceName() != null || getEndpointName() != null || getServiceName() != null);
+ }
}
Copied: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalyzer.java (from r429390, incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalzyer.java)
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalyzer.java?p2=incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalyzer.java&p1=incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalzyer.java&r1=429390&r2=429759&rev=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalzyer.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanServiceUnitAnalyzer.java Tue Aug 8 11:26:03 2006
@@ -20,13 +20,14 @@
import java.util.ArrayList;
import java.util.List;
+import javax.jbi.messaging.MessageExchange;
+
import org.apache.servicemix.common.Endpoint;
import org.apache.servicemix.common.packaging.Provides;
import org.apache.servicemix.common.packaging.ServiceUnitAnalyzer;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.FileSystemResource;
+import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
-public abstract class AbstractXBeanServiceUnitAnalzyer implements
+public abstract class AbstractXBeanServiceUnitAnalyzer implements
ServiceUnitAnalyzer {
List consumes = new ArrayList();
@@ -53,12 +54,17 @@
return provides;
}
- protected Provides getProvides(Endpoint endpoint) {
- Provides newProvide = new Provides();
- newProvide.setEndpointName(endpoint.getEndpoint());
- newProvide.setInterfaceName(endpoint.getInterfaceName());
- newProvide.setServiceName(endpoint.getService());
- return newProvide;
+ protected List getProvides(Endpoint endpoint) {
+ List providesList = new ArrayList();
+ if (endpoint.getRole().equals(MessageExchange.Role.PROVIDER)) {
+ Provides newProvide = new Provides();
+ newProvide.setEndpointName(endpoint.getEndpoint());
+ newProvide.setInterfaceName(endpoint.getInterfaceName());
+ newProvide.setServiceName(endpoint.getService());
+ providesList.add(newProvide);
+ }
+
+ return providesList;
}
protected abstract String getXBeanFile();
@@ -69,16 +75,17 @@
* @see org.apache.servicemix.common.packaging.ServiceUnitAnalyzer#init(java.io.File)
*/
public void init(File explodedServiceUnitRoot) {
- XmlBeanFactory factory = new XmlBeanFactory(new FileSystemResource(
- new File(explodedServiceUnitRoot, getXBeanFile())));
+ FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(
+ explodedServiceUnitRoot.getAbsolutePath() + "/"
+ + getXBeanFile());
- for (int i = 0; i < factory.getBeanDefinitionNames().length; i++) {
- Object bean = factory.getBean(factory.getBeanDefinitionNames()[i]);
+ for (int i = 0; i < context.getBeanDefinitionNames().length; i++) {
+ Object bean = context.getBean(context.getBeanDefinitionNames()[i]);
if (isValidEndpoint(bean)) {
// The provides are generic while the consumes need to
// be handled by the implementation
Endpoint endpoint = (Endpoint) bean;
- provides.add(getProvides(endpoint));
+ provides.addAll(getProvides(endpoint));
consumes.addAll(getConsumes(endpoint));
}
}
Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/packaging/HttpServiceUnitAnalyzer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/packaging/HttpServiceUnitAnalyzer.java?rev=429759&r1=429758&r2=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/packaging/HttpServiceUnitAnalyzer.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/packaging/HttpServiceUnitAnalyzer.java Tue Aug 8 11:26:03 2006
@@ -1,16 +1,65 @@
+/*
+ * 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.servicemix.http.packaging;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import javax.jbi.messaging.MessageExchange;
+
import org.apache.servicemix.common.Endpoint;
-import org.apache.servicemix.common.xbean.AbstractXBeanServiceUnitAnalzyer;
+import org.apache.servicemix.common.packaging.Consumes;
+import org.apache.servicemix.common.packaging.ServiceUnitAnalyzer;
+import org.apache.servicemix.common.xbean.AbstractXBeanServiceUnitAnalyzer;
import org.apache.servicemix.http.HttpEndpoint;
-public class HttpServiceUnitAnalyzer extends AbstractXBeanServiceUnitAnalzyer {
+/**
+ * Implementation of the ServiceUnitAnalyzer can be used in tooling to provide a
+ * way to parse the artifact for the service unit and provide a list of consumes
+ * and provides
+ *
+ * @author Philip Dodds
+ * @since 3.0
+ * @see ServiceUnitAnalyzer, {@link ServiceUnitAnalyzer}
+ *
+ */
+public class HttpServiceUnitAnalyzer extends AbstractXBeanServiceUnitAnalyzer {
protected List getConsumes(Endpoint endpoint) {
- return new ArrayList();
+ List consumesList = new ArrayList();
+ Consumes consumes;
+ if (endpoint.getRole().equals(MessageExchange.Role.CONSUMER)) {
+ consumes = new Consumes();
+ consumes = new Consumes();
+ consumes.setEndpointName(endpoint.getEndpoint());
+ consumes.setInterfaceName(endpoint.getInterfaceName());
+ consumes.setServiceName(endpoint.getService());
+ consumesList.add(consumes);
+ }
+ HttpEndpoint httpEndpoint = (HttpEndpoint) endpoint;
+ consumes = new Consumes();
+ consumes.setEndpointName(httpEndpoint.getTargetEndpoint());
+ consumes.setInterfaceName(httpEndpoint.getTargetInterfaceName());
+ consumes.setServiceName(httpEndpoint.getTargetService());
+ if (consumes.isValid())
+ consumesList.add(consumes);
+
+ return consumesList;
}
protected String getXBeanFile() {
Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java?rev=429759&r1=429758&r2=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java Tue Aug 8 11:26:03 2006
@@ -27,9 +27,16 @@
import java.util.Set;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
import org.apache.servicemix.common.packaging.ServiceUnitAnalyzer;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
* A Mojo used to build the jbi.xml file for a service unit.
@@ -54,6 +61,13 @@
private Boolean generateJbiDescriptor = Boolean.TRUE;
/**
+ * Determines whether to use the service unit analyzer
+ *
+ * @parameter
+ */
+ private Boolean useServiceUnitAnalyzer = Boolean.TRUE;
+
+ /**
* The component name.
*
* @parameter expression="${project.artifactId}"
@@ -81,6 +95,28 @@
*/
private String generatedDescriptorLocation;
+ /**
+ * Directory where artifacts for the service unit are held
+ *
+ * @parameter expression="${basedir}/src/main/resources"
+ */
+ private File serviceUnitArtifactsDir;
+
+ /**
+ * @component
+ */
+ private MavenProjectBuilder pb;
+
+ /**
+ * @parameter default-value="${localRepository}"
+ */
+ private ArtifactRepository localRepo;
+
+ /**
+ * @parameter default-value="${project.remoteArtifactRepositories}"
+ */
+ private List remoteRepos;
+
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug(
@@ -109,10 +145,6 @@
}
- private void buildConnections() {
-
- }
-
/**
* Set up a classloader for the execution of the main class.
*
@@ -138,7 +170,7 @@
while (iter.hasNext()) {
Artifact classPathElement = (Artifact) iter.next();
getLog().debug(
- "Adding artifact: " + classPathElement.getArtifactId()
+ "Adding artifact: " + classPathElement.getFile()
+ " to classpath");
urls.add(classPathElement.getFile().toURL());
}
@@ -161,26 +193,99 @@
outputDir.mkdirs();
}
- File descriptor = new File(outputDir, JBI_DESCRIPTOR);
-
- List uris = new ArrayList();
-
- JbiServiceUnitDescriptorWriter writer = new JbiServiceUnitDescriptorWriter(
- encoding);
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+
+ try {
+ URLClassLoader newClassLoader = getClassLoader();
+ Thread.currentThread().setContextClassLoader(newClassLoader);
+ File descriptor = new File(outputDir, JBI_DESCRIPTOR);
+ List uris = new ArrayList();
+ JbiServiceUnitDescriptorWriter writer = new JbiServiceUnitDescriptorWriter(
+ encoding);
+
+ List consumes = new ArrayList();
+ List provides = new ArrayList();
+
+ if (useServiceUnitAnalyzer.booleanValue()) {
+ String serviceUnitAnalyzerClazzName = getServiceUnitAnalyzer();
+
+ // The ServiceUnitAnalyzer should give us the consumes and
+ // provides
+ if (serviceUnitAnalyzerClazzName != null) {
+ ServiceUnitAnalyzer serviceUnitAnalyzer = (ServiceUnitAnalyzer) newClassLoader
+ .loadClass(serviceUnitAnalyzerClazzName)
+ .newInstance();
+ getLog().info(
+ "Created Service Unit Analyzer "
+ + serviceUnitAnalyzer);
+ serviceUnitAnalyzer.init(serviceUnitArtifactsDir);
+ consumes.addAll(serviceUnitAnalyzer.getConsumes());
+ provides.addAll(serviceUnitAnalyzer.getProvides());
+ }
+
+ getLog().info(
+ "generated : consumes " + consumes + " provides "
+ + provides);
- ServiceUnitAnalyzer serviceUnitAnalyzer = getServiceUnitAnalyzer();
- List consumes = new ArrayList();
- List provides = new ArrayList();
- if (serviceUnitAnalyzer != null) {
- consumes.addAll(serviceUnitAnalyzer.getConsumes());
- provides.addAll(serviceUnitAnalyzer.getProvides());
+ }
+ writer.write(descriptor, name, description, uris, consumes,
+ provides);
+ } catch (Exception e) {
+ throw new JbiPluginException(
+ "Unable to generate service unit descriptor!", e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
}
+ }
- writer.write(descriptor, name, description, uris);
+ private String getServiceUnitAnalyzer() {
+ MavenProject project = getComponentProject();
+ if (project != null) {
+ List plugins = project.getBuild().getPlugins();
+ for (Iterator iterator = plugins.iterator(); iterator.hasNext();) {
+ Plugin plugin = (Plugin) iterator.next();
+ if ("org.apache.servicemix.tooling".equals(plugin.getGroupId())
+ && "jbi-maven-plugin".equals(plugin.getArtifactId())) {
+ Xpp3Dom o = (Xpp3Dom) plugin.getConfiguration();
+ if (o != null && o.getChild("serviceUnitAnalyzer") != null) {
+ String clazzName = o.getChild("serviceUnitAnalyzer")
+ .getValue();
+ return clazzName;
+ }
+ }
+ }
+ }
+ return null;
}
- private ServiceUnitAnalyzer getServiceUnitAnalyzer() {
- // TODO Auto-generated method stub
+ private MavenProject getComponentProject() {
+ Set artifacts = project.getArtifacts();
+ for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
+ Artifact artifact = (Artifact) iter.next();
+
+ // TODO: utilise appropriate methods from project builder
+ ScopeArtifactFilter filter = new ScopeArtifactFilter(
+ Artifact.SCOPE_RUNTIME);
+ if (!artifact.isOptional() && filter.include(artifact)
+ && (artifact.getDependencyTrail().size() == 2)) {
+ MavenProject project = null;
+ try {
+ project = pb.buildFromRepository(artifact, remoteRepos,
+ localRepo);
+ } catch (ProjectBuildingException e) {
+ getLog().warn(
+ "Unable to determine packaging for dependency : "
+ + artifact.getArtifactId()
+ + " assuming jar");
+ }
+ if ((project != null)
+ && (project.getPackaging().equals("jbi-component"))) {
+ return project;
+ }
+
+ }
+ }
return null;
}
+
}
Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java?rev=429759&r1=429758&r2=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java Tue Aug 8 11:26:03 2006
@@ -45,7 +45,7 @@
+ descriptor.getAbsolutePath() + "]", ex);
}
- XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
+ XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
writer.startElement("jbi");
writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
writer.addAttribute("version", "1.0");
Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java?rev=429759&r1=429758&r2=429759&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java Tue Aug 8 11:26:03 2006
@@ -20,15 +20,21 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.common.packaging.Consumes;
+import org.apache.servicemix.common.packaging.Provides;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;
/**
* Helper that is used to write the jbi.xml for a service unit
- *
+ *
*/
public class JbiServiceUnitDescriptorWriter {
@@ -38,11 +44,8 @@
this.encoding = encoding;
}
- public void write(File descriptor,
- String name,
- String description,
- List uris)
- throws JbiPluginException {
+ public void write(File descriptor, String name, String description,
+ List uris, List consumes, List provides) throws JbiPluginException {
FileWriter w;
try {
w = new FileWriter(descriptor);
@@ -55,15 +58,109 @@
writer.startElement("jbi");
writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
writer.addAttribute("version", "1.0");
-
+
writer.startElement("services");
+
+ // We need to get all the namespaces into a hashmap so we
+ // can get the QName output correctly
+ Map namespaceMap = getNamespaceMap(provides, consumes);
+
+ // Set-up the namespaces
+ for (Iterator iterator = namespaceMap.keySet().iterator(); iterator
+ .hasNext();) {
+ String key = (String) iterator.next();
+ StringBuffer namespaceDecl = new StringBuffer();
+ namespaceDecl.append("xmlns:");
+ namespaceDecl.append(namespaceMap.get(key));
+ writer.addAttribute(namespaceDecl.toString(), key);
+ }
+
+ // Put in the provides
+ for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
+ Provides providesEntry = (Provides) iterator.next();
+ writer.startElement("provides");
+ addQNameAttribute(writer, "interface-name", providesEntry
+ .getInterfaceName(), namespaceMap);
+ addQNameAttribute(writer, "service-name", providesEntry
+ .getServiceName(), namespaceMap);
+ addStringAttribute(writer, "endpoint-name", providesEntry
+ .getEndpointName());
+ writer.endElement();
+ }
+
+ // Put in the consumes
+ for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
+ Consumes consumesEntry = (Consumes) iterator.next();
+ writer.startElement("consumes");
+ addQNameAttribute(writer, "interface-name", consumesEntry
+ .getInterfaceName(), namespaceMap);
+ addQNameAttribute(writer, "service-name", consumesEntry
+ .getServiceName(), namespaceMap);
+ addStringAttribute(writer, "endpoint-name", consumesEntry
+ .getEndpointName());
+
+ // TODO Handling of LinkType?
+
+ writer.endElement();
+ }
+
writer.endElement();
-
+
writer.endElement();
close(w);
}
-
+
+ private void addStringAttribute(XMLWriter writer, String attributeName,
+ String attributeValue) {
+ if (attributeValue != null)
+ writer.addAttribute(attributeName, attributeValue);
+ }
+
+ private void addQNameAttribute(XMLWriter writer, String attributeName,
+ QName attributeValue, Map namespaceMap) {
+ System.out.println("attributeName="+attributeValue);
+ if (attributeValue != null) {
+ StringBuffer attributeStringValue = new StringBuffer();
+ attributeStringValue.append(namespaceMap.get(attributeValue
+ .getNamespaceURI()));
+ attributeStringValue.append(":");
+ attributeStringValue.append(attributeValue.getLocalPart());
+ writer.addAttribute(attributeName, attributeStringValue.toString());
+ }
+
+ }
+
+ private Map getNamespaceMap(List provides, List consumes) {
+ Map namespaceMap = new HashMap();
+ int namespaceCounter = 1;
+ for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
+ Provides providesEntry = (Provides) iterator.next();
+ resolveMapEntry(namespaceMap, providesEntry.getInterfaceName(),
+ namespaceCounter);
+ resolveMapEntry(namespaceMap, providesEntry.getServiceName(),
+ namespaceCounter);
+ }
+
+ for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
+ Consumes consumesEntry = (Consumes) iterator.next();
+ resolveMapEntry(namespaceMap, consumesEntry.getInterfaceName(),
+ namespaceCounter);
+ resolveMapEntry(namespaceMap, consumesEntry.getServiceName(),
+ namespaceCounter);
+ }
+
+ return namespaceMap;
+ }
+
+ private void resolveMapEntry(Map namespaceMap, QName qname,
+ int namespaceCounter) {
+ if ((qname != null)
+ && (!namespaceMap.containsKey(qname.getNamespaceURI()))) {
+ namespaceMap.put(qname.getNamespaceURI(), qname.getPrefix());
+ }
+ }
+
private void close(Writer closeable) {
if (closeable != null) {
try {