2011/1/27 Carlos Quiroz <[email protected]>

> Hi
>
> I see, I guess that is worth to document a bit.
>
I agree

>
> In general though it makes iPOJO non transparent as the behaviour depends
> on details like where you are initializing the fields
> I'd expect that it wouldn't matter whether you initialize it in code or via
> the external service
>

It' is not 'in code" or "external service" its "in code" or "the component
model"
the thing is, if you want the component model handles some properties
(simple property or a service dependency), you need to let it do his job.

For example, a required service, if you have :
@requires
private MyService service;
// Then, you expect the framework to solve the service dependency, so you
will not do

@requires
private MyService service;
...//and later ask the bundle context for a service.
service = bundleContext.getService(theServiceReference);

If you do so, you affect the component model job.



> Carlos
>
> On Jan 27, 2011, at 10:07 AM, [email protected] wrote:
>
> > Its the iPOJO normal/known behaviour.
> > In order to set or initialize a default value, you must doit in the
> property
> > anotation.
> >   @Property(name = "statusName", value = "SOMETHING", mandatory = true)
> >   private String statusName;
> >
> > why? I don't know, I think is a code manipulation problem.
> >
> > 2011/1/27 Carlos Quiroz <[email protected]>
> >
> >> Hi
> >>
> >> I'm using iPOJO and I want to also integrate with ConfigAdmin but I have
> >> found an issue that I'm not sure if it is by design or bugs
> >>
> >> I' having a bundle that defines a component (Not a service) and has a
> >> couple of configuration properties defined as fields:
> >> I'm also using the Felix ConfigAdmin and Felix FileInstall service
> setting
> >> the properties in a configuration file as simple properties
> >>
> >> The class look like:
> >>
> >> @Component(name = "GIAPI_STATUS_SERVICE", managedservice =
> >> "edu.gemini.aspen.giapi.statusservice.StatusService")
> >> @Instantiate(name="GIAPI_STATUS_SERVICE")
> >> public class StatusService {
> >>   @Property
> >>   private String statusName;
> >>
> >>   @Property
> >>   private String serviceName;
> >> ...
> >>
> >> @Updated
> >> public void updates() ...
> >>
> >> @Validated
> >> public void updates() ...
> >>
> >> Now, I expect that since the values are stored in the configuration they
> >> will be made available at @Updated but. If the fields are initialized in
> >> code like
> >>   @Property(name = "statusName", value = "INVALID", mandatory = true)
> >>   private String statusName = "SOMETHING";
> >>
> >> Then at @Updated statusName has the value "SOMETHING" rather than the
> one
> >> in the config file
> >>
> >> If I don't initialize then it works
> >>
> >> Any ideas?
> >> Carlos
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
> >
> >
> > --
> > Issac Noé García Garza
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Issac Noé García Garza

Reply via email to