Return-Path: Delivered-To: apmail-tuscany-user-archive@www.apache.org Received: (qmail 63418 invoked from network); 18 Jun 2009 15:48:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jun 2009 15:48:30 -0000 Received: (qmail 45861 invoked by uid 500); 18 Jun 2009 15:48:41 -0000 Delivered-To: apmail-tuscany-user-archive@tuscany.apache.org Received: (qmail 45791 invoked by uid 500); 18 Jun 2009 15:48:41 -0000 Mailing-List: contact user-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@tuscany.apache.org Delivered-To: mailing list user@tuscany.apache.org Received: (qmail 45783 invoked by uid 99); 18 Jun 2009 15:48:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 15:48:40 +0000 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of enjoyjava@gmail.com designates 209.85.221.193 as permitted sender) Received: from [209.85.221.193] (HELO mail-qy0-f193.google.com) (209.85.221.193) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 15:48:28 +0000 Received: by qyk31 with SMTP id 31so1607884qyk.10 for ; Thu, 18 Jun 2009 08:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:references :in-reply-to:subject:date:mime-version:content-type:x-priority :x-msmail-priority:importance:x-mailer:x-mimeole; bh=c161KsrflzX+GQJXn1dWCYPFLRhIKx7eCXB6NzjueTg=; b=m9AGrofeGEKqEy/ePYHCQnenZd4f7vLtVTPuX9WZAHwAayoxXV8KHwFzk/soXXWoJQ 9ZYTxpArZfJ/K+CZhRC6OJJduahisS+tO2H62/jRDHzxIlisFIyxD3MfU6TfT/RAFHT/ uaBOgEHGIF9vvug0BV8csV60iRciqKQtBAVC8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:references:in-reply-to:subject:date:mime-version :content-type:x-priority:x-msmail-priority:importance:x-mailer :x-mimeole; b=Jsyy7fWJoFam26mVfxkvB8tBfWY8OIMJfe6MF5PEiZtqcnkZoZPvNTSh8jG38QjMgg G5UQpuhnbCcsn+pYF6FNGkOTZX0JCoroWpIQKVdKtVhrbOqSQyEZkxHaSS5Bvszt6TKY JvmH2c7LksDjVY+xmBbOy7XhW77lBA4peOXnY= Received: by 10.224.37.142 with SMTP id x14mr1459520qad.145.1245340087326; Thu, 18 Jun 2009 08:48:07 -0700 (PDT) Received: from rfengt61p (adsl-76-200-183-0.dsl.pltn13.sbcglobal.net [76.200.183.0]) by mx.google.com with ESMTPS id 26sm12358qwa.54.2009.06.18.08.48.03 (version=SSLv3 cipher=RC4-MD5); Thu, 18 Jun 2009 08:48:06 -0700 (PDT) Message-ID: From: "Raymond Feng" To: , References: <9AB1B1B3F4BC4D8D870ACA756EC59664@rfengt61p> <833c9480906170756w46d869e4j8a297baf0d64f8e3@mail.gmail.com> <833c9480906170806kdbc9b9axdfe02e021c4ae49c@mail.gmail.com> <9771BAEF061E4E7E8E405E9A44676828@rfengt61p> <833c9480906180305h7e6bd888kf69b62597ac55591@mail.gmail.com> In-Reply-To: <833c9480906180305h7e6bd888kf69b62597ac55591@mail.gmail.com> Subject: Re: Fwd: Problem with "implementation.osgi" reference Date: Thu, 18 Jun 2009 08:47:59 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0AA5_01C9EFF1.7BEA28B0" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 14.0.8064.206 X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8064.206 X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------=_NextPart_000_0AA5_01C9EFF1.7BEA28B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Which level of the Tuscany 2.x code are you using? The various issues = you ran into seem to have been fixed before. Can you try our M3 RC1? http://people.apache.org/~antelder/tuscany/2.0-M3-RC1/ Thanks, Raymond =20 From: Santiago Miguel Aranda Rojas=20 Sent: Thursday, June 18, 2009 3:05 AM To: user@tuscany.apache.org=20 Subject: Re: Fwd: Problem with "implementation.osgi" reference I am checking your comments. I can not remove bundle.composite file from = TestService bundle because tuscany is not working without this file. I have this Caused by: java.lang.NullPointerException at = org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.configureNode(NodeF= actoryImpl.java:440) at = org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.access$2(NodeFactor= yImpl.java:351) at = org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl$NodeImpl.(Nod= eFactoryImpl.java:574) and the source code about this line is if (composite =3D=3D null) { composite =3D getDefaultComposite(configuration, workspace); } // Find the composite in the given contributions boolean found =3D false; Artifact compositeFile =3D contributionFactory.createArtifact(); compositeFile.setUnresolved(true); compositeFile.setURI(composite.getURI()); for (Contribution contribution : workspace.getContributions()) { ModelResolver resolver =3D contribution.getModelResolver(); // for (Artifact artifact : = contribution.getArtifacts()){ // logger.log(Level.INFO,"artifact - " + = artifact.getURI()); // } Artifact resolvedArtifact =3D = resolver.resolveModel(Artifact.class, compositeFile); // if (!resolvedArtifact.isUnresolved() && = resolvedArtifact.getModel() instanceof Composite) { if (!composite.isUnresolved()) { ---> This is line 440 // The composite content was passed into the node and = read into a composite model, // don't use the composite found in the contribution, = use that composite, but just resolve // it within the context of the contribution compositeProcessor.resolve(composite, resolver); } else { // Use the resolved composite we've found in the = contribution composite =3D (Composite)resolvedArtifact.getModel(); } found =3D true; // break; // } } I guess composite variable is not null in the first iteration. But it is = null when composite =3D (Composite)resolvedArtifact.getModel(); is = executed. So I guess is another problem related with "contribution" = because there is a comment about that "// Use the resolved composite = we've found in the contribution" Besides, while I fix these things I am going to use java code in order = to register the SCA node. I have checked all your comments about = bundle.composite and bundle.componentType at TestService and Calculator = bundle. When I invoke to a method of CalculatorService with a WS client = I have another problem.=20 This code of CalculatorServiceImpl public class CalculatorServiceImpl implements CalculatorService { private AddService addService; private TestService testService; public int add(int param1, int param2) { System.out.println (testService.sayHello()); --> I have an error when = this line is executed return addService.add(param1, param2); } public AddService getAddService() { return addService; } @Reference public void setAddService(AddService addService) { this.addService =3D addService; } public TestService getTestService() { return testService; } @Reference public void setTestService(TestService testService) { this.testService =3D testService; } } This is the error . The testService instance is not null but it is not = wired to TestService. I have registered the Osgi Service registry using = this code in the Activator of TestService bundle. I think this is = neccesary. arg0.registerService(TestService.class.getName(), new TestServiceImpl(), = null); =20 Caused by: org.oasisopen.sca.ServiceUnavailableException: Unable to = create SCA binding invoker for local target CalculatorComponent = reference testService (bindingURI=3Dnull operation=3DsayHello) at = org.apache.tuscany.sca.binding.sca.provider.RuntimeSCAReferenceBindingPro= vider.createInvoker(RuntimeSCAReferenceBindingProvider.java:200) --------------------------------------------- 2009/6/17 Raymond Feng Hi, Please see my comments inline. Thanks, Raymond=20 ------------------------------------ BUNDLE CALCULATOR ------------------------------------ *****OSGI-INF/sca/bundle.composite. Two java components (Calculator = and AddService) and one OSGi component (TestService) This is good.=20 *******OSGI-INF/sca/bundle.componentType You don't need to provide this file. The componentType is only = needed for the OSGi component.=20 ----------------------------------- BUNDLE TESTSERVICE ------------------------------------- *******OSGI-INF/sca/bundle.componentType This is good.=20 *****OSGI-INF/sca/bundle.composite This should be removed as the TestServiceComponent has been = declared in the calculator bundle composite.=20 It is necessary to have a bundle.composite file in TestService?? and = bundle.componentType?? Can I remove these files from TestService bundle = and put the TestService4s bundle.componentType in the Calculator bundle. = You said "Alternatively, you have place the file as = OSGI-INF/sca//bundle.componentType in the calculator = bundle." Do you mean I can copy TestService4s bundle.componentType into = a CalculatorService bundle? Yes=20 Thank you very much ------------------------------------------------------------------- Tuscany checks the OSGi bundle based on one of the following patterns: * An "SCA-Composite" header in the MANIFEST.MF. It points to an SCA = composite file within the bundle. * Any files under OSGI-INF/sca. In your case, the first bundle contains three java components. The = second bundle contains one OSGi component. There are a few options to = get them work together (CalculatorService with a reference to = TestService). Option 1: 1) Place bundle.composite under OSGI-INF/sca in the calculator bundle. = The composite contains 4 components: 3 java components and 1 OSGi = component. The @target for CalculatorService component's testService reference = will be TestService/. 2) Place bundle.componentType under OSGI-INF/sca in the test service = bundle. Alternatively, you have place the file as = OSGI-INF/sca//bundle.componentType in the calculator = bundle. In this case, we are going to start one Node. Option 2: 1) Place bundle.composite under OSGI-INF/sca in the calculator bundle. = The composite contains 3 java components 2) Place bundle.composite under OSGI-INF/sca in the test service = bundle. The composite contains 1 OSGi component. 3) Place bundle.componentType under OSGI-INF/sca in the test service = bundle. In this case, we are going to start two nodes. You can configure the = CalculatorService.testService reference and the OSGi service to use the = same binding (such as RMI, or WS) to communicate. Make sure the = interface is remotable. binding.sca is not working yet. Thanks, Raymond From: santiago.aranda@telvent.com Sent: Tuesday, June 16, 2009 1:33 AM To: user@tuscany.apache.org Subject: Re: Fwd: Problem with "implementation.osgi" reference So, I have to attach two files (componentType and composite) to my two = different bundles (TestService and Calculator) and model it as = "implementation.osgi". I have TestService in a bundle I will add these = two file and I will design as "implementation.osgi" . But Calculator Service (this is in other bundle) has three components = and they are all "implementation.java" and it is working OK. How can I = put a reference to TestService?? Do I need change "implementation.osgi" = in CalculatorComponent instead "implementation.java"? and is it = neccesary for AddServiceComponent and SubstractService?? I will try a example I will copy my files in the email. Thank you very much Un saludo. Santiago Miguel Aranda Rojas Telvent Interactiva Extension: 35999 Telefono: 955637418 "Raymond Feng" "Raymond Feng" 15/06/2009 18:36 Para: , cc: Asunto: Re: Fwd: Problem with "implementation.osgi" reference To access an OSGi service from the SCA component, you will have to = provide SCA configurations for the OSGi bundle so that it becomes an SCA = component using implementation.osgi and the OSGi service becomes an SCA service = so that the Calculator component can wire to that TestService. There are two SCA files you to provide to model the OSGi bundle as an = SCA component. * bundle.componentType to describe what OSGi services or references = are used in the bundle (We potentially have better approach to introspect the = OSGi bundle to build this up) * bundle.composite to configure the component, for example, setting = the bindings. These files can be in a separate OSGi bundle than the one that owns = the services/references. Thanks, Raymond From: Santiago Miguel Aranda Rojas Sent: Monday, June 15, 2009 4:01 AM To: user@tuscany.apache.org Subject: Fwd: Problem with "implementation.osgi" reference Hi I can not understand this sample because there are many new concepts = for me. For example "bundle.componentType". There is not too much information = about that . I think I need something more simple. I have attached a picture = with my idea. ** When my SCA service was working I had a main component "implementacion.java" with two references to another two components (implementation.java). The main component could be invoked as Web = Service. ** Now, I want another reference to a Service (TestService in the = picture) that was registered by another different bundle. But this is a OSGi = bundle, without SCA information, Composite file nor ComponentType file. I mean = it is a bundle that is registering a service in the OSGi registry. I need = have a instance wired to this OSGi service in the class of the main Component = in order to invoke their methods. TestService testService; //I need testService is not null in order to invoke their methods. testService.sayHello(); I hope you can understand my problem. You can ask me if you want. Thank you very mucha 2009/6/10 Raymond Feng Please see: = https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-calculato= r/ = https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-calculato= r-operations/ = http://cwiki.apache.org/confluence/display/TUSCANYWIKI/OSGi+RFC+119+Imple= mentation Thanks, Raymond From: Santiago Miguel Aranda Rojas Sent: Wednesday, June 10, 2009 12:07 AM To: user@tuscany.apache.org Subject: Re: Problem with "implementation.osgi" reference Yes, you are right. I was doing some different tests and I copied you = a wrong composite. I wanted to see if the change of @target made an = error in tuscany. But Tuscany doesn4t recognize this error because I think it supposes that will be a "remote Component". I can see this in the = tuscany trace ADVERTENCIA: Component reference target not found, it might be a = remote service running elsewhere in the SCA Domain: Composite =3D = {http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetw= orkManagement}SensorNetworkManagement Service =3D PruebaComponent But it is Ok, because the component I want if an Osgi Service = registered in the Osgi registry. I have fixed the error in @target and it is not working yet. Do you know any example when an component is = used? I have tried to change "xmlns" tag, but it doesn4t work. Thank you very much. 2009/6/10 Raymond Feng The @target is pointing to a wrong componentName/serviceName. It = should be "Prueba" instead of "PruebaComponent" as the component name is = "Prueba". From: Santiago Miguel Aranda Rojas Sent: Tuesday, June 09, 2009 1:28 PM To: user@tuscany.apache.org Subject: Re: Problem with "implementation.osgi" reference Tuscany 2.02M. The last version I think. April 2009 ----- Original Message ----- From: Raymond Feng To: user@tuscany.apache.org Sent: Tuesday, June 09, 2009 7:12 PM Subject: Re: Problem with "implementation.osgi" reference Are you using Tuscany/SCA 2.x or 1.x? From: santiago.aranda@telvent.com Sent: Tuesday, June 09, 2009 9:15 AM To: user@tuscany.apache.org Subject: Problem with "implementation.osgi" reference Hello I want to use an osgi service as a SCA component. But I can not access = to their methods from other Component. I mean I have created a wired = instance to the Osgi Service ($Proxy25). It is not "null" but I can not invoke = to one method because an error is happening --->Unable to create SCA binding invoker for local target SensorNetworkManagementComponent reference prueba (bindingURI=3Dnull operation=3DsayHello) This is my composite file. I want to have to two components. The first = had a reference to the second and it is normal "implementation.java". The = second is the SCA component that is representing to the Osgi Service that I = want to recover. This Osgi Service was registered in the Osgi registry by = Activator class in "RegistroService" bundle. ***The Java code--> The first component. public class SensorNetworkManagementServiceImpl implements SensorNetworkManagementService { private Prueba prueba; public Prueba getPrueba() { return prueba; } @Reference public void setPrueba(Prueba prueba) { this.prueba =3D prueba; } } **Java code --> The second component. It is another bundle that = is registering one simple Osgi Service. The interface was public interface Prueba { public abstract String sayHello(); } This instance (prueba) is not null when an outside client invoke to = the first component. But if I invoke to one method of this interface, for example "prueba.sayHello" I obtained the previous error. I have read something about anottations like @AllowsPassByReference or @Scope, but I don4t know if they are neccesary .=20 ------=_NextPart_000_0AA5_01C9EFF1.7BEA28B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Which level of the Tuscany 2.x code are you = using? The=20 various issues you ran into seem to have been fixed before. Can you try = our M3=20 RC1?
 
http://pe= ople.apache.org/~antelder/tuscany/2.0-M3-RC1/
 
Thanks,
Raymond

 
From: Santiago Miguel Aranda = Rojas=20
Sent: Thursday, June 18, 2009 3:05 AM
Subject: Re: Fwd: Problem with "implementation.osgi"=20 reference

I am checking your comments. I can not remove bundle.composite file = from=20 TestService bundle because tuscany is not working without this = file.

I have this

Caused by: java.lang.NullPointerException
at=20 org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.configureNode(NodeF= actoryImpl.java:440)
at=20 org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.access$2(NodeFactor= yImpl.java:351)
at=20 org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl$NodeImpl.<init&g= t;(NodeFactoryImpl.java:574)

and the source code about this line is

 if (composite =3D=3D null) {
            composite =3D=20 getDefaultComposite(configuration, workspace);
        }

        // Find the composite in the given = contributions
        boolean found =3D false;
        Artifact compositeFile =3D=20 contributionFactory.createArtifact();
       =  compositeFile.setUnresolved(true);
      =20  compositeFile.setURI(composite.getURI());
        for (Contribution contribution :=20 workspace.getContributions()) {
            ModelResolver = resolver =3D=20 contribution.getModelResolver();
            //     =  =20      for (Artifact artifact : = contribution.getArtifacts()){
            //     =  =20          logger.log(Level.INFO,"artifact - " +=20 artifact.getURI());
            //     =  =20      }
            Artifact = resolvedArtifact =3D=20 resolver.resolveModel(Artifact.class, compositeFile);
            //     =  =20      if (!resolvedArtifact.isUnresolved() &&=20 resolvedArtifact.getModel() instanceof Composite) {

            if=20 (!composite.isUnresolved()) {  ---> This is line 440

                // The = composite content was passed into the node and read into a composite=20 model,
                // = don't use=20 the composite found in the contribution, use that composite, but just=20 resolve
                // it = within=20 the context of the contribution
              =20  compositeProcessor.resolve(composite, resolver);

            } else {

                // Use = the=20 resolved composite we've found in the contribution
               =  composite =3D=20 (Composite)resolvedArtifact.getModel();
            }
            found =3D = true;
            //     =  =20      break;
            //     =  =20    }
        }


I guess composite variable is not null in the first iteration. But = it is=20 null when composite =3D = (Composite)resolvedArtifact.getModel(); is=20 executed. So I guess is another problem related with "contribution" = because=20 there is a comment about that "// Use the resolved composite we've = found in=20 the contribution"

Besides, while I fix these things I am going to use java code in = order to=20 register the SCA node. I have checked all your comments about = bundle.composite=20 and bundle.componentType at TestService and Calculator bundle. When I = invoke to=20 a method of CalculatorService with a WS client I have another=20 problem. 

This code of CalculatorServiceImpl

public class CalculatorServiceImpl implements CalculatorService = {
private=20 AddService addService;
private=20 TestService testService;

       public int add(int param1, int param2) = {
System.out.println = (testService.sayHello());=20  --> I have an error when this line is executed
return=20 addService.add(param1, param2);
}


public=20 AddService getAddService() {
return=20 addService;
}

@Reference
public void=20 setAddService(AddService addService) {
this.addService=20 =3D addService;
}

public=20 TestService getTestService() {
return=20 testService;
}

@Reference
public void=20 setTestService(TestService testService) {
this.testService=20 =3D testService;
}
}


This is the error . The testService instance is not null but it is = not=20 wired to TestService.  I have registered the Osgi Service registry = using=20 this code in the Activator of TestService bundle. I think this is=20 neccesary.

arg0.registerService(TestService.= class.getName(),=20 new TestServiceImpl(), null);  



Caused by: org.oasisopen.sca.ServiceUnavailableException: Unable to = create=20 SCA binding invoker for local target CalculatorComponent reference = testService=20 (bindingURI=3Dnull operation=3DsayHello)
at=20 org.apache.tuscany.sca.binding.sca.provider.RuntimeSCAReferenceBindingPro= vider.createInvoker(RuntimeSCAReferenceBindingProvider.java:200)



---------------------------------------------



2009/6/17 Raymond Feng <enjoyjava@gmail.com> Hi,

Please see my comments=20 inline.

Thanks,
Raymond=20


------------------------------------
BUNDLE = = CALCULATOR
------------------------------------
*****OSGI-INF/sca/b= undle.composite.=20 Two java components (Calculator and AddService) and one OSGi component = (TestService)

<rfeng>This is good.</rfeng>=20



<sca:composite xmlns:tuscany=3D"http://tuscany.apache.org/xmlns/sca/1.1" = xmlns:sca=3D"http://docs.oasis-open.org/ns/opencsa/sca/200903"=20 name=3D"SensorNetworkManagement" targetNamespace=3D"http://eclipse.org/SensorNetworkManagement/src/main/resou= rces/SensorNetworkManagement">

 <sca:component=20 name=3D"CalculatorComponent">
  <sca:implementation.java = = class=3D"es.amivital.calculatorservice2.CalculatorServiceImpl"/>
&n= bsp;=20  <sca:service = name=3D"CalculatorService">
 <sca:binding.ws uri=3D"http://localhost:8085/CalculatorComponent"/>
&n= bsp;=20  </sca:service>

   <sca:reference=20 name=3D"addService" target=3D"AddServiceComponent"/>
 =20  <sca:reference name=3D"testService"=20 = target=3D"TestServiceComponent/TestService"/>
 </sca:compon= ent>


 <sca:component=20 name=3D"AddServiceComponent">
  <sca:implementation.java = = class=3D"es.amivital.calculatorservice2.AddServiceImpl"/>
 <= ;/sca:component>

 <sca:component=20 name=3D"TestServiceComponent">
 <sca:implementation.osgi = bundleSymbolicName=3D"TestService"=20 = bundleVersion=3D"1.0.0"/>
 </sca:component>
</sca:= composite>




*******OSGI-INF/sca/bundle.componentType=
<rfeng>You=20 don't need to provide this file. The componentType is only needed for = the OSGi=20 component.</rfeng>=20



<componentType xmlns=3D"http://docs.oasis-open.org/ns/opencsa/sca/200903"
=  =20            xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
    =  =20        xmlns:t=3D"http://tuscany.apache.org/xmlns/sca/1.1">
 = ;=20 <!-- The service elment defines an SCA view of the OSGi service=20 -->
  <service name=3D"CalculatorService">
  =  =20   <!-- The interface will be mapped into the OSGi service = class=20 -->
      <interface.java=20 = interface=3D"es.amivital.calculatorservice2.CalculatorService"/>
&n= bsp;=20     <!-- The list of OSGi properties -->

  = = </service>
</componentType>

-----------------------= ------------
BUNDLE=20 = TESTSERVICE
-------------------------------------


*******OS= GI-INF/sca/bundle.componentType
<rfeng>This=20 is good.</rfeng>=20



<componentType xmlns=3D"http://docs.oasis-open.org/ns/opencsa/sca/200903"
=  =20            xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
    =  =20        xmlns:t=3D"http://tuscany.apache.org/xmlns/sca/1.1">
 = ;=20 <!-- The service elment defines an SCA view of the OSGi service=20 -->
  <service name=3D"TestService">
    =  =20 <!-- The interface will be mapped into the OSGi service class=20 -->
      <interface.java=20 interface=3D"es.amivital.testservice.Test"/>
    =   <!--=20 The list of OSGi properties -->

 =20 = </service>
</componentType>


*****OSGI-INF/sca/b= undle.composite
<rfeng>This=20 should be removed as the TestServiceComponent has been declared in the = calculator bundle composite.</rfeng>=20


<sca:composite xmlns:tuscany=3D"http://tuscany.apache.org/xmlns/sca/1.1" = xmlns:sca=3D"http://docs.oasis-open.org/ns/opencsa/sca/200903"=20 name=3D"SensorNetworkManagement" targetNamespace=3D"http://eclipse.org/SensorNetworkManagement/src/main/resou= rces/SensorNetworkManagement">

 <sca:component=20 name=3D"TestServiceComponent">
 <sca:implementation.java = = class=3D"es.amivital.testservice.TestImpl"/>
 </sca:compone= nt>
</sca:composite>


It=20 is necessary to have a bundle.composite file in TestService?? and=20 bundle.componentType?? Can I remove these files from TestService = bundle and=20 put the TestService4s bundle.componentType in the Calculator bundle. = You said=20 "Alternatively, you have place the file as=20 OSGI-INF/sca/<bundleSymbolicName>/bundle.componentType in the = calculator=20 bundle." Do you mean I can copy TestService4s bundle.componentType = into a=20 CalculatorService bundle?

<rfeng>Yes</rfeng>=20



Thank you very=20 = much
-----------------------------------------------------------------= --





Tuscany=20 checks the OSGi bundle based on one of the following patterns:
* An = "SCA-Composite" header in the MANIFEST.MF. It points to an SCA = composite file=20 within the bundle.
* Any files under OSGI-INF/sca.

In your = case, the=20 first bundle contains three java components. The second bundle = contains one=20 OSGi component.  There are a few options to get them work = together=20 (CalculatorService with a reference to TestService).

Option = 1:
1)=20 Place bundle.composite under OSGI-INF/sca in the calculator bundle. = The=20 composite contains 4 components: 3 java components and 1 OSGi=20 component.
The @target for CalculatorService component's = testService=20 reference will be TestService/<serviceName>.

2) Place=20 bundle.componentType under OSGI-INF/sca in the test service=20 bundle.
Alternatively, you have place the file as=20 OSGI-INF/sca/<bundleSymbolicName>/bundle.componentType in the = calculator=20 bundle.

In this case, we are going to start one = Node.

Option=20 2:
1) Place bundle.composite under OSGI-INF/sca in the calculator = bundle.=20 The composite contains 3 java components
2) Place bundle.composite = under=20 OSGI-INF/sca in the test service bundle. The composite contains 1 OSGi = component.
3) Place bundle.componentType under OSGI-INF/sca in the = test=20 service bundle.

In this case, we are going to start two nodes. = You can=20 configure the CalculatorService.testService reference and the OSGi = service to=20 use the same binding (such as RMI, or WS) to communicate. Make sure = the=20 interface is remotable. binding.sca is not working=20 yet.

Thanks,
Raymond


From: santiago.aranda@telvent.com

Sent: Tuesday, = June 16,=20 2009 1:33 AM

To: user@tuscany.apache.org

Subject: Re: Fwd: = Problem=20 with "implementation.osgi" reference




So, I have to = attach=20 two files (componentType and composite) to my two different bundles=20 (TestService and Calculator) and model it as "implementation.osgi". =   I=20 have TestService in a bundle I will add these two file and I will = design as=20 "implementation.osgi" .

But Calculator Service (this is in = other=20 bundle) has three components and they are all "implementation.java" = and it is=20 working OK. How can I put a reference to TestService?? Do I need = change=20 "implementation.osgi" in CalculatorComponent instead = "implementation.java"?=20 and is it neccesary for AddServiceComponent and = SubstractService??

I=20 will try a example I will copy my files in the email.

Thank you = very=20 much

Un saludo.
Santiago Miguel Aranda Rojas
Telvent=20 Interactiva
Extension: 35999
Telefono: = 955637418


"Raymond=20 Feng" <enjoyjava@gmail.com>
"Raymond = Feng"
15/06/2009=20 18:36
Para: <user@tuscany.apache.org>, <santiago.aranda@telvent.com>
cc:
Asunto: = Re: Fwd:=20 Problem with "implementation.osgi" reference




To = access an=20 OSGi service from the SCA component, you will have to provide
SCA=20 configurations for the OSGi bundle so that it becomes an SCA=20 component
using implementation.osgi and the OSGi service becomes an = SCA=20 service so
that the Calculator component can wire to that=20 TestService.

There are two SCA files you to provide to model = the OSGi=20 bundle as an SCA
component.
* bundle.componentType to describe = what OSGi=20 services or references are used
in the bundle (We potentially have = better=20 approach to introspect the OSGi
bundle to build this up)
*=20 bundle.composite to configure the component, for example, setting=20 the
bindings.

These files can be in a separate OSGi bundle = than the=20 one that owns=20 the
services/references.

Thanks,
Raymond

From: = Santiago=20 Miguel Aranda Rojas
Sent: Monday, June 15, 2009 4:01 AM
To: user@tuscany.apache.org
Subject: Fwd: Problem = with=20 "implementation.osgi" = reference






Hi


I can=20 not understand this sample because there are many new concepts for = me.
For=20 example "bundle.componentType". There is not too much information=20 about
that . I think I need something more simple. I have attached = a=20 picture with
my idea.


** When my SCA service was working = I had a=20 main component
"implementacion.java" with two references to another = two=20 components
(implementation.java). The main component could be = invoked as=20 Web Service.


** Now, I want another reference to a Service=20 (TestService in the picture)
that was registered by another = different=20 bundle. But this is a OSGi bundle,
without SCA information, = Composite file=20 nor ComponentType file. I mean it is
a bundle that is registering a = service=20 in the OSGi registry. I need have a
instance wired to this OSGi = service in=20 the class of the main Component in
order to invoke their=20 methods.


TestService testService;


//I need = testService=20 is not null in order to invoke their=20 methods.
testService.sayHello();




I hope you can=20 understand my problem. You can ask me if you want.


Thank = you very=20 = mucha
















=
2009/6/10=20 Raymond Feng <enjoyjava@gmail.com>

Please = see:

https://svn.apache.org/repos/asf/tuscany/java/sca/samples= /dosgi-calculator/
https://svn.apache.org/repos/asf/tuscany/java/sca/samples= /dosgi-calculator-operations/

http://cwiki.apache.org/confluence/display/TUSCANYWIKI/OS= Gi+RFC+119+Implementation

Thanks,
Raymond


From: = Santiago Miguel Aranda Rojas
Sent: Wednesday, June 10, 2009 12:07 = AM
To:=20 user@tuscany.apache.org
Subject: Re: Problem = with=20 "implementation.osgi" reference


Yes, you are right. I was = doing=20 some different tests and I copied you a
wrong composite. I wanted = to see if=20 the change of @target made an error in
tuscany.  But Tuscany = doesn4t=20 recognize this error because I think it
supposes that will be a = "remote=20 Component". I can see this in the = tuscany
trace


ADVERTENCIA:=20 Component reference target not found, it might be a remote
service = running=20 elsewhere in the SCA Domain: Composite =3D
{http://eclipse.org/SensorNetworkManagement/src/main/resou= rces/SensorNetworkManagement}SensorNetworkManagement
Service=20 =3D PruebaComponent



But it is Ok, because the component = I want if=20 an Osgi Service registered in
the Osgi registry.
I have fixed = the error=20 in @target and it is not working yet.


Do you know any = example when=20 an <implementation.osgi> component is used?




I = have=20 tried to change  "xmlns" tag, but it doesn4t=20 work.


<sca:component = name=3D"PruebaComponent">
 =20  <sca:implementation.osgi
xmlns=3D"http://docs.oasis-open.org/ns/opencsa/sca/200903"
=  =20       bundleSymbolicName=3D"RegistroService"
  =  =20     bundleVersion=3D"1.0.0">
     =20  <sca:properties service=3D"prueba.PruebaImpl">
  =  =20    </sca:properties>
 =20 =  </sca:implementation.osgi>
 </sca:component>

Thank=20 you very much.



2009/6/10 Raymond Feng <enjoyjava@gmail.com>

The @target is = pointing to a=20 wrong componentName/serviceName. It should be
"Prueba" instead of=20 "PruebaComponent" as the component name is "Prueba".


From: = Santiago=20 Miguel Aranda Rojas
Sent: Tuesday, June 09, 2009 1:28 PM
To: user@tuscany.apache.org
Subject: Re: Problem = with=20 "implementation.osgi" reference


Tuscany 2.02M. The last = version I=20 think. April 2009
----- Original Message ----- From: Raymond = Feng
To: user@tuscany.apache.org
Sent: Tuesday, June 09, = 2009 7:12=20 PM
Subject: Re: Problem with "implementation.osgi" = reference


Are=20 you using Tuscany/SCA 2.x or 1.x?


From: santiago.aranda@telvent.com
Sent: Tuesday, June = 09, 2009=20 9:15 AM
To: user@tuscany.apache.org
Subject: Problem with=20 "implementation.osgi" reference



Hello

I want to = use an=20 osgi service as a SCA component. But I can not access to
their = methods from=20 other Component.  I mean I have created a wired instance
to = the Osgi=20 Service ($Proxy25). It is not "null" but I can not invoke to = one
method=20 because an error is happening

--->Unable to create SCA = binding=20 invoker for local target
SensorNetworkManagementComponent reference = prueba=20 (bindingURI=3Dnull
operation=3DsayHello)

This is my = composite file. I=20 want to have to two components. The first had a
reference to the = second and=20 it is normal "implementation.java". The second
is the SCA component = that is=20 representing to the Osgi Service that I want to
recover. This Osgi = Service=20 was registered in the Osgi registry by Activator
class in = "RegistroService"=20 bundle.

<sca:component=20 = name=3D"SensorNetworkManagementComponent">
<sca:implementation.j= ava
class=3D"es.amivital.sensornetworkmanagement.sca.SensorNetworkMana= gementServiceImpl"/>
<sca:service=20 name=3D"SensorNetworkManagementService">
 <sca:binding.ws
uri=3D"http://localhost:8085/SensorNetworkManagementComponent"/>
</sca:service>
<sca:reference=20 name=3D"prueba"=20 = target=3D"PruebaComponent"/>
</sca:component>


<= sca:component=20 name=3D"Prueba">
  =  <sca:implementation.osgi
xmlns=3D"http://tuscany.apache.org/xmlns/sca/1.0
"
  =  =20     bundleSymbolicName=3D"RegistroService"
    =  =20   bundleVersion=3D"1.0.0">
     =20  <sca:properties service=3D"prueba.PruebaImpl">
  =  =20    </sca:properties>
 =20 =  </sca:implementation.osgi>
</sca:component>

*= **The=20 Java code--> The first component.

public class=20 SensorNetworkManagementServiceImpl=20  implements
SensorNetworkManagementService {
private Prueba = prueba;
public Prueba getPrueba() {
return=20 prueba;
}
@Reference
public void setPrueba(Prueba prueba)=20 {
this.prueba =3D prueba;
}
}

**Java code   =    =20 --> The second component. It is another bundle that = is
registering one=20 simple Osgi Service. The interface was

public interface Prueba=20 {
public abstract String = sayHello();

}





This=20 instance (prueba) is not null when an outside client invoke to = the
first=20 component. But if I invoke to one method of this interface, = for
example=20 "prueba.sayHello" I obtained the previous error.

I have read = something=20 about anottations like @AllowsPassByReference or
@Scope, but I = don4t know=20 if they are neccesary . =

------=_NextPart_000_0AA5_01C9EFF1.7BEA28B0--