<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<!-- MHonArc v2.6.10 -->
	<channel>
		<title>equinox-dev</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/maillist.html</link>
		<description>equinox-dev</description>
		<language>en-us</language>
		<pubDate>Wed, 18 Nov 2009 15:51:23 GMT</pubDate>
		<lastBuildDate>Wed, 18 Nov 2009 15:51:23 GMT</lastBuildDate>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>MHonArc RSS 2.0 RCFile</generator>
		<managingEditor>webmaster@eclipse.org (Webmaster)</managingEditor>
		<webMaster>webmaster@eclipse.org (Webmaster)</webMaster>
		<image>
			<title>equinox-dev</title>
			<url>http://www.eclipse.org/eclipse.org-common/themes/Phoenix/images/eclipse_home_header.jpg</url>
			<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/maillist.html</link>
		</image>
 

	<item>
		<title>Re: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05958.html</link>
		<description> David, While Thomas's suggestion is absolutely correct, I think you need to step back from the problem a little and ask if this is the right approach. If your consumer bundle needs the Interface1 service then it should simply bind to an instance of Interf...</description>
		<content:encoded><![CDATA[
<p>You should keep in mind the different views of the service between the registrant and the consumer.  On the registrant (service producing/implementing) side, it is perfectly reasonable for them to register a single service object under all the different service interfaces they implement.  But I think Niel's point is on the side of the consumer bundle.  I think it is far more simple for them to simply bind to each service (interface) that they require individually instead of trying to find a particular service which implements all the service interfaces they need at once and then casting that single service to the various interfaces it implements.  As Neil points out this also couples a client to a particular type of implementation that must use a single service registration for all the service interfaces needed by the client.<br>
<br>
Tom<br>
<br>
<br>
<br>
<img width="16" height="16" src="" border="0" alt="Inactive hide details for Tim Diekmann ---11/16/2009 05:46:21 PM---Neil, one concrete example where the services need to be pro"><font color="#424282">Tim Diekmann ---11/16/2009 05:46:21 PM---Neil, one concrete example where the services need to be provided as a unit is the support for JTA (coming in the Enterprise Pr</font><br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">From:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">Tim Diekmann &lt;tdiekman@xxxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">To:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">&quot;Equinox development mailing list&quot; &lt;equinox-dev@xxxxxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Date:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">11/16/2009 05:46 PM</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Subject:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">Re: [equinox-dev] Registering two services in the same bundle</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<font size="4">Neil,</font><br>
<br>
<font size="4">one concrete example where the services need to be provided as a unit is the support for JTA (coming in the Enterprise Profile soon). In the JTA case, the provider is mandated to implement 3 services and register them, among them UserTransaction and TransactionManager. Since they come from the JTA spec, they cannot be easily combined.</font><br>
<font size="4" face="Helvetica"><br>
   Tim.</font><br>
<br>
<i><font size="1" color="#B3793D" face="Helvetica">&quot;In the end everything will be right. But since things are not right, we are not at the end yet!&quot;</font></i><br>
<i><font size="1" color="#B3793D" face="Helvetica">   -- Unknown</font></i><br>
<br>
<br>
<br>
<font size="4">On Nov 16, 2009, at 3:32 PM, Neil Bartlett wrote:</font><br>

<ul>
<ul><font size="4">David,</font><br>
<br>
<font size="4">While Thomas's suggestion is absolutely correct, I think you need to step back from the problem a little and ask if this is the right approach.</font><br>
<br>
<font size="4">If your consumer bundle needs the Interface1 service then it should simply bind to an instance of Interface1. If it also needs the Interface2 service then it should just bind to Interface2. The consumer should not *require* both services to be offered by the same object, because this will severely limit the ability of other producers to offer an alternative implementation for those services. In other words, you are coupling your consumer to an implementation detail of the producer which it shouldn't care about.</font><br>
<br>
<font size="4">On the other hand, if your API is such that these interfaces really should be published and consumed as a unit, then maybe you should just merge them into one interface, or declare a new Interface3 that extends both Interface1 and Interface2.</font><br>
<br>
<font size="4">Neil</font></ul>
</ul>
<tt>_______________________________________________<br>
equinox-dev mailing list<br>
equinox-dev@xxxxxxxxxxx<br>
</tt><tt><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a></tt><tt><br>
</tt><br>
<br>

<p><a href="gifnWdmS54JRn.gif" ><img src="gifnWdmS54JRn.gif" alt="GIF image"></a></p>
<p><a href="gifLlF1WRy020.gif" ><img src="gifLlF1WRy020.gif" alt="GIF image"></a></p>
]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 15:42:59 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05958.html</guid>
		<author>tjwatson@xxxxxxx (Thomas Watson)</author>
	</item>
	<item>
		<title>[equinox-dev] How to manage SIP Servlet as a bundle in OSGI platform</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05957.html</link>
		<description> Dear: I just started studying and using OSGI,and I found that osgi support deploying the Http Service into the platform as a bundle, depending on the org.eclipse.equinox.http bundle that just like the web container.; I wonder whether the osgi also support...</description>
		<content:encoded><![CDATA[<table width="100%"><tr><td style="">


<DIV><FONT face=Verdana size=2>Dear:</FONT></DIV>
<DIV style="TEXT-INDENT: 2em">I&nbsp;just&nbsp;started&nbsp;studying and 
using&nbsp;OSGI,and I found that osgi support deploying the&nbsp;Http Service 
into the platform as a bundle, depending&nbsp;on&nbsp;the 
org.eclipse.equinox.http bundle that just like the web container.&nbsp;</DIV>
<DIV style="TEXT-INDENT: 2em">I&nbsp;wonder whether the osgi also support the 
SIP Service,I want to deploy the SIP Servlet into the OSGI as a bundle ,and how 
to do. Thank you.</DIV>
<DIV style="TEXT-INDENT: 2em">&nbsp;</DIV>
<DIV>Best Regards</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2></FONT>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2></FONT>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2></FONT>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2></FONT>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2>2009-11-18 
</FONT></DIV><FONT face=Verdana size=2>
<HR style="WIDTH: 122px; HEIGHT: 2px" align=left SIZE=2>

<DIV><FONT face=Verdana color=#c0c0c0 size=2><SPAN>Fox 
Su</SPAN>&nbsp;</FONT></DIV></FONT>
</td></tr></table>]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 13:09:17 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05957.html</guid>
		<author>sjrfox@xxxxxxx (&#x82CF;&#x664B;&#x8363;)</author>
	</item>


	<item>
		<title>Re: [equinox-dev] attach a fragment in runtime</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05956.html</link>
		<description> Equinox </description>
		<content:encoded><![CDATA[<pre>


Thomas Watson wrote:
&gt; 
&gt; 
&gt;&gt;That console output does not look familiar to me.  Is that from the
Equinox
&gt;&gt;console?  
&gt; 
&gt; No, it's a knopflerfish console
&gt; thank you for replying.
&gt; 
&gt; 
&gt; 
&gt; |------------&gt;
&gt; | From:      |
&gt; |------------&gt;
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt;   |prof_trg &lt;prof.target@xxxxxxxxx&gt;                                                                                                                 
&gt; |
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt; |------------&gt;
&gt; | To:        |
&gt; |------------&gt;
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt;   |equinox-dev@xxxxxxxxxxx                                                                                                                          
&gt; |
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt; |------------&gt;
&gt; | Date:      |
&gt; |------------&gt;
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt;   |10/08/2009 03:53 PM                                                                                                                              
&gt; |
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt; |------------&gt;
&gt; | Subject:   |
&gt; |------------&gt;
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt;   |[equinox-dev] attach a fragment in runtime                                                                                                       
&gt; |
&gt;  
&gt; &gt;--------------------------------------------------------------------------------------------------------------------------------------------------|
&gt; 
&gt; 
&gt; 
&gt; 
&gt; 
&gt; 
&gt; Hello,
&gt; I am trying to attach a fragment to its host at runtime, but I have some
&gt; issues...
&gt; in fact , I uninstall the fragment then I install it again, but as if it
&gt; is
&gt; not detected by the host...
&gt; 
&gt; before uninstalling the fragment, I have this line in my console:
&gt; 
&gt; 29 2/active Host (h:28)
&gt; 28 2/resolved Fragment (f:29)
&gt; 
&gt; after uninstalling and then installing the fragment again :
&gt; 
&gt; 29 2/active Host (h:28)
&gt; 30 2/installed Fragment
&gt; 
&gt; would someone help me understanding this?
&gt; Regard
&gt; --
&gt; View this message in context:
&gt; <a  href="http://www.nabble.com/attach-a-fragment-in-runtime-tp25810711p25810711.html">http://www.nabble.com/attach-a-fragment-in-runtime-tp25810711p25810711.html</a>
&gt; Sent from the Equinox - Dev mailing list archive at Nabble.com.
&gt; 
&gt; _______________________________________________
&gt; equinox-dev mailing list
&gt; equinox-dev@xxxxxxxxxxx
&gt; <a  href="https://dev.eclipse.org/mailman/listinfo/equinox-dev">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a>
&gt; 
&gt; 
&gt;  
&gt;  
&gt; _______________________________________________
&gt; equinox-dev mailing list
&gt; equinox-dev@xxxxxxxxxxx
&gt; <a  href="https://dev.eclipse.org/mailman/listinfo/equinox-dev">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a>
&gt; 
&gt; 

-- 
View this message in context: <a  href="http://old.nabble.com/attach-a-fragment-in-runtime-tp25810711p26392026.html">http://old.nabble.com/attach-a-fragment-in-runtime-tp25810711p26392026.html</a>
Sent from the Equinox - Dev mailing list archive at Nabble.com.


</pre>]]></content:encoded>
		<pubDate>Tue, 17 Nov 2009 15:38:48 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05956.html</guid>
		<author>prof.target@xxxxxxx (prof_trg)</author>
	</item>
	<item>
		<title>RE: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05955.html</link>
		<description> Hi Thomas,   Thank you for your answer,   So once I get ServiceReference = X getServiceReferences using the filter that you told me &amp;quot;(&amp;amp;(objectClass=Interface1)(objectClass=Interface2))&amp;quot;, I have to use two castings for getting two different services like O...</description>
		<content:encoded><![CDATA[<table width="100%"><tr><td style="a:link { color: blue } a:visited { color: purple } ">





<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi Neil,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thank you for your answer,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I agree with you, in the final deployment, I should not be able
to get two interfaces from the same object because in this case it would better
to merge them in another interface3 as you said, I just wanted to ask the
different ways to do that.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>David<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] <b>En
nombre de </b>Neil Bartlett<br>
<b>Enviado el:</b> martes, 17 de noviembre de 2009 0:32<br>
<b>Para:</b> Equinox development mailing list<br>
<b>Asunto:</b> Re: [equinox-dev] Registering two services in the same bundle<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>David,<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>While Thomas's suggestion is absolutely correct, I think you
need to step back from the problem a little and ask if this is the right
approach.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>If your consumer bundle needs the Interface1 service then it
should simply bind to an instance of Interface1. If it also needs the
Interface2 service then it should just bind to Interface2. The consumer should
not *require* both services to be offered by the same object, because this will
severely limit the ability of other producers to offer an alternative
implementation for those services. In other words, you are coupling your
consumer to an implementation detail of the producer which it shouldn't care
about.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>On the other hand, if your API is such that these interfaces
really should be published and consumed as a unit, then maybe you should just
merge them into one interface, or declare a new Interface3 that extends both
Interface1 and Interface2.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'>Neil<o:p></o:p></p>

<div>

<p class=MsoNormal>On Mon, Nov 16, 2009 at 3:38 PM, David Conde &lt;<a
href="mailto:dconde@xxxxxxxx">dconde@xxxxxxxx</a>&gt; wrote:<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi
Thomas,<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thank
you for your answer,<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>So
once I get ServiceReference = X getServiceReferences using the filter that you
told me &quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;, I
have to use two castings for getting two different services like Object1 =
(Interface1) BundleContext.getReference (X) and Object2= (Interface2)
BundleContext.getReference(X), and then use two instances of the same object for
using two different interfaces implemented by this same object, am I right? Is
there any other mechanism for using the same object for two different
interfaces, because really the object provides two different services (2
different interfaces)<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thank
you in advance<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>David<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span
style='font-size:10.0pt'>De:</span></b><span style='font-size:10.0pt'> <a
href="mailto:equinox-dev-bounces@xxxxxxxxxxx" target="_blank">equinox-dev-bounces@xxxxxxxxxxx</a>
[mailto:<a href="mailto:equinox-dev-bounces@xxxxxxxxxxx" target="_blank">equinox-dev-bounces@xxxxxxxxxxx</a>]
<b>En nombre de </b>Thomas Watson<br>
<b>Enviado el:</b> lunes, 16 de noviembre de 2009 15:53<br>
<b>Para:</b> Equinox development mailing list<br>
<b>Asunto:</b> Re: [equinox-dev] Registering two services in the same bundle</span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p style='margin-bottom:12.0pt'>You can use the
registerService(java.lang.String[] clazzes,java.lang.Object service,
java.util.Dictionary properties) to register your service object under multiple
service interfaces. This will allow you to control the registration with a
single ServiceRegistration object. But in order to get a ServiceReference that
is guaranteed to implement both service interfaces then you must use the
getServiceReferences(String clazz, String filter) with a null clazz and a
filter that looks something like this:<br>
<br>
&quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;<br>
<br>
This will ensure that the ServiceReference objects returned implement both
Interface1 and Interface2. This should allow you to cast the Object returned
from getService(ServiceReference) to both Interface1 and Interface2 in your
service using client bundle. But for client code I recommend you use an
injection mechanism (like Declarative Services, Spring DM or Blueprint) if
possible so you don't have to worry about tracking the services yourself.<br>
<br>
Tom<br>
<br>
<br>
<br>
<img border=0 width=16 height=16 id="_x0000_i1025"
src=""
alt="Inactive hide details for &quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,"><span
style='color:#424282'>&quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,</span><o:p></o:p></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%"
 style='width:100.0%'>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=96 height=1 id="_x0000_i1026"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>From:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=1 height=1 id="_x0000_i1027"
  src=""><br>
  <span style='font-size:10.0pt'>&quot;David Conde&quot; &lt;<a
  href="mailto:dconde@xxxxxxxx" target="_blank">dconde@xxxxxxxx</a>&gt;</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=96 height=1 id="_x0000_i1028"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>To:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=1 height=1 id="_x0000_i1029"
  src=""><br>
  <span style='font-size:10.0pt'>&quot;'Equinox development mailing list'&quot;
  &lt;<a href="mailto:equinox-dev@xxxxxxxxxxx" target="_blank">equinox-dev@xxxxxxxxxxx</a>&gt;</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=96 height=1 id="_x0000_i1030"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Date:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=1 height=1 id="_x0000_i1031"
  src=""><br>
  <span style='font-size:10.0pt'>11/16/2009 02:34 AM</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=96 height=1 id="_x0000_i1032"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Subject:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img
  border=0 width=1 height=1 id="_x0000_i1033"
  src=""><br>
  <span style='font-size:10.0pt'>[equinox-dev] Registering two services in the
  same bundle</span><o:p></o:p></p>
  </td>
 </tr>
</table>

<div>

<div class=MsoNormal>

<hr size=2 width="100%" noshade style='color:#8091A5' align=left>

</div>

</div>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><br>
<br>
<br>
Hi,<br>
<br>
<span style='font-family:"Courier New"'>I would like to know what I have to do
for registering two different services in a same bundle. I mean, I have two
create a service object which implements two different interfaces (registering
two different services). I thought about using <b>registerService</b>(java.lang.String[]
clazzes,java.lang.Object service,</span><br>
java.util.Dictionary properties) by including Interface1.class.getName() and
Interface2.class.getName() in String array called clazzes.<br>
<br>
However, I found as a problem that if I want to use this object service I have
to get two service objects, one for Interface1 and another one for Interface2
by doing BundleContext.getServiceReference(Interface1) &amp;
BundleContext.getServiceReference(Interface2), am I missing anything?Does it
exist another way to do that?<br>
<br>
Thanks in advance <tt><span style='font-size:10.0pt'>_______________________________________________</span></tt><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<tt>equinox-dev mailing list</tt><br>
<tt><a href="mailto:equinox-dev@xxxxxxxxxxx" target="_blank">equinox-dev@xxxxxxxxxxx</a></tt><br>
<tt><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev"
target="_blank">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a></tt></span><o:p></o:p></p>

</div>

</div>

</div>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
equinox-dev mailing list<br>
<a href="mailto:equinox-dev@xxxxxxxxxxx">equinox-dev@xxxxxxxxxxx</a><br>
<a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev" target="_blank">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a><o:p></o:p></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>




</td></tr></table><p><a href="gifIWWPMplNCz.gif" ><img src="gifIWWPMplNCz.gif" alt="GIF image"></a></p>
<p><a href="pngFyBsJQcZDV.png" ><img src="pngFyBsJQcZDV.png" alt="PNG image"></a></p>
<p><a href="pngHxoNtL8xbD.png" ><img src="pngHxoNtL8xbD.png" alt="PNG image"></a></p>
]]></content:encoded>
		<pubDate>Tue, 17 Nov 2009 07:55:14 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05955.html</guid>
		<author>dconde@xxxxxxx (David Conde)</author>
	</item>


	<item>
		<title>Re: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05954.html</link>
		<description>Neil,one concrete example where the services need to be provided as a unit is the support for JTA (coming in the Enterprise Profile soon). In the JTA case, the provider is mandated to implement 3 services and register them, among them UserTransaction and T...</description>
		<content:encoded><![CDATA[<table width="100%"><tr><td style="">Neil,<div><br></div><div>one concrete example where the services need to be provided as a unit is the support for JTA (coming in the Enterprise Profile soon). In the JTA case, the provider is mandated to implement 3 services and register them, among them UserTransaction and TransactionManager. Since they come from the JTA spec, they cannot be easily combined.<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><br class="Apple-interchange-newline">&nbsp;&nbsp; Tim.</div><div><br></div><div><font class="Apple-style-span" color="#B3793D"><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px; "><i>"In the end everything will be right. But since things are not right, we are not at the end yet!"</i></span></font></font></div><div><font class="Apple-style-span" color="#B3793D"><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px; "><i>&nbsp;&nbsp; -- Unknown</i></span></font></font></div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Nov 16, 2009, at 3:32 PM, Neil Bartlett wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">David,<div><br></div><div>While Thomas's suggestion is absolutely correct, I think you need to step back from the problem a little and ask if this is the right approach.</div><div><br></div><div>If your consumer bundle needs the Interface1 service then it should simply bind to an instance of Interface1. If it also needs the Interface2 service then it should just bind to Interface2. The consumer should not *require* both services to be offered by the same object, because this will severely limit the ability of other producers to offer an alternative implementation for those services. In other words, you are coupling your consumer to an implementation detail of the producer which it shouldn't care about.</div>
<div><br></div><div>On the other hand, if your API is such that these interfaces really should be published and consumed as a unit, then maybe you should just merge them into one interface, or declare a new Interface3 that extends both Interface1 and Interface2.</div>
<div><br></div><div>Neil<br></div></blockquote></div><br></div></td></tr></table>]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 23:46:06 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05954.html</guid>
		<author>tdiekman@xxxxxxx (Tim Diekmann)</author>
	</item>
	<item>
		<title>[equinox-dev] Equinox tagged for the next Helios integration build.</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05953.html</link>
		<description> The map file has been updated for the following Bug changes: The following projects have changed: org.eclipse.equinox.launcher.win32.win32.ia64 org.eclipse.equinox.launcher.releng org.eclipse.equinox.launcher.carbon.macosx org.eclipse.equinox.launcher.win...</description>
		<content:encoded><![CDATA[
<p>The map file has been updated for the following Bug changes:<br>
+ Bug 244468. Support reading extension registry in any locale (FIXED)<br>
+ Bug 275379. [launcher] Native Launcher looks for shared library in nl fragment (FIXED)<br>
+ Bug 291919. [launcher] return different error codes when failing to start java (FIXED)<br>
+ Bug 293831. [launcher] AIX needs jre/lib/&lt;arch&gt; on library search path (ASSIGNED)<br>
+ Bug 293840. [launcher] AIX build of eclipse binary needs adjusting. (FIXED)<br>
<br>
The following projects have changed:<br>
org.eclipse.equinox.launcher.win32.win32.ia64<br>
org.eclipse.equinox.launcher.releng<br>
org.eclipse.equinox.launcher.carbon.macosx<br>
org.eclipse.equinox.launcher.win32.win32.x86_64<br>
org.eclipse.equinox.launcher.gtk.linux.ppc<br>
org.eclipse.equinox.launcher.gtk.solaris.x86<br>
org.eclipse.equinox.launcher.motif.solaris.sparc<br>
org.eclipse.equinox.launcher.motif.linux.x86<br>
org.eclipse.equinox.launcher.gtk.linux.x86_64<br>
org.eclipse.equinox.launcher.cocoa.macosx.x86_64<br>
org.eclipse.equinox.launcher.motif.hpux.ia64_32<br>
org.eclipse.equinox.launcher.wpf.win32.x86<br>
org.eclipse.equinox.launcher.cocoa.macosx<br>
org.eclipse.equinox.launcher<br>
org.eclipse.equinox.launcher.win32.win32.x86<br>
org.eclipse.equinox.executable<br>
org.eclipse.equinox.launcher.gtk.solaris.sparc<br>
org.eclipse.equinox.launcher.motif.aix.ppc<br>
org.eclipse.equinox.common<br>
org.eclipse.equinox.launcher.gtk.linux.x86<br>
<br>
Tom<br>
<br>
]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 23:45:07 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05953.html</guid>
		<author>tjwatson@xxxxxxx (Thomas Watson)</author>
	</item>
	<item>
		<title>Re: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05952.html</link>
		<description> </description>
		<content:encoded><![CDATA[David,<div><br></div><div>While Thomas&#39;s suggestion is absolutely correct, I think you need to step back from the problem a little and ask if this is the right approach.</div><div><br></div><div>If your consumer bundle needs the Interface1 service then it should simply bind to an instance of Interface1. If it also needs the Interface2 service then it should just bind to Interface2. The consumer should not *require* both services to be offered by the same object, because this will severely limit the ability of other producers to offer an alternative implementation for those services. In other words, you are coupling your consumer to an implementation detail of the producer which it shouldn&#39;t care about.</div>
<div><br></div><div>On the other hand, if your API is such that these interfaces really should be published and consumed as a unit, then maybe you should just merge them into one interface, or declare a new Interface3 that extends both Interface1 and Interface2.</div>
<div><br></div><div>Neil<br><br><div class="gmail_quote">On Mon, Nov 16, 2009 at 3:38 PM, David Conde <span dir="ltr">&lt;<a href="mailto:dconde@xxxxxxxx">dconde@xxxxxxxx</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">










<div lang="ES" link="blue" vlink="purple">

<div>

<p class="MsoNormal">Hi Thomas,</p>

<p class="MsoNormal">&#xC2;</p>

<p class="MsoNormal">Thank you for your answer,</p>

<p class="MsoNormal">&#xC2;</p>

<p class="MsoNormal">So once I get ServiceReference = X getServiceReferences
using the filter that you told me &quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;,
I have to use two castings for getting two different services like Object1 =
(Interface1) BundleContext.getReference (X) and Object2= (Interface2)
BundleContext.getReference(X), and then use two instances of the same object
for using two different interfaces implemented by this same object, am I right?
Is there any other mechanism for using the same object for two different
interfaces, because really the object provides two different services (2
different interfaces)</p>

<p class="MsoNormal">&#xC2;</p>

<p class="MsoNormal">Thank you in advance</p>

<p class="MsoNormal">&#xC2;</p>

<p class="MsoNormal">David</p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&#xC2;</span></p>

<div>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10.0pt">De:</span></b><span style="font-size:10.0pt">
<a href="mailto:equinox-dev-bounces@xxxxxxxxxxx" target="_blank">equinox-dev-bounces@xxxxxxxxxxx</a> [mailto:<a href="mailto:equinox-dev-bounces@xxxxxxxxxxx" target="_blank">equinox-dev-bounces@xxxxxxxxxxx</a>] <b>En
nombre de </b>Thomas Watson<br>
<b>Enviado el:</b> lunes, 16 de noviembre de 2009 15:53<br>
<b>Para:</b> Equinox development mailing list<br>
<b>Asunto:</b> Re: [equinox-dev] Registering two services in the same bundle</span></p>

</div>

</div><div><div></div><div class="h5">

<p class="MsoNormal">&#xC2;</p>

<p style="margin-bottom:12.0pt">You can use the
registerService(java.lang.String[] clazzes,java.lang.Object service,
java.util.Dictionary properties) to register your service object under multiple
service interfaces. This will allow you to control the registration with a
single ServiceRegistration object. But in order to get a ServiceReference that
is guaranteed to implement both service interfaces then you must use the
getServiceReferences(String clazz, String filter) with a null clazz and a
filter that looks something like this:<br>
<br>
&quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;<br>
<br>
This will ensure that the ServiceReference objects returned implement both
Interface1 and Interface2. This should allow you to cast the Object returned
from getService(ServiceReference) to both Interface1 and Interface2 in your
service using client bundle. But for client code I recommend you use an
injection mechanism (like Declarative Services, Spring DM or Blueprint) if
possible so you don&#39;t have to worry about tracking the services yourself.<br>
<br>
Tom<br>
<br>
<br>
<br>
<img width="16" height="16" src="" alt="Inactive hide details for &quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,"><span style="color:#424282">&quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,</span></p>


<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
 <tbody><tr>
  <td width="1%" valign="top" style="width:1.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="96" height="1" src=""><br>
  <span style="font-size:10.0pt;color:#5F5F5F">From:</span></p>
  </td>
  <td width="100%" valign="top" style="width:100.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="1" height="1" src=""><br>
  <span style="font-size:10.0pt">&quot;David Conde&quot;
  &lt;<a href="mailto:dconde@xxxxxxxx" target="_blank">dconde@xxxxxxxx</a>&gt;</span></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign="top" style="width:1.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="96" height="1" src=""><br>
  <span style="font-size:10.0pt;color:#5F5F5F">To:</span></p>
  </td>
  <td width="100%" valign="top" style="width:100.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="1" height="1" src=""><br>
  <span style="font-size:10.0pt">&quot;&#39;Equinox development mailing list&#39;&quot;
  &lt;<a href="mailto:equinox-dev@xxxxxxxxxxx" target="_blank">equinox-dev@xxxxxxxxxxx</a>&gt;</span></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign="top" style="width:1.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="96" height="1" src=""><br>
  <span style="font-size:10.0pt;color:#5F5F5F">Date:</span></p>
  </td>
  <td width="100%" valign="top" style="width:100.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="1" height="1" src=""><br>
  <span style="font-size:10.0pt">11/16/2009 02:34 AM</span></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign="top" style="width:1.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="96" height="1" src=""><br>
  <span style="font-size:10.0pt;color:#5F5F5F">Subject:</span></p>
  </td>
  <td width="100%" valign="top" style="width:100.0%;padding:0cm 0cm 0cm 0cm">
  <p class="MsoNormal"><img width="1" height="1" src=""><br>
  <span style="font-size:10.0pt">[equinox-dev] Registering two services in the
  same bundle</span></p>
  </td>
 </tr>
</tbody></table>

<div class="MsoNormal">

<hr size="2" width="100%" noshade style="color:#8091A5" align="left">

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<br>
<span>Hi,</span><br>
<br>
<span style="font-family:&quot;Courier New&quot;">I would like to know what I have to do
for registering two different services in a same bundle. I mean, I have two
create a service object which implements two different interfaces (registering
two different services). I thought about using <b>registerService</b>(java.lang.String[]
clazzes,java.lang.Object service,</span><br>
<span>java.util.Dictionary
properties) by including Interface1.class.getName() and
Interface2.class.getName() in String array called clazzes.</span><br>
<br>
<span>However, I found as a problem
that if I want to use this object service I have to get two service objects,
one for Interface1 and another one for Interface2 by doing
BundleContext.getServiceReference(Interface1) &amp;
BundleContext.getServiceReference(Interface2), am I missing anything?Does it
exist another way to do that?</span><br>
<br>
<span>Thanks in advance </span><tt><span style="font-size:10.0pt">_______________________________________________</span></tt><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
<tt>equinox-dev mailing list</tt><br>
<tt><a href="mailto:equinox-dev@xxxxxxxxxxx" target="_blank">equinox-dev@xxxxxxxxxxx</a></tt><br>
<tt><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev" target="_blank">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a></tt><br>
<br>
</span></p>

</div></div></div>

</div>


<br>_______________________________________________<br>
equinox-dev mailing list<br>
<a href="mailto:equinox-dev@xxxxxxxxxxx">equinox-dev@xxxxxxxxxxx</a><br>
<a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev" target="_blank">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a><br>
<br></blockquote></div><br></div>
<p><a href="gifVzjWDB5AaP.gif" ><img src="gifVzjWDB5AaP.gif" alt="GIF image"></a></p>
<p><a href="pngZCgh4MkYSq.png" ><img src="pngZCgh4MkYSq.png" alt="PNG image"></a></p>
<p><a href="pngwY9UCaK1JM.png" ><img src="pngwY9UCaK1JM.png" alt="PNG image"></a></p>
]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 23:32:09 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05952.html</guid>
		<author>njbartlett@xxxxxxx (Neil Bartlett)</author>
	</item>
	<item>
		<title>[equinox-dev] Tagged core.* and Equinox for Helios stream build</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05951.html</link>
		<description> The map file has been updated for the following Bug changes: registry in any locale (FIXED) only sets exec bit for owner. (ASSIGNED) workspace refresh due to FileInfo carrying substring baggage (FIXED) The following projects have changed: org.eclipse.core...</description>
		<content:encoded><![CDATA[
<br><font size=2 face="sans-serif">The map file has been updated for the
following Bug changes:</font>
<br><font size=2 face="sans-serif">+ Bug 244468. Support reading extension
registry in any locale (FIXED)</font>
<br><font size=2 face="sans-serif">+ Bug 259643. LocalFileNatives.internalSetFileInfo
only sets exec bit for owner. (ASSIGNED)</font>
<br><font size=2 face="sans-serif">+ Bug 294429. OutOfMemoryError during
workspace refresh due to FileInfo carrying substring baggage (FIXED)</font>
<br>
<br><font size=2 face="sans-serif">The following projects have changed:</font>
<br><font size=2 face="sans-serif">org.eclipse.core.runtime.compatibility.registry</font>
<br><font size=2 face="sans-serif">org.eclipse.core.tests.runtime</font>
<br><font size=2 face="sans-serif">org.eclipse.core.filesystem</font>
<br><font size=2 face="sans-serif">org.eclipse.equinox.registry</font>
<br><font size=2 face="sans-serif">org.eclipse.core.filesystem.linux.x86</font>
<br>
<br>]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 23:16:02 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05951.html</guid>
		<author>John_Arthorne@xxxxxxx (John Arthorne)</author>
	</item>
	<item>
		<title>RE: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05950.html</link>
		<description> Hi, Yes you can simply get the service once and cast it to the two types you want: Object someService = bc.getService(x); Interface1 service1 = (Interface1) someService; Interface2 service2 = (Interface2) someService; Tom &amp;quot;David Conde&amp;quot; ---11/16/2009 09:34...</description>
		<content:encoded><![CDATA[
<p>Hi,<br>
<br>
Yes you can simply get the service once and cast it to the two types you want:<br>
<br>
Object someService = bc.getService(x);<br>
Interface1 service1 = (Interface1) someService;<br>
Interface2 service2 = (Interface2) someService;<br>
<br>
Tom<br>
<br>
<br>
<br>
<img width="16" height="16" src="" border="0" alt="Inactive hide details for &quot;David Conde&quot; ---11/16/2009 09:34:35 AM---Hi Thomas,"><font color="#424282">&quot;David Conde&quot; ---11/16/2009 09:34:35 AM---Hi Thomas,</font><br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">From:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">&quot;David Conde&quot; &lt;dconde@xxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">To:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">&quot;'Equinox development mailing list'&quot; &lt;equinox-dev@xxxxxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Date:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">11/16/2009 09:34 AM</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Subject:</font></td><td width="100%"><img width="1" height="1" src="" border="0" alt=""><br>
<font size="2">RE: [equinox-dev] Registering two services in the same bundle</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<font size="4" face="Times New Roman">Hi Thomas,</font><br>
<font size="4" face="Times New Roman"> </font><br>
<font size="4" face="Times New Roman">Thank you for your answer,</font><br>
<font size="4" face="Times New Roman"> </font><br>
<font size="4" face="Times New Roman">So once I get ServiceReference = X getServiceReferences using the filter that you told me &quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;, I have to use two castings for getting two different services like Object1 = (Interface1) BundleContext.getReference (X) and Object2= (Interface2) BundleContext.getReference(X), and then use two instances of the same object for using two different interfaces implemented by this same object, am I right? Is there any other mechanism for using the same object for two different interfaces, because really the object provides two different services (2 different interfaces)</font><br>
<font size="4" face="Times New Roman"> </font><br>
<font size="4" face="Times New Roman">Thank you in advance</font><br>
<font size="4" face="Times New Roman"> </font><br>
<font size="4" face="Times New Roman">David</font><br>
<font color="#1F497D" face="Calibri"> </font><br>
<b><font face="Tahoma">De:</font></b><font face="Tahoma"> equinox-dev-bounces@xxxxxxxxxxx [</font><font face="Tahoma"><a href="mailto:equinox-dev-bounces@xxxxxxxxxxx">mailto:equinox-dev-bounces@xxxxxxxxxxx</a></font><font face="Tahoma">] </font><b><font face="Tahoma">En nombre de </font></b><font face="Tahoma">Thomas Watson</font><b><font face="Tahoma"><br>
Enviado el:</font></b><font face="Tahoma"> lunes, 16 de noviembre de 2009 15:53</font><b><font face="Tahoma"><br>
Para:</font></b><font face="Tahoma"> Equinox development mailing list</font><b><font face="Tahoma"><br>
Asunto:</font></b><font face="Tahoma"> Re: [equinox-dev] Registering two services in the same bundle</font><br>
<font size="4" face="Times New Roman"> </font>
<p><font size="4" face="Times New Roman">You can use the registerService(java.lang.String[] clazzes,java.lang.Object service, java.util.Dictionary properties) to register your service object under multiple service interfaces. This will allow you to control the registration with a single ServiceRegistration object. But in order to get a ServiceReference that is guaranteed to implement both service interfaces then you must use the getServiceReferences(String clazz, String filter) with a null clazz and a filter that looks something like this:<br>
<br>
&quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;<br>
<br>
This will ensure that the ServiceReference objects returned implement both Interface1 and Interface2. This should allow you to cast the Object returned from getService(ServiceReference) to both Interface1 and Interface2 in your service using client bundle. But for client code I recommend you use an injection mechanism (like Declarative Services, Spring DM or Blueprint) if possible so you don't have to worry about tracking the services yourself.<br>
<br>
Tom<br>
<br>
<br>
<br>
</font><img src="" width="16" height="16" alt="Inactive hide details for &quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,"><font size="4" color="#424282" face="Times New Roman">&quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,</font>
<p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="22%"><img src="" width="96" height="1"><font color="#5F5F5F" face="Times New Roman"><br>
From:</font></td><td width="78%"><img src="" width="1" height="1"><font face="Times New Roman"><br>
&quot;David Conde&quot; &lt;dconde@xxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="22%"><img src="" width="96" height="1"><font color="#5F5F5F" face="Times New Roman"><br>
To:</font></td><td width="78%"><img src="" width="1" height="1"><font face="Times New Roman"><br>
&quot;'Equinox development mailing list'&quot; &lt;equinox-dev@xxxxxxxxxxx&gt;</font></td></tr>

<tr valign="top"><td width="22%"><img src="" width="96" height="1"><font color="#5F5F5F" face="Times New Roman"><br>
Date:</font></td><td width="78%"><img src="" width="1" height="1"><font face="Times New Roman"><br>
11/16/2009 02:34 AM</font></td></tr>

<tr valign="top"><td width="22%"><img src="" width="96" height="1"><font color="#5F5F5F" face="Times New Roman"><br>
Subject:</font></td><td width="78%"><img src="" width="1" height="1"><font face="Times New Roman"><br>
[equinox-dev] Registering two services in the same bundle</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade><br>
<font size="4" face="Times New Roman"><br>
<br>
</font><font size="4" face="Calibri"><br>
Hi,</font><font size="4" face="Times New Roman"><br>
</font><font size="4" face="Courier New"><br>
I would like to know what I have to do for registering two different services in a same bundle. I mean, I have two create a service object which implements two different interfaces (registering two different services). I thought about using </font><b><font size="4" face="Courier New">registerService</font></b><font size="4" face="Courier New">(java.lang.String[] clazzes,java.lang.Object service,</font><font size="4" face="Calibri"><br>
java.util.Dictionary properties) by including Interface1.class.getName() and Interface2.class.getName() in String array called clazzes.</font><font size="4" face="Times New Roman"><br>
</font><font size="4" face="Calibri"><br>
However, I found as a problem that if I want to use this object service I have to get two service objects, one for Interface1 and another one for Interface2 by doing BundleContext.getServiceReference(Interface1) &amp; BundleContext.getServiceReference(Interface2), am I missing anything?Does it exist another way to do that?</font><font size="4" face="Times New Roman"><br>
</font><font size="4" face="Calibri"><br>
Thanks in advance </font><font face="Courier New">_______________________________________________<br>
equinox-dev mailing list<br>
equinox-dev@xxxxxxxxxxx</font><u><font color="#0000FF" face="Courier New"><br>
</font></u><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev"><u><font color="#0000FF" face="Courier New">https://dev.eclipse.org/mailman/listinfo/equinox-dev</font></u></a><font face="Courier New"><br>
</font><tt>_______________________________________________<br>
equinox-dev mailing list<br>
equinox-dev@xxxxxxxxxxx<br>
</tt><tt><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a></tt><tt><br>
</tt><br>
<br>

<p><a href="gifwp6cQxmNod.gif" ><img src="gifwp6cQxmNod.gif" alt="GIF image"></a></p>
<p><a href="gifwA3rBgyvi0.gif" ><img src="gifwA3rBgyvi0.gif" alt="GIF image"></a></p>
<p><a href="gif2ZHRk9qn6b.gif" ><img src="gif2ZHRk9qn6b.gif" alt="GIF image"></a></p>
<p><a href="gifLXnPwFCxNb.gif" ><img src="gifLXnPwFCxNb.gif" alt="GIF image"></a></p>
]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 16:24:10 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05950.html</guid>
		<author>tjwatson@xxxxxxx (Thomas Watson)</author>
	</item>
	<item>
		<title>RE: [equinox-dev] Registering two services in the same bundle</title>
		<link>http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05949.html</link>
		<description> Hi Thomas,   Thank you for your answer,   So once I get ServiceReference = X getServiceReferences using the filter that you told me &amp;quot;(&amp;amp;(objectClass=Interface1)(objectClass=Interface2))&amp;quot;, I have to use two castings for getting two different services like O...</description>
		<content:encoded><![CDATA[<table width="100%"><tr><td style="a:link { color: blue } a:visited { color: purple } ">





<div class=Section1>

<p class=MsoNormal>Hi Thomas,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thank you for your answer,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>So once I get ServiceReference = X getServiceReferences
using the filter that you told me &quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;,
I have to use two castings for getting two different services like Object1 =
(Interface1) BundleContext.getReference (X) and Object2= (Interface2)
BundleContext.getReference(X), and then use two instances of the same object
for using two different interfaces implemented by this same object, am I right?
Is there any other mechanism for using the same object for two different
interfaces, because really the object provides two different services (2
different interfaces)<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thank you in advance<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>David<o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] <b>En
nombre de </b>Thomas Watson<br>
<b>Enviado el:</b> lunes, 16 de noviembre de 2009 15:53<br>
<b>Para:</b> Equinox development mailing list<br>
<b>Asunto:</b> Re: [equinox-dev] Registering two services in the same bundle<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p style='margin-bottom:12.0pt'>You can use the
registerService(java.lang.String[] clazzes,java.lang.Object service,
java.util.Dictionary properties) to register your service object under multiple
service interfaces. This will allow you to control the registration with a
single ServiceRegistration object. But in order to get a ServiceReference that
is guaranteed to implement both service interfaces then you must use the
getServiceReferences(String clazz, String filter) with a null clazz and a
filter that looks something like this:<br>
<br>
&quot;(&amp;(objectClass=Interface1)(objectClass=Interface2))&quot;<br>
<br>
This will ensure that the ServiceReference objects returned implement both
Interface1 and Interface2. This should allow you to cast the Object returned
from getService(ServiceReference) to both Interface1 and Interface2 in your
service using client bundle. But for client code I recommend you use an
injection mechanism (like Declarative Services, Spring DM or Blueprint) if
possible so you don't have to worry about tracking the services yourself.<br>
<br>
Tom<br>
<br>
<br>
<br>
<img width=16 height=16 id="_x0000_i1025"
src=""
alt="Inactive hide details for &quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,"><span
style='color:#424282'>&quot;David Conde&quot; ---11/16/2009 02:34:18 AM---Hi,</span><o:p></o:p></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%"
 style='width:100.0%'>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1026"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>From:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1027"
  src=""><br>
  <span style='font-size:10.0pt'>&quot;David Conde&quot;
  &lt;dconde@xxxxxxxx&gt;</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1028"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>To:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1029"
  src=""><br>
  <span style='font-size:10.0pt'>&quot;'Equinox development mailing list'&quot;
  &lt;equinox-dev@xxxxxxxxxxx&gt;</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1030"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Date:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1031"
  src=""><br>
  <span style='font-size:10.0pt'>11/16/2009 02:34 AM</span><o:p></o:p></p>
  </td>
 </tr>
 <tr>
  <td width="1%" valign=top style='width:1.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=96 height=1 id="_x0000_i1032"
  src=""><br>
  <span style='font-size:10.0pt;color:#5F5F5F'>Subject:</span><o:p></o:p></p>
  </td>
  <td width="100%" valign=top style='width:100.0%;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><img width=1 height=1 id="_x0000_i1033"
  src=""><br>
  <span style='font-size:10.0pt'>[equinox-dev] Registering two services in the
  same bundle</span><o:p></o:p></p>
  </td>
 </tr>
</table>

<div class=MsoNormal>

<hr size=2 width="100%" noshade style='color:#8091A5' align=left>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br>
<br>
<span style='font-family:"Calibri","sans-serif"'>Hi,</span><br>
<br>
<span style='font-family:"Courier New"'>I would like to know what I have to do
for registering two different services in a same bundle. I mean, I have two
create a service object which implements two different interfaces (registering
two different services). I thought about using <b>registerService</b>(java.lang.String[]
clazzes,java.lang.Object service,</span><br>
<span style='font-family:"Calibri","sans-serif"'>java.util.Dictionary
properties) by including Interface1.class.getName() and
Interface2.class.getName() in String array called clazzes.</span><br>
<br>
<span style='font-family:"Calibri","sans-serif"'>However, I found as a problem
that if I want to use this object service I have to get two service objects,
one for Interface1 and another one for Interface2 by doing
BundleContext.getServiceReference(Interface1) &amp;
BundleContext.getServiceReference(Interface2), am I missing anything?Does it
exist another way to do that?</span><br>
<br>
<span style='font-family:"Calibri","sans-serif"'>Thanks in advance </span><tt><span
style='font-size:10.0pt'>_______________________________________________</span></tt><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<tt>equinox-dev mailing list</tt><br>
<tt>equinox-dev@xxxxxxxxxxx</tt><br>
<tt><a href="https://dev.eclipse.org/mailman/listinfo/equinox-dev">https://dev.eclipse.org/mailman/listinfo/equinox-dev</a></tt><br>
<br>
</span><o:p></o:p></p>

</div>




</td></tr></table><p><a href="gifK1lXVoR1XQ.gif" ><img src="gifK1lXVoR1XQ.gif" alt="GIF image"></a></p>
<p><a href="pngh02jxpzYv9.png" ><img src="pngh02jxpzYv9.png" alt="PNG image"></a></p>
<p><a href="png3ege64i1ZE.png" ><img src="png3ege64i1ZE.png" alt="PNG image"></a></p>
]]></content:encoded>
		<pubDate>Mon, 16 Nov 2009 15:34:12 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05949.html</guid>
		<author>dconde@xxxxxxx (David Conde)</author>
	</item>

 
	</channel>
	</rss>
<!-- MHonArc v2.6.10 -->
