tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r718858 [3/9] - in /tuscany/java/sca/modules: ./ assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/resource...
Date Wed, 19 Nov 2008 05:28:12 GMT
Modified: tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java (original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java Tue Nov 18 21:27:58 2008
@@ -51,20 +51,33 @@
 
     private static final QName ATTRIBUTE = new QName("http://test", "customAttribute");
     
+    // implementation.java for CalculatorServiceComponent appears in a strange place as the
+    // java implementation extension is not loaded and hence they are loaded as any elements
     private static final String XML = "<?xml version='1.0' encoding='UTF-8'?>"+
-                         "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\">"+
-                         "<service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\" />"+
-                         "<component name=\"CalculatorServiceComponent\" customAttribute=\"customValue\">"+
-                                "<reference name=\"addService\" target=\"AddServiceComponent\" />"+
-                                "<reference name=\"subtractService\" target=\"SubtractServiceComponent\" />"+
-                                "<reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" />"+
-                                "<reference name=\"divideService\" target=\"DivideServiceComponent\" />"+
-                         "</component>"+
-                         "<component name=\"AddServiceComponent\" />"+
-                         "<component name=\"SubtractServiceComponent\" />"+
-                         "<component name=\"MultiplyServiceComponent\" />"+
-                         "<component name=\"DivideServiceComponent\" />"+
-                         "</composite>";
+		 	 "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\">"+
+		 	 "<service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\">"+
+		 	 	"<interface.java interface=\"calculator.CalculatorService\" />"+
+	 	 	 "</service>"+
+	 	 	 "<component name=\"CalculatorServiceComponent\" customAttribute=\"customValue\">"+
+	 	 	    "<implementation.java class=\"calculator.CalculatorServiceImpl\" />"+
+	 	 	 	"<reference name=\"addService\" target=\"AddServiceComponent\" />"+
+	 	 	 	"<reference name=\"subtractService\" target=\"SubtractServiceComponent\" />"+
+	 	 	 	"<reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" />"+
+	 	 	 	"<reference name=\"divideService\" target=\"DivideServiceComponent\" />"+
+ 	 	 	 "</component>"+
+ 	 	 	 "<component name=\"AddServiceComponent\">"+
+ 	 	 	    "<implementation.java class=\"calculator.AddServiceImpl\" />"+
+ 	 	 	 "</component>"+
+ 	 	 	 "<component name=\"SubtractServiceComponent\">"+
+ 	 	 	    "<implementation.java class=\"calculator.SubtractServiceImpl\" />"+
+ 	 	 	 "</component>"+
+ 	 	 	 "<component name=\"MultiplyServiceComponent\">"+
+ 	 	 	    "<implementation.java class=\"calculator.MultiplyServiceImpl\" />"+
+ 	 	 	 "</component>"+
+ 	 	 	 "<component name=\"DivideServiceComponent\">"+
+ 	 	 	    "<implementation.java class=\"calculator.DivideServiceImpl\" />"+
+ 	 	 	 "</component>"+
+ 	 	 	 "</composite>";
     
     @BeforeClass
     public static void setUp() throws Exception {
@@ -75,7 +88,6 @@
         StAXAttributeProcessorExtensionPoint staxAttributeProcessors = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
         staxAttributeProcessors.addArtifactProcessor(new TestAttributeProcessor());
         
-        
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
     }
 

Modified: tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite (original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite Tue Nov 18 21:27:58 2008
@@ -22,13 +22,14 @@
 	xmlns:calc="http://calc"
 	targetNamespace="http://calc"
 	name="Calculator">
-
-    <service name="CalculatorService" promote="CalculatorServiceComponent">
+	
+	<service name="CalculatorService" promote="CalculatorServiceComponent">
         <interface.java interface="calculator.CalculatorService"/>
     </service>
+    
     <component name="CalculatorServiceComponent">
 		<implementation.java class="calculator.CalculatorServiceImpl"/>
-        <reference name="addService" target="AddServiceComponent"/>
+        <reference name="addService"  multiplicity="0..1" target="AddServiceComponent"/>
         <reference name="subtractService" target="SubtractServiceComponent"/>
         <reference name="multiplyService" target="MultiplyServiceComponent"/>
         <reference name="divideService" target="DivideServiceComponent"/>
@@ -51,9 +52,8 @@
     </component>
     
     <x:unknownElement uknAttr="attribute1">
-		<x:subUnknownElement1 uknAttr1="attribute1"/>
-		<x:subUnknownElement2/>
+		<y:subUnknownElement1 xmlns:y="http://y" uknAttr1="attribute2"/>
+		<x:subUnknownElement2 />
 	</x:unknownElement>
-
-
+		
 </composite>

Modified: tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType (original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType Tue Nov 18 21:27:58 2008
@@ -26,9 +26,9 @@
         <interface.java class="calculator.CalculatorService" />
   </service>
 
-  <reference name="divideService">
+  <reference name="divideService" multiplicity="1..1">
         <interface.java class="calculator.DivideService" />
   </reference>  
 
 </constrainingType>              
-       
\ No newline at end of file
+       

Modified: tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType (original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType Tue Nov 18 21:27:58 2008
@@ -20,12 +20,12 @@
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
 
   <service name="CalculatorService">
-        <interface.java class="calculator.CalculatorService" />
+        <interface.java interface="calculator.CalculatorService" />
   </service>
 
   <reference name="divideService">
-        <interface.java class="calculator.DivideService" />
+        <interface.java interface="calculator.DivideService" />
   </reference>  
 
 </componentType>              
-       
\ No newline at end of file
+       

Modified: tuscany/java/sca/modules/assembly-xsd/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/LICENSE?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/LICENSE (original)
+++ tuscany/java/sca/modules/assembly-xsd/LICENSE Tue Nov 18 21:27:58 2008
@@ -242,3 +242,40 @@
 No other rights are granted by implication, estoppel or otherwise.
 
 ===============================================================================
+
+This module includes XSD files under the following W3C(r) Software License:
+
+W3C(r) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other related items) 
+is being provided by the copyright holders under the following license. By obtaining, 
+using and/or copying this work, you (the licensee) agree that you have read, understood, 
+and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation, with or 
+without modification, for any purpose and without fee or royalty is hereby granted, provided 
+that you include the following on ALL copies of the software and documentation or portions 
+thereof, including modifications:
+
+   1. The full text of this NOTICE in a location viewable to users of the redistributed or 
+      derivative work.
+   2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. 
+      If none exist, the W3C Software Short Notice should be included (hypertext is preferred,
+      text is permitted) within the body of any redistributed or derivative code.
+   3. Notice of any changes or modifications to the files, including the date changes were 
+      made. (We recommend you provide URIs to the location from which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO 
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES 
+OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR 
+DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER 
+RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL 
+DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or publicity 
+pertaining to the software without specific, written prior permission. Title to copyright 
+in this software and any associated documentation will at all times remain with copyright 
+holders.

Modified: tuscany/java/sca/modules/assembly-xsd/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/NOTICE?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/NOTICE (original)
+++ tuscany/java/sca/modules/assembly-xsd/NOTICE Tue Nov 18 21:27:58 2008
@@ -10,3 +10,14 @@
 
 (c) Copyright SCA Collaboration 2006, 2007
 
+This product also includes software under the W3C(r) Software License
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+Copyright (c) 2004 World Wide Web Consortium (Massachusetts Institute of Technology, 
+European Research Consortium for Informatics and Mathematics, Keio University). 
+All Rights Reserved. This work is distributed under the W3C(r) Software License [1] 
+in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+    [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd Tue Nov 18 21:27:58 2008
@@ -41,7 +41,7 @@
             <attribute name="requestConnection" type="QName"/>
             <attribute name="responseConnection" type="QName"/>
             <attribute name="operationProperties" type="QName"/>
-            <anyAttribute/>
+            <anyAttribute namespace="##any" processContents="lax"/>
          </extension>
       </complexContent>
    </complexType>
@@ -136,4 +136,5 @@
 
    <element name="binding.jms" type="sca:JMSBinding" 
             substitutionGroup="sca:binding"/>
+                       
 </schema>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd Tue Nov 18 21:27:58 2008
@@ -6,6 +6,11 @@
     xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
     xmlns:wsa="http://www.w3.org/2004/12/addressing"
     elementFormDefault="qualified">
+    
+    <import namespace="http://www.w3.org/2004/08/wsdl-instance"
+            schemaLocation="wsdli.xsd" />
+    <!-- import namespace="http://www.w3.org/2005/08/addressing" 
+            schemaLocation="ws-addr.xsd" /-->
 
     <include schemaLocation="sca-core.xsd"/>
 
@@ -15,11 +20,14 @@
         <complexContent>
             <extension base="sca:Binding">
                 <sequence>
+                    <!-- element ref="wsa:EndpointReference" minOccurs="0"
+                         maxOccurs="unbounded"/-->                  
                     <any namespace="##other" processContents="lax" minOccurs="0"
                          maxOccurs="unbounded"/>
                 </sequence>
 			 <attribute name="wsdlElement" type="anyURI" use="optional"/>
-                <anyAttribute namespace="##any" processContents="lax"/>
+             <attribute ref="wsdli:wsdlLocation" use="optional"/>
+             <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-contributions.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-contributions.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-contributions.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-contributions.xsd Tue Nov 18 21:27:58 2008
@@ -10,9 +10,9 @@
     <element name="contribution" type="sca:ContributionType"/>        
     <complexType name="ContributionType">
          <sequence>
-             <element name="deployable" type="sca:DeployableType" minOccurs="1" maxOccurs="unbounded"/>
-             <element name="import" type="sca:ImportType" minOccurs="0" maxOccurs="unbounded"/>
-             <element name="export" type="sca:ExportType" minOccurs="0" maxOccurs="unbounded"/>
+             <element name="deployable" type="sca:DeployableType" minOccurs="0" maxOccurs="unbounded"/>
+             <element ref="sca:import" minOccurs="0" maxOccurs="unbounded"/>
+             <element ref="sca:export" minOccurs="0" maxOccurs="unbounded"/>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
         </sequence>
         <anyAttribute namespace="##other" processContents="lax"/>
@@ -26,6 +26,7 @@
         <anyAttribute namespace="##other" processContents="lax"/>
     </complexType>        
 
+    <element name="import" type="sca:ImportType"/>
     <complexType name="ImportType">
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
@@ -35,11 +36,30 @@
         <anyAttribute namespace="##other" processContents="lax"/>
     </complexType>        
 
+    <element name="export" type="sca:ExportType"/>
     <complexType name="ExportType">
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
         </sequence>
         <attribute name="namespace" type="string" use="required"/>
         <anyAttribute namespace="##other" processContents="lax"/>
-    </complexType>           
+    </complexType>  
+    
+    <element name="import.resource" type="sca:ImportResourceType" substitutionGroup="sca:import"/>
+    <complexType name="ImportResourceType">
+        <complexContent>
+            <extension base="sca:ImportType">
+                 <attribute name="uri" type="anyURI" use="optional"/>
+            </extension>
+        </complexContent>
+    </complexType>   
+    
+    <element name="export.resource" type="sca:ExportResourceType" substitutionGroup="sca:export"/>
+    <complexType name="ExportResourceType">
+        <complexContent>
+            <extension base="sca:ExportType">
+                <attribute name="uri" type="anyURI" use="optional"/>
+            </extension>
+        </complexContent>
+    </complexType>  
 </schema> 
\ No newline at end of file

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-core.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-core.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-core.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-core.xsd Tue Nov 18 21:27:58 2008
@@ -123,7 +123,7 @@
 	          <attribute name="element" type="QName" use="optional"/>
 	          <attribute name="many" type="boolean" default="false" 
 	          	use="optional"/>
-	          <attribute name="noDefault" type="boolean" default="false" 
+	          <attribute name="mustSupply" type="boolean" default="false" 
 	          	use="optional"/>
 	          <anyAttribute namespace="##any" processContents="lax"/>
 	          <!-- an extension point ; attribute-based only --> 
@@ -149,7 +149,7 @@
 
     <element name="binding" type="sca:Binding" abstract="true"/>
     <complexType name="Binding" abstract="true">
-    	<sequence>
+    	<sequence>      
     		<element name="operation" type="sca:Operation" minOccurs="0" 
     			maxOccurs="unbounded" />
     	</sequence>
@@ -157,7 +157,7 @@
         <attribute name="name" type="QName" use="optional"/>
         <attribute name="requires" type="sca:listOfQNames" use="optional"/>
         <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
-    </complexType>
+    </complexType>   
     
     <element name="bindingType" type="sca:BindingType"/>
     <complexType name="BindingType">

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca.xsd Tue Nov 18 21:27:58 2008
@@ -18,6 +18,8 @@
 
     <include schemaLocation="sca-contributions.xsd"/>
         
+    <include schemaLocation="sca-contributions.xsd"/>
+    
     <include schemaLocation="sca-definitions.xsd"/>
     <include schemaLocation="sca-policy.xsd"/>
     

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd Tue Nov 18 21:27:58 2008
@@ -35,6 +35,7 @@
                          maxOccurs="unbounded"/>
                 </sequence>
                 <attribute name="title" type="string" use="optional"/>
+                <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd Tue Nov 18 21:27:58 2008
@@ -34,6 +34,7 @@
                     <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
                          maxOccurs="unbounded"/>
                 </sequence>
+                <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd Tue Nov 18 21:27:58 2008
@@ -34,6 +34,7 @@
                     <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
                          maxOccurs="unbounded"/>
                 </sequence>
+                <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd Tue Nov 18 21:27:58 2008
@@ -34,6 +34,7 @@
                     <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
                          maxOccurs="unbounded"/>
                 </sequence>
+                <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd Tue Nov 18 21:27:58 2008
@@ -35,6 +35,7 @@
                          maxOccurs="unbounded"/>
                 </sequence>
                 <attribute name="title" type="string" use="optional"/>
+                <anyAttribute namespace="##any" processContents="lax"/>
             </extension>
         </complexContent>
     </complexType>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd Tue Nov 18 21:27:58 2008
@@ -20,6 +20,8 @@
 <schema xmlns="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0">
     
+    <import namespace="http://www.w3.org/2004/08/wsdl-instance" schemaLocation="wsdli.xsd"/>
+    
     <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
     <import namespace="http://data.tuscany.apache.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-data-helper.xsd"/>
     
@@ -27,6 +29,7 @@
     <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
     <include schemaLocation="tuscany-sca-binding-http.xsd"/>
     <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
+    <include schemaLocation="tuscany-sca-binding-jms.xsd"/>
     <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
     <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
     <include schemaLocation="tuscany-sca-binding-rss.xsd"/>

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java Tue Nov 18 21:27:58 2008
@@ -506,7 +506,8 @@
                     		composite.getName().toString(), componentService.getName());
                 }
             }
-        } else if (componentReference.getReference() != null) {
+        } else if ((componentReference.getReference() != null) &&
+                   (!componentReference.getReference().getTargets().isEmpty())) {
 
             // Resolve targets from the corresponding reference in the
             // componentType
@@ -568,7 +569,49 @@
                     		         composite.getName().toString(), componentService.getName());
                 }
             }
-        } 
+        } else if (componentReference.getAutowire() == Boolean.TRUE) {
+
+            // Find suitable targets in the current composite for an
+            // autowired reference
+            Multiplicity multiplicity = componentReference.getMultiplicity();
+            for (Component targetComponent : composite.getComponents()) {
+                // prevent autowire connecting to self
+                boolean skipSelf = false;
+                for (ComponentReference targetComponentReference : targetComponent.getReferences()) {
+                    if (componentReference == targetComponentReference){
+                        skipSelf = true;
+                    }
+                }
+                
+                if (!skipSelf){
+                    for (ComponentService targetComponentService : targetComponent.getServices()) {
+                        if (componentReference.getInterfaceContract() == null ||
+                            interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+                            
+                            Endpoint endpoint = endpointFactory.createEndpoint();
+                            endpoint.setTargetName(targetComponent.getName());
+                            endpoint.setSourceComponent(null); // TODO - fixed up at start
+                            endpoint.setSourceComponentReference(componentReference);
+                            endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+                            endpoint.setTargetComponent(targetComponent);
+                            endpoint.setTargetComponentService(targetComponentService);
+                            endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+                            endpoints.add(endpoint);
+                            
+                            if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+            
+            if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
+                if (endpoints.size() == 0) {
+                    warning("NoComponentReferenceTarget", componentReference, componentReference.getName());
+                }
+            }
+        }
             
                 
         // if no endpoints have found so far retrieve any target names that are in binding URIs

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java Tue Nov 18 21:27:58 2008
@@ -148,6 +148,6 @@
     
     @Override
     public String toString(){
-        return getName().toString();
+    	return ( this.name != null ) ? getName().toString() : "null";
     }
 }

Modified: tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java (original)
+++ tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java Tue Nov 18 21:27:58 2008
@@ -461,7 +461,7 @@
 
         @Override
         public Message invoke(Message msg) {
-            // TODO implement
+        	// PostInvoker can detect media by content type (non-Feed, non-Entry)
             return super.invoke(msg);
         }
     }
@@ -477,7 +477,7 @@
 
         @Override
         public Message invoke(Message msg) {
-            // TODO implement
+        	// PutInvoker can detect media by content type (non-Feed, non-Entry)
             return super.invoke(msg);
         }
     }

Modified: tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java (original)
+++ tuscany/java/sca/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java Tue Nov 18 21:27:58 2008
@@ -47,6 +47,7 @@
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.model.Service;
@@ -56,7 +57,7 @@
 import org.apache.abdera.writer.WriterFactory;
 
 import org.apache.commons.codec.binary.Base64;
-import org.apache.tuscany.sca.binding.http.CacheContext;
+import org.apache.tuscany.sca.binding.http.HTTPCacheContext;
 import org.apache.tuscany.sca.data.collection.Entry;
 import org.apache.tuscany.sca.databinding.Mediator;
 import org.apache.tuscany.sca.interfacedef.DataType;
@@ -164,9 +165,9 @@
         // No authentication required for a get request
     	
     	// Test for any cache info in the request
- 	    CacheContext cacheContext = null;    	
+ 	    HTTPCacheContext cacheContext = null;    	
     	try { 
-    	   cacheContext = CacheContext.getCacheContextFromRequest( request );
+    	   cacheContext = HTTPCacheContext.getCacheContextFromRequest( request );
     	} catch ( java.text.ParseException e ) {    
     	}
     	// System.out.println( "AtomBindingListener.doGet cache context=" + cacheContext );
@@ -581,7 +582,6 @@
                 }
 
             } else if (contentType != null) {
-
                 // Create a new media entry
 
                 // Get incoming headers
@@ -596,13 +596,18 @@
                     throw new ServletException((Throwable)responseMessage.getBody());
                 }
                 createdFeedEntry = responseMessage.getBody();
+                
+                // Transfer media info to response header.
+                // Summary is a comma separated list of header properties.
+                String summary = createdFeedEntry.getSummary();
+               	addPropertiesToHeader( response, summary );
+                
             } else {
                 response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
             }
 
-            // A new entry was created successfully
+            // A new entry for non-media was created successfully.
             if (createdFeedEntry != null) {
-
                 // Set location of the created entry in the Location header
                 IRI feedId = createdFeedEntry.getId();
                 if ( feedId != null )
@@ -613,11 +618,14 @@
                 Link link = createdFeedEntry.getSelfLink();
                 if (link != null) {
                     response.addHeader(LOCATION, link.getHref().toString());
-                } else {
-                   link = createdFeedEntry.getLink( "Edit" );
-                   if (link != null) {
-                      response.addHeader(LOCATION, link.getHref().toString());
-                   }
+                } 
+                Link editLink = createdFeedEntry.getEditLink();
+                if (editLink != null) {
+                    response.addHeader(LOCATION, editLink.getHref().toString());
+                }
+                Link editMediaLink = createdFeedEntry.getEditMediaLink();
+                if (editMediaLink != null) {
+                    response.addHeader(CONTENTLOCATION, editMediaLink.getHref().toString());
                 }
 
                 // Write the created Atom entry
@@ -703,12 +711,13 @@
 
             } else if (contentType != null) {
 
-                // Updated a media entry
+                // Update a media entry
 
                 // Let the component implementation create the media entry
                 Message requestMessage = messageFactory.createMessage();
                 requestMessage.setBody(new Object[] {id, contentType, request.getInputStream()});
                 Message responseMessage = putMediaInvoker.invoke(requestMessage);
+                
                 Object body = responseMessage.getBody();
                 if (responseMessage.isFault()) {
                     if (body.getClass().getName().endsWith(".NotFoundException")) {
@@ -717,6 +726,9 @@
                         throw new ServletException((Throwable)responseMessage.getBody());
                     }
                 }
+                
+                // Transfer content to response header.
+                
             } else {
                 response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
             }
@@ -833,4 +845,27 @@
         return "application/atom+xml";
     }
 
+    /** Take a list of key values and add them to the header.
+     * For instance "Content-Type=image/gif,Content-Length=14201"
+     * @param response
+     * @param properties
+     */
+	public static void addPropertiesToHeader( HttpServletResponse response, String properties  ) {
+		if ( properties == null ) return; 
+    	StringTokenizer props = new StringTokenizer( properties, ",");
+    	while( props.hasMoreTokens()) {
+    		String prop = props.nextToken();
+    		StringTokenizer keyVal = new StringTokenizer( prop, "=");
+    		String key = null;
+    		String val = null;
+    		if ( keyVal.hasMoreTokens() )
+    			key = keyVal.nextToken();
+    		if ( keyVal.hasMoreTokens() )
+    			val = keyVal.nextToken();
+    		if (( key != null ) && ( val != null )) {
+                response.addHeader(key, val);                			
+    		}
+    	}
+	}
+
 }

Modified: tuscany/java/sca/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java (original)
+++ tuscany/java/sca/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java Tue Nov 18 21:27:58 2008
@@ -47,10 +47,6 @@
     private IntentAttachPointType intentAttachPointType;
     private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
 
-    public List<PolicySet> getApplicablePolicySets() {
-        return applicablePolicySets;
-    }
-
     public String getName() {
         return name;
     }
@@ -84,6 +80,8 @@
         // The binding is always resolved
     }
 
+    //Policy related getters/setters
+    
     public List<PolicySet> getPolicySets() {
         return policySets;
     }
@@ -107,6 +105,10 @@
     public void setRequiredIntents(List<Intent> intents) {
         this.requiredIntents = intents;
     }
+    
+    public List<PolicySet> getApplicablePolicySets() {
+        return applicablePolicySets;
+    }
 
     @Override
     public Object clone() throws CloneNotSupportedException {

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java Tue Nov 18 21:27:58 2008
@@ -33,7 +33,6 @@
  * Mock RuntimeWire implementation. Only few methods needs to be implemented.
  */
 public class TestRuntimeWire implements RuntimeWire {
-
     private Object invocationTarget;
 
     public TestRuntimeWire(Object invocationTarget) {
@@ -83,6 +82,11 @@
 
         return null;
     }
+    
+    public Object invoke(Message arg1) throws InvocationTargetException {
+
+        return null;
+    }    
 
     public void rebuild() {
 
@@ -97,4 +101,7 @@
         return null;
     }
 
+    public InvocationChain getBindingInvocationChain() {
+        return null;
+    }
 }

Modified: tuscany/java/sca/modules/binding-http-runtime/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/pom.xml?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/pom.xml (original)
+++ tuscany/java/sca/modules/binding-http-runtime/pom.xml Tue Nov 18 21:27:58 2008
@@ -38,6 +38,12 @@
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-security</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-core-spi</artifactId>
             <version>1.4-EQUINOX-SNAPSHOT</version>
         </dependency>

Modified: tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java (original)
+++ tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java Tue Nov 18 21:27:58 2008
@@ -24,16 +24,25 @@
 import java.io.OutputStream;
 import java.net.URLDecoder;
 import java.text.ParseException;
+import java.util.List;
 
 import javax.servlet.ServletException;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
 
-import org.apache.tuscany.sca.binding.http.CacheContext;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.http.HTTPCacheContext;
+import org.apache.tuscany.sca.binding.http.util.HTTPHeadersParser;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
 
 /**
  * Servlet responsible for dispatching HTTP requests to the
@@ -44,6 +53,13 @@
 public class HTTPBindingListenerServlet extends HttpServlet {
     private static final long serialVersionUID = 2865466417329430610L;
     
+    private static final QName AUTEHTICATION_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","authentication");
+    
+    transient private Binding binding;
+
+    transient private boolean requiresAuthentication = false;
+    transient private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
+
     private MessageFactory messageFactory;
     private Invoker getInvoker;
     private Invoker conditionalGetInvoker;
@@ -57,12 +73,49 @@
     /**
      * Constructs a new HTTPServiceListenerServlet.
      */
-    public HTTPBindingListenerServlet(MessageFactory messageFactory) {
+    public HTTPBindingListenerServlet(Binding binding, MessageFactory messageFactory) {
+        this.binding = binding;
         this.messageFactory = messageFactory;
+        
+
+        // find out which policies are active
+        if (binding instanceof PolicySetAttachPoint) {
+            List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
+            for(Intent intent : intents) {
+                if(intent.getName().equals(AUTEHTICATION_INTENT)) {
+                    requiresAuthentication = true;
+                }
+            }
+
+
+            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (BasicAuthenticationPolicy.class.isInstance(p)) {
+                        basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
+                    } else {
+                        // etc. check for other types of policy being present
+                    }
+                }
+            }
+        }        
     }
 
     
     @Override
+    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+        if(requiresAuthentication) {
+            if(! hasAuthenticationHeader(request, response)) {
+                response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
+                response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+            }
+        }
+        
+        super.service(request, response);
+    }    
+    
+    @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         // Get the request path
         String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
@@ -75,12 +128,16 @@
 
         // Invoke the get operation on the service implementation
         Message requestMessage = messageFactory.createMessage();
+
+        //store http headers to message
+        requestMessage.getHeaders().addAll(HTTPHeadersParser.getHeaders(request));
+        
         String id = path.substring(1);
         
         Message responseMessage = null;
-        CacheContext cacheContext = null;
+        HTTPCacheContext cacheContext = null;
         try { 
-           cacheContext = CacheContext.getCacheContextFromRequest(request);
+           cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
         } catch (ParseException e) {        	
         }
 
@@ -144,9 +201,9 @@
         String id = path.substring(1);
         
         Message responseMessage = null;
-        CacheContext cacheContext = null;
+        HTTPCacheContext cacheContext = null;
         try { 
-           cacheContext = CacheContext.getCacheContextFromRequest(request);
+           cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
         } catch (ParseException e) {        	
         }
         
@@ -210,9 +267,9 @@
         String id = path.substring(1);
         
         Message responseMessage = null;
-        CacheContext cacheContext = null;
+        HTTPCacheContext cacheContext = null;
         try { 
-           cacheContext = CacheContext.getCacheContextFromRequest(request);
+           cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
         } catch (ParseException e) {        	
         }
         
@@ -276,9 +333,9 @@
         // String id = path.substring(1);
         
         Message responseMessage = null;
-        CacheContext cacheContext = null;
+        HTTPCacheContext cacheContext = null;
         try { 
-           cacheContext = CacheContext.getCacheContextFromRequest(request);
+           cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
         } catch (ParseException e) {        	
         }
         
@@ -314,9 +371,9 @@
 
         // Test if the ETag and LastModified are returned as a cache context.
     	Object body = responseMessage.getBody();
-    	if ( body.getClass() == CacheContext.class ) {
+    	if ( body.getClass() == HTTPCacheContext.class ) {
     		// Transfer to header if so.
-    		CacheContext cc = (CacheContext)responseMessage.getBody();
+    		HTTPCacheContext cc = (HTTPCacheContext)responseMessage.getBody();
     		if (( cc != null ) && ( cc.isEnabled() )) {
     			String eTag = cc.getETag();
             	if ( eTag != null )
@@ -328,116 +385,132 @@
     	}
     }
 
-	/**
-	 * @return the getInvoker
-	 */
-	public Invoker getGetInvoker() {
-		return getInvoker;
-	}
-
-	/**
-	 * @param getInvoker the getInvoker to set
-	 */
-	public void setGetInvoker(Invoker getInvoker) {
-		this.getInvoker = getInvoker;
-	}
-
-	/**
-	 * @return the conditionalGetInvoker
-	 */
-	public Invoker getConditionalGetInvoker() {
-		return conditionalGetInvoker;
-	}
-
-	/**
-	 * @param conditionalGetInvoker the conditionalGetInvoker to set
-	 */
-	public void setConditionalGetInvoker(Invoker conditionalGetInvoker) {
-		this.conditionalGetInvoker = conditionalGetInvoker;
-	}
+    /**
+     * @return the getInvoker
+     */
+    public Invoker getGetInvoker() {
+        return getInvoker;
+    }
+
+    /**
+     * @param getInvoker the getInvoker to set
+     */
+    public void setGetInvoker(Invoker getInvoker) {
+        this.getInvoker = getInvoker;
+    }
+
+    /**
+     * @return the conditionalGetInvoker
+     */
+    public Invoker getConditionalGetInvoker() {
+        return conditionalGetInvoker;
+    }
+
+    /**
+     * @param conditionalGetInvoker the conditionalGetInvoker to set
+     */
+    public void setConditionalGetInvoker(Invoker conditionalGetInvoker) {
+        this.conditionalGetInvoker = conditionalGetInvoker;
+    }
+
+    /**
+     * @return the putInvoker
+     */
+    public Invoker getPutInvoker() {
+        return putInvoker;
+    }
+
+    /**
+     * @param putInvoker the putInvoker to set
+     */
+    public void setPutInvoker(Invoker putInvoker) {
+        this.putInvoker = putInvoker;
+    }
+
+    /**
+     * @return the conditionalPutInvoker
+     */
+    public Invoker getConditionalPutInvoker() {
+        return conditionalPutInvoker;
+    }
+
+    /**
+     * @param conditionalPutInvoker the conditionalPutInvoker to set
+     */
+    public void setConditionalPutInvoker(Invoker conditionalPutInvoker) {
+        this.conditionalPutInvoker = conditionalPutInvoker;
+    }
+
+    /**
+     * @return the postInvoker
+     */
+    public Invoker getPostInvoker() {
+        return postInvoker;
+    }
+
+    /**
+     * @param postInvoker the postInvoker to set
+     */
+    public void setPostInvoker(Invoker postInvoker) {
+        this.postInvoker = postInvoker;
+    }
+
+    /**
+     * @return the conditionalPostInvoker
+     */
+    public Invoker getConditionalPostInvoker() {
+        return conditionalPostInvoker;
+    }
+
+    /**
+     * @param conditionalPostInvoker the conditionalPostInvoker to set
+     */
+    public void setConditionalPostInvoker(Invoker conditionalPostInvoker) {
+        this.conditionalPostInvoker = conditionalPostInvoker;
+    }
+
+    /**
+     * @return the deleteInvoker
+     */
+    public Invoker getDeleteInvoker() {
+        return deleteInvoker;
+    }
+
+    /**
+     * @param deleteInvoker the deleteInvoker to set
+     */
+    public void setDeleteInvoker(Invoker deleteInvoker) {
+        this.deleteInvoker = deleteInvoker;
+    }
+
+    /**
+     * @return the conditionalDeleteInvoker
+     */
+    public Invoker getConditionalDeleteInvoker() {
+        return conditionalDeleteInvoker;
+    }
+
+    /**
+     * @param conditionalDeleteInvoker the conditionalDeleteInvoker to set
+     */
+    public void setConditionalDeleteInvoker(Invoker conditionalDeleteInvoker) {
+        this.conditionalDeleteInvoker = conditionalDeleteInvoker;
+    }
+
+    
+    /** 
+     * Utility Methods related to Policy
+     */
     
-	/**
-	 * @return the putInvoker
-	 */
-	public Invoker getPutInvoker() {
-		return putInvoker;
-	}
-
-	/**
-	 * @param putInvoker the putInvoker to set
-	 */
-	public void setPutInvoker(Invoker putInvoker) {
-		this.putInvoker = putInvoker;
-	}
-
-	/**
-	 * @return the conditionalPutInvoker
-	 */
-	public Invoker getConditionalPutInvoker() {
-		return conditionalPutInvoker;
-	}
-
-	/**
-	 * @param conditionalPutInvoker the conditionalPutInvoker to set
-	 */
-	public void setConditionalPutInvoker(Invoker conditionalPutInvoker) {
-		this.conditionalPutInvoker = conditionalPutInvoker;
-	}
-
-	/**
-	 * @return the postInvoker
-	 */
-	public Invoker getPostInvoker() {
-		return postInvoker;
-	}
-
-	/**
-	 * @param postInvoker the postInvoker to set
-	 */
-	public void setPostInvoker(Invoker postInvoker) {
-		this.postInvoker = postInvoker;
-	}
-
-	/**
-	 * @return the conditionalPostInvoker
-	 */
-	public Invoker getConditionalPostInvoker() {
-		return conditionalPostInvoker;
-	}
-
-	/**
-	 * @param conditionalPostInvoker the conditionalPostInvoker to set
-	 */
-	public void setConditionalPostInvoker(Invoker conditionalPostInvoker) {
-		this.conditionalPostInvoker = conditionalPostInvoker;
-	}
-
-	/**
-	 * @return the deleteInvoker
-	 */
-	public Invoker getDeleteInvoker() {
-		return deleteInvoker;
-	}
-
-	/**
-	 * @param deleteInvoker the deleteInvoker to set
-	 */
-	public void setDeleteInvoker(Invoker deleteInvoker) {
-		this.deleteInvoker = deleteInvoker;
-	}
-
-	/**
-	 * @return the conditionalDeleteInvoker
-	 */
-	public Invoker getConditionalDeleteInvoker() {
-		return conditionalDeleteInvoker;
-	}
-
-	/**
-	 * @param conditionalDeleteInvoker the conditionalDeleteInvoker to set
-	 */
-	public void setConditionalDeleteInvoker(Invoker conditionalDeleteInvoker) {
-		this.conditionalDeleteInvoker = conditionalDeleteInvoker;
-	}
+
+    private boolean hasAuthenticationHeader(HttpServletRequest request, ServletResponse response) {
+        boolean result = false;
+        if(request.getHeader("Authorization") != null) {
+            result = true;
+        }
+        
+        return result;
+    }
+
 
 }

Modified: tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java (original)
+++ tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java Tue Nov 18 21:27:58 2008
@@ -39,10 +39,10 @@
  * @version $Rev$ $Date$
  */
 public class HTTPServiceBindingProvider implements ServiceBindingProvider {
-    
     private RuntimeComponentService service;  
     private HTTPBinding binding;
     private MessageFactory messageFactory;
+    
     private ServletHost servletHost;
     private String servletMapping;
     private HTTPBindingListenerServlet bindingListenerServlet;
@@ -63,7 +63,7 @@
         RuntimeComponentService componentService = (RuntimeComponentService) service;
         RuntimeWire wire = componentService.getRuntimeWire(binding);
         Servlet servlet = null;
-        bindingListenerServlet = new HTTPBindingListenerServlet( messageFactory );
+        bindingListenerServlet = new HTTPBindingListenerServlet(binding, messageFactory );
         for (InvocationChain invocationChain : wire.getInvocationChains()) {
             Operation operation = invocationChain.getTargetOperation();
             String operationName = operation.getName();
@@ -101,7 +101,7 @@
                 servlet = bindingListenerServlet;
             } else if (operationName.equals("service")) {
                 Invoker serviceInvoker = invocationChain.getHeadInvoker();
-                servlet = new HTTPServiceListenerServlet(serviceInvoker, messageFactory);
+                servlet = new HTTPServiceListenerServlet(binding, serviceInvoker, messageFactory);
                 break;
             }
         }

Modified: tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java?rev=718858&r1=718857&r2=718858&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java (original)
+++ tuscany/java/sca/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java Tue Nov 18 21:27:58 2008
@@ -20,17 +20,25 @@
 package org.apache.tuscany.sca.binding.http.provider;
 
 import java.io.IOException;
+import java.util.List;
 
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
 
 /**
  * Servlet responsible for dispatching HTTP service requests to the
@@ -39,17 +47,45 @@
  * @version $Rev$ $Date$
  */
 public class HTTPServiceListenerServlet implements Servlet {
+    private static final QName AUTEHTICATION_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","authentication");
     
-    private ServletConfig config;
-    private MessageFactory messageFactory;
-    private Invoker serviceInvoker;
+    transient private Binding binding;
+    transient private ServletConfig config;
+    transient private MessageFactory messageFactory;
+    transient private Invoker serviceInvoker;
     
+    transient private boolean requiresAuthentication = false;
+    transient private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
+
     /**
      * Constructs a new HTTPServiceListenerServlet.
      */
-    public HTTPServiceListenerServlet(Invoker serviceInvoker, MessageFactory messageFactory) {
+    public HTTPServiceListenerServlet(Binding binding, Invoker serviceInvoker, MessageFactory messageFactory) {
+        this.binding = binding;
         this.serviceInvoker = serviceInvoker;
         this.messageFactory = messageFactory;
+        
+        // find out which policies are active
+        if (binding instanceof PolicySetAttachPoint) {
+            List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
+            for(Intent intent : intents) {
+                if(intent.getName().equals(AUTEHTICATION_INTENT)) {
+                    requiresAuthentication = true;
+                }
+            }
+
+
+            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (BasicAuthenticationPolicy.class.isInstance(p)) {
+                        basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
+                    } else {
+                        // etc. check for other types of policy being present
+                    }
+                }
+            }
+        }        
     }
 
     public ServletConfig getServletConfig() {
@@ -65,10 +101,17 @@
     }
 
     public void destroy() {
+        
     }
 
     public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
         
+        if(requiresAuthentication) {
+            if(! hasAuthenticationHeader((HttpServletRequest)request, (HttpServletResponse)response)) {
+                ((HttpServletResponse)response).sendError(HttpServletResponse.SC_UNAUTHORIZED);
+            }
+        }
+        
         // Dispatch the service interaction to the service invoker
         Message requestMessage = messageFactory.createMessage();
         requestMessage.setBody(new Object[]{request, response});
@@ -81,4 +124,13 @@
         }
     }
 
+    
+    private boolean hasAuthenticationHeader(HttpServletRequest request, ServletResponse response) {
+        boolean result = false;
+        if(request.getHeader("Authorization") != null) {
+            result = true;
+        }
+        
+        return result;
+    }
 }



Mime
View raw message