mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/osgi/MetatypeMessageService.java
private MetaTypeInfoType buildMetaTypeInfo(final Bundle bundle, final MetaTypeInformation info, final String pid, 
            final boolean isFactory)
    {
        final MetaTypeInfoType.Builder metaInfo = MetaTypeInfoType.newBuilder();
        metaInfo.setBundleId(bundle.getBundleId()).setPid(pid).setIsFactory(isFactory);
        final ObjectClassDefinition ocd = info.getObjectClassDefinition(pid, null);
        metaInfo.setOcd(getOcdMessage(ocd));
        final AttributeDefinition[] attribsReq = ocd.getAttributeDefinitions(ObjectClassDefinition.REQUIRED);
        final AttributeDefinition[] attribsOpt = ocd.getAttributeDefinitions(ObjectClassDefinition.OPTIONAL);
        if (attribsReq != null)
        {
            //iterate over required attributes
            for (AttributeDefinition attribute : attribsReq)
            {
                //get the attribute definition type
                final AttributeDefinitionType attributeDef = 
                        convertToAttribDefType(attribute, ObjectClassDefinition.REQUIRED);
                metaInfo.addAttributes(attributeDef);
            }
        }
        if (attribsOpt != null)
        {
            //iterate over optional attributes
            for (AttributeDefinition attribute : attribsOpt)
            {
                //get the attribute definition type
                final AttributeDefinitionType attributeDef = 
                        convertToAttribDefType(attribute, ObjectClassDefinition.OPTIONAL);
                metaInfo.addAttributes(attributeDef);
            }
        }
        return metaInfo.build();
    }
/**
     * Method that creates protocol buffer representation of meta type information for the specified PID.
     * 
     * @param bundle
     *      The bundle that contains meta type information for the specified PID.
     * @param info
     *      Meta type information for the specified PID.
     * @param pid
     *      PID to build protocol buffer meta type information for.
     * @param isFactory
     *      Boolean used to determine if the PID represents a factory.
     * @return
     *      Protocol buffer representation of the meta type information for the specified PID.
     */
Method that creates protocol buffer representation of meta type information for the specified PID.

@param bundle
The bundle that contains meta type information for the specified PID.
@param info
Meta type information for the specified PID.
@param pid
PID to build protocol buffer meta type information for.
@param isFactory
Boolean used to determine if the PID represents a factory.
@return
Protocol buffer representation of the meta type information for the specified PID.
Method that creates protocol buffer representation of meta type information for the specified PID . @param bundle The bundle that contains meta type information for the specified PID . @param info Meta type information for the specified PID . @param pid PID to build protocol buffer meta type information for . @param isFactory Boolean used to determine if the PID represents a factory . @return Protocol buffer representation of the meta type information for the specified PID .
private MetaTypeInfoType buildMetaTypeInfo(final Bundle bundle, final MetaTypeInformation info, final String pid, 
            final boolean isFactory)
    {
        final MetaTypeInfoType.Builder metaInfo = MetaTypeInfoType.newBuilder();
        metaInfo.setBundleId(bundle.getBundleId()).setPid(pid).setIsFactory(isFactory);
        final ObjectClassDefinition ocd = info.getObjectClassDefinition(pid, null);
        metaInfo.setOcd(getOcdMessage(ocd));
        final AttributeDefinition[] attribsReq = ocd.getAttributeDefinitions(ObjectClassDefinition.REQUIRED);
        final AttributeDefinition[] attribsOpt = ocd.getAttributeDefinitions(ObjectClassDefinition.OPTIONAL);
        if (attribsReq != null)
        {
            for (AttributeDefinition attribute : attribsReq)
            {
                final AttributeDefinitionType attributeDef = 
                        convertToAttribDefType(attribute, ObjectClassDefinition.REQUIRED);
                metaInfo.addAttributes(attributeDef);
            }
        }
        if (attribsOpt != null)
        {
            for (AttributeDefinition attribute : attribsOpt)
            {
                final AttributeDefinitionType attributeDef = 
                        convertToAttribDefType(attribute, ObjectClassDefinition.OPTIONAL);
                metaInfo.addAttributes(attributeDef);
            }
        }
        return metaInfo.build();
    }
private MetaTypeInfoType buildMetaTypeInfo ( final Bundle bundle , final MetaTypeInformation info , final String pid , final boolean isFactory ) { final MetaTypeInfoType . Builder metaInfo = MetaTypeInfoType . newBuilder ( ) ; metaInfo . setBundleId ( bundle . getBundleId ( ) ) . setPid ( pid ) . setIsFactory ( isFactory ) ; final ObjectClassDefinition ocd = info . getObjectClassDefinition ( pid , null ) ; metaInfo . setOcd ( getOcdMessage ( ocd ) ) ; final AttributeDefinition [ ] attribsReq = ocd . getAttributeDefinitions ( ObjectClassDefinition . REQUIRED ) ; final AttributeDefinition [ ] attribsOpt = ocd . getAttributeDefinitions ( ObjectClassDefinition . OPTIONAL ) ; if ( attribsReq != null ) { for ( AttributeDefinition attribute : attribsReq ) { final AttributeDefinitionType attributeDef = convertToAttribDefType ( attribute , ObjectClassDefinition . REQUIRED ) ; metaInfo . addAttributes ( attributeDef ) ; } } if ( attribsOpt != null ) { for ( AttributeDefinition attribute : attribsOpt ) { final AttributeDefinitionType attributeDef = convertToAttribDefType ( attribute , ObjectClassDefinition . OPTIONAL ) ; metaInfo . addAttributes ( attributeDef ) ; } } return metaInfo . build ( ) ; }
Method that creates protocol buffer representation of meta type information for the specified PID.
Method that creates protocol buffer representation of meta type information for the specified PID .
//iterate over required attributes //get the attribute definition type //iterate over optional attributes //get the attribute definition type