Hi,

On 06.10.2010, at 09:31, Bengt Rodehav wrote:

> Clement,
> 
> Have you had a chance to look at this? I'm thinking about upgrading to iPOJO
> 1.6.0 but I need to know whether this type of behavior is supported by iPOJO
> or if it just happens to work. If it's not supported I would strongly wish
> that it will be in the next iPOJO version (is that 1.8.0?).

My first impression is, it's supported (I've found one modification fixing the 
issue between 1.4.0 and 1.6.0). However, I still didn't write a test case to 
avoid future regressions. In case of a bug it would 1.6.6 not 1.8.0 (minor bug 
fixes).

Clement

> 
> /Bengt
> 
> 2010/10/4 Bengt Rodehav <[email protected]>
> 
>> JIRA created:
>> 
>> https://issues.apache.org/jira/browse/FELIX-2636
>> 
>> <https://issues.apache.org/jira/browse/FELIX-2636>/Bengt
>> 
>> 2010/10/4 Clement Escoffier <[email protected]>
>> 
>>> 
>>> On 04.10.2010, at 21:04, Bengt Rodehav wrote:
>>> 
>>>> Clement,
>>>> 
>>>> I added:
>>>> 
>>>> @Updated
>>>>> 
>>>>> public void updated(Dictionary theDict) {
>>>>> 
>>>>>   System.out.println("updated: " + theDict);
>>>>> 
>>>>>   mValid = true;
>>>>> 
>>>>> }
>>>>> 
>>>>> 
>>>> I do get the output to System.out but the instance is still invalid.
>>>> 
>>>> 
>>>> updated: {include=(?i).*(?<!\.TMP), redelivery.maxAttempts=10,
>>>>> delimiter=<DELIM>
>>>> 
>>>> , connect.enabled=false, deleteProcessedFiles=false,
>>> skipEmptyFiles=false,
>>>>> servi
>>>> 
>>>> ce.factoryPid=connect.skandia.filetransfer, delay=60000,
>>>>> fromUri=file:data/conne
>>>> 
>>>> ct/test/sample/file2file, connect.name=Sample file transfer from file
>>> to
>>>>> file, f
>>>> 
>>>> 
>>> elix.fileinstall.filename=connect.skandia.filetransfer-sample-file2file.cfg,
>>>>> alw
>>>> 
>>>> aysDisconnect=true,
>>>>> service.pid=connect.skandia.filetransfer.694a9c3c-9319-46b0-
>>>> 
>>>> 997f-70af37f40da2,
>>>>> redelivery.delaypattern=0:2000;5:10000;10:60000;20:600000;25:
>>>> 
>>>> 1800000, temporaryFileName=${file:name.noext}.tmp,
>>>>> toUris=file:data/connect/test
>>>> 
>>>> /sample/file2file/test-out}
>>>> 
>>>> 
>>>> I don't seem to get the same problem with iPOJO 1.6.0. Maybe the problem
>>> has
>>>> been "fixed". Nevertheless, it's important for me to know that I don't
>>>> speculate in a particular implementation detail but that I take
>>> advantage of
>>>> supported behaviour (preferably supported by some junit test case in
>>> iPOJO).
>>>> 
>>>> Should I still create a JIRA ticket?
>>> 
>>> Yes please. Because I didn't fix anything in this area. I need to look
>>> into this and create a test case (to avoid regressions).
>>> 
>>> Regards,
>>> 
>>> Clement
>>> 
>>> 
>>>> 
>>>> /Bengt
>>>> 
>>>> 2010/10/4 Clement Escoffier <[email protected]>
>>>> 
>>>>> Hi,
>>>>> 
>>>>> On 04.10.2010, at 18:00, Bengt Rodehav wrote:
>>>>> 
>>>>>> Clement,
>>>>>> 
>>>>>> Like I wrote before, I did manage to get iPOJO 1.6.0 to work for me.
>>>>>> However, once I got it to work I realised that the @ServiceController
>>> is
>>>>> not
>>>>>> really what I need. It's the @Controller. I haven't quite filled you
>>> in
>>>>> with
>>>>>> all the details. This is what I do:
>>>>>> 
>>>>>> I use OSGi service factories to instantiate "integration services" in
>>> my
>>>>>> Karaf/Camel based integration platform. Most of the integration
>>> services
>>>>> are
>>>>>> implemented as Camel routes (but not all of them).
>>>>>> 
>>>>>> When an instance becomes valid I start the camel route and when the
>>>>> instance
>>>>>> becomes invalid I stop it:
>>>>>> 
>>>>>> @Validate
>>>>>> 
>>>>>> public void start() {
>>>>>> 
>>>>>>  startContext();
>>>>>> 
>>>>>> }
>>>>>> 
>>>>>> 
>>>>>>> @Invalidate
>>>>>> 
>>>>>> public void stop() {
>>>>>> 
>>>>>>  stopContext();
>>>>>> 
>>>>>> }
>>>>>> 
>>>>>> 
>>>>>> I use a configuration property (the connect.enabled) to control
>>> whether a
>>>>>> particular integration service should be up-and-running or not, using
>>> the
>>>>>> following code:
>>>>>> 
>>>>>> @Controller
>>>>>> 
>>>>>> @Property(name = "connect.enabled", mandatory = true)
>>>>>> 
>>>>>> private boolean mValid = false;
>>>>>> 
>>>>>> 
>>>>>> Note that the way I do it above makes sure that a disabled service
>>> cannot
>>>>>> start (this was my original problem). However, now I get problems on
>>>>> startup
>>>>>> (Karaf startup). Although the property "connect.enabled" is true, the
>>>>>> instance is still invalid. Looking under the iPOJO tab in the
>>> Webconsole
>>>>> I
>>>>>> can see that iPOJO regards this property as false and thus regards the
>>>>> iPOJO
>>>>>> instance as invalid. Looking under the Configuration tab I can see
>>> that
>>>>>> Configuration Manager regards it as true.
>>>>>> 
>>>>>> There must be some kind of timing problem here. iPOJO regards the
>>>>> instance
>>>>>> as invalid (connect.enabled=false the way I initialise it) and then
>>>>> doesn't
>>>>>> pick up the change from configuration manager. My original problem was
>>>>> the
>>>>>> opposite since I initialised it to true instead. Then iPOJO regarded
>>> the
>>>>>> instance as valid and failed to pick up information from configuration
>>>>>> manager that said it was disabled.
>>>>>> 
>>>>>> How can I get this to work? (Note that I now use iPOJO 1.4.0 but I can
>>>>>> upgrade if that would help)
>>>>>> 
>>>>>> What I want to achieve is, I believe, rather trivial and it's hard to
>>>>>> believe that no one else has thought of this use case:
>>>>>> 
>>>>>> "Control the validity of an iPOJO instance using a configuration
>>>>> property".
>>>>> 
>>>>> There is two points here:
>>>>> - I think there is a bug. In fact the @Controller and @Property are
>>>>> completely disconnected (handler are complete separated). But, both
>>> should
>>>>> check the current value of the field during initialization, listen
>>> onSet on
>>>>> the field and call onSet when they receive a new value. It sounds like
>>> one
>>>>> of those handlers does not respect these instructions. I bet on the
>>>>> Controller :-)
>>>>> - could you try to add a @Updated method or use a setter for the
>>> property.
>>>>> In these method really assign the controller field to the desired value
>>>>> (false|true) like m_controller = true|false. If it's works, it's
>>> definitely
>>>>> a bug, so please fill a bug.
>>>>> 
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Clement
>>>>> 
>>>>> 
>>>>>> 
>>>>>> Any clues?
>>>>>> 
>>>>>> BTW I also publish a service to enable my GUI to show me, and interact
>>>>> with,
>>>>>> all running "integration services". It makes it easy to find all of
>>> "my
>>>>>> services".
>>>>>> 
>>>>>> /Bengt
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 2010/10/4 Clement Escoffier <[email protected]>
>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> On 03.10.2010, at 21:08, Bengt Rodehav wrote:
>>>>>>> 
>>>>>>>> Clement,
>>>>>>>> 
>>>>>>>> Now that used your tip (from the FAQ), it works fine with
>>>>>>> maven-ipojo-plugin
>>>>>>>> version 1.6.0. The real error was of course that I used the wrong
>>>>> version
>>>>>>> of
>>>>>>>> the manipulator. I dont't know why the latest version from trunk
>>>>>>>> (1.7.0-SNAPSHOT) seemed the hide that error but it's gone now that I
>>>>> use
>>>>>>> the
>>>>>>>> correct manipulator version.
>>>>>>> 
>>>>>>> I've to check that... I will look into that.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> 
>>>>>>> Clement
>>>>>>> 
>>>>>>>> 
>>>>>>>> /Bengt
>>>>>>>> 
>>>>>>>> 2010/10/3 Bengt Rodehav <[email protected]>
>>>>>>>> 
>>>>>>>>> Thanks Clement - that worked perfectly!
>>>>>>>>> 
>>>>>>>>> I don't know how I've missed that FAQ but now I learned something
>>> new.
>>>>>>>>> 
>>>>>>>>> Yes, I used the latest maven-ipojo-plugin from trunk.
>>>>>>>>> 
>>>>>>>>> /Bengt
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 2010/10/3 clement escoffier <[email protected]>
>>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>>> 
>>>>>>>>>> 2010/10/3 Bengt Rodehav <[email protected]>
>>>>>>>>>> 
>>>>>>>>>>> Clement,
>>>>>>>>>>> 
>>>>>>>>>>> I've upgrade to iPOJO 1.6.0 but I still have problems exposing
>>>>>>> services
>>>>>>>>>>> using the @ServiceController.
>>>>>>>>>>> 
>>>>>>>>>>> I get:
>>>>>>>>>>> 
>>>>>>>>>>> factory name="connect.skandia.filetransfer" state="invalid"
>>>>>>> bundle="86"
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> implementation-class="se.digia.connect.services.skandia.filetransfer.FileTransferService"
>>>>>>>>>>> missinghandlers
>>>>>>>>>>> list="[org.apache.felix.ipojo.annotations:servicecontroller]"
>>>>>>>>>>> requiredhandlers list="[org.apache.felix.ipojo:requires,
>>>>>>>>>>> org.apache.felix.ipojo:properties,
>>> org.apache.felix.ipojo:callback,
>>>>>>>>>>> org.apache.felix.ipojo:provides,
>>>>>>>>>>> org.apache.felix.ipojo.annotations:servicecontroller,
>>>>>>>>>>> org.apache.felix.ipojo:architecture]"
>>>>>>>>>>> 
>>>>>>>>>>> in the Webconsole under iPOJO/factories. It seems iPOJO cannot
>>> find
>>>>> a
>>>>>>>>>>> handler for
>>>>>>>>>>> 
>>>>>>>>>>> org.apache.felix.ipojo.annotations:servicecontroller
>>>>>>>>>>> 
>>>>>>>>>>> What bundle am I missing?
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> No, but you must use the manipulator 1.6.4 as explained in:
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> http://felix.apache.org/site/ipojo-faq.html#iPOJOFAQ-Usingadifferentversionofthemanipulatorduringthemanipulation
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> BTW I also move away from using the ipojo url handler (online
>>>>>>>>>> manipulator)
>>>>>>>>>>> and started using the maven-ipojo-plugin instead. It turns out I
>>>>>>> cannot
>>>>>>>>>> use
>>>>>>>>>>> the latest released version of the plugin (1.6.0) but I have to
>>> use
>>>>>>>>>>> 1.7.0-SNAPSHOT.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Here is the configuration you should use.
>>>>>>>>>> 
>>>>>>>>>> <plugin>
>>>>>>>>>>    <groupId>org.apache.felix</groupId>
>>>>>>>>>>    <artifactId>maven-ipojo-plugin</artifactId>
>>>>>>>>>>    <executions>
>>>>>>>>>>      <execution>
>>>>>>>>>>        <goals>
>>>>>>>>>>          <goal>ipojo-bundle</goal>
>>>>>>>>>>        </goals>
>>>>>>>>>>      </execution>
>>>>>>>>>>    </executions>
>>>>>>>>>>    <dependencies>
>>>>>>>>>>            <dependency>
>>>>>>>>>>                    <groupId>org.apache.felix</groupId>
>>>>>>>>>> 
>>>>>>>>>> <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
>>>>>>>>>>                    <version>1.6.4</version>
>>>>>>>>>>            </dependency>
>>>>>>>>>>    </dependencies>
>>>>>>>>>>  </plugin>
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> Otherwise I get the following exception:
>>>>>>>>>>> 
>>>>>>>>>>> java.lang.NullPointerException
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> I will look into that. Did you use the latest from trunk ?
>>>>>>>>>> 
>>>>>>>>>> Regards,
>>>>>>>>>> 
>>>>>>>>>> Clement
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.manipulation.annotations.MetadataCollector.visitEnd(MetadataCollector.java:215)
>>>>>>>>>>> 
>>>>>>>>>>>    at org.objectweb.asm.ClassReader.accept(Unknown Source)
>>>>>>>>>>> 
>>>>>>>>>>>    at org.objectweb.asm.ClassReader.accept(Unknown Source)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.manipulator.Pojoization.computeAnnotations(Pojoization.java:294)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.manipulator.Pojoization.manipulateComponents(Pojoization.java:484)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.manipulator.Pojoization.manipulateJarFile(Pojoization.java:335)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.manipulator.Pojoization.pojoization(Pojoization.java:194)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.plugin.ManipulatorMojo.execute(ManipulatorMojo.java:199)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>>>>>>>>>>> 
>>>>>>>>>>>    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>> 
>>>>> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>>>>>>>>>>> 
>>>>>>>>>>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>>> 
>>>>>>>>>>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>> org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>>>>>>>>> 
>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>>>>>>>>> 
>>>>>>>>>>>    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> /Bengt
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> /Bengt
>>>>>>>>>>> 
>>>>>>>>>>> 2010/10/1 Clement Escoffier <[email protected]>
>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On 01.10.2010, at 18:30, Bengt Rodehav wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Clement,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Just a clarification:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> When you restart your instance, be sure that the filed is
>>> really
>>>>>>>>>>>> re-assigned
>>>>>>>>>>>>>> to false. To be sure, make your instance immediate and set the
>>>>>>>>>> field
>>>>>>>>>>> in
>>>>>>>>>>>> the
>>>>>>>>>>>>>> constructor.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I suspect you misspelled "filed". I'm not sure what you mean
>>> here.
>>>>>>>>>> My
>>>>>>>>>>>>> "mValid" field will be set from a configuration that file
>>> install
>>>>>>>>>> picks
>>>>>>>>>>>> up.
>>>>>>>>>>>>> If the configuration value "connect.enabled" is set to true
>>> (which
>>>>>>>>>> is
>>>>>>>>>>> the
>>>>>>>>>>>>> normal case) then I want the service to be started. If it is
>>> set
>>>>> to
>>>>>>>>>>>> false,
>>>>>>>>>>>>> then I do not want to start nor publish a service yet.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I want to make sure that I never have a mismatch, that is if
>>>>>>>>>>>>> the "connect.enabled" property is false, then the service can
>>>>> never
>>>>>>>>>> be
>>>>>>>>>>>>> started and vice versa. It is important that services that I
>>> have
>>>>>>>>>>>> "disabled"
>>>>>>>>>>>>> this way is never started (which has unfortunately
>>> happened...).
>>>>>>>>>>>> 
>>>>>>>>>>>> I never tested having the @ServiceController on the same field
>>> as a
>>>>>>>>>>>> @Property. This may have some side effects, like not-yet
>>> injected
>>>>>>>>>> values.
>>>>>>>>>>>> Try to set your component as immediate. This will force the
>>>>>>> injection.
>>>>>>>>>> In
>>>>>>>>>>>> fact, if the property has the value false, but there is no
>>> object
>>>>>>>>>>> created,
>>>>>>>>>>>> the
>>>>>>>>>>>> @ServiceController has no way to know the current value. If the
>>>>>>>>>> instance
>>>>>>>>>>> is
>>>>>>>>>>>> immediate, an object is created and the field is assigned to the
>>>>>>>>>> property
>>>>>>>>>>>> value.
>>>>>>>>>>>> This will allow the service controller to get the value.
>>>>>>>>>>>> 
>>>>>>>>>>>> Clement
>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> /Bengt
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 2010/10/1 Clement Escoffier <[email protected]>
>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> On 01.10.2010, at 17:03, Bengt Rodehav wrote:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> OK - obviously @ServiceController is what I need...
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> As said by Richard, The @ServiceController impacts the service
>>>>>>>>>>> lifecycle
>>>>>>>>>>>>>> The @Controller impacts the instance lifecycle. The
>>> @Controller
>>>>> is
>>>>>>>>>>>> generally
>>>>>>>>>>>>>> used to detect wrong configuration or really bad state where
>>> the
>>>>>>>>>>>> instance
>>>>>>>>>>>>>> decide to become invalid.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> The @ServiceController is not tied to the instance lifecycle,
>>>>> which
>>>>>>>>>>>> means
>>>>>>>>>>>>>> that despite the instance is valid, the service can be
>>>>> unpublished
>>>>>>>>>>> using
>>>>>>>>>>>> the
>>>>>>>>>>>>>> @ServiceController.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> When you restart your instance, be sure that the filed is
>>> really
>>>>>>>>>>>>>> re-assigned to false. To be sure, make your instance immediate
>>>>> and
>>>>>>>>>> set
>>>>>>>>>>>> the
>>>>>>>>>>>>>> field in the constructor.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Clement
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> /Bengt
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 2010/10/1 Richard S. Hall <[email protected]>
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> On 10/1/10 10:41, Bengt Rodehav wrote:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> OK - thanks,
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> BTW, what then is @Controller used for?
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> It is for disabling the component itself and is generally
>>> more
>>>>> to
>>>>>>>>>>>> signal
>>>>>>>>>>>>>>>> error conditions from which the component cannot recover,
>>> such
>>>>> as
>>>>>>>>>>>> faulty
>>>>>>>>>>>>>> or
>>>>>>>>>>>>>>>> missing configuration. On the other hand, @ServiceController
>>>>>>>>>> allows
>>>>>>>>>>>> you
>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>> control when your services are provided.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> -> richard
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> /Bengt
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 2010/10/1 Karl Pauls<[email protected]>
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> iirc, you want the @ServiceController and not the
>>> @Controller
>>>>>>>>>> and
>>>>>>>>>>>>>>>>>> again iirc, you need to update to ipojo 1.6.x for that
>>> one.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> regards,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Karl
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> On Fri, Oct 1, 2010 at 4:06 PM, Bengt Rodehav<
>>>>>>>>>> [email protected]>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I'm using iPOJO 1.4.0. My installed iPOJO related
>>> artifacts
>>>>>>>>>> (in
>>>>>>>>>>>> Karaf
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 1.6.0)
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> are:
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.ipojo-1.4.0.jar
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.ipojo.handler.extender-1.4.0.jar
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.ipojo.online.manipulator-1.4.2.jar
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.ipojo.webconsole-1.4.0.jar
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I also use
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.fileinstall-3.0.2.jar
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> ... and a whole lot of other bundles.
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I publish services using factories. An example of a
>>>>>>>>>> configuration
>>>>>>>>>>>>>> file
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> for
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> my factories is:
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.enabled=true
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.name=Sample file transfer from file to file
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> The "connect.enabled" property is bound to the field in
>>> my
>>>>>>>>>>> service
>>>>>>>>>>>>>> class
>>>>>>>>>>>>>>>>>>> that is a "controller":
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> @Controller
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> @Property(name = "connect.enabled", mandatory = false,
>>> value
>>>>> =
>>>>>>>>>>>>>> "true")
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> private boolean mValid;
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> The intention is that I can then disable my service by
>>>>> setting
>>>>>>>>>>> this
>>>>>>>>>>>>>>>>>>> configuration property to false. However, I've encounted
>>> a
>>>>>>>>>>> problem
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> regarding
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> this. While the service is active, I set
>>> "connect.enabled"
>>>>> to
>>>>>>>>>>>> false.
>>>>>>>>>>>>>>>>>>> File
>>>>>>>>>>>>>>>>>>> install picks up the changes and the service is
>>>>> de-registered
>>>>>>>>>> -
>>>>>>>>>>>> works
>>>>>>>>>>>>>>>>>>> perfectly. But if I now shutdown Karaf and restart it
>>> again,
>>>>>>>>>> the
>>>>>>>>>>>>>> service
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> started (registered) despite the fact that
>>>>> "connect.disabled"
>>>>>>>>>> is
>>>>>>>>>>>>>> still
>>>>>>>>>>>>>>>>>>> false. Is this a bug in iPOJO or have I misunderstood
>>>>>>>>>> something?
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> When googling about this problem I noticed that there is
>>>>> also
>>>>>>>>>> an
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> annotation
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> called @ServiceController. What is the difference between
>>>>>>>>>>>> @Controller
>>>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>>>> @ServiceController?
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I tried to switch to @ServiceController instead but get
>>> the
>>>>>>>>>>>> following
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> error:
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 2010-10-01 15:48:03,341 | ERROR | guration Updater |
>>>>>>>>>> configadmin
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>>    | ?                                   ? |
>>>>>>>>>>>>>>>>>>>> [org.apache.felix.ipojo.Factory,
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.osgi.service.cm.ManagedServiceFactory,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> id=174, bundle=84]: Updating configuration property
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> {service.pid=connect.skandia.filetransfer.269d25ad-c4d6-4277-9d78-6d4b15acb795,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> fromuri=file:data/connect/test/sample/file2file,
>>>>>>>>>>>>>>>>>>>> touris=file:data/connect/test/sample/file2file/test-out,
>>>>>>>>>>>>>>>>>>>> service.factorypid=connect.skandia.filetransfer,
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> felix.fileinstall.filename=connect.skandia.filetransfer-sample-file2file.cfg,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.enabled=true, instance.name
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>> =connect.skandia.filetransfer.269d25ad-c4d6-4277-9d78-6d4b15acb795,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.name=Sample file transfer from file to file}
>>> caused
>>>>> a
>>>>>>>>>>>>>> problem:
>>>>>>>>>>>>>>>>>>>> Missing handlers :
>>>>>>>>>>>>>> org.apache.felix.ipojo.annotations:servicecontroller
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.osgi.service.cm.ConfigurationException:
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> {service.pid=connect.skandia.filetransfer.269d25ad-c4d6-4277-9d78-6d4b15acb795,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> fromuri=file:data/connect/test/sample/file2file,
>>>>>>>>>>>>>>>>>>>> touris=file:data/connect/test/sample/file2file/test-out,
>>>>>>>>>>>>>>>>>>>> service.factorypid=connect.skandia.filetransfer,
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> felix.fileinstall.filename=connect.skandia.filetransfer-sample-file2file.cfg,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.enabled=true, instance.name
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>> =connect.skandia.filetransfer.269d25ad-c4d6-4277-9d78-6d4b15acb795,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> connect.name=Sample file transfer from file to file} :
>>>>>>>>>> Missing
>>>>>>>>>>>>>> handlers
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> :
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> org.apache.felix.ipojo.annotations:servicecontroller
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.ipojo.IPojoFactory.updated(IPojoFactory.java:609)[38:org.apache.felix.ipojo:1.4.0]
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1279)[6:org.apache.felix.configadmin:1.2.4]
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)[6:org.apache.felix.configadmin:1.2.4]
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I'm not sure in which jar the
>>>>>>>>>>>>>>>>>>> " org.apache.felix.ipojo.annotations:servicecontroller"
>>>>>>>>>> resides.
>>>>>>>>>>> I
>>>>>>>>>>>>>> tried
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> deploy
>>> "org.apache.felix.ipojo.handler.whiteboard-1.4.0.jar"
>>>>>>>>>> but
>>>>>>>>>>> it
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> didn't
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> seem to help.
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> Can anyone help me sort this out?
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> /Bengt
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>> Karl Pauls
>>>>>>>>>>>>>>>>>> [email protected]
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>> [email protected]
>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>> [email protected]
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>> [email protected]
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>> 
>>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to