Re: [equinox-dev] service elements in Declaratice Services
Hi Kai, I think that this is a bug. According to XML schema that defines the component description grammar there is: element name=service type=scr:Tservice minOccurs=0 maxOccurs=1/ So only one occurrence is allowed. --- Regards/Pozdrowienia, Lukasz Bobowiec Software Engineer Tivoli Dynamic Content Delivery [EMAIL PROTECTED] tel. (+48) 12-628-98-82 IBM SWG Lab, Cracow, Poland IBM Polska Sp. z o.o. oddział w Krakowie ul. Armii Krajowej 18 30 -150 Kraków NIP: 526-030-07-24 Sąd Rejonowy dla m.st. Warszawy, XIII Wydział Gospodarczy KRS KRS 012941, Kapitał zakładowy: 3.073.600 PLN From: Toedter, Kai [EMAIL PROTECTED] To: Equinox development mailing list equinox-dev@eclipse.org Date: 2008-10-28 14:31 Subject: [equinox-dev] service elements in Declaratice Services Hi All, I currently prototype a little Equinox app that uses Declarative Services (DS). The DS spec 4.1 says The service element is optional. ... The service element must have one or more provide elements that define the service interfaces. So, the following XML is syntactically correct and handled well by Equinox DS: component name=com.siemens.ct.pm.ui.views.treeView implementation class=com.siemens.ct.pm.ui.views.treeview.TreeView/ service provide interface=com.siemens.ct.pm.application.service.IViewContribution/ provide interface=com.siemens.ct.pm.model.IPersonListener/ /service /component However, the following XML is incorrect with regards to the DS spec... component name=com.siemens.ct.pm.ui.views.treeView implementation class=com.siemens.ct.pm.ui.views.treeview.TreeView/ service provide interface=com.siemens.ct.pm.application.service.IViewContribution/ /service service provide interface=com.siemens.ct.pm.model.IPersonListener/ /service /component ... but Equinox handles it exactly like the above correct XML :) Now the question is, is this a bug or a feature? If it is a bug, I can file it... ...but how should Equinox DS react then? Best regards, Kai --- Kai Tödter Siemens AG Corporate Technology Architecture CT SE 2 Otto-Hahn-Ring 6 81739 Munich, Germany Phone: +49 89 636-41064 Fax: +49 89 636-45450 mailto: [EMAIL PROTECTED] Internet: www.siemens.com/corporate-technology Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Gerhard Cromme; Managing Board: Peter Loescher, Chairman, President and Chief Executive Officer; Heinrich Hiesinger, Joe Kaeser, Rudi Lamprecht, Eduardo Montes, Juergen Radomski, Erich R. Reinhardt, Hermann Requardt, Uriel J. Sharef, Peter Y. Solmssen, Klaus Wucherer; Registered offices: Berlin and Munich; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322 ___ equinox-dev mailing list equinox-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev ___ equinox-dev mailing list equinox-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev
Re: [equinox-dev] Caused by: org.osgi.framework.BundleException: State change in progress for bundle...by thread OSGi Console
Hi Jacek, I think this is some threading issue. First of all remember that in the start/stop methods of BundleActivator you shouldn't spawn a long running task (just use a new Thread to do this). In the javadoc to org.osgi.framework.BundleActivator#start() method is written: Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle. This method can be used to register services or to allocate any resources that this bundle needs. This method must complete and return to its caller in a timely manner. Otherwise you can block the OSGi console thread. I suspect that installing and resolving the Spring bundle may consume some amount of time and it should be in the start method. Moreover nesting a start of another bundle in your bundle is not the best idea. I am wondering if you are using OSGi console and you are able to install and start your bundle why you don't install and start the spring bundle? Anyway I think that BundleListener resolves your issue: package pl.jaceklaskowski.osgi; import java.util.logging.Level; import java.util.logging.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; import org.osgi.framework.BundleException; import org.osgi.framework.BundleListener; public class AktywatorPakunku implements BundleActivator, BundleListener { Logger log = Logger.getLogger(AktywatorPakunku.class.getName()); private Bundle bundle; public void start(BundleContext bundleContext) throws Exception { // add bundle listener bundleContext.addBundleListener(this); bundle = bundleContext.installBundle( file:c:/projs/osgi/spring-osgi-activationpolicy/target/spring-osgi-activationpolicy-1.0.jar ); long bundleId = bundle.getBundleId(); String bundleLocation = bundle.getLocation(); String bundleSymbolicName = bundle.getSymbolicName(); System.out.println(); System.out.println(Charakterystyka zainstalowanego pakunku:); System.out.println( Identyfikator: + bundleId); System.out.println( Identyfikator położenia: + bundleLocation); System.out.println( Nazwa symboliczna: + bundleSymbolicName); System.out.println(); } public void stop(BundleContext bundleContext) throws Exception { // remove bundle listener bundleContext.removeBundleListener(this); log.info(stop() wykonano - czyszczę po sobie); } public void bundleChanged(BundleEvent event) { if (event.getType() == Bundle.RESOLVED event.getBundle() == bundle) { try { System.out.println(Startuję pakunek + bundle.getSymbolicName()); bundle.start(); } catch (BundleException e) { log.log(Level.SEVERE, e.getMessage()); } } } } --- Best regards, Lukasz Bobowiec Software Engineer, Common Agent Services [EMAIL PROTECTED] (+48 12) 628 9882 IBM SWG Lab, Cracow, Poland IBM Polska Sp. z o.o. oddział w Krakowie ul. Armii Krajowej 18 30 -150 Kraków NIP: 526-030-07-24 Sąd Rejonowy dla m.st. Warszawy, XIII Wydział Gospodarczy KRS KRS 012941, Kapitał zakładowy: 3.073.600 PLN Jacek Laskowski [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 2008-04-04 08:55 Please respond to [EMAIL PROTECTED]; Please respond to Equinox development mailing list equinox-dev@eclipse.org To equinox-dev@eclipse.org cc Subject [equinox-dev] Caused by: org.osgi.framework.BundleException: State change in progress for bundle...by thread OSGi Console Hi, Why do I face the following exception: [EMAIL PROTECTED] /cygdrive/c/projs/osgi/spring-osgi-install $ java -jar c:/apps/eclipse/plugins/org.eclipse.osgi_3.4.0.v20080205.jar -console osgi ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.4.0.v20080205 osgi install file:c:/projs/osgi/spring-osgi-install/target/spring-osgi-install-1.0.jar Bundle id is 1 osgi start 1 2008-04-03 22:26:06 pl.jaceklaskowski.osgi.AktywatorPakunku start Charakterystyka zainstalowanego pakunku: Identyfikator: 2 Identyfikator położenia: file:c:/projs/osgi/spring-osgi-activationpolicy/target/spring-osgi-activationpolicy-1.0.jar Nazwa symboliczna: pl.jaceklaskowski.osgi.spring-osgi-activationpolicy Startuj?Ö pakunek pl.jaceklaskowski.osgi.spring-osgi-activationpolicy 2008-04-03 22:26:07 pl.jaceklaskowski.osgi.AktywatorPakunku start Charakterystyka zainstalowanego pakunku: Identyfikator: 2 Identyfikator położenia: file:c:/projs/osgi/spring-osgi
[equinox-dev] ConcurrentModificationException in DS implementation
Hello, I encountered an issue related to the lack of thread-safe in Declarative Service resolver. I found the similar bug 164574 https://bugs.eclipse.org/bugs/show_bug.cgi?id=164574 There is also a patch already provided by the bug's originator. My question is why this defect is still in NEW state and why this patch was not applied to DS implementation (I am talking about Equinox DS implementation not ProSyst). The last exposed on Equinox download site ds jar is: org.eclipse.equinox.ds_1.0.0.v20070226.jar but this patch was provided later? However it is not applied to any official Equinox version. The patch is available: https://bugs.eclipse.org/bugs/show_bug.cgi?id=181858 What is the Equinox's decision? --- Best regards, Lukasz Bobowiec Software Engineer, Common Agent Services [EMAIL PROTECTED] (+48 12) 628 9882 IBM SWG Lab, Cracow, Poland IBM Polska Sp. z o.o. oddział w Krakowie ul. Armii Krajowej 18 30 -150 Kraków NIP: 526-030-07-24 Sąd Rejonowy dla m.st. Warszawy, XIII Wydział Gospodarczy KRS KRS 012941, Kapitał zakładowy: 3.073.600 PLN ___ equinox-dev mailing list equinox-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev