[ 
https://issues.apache.org/jira/browse/FELIX-4649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14154659#comment-14154659
 ] 

Carsten Ziegeler commented on FELIX-4649:
-----------------------------------------

I've asked for clarification of the OSGi spec wrt when metatype information 
should be read by the implementation. The answer is this:
>>>
The meta type information come from a variety of sources: resource in a bundle, 
resources in attached fragments, MS(F) services implementing MTP, and MTP 
services. Since the services are fully dynamic, there is never a known time 
when one can be sure that all possible sources of metatype information are 
present.

So the information returned by MetaTypeService is just the currently known 
information. Therefore, a MetaTypeService implementation can return meta type 
information about a bundle at any life cycle stage of a bundle (except for 
UNINSTALLED obviously). So the spec must not prescribe any subset of states for 
which an implementation can provide meta type information.
<<<
Therefore I think the current implementation is good enough and client code 
should not rely on any particular bundle state.


> Get MetaTypeInformation while bundle is starting
> ------------------------------------------------
>
>                 Key: FELIX-4649
>                 URL: https://issues.apache.org/jira/browse/FELIX-4649
>             Project: Felix
>          Issue Type: Wish
>          Components: Metatype Service
>    Affects Versions: metatype-1.0.10
>            Reporter: Irakli Betchvaia
>
> Problem
> Gathering metatype information as long as bundle is not in state 
> Bundle.ACTIVE MetaTypeService returns null in method 
> MetaTypeserviceImpl.getMetaTypeInformation. We'd like to have the 
> MetatTypeInformation returned also in state Bundle.STARTING
> Solution
> Please replace the following in MediaTypeServiceimpl.java Method 
> getMetaTypeInformation
> {code:title=MediaTypeServiceimpl.java|borderStyle=solid}
> if ( bundle.getState() == Bundle.ACTIVE )
> {
>         putMetaTypeInformationInternal( bundle, mti );
> }
> else
> {
>         impl = mti;
>         mti = null;
> }
> {code}
> by
> {code:title=MediaTypeServiceimpl.java|borderStyle=solid}
> if ( bundle.getState() == Bundle.ACTIVE || bundle.getState() == 
> Bundle.STARTING )
> {
>         putMetaTypeInformationInternal( bundle, mti );
> }
> else
> {
>         impl = mti;
>         mti = null;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to