summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-http/src/main
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-21 03:55:14 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-21 03:55:14 +0000
commit81ea5409f4503940dde3197cdf0358b802dedc29 (patch)
tree20516114914a745e729ebb83d9e9a3a6997590da /java/sca/modules/binding-http/src/main
parentf577b23630be8301938ee15f72f7984a67285c13 (diff)
Cleaning up http binding model, removing non-used classes and policy related impls
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@817142 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-http/src/main')
-rw-r--r--java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java3
-rw-r--r--java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java47
-rw-r--r--java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java51
-rw-r--r--java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java53
-rw-r--r--java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java42
5 files changed, 37 insertions, 159 deletions
diff --git a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java
index 3a749c5f29..25c16b722e 100644
--- a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java
+++ b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.binding.http;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.assembly.BindingRRB;
@@ -28,4 +30,5 @@ import org.apache.tuscany.sca.assembly.BindingRRB;
* @version $Rev$ $Date$
*/
public interface HTTPBinding extends BindingRRB {
+ QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.http");
}
diff --git a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java
deleted file mode 100644
index f7e5bac606..0000000000
--- a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.tuscany.sca.binding.http;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * HTTP Binding Context
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingContext {
- private HttpServletRequest request;
- private HttpServletResponse response;
-
- public HttpServletRequest getHttpRequest() {
- return request;
- }
- public void setHttpRequest(HttpServletRequest request) {
- this.request = request;
- }
- public HttpServletResponse getHttpResponse() {
- return response;
- }
- public void setHttpResponse(HttpServletResponse response) {
- this.response = response;
- }
-
-}
diff --git a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
deleted file mode 100644
index 69e44cf35c..0000000000
--- a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.tuscany.sca.binding.http;
-
-public class HTTPHeader {
- private String name;
- private Object value;
-
- public HTTPHeader() {
-
- }
-
- public HTTPHeader(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
diff --git a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
index c902797a79..66d42c3965 100644
--- a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
+++ b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
@@ -19,16 +19,11 @@
package org.apache.tuscany.sca.binding.http.impl;
-import java.util.ArrayList;
-import java.util.List;
+import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.OperationSelector;
import org.apache.tuscany.sca.assembly.WireFormat;
import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
/**
@@ -36,19 +31,17 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
*
* @version $Rev$ $Date$
*/
-class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
+class HTTPBindingImpl implements HTTPBinding {
private String name;
private String uri;
private WireFormat wireFormat;
private OperationSelector operationSelector;
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ public QName getType() {
+ return TYPE;
+ }
public String getName() {
return name;
@@ -65,9 +58,8 @@ class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
public void setURI(String uri) {
this.uri = uri;
}
-
- public boolean isUnresolved() {
+ public boolean isUnresolved() {
return false;
}
@@ -75,7 +67,7 @@ class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
// The sample binding is always resolved
}
-// Wireformat and Operation selection
+ // Wireformat and Operation selection
public WireFormat getRequestWireFormat() {
return wireFormat;
@@ -101,39 +93,8 @@ class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
this.operationSelector = operationSelector;
}
- //Policy related getters/setters
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
-
}
diff --git a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
index 874c23c7e0..257e394039 100644
--- a/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
+++ b/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
@@ -29,26 +29,25 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.assembly.OperationSelector;
import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
-import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.binding.http.HTTPBinding;
import org.apache.tuscany.sca.binding.http.HTTPBindingFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<HTTPBinding> {
private static final String BINDING_HTTP = "binding.http";
- private static final QName BINDING_HTTP_QNAME = new QName(Constants.SCA10_TUSCANY_NS, BINDING_HTTP);
+ private static final QName BINDING_HTTP_QNAME = HTTPBinding.TYPE;
private static final String NAME = "name";
private static final String URI = "uri";
@@ -62,7 +61,7 @@ public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements S
StAXArtifactProcessor extensionProcessor,
StAXAttributeProcessor extensionAttributeProcessor,
Monitor monitor) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
this.httpBindingFactory = modelFactories.getFactory(HTTPBindingFactory.class);
this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
this.extensionAttributeProcessor = extensionAttributeProcessor;
@@ -108,7 +107,6 @@ public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements S
}
}
}
-
}
if (event == END_ELEMENT && BINDING_HTTP_QNAME.equals(reader.getName())) {
@@ -148,7 +146,21 @@ public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements S
// Should not need to do anything here for now...
}
-
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = monitor.createProblem(this.getClass().getName(), "binding-http-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
/**
* Report a error.
*
@@ -157,10 +169,10 @@ public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements S
* @param model
*/
private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
+ if (monitor != null) {
+ Problem problem = monitor.createProblem(this.getClass().getName(), "binding-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
}