No problem ! Thanks. Regards JB
On 04/02/2016 08:33 AM, Cristiano Costantini wrote:
Hi JB, I didn't was aware of the Karaf archetypes and that was an archetype for the command, thank you, For all other, the documentation page is here: https://karaf.apache.org/manual/latest/developers-guide/archetypes.html Bye, Cristiano Il giorno ven 1 apr 2016 alle ore 15:49 Jean-Baptiste Onofré <[email protected] <mailto:[email protected]>> ha scritto: That's it, and it's what you can find in the command archetype ;) Regards JB On 04/01/2016 03:29 PM, Cristiano Costantini wrote: > Hi, yes I confirm it by myself, the @Reference is resolved from the OSGi > service registry. > > Specifically, in the old command implementation I was injecting inside > the commands other beans directly taken from the the same beans.xml > file. Now I have to publish as OSGi services. > > > So in summary, previously I was using: > > <bean id="myService" class="net.cristcost.MyService" /> > > <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0"> > <command name="test/hello"> > <action class="net.cristcost.HelloCommand"> > <property name="myService" ref="myService" /> > </action> > </command> > </command-bundle> > > > Now I've changed the code of net.cristcost.HelloCommand with @Service > and @Reference on the myService field, plus my blueprint.xml has changed > into: > > <bean id="myService" class="net.cristcost.MyService" /> > > <service ref="myService" interface="net.cristcost.MyService" /> > > > ...and the instruction <Karaf-Commands>*</Karaf-Commands> on the pom.xml ! > > Thank you > Cristiano > > > > > Il giorno ven 1 apr 2016 alle ore 15:11 Cristiano Costantini > <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> > ha scritto: > > Yeah! > that's what I'm searching to achieve... > > I've finally found the documentation page at > https://karaf.apache.org/manual/latest/developers-guide/extending.html > > and in my initial attempts, I also was missing that it is required > to add this instruction on the pom: > <plugin> > > <groupId>org.apache.felix</groupId> > <artifactId>maven-bundle-plugin</artifactId> > <configuration> > <instructions> > <Karaf-Commands>*</Karaf-Commands> > </instructions> > </configuration> > </plugin> > > > but I still don't understand how @Reference works... it is not > explained on the guide: > > In the Jdbc command example, > > @Reference > private JdbcService jdbcService; > > how the JdbcService it injected? is it resolved from OSGi services? > > Thank you > Cristiano > > > > Il giorno ven 1 apr 2016 alle ore 14:59 Morgan Hautman > <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> ha scritto: > > Hi Christiano, > > If you mean custom commands, the jdbc command is an example: > https://github.com/apache/karaf/tree/master/jdbc/src/main/java/org/apache/karaf/jdbc/command > > Regards, > Morgan > > 2016-04-01 14:26 GMT+02:00 Cristiano Costantini > <[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>: > > Hi all, > in my application I've developed some shell command using > the now @Deprecated > org.apache.karaf.shell.console.OsgiCommandSupport > > Is there any guide or can you suggest me an example on how > to implement the commands with the new API? > > Thanks. > Cristiano > > -- Jean-Baptiste Onofré [email protected] <mailto:[email protected]> http://blog.nanthrax.net Talend - http://www.talend.com
-- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
