Author: rfeng
Date: Tue Nov 6 12:38:49 2007
New Revision: 592545
URL: http://svn.apache.org/viewvc?rev=592545&view=rev
Log:
Fix the issue reported by Adrian Mos on the user list
Added:
incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/
incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java (with
props)
incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java (with
props)
incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java (with
props)
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/foo.png
(with props)
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o1.composite
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o2.composite
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o3.composite
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o4.composite
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
(with props)
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
(with props)
Modified:
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java?rev=592545&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java Tue Nov
6 12:38:49 2007
@@ -0,0 +1,28 @@
+/*
+ * 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 foo;
+
+import org.osoa.sca.annotations.Service;
+
[EMAIL PROTECTED](I.class)
+public class A implements I {
+ public String get(int i) {
+ return A.class.getName();
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/A.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java?rev=592545&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java Tue Nov
6 12:38:49 2007
@@ -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 foo;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
[EMAIL PROTECTED](I.class)
+public class B implements I {
+ protected I i = null;
+
+ @Reference(name = "i", required = true)
+ public void setC(I c) {
+ this.i = c;
+ }
+
+ public String get(int i) {
+ return this.i.get(i);
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/B.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java?rev=592545&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java Tue Nov
6 12:38:49 2007
@@ -0,0 +1,23 @@
+/*
+ * 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 foo;
+
+public interface I {
+ String get(int i);
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/foo/I.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/foo.png
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/foo.png?rev=592545&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/foo.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o1.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o1.composite?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o1.composite
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o1.composite
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O1Composite">
+
+ <service name="O1Service" promote="AComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="foo.A" />
+ </component>
+
+</composite>
\ No newline at end of file
Added:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o2.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o2.composite?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o2.composite
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o2.composite
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O2Composite">
+
+ <service name="O2Service" promote="O1Component/O1Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O1Component">
+ <implementation.composite name="bar:O1Composite" />
+ </component>
+
+</composite>
\ No newline at end of file
Added:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o3.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o3.composite?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o3.composite
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o3.composite
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O3Composite">
+
+ <service name="O3Service" promote="BComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="BComponent">
+ <implementation.java class="foo.B" />
+ </component>
+
+ <reference name="O3Reference" promote="BComponent/i">
+ <interface.java interface="foo.I" />
+ </reference>
+
+</composite>
\ No newline at end of file
Added:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o4.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o4.composite?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o4.composite
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/main/resources/foo/o4.composite
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O4Composite">
+
+ <service name="O4Service" promote="O3Component/O3Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O3Component">
+ <implementation.composite name="bar:O3Composite" />
+ <reference name="O3Reference" target="O2Component/O2Service" />
+ </component>
+
+ <component name="O2Component">
+ <implementation.composite name="bar:O2Composite" />
+ </component>
+
+</composite>
\ No newline at end of file
Added:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,32 @@
+/*
+ * 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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O2TestCase extends TestCase {
+
+ public void testGet() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o2.composite");
+ I i = sca.getService(I.class, "O1Component");
+ assertEquals("foo.A", i.get(0));
+ }
+}
Propchange:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O2TestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java?rev=592545&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
(added)
+++
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
Tue Nov 6 12:38:49 2007
@@ -0,0 +1,39 @@
+/*
+ * 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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O4TestCase extends TestCase {
+
+ public void testO3Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O3Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+ public void testO2Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O2Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/itest/recursive/src/test/java/foo/O4TestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java?rev=592545&r1=592544&r2=592545&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
Tue Nov 6 12:38:49 2007
@@ -1015,7 +1015,7 @@
* @param topCompositeService
* @return
*/
- private ComponentService getPromotedComponentService(CompositeService
compositeService) {
+ static ComponentService getPromotedComponentService(CompositeService
compositeService) {
ComponentService componentService =
compositeService.getPromotedService();
if (componentService != null) {
Service service = componentService.getService();
@@ -1043,7 +1043,7 @@
* @param compositeService
* @return
*/
- private Component getPromotedComponent(CompositeService compositeService) {
+ static Component getPromotedComponent(CompositeService compositeService) {
ComponentService componentService =
compositeService.getPromotedService();
if (componentService != null) {
Service service = componentService.getService();
Modified:
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java?rev=592545&r1=592544&r2=592545&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
Tue Nov 6 12:38:49 2007
@@ -484,9 +484,9 @@
Component targetComponent = target.getComponent();
ComponentService targetComponentService = target.getService();
if (targetComponentService.getService() instanceof
CompositeService) {
-
+ CompositeService compositeService = (CompositeService)
targetComponentService.getService();
// Find the promoted component service
- targetComponentService =
((CompositeService)targetComponentService.getService()).getPromotedService();
+ targetComponentService =
CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService);
}
determineApplicableBindingPolicySets(componentReference,
targetComponentService);
@@ -677,7 +677,8 @@
// Wire to the actual component service
// promoted by a composite service
CompositeService compositeService =
(CompositeService)target.getService();
- ComponentService componentService =
compositeService.getPromotedService();
+ // Find the promoted component service
+ ComponentService componentService =
CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService);
if (componentService != null) {
promotedReference.getTargets().add(componentService);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]