tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Santiago Miguel Aranda Rojas <santiago.aranda.telv...@gmail.com>
Subject Re: Fwd: Problem with "implementation.osgi" reference
Date Wed, 17 Jun 2009 15:06:41 GMT
While I fix the previous error (register a SCA node without code) I am
writing the composite and componentType files.
I have chose the first option. But I need you check the content if it is
possible.

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


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

  <sca:component name="CalculatorComponent">
    <sca:implementation.java
class="es.amivital.calculatorservice2.CalculatorServiceImpl"/>
     <sca:service name="CalculatorService">
  <sca:binding.ws uri="http://localhost:8085/CalculatorComponent"/>
     </sca:service>

     <sca:reference name="addService" target="AddServiceComponent"/>
     <sca:reference name="testService"
target="TestServiceComponent/TestService"/>
  </sca:component>


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

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


********OSGI-INF/sca/bundle.componentType*

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

    </service>
</componentType>



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

*******OSGI-INF/sca/bundle.componentType

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

    </service>
</componentType>
*
*
*
******OSGI-INF/sca/bundle.composite*
*<sca:composite xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
name="SensorNetworkManagement" targetNamespace="
http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetworkManagement
">



  <sca:component name="TestServiceComponent">
   <sca:implementation.java class="es.amivital.testservice.TestImpl"/>
  </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 the TestService┬┤s bundle.componentType in the Calculator bundle. You
said "Alternatively, you have place the file as
OSGI-INF/sca/<bundleSymbolicName>/bundle.componentType in the calculator
bundle." Do you mean I can copy TestService┬┤s bundle.componentType into a
CalculatorService bundle?


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/<serviceName>.
>>
>> 2) Place bundle.componentType under OSGI-INF/sca in the test service
>> bundle.
>> Alternatively, you have place the file as
>> OSGI-INF/sca/<bundleSymbolicName>/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" <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
>> 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 <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/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<http://eclipse.org/SensorNetworkManagement/src/main/resources/SensorNetworkManagement%7DSensorNetworkManagement>
>> 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 <implementation.osgi> component is used?
>>
>>
>>
>>
>> I have tried to change  "xmlns" tag, but it doesn4t work.
>>
>>
>> <sca:component name="PruebaComponent">
>>      <sca:implementation.osgi
>> xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
>>           bundleSymbolicName="RegistroService"
>>           bundleVersion="1.0.0">
>>          <sca:properties service="prueba.PruebaImpl">
>>          </sca:properties>
>>      </sca:implementation.osgi>
>>    </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
>> "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.
>>
>> <sca:component name="SensorNetworkManagementComponent">
>>  <sca:implementation.java
>>
>> class="es.amivital.sensornetworkmanagement.sca.SensorNetworkManagementServiceImpl"/>
>>  <sca:service name="SensorNetworkManagementService">
>>   <sca:binding.ws
>> uri="http://localhost:8085/SensorNetworkManagementComponent"/>
>>  </sca:service>
>> <sca:reference name="prueba" target="PruebaComponent"/>
>> </sca:component>
>>
>>
>> <sca:component name="Prueba">
>>      <sca:implementation.osgi
>> xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
>>           bundleSymbolicName="RegistroService"
>>           bundleVersion="1.0.0">
>>          <sca:properties service="prueba.PruebaImpl">
>>          </sca:properties>
>>      </sca:implementation.osgi>
>> </sca:component>
>>
>> ***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 .
>>
>
>

Mime
View raw message