Package org.apache.felix.metatype

Examples of org.apache.felix.metatype.MetaDataReader


    }


    private MetaTypeInformationImpl fromDocuments( Bundle bundle )
    {
        MetaDataReader reader = new MetaDataReader();

        // get the descriptors, return nothing if none
        Enumeration docs = bundle.findEntries( METATYPE_DOCUMENTS_LOCATION, "*.xml", false );
        if ( docs == null || !docs.hasMoreElements() )
        {
            return null;
        }

        MetaTypeInformationImpl cmti = new MetaTypeInformationImpl( bundle );
        while ( docs.hasMoreElements() )
        {
            URL doc = ( URL ) docs.nextElement();
            try
            {
                MetaData metaData = reader.parse( doc );
                if ( metaData != null )
                {
                    cmti.addMetaData( metaData );
                }
            }
View Full Code Here


        synchronized (LOCK) {
            if (m_session == null) {
                throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Can not process resource without a Deployment Session");
            }
        }
        MetaDataReader reader = new MetaDataReader();
        MetaData data = null;
        try {
            data = reader.parse(stream);
        }
        catch (IOException e) {
            throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Unable to process resource.", e);
        }
        if (data == null) {
View Full Code Here

            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                String name = entry.getName();
                if (name.startsWith("OSGI-INF/metatype/")) {
                    if (name.endsWith(XML_SUFFIX)) {
                        MetaDataReader reader = new MetaDataReader();
                        InputStream in = jarFile.getInputStream(entry);
                        if (in != null) {
                            String text = IOHelpers.readFully(in);
                            MetaData metadata = reader.parse(new ByteArrayInputStream(text.getBytes()));
                            if (metadata != null) {
                                String pid = name.substring(0, name.length() - XML_SUFFIX.length());
                                xmlMap.put(pid, text);
                                metadataMap.put(pid, metadata);
                            }
View Full Code Here

            metadata.addDesignate(designate);
            OCD ocd = new OCD();
            ocd.setId(pid);
            metadata.addObjectClassDefinition(ocd);
        } else {
            MetaDataReader reader = new MetaDataReader();
            metadata = reader.parse(new FileInputStream(xmlFile));
        }
        // lets try get the i18n properties
        Properties properties = new Properties();
        if (propertiesFile.exists() && propertiesFile.isFile()) {
            properties.load(new FileInputStream(propertiesFile));
View Full Code Here

        while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            String name = entry.getName();
            if (name.startsWith("OSGI-INF/metatype/")) {
                if (name.endsWith(XML_SUFFIX)) {
                    MetaDataReader reader = new MetaDataReader();
                    InputStream in = jarFile.getInputStream(entry);
                    if (in != null) {
                        MetaData metadata = reader.parse(in);
                        if (metadata != null) {
                            String pid = name.substring(0, name.length() - XML_SUFFIX.length());
                            metadataMap.put(pid, metadata);
                        }
                    }
View Full Code Here

    }


    private MetaTypeInformationImpl fromDocuments( Bundle bundle )
    {
        MetaDataReader reader = new MetaDataReader();

        // get the descriptors, return nothing if none
        Enumeration docs = bundle.findEntries( METATYPE_DOCUMENTS_LOCATION, "*.xml", false );
        if ( docs == null || !docs.hasMoreElements() )
        {
            return null;
        }

        MetaTypeInformationImpl cmti = new MetaTypeInformationImpl( bundle );
        while ( docs.hasMoreElements() )
        {
            URL doc = ( URL ) docs.nextElement();
            try
            {
                MetaData metaData = reader.parse( doc );
                if ( metaData != null )
                {
                    cmti.addMetaData( metaData );
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.metatype.MetaDataReader

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.