You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Alex Soto <as...@gmail.com> on 2015/06/17 11:00:43 UTC
AbstractService properties immutable
Hi, currently I am developing an application which I am registering
dynamically resources using Assembler class.
I have seen that AbstractService has a field called properties that you can
only get information from it but not set it. All other fields has its own
getter/setter except this one. I think that if there is nothing against it
it should have a setter too so I can dynamically set properties too.
The class is here:
https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
I can provide a PR if you agree.
Alex.
Re: AbstractService properties immutable
Posted by Romain Manni-Bucau <rm...@gmail.com>.
you are not wrong but it is just not the way it is done
today: org.apache.openejb.config.ConfigurationFactory#toConfigDeclaration(java.lang.String,
java.net.URI) for instance
also programmatically a properties provider can fit better avoiding a too
hard link between repository and our internals
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
2015-06-17 18:20 GMT+02:00 Alex Soto <as...@gmail.com>:
> Yes I was thinking the same as Romain. But please I can be wrong, this is
> something that I have noticed today when I tried to generate and register
> resources dynamically instead of loading in static way from resources.xml
>
> Alex.
>
> El dc., 17 juny 2015 a les 18:17, Romain Manni-Bucau (<
> rmannibucau@gmail.com>)
> va escriure:
>
> > well even if that is no more strictly true (we rewrap for several cases
> it
> > in super properties) we could still wrap the properties in the setter
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> | Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-06-17 18:12 GMT+02:00 David Blevins <da...@gmail.com>:
> >
> > > Hi Alex!
> > >
> > > The motivation there is slightly more than philosophical. The
> properties
> > > in AbstractService is actually not the standard java.util.Properties,
> but
> > > rather an implementation which is case-insensitive. The library we use
> > to
> > > construct the services themselves, xbean-reflect, is also setup to use
> > > case-insensitive object attributes.
> > >
> > > If we were to add a setProperties method, we'd have to in some way
> ensure
> > > it has the same feature or pull all the properties out and move them
> in.
> > >
> > >
> > > --
> > > David Blevins
> > > http://twitter.com/dblevins
> > > http://www.tomitribe.com
> > >
> > > On Jun 17, 2015, at 10:00 AM, Alex Soto <as...@gmail.com> wrote:
> > >
> > > > Hi, currently I am developing an application which I am registering
> > > > dynamically resources using Assembler class.
> > > >
> > > > I have seen that AbstractService has a field called properties that
> you
> > > can
> > > > only get information from it but not set it. All other fields has its
> > own
> > > > getter/setter except this one. I think that if there is nothing
> against
> > > it
> > > > it should have a setter too so I can dynamically set properties too.
> > > >
> > > > The class is here:
> > > >
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > > >
> > > > I can provide a PR if you agree.
> > > >
> > > > Alex.
> > >
> > >
> >
>
Re: AbstractService properties immutable
Posted by Alex Soto <as...@gmail.com>.
Yes I was thinking the same as Romain. But please I can be wrong, this is
something that I have noticed today when I tried to generate and register
resources dynamically instead of loading in static way from resources.xml
Alex.
El dc., 17 juny 2015 a les 18:17, Romain Manni-Bucau (<rm...@gmail.com>)
va escriure:
> well even if that is no more strictly true (we rewrap for several cases it
> in super properties) we could still wrap the properties in the setter
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-06-17 18:12 GMT+02:00 David Blevins <da...@gmail.com>:
>
> > Hi Alex!
> >
> > The motivation there is slightly more than philosophical. The properties
> > in AbstractService is actually not the standard java.util.Properties, but
> > rather an implementation which is case-insensitive. The library we use
> to
> > construct the services themselves, xbean-reflect, is also setup to use
> > case-insensitive object attributes.
> >
> > If we were to add a setProperties method, we'd have to in some way ensure
> > it has the same feature or pull all the properties out and move them in.
> >
> >
> > --
> > David Blevins
> > http://twitter.com/dblevins
> > http://www.tomitribe.com
> >
> > On Jun 17, 2015, at 10:00 AM, Alex Soto <as...@gmail.com> wrote:
> >
> > > Hi, currently I am developing an application which I am registering
> > > dynamically resources using Assembler class.
> > >
> > > I have seen that AbstractService has a field called properties that you
> > can
> > > only get information from it but not set it. All other fields has its
> own
> > > getter/setter except this one. I think that if there is nothing against
> > it
> > > it should have a setter too so I can dynamically set properties too.
> > >
> > > The class is here:
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > >
> > > I can provide a PR if you agree.
> > >
> > > Alex.
> >
> >
>
Re: AbstractService properties immutable
Posted by Romain Manni-Bucau <rm...@gmail.com>.
well even if that is no more strictly true (we rewrap for several cases it
in super properties) we could still wrap the properties in the setter
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
2015-06-17 18:12 GMT+02:00 David Blevins <da...@gmail.com>:
> Hi Alex!
>
> The motivation there is slightly more than philosophical. The properties
> in AbstractService is actually not the standard java.util.Properties, but
> rather an implementation which is case-insensitive. The library we use to
> construct the services themselves, xbean-reflect, is also setup to use
> case-insensitive object attributes.
>
> If we were to add a setProperties method, we'd have to in some way ensure
> it has the same feature or pull all the properties out and move them in.
>
>
> --
> David Blevins
> http://twitter.com/dblevins
> http://www.tomitribe.com
>
> On Jun 17, 2015, at 10:00 AM, Alex Soto <as...@gmail.com> wrote:
>
> > Hi, currently I am developing an application which I am registering
> > dynamically resources using Assembler class.
> >
> > I have seen that AbstractService has a field called properties that you
> can
> > only get information from it but not set it. All other fields has its own
> > getter/setter except this one. I think that if there is nothing against
> it
> > it should have a setter too so I can dynamically set properties too.
> >
> > The class is here:
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> >
> > I can provide a PR if you agree.
> >
> > Alex.
>
>
Re: AbstractService properties immutable
Posted by David Blevins <da...@gmail.com>.
Hi Alex!
The motivation there is slightly more than philosophical. The properties in AbstractService is actually not the standard java.util.Properties, but rather an implementation which is case-insensitive. The library we use to construct the services themselves, xbean-reflect, is also setup to use case-insensitive object attributes.
If we were to add a setProperties method, we'd have to in some way ensure it has the same feature or pull all the properties out and move them in.
--
David Blevins
http://twitter.com/dblevins
http://www.tomitribe.com
On Jun 17, 2015, at 10:00 AM, Alex Soto <as...@gmail.com> wrote:
> Hi, currently I am developing an application which I am registering
> dynamically resources using Assembler class.
>
> I have seen that AbstractService has a field called properties that you can
> only get information from it but not set it. All other fields has its own
> getter/setter except this one. I think that if there is nothing against it
> it should have a setter too so I can dynamically set properties too.
>
> The class is here:
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
>
> I can provide a PR if you agree.
>
> Alex.
Re: AbstractService properties immutable
Posted by Alex Soto <as...@gmail.com>.
Ok, no worries, for now this is ok
El dc., 17 juny 2015 a les 11:34, Romain Manni-Bucau (<rm...@gmail.com>)
va escriure:
> 2015-06-17 11:27 GMT+02:00 Alex Soto <as...@gmail.com>:
>
> > Yes, but as you said consistent with jaxb tree but what's happening if
> you
> > want to use it as simple POJO for dynamic registration? Well it was only
> a
> > suggestion, of course it is not blocker.
> >
> >
> sure but that's the common pattern for collections. Setters are fine for
> single valued fields IMO, optional for others.
>
> A builder would be better than a setter IMO. Think David started few things
> about it butwe never finished the API AFAIK.
>
>
> >
> >
> > El dc., 17 juny 2015 a les 11:25, Romain Manni-Bucau (<
> > rmannibucau@gmail.com>)
> > va escriure:
> >
> > > Yes and no. It is javadoc-ed and consistent in our "jaxb tree".
> > > Le 17 juin 2015 10:19, "Alex Soto" <as...@gmail.com> a écrit :
> > >
> > > > Yes but it is a bit antinatural if all other methods follows the
> > > > getter/setter, maybe a setter and an append methid in case of
> > properties
> > > > could have more sense.
> > > >
> > > > El dc., 17 juny 2015 a les 11:16, Romain Manni-Bucau (<
> > > > rmannibucau@gmail.com>)
> > > > va escriure:
> > > >
> > > > > Not sure i got it. You use getProperties to mutate it
> > > > > Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
> > > > >
> > > > > > Hi, currently I am developing an application which I am
> registering
> > > > > > dynamically resources using Assembler class.
> > > > > >
> > > > > > I have seen that AbstractService has a field called properties
> that
> > > you
> > > > > can
> > > > > > only get information from it but not set it. All other fields has
> > its
> > > > own
> > > > > > getter/setter except this one. I think that if there is nothing
> > > against
> > > > > it
> > > > > > it should have a setter too so I can dynamically set properties
> > too.
> > > > > >
> > > > > > The class is here:
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > > > > >
> > > > > > I can provide a PR if you agree.
> > > > > >
> > > > > > Alex.
> > > > > >
> > > > >
> > > >
> > >
> >
>
Re: AbstractService properties immutable
Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-06-17 11:27 GMT+02:00 Alex Soto <as...@gmail.com>:
> Yes, but as you said consistent with jaxb tree but what's happening if you
> want to use it as simple POJO for dynamic registration? Well it was only a
> suggestion, of course it is not blocker.
>
>
sure but that's the common pattern for collections. Setters are fine for
single valued fields IMO, optional for others.
A builder would be better than a setter IMO. Think David started few things
about it butwe never finished the API AFAIK.
>
>
> El dc., 17 juny 2015 a les 11:25, Romain Manni-Bucau (<
> rmannibucau@gmail.com>)
> va escriure:
>
> > Yes and no. It is javadoc-ed and consistent in our "jaxb tree".
> > Le 17 juin 2015 10:19, "Alex Soto" <as...@gmail.com> a écrit :
> >
> > > Yes but it is a bit antinatural if all other methods follows the
> > > getter/setter, maybe a setter and an append methid in case of
> properties
> > > could have more sense.
> > >
> > > El dc., 17 juny 2015 a les 11:16, Romain Manni-Bucau (<
> > > rmannibucau@gmail.com>)
> > > va escriure:
> > >
> > > > Not sure i got it. You use getProperties to mutate it
> > > > Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
> > > >
> > > > > Hi, currently I am developing an application which I am registering
> > > > > dynamically resources using Assembler class.
> > > > >
> > > > > I have seen that AbstractService has a field called properties that
> > you
> > > > can
> > > > > only get information from it but not set it. All other fields has
> its
> > > own
> > > > > getter/setter except this one. I think that if there is nothing
> > against
> > > > it
> > > > > it should have a setter too so I can dynamically set properties
> too.
> > > > >
> > > > > The class is here:
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > > > >
> > > > > I can provide a PR if you agree.
> > > > >
> > > > > Alex.
> > > > >
> > > >
> > >
> >
>
Re: AbstractService properties immutable
Posted by Alex Soto <as...@gmail.com>.
Yes, but as you said consistent with jaxb tree but what's happening if you
want to use it as simple POJO for dynamic registration? Well it was only a
suggestion, of course it is not blocker.
El dc., 17 juny 2015 a les 11:25, Romain Manni-Bucau (<rm...@gmail.com>)
va escriure:
> Yes and no. It is javadoc-ed and consistent in our "jaxb tree".
> Le 17 juin 2015 10:19, "Alex Soto" <as...@gmail.com> a écrit :
>
> > Yes but it is a bit antinatural if all other methods follows the
> > getter/setter, maybe a setter and an append methid in case of properties
> > could have more sense.
> >
> > El dc., 17 juny 2015 a les 11:16, Romain Manni-Bucau (<
> > rmannibucau@gmail.com>)
> > va escriure:
> >
> > > Not sure i got it. You use getProperties to mutate it
> > > Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
> > >
> > > > Hi, currently I am developing an application which I am registering
> > > > dynamically resources using Assembler class.
> > > >
> > > > I have seen that AbstractService has a field called properties that
> you
> > > can
> > > > only get information from it but not set it. All other fields has its
> > own
> > > > getter/setter except this one. I think that if there is nothing
> against
> > > it
> > > > it should have a setter too so I can dynamically set properties too.
> > > >
> > > > The class is here:
> > > >
> > > >
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > > >
> > > > I can provide a PR if you agree.
> > > >
> > > > Alex.
> > > >
> > >
> >
>
Re: AbstractService properties immutable
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Yes and no. It is javadoc-ed and consistent in our "jaxb tree".
Le 17 juin 2015 10:19, "Alex Soto" <as...@gmail.com> a écrit :
> Yes but it is a bit antinatural if all other methods follows the
> getter/setter, maybe a setter and an append methid in case of properties
> could have more sense.
>
> El dc., 17 juny 2015 a les 11:16, Romain Manni-Bucau (<
> rmannibucau@gmail.com>)
> va escriure:
>
> > Not sure i got it. You use getProperties to mutate it
> > Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
> >
> > > Hi, currently I am developing an application which I am registering
> > > dynamically resources using Assembler class.
> > >
> > > I have seen that AbstractService has a field called properties that you
> > can
> > > only get information from it but not set it. All other fields has its
> own
> > > getter/setter except this one. I think that if there is nothing against
> > it
> > > it should have a setter too so I can dynamically set properties too.
> > >
> > > The class is here:
> > >
> > >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> > >
> > > I can provide a PR if you agree.
> > >
> > > Alex.
> > >
> >
>
Re: AbstractService properties immutable
Posted by Alex Soto <as...@gmail.com>.
Yes but it is a bit antinatural if all other methods follows the
getter/setter, maybe a setter and an append methid in case of properties
could have more sense.
El dc., 17 juny 2015 a les 11:16, Romain Manni-Bucau (<rm...@gmail.com>)
va escriure:
> Not sure i got it. You use getProperties to mutate it
> Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
>
> > Hi, currently I am developing an application which I am registering
> > dynamically resources using Assembler class.
> >
> > I have seen that AbstractService has a field called properties that you
> can
> > only get information from it but not set it. All other fields has its own
> > getter/setter except this one. I think that if there is nothing against
> it
> > it should have a setter too so I can dynamically set properties too.
> >
> > The class is here:
> >
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
> >
> > I can provide a PR if you agree.
> >
> > Alex.
> >
>
Re: AbstractService properties immutable
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not sure i got it. You use getProperties to mutate it
Le 17 juin 2015 10:01, "Alex Soto" <as...@gmail.com> a écrit :
> Hi, currently I am developing an application which I am registering
> dynamically resources using Assembler class.
>
> I have seen that AbstractService has a field called properties that you can
> only get information from it but not set it. All other fields has its own
> getter/setter except this one. I think that if there is nothing against it
> it should have a setter too so I can dynamically set properties too.
>
> The class is here:
>
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/sys/AbstractService.java
>
> I can provide a PR if you agree.
>
> Alex.
>