The number is the number of the factory configuration to create. As I
said, it is a managed service factory not only a managed service. You
are free to pick any number you like I think.

regards,

Karl

On Mon, Mar 30, 2009 at 11:43 PM, Joel Schuster <[email protected]> wrote:
> I still can't seem to get this working... I tried both the component name and 
> the instance name.
>
> How would I determine what the -<number> would be?
>
> Based on what I read here: 
> http://felix.apache.org/site/apache-felix-file-install.html
>
> It seems to say that it would be something like: LogClientExample.cfg like 
> you were saying.
>
> Also, just because it's 'REQUIRED' doesn't keep it from being installed and 
> activated.
>
> Here's the info from the Configuration Status tab of the Web Console:
>
> 48=[org.apache.felix.ipojo.Factory, org.osgi.service.cm.ManagedServiceFactory]
>  Bundle=com.examples.logclient (0) "com.examples.logclient"
>  Using Bundles=[org.apache.felix.configadmin (1.0.10) "Apache Felix 
> Configuration Admin Service"]
>  component.class=com.examples.logclient.LogClient
>  component.description=factory name="LogClientExample" state="valid" 
> bundle="24" implementation-class="com.examples.logclient.LogClient"
>        missinghandlers list="[]"
>        property name="logString" value="REQUIRED" type="java.lang.String"
>        requiredhandlers list="[org.apache.felix.ipojo:requires, 
> org.apache.felix.ipojo:callback, org.apache.felix.ipojo:properties, 
> org.apache.felix.ipojo:architecture]"
>  component.properties=[org.apache.felix.ipojo.architecture.propertydescript...@b30913]
>  component.providedServiceSpecifications=[]
>  factory.name=LogClientExample
>  factory.state=1
>  service.pid=LogClientExample
>
>
>
>
>> -----Original Message-----
>> From: Karl Pauls [mailto:[email protected]]
>> Sent: Monday, March 30, 2009 3:22 PM
>> To: [email protected]
>> Subject: Re: cfg files for PaxLogging and iPOJO
>>
>> Iirc, the instance name is used for the configuration and it is really
>> a managed service factory -- hence, the file should be named something
>> like this:
>>
>> LogClientExample-4711.cfg
>>
>> regards,
>>
>> Karl
>>
>> p.s.: In case you want your service to only be created and activated
>> if there is  a valid properties configuration then add:
>> @Property(mandatory=true)
>>
>>
>> On Mon, Mar 30, 2009 at 11:10 PM, Joel Schuster <[email protected]> wrote:
>> > I got the PaxLogging config working. But the iPOJO isn't.
>> >
>> > Here's some code:
>> >
>> > package com.example;
>> >
>> > import ...*...
>> >
>> > @Component(name="LogClientExample", immediate=true)
>> > public class LogClient implements Runnable {
>> >
>> >       �...@requires
>> >        private LogService logService;
>> >
>> >        private boolean running;
>> >
>> >       �...@property
>> >        private String logString;
>> >
>> > @Override
>> >        public void run() {
>> >                logService.log( LogService.LOG_INFO, "LogClient run().");
>> >                while( running) {
>> >                        logService.log( LogService.LOG_INFO, "LogClient
>> Running..." + logString);
>> >                        try {
>> >                                Thread.sleep( 10000);
>> >                        } catch (InterruptedException e) {
>> >                                logService.log( LogService.LOG_WARNING,
>> "", e);
>> >                        }
>> >                }
>> >        }
>> >
>> >       �...@validate
>> >        public void start() {
>> >                logService.log( LogService.LOG_INFO, "LogClient
>> start()");
>> >                running = true;
>> >                new Thread( this).start();
>> >        }
>> >
>> >       �...@invalidate
>> >        public void stop() {
>> >                logService.log( LogService.LOG_INFO, "LogClient stop()");
>> >                running = false;
>> >        }
>> > }
>> >
>> > Then I've created a file called 'com.example.LogClientExample.cfg' (I
>> tried just com.example.LogClient.cfg as well) with one line:
>> >
>> > logString=New Hello
>> >
>> >
>> > The logs come out as "LogClient Running...null"
>> >
>> > Unless I put this in the metadata.xml:
>> >
>> > <ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> >    xsi:schemaLocation="org.apache.felix.ipojo
>> http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd";
>> >    xmlns="org.apache.felix.ipojo">
>> > <!-- declare your component types and instances here -->
>> >        <instance component="LogClientExample"
>> name="LogClientExampleInstance">
>> >                <property name="logString" type="java.lang.String"
>> value="Hello" />
>> >        </instance>
>> > </ipojo>
>> >
>> >
>> >
>> >
>> >
>> >> -----Original Message-----
>> >> From: Clement Escoffier [mailto:[email protected]]
>> >> Sent: Monday, March 30, 2009 12:45 PM
>> >> To: [email protected]
>> >> Subject: Re: cfg files for PaxLogging and iPOJO
>> >>
>> >> Hi,
>> >>
>> >> To use cfg file you need:
>> >> - File install configured on a folder (let's say 'foo')
>> >> - A configuration admin implementation (like the Apache Felix one :-))
>> >>
>> >> Then, create a cfg file named factory-name-id. The factory name is
>> >> generally the class name of your pojo.
>> >> In this file, add one line per property:
>> >> prop1=value1
>> >> prop2=value2
>> >>
>> >> Copy this file in the 'foo' folder, that's it:
>> >> File install will read the file and push the configuration in the
>> >> configuration admin.
>> >> The configuration admin will push the configuration to iPOJO
>> >> iPOJO will create the instance and configure it (i.e you don't need
>> >> metadata.xml file at all)
>> >>
>> >> Regards,
>> >>
>> >>
>> >> Clement
>> >>
>> >>
>> >> On 30.03.2009, at 20:26, Stuart McCulloch wrote:
>> >>
>> >> > 2009/3/30 Joel Schuster <[email protected]>
>> >> >
>> >> >> I've started using PaxLogging as my LogService. However, I can't
>> >> >> seem to
>> >> >> figure out how to configure it.
>> >> >>
>> >> >
>> >> > you need to configure it via the ConfigAdmin service using a
>> >> > configuration
>> >> > pid "org.ops4j.pax.logging"
>> >> > to point to the contents of the log4j properties file - you can do
>> >> > this
>> >> > using Pax ConfMan or FileInstall
>> >> > from Apache Felix (both let you associate properties files with
>> >> > configuration pids)
>> >> >
>> >> >   http://wiki.ops4j.org/display/ops4j/Pax+Logging#PaxLogging-
>> >> Configuration
>> >> >
>> >> > you'll also need a working ConfigAdmin implementation, such as the
>> >> > Apache
>> >> > Felix configadmin bundle
>> >> >
>> >> > HTH
>> >> >
>> >> > I've tried creating various cfg files to no avail.
>> >> >>
>> >> >> As a an attempt to better understand how this should work I've
>> >> >> created a
>> >> >> quick iPOJO based LogClient which @Requires the LogService.
>> >> >>
>> >> >> This works great, so I added a String based @Property.
>> >> >>
>> >> >> However, I can't seem to set the property outside of the
>> >> >> metadata.xml file.
>> >> >> Shouldn't I be able to create a cfg file?
>> >> >>
>> >> >> If I can get that working it seems I should then be able to figure
>> >> >> out a
>> >> >> cfg file for the PaxLogging too.
>> >> >>
>> >> >
>> >> > I'll let Clement answer the iPOJO specifics, but as long as you can
>> >> > associate the "org.ops4j.pax.logging"
>> >> > configuration pid to the log4j properties using iPOJO then it's just
>> a
>> >> > matter of making sure you have a
>> >> > ConfigAdmin implementation installed to pass the configuration onto
>> >> > the
>> >> > Pax-Logging service
>> >> >
>> >> > (note you also need both the Pax-Logging API and the Pax-Logging
>> >> > service
>> >> > bundles installed)
>> >> >
>> >> >
>> >> >> ______________________________
>> >> >> Joel Schuster
>> >> >> Senior Software Engineer
>> >> >> NAVSYS Corporation
>> >> >> 14960 Woodcarver Road
>> >> >> Colorado Springs, CO 80921
>> >> >> (719) 481-4877 x138
>> >> >> [email protected]<mailto:[email protected]>
>> >> >>
>> >> >> The information contained herein is confidential and intended
>> >> >> solely for
>> >> >> the use of the addressees. If the reader is not the intended
>> >> >> recipient, you
>> >> >> are hereby notified that any distribution or copying of this
>> >> >> communication
>> >> >> is prohibited. Further distribution without the sender's approval
>> >> >> is also
>> >> >> prohibited.  If you have received this communication in error,
>> >> >> please notify
>> >> >> us immediately by replying to the message and deleting it entirely
>> >> >> from your
>> >> >> computer. Thank you. NAVSYS Corporation.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers, Stuart
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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]
>> >
>> >
>>
>>
>>
>> --
>> 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]
>
>



-- 
Karl Pauls
[email protected]

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

Reply via email to