summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-12 23:46:32 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-12 23:46:32 +0000
commit7daf165684aa788a13955206e77fe777fbed7f6f (patch)
tree4c76d7a3bf9880a688041cc2b85b069410e84470 /java
parent9b83ee182114c288675c2249da652df93a105dfe (diff)
Use the getQName from ServiceDeclarationParser
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@824541 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java29
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java29
2 files changed, 4 insertions, 54 deletions
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
index 0d2c7714ee..945be504be 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
@@ -35,6 +35,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDeclarationParser;
import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
@@ -129,32 +130,6 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends
}
/**
- * Returns a QName object from a QName expressed as {ns}name
- * or ns#name.
- *
- * @param qname
- * @return
- */
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: " + qname);
- }
-
- /**
* Lazily load artifact processors registered in the extension point.
*/
private synchronized void loadArtifactProcessors() {
@@ -178,7 +153,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends
// Load a StAX artifact processor
// Get the model QName
- QName artifactType = getQName(attributes.get("qname"));
+ QName artifactType = ServiceDeclarationParser.getQName(attributes.get("qname"));
// Get the model class name
String modelTypeName = attributes.get("model");
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
index 314f8ebf07..d13885bce9 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
@@ -35,6 +35,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDeclarationParser;
import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
@@ -123,32 +124,6 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends
}
/**
- * Returns a QName object from a QName expressed as {ns}name
- * or ns#name.
- *
- * @param qname
- * @return
- */
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: " + qname);
- }
-
- /**
* Lazily load artifact processors registered in the extension point.
*/
private synchronized void loadArtifactProcessors() {
@@ -172,7 +147,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends
// Load a StAX artifact processor
// Get the model QName
- QName artifactType = getQName(attributes.get("qname"));
+ QName artifactType = ServiceDeclarationParser.getQName(attributes.get("qname"));
// Get the model class name
String modelTypeName = attributes.get("model");