Package org.apache.felix.scrplugin.helper

Examples of org.apache.felix.scrplugin.helper.MetatypeAttributeDefinition


    private static String detectMetatypeVersion(final DescriptionContainer container) {
        for(final ComponentContainer comp : container.getComponents()) {
            if ( comp.getMetatypeContainer() != null ) {
                final Iterator<MetatypeAttributeDefinition> i = comp.getMetatypeContainer().getProperties().iterator();
                while ( i.hasNext() ) {
                    final MetatypeAttributeDefinition ad = i.next();
                    if ( ad.getType().equalsIgnoreCase("password") ) {
                        return NAMESPACE_URI_12;
                    }
                }
            }
        }
View Full Code Here


        if ( ocd.getProperties().size() > 0 ) {
            IOUtils.newline(contentHandler);
            final Iterator<MetatypeAttributeDefinition> i = ocd.getProperties().iterator();
            while ( i.hasNext() ) {
                final MetatypeAttributeDefinition ad = i.next();
                generateAttributeXML(ad, contentHandler);
            }
            IOUtils.indent(contentHandler, 1);
        }
View Full Code Here

                        } else {
                            isPrivate = false;
                        }
                    }
                    if ( !isPrivate ) {
                        final MetatypeAttributeDefinition ad = new MetatypeAttributeDefinition();
                        ocd.getProperties().add(ad);
                        ad.setId(pd.getName());
                        ad.setType(pd.getType().name());

                        if (pd.getLabel() != null ) {
                            ad.setName(pd.getLabel());
                        }
                        if (pd.getDescription() != null ) {
                            ad.setDescription(pd.getDescription());
                        }

                        if ( pd.getUnbounded() == PropertyUnbounded.DEFAULT ) {
                            if ( pd.getCardinality() != 0 ) {
                                ad.setCardinality(pd.getCardinality());
                            }
                        } else if ( pd.getUnbounded() == PropertyUnbounded.ARRAY ) {
                            // unlimited array
                            ad.setCardinality(new Integer(Integer.MAX_VALUE));
                        } else {
                            // unlimited vector
                            ad.setCardinality(new Integer(Integer.MIN_VALUE));
                        }

                        ad.setDefaultValue(pd.getValue());
                        ad.setDefaultMultiValue(pd.getMultiValue());

                        // check options
                        final String[] parameters = pd.getOptions();
                        if ( parameters != null && parameters.length > 0 ) {
                            final Map<String, String> options = new LinkedHashMap<String, String>();
                            for (int j=0; j < parameters.length; j=j+2) {
                                final String optionLabel = parameters[j];
                                final String optionValue = (j < parameters.length-1) ? parameters[j+1] : null;
                                if (optionValue != null) {
                                    options.put(optionLabel, optionValue);
                                }
                            }
                            ad.setOptions(options);
                        }
                    }
                } else {
                    // additional metatype checks (FELIX-4033)
                    if ( pd.isPrivate() != null && pd.isPrivate() ) {
View Full Code Here

TOP

Related Classes of org.apache.felix.scrplugin.helper.MetatypeAttributeDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.