List Range...

2010-12-20 Thread Brad Beck
Is there a way to specify a range of values (similar to perl) in the list 
operator at the shell? e.g.

each [1..10] { start $it }

-Brad



Re: List Range...

2010-12-20 Thread Guillaume Nodet
Not afaik.   One possible way to work around this syntax limitation
would be to define a command range and do something like:
   each (range 1 10) { start $it }
Basically, you need a way to compute your set of values to iterate through.

On Mon, Dec 20, 2010 at 15:39, Brad Beck bb...@peoplenetonline.com wrote:
 Is there a way to specify a range of values (similar to perl) in the list 
 operator at the shell? e.g.

 each [1..10] { start $it }

 -Brad





-- 
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://fusesource.com


Re: Managed Properties question

2010-12-20 Thread karafman

It still isn't working.

Here's an excerpt of my .cfg file (none of the names in the file have any
characters other than [a-z, A-Z]:
myAppDbShowSql = false
myAppDbFormatSql = false

In the file where I get my service I have:
osgix:cm-properties id=myAppDatabaseProperties
persistent-id=myApp.data.access/
ctx:property-placeholder properties-ref=myAppDatabaseProperties/

In the file where I am using the managed service I have (unnecessary bits
removed):
bean id=myAppSessionFactory
class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
p:dataSource-ref=myAppPoolDataSource
  osgix:managedProperties persistent-id=myApp.data.access 
update-strategy=container-managed/
  property name=mappingResources
   listhibernate valies/list
  /property
  property name=hibernateProperties
props
 prop key=hibernate.show_sql${myAppDbShowSql}/prop
 prop key=hibernate.format_sql${myAppDbFormatSql}/prop
/props
   /property
/bean

When I change the values in my .cfg file, I can see those changes being
populated by doing a config:list.

However, I get the following error in my log:
Configuration for myApp.data.access has already been used for service
[org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]

When I restart bundle 89, the properties are properly consumed.

Anyone know what's going wrong?


-
Karafman
Slayer of the JEE
Pounder of the Perl Programmer

-- 
View this message in context: 
http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121172.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Managed Properties question

2010-12-20 Thread Achim Nierbeck
This is a short example on how I did it with spring-dm should be
comparable:

!-- Configuration Admin Service Factory --
osgix:managed-service-factory
factory-pid=my.own.factory.pid
interface=my.own.interface
update-strategy=bean-managed update-method=setProperties
bean id=theBeanID
class=my.own.ClassImplementingInterface 
property name=propA /
property name=propB /
!-- these properties can also be leaved blank I think. --
/bean
/osgix:managed-service-factory

This one works.


2010/12/20 karafman mvangeert...@comcast.net


 It still isn't working.

 Here's an excerpt of my .cfg file (none of the names in the file have any
 characters other than [a-z, A-Z]:
 myAppDbShowSql = false
 myAppDbFormatSql = false

 In the file where I get my service I have:
 osgix:cm-properties id=myAppDatabaseProperties
 persistent-id=myApp.data.access/
 ctx:property-placeholder properties-ref=myAppDatabaseProperties/

 In the file where I am using the managed service I have (unnecessary bits
 removed):
 bean id=myAppSessionFactory
 class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
 p:dataSource-ref=myAppPoolDataSource
  osgix:managedProperties persistent-id=myApp.data.access
 update-strategy=container-managed/
  property name=mappingResources
   listhibernate valies/list
  /property
  property name=hibernateProperties
props
 prop key=hibernate.show_sql${myAppDbShowSql}/prop
 prop key=hibernate.format_sql${myAppDbFormatSql}/prop
/props
   /property
 /bean

 When I change the values in my .cfg file, I can see those changes being
 populated by doing a config:list.

 However, I get the following error in my log:
 Configuration for myApp.data.access has already been used for service
 [org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
 given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]

 When I restart bundle 89, the properties are properly consumed.

 Anyone know what's going wrong?


 -
 Karafman
 Slayer of the JEE
 Pounder of the Perl Programmer

 --
 View this message in context:
 http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121172.html
 Sent from the Karaf - User mailing list archive at Nabble.com.



Re: Managed Properties question

2010-12-20 Thread Achim Nierbeck
OK, another try

bean id=containerManaged class=ContainerManagedBean
   osgix:managed-properties persistent-id=labX
update-strategy=container-managed/
   property name=integer value=23/
/bean

this is the official example :)

I think the property (named integer here) is optional. Usually all
properties which can be read through getter and setter can be set by
the configuration.

So your problem is that you try to inject properties within another property

property name=hibernateProperties
   props
prop key=hibernate.show_sql${myAppDbShowSql}/prop
prop key=hibernate.format_sql${myAppDbFormatSql}/prop
   /props
  /property

All your properties you want to update need to be accessible via
getter and setter.
If you want to do this you need to make an extra bean which is
configurable (with the same pid)
and inject that one after it is initialized. you may want to make your
standard bean dependend on the new bean.

2010/12/20 karafman mvangeert...@comcast.net

 It still isn't working.

 Here's an excerpt of my .cfg file (none of the names in the file have any
 characters other than [a-z, A-Z]:
 myAppDbShowSql = false
 myAppDbFormatSql = false

 In the file where I get my service I have:
 osgix:cm-properties id=myAppDatabaseProperties
 persistent-id=myApp.data.access/
 ctx:property-placeholder properties-ref=myAppDatabaseProperties/

 In the file where I am using the managed service I have (unnecessary bits
 removed):
 bean id=myAppSessionFactory
 class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
 p:dataSource-ref=myAppPoolDataSource
  osgix:managedProperties persistent-id=myApp.data.access
 update-strategy=container-managed/
  property name=mappingResources
   listhibernate valies/list
  /property
  property name=hibernateProperties
    props
     prop key=hibernate.show_sql${myAppDbShowSql}/prop
     prop key=hibernate.format_sql${myAppDbFormatSql}/prop
    /props
   /property
 /bean

 When I change the values in my .cfg file, I can see those changes being
 populated by doing a config:list.

 However, I get the following error in my log:
 Configuration for myApp.data.access has already been used for service
 [org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
 given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]

 When I restart bundle 89, the properties are properly consumed.

 Anyone know what's going wrong?


 -
 Karafman
 Slayer of the JEE
 Pounder of the Perl Programmer

 --
 View this message in context: 
 http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121172.html
 Sent from the Karaf - User mailing list archive at Nabble.com.


RE: Managed Properties question

2010-12-20 Thread Łukasz Dywicki
If you try to do managed component your configuration property name must
match field name, otherwise container will not update your bean. Both
spring-dm and aries blueprint works same. In your example the property named
integer have to use placeholder ${integer}. If you would like to use
different names you need to manage changes in bean (set strategy to bean
managed and callback method).

Best regards,
Lukasz

-Original Message-
From: Achim Nierbeck [mailto:bcanh...@googlemail.com] 
Sent: Monday, December 20, 2010 6:00 PM
To: user@karaf.apache.org
Subject: Re: Managed Properties question

OK, another try

bean id=containerManaged class=ContainerManagedBean
   osgix:managed-properties persistent-id=labX
update-strategy=container-managed/
   property name=integer value=23/
/bean

this is the official example :)

I think the property (named integer here) is optional. Usually all
properties which can be read through getter and setter can be set by
the configuration.

So your problem is that you try to inject properties within another property

property name=hibernateProperties
   props
prop key=hibernate.show_sql${myAppDbShowSql}/prop
prop key=hibernate.format_sql${myAppDbFormatSql}/prop
   /props
  /property

All your properties you want to update need to be accessible via
getter and setter.
If you want to do this you need to make an extra bean which is
configurable (with the same pid)
and inject that one after it is initialized. you may want to make your
standard bean dependend on the new bean.

2010/12/20 karafman mvangeert...@comcast.net

 It still isn't working.

 Here's an excerpt of my .cfg file (none of the names in the file have any
 characters other than [a-z, A-Z]:
 myAppDbShowSql = false
 myAppDbFormatSql = false

 In the file where I get my service I have:
 osgix:cm-properties id=myAppDatabaseProperties
 persistent-id=myApp.data.access/
 ctx:property-placeholder properties-ref=myAppDatabaseProperties/

 In the file where I am using the managed service I have (unnecessary bits
 removed):
 bean id=myAppSessionFactory
 class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
 p:dataSource-ref=myAppPoolDataSource
  osgix:managedProperties persistent-id=myApp.data.access
 update-strategy=container-managed/
  property name=mappingResources
   listhibernate valies/list
  /property
  property name=hibernateProperties
    props
     prop key=hibernate.show_sql${myAppDbShowSql}/prop
     prop key=hibernate.format_sql${myAppDbFormatSql}/prop
    /props
   /property
 /bean

 When I change the values in my .cfg file, I can see those changes being
 populated by doing a config:list.

 However, I get the following error in my log:
 Configuration for myApp.data.access has already been used for service
 [org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
 given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]

 When I restart bundle 89, the properties are properly consumed.

 Anyone know what's going wrong?


 -
 Karafman
 Slayer of the JEE
 Pounder of the Perl Programmer

 --
 View this message in context:
http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121
172.html
 Sent from the Karaf - User mailing list archive at Nabble.com.



Re: Managed Properties question

2010-12-20 Thread Guillaume Nodet
Or use a cm:property-placeholder in combination with the reload flag
to reload the app if the config change, that's what i used inside
karaf, see:
  
http://svn.apache.org/repos/asf/karaf/trunk/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml

2010/12/20 Łukasz Dywicki l...@code-house.org:
 If you try to do managed component your configuration property name must
 match field name, otherwise container will not update your bean. Both
 spring-dm and aries blueprint works same. In your example the property named
 integer have to use placeholder ${integer}. If you would like to use
 different names you need to manage changes in bean (set strategy to bean
 managed and callback method).

 Best regards,
 Lukasz

 -Original Message-
 From: Achim Nierbeck [mailto:bcanh...@googlemail.com]
 Sent: Monday, December 20, 2010 6:00 PM
 To: user@karaf.apache.org
 Subject: Re: Managed Properties question

 OK, another try

 bean id=containerManaged class=ContainerManagedBean
   osgix:managed-properties persistent-id=labX
 update-strategy=container-managed/
   property name=integer value=23/
 /bean

 this is the official example :)

 I think the property (named integer here) is optional. Usually all
 properties which can be read through getter and setter can be set by
 the configuration.

 So your problem is that you try to inject properties within another property

 property name=hibernateProperties
   props
    prop key=hibernate.show_sql${myAppDbShowSql}/prop
    prop key=hibernate.format_sql${myAppDbFormatSql}/prop
   /props
  /property

 All your properties you want to update need to be accessible via
 getter and setter.
 If you want to do this you need to make an extra bean which is
 configurable (with the same pid)
 and inject that one after it is initialized. you may want to make your
 standard bean dependend on the new bean.

 2010/12/20 karafman mvangeert...@comcast.net

 It still isn't working.

 Here's an excerpt of my .cfg file (none of the names in the file have any
 characters other than [a-z, A-Z]:
 myAppDbShowSql = false
 myAppDbFormatSql = false

 In the file where I get my service I have:
 osgix:cm-properties id=myAppDatabaseProperties
 persistent-id=myApp.data.access/
 ctx:property-placeholder properties-ref=myAppDatabaseProperties/

 In the file where I am using the managed service I have (unnecessary bits
 removed):
 bean id=myAppSessionFactory
 class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
 p:dataSource-ref=myAppPoolDataSource
  osgix:managedProperties persistent-id=myApp.data.access
 update-strategy=container-managed/
  property name=mappingResources
   listhibernate valies/list
  /property
  property name=hibernateProperties
    props
     prop key=hibernate.show_sql${myAppDbShowSql}/prop
     prop key=hibernate.format_sql${myAppDbFormatSql}/prop
    /props
   /property
 /bean

 When I change the values in my .cfg file, I can see those changes being
 populated by doing a config:list.

 However, I get the following error in my log:
 Configuration for myApp.data.access has already been used for service
 [org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
 given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]

 When I restart bundle 89, the properties are properly consumed.

 Anyone know what's going wrong?


 -
 Karafman
 Slayer of the JEE
 Pounder of the Perl Programmer

 --
 View this message in context:
 http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121
 172.html
 Sent from the Karaf - User mailing list archive at Nabble.com.





-- 
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://fusesource.com