I will look into detail about the Resource injection after M1-Release. Thanks;
/Gurkan ________________________________ From: Mark Struberg <[email protected]> To: [email protected] Sent: Wednesday, January 28, 2009 6:05:59 PM Subject: Re: level of resource injection Another thing: > 3.10. Support for Common Annotations > @PersistenceContext(type=EXTENDED)is not supported for simple beans. But in an SE environment there are only extended EntityManagers available? What to do? Otoh the Spec only says that the attribute type=EXTENDED is not supported, but it does not say that all injected EntityManagers has to be of type TRANSACTION ;) LieGrue, strub --- Mark Struberg <[email protected]> schrieb am Mi, 28.1.2009: > Von: Mark Struberg <[email protected]> > Betreff: Re: level of resource injection > An: [email protected] > Datum: Mittwoch, 28. Januar 2009, 17:01 > I'm a bit confused: > > Section 3.6 states that: > > A resource always has scope @Dependent. > > What does this mean for @PersistenceUnit? > > Another open issue: if JNDI is involved, we have to take > the EntityManagerFactory from there instead of getting it > from the Persistence Factory. > > What do you suggest for this scenario? > > LieGrue, > strub > > --- Mark Struberg <[email protected]> schrieb am Mi, > 28.1.2009: > > > Von: Mark Struberg <[email protected]> > > Betreff: Re: level of resource injection > > An: [email protected] > > Datum: Mittwoch, 28. Januar 2009, 14:36 > > it's done. > > > > please review the patch in > > https://issues.apache.org/jira/browse/OWB-71 > > > > Regarding JPAUtil#getPersistenceUnit > > > > I'm in favour to implement those functions for the > > basic systems directly in our code for now and think > about > > what to implement via an SPI later in a 2nd round. > This will > > give us more time to learn what we really need first. > > > > LieGrue, > > strub > > > > > > --- Gurkan Erdogdu <[email protected]> > schrieb > > am Di, 27.1.2009: > > > > > Von: Gurkan Erdogdu > <[email protected]> > > > Betreff: Re: level of resource injection > > > An: [email protected] > > > Datum: Dienstag, 27. Januar 2009, 15:55 > > > Ok, Mark. > > > > > > > > ________________________________ > > > From: Mark Struberg <[email protected]> > > > To: [email protected] > > > Sent: Tuesday, January 27, 2009 4:04:26 PM > > > Subject: Re: level of resource injection > > > > > > Hi Gurkan! > > > > > > Thanks for the tips! > > > > > > Currently I'm only looking at the injection > of > > > resources which do not need any XML. So I started > with > > > implementing @PersistenceUnit and looking forward > to > > wrap > > > all the necessary PersistenceManagerFactory stuff > in > > > JPAUtil.java (currently empty, but I think > that's > > what > > > you've intended it for, isn't it?). > > > > > > I'll post a patch for review in the afternoon > > > (hopefully) and commit it after you've > checked it. > > > > > > @PersistenceContext will be a bit trickier, since > it > > is not > > > thread save and we have to do kind of > > 'scoping' > > > ourself. > > > > > > The @CustomerDataservice with the whole XML stuff > will > > be > > > the next step after we've solved this > problem. > > > > > > > > > LieGrue, > > > strub > > > > > > > > > --- Gurkan Erdogdu > <[email protected]> > > schrieb > > > am Di, 27.1.2009: > > > > > > > Von: Gurkan Erdogdu > > <[email protected]> > > > > Betreff: Re: level of resource injection > > > > An: [email protected] > > > > Datum: Dienstag, 27. Januar 2009, 12:47 > > > > Hi Mark; > > > > > > > > Do you try to implement resource injections > via > > XML > > > > definitions, right? Below sketch is the > summary > > of how > > > you > > > > can proceed with the current implementation. > > > > > > > > For XML defined webbeans, the main entry > point is > > the > > > > *WebBeansXMLConfigurator* class. Java EE > > Resources are > > > only > > > > defined in the xml file, according to the > *9.5.2 > > > Type-Level > > > > metadata for a bean*. This part is handled > in the > > > > > > *WebBeansXMLConfigurator#configureTypeLevelMetaData* > > > method. > > > > > > > > > > > > For injectable resources, you can create > another > > class > > > like > > > > *XMLResourceInjectableField* in the > *inject/xml* > > > package and > > > > add the > *Map<Field,XMLInjectionPointModel> > > > > injectedResources* instance variable into > the > > > > *XMLComponentImpl.java* to hold the > injectable > > > resource > > > > fields. > > > > > > > > After that you will have to add the resource > > injection > > > > fields that are declared in the XML into the > > resource > > > > injection map in the *XMLComponentImpl* > class. > > You can > > > > create another method for this in the > > > > *WebBeansXMLConfigurator* class, for example > > > > *configureInjectableResources()*, and call > this > > method > > > from > > > > *configureTypeLevelMetaData()* method. > > > > > > > > Skeletons of the codes may like the > followings; > > > > > > > > WebBeansXMLConfigurator.java > > > > > ---------------------------------------------- > > > > ........ > > > > > > > > //Update this method > > > > public <T> void > > configureTypeLevelMetaData() > > > > { > > > > //Add this method call > > > > configureInjectableResources(); > > > > > > > > } > > > > //This is the new method that is responsible > for > > > adding > > > > resource injection fields to the component > > > > public <T> void > > configureInjectableResources() > > > > { > > > > //Find fields from resource decleration > in > > XML > > > > //Create XMLInjectionPointModel for each > > field > > > > //Add field and related model into the > > > > > > > > > > XMLComponentImpl#Map<Field,XMLInjectionPointModel> > > > > } > > > > > > > > XMLComponentImpl.java > > > > --------------------------------- > > > > After that in XMLComponentImpl class, update > > > injectFields > > > > method to inject resources, > > > > > > > > //Update this method for adding resource > > injection > > > support > > > > > > > > protected void injectFields(T instance) > > > > { > > > > ...... > > > > //For each resource injection map entry > > > > //Create new *XMLResourceInjectableField* > > instance > > > > //Set field with calling the > > > > AbstractInjectable#inject(....) > > > > } > > > > AbstractInjectable class > > > > --------------------------------- > > > > public Object inject() > > > > { > > > > //If resource, create injection object > with > > method > > > > injectResource > > > > if (isResource(annotations)) > > > > { > > > > return injectResource(type, > > > annotations); > > > > } > > > > } > > > > > > > > WDYT? > > > > > > > > /Gurkan > > > > > > > > > > > > > > > > ________________________________ > > > > From: Mark Struberg > <[email protected]> > > > > To: [email protected] > > > > Sent: Tuesday, January 27, 2009 12:35:02 PM > > > > Subject: level of resource injection > > > > > > > > Gurkan, > > > > another question about resources: where > should I > > > actually > > > > inject the resources finally? > > > > > > > > This is the stack trace so far: > > > > > > > > > > InjectionResolver.implResolveByType(Class<?>, > > > Type[], > > > > Annotation...) line: 94 > > > > > > > > > > InjectableField(AbstractInjectable).inject(Class<T>, > > > > Type[], Annotation...) line: 83 > > > > InjectableField.doInjection() line: 92 > > > > > > > > > > > > My thoughts: > > > > Resources can be handled in a very high > layer, > > since > > > the > > > > 'accessors' already hide all the > > underlying > > > > complexity of having classloader hierarchies > etc, > > > isn't? > > > > > > > > So in the > > > > AbstractInjectable#inject > > > > I'd like to add something like: > > > > > > > > if (isResource(annotations)) > > > > { > > > > return injectResource(type, > > > annotations); > > > > } > > > > > > > > LieGrü, > > > > strub
