Return-Path: Delivered-To: apmail-tuscany-user-archive@www.apache.org Received: (qmail 89221 invoked from network); 18 Jun 2009 10:06:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jun 2009 10:06:21 -0000 Received: (qmail 39238 invoked by uid 500); 18 Jun 2009 10:06:32 -0000 Delivered-To: apmail-tuscany-user-archive@tuscany.apache.org Received: (qmail 39170 invoked by uid 500); 18 Jun 2009 10:06:32 -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 39161 invoked by uid 99); 18 Jun 2009 10:06:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 10:06:32 +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 (nike.apache.org: domain of santiago.aranda.telvent@gmail.com designates 209.85.220.207 as permitted sender) Received: from [209.85.220.207] (HELO mail-fx0-f207.google.com) (209.85.220.207) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 10:06:18 +0000 Received: by fxm3 with SMTP id 3so868685fxm.20 for ; Thu, 18 Jun 2009 03:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=/pN620KhrIwN2cOVpLXdwxRIMeUTKrWCLdal3lWio4M=; b=Qr8WGWv3HSPnv0i/r1tWBr5m/o0LAQTvbfI4kTodyQRzFZmjbWMTMfk/OlBK2N0GaE 1hpjxKBhP/GPrR8SaSKj6EuEFxy1WkIGDkUox53k2CemYtX/kSSumlLT+Vl1OM67oc1V AKPoE93bvG6l3tV7gDNiNA2wmFg/cbc6SYgWc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type; b=HbmsMc/8oLaWxZSaF4YmbuAVVh+FYIxw4CyGXkW/zmHOn9QyS5qMf2GrfSlnvvj/4p +ltFxEfoVK+v5hHC60inM/vA1ag5NDHw9rIHAv+WBmkgDRgLmZgonYao/Y0bGyfoiiZX rKpXrnslR4wtiT2UtCDS+lIVqxOwJXjdqBS/s= MIME-Version: 1.0 Received: by 10.223.107.68 with SMTP id a4mr918160fap.104.1245319557370; Thu, 18 Jun 2009 03:05:57 -0700 (PDT) Reply-To: santiago.aranda@telvent.com In-Reply-To: <9771BAEF061E4E7E8E405E9A44676828@rfengt61p> References: <9AB1B1B3F4BC4D8D870ACA756EC59664@rfengt61p> <833c9480906170756w46d869e4j8a297baf0d64f8e3@mail.gmail.com> <833c9480906170806kdbc9b9axdfe02e021c4ae49c@mail.gmail.com> <9771BAEF061E4E7E8E405E9A44676828@rfengt61p> Date: Thu, 18 Jun 2009 12:05:57 +0200 Message-ID: <833c9480906180305h7e6bd888kf69b62597ac55591@mail.gmail.com> Subject: Re: Fwd: Problem with "implementation.osgi" reference From: Santiago Miguel Aranda Rojas To: user@tuscany.apache.org Content-Type: multipart/alternative; boundary=001636c5a440d953c9046c9c8d81 X-Virus-Checked: Checked by ClamAV on apache.org --001636c5a440d953c9046c9c8d81 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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(NodeFactoryImpl.java:440) * at org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.access$2(NodeFactoryImpl.java:351) at org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl$NodeImpl.(NodeFactoryImpl.java:574) and the source code about this line is if (composite == null) { composite = getDefaultComposite(configuration, workspace); } // Find the composite in the given contributions boolean found = false; Artifact compositeFile = contributionFactory.createArtifact(); compositeFile.setUnresolved(true); compositeFile.setURI(composite.getURI()); for (Contribution contribution : workspace.getContributions()) { ModelResolver resolver = contribution.getModelResolver(); // for (Artifact artifact : contribution.getArtifacts()){ // logger.log(Level.INFO,"artifact - " + artifact.getURI()); // } Artifact resolvedArtifact = 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 = (Composite)resolvedArtifact.getModel(); } found = true; // break; // } } I guess composite variable is not null in the first iteration. But it is null when* composite = (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. 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 = addService; } public TestService getTestService() { return testService; } @Reference public void setTestService(TestService testService) { this.testService = 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); * Caused by: org.oasisopen.sca.ServiceUnavailableException: Unable to create SCA binding invoker for local target CalculatorComponent reference testService (bindingURI=null operation=sayHello) at org.apache.tuscany.sca.binding.sca.provider.RuntimeSCAReferenceBindingProvider.createInvoker(RuntimeSCAReferenceBindingProvider.java:200) --------------------------------------------- 2009/6/17 Raymond Feng > Hi, > > Please see my comments inline. > > Thanks, > Raymond > > ------------------------------------ > BUNDLE CALCULATOR > ------------------------------------ > *****OSGI-INF/sca/bundle.composite. Two java components (Calculator and > AddService) and one OSGi component (TestService) > > This is good. > > > xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903" > name="SensorNetworkManagement" targetNamespace=" > http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetworkManagement > "> > > > class="es.amivital.calculatorservice2.CalculatorServiceImpl"/> > > > > > > target="TestServiceComponent/TestService"/> > > > > > class="es.amivital.calculatorservice2.AddServiceImpl"/> > > > > bundleVersion="1.0.0"/> > > > > > > > *******OSGI-INF/sca/bundle.componentType > You don't need to provide this file. The componentType is only > needed for the OSGi component. > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"> > > > > interface="es.amivital.calculatorservice2.CalculatorService"/> > > > > > > ----------------------------------- > BUNDLE TESTSERVICE > ------------------------------------- > > > *******OSGI-INF/sca/bundle.componentType > This is good. > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"> > > > > > > > > > > > *****OSGI-INF/sca/bundle.composite > This should be removed as the TestServiceComponent has been declared > in the calculator bundle composite. > > xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903" > name="SensorNetworkManagement" targetNamespace=" > http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetworkManagement > "> > > > > > > > > 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 > > > > 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-calculator/ > > https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-calculator-operations/ > > > http://cwiki.apache.org/confluence/display/TUSCANYWIKI/OSGi+RFC+119+Implementation > > 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 = > { > http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetworkManagement}SensorNetworkManagement > Service = 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. > > > > xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" > bundleSymbolicName="RegistroService" > bundleVersion="1.0.0"> > > > > > > > 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=null > operation=sayHello) > > 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. > > > > class="es.amivital.sensornetworkmanagement.sca.SensorNetworkManagementServiceImpl"/> > > uri="http://localhost:8085/SensorNetworkManagementComponent"/> > > > > > > > xmlns="http://tuscany.apache.org/xmlns/sca/1.0" > bundleSymbolicName="RegistroService" > bundleVersion="1.0.0"> > > > > > > ***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 = 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 . > --001636c5a440d953c9046c9c8d81 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I am checking your comments. I can not remove bundle.composite file fr= om 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(NodeFa= ctoryImpl.java:440)
at org.apache.tuscany.sca.node.osgi.impl.NodeFactor= yImpl.access$2(NodeFactoryImpl.java:351)
at or= g.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl$NodeImpl.<init>(N= odeFactoryImpl.java:574)

and the source code about= this line is

=A0if (composite =3D=3D null) {
=A0=A0 = =A0 =A0 =A0 =A0 =A0composite =3D getDefaultComposite(configuration, workspa= ce);
=A0=A0 =A0 =A0 =A0}

=A0=A0 =A0 =A0 = =A0// Find the composite in the given contributions
=A0=A0 =A0 =A0 =A0boolean found =3D false;
=A0=A0 =A0 =A0 = =A0Artifact compositeFile =3D contributionFactory.createArtifact();
=A0=A0 =A0 =A0 =A0compositeFile.setUnresolved(true);
=A0=A0 = =A0 =A0 =A0compositeFile.setURI(composite.getURI());
=A0=A0 =A0 =A0 =A0for (Contribution contribution : workspace.getContri= butions()) {
=A0=A0 =A0 =A0 =A0 =A0 =A0ModelResolver resolver =3D= contribution.getModelResolver();
=A0=A0 =A0 =A0 =A0 =A0 =A0// = =A0 =A0 =A0 =A0 =A0 =A0for (Artifact artifact : contribution.getArtifacts()= ){
=A0=A0 =A0 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0logger.log= (Level.INFO,"artifact - " + artifact.getURI());
=A0=A0 = =A0 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0}
=A0=A0 =A0 =A0 =A0= =A0 =A0Artifact resolvedArtifact =3D resolver.resolveModel(Artifact.class,= compositeFile);
=A0=A0 =A0 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0if (!resolvedArtif= act.isUnresolved() && resolvedArtifact.getModel() instanceof Compos= ite) {

=A0=A0 =A0 =A0 =A0 =A0 =A0if (!composite= .isUnresolved()) { =A0---> This is line 440

=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// The composite cont= ent was passed into the node and read into a composite model,
=A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// don't use the composite found in the = contribution, use that composite, but just resolve
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// it within the context of the cont= ribution
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compositeProcessor.res= olve(composite, resolver);

=A0=A0 =A0 =A0 =A0 =A0 = =A0} else {

=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// U= se the resolved composite we've found in the contribution
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0composite =3D (Composite)resolvedArt= ifact.getModel();
=A0=A0 =A0 =A0 =A0 =A0 =A0}
=A0=A0 = =A0 =A0 =A0 =A0 =A0found =3D true;
=A0=A0 =A0 =A0 =A0 =A0 =A0// = =A0 =A0 =A0 =A0 =A0 =A0break;
=A0=A0 =A0 =A0 =A0 =A0 =A0// =A0 = =A0 =A0 =A0 =A0}
=A0=A0 =A0 =A0 =A0}


I g= uess composite variable is not null in the first iteration. But it is null = when=A0composite =3D (Composite)resolvedArtifact.getModel(); is exec= uted. So I guess is another problem related with "contribution" b= ecause 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 co= mments about bundle.composite and bundle.componentType at TestService and C= alculator bundle. When I invoke to a method of CalculatorService with a WS = client I have another problem.=A0

This code of CalculatorServiceImpl

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

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

publi= c AddService getAddService() {
return addService;
}

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

public TestService getTestService()= {
retu= rn testService;
}

@Reference
publi= c void setTestService(TestService testService) {
this.testService =3D test= Service;
}
}


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

arg0.registerService(TestService.class.getName(), new T= estServiceImpl(), null); =A0


Caused by: org.oasisopen.sca.ServiceUnavailableException: Unable= to create SCA binding invoker for local target CalculatorComponent referen= ce testService (bindingURI=3Dnull operation=3DsayHello)
at org.apache.tusca= ny.sca.binding.sca.provider.RuntimeSCAReferenceBindingProvider.createInvoke= r(RuntimeSCAReferenceBindingProvider.java:200)



-------------------= --------------------------



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

Please see my comments inline.

Thanks,
Raymond


------------------------------------
BUNDLE CALCULATOR
------------------------------------
*****OSGI-INF/sca/bundle.composite. Two java components (Calculator and Add= Service) and one OSGi component (TestService)

<rfeng>This is good.</rfeng>



<sca:composite xmlns:tuscany=3D"http://tuscany.apache.org/xmlns/sca/1.1<= /a>" xmlns:sca=3D"http://docs.oasis-open.org/ns/opencsa/sca/2= 00903" name=3D"SensorNetworkManagement" targetNamespace= =3D"http://eclipse.org/Sensor= NetworkManagement/src/main/resources/SensorNetworkManagement"><= br>
=A0<sca:component name=3D"CalculatorComponent">
=A0 <sca:implementation.java class=3D"es.amivital.calculatorservic= e2.CalculatorServiceImpl"/>
=A0 =A0<sca:service name=3D"CalculatorService">
=A0<sca:binding.ws u= ri=3D"http://localhost:8085/CalculatorComponent"/>
=A0 =A0</sca:service>

=A0 =A0<sca:reference name=3D"addService" target=3D"AddS= erviceComponent"/>
=A0 =A0<sca:reference name=3D"testService" target=3D"Tes= tServiceComponent/TestService"/>
=A0</sca:component>


=A0<sca:component name=3D"AddServiceComponent">
=A0 <sca:implementation.java class=3D"es.amivital.calculatorservic= e2.AddServiceImpl"/>
=A0</sca:component>

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




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



<componentType xmlns=3D"http://docs.oasis-open.org/ns/opencsa/s= ca/200903"
=A0 =A0 =A0 =A0 =A0 =A0 =A0xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"= ;
=A0 =A0 =A0 =A0 =A0 =A0 =A0xmlns:t=3D"http://tuscany.apache.org/xmlns/sca/= 1.1">
=A0 <!-- The service elment defines an SCA view of the OSGi service --&= gt;
=A0 <service name=3D"CalculatorService">
=A0 =A0 =A0 <!-- The interface will be mapped into the OSGi service cla= ss -->
=A0 =A0 =A0 <interface.java interface=3D"es.amivital.calculatorser= vice2.CalculatorService"/>
=A0 =A0 =A0 <!-- The list of OSGi properties -->

=A0 </service>
</componentType>

-----------------------------------
BUNDLE TESTSERVICE
-------------------------------------


*******OSGI-INF/sca/bundle.componentType
<rfeng>This is good.</rfeng>



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

=A0 </service>
</componentType>


*****OSGI-INF/sca/bundle.composite
<rfeng>This should be removed as the TestServiceComponent has been de= clared in the calculator bundle composite.</rfeng>
<= br>
<sca:composite xmlns:tuscany=3D"http://tuscany.apache.org/xmlns/sca/1.1<= /a>" xmlns:sca=3D"http://docs.oasis-open.org/ns/opencsa/sca/2= 00903" name=3D"SensorNetworkManagement" targetNamespace= =3D"http://eclipse.org/Sensor= NetworkManagement/src/main/resources/SensorNetworkManagement"><= br>
=A0<sca:component name=3D"TestServiceComponent">
=A0<sca:implementation.java class=3D"es.amivital.testservice.TestI= mpl"/>
=A0</sca:component>
</sca:composite>


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

<rfeng>Yes</rfeng>



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 S= CA composite file within the bundle.
* Any files under OSGI-INF/sca.

In your case, the first bundle contains three java components. The second b= undle contains one OSGi component. =A0There are a few options to get them w= ork 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 wil= l be TestService/<serviceName>.

2) Place bundle.componentType under OSGI-INF/sca in the test service bundle= .
Alternatively, you have place the file as OSGI-INF/sca/<bundleSymbolicNa= me>/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. Th= e 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 Calcul= atorService.testService reference and the OSGi service to use the same bind= ing (such as RMI, or WS) to communicate. Make sure the interface is remotab= le. binding.sca is not working yet.

Thanks,
Raymond


From: sant= iago.aranda@telvent.com

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

To: user@tusca= ny.apache.org

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



So, I have to attach two files (componentType and composite) to my two diff= erent bundles (TestService and Calculator) and model it as "implementa= tion.osgi". =A0 I have TestService in a bundle I will add these two fi= le and I will design as "implementation.osgi" .

But Calculator Service (this is in other bundle) has three components and t= hey are all "implementation.java" and it is working OK. How can I= put a reference to TestService?? Do I need change "implementation.osg= i" 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" <enjoyjava@gmail.com>
"Raymond Feng"
15/06/2009 18:36
Para: <user= @tuscany.apache.org>, <santiago.aranda@telvent.com>
cc:
Asunto: Re: Fwd: Problem with "implementation.osgi" reference




To access an OSGi service from the SCA component, you will have to provide<= br> SCA configurations for the OSGi bundle so that it becomes an SCA component<= br> 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 use= d
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@tusca= ny.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 informa= tion 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 componen= ts
(implementation.java). The main component could be invoked as Web Service.<= br>

** Now, I want another reference to a Service (TestService in the picture)<= br> that was registered by another different bundle. But this is a OSGi bundle,=
without SCA information, Composite file nor ComponentType file. I mean it i= s
a bundle that is registering a service in the OSGi registry. I need have a<= br> 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 <enjoyjava@gmail.com>

Please see:

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

http://cwiki.apache.org/confluence/di= splay/TUSCANYWIKI/OSGi+RFC+119+Implementation

Thanks,
Raymond


From: Santiago Miguel Aranda Rojas
Sent: Wednesday, June 10, 2009 12:07 AM
To: user@tusca= ny.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<= br> tuscany. =A0But 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/SensorNetworkManagem= ent}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 <implementation.osgi> component is us= ed?




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


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


Thank you very much.



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

The @target is pointing to a wrong componentName/serviceName. It should be<= br> "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@tusca= ny.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@tusca= ny.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: sant= iago.aranda@telvent.com
Sent: Tuesday, June 09, 2009 9:15 AM
To: user@tusca= ny.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. =A0I mean I have created a wired instan= ce
to the Osgi Service ($Proxy25). It is not "null" but I can not in= voke 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". T= he second
is the SCA component that is representing to the Osgi Service that I want t= o
recover. This Osgi Service was registered in the Osgi registry by Activator=
class in "RegistroService" bundle.

<sca:component name=3D"SensorNetworkManagementComponent"> <sca:implementation.java
class=3D"es.amivital.sensornetworkmanagement.sca.SensorNetworkManageme= ntServiceImpl"/>
<sca:service name=3D"SensorNetworkManagementService">
=A0<sca:binding.ws uri=3D"http://localhost:8085/SensorNetworkManagementComponen= t"/>
</sca:service>
<sca:reference name=3D"prueba" target=3D"PruebaComponent&= quot;/>
</sca:component>


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

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

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

**Java code =A0 =A0 =A0 --> The second component. It is another bundle t= hat 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 .

--001636c5a440d953c9046c9c8d81--