You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com> on 2012/10/11 19:13:23 UTC
Getting Started with iPOJO
Hi,
I can't seem to find a good article that will help me resolve the "getting started" issue I am facing.
I am using Eclipse Juno (4.2) on my Mac.
I have downloaded and installed the iPOJO eclipse plugin, from: http://clement.plop-plop.net/update/
I have created a sample project following the instructions at: http://felix.apache.org/site/ipojo-eclipse-plug-in.html
I have integrated Felix into Eclipse as a project, following instructions here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
I have downloaded the following iPOJO bundle: org.apache.felix.ipojo-1.8.2.jar
I've launched Felix in the Eclipse console and I've installed the org.apache.felix.ipojo-1.8.2.jar bundle and started it.
I've created a test bundle using iPOJO called iPojoTest.jar and I've installed it and started it in the OSGI console.
I run bundles in the console and I get:
g! bundles
0|Active | 0|org.apache.felix.framework (3.0.7)
1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
2|Active | 1|org.apache.felix.gogo.command (0.6.1)
3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
12|Active | 1|iPojoTest (1.4.0)
13|Active | 1|org.apache.felix.ipojo (1.8.2)
So, the bundle seems to have started.
But I don't get any console output from my sysouts…
Here are the start() and stop() methods:
@Validate
public void start() throws IOException {
System.out.println("I'm starting...");
try{
// Create file
FileWriter fstream = new FileWriter("/Users/mcook008/out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
throw new IOException() ;
}
@Invalidate
public void stop() {
System.out.println("I'm leaving !");
}
I added in the file write to see if a file would be created. There is no file created. So, while OSGi thinks the bundle is ACTIVE, the start method appears never have to been called.
Can anyone tell me what I may have done wrong or provide a clue as to what to look at to help diagnose the problem?
Thanks,
Mike
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Hi Gokturk,
I had looked at the first URL when I was attempting to get my ancient
version of the Eclipse plugin to work. I had first attempted to follow
its directions, but I received an exception when attempting to manipulate
the bundle.
Here's what I got:
Buildfile: /Users/mcook008/Documents/workspace/MyiPOJOBundle/build.xml
manipulate:
[ipojo] Input directory :
/Users/mcook008/Documents/workspace/MyiPOJOBundle/bin
[ipojo] Metadata file :
/Users/mcook008/Documents/workspace/MyiPOJOBundle/metadata.xml
[ipojo] Start manipulation
BUILD FAILED
/Users/mcook008/Documents/workspace/MyiPOJOBundle/build.xml:54:
java.lang.ArrayIndexOutOfBoundsException: 8
On the second URL, it looks interesting, but there is insufficient
information on the page for someone without subject matter expertise to
understand how to configure it.
I have 15 years of Java programming experience, and I've been working with
OSGi for several years. I'm very comfortable building my own manifests
and developing (I think) good OSGi code. But there is a learning curve
associated with what I do, and I often work with others who don't have the
time to become expert in all things OSGi, so I was attempting to find out
if iPOJO might make it easier for me to teach them an easier way to
develop OSGi applications. So far, it unfortunately appears that there is
more difficulty in trying to simplify the development process than there
is in the development process itself.
I'm likely missing something trivial and obvious to those who work with
iPOJO regularly, and my poor Eclipse environment is likely hopelessly
misconfigured from my failed attempts at finding the correct combination
of libraries.
I think maybe I'll stick with the "old fashioned" OSGi way, unless there
is a decent tutorial available which I can follow and learn the "correct"
way to work with iPOJO. The funny thing is that a couple of years ago, I
had used Clement's old iPOJO plugin for a few projects, and it worked
easily. That's what made me decide to try it again, but I can't repeat
the good results of a couple of years ago...
Thanks for all of the help.
Mike
On 10/12/12 12:50 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>Hi,
>
>Yeah Michael is right, eclipse-ipojo-plugin is not updated since almost 4
>years. And It's using ipojo-1.0.0 internally.
>
>You should check
>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>
>You would also like
>http://gitorious.ow2.org/ow2-chameleon/eclipse-ipojo-builder You can use
>this plugin to integrate ipojo manipulation process right into eclipse's
>own building phase and can use eclipse equinox launcher.
>
>These would be necessary for you to build your own development environment
>without so much burden.
>
>
>Regards,
>Gokturk
>
>
>
>On Fri, Oct 12, 2012 at 6:11 PM, Simon Chemouil <sc...@gmail.com>
>wrote:
>
>> Michael,
>>
>> Concerning iPojo itself, I think you won't find much tutorials outside
>> of iPojo's website. That website could definitely be improved and some
>> pages are outdated. I know iPojo is used in various companies, but
>> iPojo users are rather quiet compared to Guice or Spring/Blueprint
>> users who blog a lot more.
>>
>> I suggest you take at look at the examples available at
>>
>>https://svn.apache.org/repos/asf/felix/trunk/ipojo/examples/tutorial-mave
>>n
>> The samples are depending on iPojo 1.5.0-SNAPSHOT so be sure to update
>> the versions (in pom.xml files).
>>
>> We switched to iPojo some time ago (from DS), and it was painless as
>> were already using Maven to build our projects. We simply had to
>> switch annotations and add the proper Maven configuration -- and then
>> benefit from all the other exciting features of iPojo.
>>
>> There is a release coming soon that will fix a few bugs so in the mean
>> time we are following the trunk version. I suggest you take a look at
>> iPojo's JIRA if you encounter a bug during the build in the
>> maven-ipojo-plugin: if the bugs are marked as fix you will either have
>> to build your own local copy of iPojo (1.9.0-SNAPSHOT) or wait for a
>> release.
>>
>> HTH,
>>
>> Simon
>>
>>
>> On Fri, Oct 12, 2012 at 4:29 PM, Cook, Michael J. (OCTO)
>> <Mi...@cable.comcast.com> wrote:
>> > Simon,
>> >
>> > Excellent. I will look online for tutorials explaining your suggested
>> paths forward. If you know of any good ones, please let me know.
>> >
>> > Mike
>> > Michael Cook
>> > VP Technology Innovation
>> > Comcast
>> > One Comcast Center
>> > Philadelphia, PA 19103
>> > (o) 215-286-8260
>> > (m) 609-458-0332
>> >
>> > ----- Original Message -----
>> > From: Simon Chemouil [mailto:schemouil@gmail.com]
>> > Sent: Friday, October 12, 2012 08:34 AM
>> > To: users@felix.apache.org <us...@felix.apache.org>
>> > Subject: Re: Getting Started with iPOJO
>> >
>> > Michael,
>> >
>> > It seems like you are using an antique version of iPojo. The import
>> > you show in your manifest is 0.9.0 and the last release is 1.8.2 (that
>> > import is added by the manipulator).
>> >
>> > In an earlier message you said you were using the Eclipse plugin
>> > available on Clement's website. This plugin is not maintained anymore
>> > and while there is a new iPojo Eclipse plugin maintained elsewhere, I
>> > wouldn't advise using it. Rather, you should use the manipulator from
>> > ant or maven depending on how you build your project. If you choose
>> > the maven-ipojo-plugin, you can get decent Eclipse integration using
>> > Maven's Eclipse environment (M2E).
>> >
>> > HTH,
>> >
>> > Simon
>> >
>> > On Fri, Oct 12, 2012 at 2:17 PM, Cook, Michael J. (OCTO)
>> > <Mi...@cable.comcast.com> wrote:
>> >> Sorry... I forgot to add back in the annotations in my Impl class. I
>> just
>> >> did and repackaged. Please disregard the previous manifest.
>> >>
>> >>
>> >>
>> >> Manifest-Version: 1.0
>> >> Export-Package:
>>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >>
>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> >>
>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> >>
>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> >> l
>> >> iPOJO-Components: component { $classname="cook.michael.BogusClass"
>>man
>> >> ipulation { method { $name="$init" }}}component {
>>$name="cook.michael
>> >> .MyComponentImpl" $classname="cook.michael.MyComponentImpl"
>>$public="
>> >> true" org.apache.felix.ipojo.annotations:instantiate { }callback {
>>$t
>> >> ransition="invalidate" $method="stop" }callback {
>>$transition="valida
>> >> te" $method="start" }manipulation { method { $name="$init" }method {
>> >> $name="start" }method { $name="stop" }}}
>> >> Built-By: clement
>> >> Tool: Bnd-0.0.249
>> >> Bundle-Name: Apache Felix iPOJO Annotations
>> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >> Bundle-Vendor: The Apache Software Foundation
>> >> Bundle-Version: 1.8.2
>> >> Build-Jdk: 1.6.0_31
>> >> Bnd-LastModified: 1350044136955
>> >> Bundle-ManifestVersion: 2
>> >> Bundle-Description: iPOJO Annotations
>> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> >> Bundle-DocURL:
>>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >> ns.html
>> >> Import-Package: org.osgi.service.log;version=1.3,
>>org.apache.felix.ipo
>> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>org.apache.f
>> >> elix.ipojo.architecture;version=0.9.0,
>>org.apache.felix.ipojo.extende
>> >> r, org.apache.felix.ipojo.whiteboard,
>>org.apache.felix.ipojo;version=
>> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>org.apache.felix.ipojo.
>> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>org.apache.felix.ipojo
>> >> .annotations, cook.michael
>> >> Bundle-SymbolicName: iPojoTest
>> >> Originally-Created-By: Apache Maven Bundle Plugin
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
>> >> <Mi...@cable.comcast.com> wrote:
>> >>
>> >>>OK,
>> >>>
>> >>>Here it is inline (and attached).
>> >>>
>> >>>Manifest-Version: 1.0
>> >>>Export-Package:
>>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >>>
>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> >>>
>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> >>>
>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> >>> l
>> >>>iPOJO-Components: component { $classname="cook.michael.BogusClass"
>>man
>> >>> ipulation { method { $name="$init" }}}
>> >>>Built-By: clement
>> >>>Tool: Bnd-0.0.249
>> >>>Bundle-Name: Apache Felix iPOJO Annotations
>> >>>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >>>Bundle-Vendor: The Apache Software Foundation
>> >>>Bundle-Version: 1.8.2
>> >>>Build-Jdk: 1.6.0_31
>> >>>Bnd-LastModified: 1350043925031
>> >>>Bundle-ManifestVersion: 2
>> >>>Bundle-Description: iPOJO Annotations
>> >>>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> >>>Bundle-DocURL:
>>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >>> ns.html
>> >>>Import-Package: org.osgi.service.log;version=1.3,
>>org.apache.felix.ipo
>> >>> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>org.apache.f
>> >>> elix.ipojo.architecture;version=0.9.0,
>>org.apache.felix.ipojo.extende
>> >>> r, org.apache.felix.ipojo.whiteboard,
>>org.apache.felix.ipojo;version=
>> >>> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>org.apache.felix.ipojo.
>> >>> handlers.jmx, org.osgi.service.cm;version=1.2,
>>org.apache.felix.ipojo
>> >>> .annotations, cook.michael
>> >>>Bundle-SymbolicName: iPojoTest
>> >>>Originally-Created-By: Apache Maven Bundle Plugin
>> >>>
>> >>>
>> >>>
>> >>>Mike
>> >>>
>> >>>On 10/11/12 10:40 PM, "Göktürk Gezer" <go...@gmail.com>
>>wrote:
>> >>>
>> >>>>I wanted MANIFEST.MF file actually :/
>> >>>>
>> >>>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>> >>>>Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>
>> >>>>> Hmmm...
>> >>>>>
>> >>>>> Here's my metadata.xml...
>> >>>>>
>> >>>>> I get the following error:
>> >>>>>
>> >>>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory
>>from
>> >>>>> org.apache.felix.ipojo.ComponentFactory
>> >>>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
>> >>>>>class
>> >>>>> name : component immediate="true"
>> >>>>> at
>> >>>>>
>>
>>
>>>>>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:
>>>>>>>145)
>> >>>>> at
>> >>>>>
>>
>>
>>>>>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java
>>>>>>>:121
>> >>>>>)
>> >>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> >>>>>Method)
>> >>>>> at
>> >>>>>
>>
>>
>>>>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruc
>>>>>>>torA
>> >>>>>c
>> >>>>>ce
>> >>>>> ssorImpl.java:39)
>> >>>>> at
>> >>>>>
>>
>>
>>>>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegating
>>>>>>>Cons
>> >>>>>t
>> >>>>>ru
>> >>>>> ctorAccessorImpl.java:27)
>> >>>>> at
>>java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> >>>>> at
>> >>>>>
>>
>>
>>>>>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:
>>>>>>>500)
>> >>>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>> >>>>> at
>>
>>>>>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237
>>>>>>>)
>> >>>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>> >>>>> at
>>
>>>>>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>> >>>>> at java.lang.Thread.run(Thread.java:680)
>> >>>>>
>> >>>>>
>> >>>>> Here's what I had for the Bogus Class case on the metadata.xml:
>> >>>>>
>> >>>>> <ipojo>
>> >>>>> <component className="cook.michael.BogusClass"/>
>> >>>>> </ipojo>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> Mike
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com>
>> wrote:
>> >>>>>
>> >>>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>> >>>>> >
>> >>>>> >First finding : you don't need a bogus component. You can just
>>type
>> >>>>> ><ipojo>
>> >>>>> ><component/>
>> >>>>> ></ipojo>
>> >>>>> >
>> >>>>> >inside you metadata.xml and it'll pass silently.
>> >>>>> >
>> >>>>> >Besides you might be hitting a bug we've fixed in trunk, because
>>in
>> >>>>>the
>> >>>>> >same scenario I suggested to you I saw some elements in MANIFEST
>> which
>> >>>>> >shouldn't be there.
>> >>>>> >Could you share me your MANIFEST for the final state(bogus
>> >>>>>metadata.xml +
>> >>>>> >annotations)?
>> >>>>> >
>> >>>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>> >>>>> >Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>> >
>> >>>>> >> Hi,
>> >>>>> >>
>> >>>>> >> >>Could you tell me what happens when you remove the <ipojo/>
>> >>>>>element
>> >>>>> >>too
>> >>>>> >> >>leaving the metadata.xml empty?
>> >>>>> >>
>> >>>>> >>
>> >>>>> >> I get an error when there is no contents in the metadata.xml
>>file.
>> >>>>> >>
>> >>>>> >> >>I could suggest you a trick to define a bogus
>> >>>>> >> >>component inside metadata.xml(Will require you to maintain a
>> bogus
>> >>>>> >>class)
>> >>>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml
>>and
>> >>>>>move
>> >>>>> >>along
>> >>>>> >> >>its way with annotations.
>> >>>>> >>
>> >>>>> >>
>> >>>>> >> I added a bogus class into the cook.michael package and put the
>> >>>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the
>>code.
>> >>>>>Then
>> >>>>> >> added this component to the metadata.xml file:
>> >>>>> >> <ipojo>
>> >>>>> >> <component className="cook.michael.BogusClass"/>
>> >>>>> >> </ipojo>
>> >>>>> >>
>> >>>>> >>
>> >>>>> >>
>> >>>>> >> The above results in the start and stop not being invoked.
>> >>>>> >>
>> >>>>> >> >>Instead of embedding Felix into eclipse you can use its own
>> >>>>>Equinox
>> >>>>> >> >>launcher.
>> >>>>> >>
>> >>>>> >> I'm developing atop Felix, because the target device is Felix
>> based,
>> >>>>>so
>> >>>>> >>I
>> >>>>> >> would like to keep it on the same platform.
>> >>>>> >>
>> >>>>> >>
>> >>>>> >> Thank you for your help.
>> >>>>> >> Mike
>> >>>>> >>
>> >>>>> >>
>> >>>>> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com>
>> >>>>>wrote:
>> >>>>> >>
>> >>>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>> >>>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>> >> >
>> >>>>> >> >> Göktürk,
>> >>>>> >> >>
>> >>>>> >> >> Thank you! I used #2 below and it worked well. I was able
>>to
>> >>>>>launch
>> >>>>> >>the
>> >>>>> >> >> bundle, and I saw it output the traces I had been looking
>>for.
>> >>>>> >> >>
>> >>>>> >> >
>> >>>>> >> >Cool !
>> >>>>> >> >
>> >>>>> >> >
>> >>>>> >> >>
>> >>>>> >> >> On the first, if I remove the contents of the metadata.xml
>> file,
>> >>>>>how
>> >>>>> >> >>can I
>> >>>>> >> >> use iPOJO to generate the bundle? If I leave in the
>><ipojo/>
>> >>>>> >>element,
>> >>>>> >> >>and
>> >>>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
>> >>>>>component
>> >>>>> >> >>types,
>> >>>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>> >>>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>> >>>>>although
>> >>>>> >>the
>> >>>>> >> >> class is marked with @Component and @Instantiate and
>>start/stop
>> >>>>>is
>> >>>>> >> >>marked
>> >>>>> >> >> with @Validate/@Invalidate.
>> >>>>> >> >>
>> >>>>> >> >
>> >>>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
>> >>>>>seems
>> >>>>> >>to be
>> >>>>> >> >dependent on metadata.xml but also sees the annotations on its
>> way.
>> >>>>> >> >
>> >>>>> >> >Could you tell me what happens when you remove the <ipojo/>
>> element
>> >>>>>too
>> >>>>> >> >leaving the metadata.xml empty?
>> >>>>> >>
>> >>>>> >> >
>> >>>>> >> >If above trick didn't work and you want to stick with
>> >>>>> >>eclipse-ipojo-plugin
>> >>>>> >> >while using annotations. I could suggest you a trick to
>>define a
>> >>>>>bogus
>> >>>>> >> >component inside metadata.xml(Will require you to maintain a
>> bogus
>> >>>>> >>class)
>> >>>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and
>> move
>> >>>>> >>along
>> >>>>> >> >its way with annotations.
>> >>>>> >> >
>> >>>>> >> >Also it seems to me that your development environment is
>>heavy.
>> >>>>> >>Instead of
>> >>>>> >> >embedding Felix into eclipse you can use its own Equinox
>> launcher.
>> >>>>> >> >I suggest you to have a look at
>> >>>>> >>
>> >>>>> >>>
>> >>>>>
>> >>>>>
>> http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>> >>>>> >> >where
>> >>>>> >> >you can see basic setup.(You can use annotations or metadata
>>of
>> >>>>>your
>> >>>>> >> >choice
>> >>>>> >> >in this setup)
>> >>>>> >> >
>> >>>>> >> >
>> >>>>> >> >Gokturk
>> >>>>> >> >
>> >>>>> >> >
>> >>>>> >> >>
>> >>>>> >> >> Mike
>> >>>>> >> >>
>> >>>>> >> >>
>> >>>>> >> >>
>> >>>>> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer"
>><go...@gmail.com>
>> >>>>> wrote:
>> >>>>> >> >>
>> >>>>> >> >> >Well i thought at first that you didn't specify
>>metadata.xml
>> but
>> >>>>>i
>> >>>>> >>see
>> >>>>> >> >>now
>> >>>>> >> >> >that you did. Mixing metadata.xml and annotations for one
>> single
>> >>>>> >> >>component
>> >>>>> >> >> >is a mistake. For same component you must go with one of
>>them.
>> >>>>> >> >> >
>> >>>>> >> >> >So there are 2 different ways for you:
>> >>>>> >> >> >
>> >>>>> >> >> >1- Using only annotations: Just disable the metadata.xml
>> (easily
>> >>>>> >> >>delete it
>> >>>>> >> >> >or comment out the content ) and leave the annotations as
>>it
>> is.
>> >>>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml
>>then
>> >>>>> >>remove
>> >>>>> >> >>all
>> >>>>> >> >> >annotations including @validate and @invalidate and make
>>sure
>> >>>>>your
>> >>>>> >> >> >metadata.xml looks like this:
>> >>>>> >> >> >
>> >>>>> >> >> ><ipojo>
>> >>>>> >> >> ><component className="cook.michael.MyComponentImpl">
>> >>>>> >> >> > <callback transition="validate" method="start"/>
>> >>>>> >> >> > <callback transition="invalidate" method="stop"/>
>> >>>>> >> >> ></component>
>> >>>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>> >>>>> >> >> ></ipojo>
>> >>>>> >> >> >
>> >>>>> >> >> >Either way should bring you where you want. Just don't mix
>> >>>>> >>annotation
>> >>>>> >> >>and
>> >>>>> >> >> >metadata usage for same component.
>> >>>>> >> >> >
>> >>>>> >> >> >Regards,
>> >>>>> >> >> >Gokturk
>> >>>>> >> >> >
>> >>>>> >> >> >
>> >>>>> >> >> >
>> >>>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>> >>>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>> >> >> >
>> >>>>> >> >> >> Hi Göktürk,
>> >>>>> >> >> >>
>> >>>>> >> >> >> OK... Tried that. Still the same thing. There's not
>>much
>> to
>> >>>>>my
>> >>>>> >> >>code,
>> >>>>> >> >> >>so
>> >>>>> >> >> >> I'm including it below. Please let me know if you see
>> >>>>>anything.
>> >>>>> >> >> >>
>> >>>>> >> >> >> Thank you for helping me,
>> >>>>> >> >> >> Mike
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >> MyComponentImpl.java:
>> >>>>> >> >> >>
>> >>>>> >> >> >> package cook.michael;
>> >>>>> >> >> >>
>> >>>>> >> >> >> import java.io.BufferedWriter;
>> >>>>> >> >> >> import java.io.File;
>> >>>>> >> >> >> import java.io.FileWriter;
>> >>>>> >> >> >> import java.io.IOException;
>> >>>>> >> >> >>
>> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>> >>>>> >> >> >>
>> >>>>> >> >> >> @Component
>> >>>>> >> >> >> @Instantiate
>> >>>>> >> >> >> public class MyComponentImpl {
>> >>>>> >> >> >>
>> >>>>> >> >> >> @Validate
>> >>>>> >> >> >> public void start() throws IOException {
>> >>>>> >> >> >> System.err.println("Starting: " );
>> >>>>> >> >> >>
>> >>>>> >> >> >> System.out.println("I'm starting...");
>> >>>>> >> >> >> try{
>> >>>>> >> >> >> // Create file
>> >>>>> >> >> >> FileWriter fstream = new
>> >>>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>> >>>>> >> >> >> BufferedWriter out = new
>>BufferedWriter(fstream);
>> >>>>> >> >> >> out.write("Hello Java");
>> >>>>> >> >> >> //Close the output stream
>> >>>>> >> >> >> out.close();
>> >>>>> >> >> >> }catch (Exception e){//Catch exception if any
>> >>>>> >> >> >> System.err.println("Error: " +
>>e.getMessage());
>> >>>>> >> >> >> }
>> >>>>> >> >> >> throw new IOException() ;
>> >>>>> >> >> >> }
>> >>>>> >> >> >>
>> >>>>> >> >> >> @Invalidate
>> >>>>> >> >> >> public void stop() {
>> >>>>> >> >> >> System.out.println("I'm leaving !");
>> >>>>> >> >> >> }
>> >>>>> >> >> >> }
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >> metadata.xml:
>> >>>>> >> >> >>
>> >>>>> >> >> >> <ipojo>
>> >>>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>> >>>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>> >>>>> >> >> >> </ipojo>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >> iPojoTest.bnd:
>> >>>>> >> >> >>
>> >>>>> >> >> >> Import-Package: *
>> >>>>> >> >> >> Export-Package: *
>> >>>>> >> >> >> #Private-Package:
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >> Generated manefest.mf:
>> >>>>> >> >> >>
>> >>>>> >> >> >> Manifest-Version: 1.0
>> >>>>> >> >> >> Export-Package:
>> >>>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >>>>> >> >> >>
>> >>>>> >>
>>
>>
>>>>>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.fe
>>>>>>>>>lix
>> >>>>> >> >> >>
>> >>>>> >>
>>
>>
>>>>>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache
>>>>>>>>>.fe
>> >>>>> >> >> >>
>> >>>>> >>
>>
>>
>>>>>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.mic
>>>>>>>>>hae
>> >>>>> >> >> >> l
>> >>>>> >> >> >> iPOJO-Components: component {
>> >>>>> >> >>$classname="cook.michael.MyComponentImpl
>> >>>>> >> >> >> " manipulation { method { $name="$init" }method {
>> >>>>>$name="start"
>> >>>>> >> >>}meth
>> >>>>> >> >> >> od { $name="stop" }}}instance {
>> >>>>> >> >>$component="cook.michael.MyComponentI
>> >>>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>> >>>>> >> >>$classname="co
>> >>>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>> >>>>> >> >>org.apache.felix.ipojo.ann
>> >>>>> >> >> >> otations:instantiate { }callback {
>>$transition="invalidate"
>> >>>>> >> >>$method="
>> >>>>> >> >> >> stop" }callback { $transition="validate" $method="start"
>> >>>>> >> >>}manipulatio
>> >>>>> >> >> >> n { method { $name="$init" }method { $name="start"
>>}method
>> {
>> >>>>> >> >>$name="s
>> >>>>> >> >> >> top" }}}
>> >>>>> >> >> >> Built-By: clement
>> >>>>> >> >> >> Tool: Bnd-0.0.249
>> >>>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>> >>>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >>>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>> >>>>> >> >> >> Bundle-Version: 1.8.2
>> >>>>> >> >> >> Build-Jdk: 1.6.0_31
>> >>>>> >> >> >> Bnd-LastModified: 1350001458935
>> >>>>> >> >> >> Bundle-ManifestVersion: 2
>> >>>>> >> >> >> Bundle-Description: iPOJO Annotations
>> >>>>> >> >> >> Bundle-License:
>> http://www.apache.org/licenses/LICENSE-2.0.txt
>> >>>>> >> >> >> Bundle-DocURL:
>> >>>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >>>>> >> >> >> ns.html
>> >>>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>> >>>>> >> >>org.apache.felix.ipo
>> >>>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>> >>>>> >> >>org.apache.f
>> >>>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>> >>>>> >> >>org.apache.felix.ipojo.extende
>> >>>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>> >>>>> >> >>org.apache.felix.ipojo;version=
>> >>>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>> >>>>> >> >>org.apache.felix.ipojo.
>> >>>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>> >>>>> >> >>org.apache.felix.ipojo
>> >>>>> >> >> >> .annotations, cook.michael
>> >>>>> >> >> >> Bundle-SymbolicName: iPojoTest
>> >>>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <
>> gokturk.gezer@gmail.com>
>> >>>>> >> wrote:
>> >>>>> >> >> >>
>> >>>>> >> >> >> >Hi,
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >First of all @Component is mandatory.(For annotation
>>based
>> >>>>> >>usage).
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >But this only defines your component. To actually
>> instantiate
>> >>>>>it
>> >>>>> >>you
>> >>>>> >> >> >> >should
>> >>>>> >> >> >> >do it deliberately. One way to do that is using
>> @Instantiate
>> >>>>> >> >> >>annotation.
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >So your code would be like:
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >@Component
>> >>>>> >> >> >> >@Instantiate
>> >>>>> >> >> >> >public class foo{
>> >>>>> >> >> >> >
>> >>>>> >> >> >> > @Validate
>> >>>>> >> >> >> > public void start()
>> >>>>> >> >> >> >..........
>> >>>>> >> >> >> >..........
>> >>>>> >> >> >> >}
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J.
>>(OCTO) <
>> >>>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>> >> >> >> >
>> >>>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class.
>>And
>> >>>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried
>>removing
>> >>>>>the
>> >>>>> >> >> >> >>@Component.
>> >>>>> >> >> >> >> Same result. No output.
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> Mike
>> >>>>> >> >> >> >> Michael Cook
>> >>>>> >> >> >> >> VP Technology Innovation
>> >>>>> >> >> >> >> Comcast
>> >>>>> >> >> >> >> One Comcast Center
>> >>>>> >> >> >> >> Philadelphia, PA 19103
>> >>>>> >> >> >> >> (o) 215-286-8260
>> >>>>> >> >> >> >> (m) 609-458-0332
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> ----- Original Message -----
>> >>>>> >> >> >> >> From: Cook, Michael J. (OCTO)
>> >>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>> >>>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> >>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> I used @validate/@invalidate alone.
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> Mike
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> Michael Cook
>> >>>>> >> >> >> >> VP Technology Innovation
>> >>>>> >> >> >> >> Comcast
>> >>>>> >> >> >> >> One Comcast Center
>> >>>>> >> >> >> >> Philadelphia, PA 19103
>> >>>>> >> >> >> >> (o) 215-286-8260
>> >>>>> >> >> >> >> (m) 609-458-0332
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> ----- Original Message -----
>> >>>>> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>> >>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>> >>>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>> >>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> Hi,
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> I need to ask this first since it's not on your code
>> >>>>>snippet:
>> >>>>> >>Did
>> >>>>> >> >>you
>> >>>>> >> >> >> >>use
>> >>>>> >> >> >> >> @Component annotation for class where you've declared
>> your
>> >>>>> >>start()
>> >>>>> >> >> >> >>stop()
>> >>>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> *Regards,*
>> >>>>> >> >> >> >> *Gokturk*
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J.
>>(OCTO)
>> <
>> >>>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>> >>>>> >> >> >> >>
>> >>>>> >> >> >> >> > Hi,
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I can't seem to find a good article that will help
>>me
>> >>>>>resolve
>> >>>>> >> >>the
>> >>>>> >> >> >> >> "getting
>> >>>>> >> >> >> >> > started" issue I am facing.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse
>> plugin,
>> >>>>> >>from:
>> >>>>> >> >> >> >> > http://clement.plop-plop.net/update/
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I have created a sample project following the
>> >>>>>instructions
>> >>>>> >>at:
>> >>>>> >> >> >> >> >
>> http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>> >>>>>following
>> >>>>> >> >> >> >>instructions
>> >>>>> >> >> >> >> > here:
>> >>>>> >> >> >>
>> >>>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>> >>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>> >>>>>installed
>> >>>>> >> >>the
>> >>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started
>>it.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I've created a test bundle using iPOJO called
>> >>>>>iPojoTest.jar
>> >>>>> >>and
>> >>>>> >> >> >>I've
>> >>>>> >> >> >> >> > installed it and started it in the OSGI console.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I run bundles in the console and I get:
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > g! bundles
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
>> >>>>>(3.0.7)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 1|Active |
>> 1|org.apache.felix.bundlerepository
>> >>>>> >> >>(1.6.2)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 2|Active |
>>1|org.apache.felix.gogo.command
>> >>>>>(0.6.1)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 3|Active |
>>1|org.apache.felix.gogo.runtime
>> >>>>>(0.6.1)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>> >>>>>(0.6.1)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo
>>(1.8.2)
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > So, the bundle seems to have started.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > But I don't get any console output from my sysoutsŠ
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > Here are the start() and stop() methods:
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > @Validate
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > public void start() throws IOException {
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > System.out.println("I'm
>>starting...");
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > try{
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > // Create file
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > FileWriter fstream = new
>> >>>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > BufferedWriter out = new
>> >>>>> >> >>BufferedWriter(fstream);
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > out.write("Hello Java");
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > //Close the output stream
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > out.close();
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > }catch (Exception e){//Catch
>> exception
>> >>>>>if
>> >>>>> >>any
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > System.err.println("Error: " +
>> >>>>> >> >>e.getMessage());
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > }
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > throw new IOException() ;
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > }
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > @Invalidate
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > public void stop() {
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > System.out.println("I'm leaving !");
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > }
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > I added in the file write to see if a file would be
>> >>>>>created.
>> >>>>> >> >>There
>> >>>>> >> >> >> >>is no
>> >>>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
>> >>>>>ACTIVE,
>> >>>>> >>the
>> >>>>> >> >> >>start
>> >>>>> >> >> >> >> method
>> >>>>> >> >> >> >> > appears never have to been called.
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > Can anyone tell me what I may have done wrong or
>> provide
>> >>>>>a
>> >>>>> >>clue
>> >>>>> >> >>as
>> >>>>> >> >> >>to
>> >>>>> >> >> >> >> what
>> >>>>> >> >> >> >> > to look at to help diagnose the problem?
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > Thanks,
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> > Mike
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >> >
>> >>>>> >> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>>
>> >>---------------------------------------------------------------------
>> >>>>> >> >> >> To unsubscribe, e-mail:
>>users-unsubscribe@felix.apache.org
>> >>>>> >> >> >> For additional commands, e-mail:
>> users-help@felix.apache.org
>> >>>>> >> >> >>
>> >>>>> >> >> >>
>> >>>>> >> >>
>> >>>>> >> >>
>> >>>>> >> >>
>>
>>>>>>>--------------------------------------------------------------------
>>>>>>>-
>> >>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>> >> >>
>> >>>>> >> >>
>> >>>>> >>
>> >>>>> >>
>> >>>>> >>
>>
>>>>>>>--------------------------------------------------------------------
>>>>>>>-
>> >>>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>> >>
>> >>>>> >>
>> >>>>>
>> >>>>>
>> >>>>>
>>---------------------------------------------------------------------
>> >>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>>> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>>
>> >>>>>
>> >>>
>> >>>
>> >>>---------------------------------------------------------------------
>> >>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> > For additional commands, e-mail: users-help@felix.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> > For additional commands, e-mail: users-help@felix.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
Hi,
Yeah Michael is right, eclipse-ipojo-plugin is not updated since almost 4
years. And It's using ipojo-1.0.0 internally.
You should check
http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
You would also like
http://gitorious.ow2.org/ow2-chameleon/eclipse-ipojo-builder You can use
this plugin to integrate ipojo manipulation process right into eclipse's
own building phase and can use eclipse equinox launcher.
These would be necessary for you to build your own development environment
without so much burden.
Regards,
Gokturk
On Fri, Oct 12, 2012 at 6:11 PM, Simon Chemouil <sc...@gmail.com> wrote:
> Michael,
>
> Concerning iPojo itself, I think you won't find much tutorials outside
> of iPojo's website. That website could definitely be improved and some
> pages are outdated. I know iPojo is used in various companies, but
> iPojo users are rather quiet compared to Guice or Spring/Blueprint
> users who blog a lot more.
>
> I suggest you take at look at the examples available at
> https://svn.apache.org/repos/asf/felix/trunk/ipojo/examples/tutorial-maven
> The samples are depending on iPojo 1.5.0-SNAPSHOT so be sure to update
> the versions (in pom.xml files).
>
> We switched to iPojo some time ago (from DS), and it was painless as
> were already using Maven to build our projects. We simply had to
> switch annotations and add the proper Maven configuration -- and then
> benefit from all the other exciting features of iPojo.
>
> There is a release coming soon that will fix a few bugs so in the mean
> time we are following the trunk version. I suggest you take a look at
> iPojo's JIRA if you encounter a bug during the build in the
> maven-ipojo-plugin: if the bugs are marked as fix you will either have
> to build your own local copy of iPojo (1.9.0-SNAPSHOT) or wait for a
> release.
>
> HTH,
>
> Simon
>
>
> On Fri, Oct 12, 2012 at 4:29 PM, Cook, Michael J. (OCTO)
> <Mi...@cable.comcast.com> wrote:
> > Simon,
> >
> > Excellent. I will look online for tutorials explaining your suggested
> paths forward. If you know of any good ones, please let me know.
> >
> > Mike
> > Michael Cook
> > VP Technology Innovation
> > Comcast
> > One Comcast Center
> > Philadelphia, PA 19103
> > (o) 215-286-8260
> > (m) 609-458-0332
> >
> > ----- Original Message -----
> > From: Simon Chemouil [mailto:schemouil@gmail.com]
> > Sent: Friday, October 12, 2012 08:34 AM
> > To: users@felix.apache.org <us...@felix.apache.org>
> > Subject: Re: Getting Started with iPOJO
> >
> > Michael,
> >
> > It seems like you are using an antique version of iPojo. The import
> > you show in your manifest is 0.9.0 and the last release is 1.8.2 (that
> > import is added by the manipulator).
> >
> > In an earlier message you said you were using the Eclipse plugin
> > available on Clement's website. This plugin is not maintained anymore
> > and while there is a new iPojo Eclipse plugin maintained elsewhere, I
> > wouldn't advise using it. Rather, you should use the manipulator from
> > ant or maven depending on how you build your project. If you choose
> > the maven-ipojo-plugin, you can get decent Eclipse integration using
> > Maven's Eclipse environment (M2E).
> >
> > HTH,
> >
> > Simon
> >
> > On Fri, Oct 12, 2012 at 2:17 PM, Cook, Michael J. (OCTO)
> > <Mi...@cable.comcast.com> wrote:
> >> Sorry... I forgot to add back in the annotations in my Impl class. I
> just
> >> did and repackaged. Please disregard the previous manifest.
> >>
> >>
> >>
> >> Manifest-Version: 1.0
> >> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >> l
> >> iPOJO-Components: component { $classname="cook.michael.BogusClass" man
> >> ipulation { method { $name="$init" }}}component { $name="cook.michael
> >> .MyComponentImpl" $classname="cook.michael.MyComponentImpl" $public="
> >> true" org.apache.felix.ipojo.annotations:instantiate { }callback { $t
> >> ransition="invalidate" $method="stop" }callback { $transition="valida
> >> te" $method="start" }manipulation { method { $name="$init" }method {
> >> $name="start" }method { $name="stop" }}}
> >> Built-By: clement
> >> Tool: Bnd-0.0.249
> >> Bundle-Name: Apache Felix iPOJO Annotations
> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >> Bundle-Vendor: The Apache Software Foundation
> >> Bundle-Version: 1.8.2
> >> Build-Jdk: 1.6.0_31
> >> Bnd-LastModified: 1350044136955
> >> Bundle-ManifestVersion: 2
> >> Bundle-Description: iPOJO Annotations
> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> >> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >> ns.html
> >> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> >> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> >> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> >> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> >> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> >> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> >> .annotations, cook.michael
> >> Bundle-SymbolicName: iPojoTest
> >> Originally-Created-By: Apache Maven Bundle Plugin
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
> >> <Mi...@cable.comcast.com> wrote:
> >>
> >>>OK,
> >>>
> >>>Here it is inline (and attached).
> >>>
> >>>Manifest-Version: 1.0
> >>>Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >>> l
> >>>iPOJO-Components: component { $classname="cook.michael.BogusClass" man
> >>> ipulation { method { $name="$init" }}}
> >>>Built-By: clement
> >>>Tool: Bnd-0.0.249
> >>>Bundle-Name: Apache Felix iPOJO Annotations
> >>>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >>>Bundle-Vendor: The Apache Software Foundation
> >>>Bundle-Version: 1.8.2
> >>>Build-Jdk: 1.6.0_31
> >>>Bnd-LastModified: 1350043925031
> >>>Bundle-ManifestVersion: 2
> >>>Bundle-Description: iPOJO Annotations
> >>>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> >>>Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >>> ns.html
> >>>Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> >>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> >>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> >>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> >>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> >>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> >>> .annotations, cook.michael
> >>>Bundle-SymbolicName: iPojoTest
> >>>Originally-Created-By: Apache Maven Bundle Plugin
> >>>
> >>>
> >>>
> >>>Mike
> >>>
> >>>On 10/11/12 10:40 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
> >>>
> >>>>I wanted MANIFEST.MF file actually :/
> >>>>
> >>>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
> >>>>Michael_J_Cook@cable.comcast.com> wrote:
> >>>>
> >>>>> Hmmm...
> >>>>>
> >>>>> Here's my metadata.xml...
> >>>>>
> >>>>> I get the following error:
> >>>>>
> >>>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
> >>>>> org.apache.felix.ipojo.ComponentFactory
> >>>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
> >>>>>class
> >>>>> name : component immediate="true"
> >>>>> at
> >>>>>
>
> >>>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
> >>>>> at
> >>>>>
>
> >>>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121
> >>>>>)
> >>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >>>>>Method)
> >>>>> at
> >>>>>
>
> >>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
> >>>>>c
> >>>>>ce
> >>>>> ssorImpl.java:39)
> >>>>> at
> >>>>>
>
> >>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
> >>>>>t
> >>>>>ru
> >>>>> ctorAccessorImpl.java:27)
> >>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> >>>>> at
> >>>>>
>
> >>>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
> >>>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
> >>>>> at
> >>>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
> >>>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
> >>>>> at
> >>>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
> >>>>> at java.lang.Thread.run(Thread.java:680)
> >>>>>
> >>>>>
> >>>>> Here's what I had for the Bogus Class case on the metadata.xml:
> >>>>>
> >>>>> <ipojo>
> >>>>> <component className="cook.michael.BogusClass"/>
> >>>>> </ipojo>
> >>>>>
> >>>>>
> >>>>>
> >>>>> Mike
> >>>>>
> >>>>>
> >>>>>
> >>>>> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com>
> wrote:
> >>>>>
> >>>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
> >>>>> >
> >>>>> >First finding : you don't need a bogus component. You can just type
> >>>>> ><ipojo>
> >>>>> ><component/>
> >>>>> ></ipojo>
> >>>>> >
> >>>>> >inside you metadata.xml and it'll pass silently.
> >>>>> >
> >>>>> >Besides you might be hitting a bug we've fixed in trunk, because in
> >>>>>the
> >>>>> >same scenario I suggested to you I saw some elements in MANIFEST
> which
> >>>>> >shouldn't be there.
> >>>>> >Could you share me your MANIFEST for the final state(bogus
> >>>>>metadata.xml +
> >>>>> >annotations)?
> >>>>> >
> >>>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
> >>>>> >Michael_J_Cook@cable.comcast.com> wrote:
> >>>>> >
> >>>>> >> Hi,
> >>>>> >>
> >>>>> >> >>Could you tell me what happens when you remove the <ipojo/>
> >>>>>element
> >>>>> >>too
> >>>>> >> >>leaving the metadata.xml empty?
> >>>>> >>
> >>>>> >>
> >>>>> >> I get an error when there is no contents in the metadata.xml file.
> >>>>> >>
> >>>>> >> >>I could suggest you a trick to define a bogus
> >>>>> >> >>component inside metadata.xml(Will require you to maintain a
> bogus
> >>>>> >>class)
> >>>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and
> >>>>>move
> >>>>> >>along
> >>>>> >> >>its way with annotations.
> >>>>> >>
> >>>>> >>
> >>>>> >> I added a bogus class into the cook.michael package and put the
> >>>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
> >>>>>Then
> >>>>> >> added this component to the metadata.xml file:
> >>>>> >> <ipojo>
> >>>>> >> <component className="cook.michael.BogusClass"/>
> >>>>> >> </ipojo>
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >> The above results in the start and stop not being invoked.
> >>>>> >>
> >>>>> >> >>Instead of embedding Felix into eclipse you can use its own
> >>>>>Equinox
> >>>>> >> >>launcher.
> >>>>> >>
> >>>>> >> I'm developing atop Felix, because the target device is Felix
> based,
> >>>>>so
> >>>>> >>I
> >>>>> >> would like to keep it on the same platform.
> >>>>> >>
> >>>>> >>
> >>>>> >> Thank you for your help.
> >>>>> >> Mike
> >>>>> >>
> >>>>> >>
> >>>>> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com>
> >>>>>wrote:
> >>>>> >>
> >>>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
> >>>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >>>>> >> >
> >>>>> >> >> Göktürk,
> >>>>> >> >>
> >>>>> >> >> Thank you! I used #2 below and it worked well. I was able to
> >>>>>launch
> >>>>> >>the
> >>>>> >> >> bundle, and I saw it output the traces I had been looking for.
> >>>>> >> >>
> >>>>> >> >
> >>>>> >> >Cool !
> >>>>> >> >
> >>>>> >> >
> >>>>> >> >>
> >>>>> >> >> On the first, if I remove the contents of the metadata.xml
> file,
> >>>>>how
> >>>>> >> >>can I
> >>>>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
> >>>>> >>element,
> >>>>> >> >>and
> >>>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
> >>>>>component
> >>>>> >> >>types,
> >>>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
> >>>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
> >>>>>although
> >>>>> >>the
> >>>>> >> >> class is marked with @Component and @Instantiate and start/stop
> >>>>>is
> >>>>> >> >>marked
> >>>>> >> >> with @Validate/@Invalidate.
> >>>>> >> >>
> >>>>> >> >
> >>>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
> >>>>>seems
> >>>>> >>to be
> >>>>> >> >dependent on metadata.xml but also sees the annotations on its
> way.
> >>>>> >> >
> >>>>> >> >Could you tell me what happens when you remove the <ipojo/>
> element
> >>>>>too
> >>>>> >> >leaving the metadata.xml empty?
> >>>>> >>
> >>>>> >> >
> >>>>> >> >If above trick didn't work and you want to stick with
> >>>>> >>eclipse-ipojo-plugin
> >>>>> >> >while using annotations. I could suggest you a trick to define a
> >>>>>bogus
> >>>>> >> >component inside metadata.xml(Will require you to maintain a
> bogus
> >>>>> >>class)
> >>>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and
> move
> >>>>> >>along
> >>>>> >> >its way with annotations.
> >>>>> >> >
> >>>>> >> >Also it seems to me that your development environment is heavy.
> >>>>> >>Instead of
> >>>>> >> >embedding Felix into eclipse you can use its own Equinox
> launcher.
> >>>>> >> >I suggest you to have a look at
> >>>>> >>
> >>>>> >>>
> >>>>>
> >>>>>
> http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
> >>>>> >> >where
> >>>>> >> >you can see basic setup.(You can use annotations or metadata of
> >>>>>your
> >>>>> >> >choice
> >>>>> >> >in this setup)
> >>>>> >> >
> >>>>> >> >
> >>>>> >> >Gokturk
> >>>>> >> >
> >>>>> >> >
> >>>>> >> >>
> >>>>> >> >> Mike
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com>
> >>>>> wrote:
> >>>>> >> >>
> >>>>> >> >> >Well i thought at first that you didn't specify metadata.xml
> but
> >>>>>i
> >>>>> >>see
> >>>>> >> >>now
> >>>>> >> >> >that you did. Mixing metadata.xml and annotations for one
> single
> >>>>> >> >>component
> >>>>> >> >> >is a mistake. For same component you must go with one of them.
> >>>>> >> >> >
> >>>>> >> >> >So there are 2 different ways for you:
> >>>>> >> >> >
> >>>>> >> >> >1- Using only annotations: Just disable the metadata.xml
> (easily
> >>>>> >> >>delete it
> >>>>> >> >> >or comment out the content ) and leave the annotations as it
> is.
> >>>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
> >>>>> >>remove
> >>>>> >> >>all
> >>>>> >> >> >annotations including @validate and @invalidate and make sure
> >>>>>your
> >>>>> >> >> >metadata.xml looks like this:
> >>>>> >> >> >
> >>>>> >> >> ><ipojo>
> >>>>> >> >> ><component className="cook.michael.MyComponentImpl">
> >>>>> >> >> > <callback transition="validate" method="start"/>
> >>>>> >> >> > <callback transition="invalidate" method="stop"/>
> >>>>> >> >> ></component>
> >>>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
> >>>>> >> >> ></ipojo>
> >>>>> >> >> >
> >>>>> >> >> >Either way should bring you where you want. Just don't mix
> >>>>> >>annotation
> >>>>> >> >>and
> >>>>> >> >> >metadata usage for same component.
> >>>>> >> >> >
> >>>>> >> >> >Regards,
> >>>>> >> >> >Gokturk
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
> >>>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >>>>> >> >> >
> >>>>> >> >> >> Hi Göktürk,
> >>>>> >> >> >>
> >>>>> >> >> >> OK... Tried that. Still the same thing. There's not much
> to
> >>>>>my
> >>>>> >> >>code,
> >>>>> >> >> >>so
> >>>>> >> >> >> I'm including it below. Please let me know if you see
> >>>>>anything.
> >>>>> >> >> >>
> >>>>> >> >> >> Thank you for helping me,
> >>>>> >> >> >> Mike
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> MyComponentImpl.java:
> >>>>> >> >> >>
> >>>>> >> >> >> package cook.michael;
> >>>>> >> >> >>
> >>>>> >> >> >> import java.io.BufferedWriter;
> >>>>> >> >> >> import java.io.File;
> >>>>> >> >> >> import java.io.FileWriter;
> >>>>> >> >> >> import java.io.IOException;
> >>>>> >> >> >>
> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
> >>>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
> >>>>> >> >> >>
> >>>>> >> >> >> @Component
> >>>>> >> >> >> @Instantiate
> >>>>> >> >> >> public class MyComponentImpl {
> >>>>> >> >> >>
> >>>>> >> >> >> @Validate
> >>>>> >> >> >> public void start() throws IOException {
> >>>>> >> >> >> System.err.println("Starting: " );
> >>>>> >> >> >>
> >>>>> >> >> >> System.out.println("I'm starting...");
> >>>>> >> >> >> try{
> >>>>> >> >> >> // Create file
> >>>>> >> >> >> FileWriter fstream = new
> >>>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
> >>>>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
> >>>>> >> >> >> out.write("Hello Java");
> >>>>> >> >> >> //Close the output stream
> >>>>> >> >> >> out.close();
> >>>>> >> >> >> }catch (Exception e){//Catch exception if any
> >>>>> >> >> >> System.err.println("Error: " + e.getMessage());
> >>>>> >> >> >> }
> >>>>> >> >> >> throw new IOException() ;
> >>>>> >> >> >> }
> >>>>> >> >> >>
> >>>>> >> >> >> @Invalidate
> >>>>> >> >> >> public void stop() {
> >>>>> >> >> >> System.out.println("I'm leaving !");
> >>>>> >> >> >> }
> >>>>> >> >> >> }
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> metadata.xml:
> >>>>> >> >> >>
> >>>>> >> >> >> <ipojo>
> >>>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
> >>>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
> >>>>> >> >> >> </ipojo>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> iPojoTest.bnd:
> >>>>> >> >> >>
> >>>>> >> >> >> Import-Package: *
> >>>>> >> >> >> Export-Package: *
> >>>>> >> >> >> #Private-Package:
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> Generated manefest.mf:
> >>>>> >> >> >>
> >>>>> >> >> >> Manifest-Version: 1.0
> >>>>> >> >> >> Export-Package:
> >>>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >>>>> >> >> >>
> >>>>> >>
>
> >>>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >>>>> >> >> >>
> >>>>> >>
>
> >>>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >>>>> >> >> >>
> >>>>> >>
>
> >>>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >>>>> >> >> >> l
> >>>>> >> >> >> iPOJO-Components: component {
> >>>>> >> >>$classname="cook.michael.MyComponentImpl
> >>>>> >> >> >> " manipulation { method { $name="$init" }method {
> >>>>>$name="start"
> >>>>> >> >>}meth
> >>>>> >> >> >> od { $name="stop" }}}instance {
> >>>>> >> >>$component="cook.michael.MyComponentI
> >>>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
> >>>>> >> >>$classname="co
> >>>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
> >>>>> >> >>org.apache.felix.ipojo.ann
> >>>>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
> >>>>> >> >>$method="
> >>>>> >> >> >> stop" }callback { $transition="validate" $method="start"
> >>>>> >> >>}manipulatio
> >>>>> >> >> >> n { method { $name="$init" }method { $name="start" }method
> {
> >>>>> >> >>$name="s
> >>>>> >> >> >> top" }}}
> >>>>> >> >> >> Built-By: clement
> >>>>> >> >> >> Tool: Bnd-0.0.249
> >>>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
> >>>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >>>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
> >>>>> >> >> >> Bundle-Version: 1.8.2
> >>>>> >> >> >> Build-Jdk: 1.6.0_31
> >>>>> >> >> >> Bnd-LastModified: 1350001458935
> >>>>> >> >> >> Bundle-ManifestVersion: 2
> >>>>> >> >> >> Bundle-Description: iPOJO Annotations
> >>>>> >> >> >> Bundle-License:
> http://www.apache.org/licenses/LICENSE-2.0.txt
> >>>>> >> >> >> Bundle-DocURL:
> >>>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >>>>> >> >> >> ns.html
> >>>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
> >>>>> >> >>org.apache.felix.ipo
> >>>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
> >>>>> >> >>org.apache.f
> >>>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
> >>>>> >> >>org.apache.felix.ipojo.extende
> >>>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
> >>>>> >> >>org.apache.felix.ipojo;version=
> >>>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
> >>>>> >> >>org.apache.felix.ipojo.
> >>>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
> >>>>> >> >>org.apache.felix.ipojo
> >>>>> >> >> >> .annotations, cook.michael
> >>>>> >> >> >> Bundle-SymbolicName: iPojoTest
> >>>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <
> gokturk.gezer@gmail.com>
> >>>>> >> wrote:
> >>>>> >> >> >>
> >>>>> >> >> >> >Hi,
> >>>>> >> >> >> >
> >>>>> >> >> >> >First of all @Component is mandatory.(For annotation based
> >>>>> >>usage).
> >>>>> >> >> >> >
> >>>>> >> >> >> >But this only defines your component. To actually
> instantiate
> >>>>>it
> >>>>> >>you
> >>>>> >> >> >> >should
> >>>>> >> >> >> >do it deliberately. One way to do that is using
> @Instantiate
> >>>>> >> >> >>annotation.
> >>>>> >> >> >> >
> >>>>> >> >> >> >So your code would be like:
> >>>>> >> >> >> >
> >>>>> >> >> >> >@Component
> >>>>> >> >> >> >@Instantiate
> >>>>> >> >> >> >public class foo{
> >>>>> >> >> >> >
> >>>>> >> >> >> > @Validate
> >>>>> >> >> >> > public void start()
> >>>>> >> >> >> >..........
> >>>>> >> >> >> >..........
> >>>>> >> >> >> >}
> >>>>> >> >> >> >
> >>>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
> >>>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >>>>> >> >> >> >
> >>>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
> >>>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
> >>>>>the
> >>>>> >> >> >> >>@Component.
> >>>>> >> >> >> >> Same result. No output.
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> Mike
> >>>>> >> >> >> >> Michael Cook
> >>>>> >> >> >> >> VP Technology Innovation
> >>>>> >> >> >> >> Comcast
> >>>>> >> >> >> >> One Comcast Center
> >>>>> >> >> >> >> Philadelphia, PA 19103
> >>>>> >> >> >> >> (o) 215-286-8260
> >>>>> >> >> >> >> (m) 609-458-0332
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> ----- Original Message -----
> >>>>> >> >> >> >> From: Cook, Michael J. (OCTO)
> >>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
> >>>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
> >>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> I used @validate/@invalidate alone.
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> Mike
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> Michael Cook
> >>>>> >> >> >> >> VP Technology Innovation
> >>>>> >> >> >> >> Comcast
> >>>>> >> >> >> >> One Comcast Center
> >>>>> >> >> >> >> Philadelphia, PA 19103
> >>>>> >> >> >> >> (o) 215-286-8260
> >>>>> >> >> >> >> (m) 609-458-0332
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> ----- Original Message -----
> >>>>> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> >>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
> >>>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
> >>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> Hi,
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> I need to ask this first since it's not on your code
> >>>>>snippet:
> >>>>> >>Did
> >>>>> >> >>you
> >>>>> >> >> >> >>use
> >>>>> >> >> >> >> @Component annotation for class where you've declared
> your
> >>>>> >>start()
> >>>>> >> >> >> >>stop()
> >>>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
> >>>>> >> >> >> >>
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> *Regards,*
> >>>>> >> >> >> >> *Gokturk*
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO)
> <
> >>>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
> >>>>> >> >> >> >>
> >>>>> >> >> >> >> > Hi,
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I can't seem to find a good article that will help me
> >>>>>resolve
> >>>>> >> >>the
> >>>>> >> >> >> >> "getting
> >>>>> >> >> >> >> > started" issue I am facing.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse
> plugin,
> >>>>> >>from:
> >>>>> >> >> >> >> > http://clement.plop-plop.net/update/
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I have created a sample project following the
> >>>>>instructions
> >>>>> >>at:
> >>>>> >> >> >> >> >
> http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
> >>>>>following
> >>>>> >> >> >> >>instructions
> >>>>> >> >> >> >> > here:
> >>>>> >> >> >>
> >>>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
> >>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
> >>>>>installed
> >>>>> >> >>the
> >>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I've created a test bundle using iPOJO called
> >>>>>iPojoTest.jar
> >>>>> >>and
> >>>>> >> >> >>I've
> >>>>> >> >> >> >> > installed it and started it in the OSGI console.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I run bundles in the console and I get:
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > g! bundles
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
> >>>>>(3.0.7)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 1|Active |
> 1|org.apache.felix.bundlerepository
> >>>>> >> >>(1.6.2)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
> >>>>>(0.6.1)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
> >>>>>(0.6.1)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
> >>>>>(0.6.1)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > So, the bundle seems to have started.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > But I don't get any console output from my sysoutsŠ
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > Here are the start() and stop() methods:
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > @Validate
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > public void start() throws IOException {
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > System.out.println("I'm starting...");
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > try{
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > // Create file
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > FileWriter fstream = new
> >>>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > BufferedWriter out = new
> >>>>> >> >>BufferedWriter(fstream);
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > out.write("Hello Java");
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > //Close the output stream
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > out.close();
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > }catch (Exception e){//Catch
> exception
> >>>>>if
> >>>>> >>any
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > System.err.println("Error: " +
> >>>>> >> >>e.getMessage());
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > }
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > throw new IOException() ;
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > }
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > @Invalidate
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > public void stop() {
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > System.out.println("I'm leaving !");
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > }
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > I added in the file write to see if a file would be
> >>>>>created.
> >>>>> >> >>There
> >>>>> >> >> >> >>is no
> >>>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
> >>>>>ACTIVE,
> >>>>> >>the
> >>>>> >> >> >>start
> >>>>> >> >> >> >> method
> >>>>> >> >> >> >> > appears never have to been called.
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > Can anyone tell me what I may have done wrong or
> provide
> >>>>>a
> >>>>> >>clue
> >>>>> >> >>as
> >>>>> >> >> >>to
> >>>>> >> >> >> >> what
> >>>>> >> >> >> >> > to look at to help diagnose the problem?
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > Thanks,
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> > Mike
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >> >
> >>>>> >> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>>
> >>---------------------------------------------------------------------
> >>>>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>>> >> >> >> For additional commands, e-mail:
> users-help@felix.apache.org
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >> >>
> >>>>>---------------------------------------------------------------------
> >>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>>---------------------------------------------------------------------
> >>>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>>> >> For additional commands, e-mail: users-help@felix.apache.org
> >>>>> >>
> >>>>> >>
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>>> For additional commands, e-mail: users-help@felix.apache.org
> >>>>>
> >>>>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Getting Started with iPOJO
Posted by Simon Chemouil <sc...@gmail.com>.
Michael,
Concerning iPojo itself, I think you won't find much tutorials outside
of iPojo's website. That website could definitely be improved and some
pages are outdated. I know iPojo is used in various companies, but
iPojo users are rather quiet compared to Guice or Spring/Blueprint
users who blog a lot more.
I suggest you take at look at the examples available at
https://svn.apache.org/repos/asf/felix/trunk/ipojo/examples/tutorial-maven
The samples are depending on iPojo 1.5.0-SNAPSHOT so be sure to update
the versions (in pom.xml files).
We switched to iPojo some time ago (from DS), and it was painless as
were already using Maven to build our projects. We simply had to
switch annotations and add the proper Maven configuration -- and then
benefit from all the other exciting features of iPojo.
There is a release coming soon that will fix a few bugs so in the mean
time we are following the trunk version. I suggest you take a look at
iPojo's JIRA if you encounter a bug during the build in the
maven-ipojo-plugin: if the bugs are marked as fix you will either have
to build your own local copy of iPojo (1.9.0-SNAPSHOT) or wait for a
release.
HTH,
Simon
On Fri, Oct 12, 2012 at 4:29 PM, Cook, Michael J. (OCTO)
<Mi...@cable.comcast.com> wrote:
> Simon,
>
> Excellent. I will look online for tutorials explaining your suggested paths forward. If you know of any good ones, please let me know.
>
> Mike
> Michael Cook
> VP Technology Innovation
> Comcast
> One Comcast Center
> Philadelphia, PA 19103
> (o) 215-286-8260
> (m) 609-458-0332
>
> ----- Original Message -----
> From: Simon Chemouil [mailto:schemouil@gmail.com]
> Sent: Friday, October 12, 2012 08:34 AM
> To: users@felix.apache.org <us...@felix.apache.org>
> Subject: Re: Getting Started with iPOJO
>
> Michael,
>
> It seems like you are using an antique version of iPojo. The import
> you show in your manifest is 0.9.0 and the last release is 1.8.2 (that
> import is added by the manipulator).
>
> In an earlier message you said you were using the Eclipse plugin
> available on Clement's website. This plugin is not maintained anymore
> and while there is a new iPojo Eclipse plugin maintained elsewhere, I
> wouldn't advise using it. Rather, you should use the manipulator from
> ant or maven depending on how you build your project. If you choose
> the maven-ipojo-plugin, you can get decent Eclipse integration using
> Maven's Eclipse environment (M2E).
>
> HTH,
>
> Simon
>
> On Fri, Oct 12, 2012 at 2:17 PM, Cook, Michael J. (OCTO)
> <Mi...@cable.comcast.com> wrote:
>> Sorry... I forgot to add back in the annotations in my Impl class. I just
>> did and repackaged. Please disregard the previous manifest.
>>
>>
>>
>> Manifest-Version: 1.0
>> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> l
>> iPOJO-Components: component { $classname="cook.michael.BogusClass" man
>> ipulation { method { $name="$init" }}}component { $name="cook.michael
>> .MyComponentImpl" $classname="cook.michael.MyComponentImpl" $public="
>> true" org.apache.felix.ipojo.annotations:instantiate { }callback { $t
>> ransition="invalidate" $method="stop" }callback { $transition="valida
>> te" $method="start" }manipulation { method { $name="$init" }method {
>> $name="start" }method { $name="stop" }}}
>> Built-By: clement
>> Tool: Bnd-0.0.249
>> Bundle-Name: Apache Felix iPOJO Annotations
>> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> Bundle-Vendor: The Apache Software Foundation
>> Bundle-Version: 1.8.2
>> Build-Jdk: 1.6.0_31
>> Bnd-LastModified: 1350044136955
>> Bundle-ManifestVersion: 2
>> Bundle-Description: iPOJO Annotations
>> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> ns.html
>> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
>> .annotations, cook.michael
>> Bundle-SymbolicName: iPojoTest
>> Originally-Created-By: Apache Maven Bundle Plugin
>>
>>
>>
>>
>>
>>
>> On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
>> <Mi...@cable.comcast.com> wrote:
>>
>>>OK,
>>>
>>>Here it is inline (and attached).
>>>
>>>Manifest-Version: 1.0
>>>Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
>>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>>> l
>>>iPOJO-Components: component { $classname="cook.michael.BogusClass" man
>>> ipulation { method { $name="$init" }}}
>>>Built-By: clement
>>>Tool: Bnd-0.0.249
>>>Bundle-Name: Apache Felix iPOJO Annotations
>>>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>>Bundle-Vendor: The Apache Software Foundation
>>>Bundle-Version: 1.8.2
>>>Build-Jdk: 1.6.0_31
>>>Bnd-LastModified: 1350043925031
>>>Bundle-ManifestVersion: 2
>>>Bundle-Description: iPOJO Annotations
>>>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>>Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
>>> ns.html
>>>Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
>>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
>>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
>>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
>>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
>>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
>>> .annotations, cook.michael
>>>Bundle-SymbolicName: iPojoTest
>>>Originally-Created-By: Apache Maven Bundle Plugin
>>>
>>>
>>>
>>>Mike
>>>
>>>On 10/11/12 10:40 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>>
>>>>I wanted MANIFEST.MF file actually :/
>>>>
>>>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>>>>Michael_J_Cook@cable.comcast.com> wrote:
>>>>
>>>>> Hmmm...
>>>>>
>>>>> Here's my metadata.xml...
>>>>>
>>>>> I get the following error:
>>>>>
>>>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
>>>>> org.apache.felix.ipojo.ComponentFactory
>>>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
>>>>>class
>>>>> name : component immediate="true"
>>>>> at
>>>>>
>>>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
>>>>> at
>>>>>
>>>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121
>>>>>)
>>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>>Method)
>>>>> at
>>>>>
>>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
>>>>>c
>>>>>ce
>>>>> ssorImpl.java:39)
>>>>> at
>>>>>
>>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
>>>>>t
>>>>>ru
>>>>> ctorAccessorImpl.java:27)
>>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>>> at
>>>>>
>>>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
>>>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>>>>> at
>>>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>>>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>>>>> at
>>>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>>>>> at java.lang.Thread.run(Thread.java:680)
>>>>>
>>>>>
>>>>> Here's what I had for the Bogus Class case on the metadata.xml:
>>>>>
>>>>> <ipojo>
>>>>> <component className="cook.michael.BogusClass"/>
>>>>> </ipojo>
>>>>>
>>>>>
>>>>>
>>>>> Mike
>>>>>
>>>>>
>>>>>
>>>>> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>>>>
>>>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>>>>> >
>>>>> >First finding : you don't need a bogus component. You can just type
>>>>> ><ipojo>
>>>>> ><component/>
>>>>> ></ipojo>
>>>>> >
>>>>> >inside you metadata.xml and it'll pass silently.
>>>>> >
>>>>> >Besides you might be hitting a bug we've fixed in trunk, because in
>>>>>the
>>>>> >same scenario I suggested to you I saw some elements in MANIFEST which
>>>>> >shouldn't be there.
>>>>> >Could you share me your MANIFEST for the final state(bogus
>>>>>metadata.xml +
>>>>> >annotations)?
>>>>> >
>>>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>>>>> >Michael_J_Cook@cable.comcast.com> wrote:
>>>>> >
>>>>> >> Hi,
>>>>> >>
>>>>> >> >>Could you tell me what happens when you remove the <ipojo/>
>>>>>element
>>>>> >>too
>>>>> >> >>leaving the metadata.xml empty?
>>>>> >>
>>>>> >>
>>>>> >> I get an error when there is no contents in the metadata.xml file.
>>>>> >>
>>>>> >> >>I could suggest you a trick to define a bogus
>>>>> >> >>component inside metadata.xml(Will require you to maintain a bogus
>>>>> >>class)
>>>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and
>>>>>move
>>>>> >>along
>>>>> >> >>its way with annotations.
>>>>> >>
>>>>> >>
>>>>> >> I added a bogus class into the cook.michael package and put the
>>>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
>>>>>Then
>>>>> >> added this component to the metadata.xml file:
>>>>> >> <ipojo>
>>>>> >> <component className="cook.michael.BogusClass"/>
>>>>> >> </ipojo>
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> The above results in the start and stop not being invoked.
>>>>> >>
>>>>> >> >>Instead of embedding Felix into eclipse you can use its own
>>>>>Equinox
>>>>> >> >>launcher.
>>>>> >>
>>>>> >> I'm developing atop Felix, because the target device is Felix based,
>>>>>so
>>>>> >>I
>>>>> >> would like to keep it on the same platform.
>>>>> >>
>>>>> >>
>>>>> >> Thank you for your help.
>>>>> >> Mike
>>>>> >>
>>>>> >>
>>>>> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com>
>>>>>wrote:
>>>>> >>
>>>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>>>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>>> >> >
>>>>> >> >> Göktürk,
>>>>> >> >>
>>>>> >> >> Thank you! I used #2 below and it worked well. I was able to
>>>>>launch
>>>>> >>the
>>>>> >> >> bundle, and I saw it output the traces I had been looking for.
>>>>> >> >>
>>>>> >> >
>>>>> >> >Cool !
>>>>> >> >
>>>>> >> >
>>>>> >> >>
>>>>> >> >> On the first, if I remove the contents of the metadata.xml file,
>>>>>how
>>>>> >> >>can I
>>>>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>>>>> >>element,
>>>>> >> >>and
>>>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
>>>>>component
>>>>> >> >>types,
>>>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>>>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>>>>>although
>>>>> >>the
>>>>> >> >> class is marked with @Component and @Instantiate and start/stop
>>>>>is
>>>>> >> >>marked
>>>>> >> >> with @Validate/@Invalidate.
>>>>> >> >>
>>>>> >> >
>>>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
>>>>>seems
>>>>> >>to be
>>>>> >> >dependent on metadata.xml but also sees the annotations on its way.
>>>>> >> >
>>>>> >> >Could you tell me what happens when you remove the <ipojo/> element
>>>>>too
>>>>> >> >leaving the metadata.xml empty?
>>>>> >>
>>>>> >> >
>>>>> >> >If above trick didn't work and you want to stick with
>>>>> >>eclipse-ipojo-plugin
>>>>> >> >while using annotations. I could suggest you a trick to define a
>>>>>bogus
>>>>> >> >component inside metadata.xml(Will require you to maintain a bogus
>>>>> >>class)
>>>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>>>> >>along
>>>>> >> >its way with annotations.
>>>>> >> >
>>>>> >> >Also it seems to me that your development environment is heavy.
>>>>> >>Instead of
>>>>> >> >embedding Felix into eclipse you can use its own Equinox launcher.
>>>>> >> >I suggest you to have a look at
>>>>> >>
>>>>> >>>
>>>>>
>>>>>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>>>>> >> >where
>>>>> >> >you can see basic setup.(You can use annotations or metadata of
>>>>>your
>>>>> >> >choice
>>>>> >> >in this setup)
>>>>> >> >
>>>>> >> >
>>>>> >> >Gokturk
>>>>> >> >
>>>>> >> >
>>>>> >> >>
>>>>> >> >> Mike
>>>>> >> >>
>>>>> >> >>
>>>>> >> >>
>>>>> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>>> wrote:
>>>>> >> >>
>>>>> >> >> >Well i thought at first that you didn't specify metadata.xml but
>>>>>i
>>>>> >>see
>>>>> >> >>now
>>>>> >> >> >that you did. Mixing metadata.xml and annotations for one single
>>>>> >> >>component
>>>>> >> >> >is a mistake. For same component you must go with one of them.
>>>>> >> >> >
>>>>> >> >> >So there are 2 different ways for you:
>>>>> >> >> >
>>>>> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
>>>>> >> >>delete it
>>>>> >> >> >or comment out the content ) and leave the annotations as it is.
>>>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
>>>>> >>remove
>>>>> >> >>all
>>>>> >> >> >annotations including @validate and @invalidate and make sure
>>>>>your
>>>>> >> >> >metadata.xml looks like this:
>>>>> >> >> >
>>>>> >> >> ><ipojo>
>>>>> >> >> ><component className="cook.michael.MyComponentImpl">
>>>>> >> >> > <callback transition="validate" method="start"/>
>>>>> >> >> > <callback transition="invalidate" method="stop"/>
>>>>> >> >> ></component>
>>>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>>>>> >> >> ></ipojo>
>>>>> >> >> >
>>>>> >> >> >Either way should bring you where you want. Just don't mix
>>>>> >>annotation
>>>>> >> >>and
>>>>> >> >> >metadata usage for same component.
>>>>> >> >> >
>>>>> >> >> >Regards,
>>>>> >> >> >Gokturk
>>>>> >> >> >
>>>>> >> >> >
>>>>> >> >> >
>>>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>>>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>>> >> >> >
>>>>> >> >> >> Hi Göktürk,
>>>>> >> >> >>
>>>>> >> >> >> OK... Tried that. Still the same thing. There's not much to
>>>>>my
>>>>> >> >>code,
>>>>> >> >> >>so
>>>>> >> >> >> I'm including it below. Please let me know if you see
>>>>>anything.
>>>>> >> >> >>
>>>>> >> >> >> Thank you for helping me,
>>>>> >> >> >> Mike
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >> MyComponentImpl.java:
>>>>> >> >> >>
>>>>> >> >> >> package cook.michael;
>>>>> >> >> >>
>>>>> >> >> >> import java.io.BufferedWriter;
>>>>> >> >> >> import java.io.File;
>>>>> >> >> >> import java.io.FileWriter;
>>>>> >> >> >> import java.io.IOException;
>>>>> >> >> >>
>>>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>>>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>>>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>>>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>>>>> >> >> >>
>>>>> >> >> >> @Component
>>>>> >> >> >> @Instantiate
>>>>> >> >> >> public class MyComponentImpl {
>>>>> >> >> >>
>>>>> >> >> >> @Validate
>>>>> >> >> >> public void start() throws IOException {
>>>>> >> >> >> System.err.println("Starting: " );
>>>>> >> >> >>
>>>>> >> >> >> System.out.println("I'm starting...");
>>>>> >> >> >> try{
>>>>> >> >> >> // Create file
>>>>> >> >> >> FileWriter fstream = new
>>>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>>>>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
>>>>> >> >> >> out.write("Hello Java");
>>>>> >> >> >> //Close the output stream
>>>>> >> >> >> out.close();
>>>>> >> >> >> }catch (Exception e){//Catch exception if any
>>>>> >> >> >> System.err.println("Error: " + e.getMessage());
>>>>> >> >> >> }
>>>>> >> >> >> throw new IOException() ;
>>>>> >> >> >> }
>>>>> >> >> >>
>>>>> >> >> >> @Invalidate
>>>>> >> >> >> public void stop() {
>>>>> >> >> >> System.out.println("I'm leaving !");
>>>>> >> >> >> }
>>>>> >> >> >> }
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >> metadata.xml:
>>>>> >> >> >>
>>>>> >> >> >> <ipojo>
>>>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>>>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>>>>> >> >> >> </ipojo>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >> iPojoTest.bnd:
>>>>> >> >> >>
>>>>> >> >> >> Import-Package: *
>>>>> >> >> >> Export-Package: *
>>>>> >> >> >> #Private-Package:
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >> Generated manefest.mf:
>>>>> >> >> >>
>>>>> >> >> >> Manifest-Version: 1.0
>>>>> >> >> >> Export-Package:
>>>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>>>>> >> >> >>
>>>>> >>
>>>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>>>>> >> >> >>
>>>>> >>
>>>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>>>>> >> >> >>
>>>>> >>
>>>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>>>>> >> >> >> l
>>>>> >> >> >> iPOJO-Components: component {
>>>>> >> >>$classname="cook.michael.MyComponentImpl
>>>>> >> >> >> " manipulation { method { $name="$init" }method {
>>>>>$name="start"
>>>>> >> >>}meth
>>>>> >> >> >> od { $name="stop" }}}instance {
>>>>> >> >>$component="cook.michael.MyComponentI
>>>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>>>>> >> >>$classname="co
>>>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>>>>> >> >>org.apache.felix.ipojo.ann
>>>>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
>>>>> >> >>$method="
>>>>> >> >> >> stop" }callback { $transition="validate" $method="start"
>>>>> >> >>}manipulatio
>>>>> >> >> >> n { method { $name="$init" }method { $name="start" }method {
>>>>> >> >>$name="s
>>>>> >> >> >> top" }}}
>>>>> >> >> >> Built-By: clement
>>>>> >> >> >> Tool: Bnd-0.0.249
>>>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>>>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>>>>> >> >> >> Bundle-Version: 1.8.2
>>>>> >> >> >> Build-Jdk: 1.6.0_31
>>>>> >> >> >> Bnd-LastModified: 1350001458935
>>>>> >> >> >> Bundle-ManifestVersion: 2
>>>>> >> >> >> Bundle-Description: iPOJO Annotations
>>>>> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>>>> >> >> >> Bundle-DocURL:
>>>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>>>>> >> >> >> ns.html
>>>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>>>>> >> >>org.apache.felix.ipo
>>>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>>>> >> >>org.apache.f
>>>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>>>>> >> >>org.apache.felix.ipojo.extende
>>>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>>>>> >> >>org.apache.felix.ipojo;version=
>>>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>>>> >> >>org.apache.felix.ipojo.
>>>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>>>> >> >>org.apache.felix.ipojo
>>>>> >> >> >> .annotations, cook.michael
>>>>> >> >> >> Bundle-SymbolicName: iPojoTest
>>>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>>> >> wrote:
>>>>> >> >> >>
>>>>> >> >> >> >Hi,
>>>>> >> >> >> >
>>>>> >> >> >> >First of all @Component is mandatory.(For annotation based
>>>>> >>usage).
>>>>> >> >> >> >
>>>>> >> >> >> >But this only defines your component. To actually instantiate
>>>>>it
>>>>> >>you
>>>>> >> >> >> >should
>>>>> >> >> >> >do it deliberately. One way to do that is using @Instantiate
>>>>> >> >> >>annotation.
>>>>> >> >> >> >
>>>>> >> >> >> >So your code would be like:
>>>>> >> >> >> >
>>>>> >> >> >> >@Component
>>>>> >> >> >> >@Instantiate
>>>>> >> >> >> >public class foo{
>>>>> >> >> >> >
>>>>> >> >> >> > @Validate
>>>>> >> >> >> > public void start()
>>>>> >> >> >> >..........
>>>>> >> >> >> >..........
>>>>> >> >> >> >}
>>>>> >> >> >> >
>>>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>>>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>>> >> >> >> >
>>>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>>>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
>>>>>the
>>>>> >> >> >> >>@Component.
>>>>> >> >> >> >> Same result. No output.
>>>>> >> >> >> >>
>>>>> >> >> >> >> Mike
>>>>> >> >> >> >> Michael Cook
>>>>> >> >> >> >> VP Technology Innovation
>>>>> >> >> >> >> Comcast
>>>>> >> >> >> >> One Comcast Center
>>>>> >> >> >> >> Philadelphia, PA 19103
>>>>> >> >> >> >> (o) 215-286-8260
>>>>> >> >> >> >> (m) 609-458-0332
>>>>> >> >> >> >>
>>>>> >> >> >> >> ----- Original Message -----
>>>>> >> >> >> >> From: Cook, Michael J. (OCTO)
>>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>>>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>>> >> >> >> >>
>>>>> >> >> >> >> I used @validate/@invalidate alone.
>>>>> >> >> >> >>
>>>>> >> >> >> >> Mike
>>>>> >> >> >> >>
>>>>> >> >> >> >> Michael Cook
>>>>> >> >> >> >> VP Technology Innovation
>>>>> >> >> >> >> Comcast
>>>>> >> >> >> >> One Comcast Center
>>>>> >> >> >> >> Philadelphia, PA 19103
>>>>> >> >> >> >> (o) 215-286-8260
>>>>> >> >> >> >> (m) 609-458-0332
>>>>> >> >> >> >>
>>>>> >> >> >> >> ----- Original Message -----
>>>>> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>>>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>>> >> >> >> >>
>>>>> >> >> >> >> Hi,
>>>>> >> >> >> >>
>>>>> >> >> >> >> I need to ask this first since it's not on your code
>>>>>snippet:
>>>>> >>Did
>>>>> >> >>you
>>>>> >> >> >> >>use
>>>>> >> >> >> >> @Component annotation for class where you've declared your
>>>>> >>start()
>>>>> >> >> >> >>stop()
>>>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>>>>> >> >> >> >>
>>>>> >> >> >> >>
>>>>> >> >> >> >> *Regards,*
>>>>> >> >> >> >> *Gokturk*
>>>>> >> >> >> >>
>>>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>>>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>>>>> >> >> >> >>
>>>>> >> >> >> >> > Hi,
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I can't seem to find a good article that will help me
>>>>>resolve
>>>>> >> >>the
>>>>> >> >> >> >> "getting
>>>>> >> >> >> >> > started" issue I am facing.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>>>>> >>from:
>>>>> >> >> >> >> > http://clement.plop-plop.net/update/
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I have created a sample project following the
>>>>>instructions
>>>>> >>at:
>>>>> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>>>>>following
>>>>> >> >> >> >>instructions
>>>>> >> >> >> >> > here:
>>>>> >> >> >>
>>>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>>>>>installed
>>>>> >> >>the
>>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I've created a test bundle using iPOJO called
>>>>>iPojoTest.jar
>>>>> >>and
>>>>> >> >> >>I've
>>>>> >> >> >> >> > installed it and started it in the OSGI console.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I run bundles in the console and I get:
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > g! bundles
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
>>>>>(3.0.7)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>>>>> >> >>(1.6.2)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
>>>>>(0.6.1)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
>>>>>(0.6.1)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>>>>>(0.6.1)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > So, the bundle seems to have started.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > But I don't get any console output from my sysoutsŠ
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > Here are the start() and stop() methods:
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > @Validate
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > public void start() throws IOException {
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > System.out.println("I'm starting...");
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > try{
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > // Create file
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > FileWriter fstream = new
>>>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > BufferedWriter out = new
>>>>> >> >>BufferedWriter(fstream);
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > out.write("Hello Java");
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > //Close the output stream
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > out.close();
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > }catch (Exception e){//Catch exception
>>>>>if
>>>>> >>any
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > System.err.println("Error: " +
>>>>> >> >>e.getMessage());
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > }
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > throw new IOException() ;
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > }
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > @Invalidate
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > public void stop() {
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > System.out.println("I'm leaving !");
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > }
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > I added in the file write to see if a file would be
>>>>>created.
>>>>> >> >>There
>>>>> >> >> >> >>is no
>>>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
>>>>>ACTIVE,
>>>>> >>the
>>>>> >> >> >>start
>>>>> >> >> >> >> method
>>>>> >> >> >> >> > appears never have to been called.
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > Can anyone tell me what I may have done wrong or provide
>>>>>a
>>>>> >>clue
>>>>> >> >>as
>>>>> >> >> >>to
>>>>> >> >> >> >> what
>>>>> >> >> >> >> > to look at to help diagnose the problem?
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > Thanks,
>>>>> >> >> >> >> >
>>>>> >> >> >> >> > Mike
>>>>> >> >> >> >> >
>>>>> >> >> >> >> >
>>>>> >> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >>---------------------------------------------------------------------
>>>>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>>> >> >> >>
>>>>> >> >> >>
>>>>> >> >>
>>>>> >> >>
>>>>> >> >>
>>>>>---------------------------------------------------------------------
>>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>>> >> >>
>>>>> >> >>
>>>>> >>
>>>>> >>
>>>>> >>
>>>>>---------------------------------------------------------------------
>>>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> >> For additional commands, e-mail: users-help@felix.apache.org
>>>>> >>
>>>>> >>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Simon,
Excellent. I will look online for tutorials explaining your suggested paths forward. If you know of any good ones, please let me know.
Mike
Michael Cook
VP Technology Innovation
Comcast
One Comcast Center
Philadelphia, PA 19103
(o) 215-286-8260
(m) 609-458-0332
----- Original Message -----
From: Simon Chemouil [mailto:schemouil@gmail.com]
Sent: Friday, October 12, 2012 08:34 AM
To: users@felix.apache.org <us...@felix.apache.org>
Subject: Re: Getting Started with iPOJO
Michael,
It seems like you are using an antique version of iPojo. The import
you show in your manifest is 0.9.0 and the last release is 1.8.2 (that
import is added by the manipulator).
In an earlier message you said you were using the Eclipse plugin
available on Clement's website. This plugin is not maintained anymore
and while there is a new iPojo Eclipse plugin maintained elsewhere, I
wouldn't advise using it. Rather, you should use the manipulator from
ant or maven depending on how you build your project. If you choose
the maven-ipojo-plugin, you can get decent Eclipse integration using
Maven's Eclipse environment (M2E).
HTH,
Simon
On Fri, Oct 12, 2012 at 2:17 PM, Cook, Michael J. (OCTO)
<Mi...@cable.comcast.com> wrote:
> Sorry... I forgot to add back in the annotations in my Impl class. I just
> did and repackaged. Please disregard the previous manifest.
>
>
>
> Manifest-Version: 1.0
> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> l
> iPOJO-Components: component { $classname="cook.michael.BogusClass" man
> ipulation { method { $name="$init" }}}component { $name="cook.michael
> .MyComponentImpl" $classname="cook.michael.MyComponentImpl" $public="
> true" org.apache.felix.ipojo.annotations:instantiate { }callback { $t
> ransition="invalidate" $method="stop" }callback { $transition="valida
> te" $method="start" }manipulation { method { $name="$init" }method {
> $name="start" }method { $name="stop" }}}
> Built-By: clement
> Tool: Bnd-0.0.249
> Bundle-Name: Apache Felix iPOJO Annotations
> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> Bundle-Vendor: The Apache Software Foundation
> Bundle-Version: 1.8.2
> Build-Jdk: 1.6.0_31
> Bnd-LastModified: 1350044136955
> Bundle-ManifestVersion: 2
> Bundle-Description: iPOJO Annotations
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> ns.html
> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> .annotations, cook.michael
> Bundle-SymbolicName: iPojoTest
> Originally-Created-By: Apache Maven Bundle Plugin
>
>
>
>
>
>
> On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
> <Mi...@cable.comcast.com> wrote:
>
>>OK,
>>
>>Here it is inline (and attached).
>>
>>Manifest-Version: 1.0
>>Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> l
>>iPOJO-Components: component { $classname="cook.michael.BogusClass" man
>> ipulation { method { $name="$init" }}}
>>Built-By: clement
>>Tool: Bnd-0.0.249
>>Bundle-Name: Apache Felix iPOJO Annotations
>>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>Bundle-Vendor: The Apache Software Foundation
>>Bundle-Version: 1.8.2
>>Build-Jdk: 1.6.0_31
>>Bnd-LastModified: 1350043925031
>>Bundle-ManifestVersion: 2
>>Bundle-Description: iPOJO Annotations
>>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> ns.html
>>Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
>> .annotations, cook.michael
>>Bundle-SymbolicName: iPojoTest
>>Originally-Created-By: Apache Maven Bundle Plugin
>>
>>
>>
>>Mike
>>
>>On 10/11/12 10:40 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>
>>>I wanted MANIFEST.MF file actually :/
>>>
>>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>>>Michael_J_Cook@cable.comcast.com> wrote:
>>>
>>>> Hmmm...
>>>>
>>>> Here's my metadata.xml...
>>>>
>>>> I get the following error:
>>>>
>>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
>>>> org.apache.felix.ipojo.ComponentFactory
>>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
>>>>class
>>>> name : component immediate="true"
>>>> at
>>>>
>>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
>>>> at
>>>>
>>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121
>>>>)
>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>Method)
>>>> at
>>>>
>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
>>>>c
>>>>ce
>>>> ssorImpl.java:39)
>>>> at
>>>>
>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
>>>>t
>>>>ru
>>>> ctorAccessorImpl.java:27)
>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>> at
>>>>
>>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
>>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>>>> at
>>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>>>> at
>>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>>>> at java.lang.Thread.run(Thread.java:680)
>>>>
>>>>
>>>> Here's what I had for the Bogus Class case on the metadata.xml:
>>>>
>>>> <ipojo>
>>>> <component className="cook.michael.BogusClass"/>
>>>> </ipojo>
>>>>
>>>>
>>>>
>>>> Mike
>>>>
>>>>
>>>>
>>>> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>>>
>>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>>>> >
>>>> >First finding : you don't need a bogus component. You can just type
>>>> ><ipojo>
>>>> ><component/>
>>>> ></ipojo>
>>>> >
>>>> >inside you metadata.xml and it'll pass silently.
>>>> >
>>>> >Besides you might be hitting a bug we've fixed in trunk, because in
>>>>the
>>>> >same scenario I suggested to you I saw some elements in MANIFEST which
>>>> >shouldn't be there.
>>>> >Could you share me your MANIFEST for the final state(bogus
>>>>metadata.xml +
>>>> >annotations)?
>>>> >
>>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>>>> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >
>>>> >> Hi,
>>>> >>
>>>> >> >>Could you tell me what happens when you remove the <ipojo/>
>>>>element
>>>> >>too
>>>> >> >>leaving the metadata.xml empty?
>>>> >>
>>>> >>
>>>> >> I get an error when there is no contents in the metadata.xml file.
>>>> >>
>>>> >> >>I could suggest you a trick to define a bogus
>>>> >> >>component inside metadata.xml(Will require you to maintain a bogus
>>>> >>class)
>>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and
>>>>move
>>>> >>along
>>>> >> >>its way with annotations.
>>>> >>
>>>> >>
>>>> >> I added a bogus class into the cook.michael package and put the
>>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
>>>>Then
>>>> >> added this component to the metadata.xml file:
>>>> >> <ipojo>
>>>> >> <component className="cook.michael.BogusClass"/>
>>>> >> </ipojo>
>>>> >>
>>>> >>
>>>> >>
>>>> >> The above results in the start and stop not being invoked.
>>>> >>
>>>> >> >>Instead of embedding Felix into eclipse you can use its own
>>>>Equinox
>>>> >> >>launcher.
>>>> >>
>>>> >> I'm developing atop Felix, because the target device is Felix based,
>>>>so
>>>> >>I
>>>> >> would like to keep it on the same platform.
>>>> >>
>>>> >>
>>>> >> Thank you for your help.
>>>> >> Mike
>>>> >>
>>>> >>
>>>> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com>
>>>>wrote:
>>>> >>
>>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >
>>>> >> >> Göktürk,
>>>> >> >>
>>>> >> >> Thank you! I used #2 below and it worked well. I was able to
>>>>launch
>>>> >>the
>>>> >> >> bundle, and I saw it output the traces I had been looking for.
>>>> >> >>
>>>> >> >
>>>> >> >Cool !
>>>> >> >
>>>> >> >
>>>> >> >>
>>>> >> >> On the first, if I remove the contents of the metadata.xml file,
>>>>how
>>>> >> >>can I
>>>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>>>> >>element,
>>>> >> >>and
>>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
>>>>component
>>>> >> >>types,
>>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>>>>although
>>>> >>the
>>>> >> >> class is marked with @Component and @Instantiate and start/stop
>>>>is
>>>> >> >>marked
>>>> >> >> with @Validate/@Invalidate.
>>>> >> >>
>>>> >> >
>>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
>>>>seems
>>>> >>to be
>>>> >> >dependent on metadata.xml but also sees the annotations on its way.
>>>> >> >
>>>> >> >Could you tell me what happens when you remove the <ipojo/> element
>>>>too
>>>> >> >leaving the metadata.xml empty?
>>>> >>
>>>> >> >
>>>> >> >If above trick didn't work and you want to stick with
>>>> >>eclipse-ipojo-plugin
>>>> >> >while using annotations. I could suggest you a trick to define a
>>>>bogus
>>>> >> >component inside metadata.xml(Will require you to maintain a bogus
>>>> >>class)
>>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>>> >>along
>>>> >> >its way with annotations.
>>>> >> >
>>>> >> >Also it seems to me that your development environment is heavy.
>>>> >>Instead of
>>>> >> >embedding Felix into eclipse you can use its own Equinox launcher.
>>>> >> >I suggest you to have a look at
>>>> >>
>>>> >>>
>>>>
>>>>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>>>> >> >where
>>>> >> >you can see basic setup.(You can use annotations or metadata of
>>>>your
>>>> >> >choice
>>>> >> >in this setup)
>>>> >> >
>>>> >> >
>>>> >> >Gokturk
>>>> >> >
>>>> >> >
>>>> >> >>
>>>> >> >> Mike
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>> wrote:
>>>> >> >>
>>>> >> >> >Well i thought at first that you didn't specify metadata.xml but
>>>>i
>>>> >>see
>>>> >> >>now
>>>> >> >> >that you did. Mixing metadata.xml and annotations for one single
>>>> >> >>component
>>>> >> >> >is a mistake. For same component you must go with one of them.
>>>> >> >> >
>>>> >> >> >So there are 2 different ways for you:
>>>> >> >> >
>>>> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
>>>> >> >>delete it
>>>> >> >> >or comment out the content ) and leave the annotations as it is.
>>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
>>>> >>remove
>>>> >> >>all
>>>> >> >> >annotations including @validate and @invalidate and make sure
>>>>your
>>>> >> >> >metadata.xml looks like this:
>>>> >> >> >
>>>> >> >> ><ipojo>
>>>> >> >> ><component className="cook.michael.MyComponentImpl">
>>>> >> >> > <callback transition="validate" method="start"/>
>>>> >> >> > <callback transition="invalidate" method="stop"/>
>>>> >> >> ></component>
>>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>>>> >> >> ></ipojo>
>>>> >> >> >
>>>> >> >> >Either way should bring you where you want. Just don't mix
>>>> >>annotation
>>>> >> >>and
>>>> >> >> >metadata usage for same component.
>>>> >> >> >
>>>> >> >> >Regards,
>>>> >> >> >Gokturk
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >
>>>> >> >> >> Hi Göktürk,
>>>> >> >> >>
>>>> >> >> >> OK... Tried that. Still the same thing. There's not much to
>>>>my
>>>> >> >>code,
>>>> >> >> >>so
>>>> >> >> >> I'm including it below. Please let me know if you see
>>>>anything.
>>>> >> >> >>
>>>> >> >> >> Thank you for helping me,
>>>> >> >> >> Mike
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> MyComponentImpl.java:
>>>> >> >> >>
>>>> >> >> >> package cook.michael;
>>>> >> >> >>
>>>> >> >> >> import java.io.BufferedWriter;
>>>> >> >> >> import java.io.File;
>>>> >> >> >> import java.io.FileWriter;
>>>> >> >> >> import java.io.IOException;
>>>> >> >> >>
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>>>> >> >> >>
>>>> >> >> >> @Component
>>>> >> >> >> @Instantiate
>>>> >> >> >> public class MyComponentImpl {
>>>> >> >> >>
>>>> >> >> >> @Validate
>>>> >> >> >> public void start() throws IOException {
>>>> >> >> >> System.err.println("Starting: " );
>>>> >> >> >>
>>>> >> >> >> System.out.println("I'm starting...");
>>>> >> >> >> try{
>>>> >> >> >> // Create file
>>>> >> >> >> FileWriter fstream = new
>>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>>>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
>>>> >> >> >> out.write("Hello Java");
>>>> >> >> >> //Close the output stream
>>>> >> >> >> out.close();
>>>> >> >> >> }catch (Exception e){//Catch exception if any
>>>> >> >> >> System.err.println("Error: " + e.getMessage());
>>>> >> >> >> }
>>>> >> >> >> throw new IOException() ;
>>>> >> >> >> }
>>>> >> >> >>
>>>> >> >> >> @Invalidate
>>>> >> >> >> public void stop() {
>>>> >> >> >> System.out.println("I'm leaving !");
>>>> >> >> >> }
>>>> >> >> >> }
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> metadata.xml:
>>>> >> >> >>
>>>> >> >> >> <ipojo>
>>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>>>> >> >> >> </ipojo>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> iPojoTest.bnd:
>>>> >> >> >>
>>>> >> >> >> Import-Package: *
>>>> >> >> >> Export-Package: *
>>>> >> >> >> #Private-Package:
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> Generated manefest.mf:
>>>> >> >> >>
>>>> >> >> >> Manifest-Version: 1.0
>>>> >> >> >> Export-Package:
>>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>>>> >> >> >>
>>>> >>
>>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>>>> >> >> >>
>>>> >>
>>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>>>> >> >> >>
>>>> >>
>>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>>>> >> >> >> l
>>>> >> >> >> iPOJO-Components: component {
>>>> >> >>$classname="cook.michael.MyComponentImpl
>>>> >> >> >> " manipulation { method { $name="$init" }method {
>>>>$name="start"
>>>> >> >>}meth
>>>> >> >> >> od { $name="stop" }}}instance {
>>>> >> >>$component="cook.michael.MyComponentI
>>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>>>> >> >>$classname="co
>>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>>>> >> >>org.apache.felix.ipojo.ann
>>>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
>>>> >> >>$method="
>>>> >> >> >> stop" }callback { $transition="validate" $method="start"
>>>> >> >>}manipulatio
>>>> >> >> >> n { method { $name="$init" }method { $name="start" }method {
>>>> >> >>$name="s
>>>> >> >> >> top" }}}
>>>> >> >> >> Built-By: clement
>>>> >> >> >> Tool: Bnd-0.0.249
>>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>>>> >> >> >> Bundle-Version: 1.8.2
>>>> >> >> >> Build-Jdk: 1.6.0_31
>>>> >> >> >> Bnd-LastModified: 1350001458935
>>>> >> >> >> Bundle-ManifestVersion: 2
>>>> >> >> >> Bundle-Description: iPOJO Annotations
>>>> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>>> >> >> >> Bundle-DocURL:
>>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>>>> >> >> >> ns.html
>>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>>>> >> >>org.apache.felix.ipo
>>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>>> >> >>org.apache.f
>>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>>>> >> >>org.apache.felix.ipojo.extende
>>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>>>> >> >>org.apache.felix.ipojo;version=
>>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>>> >> >>org.apache.felix.ipojo.
>>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>>> >> >>org.apache.felix.ipojo
>>>> >> >> >> .annotations, cook.michael
>>>> >> >> >> Bundle-SymbolicName: iPojoTest
>>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>> >> wrote:
>>>> >> >> >>
>>>> >> >> >> >Hi,
>>>> >> >> >> >
>>>> >> >> >> >First of all @Component is mandatory.(For annotation based
>>>> >>usage).
>>>> >> >> >> >
>>>> >> >> >> >But this only defines your component. To actually instantiate
>>>>it
>>>> >>you
>>>> >> >> >> >should
>>>> >> >> >> >do it deliberately. One way to do that is using @Instantiate
>>>> >> >> >>annotation.
>>>> >> >> >> >
>>>> >> >> >> >So your code would be like:
>>>> >> >> >> >
>>>> >> >> >> >@Component
>>>> >> >> >> >@Instantiate
>>>> >> >> >> >public class foo{
>>>> >> >> >> >
>>>> >> >> >> > @Validate
>>>> >> >> >> > public void start()
>>>> >> >> >> >..........
>>>> >> >> >> >..........
>>>> >> >> >> >}
>>>> >> >> >> >
>>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >> >
>>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
>>>>the
>>>> >> >> >> >>@Component.
>>>> >> >> >> >> Same result. No output.
>>>> >> >> >> >>
>>>> >> >> >> >> Mike
>>>> >> >> >> >> Michael Cook
>>>> >> >> >> >> VP Technology Innovation
>>>> >> >> >> >> Comcast
>>>> >> >> >> >> One Comcast Center
>>>> >> >> >> >> Philadelphia, PA 19103
>>>> >> >> >> >> (o) 215-286-8260
>>>> >> >> >> >> (m) 609-458-0332
>>>> >> >> >> >>
>>>> >> >> >> >> ----- Original Message -----
>>>> >> >> >> >> From: Cook, Michael J. (OCTO)
>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>> >> >> >> >>
>>>> >> >> >> >> I used @validate/@invalidate alone.
>>>> >> >> >> >>
>>>> >> >> >> >> Mike
>>>> >> >> >> >>
>>>> >> >> >> >> Michael Cook
>>>> >> >> >> >> VP Technology Innovation
>>>> >> >> >> >> Comcast
>>>> >> >> >> >> One Comcast Center
>>>> >> >> >> >> Philadelphia, PA 19103
>>>> >> >> >> >> (o) 215-286-8260
>>>> >> >> >> >> (m) 609-458-0332
>>>> >> >> >> >>
>>>> >> >> >> >> ----- Original Message -----
>>>> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>> >> >> >> >>
>>>> >> >> >> >> Hi,
>>>> >> >> >> >>
>>>> >> >> >> >> I need to ask this first since it's not on your code
>>>>snippet:
>>>> >>Did
>>>> >> >>you
>>>> >> >> >> >>use
>>>> >> >> >> >> @Component annotation for class where you've declared your
>>>> >>start()
>>>> >> >> >> >>stop()
>>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>>>> >> >> >> >>
>>>> >> >> >> >>
>>>> >> >> >> >> *Regards,*
>>>> >> >> >> >> *Gokturk*
>>>> >> >> >> >>
>>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >> >>
>>>> >> >> >> >> > Hi,
>>>> >> >> >> >> >
>>>> >> >> >> >> > I can't seem to find a good article that will help me
>>>>resolve
>>>> >> >>the
>>>> >> >> >> >> "getting
>>>> >> >> >> >> > started" issue I am facing.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>>>> >>from:
>>>> >> >> >> >> > http://clement.plop-plop.net/update/
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have created a sample project following the
>>>>instructions
>>>> >>at:
>>>> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>>>>following
>>>> >> >> >> >>instructions
>>>> >> >> >> >> > here:
>>>> >> >> >>
>>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>>>> >> >> >> >> >
>>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>>>>installed
>>>> >> >>the
>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I've created a test bundle using iPOJO called
>>>>iPojoTest.jar
>>>> >>and
>>>> >> >> >>I've
>>>> >> >> >> >> > installed it and started it in the OSGI console.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I run bundles in the console and I get:
>>>> >> >> >> >> >
>>>> >> >> >> >> > g! bundles
>>>> >> >> >> >> >
>>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
>>>>(3.0.7)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>>>> >> >>(1.6.2)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > So, the bundle seems to have started.
>>>> >> >> >> >> >
>>>> >> >> >> >> > But I don't get any console output from my sysoutsŠ
>>>> >> >> >> >> >
>>>> >> >> >> >> > Here are the start() and stop() methods:
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > @Validate
>>>> >> >> >> >> >
>>>> >> >> >> >> > public void start() throws IOException {
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.out.println("I'm starting...");
>>>> >> >> >> >> >
>>>> >> >> >> >> > try{
>>>> >> >> >> >> >
>>>> >> >> >> >> > // Create file
>>>> >> >> >> >> >
>>>> >> >> >> >> > FileWriter fstream = new
>>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>>>> >> >> >> >> >
>>>> >> >> >> >> > BufferedWriter out = new
>>>> >> >>BufferedWriter(fstream);
>>>> >> >> >> >> >
>>>> >> >> >> >> > out.write("Hello Java");
>>>> >> >> >> >> >
>>>> >> >> >> >> > //Close the output stream
>>>> >> >> >> >> >
>>>> >> >> >> >> > out.close();
>>>> >> >> >> >> >
>>>> >> >> >> >> > }catch (Exception e){//Catch exception
>>>>if
>>>> >>any
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.err.println("Error: " +
>>>> >> >>e.getMessage());
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> > throw new IOException() ;
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> > @Invalidate
>>>> >> >> >> >> >
>>>> >> >> >> >> > public void stop() {
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.out.println("I'm leaving !");
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > I added in the file write to see if a file would be
>>>>created.
>>>> >> >>There
>>>> >> >> >> >>is no
>>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
>>>>ACTIVE,
>>>> >>the
>>>> >> >> >>start
>>>> >> >> >> >> method
>>>> >> >> >> >> > appears never have to been called.
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > Can anyone tell me what I may have done wrong or provide
>>>>a
>>>> >>clue
>>>> >> >>as
>>>> >> >> >>to
>>>> >> >> >> >> what
>>>> >> >> >> >> > to look at to help diagnose the problem?
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > Thanks,
>>>> >> >> >> >> >
>>>> >> >> >> >> > Mike
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >>---------------------------------------------------------------------
>>>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>>---------------------------------------------------------------------
>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >> >>
>>>> >> >>
>>>> >>
>>>> >>
>>>> >>
>>>>---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >>
>>>> >>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>For additional commands, e-mail: users-help@felix.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Simon Chemouil <sc...@gmail.com>.
Michael,
It seems like you are using an antique version of iPojo. The import
you show in your manifest is 0.9.0 and the last release is 1.8.2 (that
import is added by the manipulator).
In an earlier message you said you were using the Eclipse plugin
available on Clement's website. This plugin is not maintained anymore
and while there is a new iPojo Eclipse plugin maintained elsewhere, I
wouldn't advise using it. Rather, you should use the manipulator from
ant or maven depending on how you build your project. If you choose
the maven-ipojo-plugin, you can get decent Eclipse integration using
Maven's Eclipse environment (M2E).
HTH,
Simon
On Fri, Oct 12, 2012 at 2:17 PM, Cook, Michael J. (OCTO)
<Mi...@cable.comcast.com> wrote:
> Sorry... I forgot to add back in the annotations in my Impl class. I just
> did and repackaged. Please disregard the previous manifest.
>
>
>
> Manifest-Version: 1.0
> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> l
> iPOJO-Components: component { $classname="cook.michael.BogusClass" man
> ipulation { method { $name="$init" }}}component { $name="cook.michael
> .MyComponentImpl" $classname="cook.michael.MyComponentImpl" $public="
> true" org.apache.felix.ipojo.annotations:instantiate { }callback { $t
> ransition="invalidate" $method="stop" }callback { $transition="valida
> te" $method="start" }manipulation { method { $name="$init" }method {
> $name="start" }method { $name="stop" }}}
> Built-By: clement
> Tool: Bnd-0.0.249
> Bundle-Name: Apache Felix iPOJO Annotations
> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> Bundle-Vendor: The Apache Software Foundation
> Bundle-Version: 1.8.2
> Build-Jdk: 1.6.0_31
> Bnd-LastModified: 1350044136955
> Bundle-ManifestVersion: 2
> Bundle-Description: iPOJO Annotations
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> ns.html
> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> .annotations, cook.michael
> Bundle-SymbolicName: iPojoTest
> Originally-Created-By: Apache Maven Bundle Plugin
>
>
>
>
>
>
> On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
> <Mi...@cable.comcast.com> wrote:
>
>>OK,
>>
>>Here it is inline (and attached).
>>
>>Manifest-Version: 1.0
>>Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> l
>>iPOJO-Components: component { $classname="cook.michael.BogusClass" man
>> ipulation { method { $name="$init" }}}
>>Built-By: clement
>>Tool: Bnd-0.0.249
>>Bundle-Name: Apache Felix iPOJO Annotations
>>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>Bundle-Vendor: The Apache Software Foundation
>>Bundle-Version: 1.8.2
>>Build-Jdk: 1.6.0_31
>>Bnd-LastModified: 1350043925031
>>Bundle-ManifestVersion: 2
>>Bundle-Description: iPOJO Annotations
>>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> ns.html
>>Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
>> .annotations, cook.michael
>>Bundle-SymbolicName: iPojoTest
>>Originally-Created-By: Apache Maven Bundle Plugin
>>
>>
>>
>>Mike
>>
>>On 10/11/12 10:40 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>
>>>I wanted MANIFEST.MF file actually :/
>>>
>>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>>>Michael_J_Cook@cable.comcast.com> wrote:
>>>
>>>> Hmmm...
>>>>
>>>> Here's my metadata.xml...
>>>>
>>>> I get the following error:
>>>>
>>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
>>>> org.apache.felix.ipojo.ComponentFactory
>>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
>>>>class
>>>> name : component immediate="true"
>>>> at
>>>>
>>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
>>>> at
>>>>
>>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121
>>>>)
>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>Method)
>>>> at
>>>>
>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
>>>>c
>>>>ce
>>>> ssorImpl.java:39)
>>>> at
>>>>
>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
>>>>t
>>>>ru
>>>> ctorAccessorImpl.java:27)
>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>> at
>>>>
>>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
>>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>>>> at
>>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>>>> at
>>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>>>> at java.lang.Thread.run(Thread.java:680)
>>>>
>>>>
>>>> Here's what I had for the Bogus Class case on the metadata.xml:
>>>>
>>>> <ipojo>
>>>> <component className="cook.michael.BogusClass"/>
>>>> </ipojo>
>>>>
>>>>
>>>>
>>>> Mike
>>>>
>>>>
>>>>
>>>> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>>>
>>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>>>> >
>>>> >First finding : you don't need a bogus component. You can just type
>>>> ><ipojo>
>>>> ><component/>
>>>> ></ipojo>
>>>> >
>>>> >inside you metadata.xml and it'll pass silently.
>>>> >
>>>> >Besides you might be hitting a bug we've fixed in trunk, because in
>>>>the
>>>> >same scenario I suggested to you I saw some elements in MANIFEST which
>>>> >shouldn't be there.
>>>> >Could you share me your MANIFEST for the final state(bogus
>>>>metadata.xml +
>>>> >annotations)?
>>>> >
>>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>>>> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >
>>>> >> Hi,
>>>> >>
>>>> >> >>Could you tell me what happens when you remove the <ipojo/>
>>>>element
>>>> >>too
>>>> >> >>leaving the metadata.xml empty?
>>>> >>
>>>> >>
>>>> >> I get an error when there is no contents in the metadata.xml file.
>>>> >>
>>>> >> >>I could suggest you a trick to define a bogus
>>>> >> >>component inside metadata.xml(Will require you to maintain a bogus
>>>> >>class)
>>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and
>>>>move
>>>> >>along
>>>> >> >>its way with annotations.
>>>> >>
>>>> >>
>>>> >> I added a bogus class into the cook.michael package and put the
>>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
>>>>Then
>>>> >> added this component to the metadata.xml file:
>>>> >> <ipojo>
>>>> >> <component className="cook.michael.BogusClass"/>
>>>> >> </ipojo>
>>>> >>
>>>> >>
>>>> >>
>>>> >> The above results in the start and stop not being invoked.
>>>> >>
>>>> >> >>Instead of embedding Felix into eclipse you can use its own
>>>>Equinox
>>>> >> >>launcher.
>>>> >>
>>>> >> I'm developing atop Felix, because the target device is Felix based,
>>>>so
>>>> >>I
>>>> >> would like to keep it on the same platform.
>>>> >>
>>>> >>
>>>> >> Thank you for your help.
>>>> >> Mike
>>>> >>
>>>> >>
>>>> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com>
>>>>wrote:
>>>> >>
>>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >
>>>> >> >> Göktürk,
>>>> >> >>
>>>> >> >> Thank you! I used #2 below and it worked well. I was able to
>>>>launch
>>>> >>the
>>>> >> >> bundle, and I saw it output the traces I had been looking for.
>>>> >> >>
>>>> >> >
>>>> >> >Cool !
>>>> >> >
>>>> >> >
>>>> >> >>
>>>> >> >> On the first, if I remove the contents of the metadata.xml file,
>>>>how
>>>> >> >>can I
>>>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>>>> >>element,
>>>> >> >>and
>>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
>>>>component
>>>> >> >>types,
>>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>>>>although
>>>> >>the
>>>> >> >> class is marked with @Component and @Instantiate and start/stop
>>>>is
>>>> >> >>marked
>>>> >> >> with @Validate/@Invalidate.
>>>> >> >>
>>>> >> >
>>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
>>>>seems
>>>> >>to be
>>>> >> >dependent on metadata.xml but also sees the annotations on its way.
>>>> >> >
>>>> >> >Could you tell me what happens when you remove the <ipojo/> element
>>>>too
>>>> >> >leaving the metadata.xml empty?
>>>> >>
>>>> >> >
>>>> >> >If above trick didn't work and you want to stick with
>>>> >>eclipse-ipojo-plugin
>>>> >> >while using annotations. I could suggest you a trick to define a
>>>>bogus
>>>> >> >component inside metadata.xml(Will require you to maintain a bogus
>>>> >>class)
>>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>>> >>along
>>>> >> >its way with annotations.
>>>> >> >
>>>> >> >Also it seems to me that your development environment is heavy.
>>>> >>Instead of
>>>> >> >embedding Felix into eclipse you can use its own Equinox launcher.
>>>> >> >I suggest you to have a look at
>>>> >>
>>>> >>>
>>>>
>>>>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>>>> >> >where
>>>> >> >you can see basic setup.(You can use annotations or metadata of
>>>>your
>>>> >> >choice
>>>> >> >in this setup)
>>>> >> >
>>>> >> >
>>>> >> >Gokturk
>>>> >> >
>>>> >> >
>>>> >> >>
>>>> >> >> Mike
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>> wrote:
>>>> >> >>
>>>> >> >> >Well i thought at first that you didn't specify metadata.xml but
>>>>i
>>>> >>see
>>>> >> >>now
>>>> >> >> >that you did. Mixing metadata.xml and annotations for one single
>>>> >> >>component
>>>> >> >> >is a mistake. For same component you must go with one of them.
>>>> >> >> >
>>>> >> >> >So there are 2 different ways for you:
>>>> >> >> >
>>>> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
>>>> >> >>delete it
>>>> >> >> >or comment out the content ) and leave the annotations as it is.
>>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
>>>> >>remove
>>>> >> >>all
>>>> >> >> >annotations including @validate and @invalidate and make sure
>>>>your
>>>> >> >> >metadata.xml looks like this:
>>>> >> >> >
>>>> >> >> ><ipojo>
>>>> >> >> ><component className="cook.michael.MyComponentImpl">
>>>> >> >> > <callback transition="validate" method="start"/>
>>>> >> >> > <callback transition="invalidate" method="stop"/>
>>>> >> >> ></component>
>>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>>>> >> >> ></ipojo>
>>>> >> >> >
>>>> >> >> >Either way should bring you where you want. Just don't mix
>>>> >>annotation
>>>> >> >>and
>>>> >> >> >metadata usage for same component.
>>>> >> >> >
>>>> >> >> >Regards,
>>>> >> >> >Gokturk
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >
>>>> >> >> >> Hi Göktürk,
>>>> >> >> >>
>>>> >> >> >> OK... Tried that. Still the same thing. There's not much to
>>>>my
>>>> >> >>code,
>>>> >> >> >>so
>>>> >> >> >> I'm including it below. Please let me know if you see
>>>>anything.
>>>> >> >> >>
>>>> >> >> >> Thank you for helping me,
>>>> >> >> >> Mike
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> MyComponentImpl.java:
>>>> >> >> >>
>>>> >> >> >> package cook.michael;
>>>> >> >> >>
>>>> >> >> >> import java.io.BufferedWriter;
>>>> >> >> >> import java.io.File;
>>>> >> >> >> import java.io.FileWriter;
>>>> >> >> >> import java.io.IOException;
>>>> >> >> >>
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>>>> >> >> >>
>>>> >> >> >> @Component
>>>> >> >> >> @Instantiate
>>>> >> >> >> public class MyComponentImpl {
>>>> >> >> >>
>>>> >> >> >> @Validate
>>>> >> >> >> public void start() throws IOException {
>>>> >> >> >> System.err.println("Starting: " );
>>>> >> >> >>
>>>> >> >> >> System.out.println("I'm starting...");
>>>> >> >> >> try{
>>>> >> >> >> // Create file
>>>> >> >> >> FileWriter fstream = new
>>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>>>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
>>>> >> >> >> out.write("Hello Java");
>>>> >> >> >> //Close the output stream
>>>> >> >> >> out.close();
>>>> >> >> >> }catch (Exception e){//Catch exception if any
>>>> >> >> >> System.err.println("Error: " + e.getMessage());
>>>> >> >> >> }
>>>> >> >> >> throw new IOException() ;
>>>> >> >> >> }
>>>> >> >> >>
>>>> >> >> >> @Invalidate
>>>> >> >> >> public void stop() {
>>>> >> >> >> System.out.println("I'm leaving !");
>>>> >> >> >> }
>>>> >> >> >> }
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> metadata.xml:
>>>> >> >> >>
>>>> >> >> >> <ipojo>
>>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>>>> >> >> >> </ipojo>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> iPojoTest.bnd:
>>>> >> >> >>
>>>> >> >> >> Import-Package: *
>>>> >> >> >> Export-Package: *
>>>> >> >> >> #Private-Package:
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> Generated manefest.mf:
>>>> >> >> >>
>>>> >> >> >> Manifest-Version: 1.0
>>>> >> >> >> Export-Package:
>>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>>>> >> >> >>
>>>> >>
>>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>>>> >> >> >>
>>>> >>
>>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>>>> >> >> >>
>>>> >>
>>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>>>> >> >> >> l
>>>> >> >> >> iPOJO-Components: component {
>>>> >> >>$classname="cook.michael.MyComponentImpl
>>>> >> >> >> " manipulation { method { $name="$init" }method {
>>>>$name="start"
>>>> >> >>}meth
>>>> >> >> >> od { $name="stop" }}}instance {
>>>> >> >>$component="cook.michael.MyComponentI
>>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>>>> >> >>$classname="co
>>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>>>> >> >>org.apache.felix.ipojo.ann
>>>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
>>>> >> >>$method="
>>>> >> >> >> stop" }callback { $transition="validate" $method="start"
>>>> >> >>}manipulatio
>>>> >> >> >> n { method { $name="$init" }method { $name="start" }method {
>>>> >> >>$name="s
>>>> >> >> >> top" }}}
>>>> >> >> >> Built-By: clement
>>>> >> >> >> Tool: Bnd-0.0.249
>>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>>>> >> >> >> Bundle-Version: 1.8.2
>>>> >> >> >> Build-Jdk: 1.6.0_31
>>>> >> >> >> Bnd-LastModified: 1350001458935
>>>> >> >> >> Bundle-ManifestVersion: 2
>>>> >> >> >> Bundle-Description: iPOJO Annotations
>>>> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>>> >> >> >> Bundle-DocURL:
>>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>>>> >> >> >> ns.html
>>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>>>> >> >>org.apache.felix.ipo
>>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>>> >> >>org.apache.f
>>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>>>> >> >>org.apache.felix.ipojo.extende
>>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>>>> >> >>org.apache.felix.ipojo;version=
>>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>>> >> >>org.apache.felix.ipojo.
>>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>>> >> >>org.apache.felix.ipojo
>>>> >> >> >> .annotations, cook.michael
>>>> >> >> >> Bundle-SymbolicName: iPojoTest
>>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
>>>> >> wrote:
>>>> >> >> >>
>>>> >> >> >> >Hi,
>>>> >> >> >> >
>>>> >> >> >> >First of all @Component is mandatory.(For annotation based
>>>> >>usage).
>>>> >> >> >> >
>>>> >> >> >> >But this only defines your component. To actually instantiate
>>>>it
>>>> >>you
>>>> >> >> >> >should
>>>> >> >> >> >do it deliberately. One way to do that is using @Instantiate
>>>> >> >> >>annotation.
>>>> >> >> >> >
>>>> >> >> >> >So your code would be like:
>>>> >> >> >> >
>>>> >> >> >> >@Component
>>>> >> >> >> >@Instantiate
>>>> >> >> >> >public class foo{
>>>> >> >> >> >
>>>> >> >> >> > @Validate
>>>> >> >> >> > public void start()
>>>> >> >> >> >..........
>>>> >> >> >> >..........
>>>> >> >> >> >}
>>>> >> >> >> >
>>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >> >
>>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
>>>>the
>>>> >> >> >> >>@Component.
>>>> >> >> >> >> Same result. No output.
>>>> >> >> >> >>
>>>> >> >> >> >> Mike
>>>> >> >> >> >> Michael Cook
>>>> >> >> >> >> VP Technology Innovation
>>>> >> >> >> >> Comcast
>>>> >> >> >> >> One Comcast Center
>>>> >> >> >> >> Philadelphia, PA 19103
>>>> >> >> >> >> (o) 215-286-8260
>>>> >> >> >> >> (m) 609-458-0332
>>>> >> >> >> >>
>>>> >> >> >> >> ----- Original Message -----
>>>> >> >> >> >> From: Cook, Michael J. (OCTO)
>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>> >> >> >> >>
>>>> >> >> >> >> I used @validate/@invalidate alone.
>>>> >> >> >> >>
>>>> >> >> >> >> Mike
>>>> >> >> >> >>
>>>> >> >> >> >> Michael Cook
>>>> >> >> >> >> VP Technology Innovation
>>>> >> >> >> >> Comcast
>>>> >> >> >> >> One Comcast Center
>>>> >> >> >> >> Philadelphia, PA 19103
>>>> >> >> >> >> (o) 215-286-8260
>>>> >> >> >> >> (m) 609-458-0332
>>>> >> >> >> >>
>>>> >> >> >> >> ----- Original Message -----
>>>> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>>> >> >> >> >>
>>>> >> >> >> >> Hi,
>>>> >> >> >> >>
>>>> >> >> >> >> I need to ask this first since it's not on your code
>>>>snippet:
>>>> >>Did
>>>> >> >>you
>>>> >> >> >> >>use
>>>> >> >> >> >> @Component annotation for class where you've declared your
>>>> >>start()
>>>> >> >> >> >>stop()
>>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>>>> >> >> >> >>
>>>> >> >> >> >>
>>>> >> >> >> >> *Regards,*
>>>> >> >> >> >> *Gokturk*
>>>> >> >> >> >>
>>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>>>> >> >> >> >>
>>>> >> >> >> >> > Hi,
>>>> >> >> >> >> >
>>>> >> >> >> >> > I can't seem to find a good article that will help me
>>>>resolve
>>>> >> >>the
>>>> >> >> >> >> "getting
>>>> >> >> >> >> > started" issue I am facing.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>>>> >>from:
>>>> >> >> >> >> > http://clement.plop-plop.net/update/
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have created a sample project following the
>>>>instructions
>>>> >>at:
>>>> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>>>>following
>>>> >> >> >> >>instructions
>>>> >> >> >> >> > here:
>>>> >> >> >>
>>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>>>> >> >> >> >> >
>>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>>>> >> >> >> >> >
>>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>>>>installed
>>>> >> >>the
>>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I've created a test bundle using iPOJO called
>>>>iPojoTest.jar
>>>> >>and
>>>> >> >> >>I've
>>>> >> >> >> >> > installed it and started it in the OSGI console.
>>>> >> >> >> >> >
>>>> >> >> >> >> > I run bundles in the console and I get:
>>>> >> >> >> >> >
>>>> >> >> >> >> > g! bundles
>>>> >> >> >> >> >
>>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
>>>>(3.0.7)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>>>> >> >>(1.6.2)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>>>>(0.6.1)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>>>> >> >> >> >> >
>>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > So, the bundle seems to have started.
>>>> >> >> >> >> >
>>>> >> >> >> >> > But I don't get any console output from my sysoutsŠ
>>>> >> >> >> >> >
>>>> >> >> >> >> > Here are the start() and stop() methods:
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > @Validate
>>>> >> >> >> >> >
>>>> >> >> >> >> > public void start() throws IOException {
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.out.println("I'm starting...");
>>>> >> >> >> >> >
>>>> >> >> >> >> > try{
>>>> >> >> >> >> >
>>>> >> >> >> >> > // Create file
>>>> >> >> >> >> >
>>>> >> >> >> >> > FileWriter fstream = new
>>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>>>> >> >> >> >> >
>>>> >> >> >> >> > BufferedWriter out = new
>>>> >> >>BufferedWriter(fstream);
>>>> >> >> >> >> >
>>>> >> >> >> >> > out.write("Hello Java");
>>>> >> >> >> >> >
>>>> >> >> >> >> > //Close the output stream
>>>> >> >> >> >> >
>>>> >> >> >> >> > out.close();
>>>> >> >> >> >> >
>>>> >> >> >> >> > }catch (Exception e){//Catch exception
>>>>if
>>>> >>any
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.err.println("Error: " +
>>>> >> >>e.getMessage());
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> > throw new IOException() ;
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> > @Invalidate
>>>> >> >> >> >> >
>>>> >> >> >> >> > public void stop() {
>>>> >> >> >> >> >
>>>> >> >> >> >> > System.out.println("I'm leaving !");
>>>> >> >> >> >> >
>>>> >> >> >> >> > }
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > I added in the file write to see if a file would be
>>>>created.
>>>> >> >>There
>>>> >> >> >> >>is no
>>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
>>>>ACTIVE,
>>>> >>the
>>>> >> >> >>start
>>>> >> >> >> >> method
>>>> >> >> >> >> > appears never have to been called.
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > Can anyone tell me what I may have done wrong or provide
>>>>a
>>>> >>clue
>>>> >> >>as
>>>> >> >> >>to
>>>> >> >> >> >> what
>>>> >> >> >> >> > to look at to help diagnose the problem?
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >> > Thanks,
>>>> >> >> >> >> >
>>>> >> >> >> >> > Mike
>>>> >> >> >> >> >
>>>> >> >> >> >> >
>>>> >> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >>---------------------------------------------------------------------
>>>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>>---------------------------------------------------------------------
>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >> >>
>>>> >> >>
>>>> >>
>>>> >>
>>>> >>
>>>>---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> >> For additional commands, e-mail: users-help@felix.apache.org
>>>> >>
>>>> >>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>For additional commands, e-mail: users-help@felix.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Sorry... I forgot to add back in the annotations in my Impl class. I just
did and repackaged. Please disregard the previous manifest.
Manifest-Version: 1.0
Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
l
iPOJO-Components: component { $classname="cook.michael.BogusClass" man
ipulation { method { $name="$init" }}}component { $name="cook.michael
.MyComponentImpl" $classname="cook.michael.MyComponentImpl" $public="
true" org.apache.felix.ipojo.annotations:instantiate { }callback { $t
ransition="invalidate" $method="stop" }callback { $transition="valida
te" $method="start" }manipulation { method { $name="$init" }method {
$name="start" }method { $name="stop" }}}
Built-By: clement
Tool: Bnd-0.0.249
Bundle-Name: Apache Felix iPOJO Annotations
Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
Bundle-Vendor: The Apache Software Foundation
Bundle-Version: 1.8.2
Build-Jdk: 1.6.0_31
Bnd-LastModified: 1350044136955
Bundle-ManifestVersion: 2
Bundle-Description: iPOJO Annotations
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
ns.html
Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
.annotations, cook.michael
Bundle-SymbolicName: iPojoTest
Originally-Created-By: Apache Maven Bundle Plugin
On 10/12/12 8:13 AM, "Cook, Michael J. (OCTO)"
<Mi...@cable.comcast.com> wrote:
>OK,
>
>Here it is inline (and attached).
>
>Manifest-Version: 1.0
>Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> l
>iPOJO-Components: component { $classname="cook.michael.BogusClass" man
> ipulation { method { $name="$init" }}}
>Built-By: clement
>Tool: Bnd-0.0.249
>Bundle-Name: Apache Felix iPOJO Annotations
>Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>Bundle-Vendor: The Apache Software Foundation
>Bundle-Version: 1.8.2
>Build-Jdk: 1.6.0_31
>Bnd-LastModified: 1350043925031
>Bundle-ManifestVersion: 2
>Bundle-Description: iPOJO Annotations
>Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> ns.html
>Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> .annotations, cook.michael
>Bundle-SymbolicName: iPojoTest
>Originally-Created-By: Apache Maven Bundle Plugin
>
>
>
>Mike
>
>On 10/11/12 10:40 PM, "G�kt�rk Gezer" <go...@gmail.com> wrote:
>
>>I wanted MANIFEST.MF file actually :/
>>
>>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>>Michael_J_Cook@cable.comcast.com> wrote:
>>
>>> Hmmm...
>>>
>>> Here's my metadata.xml...
>>>
>>> I get the following error:
>>>
>>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
>>> org.apache.felix.ipojo.ComponentFactory
>>> org.apache.felix.ipojo.ConfigurationException: A component needs a
>>>class
>>> name : component immediate="true"
>>> at
>>>
>>>org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
>>> at
>>>
>>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121
>>>)
>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>Method)
>>> at
>>>
>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
>>>c
>>>ce
>>> ssorImpl.java:39)
>>> at
>>>
>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
>>>t
>>>ru
>>> ctorAccessorImpl.java:27)
>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>> at
>>>
>>>org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
>>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>>> at
>>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>>> at
>>>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>>> at java.lang.Thread.run(Thread.java:680)
>>>
>>>
>>> Here's what I had for the Bogus Class case on the metadata.xml:
>>>
>>> <ipojo>
>>> <component className="cook.michael.BogusClass"/>
>>> </ipojo>
>>>
>>>
>>>
>>> Mike
>>>
>>>
>>>
>>> On 10/11/12 10:23 PM, "G�kt�rk Gezer" <go...@gmail.com> wrote:
>>>
>>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>>> >
>>> >First finding : you don't need a bogus component. You can just type
>>> ><ipojo>
>>> ><component/>
>>> ></ipojo>
>>> >
>>> >inside you metadata.xml and it'll pass silently.
>>> >
>>> >Besides you might be hitting a bug we've fixed in trunk, because in
>>>the
>>> >same scenario I suggested to you I saw some elements in MANIFEST which
>>> >shouldn't be there.
>>> >Could you share me your MANIFEST for the final state(bogus
>>>metadata.xml +
>>> >annotations)?
>>> >
>>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>>> >Michael_J_Cook@cable.comcast.com> wrote:
>>> >
>>> >> Hi,
>>> >>
>>> >> >>Could you tell me what happens when you remove the <ipojo/>
>>>element
>>> >>too
>>> >> >>leaving the metadata.xml empty?
>>> >>
>>> >>
>>> >> I get an error when there is no contents in the metadata.xml file.
>>> >>
>>> >> >>I could suggest you a trick to define a bogus
>>> >> >>component inside metadata.xml(Will require you to maintain a bogus
>>> >>class)
>>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and
>>>move
>>> >>along
>>> >> >>its way with annotations.
>>> >>
>>> >>
>>> >> I added a bogus class into the cook.michael package and put the
>>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
>>>Then
>>> >> added this component to the metadata.xml file:
>>> >> <ipojo>
>>> >> <component className="cook.michael.BogusClass"/>
>>> >> </ipojo>
>>> >>
>>> >>
>>> >>
>>> >> The above results in the start and stop not being invoked.
>>> >>
>>> >> >>Instead of embedding Felix into eclipse you can use its own
>>>Equinox
>>> >> >>launcher.
>>> >>
>>> >> I'm developing atop Felix, because the target device is Felix based,
>>>so
>>> >>I
>>> >> would like to keep it on the same platform.
>>> >>
>>> >>
>>> >> Thank you for your help.
>>> >> Mike
>>> >>
>>> >>
>>> >> On 10/11/12 9:47 PM, "G�kt�rk Gezer" <go...@gmail.com>
>>>wrote:
>>> >>
>>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>> >> >
>>> >> >> G�kt�rk,
>>> >> >>
>>> >> >> Thank you! I used #2 below and it worked well. I was able to
>>>launch
>>> >>the
>>> >> >> bundle, and I saw it output the traces I had been looking for.
>>> >> >>
>>> >> >
>>> >> >Cool !
>>> >> >
>>> >> >
>>> >> >>
>>> >> >> On the first, if I remove the contents of the metadata.xml file,
>>>how
>>> >> >>can I
>>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>>> >>element,
>>> >> >>and
>>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither
>>>component
>>> >> >>types,
>>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>>>although
>>> >>the
>>> >> >> class is marked with @Component and @Instantiate and start/stop
>>>is
>>> >> >>marked
>>> >> >> with @Validate/@Invalidate.
>>> >> >>
>>> >> >
>>> >> >Well, I actually never used eclipse-ipojo-plugin before but it
>>>seems
>>> >>to be
>>> >> >dependent on metadata.xml but also sees the annotations on its way.
>>> >> >
>>> >> >Could you tell me what happens when you remove the <ipojo/> element
>>>too
>>> >> >leaving the metadata.xml empty?
>>> >>
>>> >> >
>>> >> >If above trick didn't work and you want to stick with
>>> >>eclipse-ipojo-plugin
>>> >> >while using annotations. I could suggest you a trick to define a
>>>bogus
>>> >> >component inside metadata.xml(Will require you to maintain a bogus
>>> >>class)
>>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>> >>along
>>> >> >its way with annotations.
>>> >> >
>>> >> >Also it seems to me that your development environment is heavy.
>>> >>Instead of
>>> >> >embedding Felix into eclipse you can use its own Equinox launcher.
>>> >> >I suggest you to have a look at
>>> >>
>>> >>>
>>>
>>>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>>> >> >where
>>> >> >you can see basic setup.(You can use annotations or metadata of
>>>your
>>> >> >choice
>>> >> >in this setup)
>>> >> >
>>> >> >
>>> >> >Gokturk
>>> >> >
>>> >> >
>>> >> >>
>>> >> >> Mike
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> On 10/11/12 8:54 PM, "G�kt�rk Gezer" <go...@gmail.com>
>>> wrote:
>>> >> >>
>>> >> >> >Well i thought at first that you didn't specify metadata.xml but
>>>i
>>> >>see
>>> >> >>now
>>> >> >> >that you did. Mixing metadata.xml and annotations for one single
>>> >> >>component
>>> >> >> >is a mistake. For same component you must go with one of them.
>>> >> >> >
>>> >> >> >So there are 2 different ways for you:
>>> >> >> >
>>> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
>>> >> >>delete it
>>> >> >> >or comment out the content ) and leave the annotations as it is.
>>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
>>> >>remove
>>> >> >>all
>>> >> >> >annotations including @validate and @invalidate and make sure
>>>your
>>> >> >> >metadata.xml looks like this:
>>> >> >> >
>>> >> >> ><ipojo>
>>> >> >> ><component className="cook.michael.MyComponentImpl">
>>> >> >> > <callback transition="validate" method="start"/>
>>> >> >> > <callback transition="invalidate" method="stop"/>
>>> >> >> ></component>
>>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>>> >> >> ></ipojo>
>>> >> >> >
>>> >> >> >Either way should bring you where you want. Just don't mix
>>> >>annotation
>>> >> >>and
>>> >> >> >metadata usage for same component.
>>> >> >> >
>>> >> >> >Regards,
>>> >> >> >Gokturk
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>> >> >> >
>>> >> >> >> Hi G�kt�rk,
>>> >> >> >>
>>> >> >> >> OK... Tried that. Still the same thing. There's not much to
>>>my
>>> >> >>code,
>>> >> >> >>so
>>> >> >> >> I'm including it below. Please let me know if you see
>>>anything.
>>> >> >> >>
>>> >> >> >> Thank you for helping me,
>>> >> >> >> Mike
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> MyComponentImpl.java:
>>> >> >> >>
>>> >> >> >> package cook.michael;
>>> >> >> >>
>>> >> >> >> import java.io.BufferedWriter;
>>> >> >> >> import java.io.File;
>>> >> >> >> import java.io.FileWriter;
>>> >> >> >> import java.io.IOException;
>>> >> >> >>
>>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>>> >> >> >>
>>> >> >> >> @Component
>>> >> >> >> @Instantiate
>>> >> >> >> public class MyComponentImpl {
>>> >> >> >>
>>> >> >> >> @Validate
>>> >> >> >> public void start() throws IOException {
>>> >> >> >> System.err.println("Starting: " );
>>> >> >> >>
>>> >> >> >> System.out.println("I'm starting...");
>>> >> >> >> try{
>>> >> >> >> // Create file
>>> >> >> >> FileWriter fstream = new
>>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
>>> >> >> >> out.write("Hello Java");
>>> >> >> >> //Close the output stream
>>> >> >> >> out.close();
>>> >> >> >> }catch (Exception e){//Catch exception if any
>>> >> >> >> System.err.println("Error: " + e.getMessage());
>>> >> >> >> }
>>> >> >> >> throw new IOException() ;
>>> >> >> >> }
>>> >> >> >>
>>> >> >> >> @Invalidate
>>> >> >> >> public void stop() {
>>> >> >> >> System.out.println("I'm leaving !");
>>> >> >> >> }
>>> >> >> >> }
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> metadata.xml:
>>> >> >> >>
>>> >> >> >> <ipojo>
>>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>>> >> >> >> </ipojo>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> iPojoTest.bnd:
>>> >> >> >>
>>> >> >> >> Import-Package: *
>>> >> >> >> Export-Package: *
>>> >> >> >> #Private-Package:
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Generated manefest.mf:
>>> >> >> >>
>>> >> >> >> Manifest-Version: 1.0
>>> >> >> >> Export-Package:
>>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>>> >> >> >>
>>> >>
>>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>>> >> >> >>
>>> >>
>>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>>> >> >> >>
>>> >>
>>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>>> >> >> >> l
>>> >> >> >> iPOJO-Components: component {
>>> >> >>$classname="cook.michael.MyComponentImpl
>>> >> >> >> " manipulation { method { $name="$init" }method {
>>>$name="start"
>>> >> >>}meth
>>> >> >> >> od { $name="stop" }}}instance {
>>> >> >>$component="cook.michael.MyComponentI
>>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>>> >> >>$classname="co
>>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>>> >> >>org.apache.felix.ipojo.ann
>>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
>>> >> >>$method="
>>> >> >> >> stop" }callback { $transition="validate" $method="start"
>>> >> >>}manipulatio
>>> >> >> >> n { method { $name="$init" }method { $name="start" }method {
>>> >> >>$name="s
>>> >> >> >> top" }}}
>>> >> >> >> Built-By: clement
>>> >> >> >> Tool: Bnd-0.0.249
>>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>>> >> >> >> Bundle-Version: 1.8.2
>>> >> >> >> Build-Jdk: 1.6.0_31
>>> >> >> >> Bnd-LastModified: 1350001458935
>>> >> >> >> Bundle-ManifestVersion: 2
>>> >> >> >> Bundle-Description: iPOJO Annotations
>>> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>>> >> >> >> Bundle-DocURL:
>>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>>> >> >> >> ns.html
>>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>>> >> >>org.apache.felix.ipo
>>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>> >> >>org.apache.f
>>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>>> >> >>org.apache.felix.ipojo.extende
>>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>>> >> >>org.apache.felix.ipojo;version=
>>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>> >> >>org.apache.felix.ipojo.
>>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>> >> >>org.apache.felix.ipojo
>>> >> >> >> .annotations, cook.michael
>>> >> >> >> Bundle-SymbolicName: iPojoTest
>>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> On 10/11/12 7:54 PM, "G�kt�rk Gezer" <go...@gmail.com>
>>> >> wrote:
>>> >> >> >>
>>> >> >> >> >Hi,
>>> >> >> >> >
>>> >> >> >> >First of all @Component is mandatory.(For annotation based
>>> >>usage).
>>> >> >> >> >
>>> >> >> >> >But this only defines your component. To actually instantiate
>>>it
>>> >>you
>>> >> >> >> >should
>>> >> >> >> >do it deliberately. One way to do that is using @Instantiate
>>> >> >> >>annotation.
>>> >> >> >> >
>>> >> >> >> >So your code would be like:
>>> >> >> >> >
>>> >> >> >> >@Component
>>> >> >> >> >@Instantiate
>>> >> >> >> >public class foo{
>>> >> >> >> >
>>> >> >> >> > @Validate
>>> >> >> >> > public void start()
>>> >> >> >> >..........
>>> >> >> >> >..........
>>> >> >> >> >}
>>> >> >> >> >
>>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>>> >> >> >> >
>>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
>>>the
>>> >> >> >> >>@Component.
>>> >> >> >> >> Same result. No output.
>>> >> >> >> >>
>>> >> >> >> >> Mike
>>> >> >> >> >> Michael Cook
>>> >> >> >> >> VP Technology Innovation
>>> >> >> >> >> Comcast
>>> >> >> >> >> One Comcast Center
>>> >> >> >> >> Philadelphia, PA 19103
>>> >> >> >> >> (o) 215-286-8260
>>> >> >> >> >> (m) 609-458-0332
>>> >> >> >> >>
>>> >> >> >> >> ----- Original Message -----
>>> >> >> >> >> From: Cook, Michael J. (OCTO)
>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>> >> >> >> >>
>>> >> >> >> >> I used @validate/@invalidate alone.
>>> >> >> >> >>
>>> >> >> >> >> Mike
>>> >> >> >> >>
>>> >> >> >> >> Michael Cook
>>> >> >> >> >> VP Technology Innovation
>>> >> >> >> >> Comcast
>>> >> >> >> >> One Comcast Center
>>> >> >> >> >> Philadelphia, PA 19103
>>> >> >> >> >> (o) 215-286-8260
>>> >> >> >> >> (m) 609-458-0332
>>> >> >> >> >>
>>> >> >> >> >> ----- Original Message -----
>>> >> >> >> >> From: G�kt�rk Gezer [mailto:gokturk.gezer@gmail.com]
>>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>>> >> >> >> >>
>>> >> >> >> >> Hi,
>>> >> >> >> >>
>>> >> >> >> >> I need to ask this first since it's not on your code
>>>snippet:
>>> >>Did
>>> >> >>you
>>> >> >> >> >>use
>>> >> >> >> >> @Component annotation for class where you've declared your
>>> >>start()
>>> >> >> >> >>stop()
>>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >> *Regards,*
>>> >> >> >> >> *Gokturk*
>>> >> >> >> >>
>>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>>> >> >> >> >>
>>> >> >> >> >> > Hi,
>>> >> >> >> >> >
>>> >> >> >> >> > I can't seem to find a good article that will help me
>>>resolve
>>> >> >>the
>>> >> >> >> >> "getting
>>> >> >> >> >> > started" issue I am facing.
>>> >> >> >> >> >
>>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>>> >> >> >> >> >
>>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>>> >>from:
>>> >> >> >> >> > http://clement.plop-plop.net/update/
>>> >> >> >> >> >
>>> >> >> >> >> > I have created a sample project following the
>>>instructions
>>> >>at:
>>> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>>> >> >> >> >> >
>>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>>>following
>>> >> >> >> >>instructions
>>> >> >> >> >> > here:
>>> >> >> >>
>>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>>> >> >> >> >> >
>>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>>> >> >> >> >> >
>>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>>>installed
>>> >> >>the
>>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>>> >> >> >> >> >
>>> >> >> >> >> > I've created a test bundle using iPOJO called
>>>iPojoTest.jar
>>> >>and
>>> >> >> >>I've
>>> >> >> >> >> > installed it and started it in the OSGI console.
>>> >> >> >> >> >
>>> >> >> >> >> > I run bundles in the console and I get:
>>> >> >> >> >> >
>>> >> >> >> >> > g! bundles
>>> >> >> >> >> >
>>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework
>>>(3.0.7)
>>> >> >> >> >> >
>>> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>>> >> >>(1.6.2)
>>> >> >> >> >> >
>>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
>>>(0.6.1)
>>> >> >> >> >> >
>>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
>>>(0.6.1)
>>> >> >> >> >> >
>>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>>>(0.6.1)
>>> >> >> >> >> >
>>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>>> >> >> >> >> >
>>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> > So, the bundle seems to have started.
>>> >> >> >> >> >
>>> >> >> >> >> > But I don't get any console output from my sysouts�
>>> >> >> >> >> >
>>> >> >> >> >> > Here are the start() and stop() methods:
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> > @Validate
>>> >> >> >> >> >
>>> >> >> >> >> > public void start() throws IOException {
>>> >> >> >> >> >
>>> >> >> >> >> > System.out.println("I'm starting...");
>>> >> >> >> >> >
>>> >> >> >> >> > try{
>>> >> >> >> >> >
>>> >> >> >> >> > // Create file
>>> >> >> >> >> >
>>> >> >> >> >> > FileWriter fstream = new
>>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>>> >> >> >> >> >
>>> >> >> >> >> > BufferedWriter out = new
>>> >> >>BufferedWriter(fstream);
>>> >> >> >> >> >
>>> >> >> >> >> > out.write("Hello Java");
>>> >> >> >> >> >
>>> >> >> >> >> > //Close the output stream
>>> >> >> >> >> >
>>> >> >> >> >> > out.close();
>>> >> >> >> >> >
>>> >> >> >> >> > }catch (Exception e){//Catch exception
>>>if
>>> >>any
>>> >> >> >> >> >
>>> >> >> >> >> > System.err.println("Error: " +
>>> >> >>e.getMessage());
>>> >> >> >> >> >
>>> >> >> >> >> > }
>>> >> >> >> >> >
>>> >> >> >> >> > throw new IOException() ;
>>> >> >> >> >> >
>>> >> >> >> >> > }
>>> >> >> >> >> >
>>> >> >> >> >> > @Invalidate
>>> >> >> >> >> >
>>> >> >> >> >> > public void stop() {
>>> >> >> >> >> >
>>> >> >> >> >> > System.out.println("I'm leaving !");
>>> >> >> >> >> >
>>> >> >> >> >> > }
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> > I added in the file write to see if a file would be
>>>created.
>>> >> >>There
>>> >> >> >> >>is no
>>> >> >> >> >> > file created. So, while OSGi thinks the bundle is
>>>ACTIVE,
>>> >>the
>>> >> >> >>start
>>> >> >> >> >> method
>>> >> >> >> >> > appears never have to been called.
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> > Can anyone tell me what I may have done wrong or provide
>>>a
>>> >>clue
>>> >> >>as
>>> >> >> >>to
>>> >> >> >> >> what
>>> >> >> >> >> > to look at to help diagnose the problem?
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> > Thanks,
>>> >> >> >> >> >
>>> >> >> >> >> > Mike
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >>---------------------------------------------------------------------
>>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>> >> >> >>
>>> >> >> >>
>>> >> >>
>>> >> >>
>>> >> >>
>>>---------------------------------------------------------------------
>>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>>> >> >>
>>> >> >>
>>> >>
>>> >>
>>> >>
>>>---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> >> For additional commands, e-mail: users-help@felix.apache.org
>>> >>
>>> >>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
OK,
Here it is inline (and attached).
Manifest-Version: 1.0
Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
l
iPOJO-Components: component { $classname="cook.michael.BogusClass" man
ipulation { method { $name="$init" }}}
Built-By: clement
Tool: Bnd-0.0.249
Bundle-Name: Apache Felix iPOJO Annotations
Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
Bundle-Vendor: The Apache Software Foundation
Bundle-Version: 1.8.2
Build-Jdk: 1.6.0_31
Bnd-LastModified: 1350043925031
Bundle-ManifestVersion: 2
Bundle-Description: iPOJO Annotations
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
ns.html
Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
.annotations, cook.michael
Bundle-SymbolicName: iPojoTest
Originally-Created-By: Apache Maven Bundle Plugin
Mike
On 10/11/12 10:40 PM, "G�kt�rk Gezer" <go...@gmail.com> wrote:
>I wanted MANIFEST.MF file actually :/
>
>On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
>Michael_J_Cook@cable.comcast.com> wrote:
>
>> Hmmm...
>>
>> Here's my metadata.xml...
>>
>> I get the following error:
>>
>> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
>> org.apache.felix.ipojo.ComponentFactory
>> org.apache.felix.ipojo.ConfigurationException: A component needs a class
>> name : component immediate="true"
>> at
>> org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
>> at
>>
>>org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>Method)
>> at
>>
>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAc
>>ce
>> ssorImpl.java:39)
>> at
>>
>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConst
>>ru
>> ctorAccessorImpl.java:27)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> at
>> org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
>> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
>> at
>>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>> at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>> at java.lang.Thread.run(Thread.java:680)
>>
>>
>> Here's what I had for the Bogus Class case on the metadata.xml:
>>
>> <ipojo>
>> <component className="cook.michael.BogusClass"/>
>> </ipojo>
>>
>>
>>
>> Mike
>>
>>
>>
>> On 10/11/12 10:23 PM, "G�kt�rk Gezer" <go...@gmail.com> wrote:
>>
>> >Just to be on the same page I installed eclipse-ipojo-plugin too.
>> >
>> >First finding : you don't need a bogus component. You can just type
>> ><ipojo>
>> ><component/>
>> ></ipojo>
>> >
>> >inside you metadata.xml and it'll pass silently.
>> >
>> >Besides you might be hitting a bug we've fixed in trunk, because in the
>> >same scenario I suggested to you I saw some elements in MANIFEST which
>> >shouldn't be there.
>> >Could you share me your MANIFEST for the final state(bogus
>>metadata.xml +
>> >annotations)?
>> >
>> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>> >Michael_J_Cook@cable.comcast.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> >>Could you tell me what happens when you remove the <ipojo/> element
>> >>too
>> >> >>leaving the metadata.xml empty?
>> >>
>> >>
>> >> I get an error when there is no contents in the metadata.xml file.
>> >>
>> >> >>I could suggest you a trick to define a bogus
>> >> >>component inside metadata.xml(Will require you to maintain a bogus
>> >>class)
>> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>> >>along
>> >> >>its way with annotations.
>> >>
>> >>
>> >> I added a bogus class into the cook.michael package and put the
>> >> @Component/@Instantiate/@Validate/@Invalidate back into the code.
>>Then
>> >> added this component to the metadata.xml file:
>> >> <ipojo>
>> >> <component className="cook.michael.BogusClass"/>
>> >> </ipojo>
>> >>
>> >>
>> >>
>> >> The above results in the start and stop not being invoked.
>> >>
>> >> >>Instead of embedding Felix into eclipse you can use its own Equinox
>> >> >>launcher.
>> >>
>> >> I'm developing atop Felix, because the target device is Felix based,
>>so
>> >>I
>> >> would like to keep it on the same platform.
>> >>
>> >>
>> >> Thank you for your help.
>> >> Mike
>> >>
>> >>
>> >> On 10/11/12 9:47 PM, "G�kt�rk Gezer" <go...@gmail.com> wrote:
>> >>
>> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >
>> >> >> G�kt�rk,
>> >> >>
>> >> >> Thank you! I used #2 below and it worked well. I was able to
>>launch
>> >>the
>> >> >> bundle, and I saw it output the traces I had been looking for.
>> >> >>
>> >> >
>> >> >Cool !
>> >> >
>> >> >
>> >> >>
>> >> >> On the first, if I remove the contents of the metadata.xml file,
>>how
>> >> >>can I
>> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>> >>element,
>> >> >>and
>> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither component
>> >> >>types,
>> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called,
>>although
>> >>the
>> >> >> class is marked with @Component and @Instantiate and start/stop is
>> >> >>marked
>> >> >> with @Validate/@Invalidate.
>> >> >>
>> >> >
>> >> >Well, I actually never used eclipse-ipojo-plugin before but it seems
>> >>to be
>> >> >dependent on metadata.xml but also sees the annotations on its way.
>> >> >
>> >> >Could you tell me what happens when you remove the <ipojo/> element
>>too
>> >> >leaving the metadata.xml empty?
>> >>
>> >> >
>> >> >If above trick didn't work and you want to stick with
>> >>eclipse-ipojo-plugin
>> >> >while using annotations. I could suggest you a trick to define a
>>bogus
>> >> >component inside metadata.xml(Will require you to maintain a bogus
>> >>class)
>> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>> >>along
>> >> >its way with annotations.
>> >> >
>> >> >Also it seems to me that your development environment is heavy.
>> >>Instead of
>> >> >embedding Felix into eclipse you can use its own Equinox launcher.
>> >> >I suggest you to have a look at
>> >>
>> >>>
>> http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>> >> >where
>> >> >you can see basic setup.(You can use annotations or metadata of your
>> >> >choice
>> >> >in this setup)
>> >> >
>> >> >
>> >> >Gokturk
>> >> >
>> >> >
>> >> >>
>> >> >> Mike
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 10/11/12 8:54 PM, "G�kt�rk Gezer" <go...@gmail.com>
>> wrote:
>> >> >>
>> >> >> >Well i thought at first that you didn't specify metadata.xml but
>>i
>> >>see
>> >> >>now
>> >> >> >that you did. Mixing metadata.xml and annotations for one single
>> >> >>component
>> >> >> >is a mistake. For same component you must go with one of them.
>> >> >> >
>> >> >> >So there are 2 different ways for you:
>> >> >> >
>> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
>> >> >>delete it
>> >> >> >or comment out the content ) and leave the annotations as it is.
>> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
>> >>remove
>> >> >>all
>> >> >> >annotations including @validate and @invalidate and make sure
>>your
>> >> >> >metadata.xml looks like this:
>> >> >> >
>> >> >> ><ipojo>
>> >> >> ><component className="cook.michael.MyComponentImpl">
>> >> >> > <callback transition="validate" method="start"/>
>> >> >> > <callback transition="invalidate" method="stop"/>
>> >> >> ></component>
>> >> >> ><instance component="cook.michael.MyComponentImpl"/>
>> >> >> ></ipojo>
>> >> >> >
>> >> >> >Either way should bring you where you want. Just don't mix
>> >>annotation
>> >> >>and
>> >> >> >metadata usage for same component.
>> >> >> >
>> >> >> >Regards,
>> >> >> >Gokturk
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >> >
>> >> >> >> Hi G�kt�rk,
>> >> >> >>
>> >> >> >> OK... Tried that. Still the same thing. There's not much to
>>my
>> >> >>code,
>> >> >> >>so
>> >> >> >> I'm including it below. Please let me know if you see
>>anything.
>> >> >> >>
>> >> >> >> Thank you for helping me,
>> >> >> >> Mike
>> >> >> >>
>> >> >> >>
>> >> >> >> MyComponentImpl.java:
>> >> >> >>
>> >> >> >> package cook.michael;
>> >> >> >>
>> >> >> >> import java.io.BufferedWriter;
>> >> >> >> import java.io.File;
>> >> >> >> import java.io.FileWriter;
>> >> >> >> import java.io.IOException;
>> >> >> >>
>> >> >> >> import org.apache.felix.ipojo.annotations.Component;
>> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
>> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>> >> >> >>
>> >> >> >> @Component
>> >> >> >> @Instantiate
>> >> >> >> public class MyComponentImpl {
>> >> >> >>
>> >> >> >> @Validate
>> >> >> >> public void start() throws IOException {
>> >> >> >> System.err.println("Starting: " );
>> >> >> >>
>> >> >> >> System.out.println("I'm starting...");
>> >> >> >> try{
>> >> >> >> // Create file
>> >> >> >> FileWriter fstream = new
>> >> >> >>FileWriter("/Users/mcook008/out.txt");
>> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
>> >> >> >> out.write("Hello Java");
>> >> >> >> //Close the output stream
>> >> >> >> out.close();
>> >> >> >> }catch (Exception e){//Catch exception if any
>> >> >> >> System.err.println("Error: " + e.getMessage());
>> >> >> >> }
>> >> >> >> throw new IOException() ;
>> >> >> >> }
>> >> >> >>
>> >> >> >> @Invalidate
>> >> >> >> public void stop() {
>> >> >> >> System.out.println("I'm leaving !");
>> >> >> >> }
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >> metadata.xml:
>> >> >> >>
>> >> >> >> <ipojo>
>> >> >> >> <component className="cook.michael.MyComponentImpl"/>
>> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
>> >> >> >> </ipojo>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> iPojoTest.bnd:
>> >> >> >>
>> >> >> >> Import-Package: *
>> >> >> >> Export-Package: *
>> >> >> >> #Private-Package:
>> >> >> >>
>> >> >> >>
>> >> >> >> Generated manefest.mf:
>> >> >> >>
>> >> >> >> Manifest-Version: 1.0
>> >> >> >> Export-Package:
>> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >> >> >>
>> >>
>>>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> >> >> >>
>> >>
>>>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> >> >> >>
>> >>
>>>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> >> >> >> l
>> >> >> >> iPOJO-Components: component {
>> >> >>$classname="cook.michael.MyComponentImpl
>> >> >> >> " manipulation { method { $name="$init" }method {
>>$name="start"
>> >> >>}meth
>> >> >> >> od { $name="stop" }}}instance {
>> >> >>$component="cook.michael.MyComponentI
>> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>> >> >>$classname="co
>> >> >> >> ok.michael.MyComponentImpl" $public="true"
>> >> >>org.apache.felix.ipojo.ann
>> >> >> >> otations:instantiate { }callback { $transition="invalidate"
>> >> >>$method="
>> >> >> >> stop" }callback { $transition="validate" $method="start"
>> >> >>}manipulatio
>> >> >> >> n { method { $name="$init" }method { $name="start" }method {
>> >> >>$name="s
>> >> >> >> top" }}}
>> >> >> >> Built-By: clement
>> >> >> >> Tool: Bnd-0.0.249
>> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >> >> >> Bundle-Vendor: The Apache Software Foundation
>> >> >> >> Bundle-Version: 1.8.2
>> >> >> >> Build-Jdk: 1.6.0_31
>> >> >> >> Bnd-LastModified: 1350001458935
>> >> >> >> Bundle-ManifestVersion: 2
>> >> >> >> Bundle-Description: iPOJO Annotations
>> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> >> >> >> Bundle-DocURL:
>> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >> >> >> ns.html
>> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
>> >> >>org.apache.felix.ipo
>> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>> >> >>org.apache.f
>> >> >> >> elix.ipojo.architecture;version=0.9.0,
>> >> >>org.apache.felix.ipojo.extende
>> >> >> >> r, org.apache.felix.ipojo.whiteboard,
>> >> >>org.apache.felix.ipojo;version=
>> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>> >> >>org.apache.felix.ipojo.
>> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>> >> >>org.apache.felix.ipojo
>> >> >> >> .annotations, cook.michael
>> >> >> >> Bundle-SymbolicName: iPojoTest
>> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> On 10/11/12 7:54 PM, "G�kt�rk Gezer" <go...@gmail.com>
>> >> wrote:
>> >> >> >>
>> >> >> >> >Hi,
>> >> >> >> >
>> >> >> >> >First of all @Component is mandatory.(For annotation based
>> >>usage).
>> >> >> >> >
>> >> >> >> >But this only defines your component. To actually instantiate
>>it
>> >>you
>> >> >> >> >should
>> >> >> >> >do it deliberately. One way to do that is using @Instantiate
>> >> >> >>annotation.
>> >> >> >> >
>> >> >> >> >So your code would be like:
>> >> >> >> >
>> >> >> >> >@Component
>> >> >> >> >@Instantiate
>> >> >> >> >public class foo{
>> >> >> >> >
>> >> >> >> > @Validate
>> >> >> >> > public void start()
>> >> >> >> >..........
>> >> >> >> >..........
>> >> >> >> >}
>> >> >> >> >
>> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >> >> >
>> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing
>>the
>> >> >> >> >>@Component.
>> >> >> >> >> Same result. No output.
>> >> >> >> >>
>> >> >> >> >> Mike
>> >> >> >> >> Michael Cook
>> >> >> >> >> VP Technology Innovation
>> >> >> >> >> Comcast
>> >> >> >> >> One Comcast Center
>> >> >> >> >> Philadelphia, PA 19103
>> >> >> >> >> (o) 215-286-8260
>> >> >> >> >> (m) 609-458-0332
>> >> >> >> >>
>> >> >> >> >> ----- Original Message -----
>> >> >> >> >> From: Cook, Michael J. (OCTO)
>> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>> >> >> >> >>
>> >> >> >> >> I used @validate/@invalidate alone.
>> >> >> >> >>
>> >> >> >> >> Mike
>> >> >> >> >>
>> >> >> >> >> Michael Cook
>> >> >> >> >> VP Technology Innovation
>> >> >> >> >> Comcast
>> >> >> >> >> One Comcast Center
>> >> >> >> >> Philadelphia, PA 19103
>> >> >> >> >> (o) 215-286-8260
>> >> >> >> >> (m) 609-458-0332
>> >> >> >> >>
>> >> >> >> >> ----- Original Message -----
>> >> >> >> >> From: G�kt�rk Gezer [mailto:gokturk.gezer@gmail.com]
>> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>> >> >> >> >> Subject: Re: Getting Started with iPOJO
>> >> >> >> >>
>> >> >> >> >> Hi,
>> >> >> >> >>
>> >> >> >> >> I need to ask this first since it's not on your code
>>snippet:
>> >>Did
>> >> >>you
>> >> >> >> >>use
>> >> >> >> >> @Component annotation for class where you've declared your
>> >>start()
>> >> >> >> >>stop()
>> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> *Regards,*
>> >> >> >> >> *Gokturk*
>> >> >> >> >>
>> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>> >> >> >> >>
>> >> >> >> >> > Hi,
>> >> >> >> >> >
>> >> >> >> >> > I can't seem to find a good article that will help me
>>resolve
>> >> >>the
>> >> >> >> >> "getting
>> >> >> >> >> > started" issue I am facing.
>> >> >> >> >> >
>> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>> >> >> >> >> >
>> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>> >>from:
>> >> >> >> >> > http://clement.plop-plop.net/update/
>> >> >> >> >> >
>> >> >> >> >> > I have created a sample project following the instructions
>> >>at:
>> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >> >> >> >> >
>> >> >> >> >> > I have integrated Felix into Eclipse as a project,
>>following
>> >> >> >> >>instructions
>> >> >> >> >> > here:
>> >> >> >>
>>http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >> >> >> >> >
>> >> >> >> >> > I have downloaded the following iPOJO bundle:
>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>> >> >> >> >> >
>> >> >> >> >> > I've launched Felix in the Eclipse console and I've
>>installed
>> >> >>the
>> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>> >> >> >> >> >
>> >> >> >> >> > I've created a test bundle using iPOJO called
>>iPojoTest.jar
>> >>and
>> >> >> >>I've
>> >> >> >> >> > installed it and started it in the OSGI console.
>> >> >> >> >> >
>> >> >> >> >> > I run bundles in the console and I get:
>> >> >> >> >> >
>> >> >> >> >> > g! bundles
>> >> >> >> >> >
>> >> >> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
>> >> >> >> >> >
>> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>> >> >>(1.6.2)
>> >> >> >> >> >
>> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command
>>(0.6.1)
>> >> >> >> >> >
>> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime
>>(0.6.1)
>> >> >> >> >> >
>> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell
>>(0.6.1)
>> >> >> >> >> >
>> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>> >> >> >> >> >
>> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > So, the bundle seems to have started.
>> >> >> >> >> >
>> >> >> >> >> > But I don't get any console output from my sysouts�
>> >> >> >> >> >
>> >> >> >> >> > Here are the start() and stop() methods:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > @Validate
>> >> >> >> >> >
>> >> >> >> >> > public void start() throws IOException {
>> >> >> >> >> >
>> >> >> >> >> > System.out.println("I'm starting...");
>> >> >> >> >> >
>> >> >> >> >> > try{
>> >> >> >> >> >
>> >> >> >> >> > // Create file
>> >> >> >> >> >
>> >> >> >> >> > FileWriter fstream = new
>> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>> >> >> >> >> >
>> >> >> >> >> > BufferedWriter out = new
>> >> >>BufferedWriter(fstream);
>> >> >> >> >> >
>> >> >> >> >> > out.write("Hello Java");
>> >> >> >> >> >
>> >> >> >> >> > //Close the output stream
>> >> >> >> >> >
>> >> >> >> >> > out.close();
>> >> >> >> >> >
>> >> >> >> >> > }catch (Exception e){//Catch exception
>>if
>> >>any
>> >> >> >> >> >
>> >> >> >> >> > System.err.println("Error: " +
>> >> >>e.getMessage());
>> >> >> >> >> >
>> >> >> >> >> > }
>> >> >> >> >> >
>> >> >> >> >> > throw new IOException() ;
>> >> >> >> >> >
>> >> >> >> >> > }
>> >> >> >> >> >
>> >> >> >> >> > @Invalidate
>> >> >> >> >> >
>> >> >> >> >> > public void stop() {
>> >> >> >> >> >
>> >> >> >> >> > System.out.println("I'm leaving !");
>> >> >> >> >> >
>> >> >> >> >> > }
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > I added in the file write to see if a file would be
>>created.
>> >> >>There
>> >> >> >> >>is no
>> >> >> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE,
>> >>the
>> >> >> >>start
>> >> >> >> >> method
>> >> >> >> >> > appears never have to been called.
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > Can anyone tell me what I may have done wrong or provide a
>> >>clue
>> >> >>as
>> >> >> >>to
>> >> >> >> >> what
>> >> >> >> >> > to look at to help diagnose the problem?
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > Thanks,
>> >> >> >> >> >
>> >> >> >> >> > Mike
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >>---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>>---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
I wanted MANIFEST.MF file actually :/
On Fri, Oct 12, 2012 at 5:35 AM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hmmm...
>
> Here's my metadata.xml...
>
> I get the following error:
>
> [ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
> org.apache.felix.ipojo.ComponentFactory
> org.apache.felix.ipojo.ConfigurationException: A component needs a class
> name : component immediate="true"
> at
> org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
> at
> org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcce
> ssorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstru
> ctorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at
> org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
> at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
> at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
> at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
> at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
> at java.lang.Thread.run(Thread.java:680)
>
>
> Here's what I had for the Bogus Class case on the metadata.xml:
>
> <ipojo>
> <component className="cook.michael.BogusClass"/>
> </ipojo>
>
>
>
> Mike
>
>
>
> On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>
> >Just to be on the same page I installed eclipse-ipojo-plugin too.
> >
> >First finding : you don't need a bogus component. You can just type
> ><ipojo>
> ><component/>
> ></ipojo>
> >
> >inside you metadata.xml and it'll pass silently.
> >
> >Besides you might be hitting a bug we've fixed in trunk, because in the
> >same scenario I suggested to you I saw some elements in MANIFEST which
> >shouldn't be there.
> >Could you share me your MANIFEST for the final state(bogus metadata.xml +
> >annotations)?
> >
> >On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
> >Michael_J_Cook@cable.comcast.com> wrote:
> >
> >> Hi,
> >>
> >> >>Could you tell me what happens when you remove the <ipojo/> element
> >>too
> >> >>leaving the metadata.xml empty?
> >>
> >>
> >> I get an error when there is no contents in the metadata.xml file.
> >>
> >> >>I could suggest you a trick to define a bogus
> >> >>component inside metadata.xml(Will require you to maintain a bogus
> >>class)
> >> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and move
> >>along
> >> >>its way with annotations.
> >>
> >>
> >> I added a bogus class into the cook.michael package and put the
> >> @Component/@Instantiate/@Validate/@Invalidate back into the code. Then
> >> added this component to the metadata.xml file:
> >> <ipojo>
> >> <component className="cook.michael.BogusClass"/>
> >> </ipojo>
> >>
> >>
> >>
> >> The above results in the start and stop not being invoked.
> >>
> >> >>Instead of embedding Felix into eclipse you can use its own Equinox
> >> >>launcher.
> >>
> >> I'm developing atop Felix, because the target device is Felix based, so
> >>I
> >> would like to keep it on the same platform.
> >>
> >>
> >> Thank you for your help.
> >> Mike
> >>
> >>
> >> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
> >>
> >> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >
> >> >> Göktürk,
> >> >>
> >> >> Thank you! I used #2 below and it worked well. I was able to launch
> >>the
> >> >> bundle, and I saw it output the traces I had been looking for.
> >> >>
> >> >
> >> >Cool !
> >> >
> >> >
> >> >>
> >> >> On the first, if I remove the contents of the metadata.xml file, how
> >> >>can I
> >> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
> >>element,
> >> >>and
> >> >> I run iPOJO's "Create Bundle", I get a warning: "Neither component
> >> >>types,
> >> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
> >> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called, although
> >>the
> >> >> class is marked with @Component and @Instantiate and start/stop is
> >> >>marked
> >> >> with @Validate/@Invalidate.
> >> >>
> >> >
> >> >Well, I actually never used eclipse-ipojo-plugin before but it seems
> >>to be
> >> >dependent on metadata.xml but also sees the annotations on its way.
> >> >
> >> >Could you tell me what happens when you remove the <ipojo/> element too
> >> >leaving the metadata.xml empty?
> >>
> >> >
> >> >If above trick didn't work and you want to stick with
> >>eclipse-ipojo-plugin
> >> >while using annotations. I could suggest you a trick to define a bogus
> >> >component inside metadata.xml(Will require you to maintain a bogus
> >>class)
> >> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
> >>along
> >> >its way with annotations.
> >> >
> >> >Also it seems to me that your development environment is heavy.
> >>Instead of
> >> >embedding Felix into eclipse you can use its own Equinox launcher.
> >> >I suggest you to have a look at
> >>
> >>>
> http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
> >> >where
> >> >you can see basic setup.(You can use annotations or metadata of your
> >> >choice
> >> >in this setup)
> >> >
> >> >
> >> >Gokturk
> >> >
> >> >
> >> >>
> >> >> Mike
> >> >>
> >> >>
> >> >>
> >> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com>
> wrote:
> >> >>
> >> >> >Well i thought at first that you didn't specify metadata.xml but i
> >>see
> >> >>now
> >> >> >that you did. Mixing metadata.xml and annotations for one single
> >> >>component
> >> >> >is a mistake. For same component you must go with one of them.
> >> >> >
> >> >> >So there are 2 different ways for you:
> >> >> >
> >> >> >1- Using only annotations: Just disable the metadata.xml (easily
> >> >>delete it
> >> >> >or comment out the content ) and leave the annotations as it is.
> >> >> >2- Using only medata.xml: If you want to use metadata.xml then
> >>remove
> >> >>all
> >> >> >annotations including @validate and @invalidate and make sure your
> >> >> >metadata.xml looks like this:
> >> >> >
> >> >> ><ipojo>
> >> >> ><component className="cook.michael.MyComponentImpl">
> >> >> > <callback transition="validate" method="start"/>
> >> >> > <callback transition="invalidate" method="stop"/>
> >> >> ></component>
> >> >> ><instance component="cook.michael.MyComponentImpl"/>
> >> >> ></ipojo>
> >> >> >
> >> >> >Either way should bring you where you want. Just don't mix
> >>annotation
> >> >>and
> >> >> >metadata usage for same component.
> >> >> >
> >> >> >Regards,
> >> >> >Gokturk
> >> >> >
> >> >> >
> >> >> >
> >> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >> >
> >> >> >> Hi Göktürk,
> >> >> >>
> >> >> >> OK... Tried that. Still the same thing. There's not much to my
> >> >>code,
> >> >> >>so
> >> >> >> I'm including it below. Please let me know if you see anything.
> >> >> >>
> >> >> >> Thank you for helping me,
> >> >> >> Mike
> >> >> >>
> >> >> >>
> >> >> >> MyComponentImpl.java:
> >> >> >>
> >> >> >> package cook.michael;
> >> >> >>
> >> >> >> import java.io.BufferedWriter;
> >> >> >> import java.io.File;
> >> >> >> import java.io.FileWriter;
> >> >> >> import java.io.IOException;
> >> >> >>
> >> >> >> import org.apache.felix.ipojo.annotations.Component;
> >> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
> >> >> >> import org.apache.felix.ipojo.annotations.Validate;
> >> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
> >> >> >>
> >> >> >> @Component
> >> >> >> @Instantiate
> >> >> >> public class MyComponentImpl {
> >> >> >>
> >> >> >> @Validate
> >> >> >> public void start() throws IOException {
> >> >> >> System.err.println("Starting: " );
> >> >> >>
> >> >> >> System.out.println("I'm starting...");
> >> >> >> try{
> >> >> >> // Create file
> >> >> >> FileWriter fstream = new
> >> >> >>FileWriter("/Users/mcook008/out.txt");
> >> >> >> BufferedWriter out = new BufferedWriter(fstream);
> >> >> >> out.write("Hello Java");
> >> >> >> //Close the output stream
> >> >> >> out.close();
> >> >> >> }catch (Exception e){//Catch exception if any
> >> >> >> System.err.println("Error: " + e.getMessage());
> >> >> >> }
> >> >> >> throw new IOException() ;
> >> >> >> }
> >> >> >>
> >> >> >> @Invalidate
> >> >> >> public void stop() {
> >> >> >> System.out.println("I'm leaving !");
> >> >> >> }
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >> metadata.xml:
> >> >> >>
> >> >> >> <ipojo>
> >> >> >> <component className="cook.michael.MyComponentImpl"/>
> >> >> >> <instance component="cook.michael.MyComponentImpl"/>
> >> >> >> </ipojo>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> iPojoTest.bnd:
> >> >> >>
> >> >> >> Import-Package: *
> >> >> >> Export-Package: *
> >> >> >> #Private-Package:
> >> >> >>
> >> >> >>
> >> >> >> Generated manefest.mf:
> >> >> >>
> >> >> >> Manifest-Version: 1.0
> >> >> >> Export-Package:
> >> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >> >> >>
> >> >>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >> >> >>
> >> >>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >> >> >>
> >> >>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >> >> >> l
> >> >> >> iPOJO-Components: component {
> >> >>$classname="cook.michael.MyComponentImpl
> >> >> >> " manipulation { method { $name="$init" }method { $name="start"
> >> >>}meth
> >> >> >> od { $name="stop" }}}instance {
> >> >>$component="cook.michael.MyComponentI
> >> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
> >> >>$classname="co
> >> >> >> ok.michael.MyComponentImpl" $public="true"
> >> >>org.apache.felix.ipojo.ann
> >> >> >> otations:instantiate { }callback { $transition="invalidate"
> >> >>$method="
> >> >> >> stop" }callback { $transition="validate" $method="start"
> >> >>}manipulatio
> >> >> >> n { method { $name="$init" }method { $name="start" }method {
> >> >>$name="s
> >> >> >> top" }}}
> >> >> >> Built-By: clement
> >> >> >> Tool: Bnd-0.0.249
> >> >> >> Bundle-Name: Apache Felix iPOJO Annotations
> >> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >> >> >> Bundle-Vendor: The Apache Software Foundation
> >> >> >> Bundle-Version: 1.8.2
> >> >> >> Build-Jdk: 1.6.0_31
> >> >> >> Bnd-LastModified: 1350001458935
> >> >> >> Bundle-ManifestVersion: 2
> >> >> >> Bundle-Description: iPOJO Annotations
> >> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> >> >> >> Bundle-DocURL:
> >> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >> >> >> ns.html
> >> >> >> Import-Package: org.osgi.service.log;version=1.3,
> >> >>org.apache.felix.ipo
> >> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
> >> >>org.apache.f
> >> >> >> elix.ipojo.architecture;version=0.9.0,
> >> >>org.apache.felix.ipojo.extende
> >> >> >> r, org.apache.felix.ipojo.whiteboard,
> >> >>org.apache.felix.ipojo;version=
> >> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
> >> >>org.apache.felix.ipojo.
> >> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
> >> >>org.apache.felix.ipojo
> >> >> >> .annotations, cook.michael
> >> >> >> Bundle-SymbolicName: iPojoTest
> >> >> >> Originally-Created-By: Apache Maven Bundle Plugin
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
> >> wrote:
> >> >> >>
> >> >> >> >Hi,
> >> >> >> >
> >> >> >> >First of all @Component is mandatory.(For annotation based
> >>usage).
> >> >> >> >
> >> >> >> >But this only defines your component. To actually instantiate it
> >>you
> >> >> >> >should
> >> >> >> >do it deliberately. One way to do that is using @Instantiate
> >> >> >>annotation.
> >> >> >> >
> >> >> >> >So your code would be like:
> >> >> >> >
> >> >> >> >@Component
> >> >> >> >@Instantiate
> >> >> >> >public class foo{
> >> >> >> >
> >> >> >> > @Validate
> >> >> >> > public void start()
> >> >> >> >..........
> >> >> >> >..........
> >> >> >> >}
> >> >> >> >
> >> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
> >> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >> >> >
> >> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
> >> >> >> >> @Invalidate/@validate on the methods. Just tried removing the
> >> >> >> >>@Component.
> >> >> >> >> Same result. No output.
> >> >> >> >>
> >> >> >> >> Mike
> >> >> >> >> Michael Cook
> >> >> >> >> VP Technology Innovation
> >> >> >> >> Comcast
> >> >> >> >> One Comcast Center
> >> >> >> >> Philadelphia, PA 19103
> >> >> >> >> (o) 215-286-8260
> >> >> >> >> (m) 609-458-0332
> >> >> >> >>
> >> >> >> >> ----- Original Message -----
> >> >> >> >> From: Cook, Michael J. (OCTO)
> >> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
> >> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
> >> >> >> >> Subject: Re: Getting Started with iPOJO
> >> >> >> >>
> >> >> >> >> I used @validate/@invalidate alone.
> >> >> >> >>
> >> >> >> >> Mike
> >> >> >> >>
> >> >> >> >> Michael Cook
> >> >> >> >> VP Technology Innovation
> >> >> >> >> Comcast
> >> >> >> >> One Comcast Center
> >> >> >> >> Philadelphia, PA 19103
> >> >> >> >> (o) 215-286-8260
> >> >> >> >> (m) 609-458-0332
> >> >> >> >>
> >> >> >> >> ----- Original Message -----
> >> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> >> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
> >> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
> >> >> >> >> Subject: Re: Getting Started with iPOJO
> >> >> >> >>
> >> >> >> >> Hi,
> >> >> >> >>
> >> >> >> >> I need to ask this first since it's not on your code snippet:
> >>Did
> >> >>you
> >> >> >> >>use
> >> >> >> >> @Component annotation for class where you've declared your
> >>start()
> >> >> >> >>stop()
> >> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> *Regards,*
> >> >> >> >> *Gokturk*
> >> >> >> >>
> >> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
> >> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
> >> >> >> >>
> >> >> >> >> > Hi,
> >> >> >> >> >
> >> >> >> >> > I can't seem to find a good article that will help me resolve
> >> >>the
> >> >> >> >> "getting
> >> >> >> >> > started" issue I am facing.
> >> >> >> >> >
> >> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
> >> >> >> >> >
> >> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
> >>from:
> >> >> >> >> > http://clement.plop-plop.net/update/
> >> >> >> >> >
> >> >> >> >> > I have created a sample project following the instructions
> >>at:
> >> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >> >> >> >> >
> >> >> >> >> > I have integrated Felix into Eclipse as a project, following
> >> >> >> >>instructions
> >> >> >> >> > here:
> >> >> >> http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >> >> >> >> >
> >> >> >> >> > I have downloaded the following iPOJO bundle:
> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
> >> >> >> >> >
> >> >> >> >> > I've launched Felix in the Eclipse console and I've installed
> >> >>the
> >> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >> >> >> >> >
> >> >> >> >> > I've created a test bundle using iPOJO called iPojoTest.jar
> >>and
> >> >> >>I've
> >> >> >> >> > installed it and started it in the OSGI console.
> >> >> >> >> >
> >> >> >> >> > I run bundles in the console and I get:
> >> >> >> >> >
> >> >> >> >> > g! bundles
> >> >> >> >> >
> >> >> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
> >> >> >> >> >
> >> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
> >> >>(1.6.2)
> >> >> >> >> >
> >> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
> >> >> >> >> >
> >> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
> >> >> >> >> >
> >> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
> >> >> >> >> >
> >> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
> >> >> >> >> >
> >> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > So, the bundle seems to have started.
> >> >> >> >> >
> >> >> >> >> > But I don't get any console output from my sysoutsŠ
> >> >> >> >> >
> >> >> >> >> > Here are the start() and stop() methods:
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > @Validate
> >> >> >> >> >
> >> >> >> >> > public void start() throws IOException {
> >> >> >> >> >
> >> >> >> >> > System.out.println("I'm starting...");
> >> >> >> >> >
> >> >> >> >> > try{
> >> >> >> >> >
> >> >> >> >> > // Create file
> >> >> >> >> >
> >> >> >> >> > FileWriter fstream = new
> >> >> >> >> > FileWriter("/Users/mcook008/out.txt");
> >> >> >> >> >
> >> >> >> >> > BufferedWriter out = new
> >> >>BufferedWriter(fstream);
> >> >> >> >> >
> >> >> >> >> > out.write("Hello Java");
> >> >> >> >> >
> >> >> >> >> > //Close the output stream
> >> >> >> >> >
> >> >> >> >> > out.close();
> >> >> >> >> >
> >> >> >> >> > }catch (Exception e){//Catch exception if
> >>any
> >> >> >> >> >
> >> >> >> >> > System.err.println("Error: " +
> >> >>e.getMessage());
> >> >> >> >> >
> >> >> >> >> > }
> >> >> >> >> >
> >> >> >> >> > throw new IOException() ;
> >> >> >> >> >
> >> >> >> >> > }
> >> >> >> >> >
> >> >> >> >> > @Invalidate
> >> >> >> >> >
> >> >> >> >> > public void stop() {
> >> >> >> >> >
> >> >> >> >> > System.out.println("I'm leaving !");
> >> >> >> >> >
> >> >> >> >> > }
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > I added in the file write to see if a file would be created.
> >> >>There
> >> >> >> >>is no
> >> >> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE,
> >>the
> >> >> >>start
> >> >> >> >> method
> >> >> >> >> > appears never have to been called.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Can anyone tell me what I may have done wrong or provide a
> >>clue
> >> >>as
> >> >> >>to
> >> >> >> >> what
> >> >> >> >> > to look at to help diagnose the problem?
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Thanks,
> >> >> >> >> >
> >> >> >> >> > Mike
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >>---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> >> >> For additional commands, e-mail: users-help@felix.apache.org
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> >> For additional commands, e-mail: users-help@felix.apache.org
> >> >>
> >> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Hmmm...
Here's my metadata.xml...
I get the following error:
[ERROR] IPOJO-Extender : Cannot instantiate an abstract factory from
org.apache.felix.ipojo.ComponentFactory
org.apache.felix.ipojo.ConfigurationException: A component needs a class
name : component immediate="true"
at
org.apache.felix.ipojo.ComponentFactory.check(ComponentFactory.java:145)
at
org.apache.felix.ipojo.ComponentFactory.<init>(ComponentFactory.java:121)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcce
ssorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstru
ctorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:500)
at org.apache.felix.ipojo.Extender.parse(Extender.java:301)
at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
at java.lang.Thread.run(Thread.java:680)
Here's what I had for the Bogus Class case on the metadata.xml:
<ipojo>
<component className="cook.michael.BogusClass"/>
</ipojo>
Mike
On 10/11/12 10:23 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>Just to be on the same page I installed eclipse-ipojo-plugin too.
>
>First finding : you don't need a bogus component. You can just type
><ipojo>
><component/>
></ipojo>
>
>inside you metadata.xml and it'll pass silently.
>
>Besides you might be hitting a bug we've fixed in trunk, because in the
>same scenario I suggested to you I saw some elements in MANIFEST which
>shouldn't be there.
>Could you share me your MANIFEST for the final state(bogus metadata.xml +
>annotations)?
>
>On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
>Michael_J_Cook@cable.comcast.com> wrote:
>
>> Hi,
>>
>> >>Could you tell me what happens when you remove the <ipojo/> element
>>too
>> >>leaving the metadata.xml empty?
>>
>>
>> I get an error when there is no contents in the metadata.xml file.
>>
>> >>I could suggest you a trick to define a bogus
>> >>component inside metadata.xml(Will require you to maintain a bogus
>>class)
>> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>along
>> >>its way with annotations.
>>
>>
>> I added a bogus class into the cook.michael package and put the
>> @Component/@Instantiate/@Validate/@Invalidate back into the code. Then
>> added this component to the metadata.xml file:
>> <ipojo>
>> <component className="cook.michael.BogusClass"/>
>> </ipojo>
>>
>>
>>
>> The above results in the start and stop not being invoked.
>>
>> >>Instead of embedding Felix into eclipse you can use its own Equinox
>> >>launcher.
>>
>> I'm developing atop Felix, because the target device is Felix based, so
>>I
>> would like to keep it on the same platform.
>>
>>
>> Thank you for your help.
>> Mike
>>
>>
>> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>
>> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>> >Michael_J_Cook@cable.comcast.com> wrote:
>> >
>> >> Göktürk,
>> >>
>> >> Thank you! I used #2 below and it worked well. I was able to launch
>>the
>> >> bundle, and I saw it output the traces I had been looking for.
>> >>
>> >
>> >Cool !
>> >
>> >
>> >>
>> >> On the first, if I remove the contents of the metadata.xml file, how
>> >>can I
>> >> use iPOJO to generate the bundle? If I leave in the <ipojo/>
>>element,
>> >>and
>> >> I run iPOJO's "Create Bundle", I get a warning: "Neither component
>> >>types,
>> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
>> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called, although
>>the
>> >> class is marked with @Component and @Instantiate and start/stop is
>> >>marked
>> >> with @Validate/@Invalidate.
>> >>
>> >
>> >Well, I actually never used eclipse-ipojo-plugin before but it seems
>>to be
>> >dependent on metadata.xml but also sees the annotations on its way.
>> >
>> >Could you tell me what happens when you remove the <ipojo/> element too
>> >leaving the metadata.xml empty?
>>
>> >
>> >If above trick didn't work and you want to stick with
>>eclipse-ipojo-plugin
>> >while using annotations. I could suggest you a trick to define a bogus
>> >component inside metadata.xml(Will require you to maintain a bogus
>>class)
>> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move
>>along
>> >its way with annotations.
>> >
>> >Also it seems to me that your development environment is heavy.
>>Instead of
>> >embedding Felix into eclipse you can use its own Equinox launcher.
>> >I suggest you to have a look at
>>
>>>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>> >where
>> >you can see basic setup.(You can use annotations or metadata of your
>> >choice
>> >in this setup)
>> >
>> >
>> >Gokturk
>> >
>> >
>> >>
>> >> Mike
>> >>
>> >>
>> >>
>> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>> >>
>> >> >Well i thought at first that you didn't specify metadata.xml but i
>>see
>> >>now
>> >> >that you did. Mixing metadata.xml and annotations for one single
>> >>component
>> >> >is a mistake. For same component you must go with one of them.
>> >> >
>> >> >So there are 2 different ways for you:
>> >> >
>> >> >1- Using only annotations: Just disable the metadata.xml (easily
>> >>delete it
>> >> >or comment out the content ) and leave the annotations as it is.
>> >> >2- Using only medata.xml: If you want to use metadata.xml then
>>remove
>> >>all
>> >> >annotations including @validate and @invalidate and make sure your
>> >> >metadata.xml looks like this:
>> >> >
>> >> ><ipojo>
>> >> ><component className="cook.michael.MyComponentImpl">
>> >> > <callback transition="validate" method="start"/>
>> >> > <callback transition="invalidate" method="stop"/>
>> >> ></component>
>> >> ><instance component="cook.michael.MyComponentImpl"/>
>> >> ></ipojo>
>> >> >
>> >> >Either way should bring you where you want. Just don't mix
>>annotation
>> >>and
>> >> >metadata usage for same component.
>> >> >
>> >> >Regards,
>> >> >Gokturk
>> >> >
>> >> >
>> >> >
>> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >
>> >> >> Hi Göktürk,
>> >> >>
>> >> >> OK... Tried that. Still the same thing. There's not much to my
>> >>code,
>> >> >>so
>> >> >> I'm including it below. Please let me know if you see anything.
>> >> >>
>> >> >> Thank you for helping me,
>> >> >> Mike
>> >> >>
>> >> >>
>> >> >> MyComponentImpl.java:
>> >> >>
>> >> >> package cook.michael;
>> >> >>
>> >> >> import java.io.BufferedWriter;
>> >> >> import java.io.File;
>> >> >> import java.io.FileWriter;
>> >> >> import java.io.IOException;
>> >> >>
>> >> >> import org.apache.felix.ipojo.annotations.Component;
>> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
>> >> >> import org.apache.felix.ipojo.annotations.Validate;
>> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
>> >> >>
>> >> >> @Component
>> >> >> @Instantiate
>> >> >> public class MyComponentImpl {
>> >> >>
>> >> >> @Validate
>> >> >> public void start() throws IOException {
>> >> >> System.err.println("Starting: " );
>> >> >>
>> >> >> System.out.println("I'm starting...");
>> >> >> try{
>> >> >> // Create file
>> >> >> FileWriter fstream = new
>> >> >>FileWriter("/Users/mcook008/out.txt");
>> >> >> BufferedWriter out = new BufferedWriter(fstream);
>> >> >> out.write("Hello Java");
>> >> >> //Close the output stream
>> >> >> out.close();
>> >> >> }catch (Exception e){//Catch exception if any
>> >> >> System.err.println("Error: " + e.getMessage());
>> >> >> }
>> >> >> throw new IOException() ;
>> >> >> }
>> >> >>
>> >> >> @Invalidate
>> >> >> public void stop() {
>> >> >> System.out.println("I'm leaving !");
>> >> >> }
>> >> >> }
>> >> >>
>> >> >>
>> >> >> metadata.xml:
>> >> >>
>> >> >> <ipojo>
>> >> >> <component className="cook.michael.MyComponentImpl"/>
>> >> >> <instance component="cook.michael.MyComponentImpl"/>
>> >> >> </ipojo>
>> >> >>
>> >> >>
>> >> >>
>> >> >> iPojoTest.bnd:
>> >> >>
>> >> >> Import-Package: *
>> >> >> Export-Package: *
>> >> >> #Private-Package:
>> >> >>
>> >> >>
>> >> >> Generated manefest.mf:
>> >> >>
>> >> >> Manifest-Version: 1.0
>> >> >> Export-Package:
>> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >> >>
>> >>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> >> >>
>> >>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> >> >>
>> >>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> >> >> l
>> >> >> iPOJO-Components: component {
>> >>$classname="cook.michael.MyComponentImpl
>> >> >> " manipulation { method { $name="$init" }method { $name="start"
>> >>}meth
>> >> >> od { $name="stop" }}}instance {
>> >>$component="cook.michael.MyComponentI
>> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>> >>$classname="co
>> >> >> ok.michael.MyComponentImpl" $public="true"
>> >>org.apache.felix.ipojo.ann
>> >> >> otations:instantiate { }callback { $transition="invalidate"
>> >>$method="
>> >> >> stop" }callback { $transition="validate" $method="start"
>> >>}manipulatio
>> >> >> n { method { $name="$init" }method { $name="start" }method {
>> >>$name="s
>> >> >> top" }}}
>> >> >> Built-By: clement
>> >> >> Tool: Bnd-0.0.249
>> >> >> Bundle-Name: Apache Felix iPOJO Annotations
>> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >> >> Bundle-Vendor: The Apache Software Foundation
>> >> >> Bundle-Version: 1.8.2
>> >> >> Build-Jdk: 1.6.0_31
>> >> >> Bnd-LastModified: 1350001458935
>> >> >> Bundle-ManifestVersion: 2
>> >> >> Bundle-Description: iPOJO Annotations
>> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> >> >> Bundle-DocURL:
>> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >> >> ns.html
>> >> >> Import-Package: org.osgi.service.log;version=1.3,
>> >>org.apache.felix.ipo
>> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>> >>org.apache.f
>> >> >> elix.ipojo.architecture;version=0.9.0,
>> >>org.apache.felix.ipojo.extende
>> >> >> r, org.apache.felix.ipojo.whiteboard,
>> >>org.apache.felix.ipojo;version=
>> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>> >>org.apache.felix.ipojo.
>> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>> >>org.apache.felix.ipojo
>> >> >> .annotations, cook.michael
>> >> >> Bundle-SymbolicName: iPojoTest
>> >> >> Originally-Created-By: Apache Maven Bundle Plugin
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
>> wrote:
>> >> >>
>> >> >> >Hi,
>> >> >> >
>> >> >> >First of all @Component is mandatory.(For annotation based
>>usage).
>> >> >> >
>> >> >> >But this only defines your component. To actually instantiate it
>>you
>> >> >> >should
>> >> >> >do it deliberately. One way to do that is using @Instantiate
>> >> >>annotation.
>> >> >> >
>> >> >> >So your code would be like:
>> >> >> >
>> >> >> >@Component
>> >> >> >@Instantiate
>> >> >> >public class foo{
>> >> >> >
>> >> >> > @Validate
>> >> >> > public void start()
>> >> >> >..........
>> >> >> >..........
>> >> >> >}
>> >> >> >
>> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >> >
>> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>> >> >> >> @Invalidate/@validate on the methods. Just tried removing the
>> >> >> >>@Component.
>> >> >> >> Same result. No output.
>> >> >> >>
>> >> >> >> Mike
>> >> >> >> Michael Cook
>> >> >> >> VP Technology Innovation
>> >> >> >> Comcast
>> >> >> >> One Comcast Center
>> >> >> >> Philadelphia, PA 19103
>> >> >> >> (o) 215-286-8260
>> >> >> >> (m) 609-458-0332
>> >> >> >>
>> >> >> >> ----- Original Message -----
>> >> >> >> From: Cook, Michael J. (OCTO)
>> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> >> >> >> Subject: Re: Getting Started with iPOJO
>> >> >> >>
>> >> >> >> I used @validate/@invalidate alone.
>> >> >> >>
>> >> >> >> Mike
>> >> >> >>
>> >> >> >> Michael Cook
>> >> >> >> VP Technology Innovation
>> >> >> >> Comcast
>> >> >> >> One Comcast Center
>> >> >> >> Philadelphia, PA 19103
>> >> >> >> (o) 215-286-8260
>> >> >> >> (m) 609-458-0332
>> >> >> >>
>> >> >> >> ----- Original Message -----
>> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>> >> >> >> Subject: Re: Getting Started with iPOJO
>> >> >> >>
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> I need to ask this first since it's not on your code snippet:
>>Did
>> >>you
>> >> >> >>use
>> >> >> >> @Component annotation for class where you've declared your
>>start()
>> >> >> >>stop()
>> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
>> >> >> >>
>> >> >> >>
>> >> >> >> *Regards,*
>> >> >> >> *Gokturk*
>> >> >> >>
>> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>> >> >> >>
>> >> >> >> > Hi,
>> >> >> >> >
>> >> >> >> > I can't seem to find a good article that will help me resolve
>> >>the
>> >> >> >> "getting
>> >> >> >> > started" issue I am facing.
>> >> >> >> >
>> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>> >> >> >> >
>> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin,
>>from:
>> >> >> >> > http://clement.plop-plop.net/update/
>> >> >> >> >
>> >> >> >> > I have created a sample project following the instructions
>>at:
>> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >> >> >> >
>> >> >> >> > I have integrated Felix into Eclipse as a project, following
>> >> >> >>instructions
>> >> >> >> > here:
>> >> >> http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >> >> >> >
>> >> >> >> > I have downloaded the following iPOJO bundle:
>> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
>> >> >> >> >
>> >> >> >> > I've launched Felix in the Eclipse console and I've installed
>> >>the
>> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>> >> >> >> >
>> >> >> >> > I've created a test bundle using iPOJO called iPojoTest.jar
>>and
>> >> >>I've
>> >> >> >> > installed it and started it in the OSGI console.
>> >> >> >> >
>> >> >> >> > I run bundles in the console and I get:
>> >> >> >> >
>> >> >> >> > g! bundles
>> >> >> >> >
>> >> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
>> >> >> >> >
>> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>> >>(1.6.2)
>> >> >> >> >
>> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>> >> >> >> >
>> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>> >> >> >> >
>> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>> >> >> >> >
>> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>> >> >> >> >
>> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > So, the bundle seems to have started.
>> >> >> >> >
>> >> >> >> > But I don't get any console output from my sysoutsŠ
>> >> >> >> >
>> >> >> >> > Here are the start() and stop() methods:
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > @Validate
>> >> >> >> >
>> >> >> >> > public void start() throws IOException {
>> >> >> >> >
>> >> >> >> > System.out.println("I'm starting...");
>> >> >> >> >
>> >> >> >> > try{
>> >> >> >> >
>> >> >> >> > // Create file
>> >> >> >> >
>> >> >> >> > FileWriter fstream = new
>> >> >> >> > FileWriter("/Users/mcook008/out.txt");
>> >> >> >> >
>> >> >> >> > BufferedWriter out = new
>> >>BufferedWriter(fstream);
>> >> >> >> >
>> >> >> >> > out.write("Hello Java");
>> >> >> >> >
>> >> >> >> > //Close the output stream
>> >> >> >> >
>> >> >> >> > out.close();
>> >> >> >> >
>> >> >> >> > }catch (Exception e){//Catch exception if
>>any
>> >> >> >> >
>> >> >> >> > System.err.println("Error: " +
>> >>e.getMessage());
>> >> >> >> >
>> >> >> >> > }
>> >> >> >> >
>> >> >> >> > throw new IOException() ;
>> >> >> >> >
>> >> >> >> > }
>> >> >> >> >
>> >> >> >> > @Invalidate
>> >> >> >> >
>> >> >> >> > public void stop() {
>> >> >> >> >
>> >> >> >> > System.out.println("I'm leaving !");
>> >> >> >> >
>> >> >> >> > }
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > I added in the file write to see if a file would be created.
>> >>There
>> >> >> >>is no
>> >> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE,
>>the
>> >> >>start
>> >> >> >> method
>> >> >> >> > appears never have to been called.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Can anyone tell me what I may have done wrong or provide a
>>clue
>> >>as
>> >> >>to
>> >> >> >> what
>> >> >> >> > to look at to help diagnose the problem?
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Thanks,
>> >> >> >> >
>> >> >> >> > Mike
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>>---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> >> For additional commands, e-mail: users-help@felix.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
Just to be on the same page I installed eclipse-ipojo-plugin too.
First finding : you don't need a bogus component. You can just type
<ipojo>
<component/>
</ipojo>
inside you metadata.xml and it'll pass silently.
Besides you might be hitting a bug we've fixed in trunk, because in the
same scenario I suggested to you I saw some elements in MANIFEST which
shouldn't be there.
Could you share me your MANIFEST for the final state(bogus metadata.xml +
annotations)?
On Fri, Oct 12, 2012 at 5:05 AM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hi,
>
> >>Could you tell me what happens when you remove the <ipojo/> element too
> >>leaving the metadata.xml empty?
>
>
> I get an error when there is no contents in the metadata.xml file.
>
> >>I could suggest you a trick to define a bogus
> >>component inside metadata.xml(Will require you to maintain a bogus class)
> >>so that eclipse-ipojo-plugin will not fail on metadata.xml and move along
> >>its way with annotations.
>
>
> I added a bogus class into the cook.michael package and put the
> @Component/@Instantiate/@Validate/@Invalidate back into the code. Then
> added this component to the metadata.xml file:
> <ipojo>
> <component className="cook.michael.BogusClass"/>
> </ipojo>
>
>
>
> The above results in the start and stop not being invoked.
>
> >>Instead of embedding Felix into eclipse you can use its own Equinox
> >>launcher.
>
> I'm developing atop Felix, because the target device is Felix based, so I
> would like to keep it on the same platform.
>
>
> Thank you for your help.
> Mike
>
>
> On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>
> >On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
> >Michael_J_Cook@cable.comcast.com> wrote:
> >
> >> Göktürk,
> >>
> >> Thank you! I used #2 below and it worked well. I was able to launch the
> >> bundle, and I saw it output the traces I had been looking for.
> >>
> >
> >Cool !
> >
> >
> >>
> >> On the first, if I remove the contents of the metadata.xml file, how
> >>can I
> >> use iPOJO to generate the bundle? If I leave in the <ipojo/> element,
> >>and
> >> I run iPOJO's "Create Bundle", I get a warning: "Neither component
> >>types,
> >> nor instances in /Users/mcook008/Workspaces/MyEclipse
> >> 8.6/iPojoTest/metadata.xml". Start and stop are not called, although the
> >> class is marked with @Component and @Instantiate and start/stop is
> >>marked
> >> with @Validate/@Invalidate.
> >>
> >
> >Well, I actually never used eclipse-ipojo-plugin before but it seems to be
> >dependent on metadata.xml but also sees the annotations on its way.
> >
> >Could you tell me what happens when you remove the <ipojo/> element too
> >leaving the metadata.xml empty?
>
> >
> >If above trick didn't work and you want to stick with eclipse-ipojo-plugin
> >while using annotations. I could suggest you a trick to define a bogus
> >component inside metadata.xml(Will require you to maintain a bogus class)
> >so that eclipse-ipojo-plugin will not fail on metadata.xml and move along
> >its way with annotations.
> >
> >Also it seems to me that your development environment is heavy. Instead of
> >embedding Felix into eclipse you can use its own Equinox launcher.
> >I suggest you to have a look at
> >http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
> >where
> >you can see basic setup.(You can use annotations or metadata of your
> >choice
> >in this setup)
> >
> >
> >Gokturk
> >
> >
> >>
> >> Mike
> >>
> >>
> >>
> >> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
> >>
> >> >Well i thought at first that you didn't specify metadata.xml but i see
> >>now
> >> >that you did. Mixing metadata.xml and annotations for one single
> >>component
> >> >is a mistake. For same component you must go with one of them.
> >> >
> >> >So there are 2 different ways for you:
> >> >
> >> >1- Using only annotations: Just disable the metadata.xml (easily
> >>delete it
> >> >or comment out the content ) and leave the annotations as it is.
> >> >2- Using only medata.xml: If you want to use metadata.xml then remove
> >>all
> >> >annotations including @validate and @invalidate and make sure your
> >> >metadata.xml looks like this:
> >> >
> >> ><ipojo>
> >> ><component className="cook.michael.MyComponentImpl">
> >> > <callback transition="validate" method="start"/>
> >> > <callback transition="invalidate" method="stop"/>
> >> ></component>
> >> ><instance component="cook.michael.MyComponentImpl"/>
> >> ></ipojo>
> >> >
> >> >Either way should bring you where you want. Just don't mix annotation
> >>and
> >> >metadata usage for same component.
> >> >
> >> >Regards,
> >> >Gokturk
> >> >
> >> >
> >> >
> >> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >
> >> >> Hi Göktürk,
> >> >>
> >> >> OK... Tried that. Still the same thing. There's not much to my
> >>code,
> >> >>so
> >> >> I'm including it below. Please let me know if you see anything.
> >> >>
> >> >> Thank you for helping me,
> >> >> Mike
> >> >>
> >> >>
> >> >> MyComponentImpl.java:
> >> >>
> >> >> package cook.michael;
> >> >>
> >> >> import java.io.BufferedWriter;
> >> >> import java.io.File;
> >> >> import java.io.FileWriter;
> >> >> import java.io.IOException;
> >> >>
> >> >> import org.apache.felix.ipojo.annotations.Component;
> >> >> import org.apache.felix.ipojo.annotations.Invalidate;
> >> >> import org.apache.felix.ipojo.annotations.Validate;
> >> >> import org.apache.felix.ipojo.annotations.Instantiate;
> >> >>
> >> >> @Component
> >> >> @Instantiate
> >> >> public class MyComponentImpl {
> >> >>
> >> >> @Validate
> >> >> public void start() throws IOException {
> >> >> System.err.println("Starting: " );
> >> >>
> >> >> System.out.println("I'm starting...");
> >> >> try{
> >> >> // Create file
> >> >> FileWriter fstream = new
> >> >>FileWriter("/Users/mcook008/out.txt");
> >> >> BufferedWriter out = new BufferedWriter(fstream);
> >> >> out.write("Hello Java");
> >> >> //Close the output stream
> >> >> out.close();
> >> >> }catch (Exception e){//Catch exception if any
> >> >> System.err.println("Error: " + e.getMessage());
> >> >> }
> >> >> throw new IOException() ;
> >> >> }
> >> >>
> >> >> @Invalidate
> >> >> public void stop() {
> >> >> System.out.println("I'm leaving !");
> >> >> }
> >> >> }
> >> >>
> >> >>
> >> >> metadata.xml:
> >> >>
> >> >> <ipojo>
> >> >> <component className="cook.michael.MyComponentImpl"/>
> >> >> <instance component="cook.michael.MyComponentImpl"/>
> >> >> </ipojo>
> >> >>
> >> >>
> >> >>
> >> >> iPojoTest.bnd:
> >> >>
> >> >> Import-Package: *
> >> >> Export-Package: *
> >> >> #Private-Package:
> >> >>
> >> >>
> >> >> Generated manefest.mf:
> >> >>
> >> >> Manifest-Version: 1.0
> >> >> Export-Package:
> >>org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >> >>
> >>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >> >>
> >>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >> >>
> >>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >> >> l
> >> >> iPOJO-Components: component {
> >>$classname="cook.michael.MyComponentImpl
> >> >> " manipulation { method { $name="$init" }method { $name="start"
> >>}meth
> >> >> od { $name="stop" }}}instance {
> >>$component="cook.michael.MyComponentI
> >> >> mpl" }component { $name="cook.michael.MyComponentImpl"
> >>$classname="co
> >> >> ok.michael.MyComponentImpl" $public="true"
> >>org.apache.felix.ipojo.ann
> >> >> otations:instantiate { }callback { $transition="invalidate"
> >>$method="
> >> >> stop" }callback { $transition="validate" $method="start"
> >>}manipulatio
> >> >> n { method { $name="$init" }method { $name="start" }method {
> >>$name="s
> >> >> top" }}}
> >> >> Built-By: clement
> >> >> Tool: Bnd-0.0.249
> >> >> Bundle-Name: Apache Felix iPOJO Annotations
> >> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >> >> Bundle-Vendor: The Apache Software Foundation
> >> >> Bundle-Version: 1.8.2
> >> >> Build-Jdk: 1.6.0_31
> >> >> Bnd-LastModified: 1350001458935
> >> >> Bundle-ManifestVersion: 2
> >> >> Bundle-Description: iPOJO Annotations
> >> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> >> >> Bundle-DocURL:
> >>http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >> >> ns.html
> >> >> Import-Package: org.osgi.service.log;version=1.3,
> >>org.apache.felix.ipo
> >> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
> >>org.apache.f
> >> >> elix.ipojo.architecture;version=0.9.0,
> >>org.apache.felix.ipojo.extende
> >> >> r, org.apache.felix.ipojo.whiteboard,
> >>org.apache.felix.ipojo;version=
> >> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
> >>org.apache.felix.ipojo.
> >> >> handlers.jmx, org.osgi.service.cm;version=1.2,
> >>org.apache.felix.ipojo
> >> >> .annotations, cook.michael
> >> >> Bundle-SymbolicName: iPojoTest
> >> >> Originally-Created-By: Apache Maven Bundle Plugin
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com>
> wrote:
> >> >>
> >> >> >Hi,
> >> >> >
> >> >> >First of all @Component is mandatory.(For annotation based usage).
> >> >> >
> >> >> >But this only defines your component. To actually instantiate it you
> >> >> >should
> >> >> >do it deliberately. One way to do that is using @Instantiate
> >> >>annotation.
> >> >> >
> >> >> >So your code would be like:
> >> >> >
> >> >> >@Component
> >> >> >@Instantiate
> >> >> >public class foo{
> >> >> >
> >> >> > @Validate
> >> >> > public void start()
> >> >> >..........
> >> >> >..........
> >> >> >}
> >> >> >
> >> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
> >> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >> >
> >> >> >> Sorry. Just rechecked. Used @ Component on the class. And
> >> >> >> @Invalidate/@validate on the methods. Just tried removing the
> >> >> >>@Component.
> >> >> >> Same result. No output.
> >> >> >>
> >> >> >> Mike
> >> >> >> Michael Cook
> >> >> >> VP Technology Innovation
> >> >> >> Comcast
> >> >> >> One Comcast Center
> >> >> >> Philadelphia, PA 19103
> >> >> >> (o) 215-286-8260
> >> >> >> (m) 609-458-0332
> >> >> >>
> >> >> >> ----- Original Message -----
> >> >> >> From: Cook, Michael J. (OCTO)
> >> >> >> Sent: Thursday, October 11, 2012 05:47 PM
> >> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
> >> >> >> Subject: Re: Getting Started with iPOJO
> >> >> >>
> >> >> >> I used @validate/@invalidate alone.
> >> >> >>
> >> >> >> Mike
> >> >> >>
> >> >> >> Michael Cook
> >> >> >> VP Technology Innovation
> >> >> >> Comcast
> >> >> >> One Comcast Center
> >> >> >> Philadelphia, PA 19103
> >> >> >> (o) 215-286-8260
> >> >> >> (m) 609-458-0332
> >> >> >>
> >> >> >> ----- Original Message -----
> >> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> >> >> >> Sent: Thursday, October 11, 2012 05:39 PM
> >> >> >> To: users@felix.apache.org <us...@felix.apache.org>
> >> >> >> Subject: Re: Getting Started with iPOJO
> >> >> >>
> >> >> >> Hi,
> >> >> >>
> >> >> >> I need to ask this first since it's not on your code snippet: Did
> >>you
> >> >> >>use
> >> >> >> @Component annotation for class where you've declared your start()
> >> >> >>stop()
> >> >> >> methods? Or did you use @Validate,@Invalidate alone?
> >> >> >>
> >> >> >>
> >> >> >> *Regards,*
> >> >> >> *Gokturk*
> >> >> >>
> >> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
> >> >> >> Michael_J_Cook@cable.comcast.com> wrote:
> >> >> >>
> >> >> >> > Hi,
> >> >> >> >
> >> >> >> > I can't seem to find a good article that will help me resolve
> >>the
> >> >> >> "getting
> >> >> >> > started" issue I am facing.
> >> >> >> >
> >> >> >> > I am using Eclipse Juno (4.2) on my Mac.
> >> >> >> >
> >> >> >> > I have downloaded and installed the iPOJO eclipse plugin, from:
> >> >> >> > http://clement.plop-plop.net/update/
> >> >> >> >
> >> >> >> > I have created a sample project following the instructions at:
> >> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >> >> >> >
> >> >> >> > I have integrated Felix into Eclipse as a project, following
> >> >> >>instructions
> >> >> >> > here:
> >> >> http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >> >> >> >
> >> >> >> > I have downloaded the following iPOJO bundle:
> >> >> >> > org.apache.felix.ipojo-1.8.2.jar
> >> >> >> >
> >> >> >> > I've launched Felix in the Eclipse console and I've installed
> >>the
> >> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >> >> >> >
> >> >> >> > I've created a test bundle using iPOJO called iPojoTest.jar and
> >> >>I've
> >> >> >> > installed it and started it in the OSGI console.
> >> >> >> >
> >> >> >> > I run bundles in the console and I get:
> >> >> >> >
> >> >> >> > g! bundles
> >> >> >> >
> >> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
> >> >> >> >
> >> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
> >>(1.6.2)
> >> >> >> >
> >> >> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
> >> >> >> >
> >> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
> >> >> >> >
> >> >> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
> >> >> >> >
> >> >> >> > 12|Active | 1|iPojoTest (1.4.0)
> >> >> >> >
> >> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >> >> >> >
> >> >> >> >
> >> >> >> > So, the bundle seems to have started.
> >> >> >> >
> >> >> >> > But I don't get any console output from my sysoutsŠ
> >> >> >> >
> >> >> >> > Here are the start() and stop() methods:
> >> >> >> >
> >> >> >> >
> >> >> >> > @Validate
> >> >> >> >
> >> >> >> > public void start() throws IOException {
> >> >> >> >
> >> >> >> > System.out.println("I'm starting...");
> >> >> >> >
> >> >> >> > try{
> >> >> >> >
> >> >> >> > // Create file
> >> >> >> >
> >> >> >> > FileWriter fstream = new
> >> >> >> > FileWriter("/Users/mcook008/out.txt");
> >> >> >> >
> >> >> >> > BufferedWriter out = new
> >>BufferedWriter(fstream);
> >> >> >> >
> >> >> >> > out.write("Hello Java");
> >> >> >> >
> >> >> >> > //Close the output stream
> >> >> >> >
> >> >> >> > out.close();
> >> >> >> >
> >> >> >> > }catch (Exception e){//Catch exception if any
> >> >> >> >
> >> >> >> > System.err.println("Error: " +
> >>e.getMessage());
> >> >> >> >
> >> >> >> > }
> >> >> >> >
> >> >> >> > throw new IOException() ;
> >> >> >> >
> >> >> >> > }
> >> >> >> >
> >> >> >> > @Invalidate
> >> >> >> >
> >> >> >> > public void stop() {
> >> >> >> >
> >> >> >> > System.out.println("I'm leaving !");
> >> >> >> >
> >> >> >> > }
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > I added in the file write to see if a file would be created.
> >>There
> >> >> >>is no
> >> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE, the
> >> >>start
> >> >> >> method
> >> >> >> > appears never have to been called.
> >> >> >> >
> >> >> >> >
> >> >> >> > Can anyone tell me what I may have done wrong or provide a clue
> >>as
> >> >>to
> >> >> >> what
> >> >> >> > to look at to help diagnose the problem?
> >> >> >> >
> >> >> >> >
> >> >> >> > Thanks,
> >> >> >> >
> >> >> >> > Mike
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> >> For additional commands, e-mail: users-help@felix.apache.org
> >> >>
> >> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Hi,
>>Could you tell me what happens when you remove the <ipojo/> element too
>>leaving the metadata.xml empty?
I get an error when there is no contents in the metadata.xml file.
>>I could suggest you a trick to define a bogus
>>component inside metadata.xml(Will require you to maintain a bogus class)
>>so that eclipse-ipojo-plugin will not fail on metadata.xml and move along
>>its way with annotations.
I added a bogus class into the cook.michael package and put the
@Component/@Instantiate/@Validate/@Invalidate back into the code. Then
added this component to the metadata.xml file:
<ipojo>
<component className="cook.michael.BogusClass"/>
</ipojo>
The above results in the start and stop not being invoked.
>>Instead of embedding Felix into eclipse you can use its own Equinox
>>launcher.
I'm developing atop Felix, because the target device is Felix based, so I
would like to keep it on the same platform.
Thank you for your help.
Mike
On 10/11/12 9:47 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
>Michael_J_Cook@cable.comcast.com> wrote:
>
>> Göktürk,
>>
>> Thank you! I used #2 below and it worked well. I was able to launch the
>> bundle, and I saw it output the traces I had been looking for.
>>
>
>Cool !
>
>
>>
>> On the first, if I remove the contents of the metadata.xml file, how
>>can I
>> use iPOJO to generate the bundle? If I leave in the <ipojo/> element,
>>and
>> I run iPOJO's "Create Bundle", I get a warning: "Neither component
>>types,
>> nor instances in /Users/mcook008/Workspaces/MyEclipse
>> 8.6/iPojoTest/metadata.xml". Start and stop are not called, although the
>> class is marked with @Component and @Instantiate and start/stop is
>>marked
>> with @Validate/@Invalidate.
>>
>
>Well, I actually never used eclipse-ipojo-plugin before but it seems to be
>dependent on metadata.xml but also sees the annotations on its way.
>
>Could you tell me what happens when you remove the <ipojo/> element too
>leaving the metadata.xml empty?
>
>If above trick didn't work and you want to stick with eclipse-ipojo-plugin
>while using annotations. I could suggest you a trick to define a bogus
>component inside metadata.xml(Will require you to maintain a bogus class)
>so that eclipse-ipojo-plugin will not fail on metadata.xml and move along
>its way with annotations.
>
>Also it seems to me that your development environment is heavy. Instead of
>embedding Felix into eclipse you can use its own Equinox launcher.
>I suggest you to have a look at
>http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html
>where
>you can see basic setup.(You can use annotations or metadata of your
>choice
>in this setup)
>
>
>Gokturk
>
>
>>
>> Mike
>>
>>
>>
>> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>
>> >Well i thought at first that you didn't specify metadata.xml but i see
>>now
>> >that you did. Mixing metadata.xml and annotations for one single
>>component
>> >is a mistake. For same component you must go with one of them.
>> >
>> >So there are 2 different ways for you:
>> >
>> >1- Using only annotations: Just disable the metadata.xml (easily
>>delete it
>> >or comment out the content ) and leave the annotations as it is.
>> >2- Using only medata.xml: If you want to use metadata.xml then remove
>>all
>> >annotations including @validate and @invalidate and make sure your
>> >metadata.xml looks like this:
>> >
>> ><ipojo>
>> ><component className="cook.michael.MyComponentImpl">
>> > <callback transition="validate" method="start"/>
>> > <callback transition="invalidate" method="stop"/>
>> ></component>
>> ><instance component="cook.michael.MyComponentImpl"/>
>> ></ipojo>
>> >
>> >Either way should bring you where you want. Just don't mix annotation
>>and
>> >metadata usage for same component.
>> >
>> >Regards,
>> >Gokturk
>> >
>> >
>> >
>> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>> >Michael_J_Cook@cable.comcast.com> wrote:
>> >
>> >> Hi Göktürk,
>> >>
>> >> OK... Tried that. Still the same thing. There's not much to my
>>code,
>> >>so
>> >> I'm including it below. Please let me know if you see anything.
>> >>
>> >> Thank you for helping me,
>> >> Mike
>> >>
>> >>
>> >> MyComponentImpl.java:
>> >>
>> >> package cook.michael;
>> >>
>> >> import java.io.BufferedWriter;
>> >> import java.io.File;
>> >> import java.io.FileWriter;
>> >> import java.io.IOException;
>> >>
>> >> import org.apache.felix.ipojo.annotations.Component;
>> >> import org.apache.felix.ipojo.annotations.Invalidate;
>> >> import org.apache.felix.ipojo.annotations.Validate;
>> >> import org.apache.felix.ipojo.annotations.Instantiate;
>> >>
>> >> @Component
>> >> @Instantiate
>> >> public class MyComponentImpl {
>> >>
>> >> @Validate
>> >> public void start() throws IOException {
>> >> System.err.println("Starting: " );
>> >>
>> >> System.out.println("I'm starting...");
>> >> try{
>> >> // Create file
>> >> FileWriter fstream = new
>> >>FileWriter("/Users/mcook008/out.txt");
>> >> BufferedWriter out = new BufferedWriter(fstream);
>> >> out.write("Hello Java");
>> >> //Close the output stream
>> >> out.close();
>> >> }catch (Exception e){//Catch exception if any
>> >> System.err.println("Error: " + e.getMessage());
>> >> }
>> >> throw new IOException() ;
>> >> }
>> >>
>> >> @Invalidate
>> >> public void stop() {
>> >> System.out.println("I'm leaving !");
>> >> }
>> >> }
>> >>
>> >>
>> >> metadata.xml:
>> >>
>> >> <ipojo>
>> >> <component className="cook.michael.MyComponentImpl"/>
>> >> <instance component="cook.michael.MyComponentImpl"/>
>> >> </ipojo>
>> >>
>> >>
>> >>
>> >> iPojoTest.bnd:
>> >>
>> >> Import-Package: *
>> >> Export-Package: *
>> >> #Private-Package:
>> >>
>> >>
>> >> Generated manefest.mf:
>> >>
>> >> Manifest-Version: 1.0
>> >> Export-Package:
>>org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> >>
>>ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> >>
>>.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> >>
>>lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> >> l
>> >> iPOJO-Components: component {
>>$classname="cook.michael.MyComponentImpl
>> >> " manipulation { method { $name="$init" }method { $name="start"
>>}meth
>> >> od { $name="stop" }}}instance {
>>$component="cook.michael.MyComponentI
>> >> mpl" }component { $name="cook.michael.MyComponentImpl"
>>$classname="co
>> >> ok.michael.MyComponentImpl" $public="true"
>>org.apache.felix.ipojo.ann
>> >> otations:instantiate { }callback { $transition="invalidate"
>>$method="
>> >> stop" }callback { $transition="validate" $method="start"
>>}manipulatio
>> >> n { method { $name="$init" }method { $name="start" }method {
>>$name="s
>> >> top" }}}
>> >> Built-By: clement
>> >> Tool: Bnd-0.0.249
>> >> Bundle-Name: Apache Felix iPOJO Annotations
>> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> >> Bundle-Vendor: The Apache Software Foundation
>> >> Bundle-Version: 1.8.2
>> >> Build-Jdk: 1.6.0_31
>> >> Bnd-LastModified: 1350001458935
>> >> Bundle-ManifestVersion: 2
>> >> Bundle-Description: iPOJO Annotations
>> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> >> Bundle-DocURL:
>>http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> >> ns.html
>> >> Import-Package: org.osgi.service.log;version=1.3,
>>org.apache.felix.ipo
>> >> jo.handler.temporal, org.apache.felix.ipojo.transaction,
>>org.apache.f
>> >> elix.ipojo.architecture;version=0.9.0,
>>org.apache.felix.ipojo.extende
>> >> r, org.apache.felix.ipojo.whiteboard,
>>org.apache.felix.ipojo;version=
>> >> 0.9.0, org.apache.felix.ipojo.handlers.event,
>>org.apache.felix.ipojo.
>> >> handlers.jmx, org.osgi.service.cm;version=1.2,
>>org.apache.felix.ipojo
>> >> .annotations, cook.michael
>> >> Bundle-SymbolicName: iPojoTest
>> >> Originally-Created-By: Apache Maven Bundle Plugin
>> >>
>> >>
>> >>
>> >>
>> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>> >>
>> >> >Hi,
>> >> >
>> >> >First of all @Component is mandatory.(For annotation based usage).
>> >> >
>> >> >But this only defines your component. To actually instantiate it you
>> >> >should
>> >> >do it deliberately. One way to do that is using @Instantiate
>> >>annotation.
>> >> >
>> >> >So your code would be like:
>> >> >
>> >> >@Component
>> >> >@Instantiate
>> >> >public class foo{
>> >> >
>> >> > @Validate
>> >> > public void start()
>> >> >..........
>> >> >..........
>> >> >}
>> >> >
>> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>> >> >Michael_J_Cook@cable.comcast.com> wrote:
>> >> >
>> >> >> Sorry. Just rechecked. Used @ Component on the class. And
>> >> >> @Invalidate/@validate on the methods. Just tried removing the
>> >> >>@Component.
>> >> >> Same result. No output.
>> >> >>
>> >> >> Mike
>> >> >> Michael Cook
>> >> >> VP Technology Innovation
>> >> >> Comcast
>> >> >> One Comcast Center
>> >> >> Philadelphia, PA 19103
>> >> >> (o) 215-286-8260
>> >> >> (m) 609-458-0332
>> >> >>
>> >> >> ----- Original Message -----
>> >> >> From: Cook, Michael J. (OCTO)
>> >> >> Sent: Thursday, October 11, 2012 05:47 PM
>> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> >> >> Subject: Re: Getting Started with iPOJO
>> >> >>
>> >> >> I used @validate/@invalidate alone.
>> >> >>
>> >> >> Mike
>> >> >>
>> >> >> Michael Cook
>> >> >> VP Technology Innovation
>> >> >> Comcast
>> >> >> One Comcast Center
>> >> >> Philadelphia, PA 19103
>> >> >> (o) 215-286-8260
>> >> >> (m) 609-458-0332
>> >> >>
>> >> >> ----- Original Message -----
>> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>> >> >> Sent: Thursday, October 11, 2012 05:39 PM
>> >> >> To: users@felix.apache.org <us...@felix.apache.org>
>> >> >> Subject: Re: Getting Started with iPOJO
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> I need to ask this first since it's not on your code snippet: Did
>>you
>> >> >>use
>> >> >> @Component annotation for class where you've declared your start()
>> >> >>stop()
>> >> >> methods? Or did you use @Validate,@Invalidate alone?
>> >> >>
>> >> >>
>> >> >> *Regards,*
>> >> >> *Gokturk*
>> >> >>
>> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>> >> >> Michael_J_Cook@cable.comcast.com> wrote:
>> >> >>
>> >> >> > Hi,
>> >> >> >
>> >> >> > I can't seem to find a good article that will help me resolve
>>the
>> >> >> "getting
>> >> >> > started" issue I am facing.
>> >> >> >
>> >> >> > I am using Eclipse Juno (4.2) on my Mac.
>> >> >> >
>> >> >> > I have downloaded and installed the iPOJO eclipse plugin, from:
>> >> >> > http://clement.plop-plop.net/update/
>> >> >> >
>> >> >> > I have created a sample project following the instructions at:
>> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >> >> >
>> >> >> > I have integrated Felix into Eclipse as a project, following
>> >> >>instructions
>> >> >> > here:
>> >> http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >> >> >
>> >> >> > I have downloaded the following iPOJO bundle:
>> >> >> > org.apache.felix.ipojo-1.8.2.jar
>> >> >> >
>> >> >> > I've launched Felix in the Eclipse console and I've installed
>>the
>> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>> >> >> >
>> >> >> > I've created a test bundle using iPOJO called iPojoTest.jar and
>> >>I've
>> >> >> > installed it and started it in the OSGI console.
>> >> >> >
>> >> >> > I run bundles in the console and I get:
>> >> >> >
>> >> >> > g! bundles
>> >> >> >
>> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
>> >> >> >
>> >> >> > 1|Active | 1|org.apache.felix.bundlerepository
>>(1.6.2)
>> >> >> >
>> >> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>> >> >> >
>> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>> >> >> >
>> >> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>> >> >> >
>> >> >> > 12|Active | 1|iPojoTest (1.4.0)
>> >> >> >
>> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>> >> >> >
>> >> >> >
>> >> >> > So, the bundle seems to have started.
>> >> >> >
>> >> >> > But I don't get any console output from my sysoutsŠ
>> >> >> >
>> >> >> > Here are the start() and stop() methods:
>> >> >> >
>> >> >> >
>> >> >> > @Validate
>> >> >> >
>> >> >> > public void start() throws IOException {
>> >> >> >
>> >> >> > System.out.println("I'm starting...");
>> >> >> >
>> >> >> > try{
>> >> >> >
>> >> >> > // Create file
>> >> >> >
>> >> >> > FileWriter fstream = new
>> >> >> > FileWriter("/Users/mcook008/out.txt");
>> >> >> >
>> >> >> > BufferedWriter out = new
>>BufferedWriter(fstream);
>> >> >> >
>> >> >> > out.write("Hello Java");
>> >> >> >
>> >> >> > //Close the output stream
>> >> >> >
>> >> >> > out.close();
>> >> >> >
>> >> >> > }catch (Exception e){//Catch exception if any
>> >> >> >
>> >> >> > System.err.println("Error: " +
>>e.getMessage());
>> >> >> >
>> >> >> > }
>> >> >> >
>> >> >> > throw new IOException() ;
>> >> >> >
>> >> >> > }
>> >> >> >
>> >> >> > @Invalidate
>> >> >> >
>> >> >> > public void stop() {
>> >> >> >
>> >> >> > System.out.println("I'm leaving !");
>> >> >> >
>> >> >> > }
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > I added in the file write to see if a file would be created.
>>There
>> >> >>is no
>> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE, the
>> >>start
>> >> >> method
>> >> >> > appears never have to been called.
>> >> >> >
>> >> >> >
>> >> >> > Can anyone tell me what I may have done wrong or provide a clue
>>as
>> >>to
>> >> >> what
>> >> >> > to look at to help diagnose the problem?
>> >> >> >
>> >> >> >
>> >> >> > Thanks,
>> >> >> >
>> >> >> > Mike
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
On Fri, Oct 12, 2012 at 4:25 AM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Göktürk,
>
> Thank you! I used #2 below and it worked well. I was able to launch the
> bundle, and I saw it output the traces I had been looking for.
>
Cool !
>
> On the first, if I remove the contents of the metadata.xml file, how can I
> use iPOJO to generate the bundle? If I leave in the <ipojo/> element, and
> I run iPOJO's "Create Bundle", I get a warning: "Neither component types,
> nor instances in /Users/mcook008/Workspaces/MyEclipse
> 8.6/iPojoTest/metadata.xml". Start and stop are not called, although the
> class is marked with @Component and @Instantiate and start/stop is marked
> with @Validate/@Invalidate.
>
Well, I actually never used eclipse-ipojo-plugin before but it seems to be
dependent on metadata.xml but also sees the annotations on its way.
Could you tell me what happens when you remove the <ipojo/> element too
leaving the metadata.xml empty?
If above trick didn't work and you want to stick with eclipse-ipojo-plugin
while using annotations. I could suggest you a trick to define a bogus
component inside metadata.xml(Will require you to maintain a bogus class)
so that eclipse-ipojo-plugin will not fail on metadata.xml and move along
its way with annotations.
Also it seems to me that your development environment is heavy. Instead of
embedding Felix into eclipse you can use its own Equinox launcher.
I suggest you to have a look at
http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html where
you can see basic setup.(You can use annotations or metadata of your choice
in this setup)
Gokturk
>
> Mike
>
>
>
> On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>
> >Well i thought at first that you didn't specify metadata.xml but i see now
> >that you did. Mixing metadata.xml and annotations for one single component
> >is a mistake. For same component you must go with one of them.
> >
> >So there are 2 different ways for you:
> >
> >1- Using only annotations: Just disable the metadata.xml (easily delete it
> >or comment out the content ) and leave the annotations as it is.
> >2- Using only medata.xml: If you want to use metadata.xml then remove all
> >annotations including @validate and @invalidate and make sure your
> >metadata.xml looks like this:
> >
> ><ipojo>
> ><component className="cook.michael.MyComponentImpl">
> > <callback transition="validate" method="start"/>
> > <callback transition="invalidate" method="stop"/>
> ></component>
> ><instance component="cook.michael.MyComponentImpl"/>
> ></ipojo>
> >
> >Either way should bring you where you want. Just don't mix annotation and
> >metadata usage for same component.
> >
> >Regards,
> >Gokturk
> >
> >
> >
> >On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
> >Michael_J_Cook@cable.comcast.com> wrote:
> >
> >> Hi Göktürk,
> >>
> >> OK... Tried that. Still the same thing. There's not much to my code,
> >>so
> >> I'm including it below. Please let me know if you see anything.
> >>
> >> Thank you for helping me,
> >> Mike
> >>
> >>
> >> MyComponentImpl.java:
> >>
> >> package cook.michael;
> >>
> >> import java.io.BufferedWriter;
> >> import java.io.File;
> >> import java.io.FileWriter;
> >> import java.io.IOException;
> >>
> >> import org.apache.felix.ipojo.annotations.Component;
> >> import org.apache.felix.ipojo.annotations.Invalidate;
> >> import org.apache.felix.ipojo.annotations.Validate;
> >> import org.apache.felix.ipojo.annotations.Instantiate;
> >>
> >> @Component
> >> @Instantiate
> >> public class MyComponentImpl {
> >>
> >> @Validate
> >> public void start() throws IOException {
> >> System.err.println("Starting: " );
> >>
> >> System.out.println("I'm starting...");
> >> try{
> >> // Create file
> >> FileWriter fstream = new
> >>FileWriter("/Users/mcook008/out.txt");
> >> BufferedWriter out = new BufferedWriter(fstream);
> >> out.write("Hello Java");
> >> //Close the output stream
> >> out.close();
> >> }catch (Exception e){//Catch exception if any
> >> System.err.println("Error: " + e.getMessage());
> >> }
> >> throw new IOException() ;
> >> }
> >>
> >> @Invalidate
> >> public void stop() {
> >> System.out.println("I'm leaving !");
> >> }
> >> }
> >>
> >>
> >> metadata.xml:
> >>
> >> <ipojo>
> >> <component className="cook.michael.MyComponentImpl"/>
> >> <instance component="cook.michael.MyComponentImpl"/>
> >> </ipojo>
> >>
> >>
> >>
> >> iPojoTest.bnd:
> >>
> >> Import-Package: *
> >> Export-Package: *
> >> #Private-Package:
> >>
> >>
> >> Generated manefest.mf:
> >>
> >> Manifest-Version: 1.0
> >> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> >> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> >> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> >> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> >> l
> >> iPOJO-Components: component { $classname="cook.michael.MyComponentImpl
> >> " manipulation { method { $name="$init" }method { $name="start" }meth
> >> od { $name="stop" }}}instance { $component="cook.michael.MyComponentI
> >> mpl" }component { $name="cook.michael.MyComponentImpl" $classname="co
> >> ok.michael.MyComponentImpl" $public="true" org.apache.felix.ipojo.ann
> >> otations:instantiate { }callback { $transition="invalidate" $method="
> >> stop" }callback { $transition="validate" $method="start" }manipulatio
> >> n { method { $name="$init" }method { $name="start" }method { $name="s
> >> top" }}}
> >> Built-By: clement
> >> Tool: Bnd-0.0.249
> >> Bundle-Name: Apache Felix iPOJO Annotations
> >> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> >> Bundle-Vendor: The Apache Software Foundation
> >> Bundle-Version: 1.8.2
> >> Build-Jdk: 1.6.0_31
> >> Bnd-LastModified: 1350001458935
> >> Bundle-ManifestVersion: 2
> >> Bundle-Description: iPOJO Annotations
> >> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> >> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> >> ns.html
> >> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> >> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> >> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> >> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> >> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> >> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> >> .annotations, cook.michael
> >> Bundle-SymbolicName: iPojoTest
> >> Originally-Created-By: Apache Maven Bundle Plugin
> >>
> >>
> >>
> >>
> >> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
> >>
> >> >Hi,
> >> >
> >> >First of all @Component is mandatory.(For annotation based usage).
> >> >
> >> >But this only defines your component. To actually instantiate it you
> >> >should
> >> >do it deliberately. One way to do that is using @Instantiate
> >>annotation.
> >> >
> >> >So your code would be like:
> >> >
> >> >@Component
> >> >@Instantiate
> >> >public class foo{
> >> >
> >> > @Validate
> >> > public void start()
> >> >..........
> >> >..........
> >> >}
> >> >
> >> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
> >> >Michael_J_Cook@cable.comcast.com> wrote:
> >> >
> >> >> Sorry. Just rechecked. Used @ Component on the class. And
> >> >> @Invalidate/@validate on the methods. Just tried removing the
> >> >>@Component.
> >> >> Same result. No output.
> >> >>
> >> >> Mike
> >> >> Michael Cook
> >> >> VP Technology Innovation
> >> >> Comcast
> >> >> One Comcast Center
> >> >> Philadelphia, PA 19103
> >> >> (o) 215-286-8260
> >> >> (m) 609-458-0332
> >> >>
> >> >> ----- Original Message -----
> >> >> From: Cook, Michael J. (OCTO)
> >> >> Sent: Thursday, October 11, 2012 05:47 PM
> >> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
> >> >> Subject: Re: Getting Started with iPOJO
> >> >>
> >> >> I used @validate/@invalidate alone.
> >> >>
> >> >> Mike
> >> >>
> >> >> Michael Cook
> >> >> VP Technology Innovation
> >> >> Comcast
> >> >> One Comcast Center
> >> >> Philadelphia, PA 19103
> >> >> (o) 215-286-8260
> >> >> (m) 609-458-0332
> >> >>
> >> >> ----- Original Message -----
> >> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> >> >> Sent: Thursday, October 11, 2012 05:39 PM
> >> >> To: users@felix.apache.org <us...@felix.apache.org>
> >> >> Subject: Re: Getting Started with iPOJO
> >> >>
> >> >> Hi,
> >> >>
> >> >> I need to ask this first since it's not on your code snippet: Did you
> >> >>use
> >> >> @Component annotation for class where you've declared your start()
> >> >>stop()
> >> >> methods? Or did you use @Validate,@Invalidate alone?
> >> >>
> >> >>
> >> >> *Regards,*
> >> >> *Gokturk*
> >> >>
> >> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
> >> >> Michael_J_Cook@cable.comcast.com> wrote:
> >> >>
> >> >> > Hi,
> >> >> >
> >> >> > I can't seem to find a good article that will help me resolve the
> >> >> "getting
> >> >> > started" issue I am facing.
> >> >> >
> >> >> > I am using Eclipse Juno (4.2) on my Mac.
> >> >> >
> >> >> > I have downloaded and installed the iPOJO eclipse plugin, from:
> >> >> > http://clement.plop-plop.net/update/
> >> >> >
> >> >> > I have created a sample project following the instructions at:
> >> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >> >> >
> >> >> > I have integrated Felix into Eclipse as a project, following
> >> >>instructions
> >> >> > here:
> >> http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >> >> >
> >> >> > I have downloaded the following iPOJO bundle:
> >> >> > org.apache.felix.ipojo-1.8.2.jar
> >> >> >
> >> >> > I've launched Felix in the Eclipse console and I've installed the
> >> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >> >> >
> >> >> > I've created a test bundle using iPOJO called iPojoTest.jar and
> >>I've
> >> >> > installed it and started it in the OSGI console.
> >> >> >
> >> >> > I run bundles in the console and I get:
> >> >> >
> >> >> > g! bundles
> >> >> >
> >> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
> >> >> >
> >> >> > 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
> >> >> >
> >> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
> >> >> >
> >> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
> >> >> >
> >> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
> >> >> >
> >> >> > 12|Active | 1|iPojoTest (1.4.0)
> >> >> >
> >> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >> >> >
> >> >> >
> >> >> > So, the bundle seems to have started.
> >> >> >
> >> >> > But I don't get any console output from my sysoutsŠ
> >> >> >
> >> >> > Here are the start() and stop() methods:
> >> >> >
> >> >> >
> >> >> > @Validate
> >> >> >
> >> >> > public void start() throws IOException {
> >> >> >
> >> >> > System.out.println("I'm starting...");
> >> >> >
> >> >> > try{
> >> >> >
> >> >> > // Create file
> >> >> >
> >> >> > FileWriter fstream = new
> >> >> > FileWriter("/Users/mcook008/out.txt");
> >> >> >
> >> >> > BufferedWriter out = new BufferedWriter(fstream);
> >> >> >
> >> >> > out.write("Hello Java");
> >> >> >
> >> >> > //Close the output stream
> >> >> >
> >> >> > out.close();
> >> >> >
> >> >> > }catch (Exception e){//Catch exception if any
> >> >> >
> >> >> > System.err.println("Error: " + e.getMessage());
> >> >> >
> >> >> > }
> >> >> >
> >> >> > throw new IOException() ;
> >> >> >
> >> >> > }
> >> >> >
> >> >> > @Invalidate
> >> >> >
> >> >> > public void stop() {
> >> >> >
> >> >> > System.out.println("I'm leaving !");
> >> >> >
> >> >> > }
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > I added in the file write to see if a file would be created. There
> >> >>is no
> >> >> > file created. So, while OSGi thinks the bundle is ACTIVE, the
> >>start
> >> >> method
> >> >> > appears never have to been called.
> >> >> >
> >> >> >
> >> >> > Can anyone tell me what I may have done wrong or provide a clue as
> >>to
> >> >> what
> >> >> > to look at to help diagnose the problem?
> >> >> >
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Mike
> >> >> >
> >> >> >
> >> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Göktürk,
Thank you! I used #2 below and it worked well. I was able to launch the
bundle, and I saw it output the traces I had been looking for.
On the first, if I remove the contents of the metadata.xml file, how can I
use iPOJO to generate the bundle? If I leave in the <ipojo/> element, and
I run iPOJO's "Create Bundle", I get a warning: "Neither component types,
nor instances in /Users/mcook008/Workspaces/MyEclipse
8.6/iPojoTest/metadata.xml". Start and stop are not called, although the
class is marked with @Component and @Instantiate and start/stop is marked
with @Validate/@Invalidate.
Mike
On 10/11/12 8:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>Well i thought at first that you didn't specify metadata.xml but i see now
>that you did. Mixing metadata.xml and annotations for one single component
>is a mistake. For same component you must go with one of them.
>
>So there are 2 different ways for you:
>
>1- Using only annotations: Just disable the metadata.xml (easily delete it
>or comment out the content ) and leave the annotations as it is.
>2- Using only medata.xml: If you want to use metadata.xml then remove all
>annotations including @validate and @invalidate and make sure your
>metadata.xml looks like this:
>
><ipojo>
><component className="cook.michael.MyComponentImpl">
> <callback transition="validate" method="start"/>
> <callback transition="invalidate" method="stop"/>
></component>
><instance component="cook.michael.MyComponentImpl"/>
></ipojo>
>
>Either way should bring you where you want. Just don't mix annotation and
>metadata usage for same component.
>
>Regards,
>Gokturk
>
>
>
>On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
>Michael_J_Cook@cable.comcast.com> wrote:
>
>> Hi Göktürk,
>>
>> OK... Tried that. Still the same thing. There's not much to my code,
>>so
>> I'm including it below. Please let me know if you see anything.
>>
>> Thank you for helping me,
>> Mike
>>
>>
>> MyComponentImpl.java:
>>
>> package cook.michael;
>>
>> import java.io.BufferedWriter;
>> import java.io.File;
>> import java.io.FileWriter;
>> import java.io.IOException;
>>
>> import org.apache.felix.ipojo.annotations.Component;
>> import org.apache.felix.ipojo.annotations.Invalidate;
>> import org.apache.felix.ipojo.annotations.Validate;
>> import org.apache.felix.ipojo.annotations.Instantiate;
>>
>> @Component
>> @Instantiate
>> public class MyComponentImpl {
>>
>> @Validate
>> public void start() throws IOException {
>> System.err.println("Starting: " );
>>
>> System.out.println("I'm starting...");
>> try{
>> // Create file
>> FileWriter fstream = new
>>FileWriter("/Users/mcook008/out.txt");
>> BufferedWriter out = new BufferedWriter(fstream);
>> out.write("Hello Java");
>> //Close the output stream
>> out.close();
>> }catch (Exception e){//Catch exception if any
>> System.err.println("Error: " + e.getMessage());
>> }
>> throw new IOException() ;
>> }
>>
>> @Invalidate
>> public void stop() {
>> System.out.println("I'm leaving !");
>> }
>> }
>>
>>
>> metadata.xml:
>>
>> <ipojo>
>> <component className="cook.michael.MyComponentImpl"/>
>> <instance component="cook.michael.MyComponentImpl"/>
>> </ipojo>
>>
>>
>>
>> iPojoTest.bnd:
>>
>> Import-Package: *
>> Export-Package: *
>> #Private-Package:
>>
>>
>> Generated manefest.mf:
>>
>> Manifest-Version: 1.0
>> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
>> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
>> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
>> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
>> l
>> iPOJO-Components: component { $classname="cook.michael.MyComponentImpl
>> " manipulation { method { $name="$init" }method { $name="start" }meth
>> od { $name="stop" }}}instance { $component="cook.michael.MyComponentI
>> mpl" }component { $name="cook.michael.MyComponentImpl" $classname="co
>> ok.michael.MyComponentImpl" $public="true" org.apache.felix.ipojo.ann
>> otations:instantiate { }callback { $transition="invalidate" $method="
>> stop" }callback { $transition="validate" $method="start" }manipulatio
>> n { method { $name="$init" }method { $name="start" }method { $name="s
>> top" }}}
>> Built-By: clement
>> Tool: Bnd-0.0.249
>> Bundle-Name: Apache Felix iPOJO Annotations
>> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
>> Bundle-Vendor: The Apache Software Foundation
>> Bundle-Version: 1.8.2
>> Build-Jdk: 1.6.0_31
>> Bnd-LastModified: 1350001458935
>> Bundle-ManifestVersion: 2
>> Bundle-Description: iPOJO Annotations
>> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
>> ns.html
>> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
>> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
>> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
>> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
>> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
>> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
>> .annotations, cook.michael
>> Bundle-SymbolicName: iPojoTest
>> Originally-Created-By: Apache Maven Bundle Plugin
>>
>>
>>
>>
>> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>>
>> >Hi,
>> >
>> >First of all @Component is mandatory.(For annotation based usage).
>> >
>> >But this only defines your component. To actually instantiate it you
>> >should
>> >do it deliberately. One way to do that is using @Instantiate
>>annotation.
>> >
>> >So your code would be like:
>> >
>> >@Component
>> >@Instantiate
>> >public class foo{
>> >
>> > @Validate
>> > public void start()
>> >..........
>> >..........
>> >}
>> >
>> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>> >Michael_J_Cook@cable.comcast.com> wrote:
>> >
>> >> Sorry. Just rechecked. Used @ Component on the class. And
>> >> @Invalidate/@validate on the methods. Just tried removing the
>> >>@Component.
>> >> Same result. No output.
>> >>
>> >> Mike
>> >> Michael Cook
>> >> VP Technology Innovation
>> >> Comcast
>> >> One Comcast Center
>> >> Philadelphia, PA 19103
>> >> (o) 215-286-8260
>> >> (m) 609-458-0332
>> >>
>> >> ----- Original Message -----
>> >> From: Cook, Michael J. (OCTO)
>> >> Sent: Thursday, October 11, 2012 05:47 PM
>> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> >> Subject: Re: Getting Started with iPOJO
>> >>
>> >> I used @validate/@invalidate alone.
>> >>
>> >> Mike
>> >>
>> >> Michael Cook
>> >> VP Technology Innovation
>> >> Comcast
>> >> One Comcast Center
>> >> Philadelphia, PA 19103
>> >> (o) 215-286-8260
>> >> (m) 609-458-0332
>> >>
>> >> ----- Original Message -----
>> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>> >> Sent: Thursday, October 11, 2012 05:39 PM
>> >> To: users@felix.apache.org <us...@felix.apache.org>
>> >> Subject: Re: Getting Started with iPOJO
>> >>
>> >> Hi,
>> >>
>> >> I need to ask this first since it's not on your code snippet: Did you
>> >>use
>> >> @Component annotation for class where you've declared your start()
>> >>stop()
>> >> methods? Or did you use @Validate,@Invalidate alone?
>> >>
>> >>
>> >> *Regards,*
>> >> *Gokturk*
>> >>
>> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>> >> Michael_J_Cook@cable.comcast.com> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > I can't seem to find a good article that will help me resolve the
>> >> "getting
>> >> > started" issue I am facing.
>> >> >
>> >> > I am using Eclipse Juno (4.2) on my Mac.
>> >> >
>> >> > I have downloaded and installed the iPOJO eclipse plugin, from:
>> >> > http://clement.plop-plop.net/update/
>> >> >
>> >> > I have created a sample project following the instructions at:
>> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >> >
>> >> > I have integrated Felix into Eclipse as a project, following
>> >>instructions
>> >> > here:
>> http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >> >
>> >> > I have downloaded the following iPOJO bundle:
>> >> > org.apache.felix.ipojo-1.8.2.jar
>> >> >
>> >> > I've launched Felix in the Eclipse console and I've installed the
>> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>> >> >
>> >> > I've created a test bundle using iPOJO called iPojoTest.jar and
>>I've
>> >> > installed it and started it in the OSGI console.
>> >> >
>> >> > I run bundles in the console and I get:
>> >> >
>> >> > g! bundles
>> >> >
>> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
>> >> >
>> >> > 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
>> >> >
>> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>> >> >
>> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>> >> >
>> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>> >> >
>> >> > 12|Active | 1|iPojoTest (1.4.0)
>> >> >
>> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>> >> >
>> >> >
>> >> > So, the bundle seems to have started.
>> >> >
>> >> > But I don't get any console output from my sysoutsŠ
>> >> >
>> >> > Here are the start() and stop() methods:
>> >> >
>> >> >
>> >> > @Validate
>> >> >
>> >> > public void start() throws IOException {
>> >> >
>> >> > System.out.println("I'm starting...");
>> >> >
>> >> > try{
>> >> >
>> >> > // Create file
>> >> >
>> >> > FileWriter fstream = new
>> >> > FileWriter("/Users/mcook008/out.txt");
>> >> >
>> >> > BufferedWriter out = new BufferedWriter(fstream);
>> >> >
>> >> > out.write("Hello Java");
>> >> >
>> >> > //Close the output stream
>> >> >
>> >> > out.close();
>> >> >
>> >> > }catch (Exception e){//Catch exception if any
>> >> >
>> >> > System.err.println("Error: " + e.getMessage());
>> >> >
>> >> > }
>> >> >
>> >> > throw new IOException() ;
>> >> >
>> >> > }
>> >> >
>> >> > @Invalidate
>> >> >
>> >> > public void stop() {
>> >> >
>> >> > System.out.println("I'm leaving !");
>> >> >
>> >> > }
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > I added in the file write to see if a file would be created. There
>> >>is no
>> >> > file created. So, while OSGi thinks the bundle is ACTIVE, the
>>start
>> >> method
>> >> > appears never have to been called.
>> >> >
>> >> >
>> >> > Can anyone tell me what I may have done wrong or provide a clue as
>>to
>> >> what
>> >> > to look at to help diagnose the problem?
>> >> >
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Mike
>> >> >
>> >> >
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
Well i thought at first that you didn't specify metadata.xml but i see now
that you did. Mixing metadata.xml and annotations for one single component
is a mistake. For same component you must go with one of them.
So there are 2 different ways for you:
1- Using only annotations: Just disable the metadata.xml (easily delete it
or comment out the content ) and leave the annotations as it is.
2- Using only medata.xml: If you want to use metadata.xml then remove all
annotations including @validate and @invalidate and make sure your
metadata.xml looks like this:
<ipojo>
<component className="cook.michael.MyComponentImpl">
<callback transition="validate" method="start"/>
<callback transition="invalidate" method="stop"/>
</component>
<instance component="cook.michael.MyComponentImpl"/>
</ipojo>
Either way should bring you where you want. Just don't mix annotation and
metadata usage for same component.
Regards,
Gokturk
On Fri, Oct 12, 2012 at 3:32 AM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hi Göktürk,
>
> OK... Tried that. Still the same thing. There's not much to my code, so
> I'm including it below. Please let me know if you see anything.
>
> Thank you for helping me,
> Mike
>
>
> MyComponentImpl.java:
>
> package cook.michael;
>
> import java.io.BufferedWriter;
> import java.io.File;
> import java.io.FileWriter;
> import java.io.IOException;
>
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Invalidate;
> import org.apache.felix.ipojo.annotations.Validate;
> import org.apache.felix.ipojo.annotations.Instantiate;
>
> @Component
> @Instantiate
> public class MyComponentImpl {
>
> @Validate
> public void start() throws IOException {
> System.err.println("Starting: " );
>
> System.out.println("I'm starting...");
> try{
> // Create file
> FileWriter fstream = new FileWriter("/Users/mcook008/out.txt");
> BufferedWriter out = new BufferedWriter(fstream);
> out.write("Hello Java");
> //Close the output stream
> out.close();
> }catch (Exception e){//Catch exception if any
> System.err.println("Error: " + e.getMessage());
> }
> throw new IOException() ;
> }
>
> @Invalidate
> public void stop() {
> System.out.println("I'm leaving !");
> }
> }
>
>
> metadata.xml:
>
> <ipojo>
> <component className="cook.michael.MyComponentImpl"/>
> <instance component="cook.michael.MyComponentImpl"/>
> </ipojo>
>
>
>
> iPojoTest.bnd:
>
> Import-Package: *
> Export-Package: *
> #Private-Package:
>
>
> Generated manefest.mf:
>
> Manifest-Version: 1.0
> Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
> ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
> .ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
> lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
> l
> iPOJO-Components: component { $classname="cook.michael.MyComponentImpl
> " manipulation { method { $name="$init" }method { $name="start" }meth
> od { $name="stop" }}}instance { $component="cook.michael.MyComponentI
> mpl" }component { $name="cook.michael.MyComponentImpl" $classname="co
> ok.michael.MyComponentImpl" $public="true" org.apache.felix.ipojo.ann
> otations:instantiate { }callback { $transition="invalidate" $method="
> stop" }callback { $transition="validate" $method="start" }manipulatio
> n { method { $name="$init" }method { $name="start" }method { $name="s
> top" }}}
> Built-By: clement
> Tool: Bnd-0.0.249
> Bundle-Name: Apache Felix iPOJO Annotations
> Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
> Bundle-Vendor: The Apache Software Foundation
> Bundle-Version: 1.8.2
> Build-Jdk: 1.6.0_31
> Bnd-LastModified: 1350001458935
> Bundle-ManifestVersion: 2
> Bundle-Description: iPOJO Annotations
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
> ns.html
> Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
> jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
> elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
> r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
> 0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
> handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
> .annotations, cook.michael
> Bundle-SymbolicName: iPojoTest
> Originally-Created-By: Apache Maven Bundle Plugin
>
>
>
>
> On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>
> >Hi,
> >
> >First of all @Component is mandatory.(For annotation based usage).
> >
> >But this only defines your component. To actually instantiate it you
> >should
> >do it deliberately. One way to do that is using @Instantiate annotation.
> >
> >So your code would be like:
> >
> >@Component
> >@Instantiate
> >public class foo{
> >
> > @Validate
> > public void start()
> >..........
> >..........
> >}
> >
> >On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
> >Michael_J_Cook@cable.comcast.com> wrote:
> >
> >> Sorry. Just rechecked. Used @ Component on the class. And
> >> @Invalidate/@validate on the methods. Just tried removing the
> >>@Component.
> >> Same result. No output.
> >>
> >> Mike
> >> Michael Cook
> >> VP Technology Innovation
> >> Comcast
> >> One Comcast Center
> >> Philadelphia, PA 19103
> >> (o) 215-286-8260
> >> (m) 609-458-0332
> >>
> >> ----- Original Message -----
> >> From: Cook, Michael J. (OCTO)
> >> Sent: Thursday, October 11, 2012 05:47 PM
> >> To: 'users@felix.apache.org' <us...@felix.apache.org>
> >> Subject: Re: Getting Started with iPOJO
> >>
> >> I used @validate/@invalidate alone.
> >>
> >> Mike
> >>
> >> Michael Cook
> >> VP Technology Innovation
> >> Comcast
> >> One Comcast Center
> >> Philadelphia, PA 19103
> >> (o) 215-286-8260
> >> (m) 609-458-0332
> >>
> >> ----- Original Message -----
> >> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> >> Sent: Thursday, October 11, 2012 05:39 PM
> >> To: users@felix.apache.org <us...@felix.apache.org>
> >> Subject: Re: Getting Started with iPOJO
> >>
> >> Hi,
> >>
> >> I need to ask this first since it's not on your code snippet: Did you
> >>use
> >> @Component annotation for class where you've declared your start()
> >>stop()
> >> methods? Or did you use @Validate,@Invalidate alone?
> >>
> >>
> >> *Regards,*
> >> *Gokturk*
> >>
> >> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
> >> Michael_J_Cook@cable.comcast.com> wrote:
> >>
> >> > Hi,
> >> >
> >> > I can't seem to find a good article that will help me resolve the
> >> "getting
> >> > started" issue I am facing.
> >> >
> >> > I am using Eclipse Juno (4.2) on my Mac.
> >> >
> >> > I have downloaded and installed the iPOJO eclipse plugin, from:
> >> > http://clement.plop-plop.net/update/
> >> >
> >> > I have created a sample project following the instructions at:
> >> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >> >
> >> > I have integrated Felix into Eclipse as a project, following
> >>instructions
> >> > here:
> http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >> >
> >> > I have downloaded the following iPOJO bundle:
> >> > org.apache.felix.ipojo-1.8.2.jar
> >> >
> >> > I've launched Felix in the Eclipse console and I've installed the
> >> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >> >
> >> > I've created a test bundle using iPOJO called iPojoTest.jar and I've
> >> > installed it and started it in the OSGI console.
> >> >
> >> > I run bundles in the console and I get:
> >> >
> >> > g! bundles
> >> >
> >> > 0|Active | 0|org.apache.felix.framework (3.0.7)
> >> >
> >> > 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
> >> >
> >> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
> >> >
> >> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
> >> >
> >> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
> >> >
> >> > 12|Active | 1|iPojoTest (1.4.0)
> >> >
> >> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >> >
> >> >
> >> > So, the bundle seems to have started.
> >> >
> >> > But I don't get any console output from my sysoutsŠ
> >> >
> >> > Here are the start() and stop() methods:
> >> >
> >> >
> >> > @Validate
> >> >
> >> > public void start() throws IOException {
> >> >
> >> > System.out.println("I'm starting...");
> >> >
> >> > try{
> >> >
> >> > // Create file
> >> >
> >> > FileWriter fstream = new
> >> > FileWriter("/Users/mcook008/out.txt");
> >> >
> >> > BufferedWriter out = new BufferedWriter(fstream);
> >> >
> >> > out.write("Hello Java");
> >> >
> >> > //Close the output stream
> >> >
> >> > out.close();
> >> >
> >> > }catch (Exception e){//Catch exception if any
> >> >
> >> > System.err.println("Error: " + e.getMessage());
> >> >
> >> > }
> >> >
> >> > throw new IOException() ;
> >> >
> >> > }
> >> >
> >> > @Invalidate
> >> >
> >> > public void stop() {
> >> >
> >> > System.out.println("I'm leaving !");
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> >
> >> > I added in the file write to see if a file would be created. There
> >>is no
> >> > file created. So, while OSGi thinks the bundle is ACTIVE, the start
> >> method
> >> > appears never have to been called.
> >> >
> >> >
> >> > Can anyone tell me what I may have done wrong or provide a clue as to
> >> what
> >> > to look at to help diagnose the problem?
> >> >
> >> >
> >> > Thanks,
> >> >
> >> > Mike
> >> >
> >> >
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Hi Göktürk,
OK... Tried that. Still the same thing. There's not much to my code, so
I'm including it below. Please let me know if you see anything.
Thank you for helping me,
Mike
MyComponentImpl.java:
package cook.michael;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Invalidate;
import org.apache.felix.ipojo.annotations.Validate;
import org.apache.felix.ipojo.annotations.Instantiate;
@Component
@Instantiate
public class MyComponentImpl {
@Validate
public void start() throws IOException {
System.err.println("Starting: " );
System.out.println("I'm starting...");
try{
// Create file
FileWriter fstream = new FileWriter("/Users/mcook008/out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
throw new IOException() ;
}
@Invalidate
public void stop() {
System.out.println("I'm leaving !");
}
}
metadata.xml:
<ipojo>
<component className="cook.michael.MyComponentImpl"/>
<instance component="cook.michael.MyComponentImpl"/>
</ipojo>
iPojoTest.bnd:
Import-Package: *
Export-Package: *
#Private-Package:
Generated manefest.mf:
Manifest-Version: 1.0
Export-Package: org.apache.felix.ipojo.handler.temporal,org.apache.fel
ix.ipojo.transaction,org.apache.felix.ipojo.extender,org.apache.felix
.ipojo.whiteboard,org.apache.felix.ipojo.handlers.event,org.apache.fe
lix.ipojo.handlers.jmx,org.apache.felix.ipojo.annotations,cook.michae
l
iPOJO-Components: component { $classname="cook.michael.MyComponentImpl
" manipulation { method { $name="$init" }method { $name="start" }meth
od { $name="stop" }}}instance { $component="cook.michael.MyComponentI
mpl" }component { $name="cook.michael.MyComponentImpl" $classname="co
ok.michael.MyComponentImpl" $public="true" org.apache.felix.ipojo.ann
otations:instantiate { }callback { $transition="invalidate" $method="
stop" }callback { $transition="validate" $method="start" }manipulatio
n { method { $name="$init" }method { $name="start" }method { $name="s
top" }}}
Built-By: clement
Tool: Bnd-0.0.249
Bundle-Name: Apache Felix iPOJO Annotations
Created-By: 1.6.0_35 (Apple Inc.) & iPOJO
Bundle-Vendor: The Apache Software Foundation
Bundle-Version: 1.8.2
Build-Jdk: 1.6.0_31
Bnd-LastModified: 1350001458935
Bundle-ManifestVersion: 2
Bundle-Description: iPOJO Annotations
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-DocURL: http://felix.apache.org/site/how-to-use-ipojo-annotatio
ns.html
Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
jo.handler.temporal, org.apache.felix.ipojo.transaction, org.apache.f
elix.ipojo.architecture;version=0.9.0, org.apache.felix.ipojo.extende
r, org.apache.felix.ipojo.whiteboard, org.apache.felix.ipojo;version=
0.9.0, org.apache.felix.ipojo.handlers.event, org.apache.felix.ipojo.
handlers.jmx, org.osgi.service.cm;version=1.2, org.apache.felix.ipojo
.annotations, cook.michael
Bundle-SymbolicName: iPojoTest
Originally-Created-By: Apache Maven Bundle Plugin
On 10/11/12 7:54 PM, "Göktürk Gezer" <go...@gmail.com> wrote:
>Hi,
>
>First of all @Component is mandatory.(For annotation based usage).
>
>But this only defines your component. To actually instantiate it you
>should
>do it deliberately. One way to do that is using @Instantiate annotation.
>
>So your code would be like:
>
>@Component
>@Instantiate
>public class foo{
>
> @Validate
> public void start()
>..........
>..........
>}
>
>On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
>Michael_J_Cook@cable.comcast.com> wrote:
>
>> Sorry. Just rechecked. Used @ Component on the class. And
>> @Invalidate/@validate on the methods. Just tried removing the
>>@Component.
>> Same result. No output.
>>
>> Mike
>> Michael Cook
>> VP Technology Innovation
>> Comcast
>> One Comcast Center
>> Philadelphia, PA 19103
>> (o) 215-286-8260
>> (m) 609-458-0332
>>
>> ----- Original Message -----
>> From: Cook, Michael J. (OCTO)
>> Sent: Thursday, October 11, 2012 05:47 PM
>> To: 'users@felix.apache.org' <us...@felix.apache.org>
>> Subject: Re: Getting Started with iPOJO
>>
>> I used @validate/@invalidate alone.
>>
>> Mike
>>
>> Michael Cook
>> VP Technology Innovation
>> Comcast
>> One Comcast Center
>> Philadelphia, PA 19103
>> (o) 215-286-8260
>> (m) 609-458-0332
>>
>> ----- Original Message -----
>> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
>> Sent: Thursday, October 11, 2012 05:39 PM
>> To: users@felix.apache.org <us...@felix.apache.org>
>> Subject: Re: Getting Started with iPOJO
>>
>> Hi,
>>
>> I need to ask this first since it's not on your code snippet: Did you
>>use
>> @Component annotation for class where you've declared your start()
>>stop()
>> methods? Or did you use @Validate,@Invalidate alone?
>>
>>
>> *Regards,*
>> *Gokturk*
>>
>> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
>> Michael_J_Cook@cable.comcast.com> wrote:
>>
>> > Hi,
>> >
>> > I can't seem to find a good article that will help me resolve the
>> "getting
>> > started" issue I am facing.
>> >
>> > I am using Eclipse Juno (4.2) on my Mac.
>> >
>> > I have downloaded and installed the iPOJO eclipse plugin, from:
>> > http://clement.plop-plop.net/update/
>> >
>> > I have created a sample project following the instructions at:
>> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>> >
>> > I have integrated Felix into Eclipse as a project, following
>>instructions
>> > here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
>> >
>> > I have downloaded the following iPOJO bundle:
>> > org.apache.felix.ipojo-1.8.2.jar
>> >
>> > I've launched Felix in the Eclipse console and I've installed the
>> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>> >
>> > I've created a test bundle using iPOJO called iPojoTest.jar and I've
>> > installed it and started it in the OSGI console.
>> >
>> > I run bundles in the console and I get:
>> >
>> > g! bundles
>> >
>> > 0|Active | 0|org.apache.felix.framework (3.0.7)
>> >
>> > 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
>> >
>> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>> >
>> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>> >
>> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>> >
>> > 12|Active | 1|iPojoTest (1.4.0)
>> >
>> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>> >
>> >
>> > So, the bundle seems to have started.
>> >
>> > But I don't get any console output from my sysoutsŠ
>> >
>> > Here are the start() and stop() methods:
>> >
>> >
>> > @Validate
>> >
>> > public void start() throws IOException {
>> >
>> > System.out.println("I'm starting...");
>> >
>> > try{
>> >
>> > // Create file
>> >
>> > FileWriter fstream = new
>> > FileWriter("/Users/mcook008/out.txt");
>> >
>> > BufferedWriter out = new BufferedWriter(fstream);
>> >
>> > out.write("Hello Java");
>> >
>> > //Close the output stream
>> >
>> > out.close();
>> >
>> > }catch (Exception e){//Catch exception if any
>> >
>> > System.err.println("Error: " + e.getMessage());
>> >
>> > }
>> >
>> > throw new IOException() ;
>> >
>> > }
>> >
>> > @Invalidate
>> >
>> > public void stop() {
>> >
>> > System.out.println("I'm leaving !");
>> >
>> > }
>> >
>> >
>> >
>> >
>> > I added in the file write to see if a file would be created. There
>>is no
>> > file created. So, while OSGi thinks the bundle is ACTIVE, the start
>> method
>> > appears never have to been called.
>> >
>> >
>> > Can anyone tell me what I may have done wrong or provide a clue as to
>> what
>> > to look at to help diagnose the problem?
>> >
>> >
>> > Thanks,
>> >
>> > Mike
>> >
>> >
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
Hi,
First of all @Component is mandatory.(For annotation based usage).
But this only defines your component. To actually instantiate it you should
do it deliberately. One way to do that is using @Instantiate annotation.
So your code would be like:
@Component
@Instantiate
public class foo{
@Validate
public void start()
..........
..........
}
On Fri, Oct 12, 2012 at 1:00 AM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Sorry. Just rechecked. Used @ Component on the class. And
> @Invalidate/@validate on the methods. Just tried removing the @Component.
> Same result. No output.
>
> Mike
> Michael Cook
> VP Technology Innovation
> Comcast
> One Comcast Center
> Philadelphia, PA 19103
> (o) 215-286-8260
> (m) 609-458-0332
>
> ----- Original Message -----
> From: Cook, Michael J. (OCTO)
> Sent: Thursday, October 11, 2012 05:47 PM
> To: 'users@felix.apache.org' <us...@felix.apache.org>
> Subject: Re: Getting Started with iPOJO
>
> I used @validate/@invalidate alone.
>
> Mike
>
> Michael Cook
> VP Technology Innovation
> Comcast
> One Comcast Center
> Philadelphia, PA 19103
> (o) 215-286-8260
> (m) 609-458-0332
>
> ----- Original Message -----
> From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
> Sent: Thursday, October 11, 2012 05:39 PM
> To: users@felix.apache.org <us...@felix.apache.org>
> Subject: Re: Getting Started with iPOJO
>
> Hi,
>
> I need to ask this first since it's not on your code snippet: Did you use
> @Component annotation for class where you've declared your start() stop()
> methods? Or did you use @Validate,@Invalidate alone?
>
>
> *Regards,*
> *Gokturk*
>
> On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
> Michael_J_Cook@cable.comcast.com> wrote:
>
> > Hi,
> >
> > I can't seem to find a good article that will help me resolve the
> "getting
> > started" issue I am facing.
> >
> > I am using Eclipse Juno (4.2) on my Mac.
> >
> > I have downloaded and installed the iPOJO eclipse plugin, from:
> > http://clement.plop-plop.net/update/
> >
> > I have created a sample project following the instructions at:
> > http://felix.apache.org/site/ipojo-eclipse-plug-in.html
> >
> > I have integrated Felix into Eclipse as a project, following instructions
> > here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
> >
> > I have downloaded the following iPOJO bundle:
> > org.apache.felix.ipojo-1.8.2.jar
> >
> > I've launched Felix in the Eclipse console and I've installed the
> > org.apache.felix.ipojo-1.8.2.jar bundle and started it.
> >
> > I've created a test bundle using iPOJO called iPojoTest.jar and I've
> > installed it and started it in the OSGI console.
> >
> > I run bundles in the console and I get:
> >
> > g! bundles
> >
> > 0|Active | 0|org.apache.felix.framework (3.0.7)
> >
> > 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
> >
> > 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
> >
> > 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
> >
> > 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
> >
> > 12|Active | 1|iPojoTest (1.4.0)
> >
> > 13|Active | 1|org.apache.felix.ipojo (1.8.2)
> >
> >
> > So, the bundle seems to have started.
> >
> > But I don't get any console output from my sysouts…
> >
> > Here are the start() and stop() methods:
> >
> >
> > @Validate
> >
> > public void start() throws IOException {
> >
> > System.out.println("I'm starting...");
> >
> > try{
> >
> > // Create file
> >
> > FileWriter fstream = new
> > FileWriter("/Users/mcook008/out.txt");
> >
> > BufferedWriter out = new BufferedWriter(fstream);
> >
> > out.write("Hello Java");
> >
> > //Close the output stream
> >
> > out.close();
> >
> > }catch (Exception e){//Catch exception if any
> >
> > System.err.println("Error: " + e.getMessage());
> >
> > }
> >
> > throw new IOException() ;
> >
> > }
> >
> > @Invalidate
> >
> > public void stop() {
> >
> > System.out.println("I'm leaving !");
> >
> > }
> >
> >
> >
> >
> > I added in the file write to see if a file would be created. There is no
> > file created. So, while OSGi thinks the bundle is ACTIVE, the start
> method
> > appears never have to been called.
> >
> >
> > Can anyone tell me what I may have done wrong or provide a clue as to
> what
> > to look at to help diagnose the problem?
> >
> >
> > Thanks,
> >
> > Mike
> >
> >
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
Sorry. Just rechecked. Used @ Component on the class. And @Invalidate/@validate on the methods. Just tried removing the @Component. Same result. No output.
Mike
Michael Cook
VP Technology Innovation
Comcast
One Comcast Center
Philadelphia, PA 19103
(o) 215-286-8260
(m) 609-458-0332
----- Original Message -----
From: Cook, Michael J. (OCTO)
Sent: Thursday, October 11, 2012 05:47 PM
To: 'users@felix.apache.org' <us...@felix.apache.org>
Subject: Re: Getting Started with iPOJO
I used @validate/@invalidate alone.
Mike
Michael Cook
VP Technology Innovation
Comcast
One Comcast Center
Philadelphia, PA 19103
(o) 215-286-8260
(m) 609-458-0332
----- Original Message -----
From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
Sent: Thursday, October 11, 2012 05:39 PM
To: users@felix.apache.org <us...@felix.apache.org>
Subject: Re: Getting Started with iPOJO
Hi,
I need to ask this first since it's not on your code snippet: Did you use
@Component annotation for class where you've declared your start() stop()
methods? Or did you use @Validate,@Invalidate alone?
*Regards,*
*Gokturk*
On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hi,
>
> I can't seem to find a good article that will help me resolve the "getting
> started" issue I am facing.
>
> I am using Eclipse Juno (4.2) on my Mac.
>
> I have downloaded and installed the iPOJO eclipse plugin, from:
> http://clement.plop-plop.net/update/
>
> I have created a sample project following the instructions at:
> http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>
> I have integrated Felix into Eclipse as a project, following instructions
> here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
>
> I have downloaded the following iPOJO bundle:
> org.apache.felix.ipojo-1.8.2.jar
>
> I've launched Felix in the Eclipse console and I've installed the
> org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>
> I've created a test bundle using iPOJO called iPojoTest.jar and I've
> installed it and started it in the OSGI console.
>
> I run bundles in the console and I get:
>
> g! bundles
>
> 0|Active | 0|org.apache.felix.framework (3.0.7)
>
> 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
>
> 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>
> 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>
> 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>
> 12|Active | 1|iPojoTest (1.4.0)
>
> 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>
>
> So, the bundle seems to have started.
>
> But I don't get any console output from my sysouts…
>
> Here are the start() and stop() methods:
>
>
> @Validate
>
> public void start() throws IOException {
>
> System.out.println("I'm starting...");
>
> try{
>
> // Create file
>
> FileWriter fstream = new
> FileWriter("/Users/mcook008/out.txt");
>
> BufferedWriter out = new BufferedWriter(fstream);
>
> out.write("Hello Java");
>
> //Close the output stream
>
> out.close();
>
> }catch (Exception e){//Catch exception if any
>
> System.err.println("Error: " + e.getMessage());
>
> }
>
> throw new IOException() ;
>
> }
>
> @Invalidate
>
> public void stop() {
>
> System.out.println("I'm leaving !");
>
> }
>
>
>
>
> I added in the file write to see if a file would be created. There is no
> file created. So, while OSGi thinks the bundle is ACTIVE, the start method
> appears never have to been called.
>
>
> Can anyone tell me what I may have done wrong or provide a clue as to what
> to look at to help diagnose the problem?
>
>
> Thanks,
>
> Mike
>
>
Re: Getting Started with iPOJO
Posted by "Cook, Michael J. (OCTO)" <Mi...@cable.comcast.com>.
I used @validate/@invalidate alone.
Mike
Michael Cook
VP Technology Innovation
Comcast
One Comcast Center
Philadelphia, PA 19103
(o) 215-286-8260
(m) 609-458-0332
----- Original Message -----
From: Göktürk Gezer [mailto:gokturk.gezer@gmail.com]
Sent: Thursday, October 11, 2012 05:39 PM
To: users@felix.apache.org <us...@felix.apache.org>
Subject: Re: Getting Started with iPOJO
Hi,
I need to ask this first since it's not on your code snippet: Did you use
@Component annotation for class where you've declared your start() stop()
methods? Or did you use @Validate,@Invalidate alone?
*Regards,*
*Gokturk*
On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hi,
>
> I can't seem to find a good article that will help me resolve the "getting
> started" issue I am facing.
>
> I am using Eclipse Juno (4.2) on my Mac.
>
> I have downloaded and installed the iPOJO eclipse plugin, from:
> http://clement.plop-plop.net/update/
>
> I have created a sample project following the instructions at:
> http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>
> I have integrated Felix into Eclipse as a project, following instructions
> here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
>
> I have downloaded the following iPOJO bundle:
> org.apache.felix.ipojo-1.8.2.jar
>
> I've launched Felix in the Eclipse console and I've installed the
> org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>
> I've created a test bundle using iPOJO called iPojoTest.jar and I've
> installed it and started it in the OSGI console.
>
> I run bundles in the console and I get:
>
> g! bundles
>
> 0|Active | 0|org.apache.felix.framework (3.0.7)
>
> 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
>
> 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>
> 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>
> 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>
> 12|Active | 1|iPojoTest (1.4.0)
>
> 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>
>
> So, the bundle seems to have started.
>
> But I don't get any console output from my sysouts…
>
> Here are the start() and stop() methods:
>
>
> @Validate
>
> public void start() throws IOException {
>
> System.out.println("I'm starting...");
>
> try{
>
> // Create file
>
> FileWriter fstream = new
> FileWriter("/Users/mcook008/out.txt");
>
> BufferedWriter out = new BufferedWriter(fstream);
>
> out.write("Hello Java");
>
> //Close the output stream
>
> out.close();
>
> }catch (Exception e){//Catch exception if any
>
> System.err.println("Error: " + e.getMessage());
>
> }
>
> throw new IOException() ;
>
> }
>
> @Invalidate
>
> public void stop() {
>
> System.out.println("I'm leaving !");
>
> }
>
>
>
>
> I added in the file write to see if a file would be created. There is no
> file created. So, while OSGi thinks the bundle is ACTIVE, the start method
> appears never have to been called.
>
>
> Can anyone tell me what I may have done wrong or provide a clue as to what
> to look at to help diagnose the problem?
>
>
> Thanks,
>
> Mike
>
>
Re: Getting Started with iPOJO
Posted by Göktürk Gezer <go...@gmail.com>.
Hi,
I need to ask this first since it's not on your code snippet: Did you use
@Component annotation for class where you've declared your start() stop()
methods? Or did you use @Validate,@Invalidate alone?
*Regards,*
*Gokturk*
On Thu, Oct 11, 2012 at 8:13 PM, Cook, Michael J. (OCTO) <
Michael_J_Cook@cable.comcast.com> wrote:
> Hi,
>
> I can't seem to find a good article that will help me resolve the "getting
> started" issue I am facing.
>
> I am using Eclipse Juno (4.2) on my Mac.
>
> I have downloaded and installed the iPOJO eclipse plugin, from:
> http://clement.plop-plop.net/update/
>
> I have created a sample project following the instructions at:
> http://felix.apache.org/site/ipojo-eclipse-plug-in.html
>
> I have integrated Felix into Eclipse as a project, following instructions
> here: http://felix.apache.org/site/integrating-felix-with-eclipse.html
>
> I have downloaded the following iPOJO bundle:
> org.apache.felix.ipojo-1.8.2.jar
>
> I've launched Felix in the Eclipse console and I've installed the
> org.apache.felix.ipojo-1.8.2.jar bundle and started it.
>
> I've created a test bundle using iPOJO called iPojoTest.jar and I've
> installed it and started it in the OSGI console.
>
> I run bundles in the console and I get:
>
> g! bundles
>
> 0|Active | 0|org.apache.felix.framework (3.0.7)
>
> 1|Active | 1|org.apache.felix.bundlerepository (1.6.2)
>
> 2|Active | 1|org.apache.felix.gogo.command (0.6.1)
>
> 3|Active | 1|org.apache.felix.gogo.runtime (0.6.1)
>
> 4|Active | 1|org.apache.felix.gogo.shell (0.6.1)
>
> 12|Active | 1|iPojoTest (1.4.0)
>
> 13|Active | 1|org.apache.felix.ipojo (1.8.2)
>
>
> So, the bundle seems to have started.
>
> But I don't get any console output from my sysouts…
>
> Here are the start() and stop() methods:
>
>
> @Validate
>
> public void start() throws IOException {
>
> System.out.println("I'm starting...");
>
> try{
>
> // Create file
>
> FileWriter fstream = new
> FileWriter("/Users/mcook008/out.txt");
>
> BufferedWriter out = new BufferedWriter(fstream);
>
> out.write("Hello Java");
>
> //Close the output stream
>
> out.close();
>
> }catch (Exception e){//Catch exception if any
>
> System.err.println("Error: " + e.getMessage());
>
> }
>
> throw new IOException() ;
>
> }
>
> @Invalidate
>
> public void stop() {
>
> System.out.println("I'm leaving !");
>
> }
>
>
>
>
> I added in the file write to see if a file would be created. There is no
> file created. So, while OSGi thinks the bundle is ACTIVE, the start method
> appears never have to been called.
>
>
> Can anyone tell me what I may have done wrong or provide a clue as to what
> to look at to help diagnose the problem?
>
>
> Thanks,
>
> Mike
>
>