Examples of Designate


Examples of org.apache.felix.metatype.Designate

            DefaultMetaTypeProvider dmtp = new DefaultMetaTypeProvider( this.bundle, md );

            Iterator designates = md.getDesignates().values().iterator();
            while ( designates.hasNext() )
            {
                Designate designate = ( Designate ) designates.next();

                // get the OCD reference, ignore the designate if none
                DesignateObject object = designate.getObject();
                String ocdRef = ( object == null ) ? null : object.getOcdRef();
                if ( ocdRef == null )
                {
                    continue;
                }

                // get ocd for the reference, ignore designate if none
                OCD ocd = ( OCD ) md.getObjectClassDefinitions().get( ocdRef );
                if ( ocd == null )
                {
                    continue;
                }

                // gather pids and factory pids and register provider
                if ( designate.getFactoryPid() != null )
                {
                    this.factoryPids.add( designate.getFactoryPid() );
                    this.addMetaTypeProvider( designate.getFactoryPid(), dmtp );
                }
                else
                {
                    this.pids.add( designate.getPid() );
                    this.addMetaTypeProvider( designate.getPid(), dmtp );
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.felix.metatype.Designate

        if (localOcds == null) {
            localOcds = Collections.EMPTY_MAP;
        }
        Iterator i = designates.keySet().iterator();
        while (i.hasNext()) {
            Designate designate = (Designate) designates.get(i.next());
           
            // check object
            if (designate.getObject() == null) {
                throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Designate Object child missing or invalid");
            }
           
            // check attributes
            if (designate.getObject().getAttributes() == null || designate.getObject().getAttributes().size() == 0) {
                throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Object Attributes child missing or invalid");
            }
           
            // check ocdRef
            String ocdRef = designate.getObject().getOcdRef();
            if (ocdRef == null || "".equals(ocdRef)) {
                throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Object ocdRef attribute missing or invalid");
            }

            // determine OCD
            ObjectClassDefinition ocd = null;
            OCD localOcd = (OCD) localOcds.get(ocdRef);
            // ask meta type service for matching OCD if no local OCD has been defined
            ocd = (localOcd != null) ? new ObjectClassDefinitionImpl(localOcd) : getMetaTypeOCD(data, designate);
            if (ocd == null) {
                throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "No Object Class Definition found with id=" + ocdRef);
            }
            // determine configuration data based on the values and their type definition
            Dictionary dict = getProperties(designate, ocd);
            if (dict == null) {
                // designate does not match it's definition, but was marked optional, ignore it
                continue;
            }
            List resources = (List) m_toBeInstalled.get(name);
            resources.add(new AutoConfResource(name, designate.getPid(), designate.getFactoryPid(), designate.getBundleLocation(), designate.isMerge(), dict, filter));
        }
        m_log.log(LogService.LOG_DEBUG, "processing " + name + " done");
    }
View Full Code Here

Examples of org.apache.felix.metatype.Designate

    protected void addMetaTypeInformation(MetadataHandler handler, String pid, File xmlFile, File propertiesFile) throws IOException {
        MetaData metadata;
        if (!xmlFile.exists()) {
            LOG.info("Warning! " + xmlFile + " does not exist so no OSGi MetaType metadata");
            metadata = new MetaData();
            Designate designate = new Designate();
            designate.setPid(pid);
            metadata.addDesignate(designate);
            OCD ocd = new OCD();
            ocd.setId(pid);
            metadata.addObjectClassDefinition(ocd);
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.