Hi,

There is some issue in your code:
- Unvalidate does not exist it's Invalidate.
- except if it's your goal, publishing Runnable as a service is not
necessary a good idea, you can specify the set of provided services in
@Provides

The following code works:
@Component(name="toto", propagation=true, architecture=true,
        immediate=true, managedservice="titi")
@Provides
public class TotoImpl implements Runnable {

            @Property
            String aproperty = null;

            @Validate
            public void start() {
                System.out.println("Started...");
            }

            @Invalidate
            public void stop() {
                System.out.println("Stopped...");
            }

            public void run() {
                // TODO Auto-generated method stub

            }
}

Then, with the following instance declaration:
<instance component="org.apache.felix.ipojo.sample.Toto"/>

the managed service is correctly exposed:
{org.osgi.service.cm.ManagedService}={service.pid=titi, factory.name=toto,
instance.name=toto-0, service.id=34}

Regards,

Clement



2009/8/11 [email protected] <[email protected]>

> Hello,
>
> I'm new to Felix + iPojo and I'm trying to build a service which will be
> exposed to the configuration admin at the Felix start.
> In order to achieve my aims I've this source code in my service:
>
> @Component(name="toto", propagation=true, architecture=true,
> immediate=true, managedservice="titi")
> @Provides
> public class TotoServiceImpl implements Runnable, TotoService {
>
> @Property
> String aproperty = null
>
> @Validate
> public void start() {
> ...
> }
>
> @Unvalidate
> public void stop() {
> ...
> }
>
> @Override
> public void run() {
> ...
> }
>
> }
>
> I instanciate my service through my pom.xml:
>
>                                    <instance
> component="Foo.TotoServiceImpl">
>                                        <property name="aproperty"
> value="TEST"/>
>                                    </instance>
>
> So when starting my felix I can see my service thanks arch command:
>
> ...
> Instance toto-0 -> valid
> ...
>
> and thanks services command:
>
> ...
> Foo.TotoServiceImpl
> ...
>
>
> But as you can see my managedservicepid is not taking into account and
> when I try the command arch -instance it return me "Instance not found" ...
>
> Did I miss something ???
>
> Thanks for all
>
> ++
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to