On Wed, Mar 4, 2015 at 3:37 AM, Jan Willem Janssen <
[email protected]> wrote:

>
> > On 03 Mar 2015, at 16:36, Raymond Auge <[email protected]> wrote:
> >
> >>
> >> IIRC, the MetaType spec already allows for optional attributes to be
> >> defined
> >> on ADs, Attributes, OCDs and Objects. I believe that this would already
> >> cover
> >> most of these requirements, not?
> >>
> >
> > Sure! However, the need to read the metatype again is painful when
> metatype
> > is already reading it. Furthermore, this doesn't work for
> MetatypeProviders.
>
> Not sure we are one the same line here: the current Felix MetaType
> implementation
> already provides access to all unknown attributes it reads from a MetaType
> XML
> Resource, see [1] and [2].


You are certainly right here. I found this out finally.


> This also can be used to create them programmatically
> for use in your MetaTypeProvider. As I see it, it should solve your 1st
> and 3rd
> requirement...


> 1.
> http://svn.apache.org/viewvc/felix/trunk/metatype/src/main/java/org/apache/felix/metatype/OptionalAttributes.java?revision=1399637
> 2.
> http://svn.apache.org/viewvc/felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java?revision=1653581


True!

However there is no way to access the information from the MetaTypeService
except through deep reflection as the implementations of OCD and AD
returned from felix don't give access to the OptionalAttributes even
through any of the interfaces implemented by the impls.

So while you could sure import the OptionalAttributes class and add the
data programmatically to your OCDs/ADs there's no "standard" (in terms of
felix metatype, not in terms of the spec) way of getting this back via the
service.

So, I propose an interface defined in felix metatype something like:

public interface OptionalAttributesProvider {
    public OptionalAttributes getOptionalAttributes();
}

which felix would apply to the OCD/AD impls it provides from XML.

AND implementers of MetaTypeProvider can use the same interface on their
OCD/AD to pass along the same programmatically.

And considering the implication of the felix metatype impl ever wrapping
MetaTypeProvider output in some sort of proxy, since the interface is in
the felix project, it could just be assured to apply the interface on
proxies if it ever decided to create any.

Thoughts?


>
> --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> My world is revolving around INAETICS and Amdatu
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
>
>


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Reply via email to