You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Fiona Mahon <fm...@tssg.org> on 2009/06/10 17:14:38 UTC

Felix File Install

Hi,

I am trying to watch three different directories using Felix File 
Install. I have set the system to watch directory 'mainwatchedDir' in my 
props.xargs file using
-Dfelix.fileinstall.dir=./mainwatchedDir

I've added three subdirectories to 'mainwatchedDir'
- 'subWatchedDir1'
- 'subWatchedDir2'
- 'subWatchedDir3'

I've added 3 configuration files to 'mainwatchedDir'
- org.apache.felix.fileinstall-subWatchedDir1
- org.apache.felix.fileinstall-subWatchedDir2
- org.apache.felix.fileinstall-subWatchedDir3

In each of those files I have defined to watch the 3 subdirectories
- felix.fileinstall.dir=./subWatchedDir1     (in 
org.apache.felix.fileinstall-subWatchedDir1)
- felix.fileinstall.dir=./subWatchedDir2     (in 
org.apache.felix.fileinstall-subWatchedDir2)
- felix.fileinstall.dir=./subWatchedDir3     (in 
org.apache.felix.fileinstall-subWatchedDir3)
(I've commented out all other settings in those files for the minute)

When I start the Felix File Install bundle in the container I get the 
following error:
Error while updating org.apache.felix.fileinstall.0 
(java.lang.ClassCastException: java.lang.Boolean cannot be cast to 
java.lang.String

It happens for each of the 3 config files. Any ideas?

Regards,
Fiona.

-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Filippo Diotalevi <fi...@gmail.com>.
On Thu, Jun 11, 2009 at 12:31 PM, Guido Spadotto<gs...@soluta.net> wrote:
> Filippo Diotalevi wrote:
> Would this next line of code work? (you save one "properties.get"
> invocation)
>
> value instanceof String ? Util.substVars(( String ) value, name, null,
> properties) : value );

Yes, definitely.. missed the second invocation :-|
Will update

-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Guido Spadotto <gs...@soluta.net>.
Filippo Diotalevi wrote:
> Hi,
>   so I was able to reproduce easily the problem with Knopflerfish, and
> submitted a patch for that at
> https://issues.apache.org/jira/browse/FELIX-1216
Thanks Filippo.

Would this next line of code work? (you save one "properties.get" 
invocation)

value instanceof String ? Util.substVars(( String ) value, name, null, properties) : value );

BR,
-- 
Logo
Guido Spadotto
Soluta.net, Italy
http://www.soluta.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Fiona Mahon <fm...@tssg.org>.
Hi Sahoo,

I can verify that this works. Thanks,
Fiona.

Sahoo wrote:
> Guido Spadotto wrote:
>> Sahoo wrote:
>>> I think I have a solution for the URISyntaxError. Can you please 
>>> file a bug and I shall upload a patch for the same?
>> There it is:
>> https://issues.apache.org/jira/browse/FELIX-1228
> Second reminder to verify the patch and update the issue.
>
> Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Guido Spadotto wrote:
> Sahoo wrote:
>> I think I have a solution for the URISyntaxError. Can you please file 
>> a bug and I shall upload a patch for the same?
> There it is:
> https://issues.apache.org/jira/browse/FELIX-1228
Second reminder to verify the patch and update the issue.

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> I think I have a solution for the URISyntaxError. Can you please file 
> a bug and I shall upload a patch for the same?
There it is:
https://issues.apache.org/jira/browse/FELIX-1228
-- 
Logo
Guido Spadotto
Soluta.net, Italy
http://www.soluta.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> Yes, the suggested fix definitely avoids the NPE, but that essentially 
> masks the configuration problem. So, I am not sure if that's the right 
> behavior. Instead, we should be checking if watchedDirectory exists or 
> not. So, we should replace:
>
>        this.watchedDirectory.mkdirs();
>
> by
>
>        if(!this.watchedDirectory.mkdirs()) { throw new 
> Exception("Faild to create " + watchedDirectory.getAbsolutePath());}
>
> in DirectoryWatcher's constructor.
>
> I suggest we separate this issue from 1228 to keep things clean.
>
> Thanks,
> Sahoo

I've created http://issues.apache.org/jira/browse/FELIX-1235
which contains a couple of suggestions.

Thank you
-- 
Guido Spadotto

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Guido Spadotto wrote:
> Sahoo wrote:
>> Fiona,
>>
>> I think I have a solution for the URISyntaxError. Can you please file 
>> a bug and I shall upload a patch for the same?
>>
>> Thanks,
>> Sahoo
>>
>> Fiona Mahon wrote:
>>> [...]
>>>
>>> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
>>> around the directory) I get the endless loop, when I start up the 
>>> container. here's a bit of the output:
>>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>>> serious trouble
>>> (java.lang.NullPointerException)
>>> java.lang.NullPointerException
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>>> er.java:439)
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>>> va:120)
>>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>>> serious trouble
>>> (java.lang.NullPointerException)
>>> java.lang.NullPointerException
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>>> er.java:439)
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>>> va:120)
>>>
>>> (this is an endless loop of output)
>>>
>
> Hi Sahoo, I was able to reproduce the "looping NullPointerException" 
> scenario above.
>
> I've taken a look at the code and I think that this is due to these 
> lines in DirectoryWatcher:
>
> void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
>    {
>        String list[] = jardir.list();
>        for (int i = 0; i < list.length; i++)
>
> which, IMHO, should become:
>
> void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
>    {
>        String list[] = jardir.list();
>        for (int i = 0; (list!=null) && (i < list.length); i++)
>
> jardir.list() will return null if the jardir File object is not
> associated to a Directory (see [1]).
>
> [1]: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list()
>
Yes, the suggested fix definitely avoids the NPE, but that essentially 
masks the configuration problem. So, I am not sure if that's the right 
behavior. Instead, we should be checking if watchedDirectory exists or 
not. So, we should replace:

        this.watchedDirectory.mkdirs();

by

        if(!this.watchedDirectory.mkdirs()) { throw new Exception("Faild 
to create " + watchedDirectory.getAbsolutePath());}

in DirectoryWatcher's constructor.

I suggest we separate this issue from 1228 to keep things clean.

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> Fiona,
>
> I think I have a solution for the URISyntaxError. Can you please file 
> a bug and I shall upload a patch for the same?
>
> Thanks,
> Sahoo
>
> Fiona Mahon wrote:
>> [...]
>>
>> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
>> around the directory) I get the endless loop, when I start up the 
>> container. here's a bit of the output:
>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>> serious trouble
>> (java.lang.NullPointerException)
>> java.lang.NullPointerException
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>> er.java:439)
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>> va:120)
>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>> serious trouble
>> (java.lang.NullPointerException)
>> java.lang.NullPointerException
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>> er.java:439)
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>> va:120)
>>
>> (this is an endless loop of output)
>>

Hi Sahoo, I was able to reproduce the "looping NullPointerException" 
scenario above.

I've taken a look at the code and I think that this is due to these 
lines in DirectoryWatcher:

void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
    {
        String list[] = jardir.list();
        for (int i = 0; i < list.length; i++)

which, IMHO, should become:

void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
    {
        String list[] = jardir.list();
        for (int i = 0; (list!=null) && (i < list.length); i++)

jardir.list() will return null if the jardir File object is not
associated to a Directory (see [1]).

[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list()

-- 
Guido

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Fiona,

I think I have a solution for the URISyntaxError. Can you please file a 
bug and I shall upload a patch for the same?

Thanks,
Sahoo

Fiona Mahon wrote:
> Just in terms of the issue with the spaces, Guido suggested I put 
> quotes around the directory. However this causes the system to go into 
> an endless loop!
>
> Behaviour is as follows:
> When I define felix.fileinstall.dir=watchedDir (i.e. without quotes), 
> and when 'watchedDir' actually resolves to E:\Documents and 
> Settings\some\path\watchedDir, then I get the following error when I 
> drop a bundle into that directory:
>
> ERROR    20090612 10:01:28 bid#11       - Failed to install bundle: 
> /E:/Documents and 
> Settings/some/path/watchedDir/print-service-0.0.2.jar 
> (java.net.URISyntaxException: Illegal character in path at index 13: 
> /E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar)
> java.net.URISyntaxException: Illegal character in path at index 13: 
> /E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar
>        at java.net.URI$Parser.fail(Unknown Source)
>        at java.net.URI$Parser.checkChars(Unknown Source)
>        at java.net.URI$Parser.parseHierarchical(Unknown Source)
>        at java.net.URI$Parser.parse(Unknown Source)
>        at java.net.URI.<init>(Unknown Source)
>        at org.apache.felix.fileinstall.Jar.<init>(Jar.java:58)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
> r.java:686)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
> r.java:587)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWa
> tcher.java:351)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:121)
>
> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
> around the directory) I get the endless loop, when I start up the 
> container. here's a bit of the output:
> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
> serious trouble
> (java.lang.NullPointerException)
> java.lang.NullPointerException
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
> er.java:439)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:120)
> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
> serious trouble
> (java.lang.NullPointerException)
> java.lang.NullPointerException
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
> er.java:439)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:120)
>
> (this is an endless loop of output)
>
> If I do the same things in a directory that doesn't contain spaces 
> i.e. if I move the whole set up to directly under the E: directory, 
> this doesn't happen.
>
> This is actually an issue since I can't guarantee that anyone else who 
> will checkout and use this code will not be also on Windows and in 
> their home directory (i.e. C:/Documents and Settings/${username}. 
> Really it becomes useless to me as a project solution.
>
> Thanks,
> Fiona.
>
> Fiona Mahon wrote:
>> Beautiful! Works a treat now.
>> Thanks Filippo and Guido
>>
>> Just a couple of things to watch for:
>> - as you said Filippo, I had to define "felix.fileinstall.dir" as the 
>> full path from where I started Knopflerfish and not from where the 
>> config file was located i.e. 
>> felix.fileinstall.dir=watchedDir/watchedSubDir
>> - also seems to have problems with spaces in the filenames. I'm 
>> running on windows and when the FileInstall resolves the location of 
>> the config files as E:/Documents and Settings/<some path> it throws 
>> an error. If I put Knopflerfish directly under E:/ all is ok! I'm not 
>> specifying this path in any file, it is just resolved to that by the 
>> bundle.
>>
>> Thanks again,
>> Fiona.
>>
>>
>> Filippo Diotalevi wrote:
>>> On Thu, Jun 11, 2009 at 9:42 AM, Guido 
>>> Spadotto<gs...@soluta.net> wrote:
>>>  
>>>> Hi Filippo,
>>>> I've had a quick look at the Compendium R4, V4.1.
>>>> On Section 104.4.2 it reads:
>>>>
>>>> /The value of the property may be of the following types:
>>>> type ::= simple | vector | arrays
>>>> simple ::= String | Integer | Long | Float | Double| Byte | Short |
>>>> Character | Boolean
>>>> primitive ::= long | int | short | char | byte | double | float | 
>>>> boolean
>>>> arrays ::= primitive ‘[]’ | simple ‘[]’
>>>> vector ::= Vector of simple
>>>> /
>>>> So, apart from this particular case with KF-specific properties, it 
>>>> might
>>>> still
>>>> be worth to be aware of 'simple' (not 'primitive') property types 
>>>> in the
>>>> Configuration Dictionary.
>>>>     
>>>
>>> Hi,
>>>   so I was able to reproduce easily the problem with Knopflerfish, and
>>> submitted a patch for that at
>>> https://issues.apache.org/jira/browse/FELIX-1216
>>>
>>> As for the original Fiona's email, I hope the patch fixes her bug too,
>>> since the file she was referring to (props.xargs file) is indeed a
>>> Knopflerfish file.
>>>
>>>
>>>   
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Felix File Install - Spaces in watched directory name

Posted by Fiona Mahon <fm...@tssg.org>.
Just in terms of the issue with the spaces, Guido suggested I put quotes 
around the directory. However this causes the system to go into an 
endless loop!

Behaviour is as follows:
When I define felix.fileinstall.dir=watchedDir (i.e. without quotes), 
and when 'watchedDir' actually resolves to E:\Documents and 
Settings\some\path\watchedDir, then I get the following error when I 
drop a bundle into that directory:

ERROR    20090612 10:01:28 bid#11       - Failed to install bundle: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar 
(java.net.URISyntaxException: Illegal character in path at index 13: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar)
java.net.URISyntaxException: Illegal character in path at index 13: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.checkChars(Unknown Source)
        at java.net.URI$Parser.parseHierarchical(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        at org.apache.felix.fileinstall.Jar.<init>(Jar.java:58)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
r.java:686)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
r.java:587)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWa
tcher.java:351)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:121)

When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
around the directory) I get the endless loop, when I start up the 
container. here's a bit of the output:
ERROR    20090612 10:08:33 bid#11       - In main loop, we have serious 
trouble
(java.lang.NullPointerException)
java.lang.NullPointerException
        at 
org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
er.java:439)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:120)
ERROR    20090612 10:08:33 bid#11       - In main loop, we have serious 
trouble
(java.lang.NullPointerException)
java.lang.NullPointerException
        at 
org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
er.java:439)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:120)

(this is an endless loop of output)

If I do the same things in a directory that doesn't contain spaces i.e. 
if I move the whole set up to directly under the E: directory, this 
doesn't happen.

This is actually an issue since I can't guarantee that anyone else who 
will checkout and use this code will not be also on Windows and in their 
home directory (i.e. C:/Documents and Settings/${username}. Really it 
becomes useless to me as a project solution.

Thanks,
Fiona.
 
Fiona Mahon wrote:
> Beautiful! Works a treat now.
> Thanks Filippo and Guido
>
> Just a couple of things to watch for:
> - as you said Filippo, I had to define "felix.fileinstall.dir" as the 
> full path from where I started Knopflerfish and not from where the 
> config file was located i.e. 
> felix.fileinstall.dir=watchedDir/watchedSubDir
> - also seems to have problems with spaces in the filenames. I'm 
> running on windows and when the FileInstall resolves the location of 
> the config files as E:/Documents and Settings/<some path> it throws an 
> error. If I put Knopflerfish directly under E:/ all is ok! I'm not 
> specifying this path in any file, it is just resolved to that by the 
> bundle.
>
> Thanks again,
> Fiona.
>
>
> Filippo Diotalevi wrote:
>> On Thu, Jun 11, 2009 at 9:42 AM, Guido Spadotto<gs...@soluta.net> 
>> wrote:
>>  
>>> Hi Filippo,
>>> I've had a quick look at the Compendium R4, V4.1.
>>> On Section 104.4.2 it reads:
>>>
>>> /The value of the property may be of the following types:
>>> type ::= simple | vector | arrays
>>> simple ::= String | Integer | Long | Float | Double| Byte | Short |
>>> Character | Boolean
>>> primitive ::= long | int | short | char | byte | double | float | 
>>> boolean
>>> arrays ::= primitive ‘[]’ | simple ‘[]’
>>> vector ::= Vector of simple
>>> /
>>> So, apart from this particular case with KF-specific properties, it 
>>> might
>>> still
>>> be worth to be aware of 'simple' (not 'primitive') property types in 
>>> the
>>> Configuration Dictionary.
>>>     
>>
>> Hi,
>>   so I was able to reproduce easily the problem with Knopflerfish, and
>> submitted a patch for that at
>> https://issues.apache.org/jira/browse/FELIX-1216
>>
>> As for the original Fiona's email, I hope the patch fixes her bug too,
>> since the file she was referring to (props.xargs file) is indeed a
>> Knopflerfish file.
>>
>>
>>   
>
>


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Fiona Mahon <fm...@tssg.org>.
Beautiful! Works a treat now.
Thanks Filippo and Guido

Just a couple of things to watch for:
- as you said Filippo, I had to define "felix.fileinstall.dir" as the 
full path from where I started Knopflerfish and not from where the 
config file was located i.e. felix.fileinstall.dir=watchedDir/watchedSubDir
- also seems to have problems with spaces in the filenames. I'm running 
on windows and when the FileInstall resolves the location of the config 
files as E:/Documents and Settings/<some path> it throws an error. If I 
put Knopflerfish directly under E:/ all is ok! I'm not specifying this 
path in any file, it is just resolved to that by the bundle.

Thanks again,
Fiona.


Filippo Diotalevi wrote:
> On Thu, Jun 11, 2009 at 9:42 AM, Guido Spadotto<gs...@soluta.net> wrote:
>   
>> Hi Filippo,
>> I've had a quick look at the Compendium R4, V4.1.
>> On Section 104.4.2 it reads:
>>
>> /The value of the property may be of the following types:
>> type ::= simple | vector | arrays
>> simple ::= String | Integer | Long | Float | Double| Byte | Short |
>> Character | Boolean
>> primitive ::= long | int | short | char | byte | double | float | boolean
>> arrays ::= primitive ‘[]’ | simple ‘[]’
>> vector ::= Vector of simple
>> /
>> So, apart from this particular case with KF-specific properties, it might
>> still
>> be worth to be aware of 'simple' (not 'primitive') property types in the
>> Configuration Dictionary.
>>     
>
> Hi,
>   so I was able to reproduce easily the problem with Knopflerfish, and
> submitted a patch for that at
> https://issues.apache.org/jira/browse/FELIX-1216
>
> As for the original Fiona's email, I hope the patch fixes her bug too,
> since the file she was referring to (props.xargs file) is indeed a
> Knopflerfish file.
>
>
>   


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




Re: Felix File Install

Posted by Filippo Diotalevi <fi...@gmail.com>.
On Thu, Jun 11, 2009 at 9:42 AM, Guido Spadotto<gs...@soluta.net> wrote:
> Hi Filippo,
> I've had a quick look at the Compendium R4, V4.1.
> On Section 104.4.2 it reads:
>
> /The value of the property may be of the following types:
> type ::= simple | vector | arrays
> simple ::= String | Integer | Long | Float | Double| Byte | Short |
> Character | Boolean
> primitive ::= long | int | short | char | byte | double | float | boolean
> arrays ::= primitive ‘[]’ | simple ‘[]’
> vector ::= Vector of simple
> /
> So, apart from this particular case with KF-specific properties, it might
> still
> be worth to be aware of 'simple' (not 'primitive') property types in the
> Configuration Dictionary.

Hi,
  so I was able to reproduce easily the problem with Knopflerfish, and
submitted a patch for that at
https://issues.apache.org/jira/browse/FELIX-1216

As for the original Fiona's email, I hope the patch fixes her bug too,
since the file she was referring to (props.xargs file) is indeed a
Knopflerfish file.


-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Guido Spadotto <gs...@soluta.net>.
Filippo Diotalevi wrote:
>   
>> Are all the properties in a ConfigurationDictionary supposed to map
>> to String objects?
>>     
>
> Specification wise, the configuration dictionary can contain a limited
> set of types (the usual int, long, string and so on, plus vectors and
> arrays), but I sort of expected that the Configuration Dictionary
> received in this particular case contained exactly the properties
> defined in the configuration file. It seems not to be the case!
> I'll do some experiments tomorrow and submit a patch.
>
> Many thanks!
>   
Hi Filippo,
I've had a quick look at the Compendium R4, V4.1.
On Section 104.4.2 it reads:

/The value of the property may be of the following types:
type ::= simple | vector | arrays
simple ::= String | Integer | Long | Float | Double| Byte | Short | 
Character | Boolean
primitive ::= long | int | short | char | byte | double | float | boolean
arrays ::= primitive ‘[]’ | simple ‘[]’
vector ::= Vector of simple
/
So, apart from this particular case with KF-specific properties, it 
might still
be worth to be aware of 'simple' (not 'primitive') property types in the
Configuration Dictionary.

All of the above if I did understand correctly the specs,
which - knowing myself - is not guaranteed.

Thank you for your commitment.
-- 
Logo
Guido Spadotto
Soluta.net, Italy
http://www.soluta.net

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Filippo Diotalevi <fi...@gmail.com>.
Hi Guido

On Wed, Jun 10, 2009 at 10:33 PM, Guido Spadotto<gs...@soluta.net> wrote:
>> That's strange... is the stacktrace giving any more detail?
> Hi Filippo,
> I managed to reproduce this same issue in Knopflerfish (hope you don't mind!
> ;) ).
>
> I don't know if I got it right, but I think that the
> "dynamic.service.bundleLocation"
> property key has an associated Object that's actually a Boolean
> (sorry, I wasn't able to find the static final String variable name).

That's very interesting... even if it makes me even more confused!
I tried to do a full text search on the pdf of the core and compendium
specification for "dynamic.service.bundleLocation" without any
success; same for the felix code, although google seems to show some
results Knopflerfish (hint hint!)

> This will raise the ClassCastException in the following code of
> FileInstall.java
> (first argument of the Util.substVars method invocation).
>
> private void performSubstitution( Dictionary properties )
>   {
> [..]
> Maybe using
> properties.get(name).toString()
> in place of
> ( String ) properties.get(name)
> might work.

Yes, I know that piece of code. It is supposed to check if a property
value is something like ${something} and substitute it with the value
of "something" system property.

> Are all the properties in a ConfigurationDictionary supposed to map
> to String objects?

Specification wise, the configuration dictionary can contain a limited
set of types (the usual int, long, string and so on, plus vectors and
arrays), but I sort of expected that the Configuration Dictionary
received in this particular case contained exactly the properties
defined in the configuration file. It seems not to be the case!
I'll do some experiments tomorrow and submit a patch.

Many thanks!
-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Guido Spadotto <gs...@soluta.net>.
Filippo Diotalevi wrote:
> 1) configuration files must have the ".cfg" extension, so
> org.apache.felix.fileinstall-subWatchedDir1.cfg
> for instance
>
> 2) relative URLs are relative to the folder where the JVM started, so
> if you write
> felix.fileinstall.dir=./subWatchedDir1
> it won't watch a  subdirectory of 'mainwatchedDir
>
>
>   
>> (I've commented out all other settings in those files for the minute)
>>
>> When I start the Felix File Install bundle in the container I get the
>> following error:
>> Error while updating org.apache.felix.fileinstall.0
>> (java.lang.ClassCastException: java.lang.Boolean cannot be cast to
>> java.lang.String
>>     
>
> That's strange... is the stacktrace giving any more detail?
Hi Filippo,
 I managed to reproduce this same issue in Knopflerfish (hope you don't 
mind! ;) ).

I don't know if I got it right, but I think that the 
"dynamic.service.bundleLocation"
property key has an associated Object that's actually a Boolean
(sorry, I wasn't able to find the static final String variable name).

This will raise the ClassCastException in the following code of 
FileInstall.java
(first argument of the Util.substVars method invocation).

private void performSubstitution( Dictionary properties )
    {
        for (Enumeration e = properties.keys(); e.hasMoreElements(); )
        {
            String name = (String) e.nextElement();
            properties.put(name, Util.substVars(( String ) 
properties.get(name), name, null, properties));
        }
    }

This is the stacktrace:
java.lang.ClassCastException: java.lang.Boolean cannot be cast to 
java.lang.String
    at 
org.apache.felix.fileinstall.FileInstall.performSubstitution(FileInstall.java:129)
    at 
org.apache.felix.fileinstall.FileInstall.updated(FileInstall.java:117)
    at org.knopflerfish.bundle.cm.Update.update(Update.java:96)
    at org.knopflerfish.bundle.cm.Update.doUpdate(Update.java:74)
    at org.knopflerfish.bundle.cm.UpdateQueue.run(UpdateQueue.java:93)
    at java.lang.Thread.run(Unknown Source)

Maybe using
properties.get(name).toString()
in place of
( String ) properties.get(name)
might work.

Are all the properties in a ConfigurationDictionary supposed to map
to String objects?

Thanks
-- 
Logo
Guido Spadotto
Soluta.net, Italy
http://www.soluta.net




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install

Posted by Filippo Diotalevi <fi...@gmail.com>.
Hi,
  it is quite difficult to diagnose the problem with the details you
provide, anyway I'll try to give you some ideas/hints (inline)

On Wed, Jun 10, 2009 at 5:14 PM, Fiona Mahon<fm...@tssg.org> wrote:
> I am trying to watch three different directories using Felix File Install. I
> have set the system to watch directory 'mainwatchedDir' in my props.xargs
> file using
> -Dfelix.fileinstall.dir=./mainwatchedDir

Not sure how is your startup setup (what's the props.xargs? in which
file of the felix distribution is it?)
If you are using the standard felix distribution, just add the line
felix.fileinstall.dir=./mainwatchedDir
in the file conf/config.properties

Please notice that since you use a relative url, it is relative to the
folder where you start the JVM


> I've added three subdirectories to 'mainwatchedDir'
> - 'subWatchedDir1'
> - 'subWatchedDir2'
> - 'subWatchedDir3'
>
> I've added 3 configuration files to 'mainwatchedDir'
> - org.apache.felix.fileinstall-subWatchedDir1
> - org.apache.felix.fileinstall-subWatchedDir2
> - org.apache.felix.fileinstall-subWatchedDir3
>
> In each of those files I have defined to watch the 3 subdirectories
> - felix.fileinstall.dir=./subWatchedDir1     (in
> org.apache.felix.fileinstall-subWatchedDir1)
> - felix.fileinstall.dir=./subWatchedDir2     (in
> org.apache.felix.fileinstall-subWatchedDir2)
> - felix.fileinstall.dir=./subWatchedDir3     (in
> org.apache.felix.fileinstall-subWatchedDir3)

1) configuration files must have the ".cfg" extension, so
org.apache.felix.fileinstall-subWatchedDir1.cfg
for instance

2) relative URLs are relative to the folder where the JVM started, so
if you write
felix.fileinstall.dir=./subWatchedDir1
it won't watch a  subdirectory of 'mainwatchedDir


> (I've commented out all other settings in those files for the minute)
>
> When I start the Felix File Install bundle in the container I get the
> following error:
> Error while updating org.apache.felix.fileinstall.0
> (java.lang.ClassCastException: java.lang.Boolean cannot be cast to
> java.lang.String

That's strange... is the stacktrace giving any more detail?

-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org