mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/mp/MissionProgrammingMessageService.java
private Message loadTemplate(final TerraHarvestMessage request, final MissionProgrammingNamespace missionMessage,
            final RemoteChannel channel) 
            throws IOException, IllegalArgumentException
    {
        //get data from the data field
        final LoadTemplateRequestData progTemplate = LoadTemplateRequestData.parseFrom(missionMessage.getData());
        MissionProgramTemplate template = null;
        try
        {
            //convert the message data to a mission program template
            template = (MissionProgramTemplate)m_Converter.convertToJaxb(progTemplate.getMission());
            m_TemplateManager.loadMissionTemplate(template);
            //send response
            m_MessageFactory.createMissionProgrammingResponseMessage(request, 
                    MissionProgrammingMessageType.LoadTemplateResponse, null).queue(channel);
        }
        catch (final ObjectConverterException exception) 
        {
            //if the jaxb converter was unable to create an object
            //send response
            final String errorDesc = "Failed to create template object from message. ";
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.CONVERTER_ERROR,
                    errorDesc + exception.getMessage()).queue(channel);
            m_Logging.error(exception, errorDesc);
        }
        catch (final PersistenceFailedException exception) 
        {
            //template failed to persist, send appropriate response
            final String errorDesc = "Failed persisting the mission template from message. ";
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.PERSIST_ERROR,
                    errorDesc + exception.getMessage()).queue(channel);
            m_Logging.error(exception, errorDesc);
        }
        
        return progTemplate;
    }
/**
     * Add the passed template to the TemplateProgramManager.
     *
     * @param request
     *     full request message
     * @param missionMessage
     *     message containing a mission program message
     * @param channel
     *      channel to use for sending a response
     * @throws IOException
     *     if the response fails to send
     * @throws IllegalArgumentException
     *     thrown in the event that one of inputs is invalid    
     * @return
     *      the data message for this request 
     */
Add the passed template to the TemplateProgramManager.
Add the passed template to the TemplateProgramManager .
private Message loadTemplate(final TerraHarvestMessage request, final MissionProgrammingNamespace missionMessage,
            final RemoteChannel channel) 
            throws IOException, IllegalArgumentException
    {
        final LoadTemplateRequestData progTemplate = LoadTemplateRequestData.parseFrom(missionMessage.getData());
        MissionProgramTemplate template = null;
        try
        {
            template = (MissionProgramTemplate)m_Converter.convertToJaxb(progTemplate.getMission());
            m_TemplateManager.loadMissionTemplate(template);
            m_MessageFactory.createMissionProgrammingResponseMessage(request, 
                    MissionProgrammingMessageType.LoadTemplateResponse, null).queue(channel);
        }
        catch (final ObjectConverterException exception) 
        {
            final String errorDesc = "Failed to create template object from message. ";
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.CONVERTER_ERROR,
                    errorDesc + exception.getMessage()).queue(channel);
            m_Logging.error(exception, errorDesc);
        }
        catch (final PersistenceFailedException exception) 
        {
            final String errorDesc = "Failed persisting the mission template from message. ";
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.PERSIST_ERROR,
                    errorDesc + exception.getMessage()).queue(channel);
            m_Logging.error(exception, errorDesc);
        }
        return progTemplate;
    }
private Message loadTemplate ( final TerraHarvestMessage request , final MissionProgrammingNamespace missionMessage , final RemoteChannel channel ) throws IOException , IllegalArgumentException { final LoadTemplateRequestData progTemplate = LoadTemplateRequestData . parseFrom ( missionMessage . getData ( ) ) ; MissionProgramTemplate template = null ; try { template = ( MissionProgramTemplate ) m_Converter . convertToJaxb ( progTemplate . getMission ( ) ) ; m_TemplateManager . loadMissionTemplate ( template ) ; m_MessageFactory . createMissionProgrammingResponseMessage ( request , MissionProgrammingMessageType . LoadTemplateResponse , null ) . queue ( channel ) ; } catch ( final ObjectConverterException exception ) { final String errorDesc = "Failed to create template object from message. " ; m_MessageFactory . createBaseErrorMessage ( request , ErrorCode . CONVERTER_ERROR , errorDesc + exception . getMessage ( ) ) . queue ( channel ) ; m_Logging . error ( exception , errorDesc ) ; } catch ( final PersistenceFailedException exception ) { final String errorDesc = "Failed persisting the mission template from message. " ; m_MessageFactory . createBaseErrorMessage ( request , ErrorCode . PERSIST_ERROR , errorDesc + exception . getMessage ( ) ) . queue ( channel ) ; m_Logging . error ( exception , errorDesc ) ; } return progTemplate ; }
Add the passed template to the TemplateProgramManager.
Add the passed template to the TemplateProgramManager .
//get data from the data field //convert the message data to a mission program template //send response //if the jaxb converter was unable to create an object //send response //template failed to persist, send appropriate response