mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/MissionProgramNamespaceUtils.java
public static boolean shutdownExecutedMission(final Socket socket, final String missionName) 
        throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        int regId = RemoteEventRegistration.regRemoteEventMessages(socket, Program.TOPIC_PROGRAM_SHUTDOWN, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, missionName));
        //create shutdown message
        ExecuteShutdownRequestData requestMessage = 
                ExecuteShutdownRequestData.newBuilder().setMissionName(missionName).build();
        
        //create shutdown message
        TerraHarvestMessage message = 
            TestMissionProgrammingNamespace.createMissionProgramMessage(
                    MissionProgrammingMessageType.ExecuteShutdownRequest, requestMessage);
        
        // send out message
        message.writeDelimitedTo(socket.getOutputStream());
        
        //wait for execution and response, response is from the actual thread executing the mission program
        try
        {
            listener.waitForRemoteEvent(Program.TOPIC_PROGRAM_SHUTDOWN, 2000);
            return true;
        }
        finally
        {
            MessageListener.unregisterEvent(regId, socket);
        }
    }
/**
     * Clean up a mission created. This assumes that the mission is in an executed state.
     * @param socket
     *     the socket to use
     * @return name
     *     a mission program name
     */
Clean up a mission created. This assumes that the mission is in an executed state.
@param socket
the socket to use
@return name
a mission program name
Clean up a mission created . This assumes that the mission is in an executed state . @param socket the socket to use @return name a mission program name
public static boolean shutdownExecutedMission(final Socket socket, final String missionName) 
        throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        int regId = RemoteEventRegistration.regRemoteEventMessages(socket, Program.TOPIC_PROGRAM_SHUTDOWN, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, missionName));
        ExecuteShutdownRequestData requestMessage = 
                ExecuteShutdownRequestData.newBuilder().setMissionName(missionName).build();
        TerraHarvestMessage message = 
            TestMissionProgrammingNamespace.createMissionProgramMessage(
                    MissionProgrammingMessageType.ExecuteShutdownRequest, requestMessage);
        message.writeDelimitedTo(socket.getOutputStream());
        try
        {
            listener.waitForRemoteEvent(Program.TOPIC_PROGRAM_SHUTDOWN, 2000);
            return true;
        }
        finally
        {
            MessageListener.unregisterEvent(regId, socket);
        }
    }
public static boolean shutdownExecutedMission ( final Socket socket , final String missionName ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; int regId = RemoteEventRegistration . regRemoteEventMessages ( socket , Program . TOPIC_PROGRAM_SHUTDOWN , String . format ( "(%s=%s)" , Program . EVENT_PROP_PROGRAM_NAME , missionName ) ) ; ExecuteShutdownRequestData requestMessage = ExecuteShutdownRequestData . newBuilder ( ) . setMissionName ( missionName ) . build ( ) ; TerraHarvestMessage message = TestMissionProgrammingNamespace . createMissionProgramMessage ( MissionProgrammingMessageType . ExecuteShutdownRequest , requestMessage ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; try { listener . waitForRemoteEvent ( Program . TOPIC_PROGRAM_SHUTDOWN , 2000 ) ; return true ; } finally { MessageListener . unregisterEvent ( regId , socket ) ; } }
Clean up a mission created.
Clean up a mission created .
//create shutdown message //create shutdown message // send out message //wait for execution and response, response is from the actual thread executing the mission program