Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,257 @@
+/*
+ * 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 java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * A class to store cache settings for Atom and HTTP requests and responses.
+ * 
+ * Predicates are statements that work in conjunction with
+ * ETags and LastModified dates to determine if a precondition
+ * or postcondition is satisfied.
+ * See HTTP specification for how predicates wrk:
+ * http://tools.ietf.org/html/rfc2616
+ * Example predicates in HTTP include If-Match, If-None-Match,
+ * If-Modified-Since, If-Unmodified-Since, If-Range.
+
+ */
+public class HTTPCacheContext {
+    public static final SimpleDateFormat RFC822DateFormat = new 
SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
+    
+    public boolean enabled;
+       public String eTag;
+       public String lastModified;
+       public Date lastModifiedDate;
+       public boolean ifModifiedSince;
+       public boolean ifUnmodifiedSince;
+       public boolean ifMatch;
+       public boolean ifNoneMatch;
+       public boolean ifRange;
+
+       /**
+        * An ETag is a unique ID for an item. It changes when
+        * a field in the item or the update date changes.
+        * See HTTP specification for how ETags work:
+        * http://tools.ietf.org/html/rfc2616
+        * @return the eTag
+        */
+       public String getETag() {
+               return eTag;
+       }
+       /**
+        * @param tag the eTag to set
+        */
+       public void setETag(String tag) {
+               eTag = tag;
+               enabled = true;
+       }
+       /**
+        * The LastModified date is the time the item was last 
+        * changed. See HTTP specification for how ETags work:
+        * http://tools.ietf.org/html/rfc2616
+        * @return the lastModified
+        */
+       public String getLastModified() {
+               return lastModified;
+       }
+       /**
+        * The LastModified date is the time the item was last 
+        * changed. See HTTP specification for how ETags work:
+        * http://tools.ietf.org/html/rfc2616
+        * @return the lastModified
+        */
+       public Date getLastModifiedAsDate() {
+               return lastModifiedDate;
+       }
+       /**
+        * @param lastModified the lastModified to set
+        */
+       public void setLastModified(String lastModified) throws 
java.text.ParseException {
+               this.lastModified = lastModified;
+               // Catch date formatting on input to help debugging.
+               lastModifiedDate = RFC822DateFormat.parse( lastModified );
+               enabled = true;
+       }
+       
+       /**
+        * @param lastModified the lastModified to set
+        */
+       public void setLastModified(Date updated) {
+               this.lastModified = RFC822DateFormat.format( updated );
+               lastModifiedDate = updated;
+               enabled = true;
+       }
+       
+       /**
+        * @return the ifModifedSince
+        */
+       public boolean isIfModifiedSince() {
+               return ifModifiedSince;
+       }
+       /**
+        * @param ifModifedSince the ifModifedSince to set
+        */
+       public void setIfModifiedSince(boolean ifModifiedSince) {
+               this.ifModifiedSince = ifModifiedSince;
+               if ( ifModifiedSince )
+                       enabled = true;
+       }
+       /**
+        * @return the ifUnModifiedSince
+        */
+       public boolean isIfUnmodifiedSince() {
+               return ifUnmodifiedSince;
+       }
+       /**
+        * @param ifUnModifiedSince the ifUnModifiedSince to set
+        */
+       public void setIfUnmodifiedSince(boolean ifUnmodifiedSince) {
+               this.ifUnmodifiedSince = ifUnmodifiedSince;
+               if ( ifUnmodifiedSince )
+                       enabled = true;
+       }
+       /**
+        * @return the ifMatch
+        */
+       public boolean isIfMatch() {
+               return ifMatch;
+       }
+       /**
+        * @param ifMatch the ifMatch to set
+        */
+       public void setIfMatch(boolean ifMatch) {
+               this.ifMatch = ifMatch;
+               if ( ifMatch )
+                       enabled = true;
+       }
+       /**
+        * @return the ifNoneMatch
+        */
+       public boolean isIfNoneMatch() {
+               return ifNoneMatch;
+       }
+       /**
+        * @param ifNoneMatch the ifNoneMatch to set
+        */
+       public void setIfNoneMatch(boolean ifNoneMatch) {
+               this.ifNoneMatch = ifNoneMatch;
+               if ( ifNoneMatch )
+                       enabled = true;
+       }
+       /**
+        * @return the ifRange
+        */
+       public boolean isIfRange() {
+               return ifRange;
+       }
+       /**
+        * @param ifRange the ifRange to set
+        */
+       public void setIfRange(boolean ifRange) {
+               this.ifRange = ifRange;
+               if ( ifRange )
+                       enabled = true;
+       }
+
+    public String toString() {
+       final String PREDPREFIX = ", predicates=";
+               StringBuffer sb = new StringBuffer(PREDPREFIX);
+               if ( ifMatch || ifNoneMatch || ifModifiedSince || 
ifUnmodifiedSince || ifRange ) {
+                       if ( ifMatch ) {
+                               if ( sb.length() > PREDPREFIX.length() ) 
sb.append( ", ");
+                               sb.append("If-Match");
+                       }
+                       if ( ifNoneMatch ) {
+                               if ( sb.length() > PREDPREFIX.length() ) 
sb.append( ", ");
+                               sb.append("If-None-Match");
+                       }
+                       if ( ifModifiedSince ) {
+                               if ( sb.length() > PREDPREFIX.length() ) 
sb.append( ", ");
+                               sb.append("If-Modified-Since");
+                       }
+                       if ( ifUnmodifiedSince ) {
+                               if ( sb.length() > PREDPREFIX.length() ) 
sb.append( ", ");
+                               sb.append("If-UnModified-Since");
+                       }
+                       if ( ifRange ) {
+                               if ( sb.length() > PREDPREFIX.length() ) 
sb.append( ", ");
+                               sb.append("If-Range");
+                       }
+               } else {
+                       sb.append("null");
+               }
+
+               return "eTag=" + eTag + ", lastModified=" + lastModified
+                               + sb.toString();
+       }
+
+    /**
+     * Gets the cache context information (ETag, LastModified, predicates) 
from the Http request.
+     * @param request
+     * @return
+     */
+    public static HTTPCacheContext getCacheContextFromRequest( 
HttpServletRequest request ) throws java.text.ParseException {
+       HTTPCacheContext context = new HTTPCacheContext();
+       
+       String eTag = request.getHeader( "If-Match" );          
+       if ( eTag != null ) {
+          context.setETag( eTag );
+          context.setIfMatch( true );
+       }
+       eTag = request.getHeader( "If-None-Match" );            
+       if ( eTag != null ) {
+          context.setETag( eTag );
+          context.setIfNoneMatch( true );
+       }
+        String lastModifiedString = request.getHeader( "If-Modified-Since" );  
      
+       if ( lastModifiedString != null ) {
+          context.setLastModified( lastModifiedString );
+          context.setIfModifiedSince( true );
+       }
+        lastModifiedString = request.getHeader( "If-Unmodified-Since" );       
 
+       if ( lastModifiedString != null ) {
+          context.setLastModified( lastModifiedString );
+          context.setIfUnmodifiedSince( true );
+       }
+        lastModifiedString = request.getHeader( "If-Range" );        
+       if ( lastModifiedString != null ) {
+          context.setLastModified( lastModifiedString );
+          context.setIfRange( true );
+       }
+       return context;
+    }
+       /**
+        * Enabled is true whenever ETag, LastModified, or predicate is set.
+        * @return the enabled
+        */
+       public boolean isEnabled() {
+               return enabled;
+       }
+       /**
+        * @param enabled the enabled to set
+        */
+       public void setEnabled(boolean enabled) {
+               this.enabled = enabled;
+       }
+}

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,51 @@
+/*
+ * 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;
+    }
+
+}

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.impl;
+
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import org.apache.tuscany.sca.binding.http.HTTPBindingFactory;
+
+/**
+ * Factory for the HTTP binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPBindingFactoryImpl implements HTTPBindingFactory {
+
+    public HTTPBinding createHTTPResourceBinding() {
+        return new HTTPBindingImpl();
+    }
+
+}

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,108 @@
+/*
+ * 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.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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;
+
+
+/**
+ * Implementation of the HTTP binding model.
+ * 
+ * @version $Rev$ $Date$
+ */
+class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
+    
+    private String name;
+    private String uri;
+    
+    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 String getName() {
+        return name;
+    }
+
+    public String getURI() {
+        return uri;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setURI(String uri) {
+        this.uri = uri;
+    }
+
+    
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        // The sample binding is always resolved
+    }
+    
+    //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();
+    }     
+
+}

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,19 @@
+# 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. 
+
+# Implementation class for model factory
+org.apache.tuscany.sca.binding.http.impl.HTTPBindingFactoryImpl

Added: 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=767775&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 (added)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-oasis/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 Thu Apr 23 03:53:15 2009
@@ -0,0 +1,19 @@
+# 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. 
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.http,model=org.apache.tuscany.sca.binding.http.HTTPBinding,factory=org.apache.tuscany.sca.binding.http.HTTPBindingFactory

Modified: tuscany/branches/sca-java-1.x/modules/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/pom.xml?rev=767775&r1=767774&r2=767775&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/pom.xml (original)
+++ tuscany/branches/sca-java-1.x/modules/pom.xml Thu Apr 23 03:53:15 2009
@@ -48,8 +48,8 @@
                 <module>binding-dwr</module>
                 <module>binding-ejb</module>
                 <module>binding-ejb-runtime</module>
-               <module>binding-erlang</module>
-               <module>binding-erlang-runtime</module>
+                <module>binding-erlang</module>
+                <module>binding-erlang-runtime</module>
                 <!-- obsolete -->
                 <module>binding-feed</module>
                 <!-- new bindings -->
@@ -61,6 +61,8 @@
                 <module>binding-gdata-runtime</module>
                 <module>binding-http</module>
                 <module>binding-http-runtime</module>
+                <module>binding-http-oasis</module>
+                <module>binding-http-oasis-runtime</module>
                 <module>binding-jms</module>
                 <module>binding-jms-runtime</module>
                 <module>binding-jms-policy</module>


Reply via email to