Author: richard.opalka(a)jboss.com
Date: 2012-12-20 06:44:19 -0500 (Thu, 20 Dec 2012)
New Revision: 17149
Modified:
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
Log:
[JBWS-3568] endpoint short name is derived from URL pattern
Modified:
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
===================================================================
---
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -30,15 +30,17 @@
private final boolean isDeclared;
public POJOEndpoint(final String name, final String className, final String
urlPattern) {
- super(name, className);
- this.urlPattern = urlPattern;
- isDeclared = true;
+ this(name, className, urlPattern, true);
}
public POJOEndpoint(final String className, final String urlPattern) {
- super(className, className);
+ this(className, className, urlPattern, false);
+ }
+
+ public POJOEndpoint(final String name, final String className, final String
urlPattern, boolean isDeclared) {
+ super(name, className);
this.urlPattern = urlPattern;
- this.isDeclared = false;
+ this.isDeclared = isDeclared;
}
public String getUrlPattern() {
Modified:
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
===================================================================
---
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss711/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -22,6 +22,7 @@
package org.jboss.as.webservices.publish;
import java.util.Map;
+import java.util.StringTokenizer;
import org.jboss.as.controller.PathElement;
import org.jboss.as.server.deployment.DeploymentUnit;
@@ -41,21 +42,50 @@
private String deploymentName;
public WSEndpointDeploymentUnit(ClassLoader loader, String context,
Map<String,String> urlPatternToClassName, WebservicesMetaData metadata) {
+ this(loader, context, urlPatternToClassName, new JBossWebMetaData(), metadata);
+ }
+
+ public WSEndpointDeploymentUnit(ClassLoader loader, String context, Map<String,
String> urlPatternToClassName,
+ JBossWebMetaData jbossWebMetaData, WebservicesMetaData metadata) {
this.deploymentName = context + ".deployment";
- JBossWebMetaData jbossWebMetaData = new JBossWebMetaData();
JAXWSDeployment jaxwsDeployment = new JAXWSDeployment();
+ if (jbossWebMetaData == null) {
+ jbossWebMetaData = new JBossWebMetaData();
+ }
jbossWebMetaData.setContextRoot(context);
+ String endpointName = null;
+ String className = null;
for (String urlPattern : urlPatternToClassName.keySet()) {
- addEndpoint(jbossWebMetaData, jaxwsDeployment,
urlPatternToClassName.get(urlPattern), urlPattern);
+ className = urlPatternToClassName.get(urlPattern);
+ endpointName = getShortName(className, urlPattern);
+ addEndpoint(jbossWebMetaData, jaxwsDeployment, endpointName, className,
urlPattern);
}
this.putAttachment(WSAttachmentKeys.CLASSLOADER_KEY, loader);
this.putAttachment(WSAttachmentKeys.JAXWS_ENDPOINTS_KEY, jaxwsDeployment);
this.putAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY, jbossWebMetaData);
- this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ if (metadata != null) {
+ this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ }
}
- private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String className, String urlPattern) {
+ private String getShortName(String className, String urlPattern) {
+ final StringTokenizer st = new StringTokenizer(urlPattern, "/*");
+ final StringBuilder sb = new StringBuilder();
+ String token = null;
+ boolean first = true;
+ while (st.hasMoreTokens()) {
+ token = st.nextToken();
+ if (token != null) {
+ if (!first) sb.append('.');
+ sb.append(token);
+ first = false;
+ }
+ }
+ return first ? className : sb.toString();
+ }
+
+ private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String endpointName, String className, String urlPattern) {
if (urlPattern == null) {
urlPattern = "/*";
} else {
@@ -64,7 +94,7 @@
urlPattern = "/" + urlPattern;
}
}
- jaxwsDeployment.addEndpoint(new POJOEndpoint(className, urlPattern));
+ jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, className, urlPattern,
false));
}
@Override
Modified:
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
===================================================================
---
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -30,15 +30,17 @@
private final boolean isDeclared;
public POJOEndpoint(final String name, final String className, final String
urlPattern) {
- super(name, className);
- this.urlPattern = urlPattern;
- isDeclared = true;
+ this(name, className, urlPattern, true);
}
public POJOEndpoint(final String className, final String urlPattern) {
- super(className, className);
+ this(className, className, urlPattern, false);
+ }
+
+ public POJOEndpoint(final String name, final String className, final String
urlPattern, boolean isDeclared) {
+ super(name, className);
this.urlPattern = urlPattern;
- this.isDeclared = false;
+ this.isDeclared = isDeclared;
}
public String getUrlPattern() {
Modified:
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
===================================================================
---
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss712/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -22,6 +22,7 @@
package org.jboss.as.webservices.publish;
import java.util.Map;
+import java.util.StringTokenizer;
import org.jboss.as.controller.PathElement;
import org.jboss.as.server.deployment.DeploymentUnit;
@@ -41,21 +42,50 @@
private String deploymentName;
public WSEndpointDeploymentUnit(ClassLoader loader, String context,
Map<String,String> urlPatternToClassName, WebservicesMetaData metadata) {
+ this(loader, context, urlPatternToClassName, new JBossWebMetaData(), metadata);
+ }
+
+ public WSEndpointDeploymentUnit(ClassLoader loader, String context, Map<String,
String> urlPatternToClassName,
+ JBossWebMetaData jbossWebMetaData, WebservicesMetaData metadata) {
this.deploymentName = context + ".deployment";
- JBossWebMetaData jbossWebMetaData = new JBossWebMetaData();
JAXWSDeployment jaxwsDeployment = new JAXWSDeployment();
+ if (jbossWebMetaData == null) {
+ jbossWebMetaData = new JBossWebMetaData();
+ }
jbossWebMetaData.setContextRoot(context);
+ String endpointName = null;
+ String className = null;
for (String urlPattern : urlPatternToClassName.keySet()) {
- addEndpoint(jbossWebMetaData, jaxwsDeployment,
urlPatternToClassName.get(urlPattern), urlPattern);
+ className = urlPatternToClassName.get(urlPattern);
+ endpointName = getShortName(className, urlPattern);
+ addEndpoint(jbossWebMetaData, jaxwsDeployment, endpointName, className,
urlPattern);
}
this.putAttachment(WSAttachmentKeys.CLASSLOADER_KEY, loader);
this.putAttachment(WSAttachmentKeys.JAXWS_ENDPOINTS_KEY, jaxwsDeployment);
this.putAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY, jbossWebMetaData);
- this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ if (metadata != null) {
+ this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ }
}
- private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String className, String urlPattern) {
+ private String getShortName(String className, String urlPattern) {
+ final StringTokenizer st = new StringTokenizer(urlPattern, "/*");
+ final StringBuilder sb = new StringBuilder();
+ String token = null;
+ boolean first = true;
+ while (st.hasMoreTokens()) {
+ token = st.nextToken();
+ if (token != null) {
+ if (!first) sb.append('.');
+ sb.append(token);
+ first = false;
+ }
+ }
+ return first ? className : sb.toString();
+ }
+
+ private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String endpointName, String className, String urlPattern) {
if (urlPattern == null) {
urlPattern = "/*";
} else {
@@ -64,7 +94,7 @@
urlPattern = "/" + urlPattern;
}
}
- jaxwsDeployment.addEndpoint(new POJOEndpoint(className, urlPattern));
+ jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, className, urlPattern,
false));
}
@Override
Modified:
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java
===================================================================
---
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/POJOEndpoint.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -30,15 +30,17 @@
private final boolean isDeclared;
public POJOEndpoint(final String name, final String className, final String
urlPattern) {
- super(name, className);
- this.urlPattern = urlPattern;
- isDeclared = true;
+ this(name, className, urlPattern, true);
}
public POJOEndpoint(final String className, final String urlPattern) {
- super(className, className);
+ this(className, className, urlPattern, false);
+ }
+
+ public POJOEndpoint(final String name, final String className, final String
urlPattern, boolean isDeclared) {
+ super(name, className);
this.urlPattern = urlPattern;
- this.isDeclared = false;
+ this.isDeclared = isDeclared;
}
public String getUrlPattern() {
Modified:
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java
===================================================================
---
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-19
17:19:35 UTC (rev 17148)
+++
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/publish/WSEndpointDeploymentUnit.java 2012-12-20
11:44:19 UTC (rev 17149)
@@ -22,6 +22,7 @@
package org.jboss.as.webservices.publish;
import java.util.Map;
+import java.util.StringTokenizer;
import org.jboss.as.controller.PathElement;
import org.jboss.as.server.deployment.DeploymentUnit;
@@ -41,21 +42,50 @@
private String deploymentName;
public WSEndpointDeploymentUnit(ClassLoader loader, String context,
Map<String,String> urlPatternToClassName, WebservicesMetaData metadata) {
+ this(loader, context, urlPatternToClassName, new JBossWebMetaData(), metadata);
+ }
+
+ public WSEndpointDeploymentUnit(ClassLoader loader, String context, Map<String,
String> urlPatternToClassName,
+ JBossWebMetaData jbossWebMetaData, WebservicesMetaData metadata) {
this.deploymentName = context + ".deployment";
- JBossWebMetaData jbossWebMetaData = new JBossWebMetaData();
JAXWSDeployment jaxwsDeployment = new JAXWSDeployment();
+ if (jbossWebMetaData == null) {
+ jbossWebMetaData = new JBossWebMetaData();
+ }
jbossWebMetaData.setContextRoot(context);
+ String endpointName = null;
+ String className = null;
for (String urlPattern : urlPatternToClassName.keySet()) {
- addEndpoint(jbossWebMetaData, jaxwsDeployment,
urlPatternToClassName.get(urlPattern), urlPattern);
+ className = urlPatternToClassName.get(urlPattern);
+ endpointName = getShortName(className, urlPattern);
+ addEndpoint(jbossWebMetaData, jaxwsDeployment, endpointName, className,
urlPattern);
}
this.putAttachment(WSAttachmentKeys.CLASSLOADER_KEY, loader);
this.putAttachment(WSAttachmentKeys.JAXWS_ENDPOINTS_KEY, jaxwsDeployment);
this.putAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY, jbossWebMetaData);
- this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ if (metadata != null) {
+ this.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, metadata);
+ }
}
- private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String className, String urlPattern) {
+ private String getShortName(String className, String urlPattern) {
+ final StringTokenizer st = new StringTokenizer(urlPattern, "/*");
+ final StringBuilder sb = new StringBuilder();
+ String token = null;
+ boolean first = true;
+ while (st.hasMoreTokens()) {
+ token = st.nextToken();
+ if (token != null) {
+ if (!first) sb.append('.');
+ sb.append(token);
+ first = false;
+ }
+ }
+ return first ? className : sb.toString();
+ }
+
+ private void addEndpoint(JBossWebMetaData jbossWebMetaData, JAXWSDeployment
jaxwsDeployment, String endpointName, String className, String urlPattern) {
if (urlPattern == null) {
urlPattern = "/*";
} else {
@@ -64,7 +94,7 @@
urlPattern = "/" + urlPattern;
}
}
- jaxwsDeployment.addEndpoint(new POJOEndpoint(className, urlPattern));
+ jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, className, urlPattern,
false));
}
@Override