Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 22596 invoked from network); 28 Jul 2008 18:17:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jul 2008 18:17:25 -0000 Received: (qmail 98697 invoked by uid 500); 28 Jul 2008 18:17:25 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 98662 invoked by uid 500); 28 Jul 2008 18:17:24 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 98651 invoked by uid 99); 28 Jul 2008 18:17:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2008 11:17:24 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of heavy@ungoverned.org designates 69.89.20.190 as permitted sender) Received: from [69.89.20.190] (HELO outbound-mail-36.bluehost.com) (69.89.20.190) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 28 Jul 2008 18:16:28 +0000 Received: (qmail 13133 invoked by uid 0); 28 Jul 2008 18:16:51 -0000 Received: from unknown (HELO host118.hostmonster.com) (74.220.207.118) by outboundproxy2.bluehost.com with SMTP; 28 Jul 2008 18:16:51 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=ungoverned.org; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Identified-User; b=f9tFD15coa/DqEzjoLhBeUSQGYbOpz0DfzuUKqR/s8AqlbyHDswEsaRGhkzKVLxx3H6glZsMGjVt/xR+zwQOM9syuwW1YhEcSNkGIH8sRmVC2GrCDcfcC6Vrf2GKR4sZ; Received: from nat-10.eecs.tufts.edu ([130.64.23.210] helo=heavy.glastender.com) by host118.hostmonster.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KNXH8-0002BA-Jl for dev@felix.apache.org; Mon, 28 Jul 2008 12:16:50 -0600 Message-ID: <488E0CB2.5060000@ungoverned.org> Date: Mon, 28 Jul 2008 14:15:14 -0400 From: "Richard S. Hall" User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: dev@felix.apache.org Subject: Re: shell service, command, and declarative services References: <9E8C2EE38A83804B8A7CD8F5C5D6BA91D398E4@exch01.praxislan01.com> <9E8C2EE38A83804B8A7CD8F5C5D6BA91D39905@exch01.praxislan01.com> In-Reply-To: <9E8C2EE38A83804B8A7CD8F5C5D6BA91D39905@exch01.praxislan01.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Identified-User: {1027:host118.hostmonster.com:ungovern:ungoverned.org} {sentby:smtp auth 130.64.23.210 authed with heavy@ungoverned.org} X-Virus-Checked: Checked by ClamAV on apache.org Yes, I guess you are doing something incorrectly, but I don't think you are giving me enough information to figure out your mistake. I have created a bundle with the following content: heavy:~/tmp/craig$ jar tf craig.jar META-INF/ META-INF/MANIFEST.MF craig/ craig/Activator.class craig/Command01.class With the following manifest: heavy:~/tmp/craig$ more manifest.mf Bundle-Name: Test Command Bundle-SymbolicName: test.command Bundle-Activator: craig.Activator Import-Package: org.osgi.framework,org.apache.felix.shell And the following source code: package craig; import java.io.PrintStream; import org.osgi.framework.*; import org.apache.felix.shell.*; public class Activator implements BundleActivator { public void start(BundleContext arg0) throws Exception { arg0.registerService(org.apache.felix.shell.Command.class.getName(), new Command01(), null); } public void stop(BundleContext arg0) throws Exception { System.out.println("command01Activator.stop() trace"); } } class Command01 implements Command { public String getName() { return "cmd01"; } public String getUsage() { return "cmd01 help"; } public String getShortDescription() { return "Simple test command"; } public void execute(String line, PrintStream out, PrintStream err) { System.out.println("Command executed: " + getName()); } } And it worked fine for me: -> cmd01 Command executed: cmd01 So, double check what you are doing. -> richard Craig Phillips wrote: > Hi, > > I removed declarative services from the mix, pretty much reducing my > example to the straight sample as provided by the felix documentation, > still to no avail (meaning, exact same results/symptoms as with the > SCR/DS in the mix); As in original post, I am providing some sample > snippets for your/our amusement... First, the run time stuff: > > -> help > cmd01 help - Command01 description > -> cmd01 > Command not found. > -> cmd01 help > Command not found. > > -> services // doesn't produce anything registered for my "command01" > even though I did the register: > > public class Command01Activator implements BundleActivator > { > public void start(BundleContext arg0) throws Exception > { > arg0.registerService( > org.apache.felix.shell.Command.class.getName(), > new Command01(), null); > } > > public void stop(BundleContext arg0) throws Exception > { > System.out.println("command01Activator.stop() trace"); > } > } > > public class Command01 implements Command > { > public String getUsage() > { > return "cmd01 help"; > } > } > > This is about as "out of the box" as I can get it... I followed the > documentation to a "T" to the best of my knowledge... > > Obviously, I'm missing some trick... Thanks again, Craig > > -----Original Message----- > From: Craig Phillips [mailto:lcphillips@praxiseng.com] > Sent: Monday, July 28, 2008 12:35 PM > To: dev@felix.apache.org > Subject: shell service, command, and declarative services > > Hi, > > I have a feeling this is another "oh by the way" by incorporating > declarative services into the mix... I'm attempting to implement a > "command" (as in org.apache.felix.shell.Command), but the actual > execute() method is not being invoked... I'll put some snippets and > some run time output in here so folks can see the pertinent pieces at > play: > > public class Sender01 implements Command > { > public String getUsage( { return "event-snd help"; } > // and, of course... public String getName() and getDescription() > > public void execute(String line, PrintStream arg1, PrintStream arg2) > { > // printf() by any other name for short: "execute() trace; line{" > + line + "};"); > } > } > > My OSGI-INF/dot.xml has: interface='org.apache.felix.shell.Command'/> > > In the ps, you see my bundle: > [ 8] [Active ] [ 1] org.craig.event.sender01 - sample bundle > > In the scr list, you see my command service: > -> scr info 1 > ID: 1 > Name: org.craig.event.sender.Sender01 > Bundle: org.craig.event.sender01 (8) > State: active > Default State: enabled > Activation: delayed > Services: org.apache.felix.shell.Command > Service Type: service > > But, when I type services, "Command" does not show up: > org.craig.event.sender01 - sample bundle > ------------------------------------------------------------------------ > ----------- > org.osgi.service.cm.ManagedService > -> > > Interestingly, however, the help has my usage in there: > -> help > bundlelevel ... | - set or get bundle start level. > install [ ...] - install bundle(s). > event-snd help - org.craig.event.sender01 > description entry > > But, if I attempt to execute some kind of event-snd command, nothing: > -> event-snd help > -> Command not found. > event-snd > Command not found. > -> > > So, I guess the question to all of you / anyone out there is: what am I > missing? > > Thanks, Craig Phillips, Praxis Engineering > >