mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/comms/CustomCommsMessageService.java
private Message createLinkLayer(final CustomCommsNamespace ccommsMessage, final TerraHarvestMessage request,
        final RemoteChannel channel) throws IOException
    {
        final CreateLinkLayerRequestData createLinkLayer = 
                CreateLinkLayerRequestData.parseFrom(ccommsMessage.getData());
        
        final String linkLayerClassName = createLinkLayer.getLinkLayerProductType();
        final String linkLayerName = createLinkLayer.getLinkLayerName();
        final Map<String, Object> properties = new HashMap<String, Object>();
        
        // may or may not have a physical link that the link layer uses
        if (createLinkLayer.hasPhysicalLinkUuid())
        {
            final UUID physicalLinkUuid = SharedMessageUtils.convertProtoUUIDtoUUID(
                    createLinkLayer.getPhysicalLinkUuid());
    
            final String physicalLinkName = m_CommsService.getPhysicalLinkName(physicalLinkUuid);
            properties.put(LinkLayerAttributes.CONFIG_PROP_PHYSICAL_LINK_NAME, physicalLinkName);
        }
        
        try
        {
            final LinkLayer createdLinkLayer = m_CommsService.createLinkLayer(linkLayerClassName, linkLayerName,
                    properties);

            final CreateLinkLayerResponseData response = CreateLinkLayerResponseData.newBuilder().
                    setInfo(SharedMessageUtils.createFactoryObjectInfoMessage(createdLinkLayer)).build();
            
            m_MessageFactory.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreateLinkLayerResponse, 
                    response).queue(channel);
        }
        catch (final CCommException e)
        {
            m_Logging.error(e, "CreateLinkLayer: Cannot create link layer.");
            
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.CCOMM_ERROR, 
                            CUSTOM_COMMS_EXCEPTION + e.getMessage()).queue(channel);
        }
        return createLinkLayer;
    }
/**
     * Method to create a new instance of a link layer and add it to the service.
     * @param ccommsMessage
     *      request message containing the link layer class name, associated physical link UUID, and name
     *      for creating a new link layer.
     * @param request
     *      entire remote message for the request
     * @param channel
     *      channel to use for sending a response
     * @return
     *      the data message for this request
     * @throws IOException
     *      if message cannot be parsed or response message cannot be sent
     */
Method to create a new instance of a link layer and add it to the service.
@param ccommsMessage
request message containing the link layer class name, associated physical link UUID, and name
for creating a new link layer.
@param request
entire remote message for the request
@param channel
channel to use for sending a response
@return
the data message for this request
@throws IOException
if message cannot be parsed or response message cannot be sent
Method to create a new instance of a link layer and add it to the service . @param ccommsMessage request message containing the link layer class name associated physical link UUID and name for creating a new link layer . @param request entire remote message for the request @param channel channel to use for sending a response @return the data message for this request @throws IOException if message cannot be parsed or response message cannot be sent
private Message createLinkLayer(final CustomCommsNamespace ccommsMessage, final TerraHarvestMessage request,
        final RemoteChannel channel) throws IOException
    {
        final CreateLinkLayerRequestData createLinkLayer = 
                CreateLinkLayerRequestData.parseFrom(ccommsMessage.getData());
        final String linkLayerClassName = createLinkLayer.getLinkLayerProductType();
        final String linkLayerName = createLinkLayer.getLinkLayerName();
        final Map<String, Object> properties = new HashMap<String, Object>();
        if (createLinkLayer.hasPhysicalLinkUuid())
        {
            final UUID physicalLinkUuid = SharedMessageUtils.convertProtoUUIDtoUUID(
                    createLinkLayer.getPhysicalLinkUuid());
            final String physicalLinkName = m_CommsService.getPhysicalLinkName(physicalLinkUuid);
            properties.put(LinkLayerAttributes.CONFIG_PROP_PHYSICAL_LINK_NAME, physicalLinkName);
        }
        try
        {
            final LinkLayer createdLinkLayer = m_CommsService.createLinkLayer(linkLayerClassName, linkLayerName,
                    properties);
            final CreateLinkLayerResponseData response = CreateLinkLayerResponseData.newBuilder().
                    setInfo(SharedMessageUtils.createFactoryObjectInfoMessage(createdLinkLayer)).build();
            m_MessageFactory.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreateLinkLayerResponse, 
                    response).queue(channel);
        }
        catch (final CCommException e)
        {
            m_Logging.error(e, "CreateLinkLayer: Cannot create link layer.");
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.CCOMM_ERROR, 
                            CUSTOM_COMMS_EXCEPTION + e.getMessage()).queue(channel);
        }
        return createLinkLayer;
    }
private Message createLinkLayer ( final CustomCommsNamespace ccommsMessage , final TerraHarvestMessage request , final RemoteChannel channel ) throws IOException { final CreateLinkLayerRequestData createLinkLayer = CreateLinkLayerRequestData . parseFrom ( ccommsMessage . getData ( ) ) ; final String linkLayerClassName = createLinkLayer . getLinkLayerProductType ( ) ; final String linkLayerName = createLinkLayer . getLinkLayerName ( ) ; final Map < String , Object > properties = new HashMap < String , Object > ( ) ; if ( createLinkLayer . hasPhysicalLinkUuid ( ) ) { final UUID physicalLinkUuid = SharedMessageUtils . convertProtoUUIDtoUUID ( createLinkLayer . getPhysicalLinkUuid ( ) ) ; final String physicalLinkName = m_CommsService . getPhysicalLinkName ( physicalLinkUuid ) ; properties . put ( LinkLayerAttributes . CONFIG_PROP_PHYSICAL_LINK_NAME , physicalLinkName ) ; } try { final LinkLayer createdLinkLayer = m_CommsService . createLinkLayer ( linkLayerClassName , linkLayerName , properties ) ; final CreateLinkLayerResponseData response = CreateLinkLayerResponseData . newBuilder ( ) . setInfo ( SharedMessageUtils . createFactoryObjectInfoMessage ( createdLinkLayer ) ) . build ( ) ; m_MessageFactory . createCustomCommsResponseMessage ( request , CustomCommsMessageType . CreateLinkLayerResponse , response ) . queue ( channel ) ; } catch ( final CCommException e ) { m_Logging . error ( e , "CreateLinkLayer: Cannot create link layer." ) ; m_MessageFactory . createBaseErrorMessage ( request , ErrorCode . CCOMM_ERROR , CUSTOM_COMMS_EXCEPTION + e . getMessage ( ) ) . queue ( channel ) ; } return createLinkLayer ; }
Method to create a new instance of a link layer and add it to the service.
Method to create a new instance of a link layer and add it to the service .
// may or may not have a physical link that the link layer uses