mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/BundleNamespaceUtils.java
public static long installBundle(final File jarFile, final String bundleLocation, final boolean startAtInstall, 
            final Socket socket) throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        byte[] buf = FileUtils.readFileToByteArray(jarFile);
        
        //construct request
        InstallRequestData request = InstallRequestData.newBuilder().
            setBundleLocation(bundleLocation).
            setBundleFile(ByteString.copyFrom(buf)).
            setStartAtInstall(startAtInstall).
            build();
        TerraHarvestMessage message = createBundleMessage(request, BundleMessageType.InstallRequest);

        //send message
        message.writeDelimitedTo(socket.getOutputStream());

        // read in response
        Message messageRcvd = 
             listener.waitForMessage(Namespace.Bundle, BundleMessageType.InstallResponse, 1000);

        BundleNamespace namespaceResponse = (BundleNamespace)messageRcvd;
        InstallResponseData responseData = InstallResponseData.parseFrom(namespaceResponse.getData());
        return responseData.getBundleId();
    }
/**
     * Install the bundle at the given file.
     * @param jarFile
     *     the jar file to install
     * @param bundleLocation
     *      the bundle location 
     * @param socket
     *     the socket connection to use
     * @return
     *     the bundleID of the installed bundle
     */
Install the bundle at the given file.
@param jarFile
the jar file to install
@param bundleLocation
the bundle location
@param socket
the socket connection to use
@return
the bundleID of the installed bundle
Install the bundle at the given file . @param jarFile the jar file to install @param bundleLocation the bundle location @param socket the socket connection to use @return the bundleID of the installed bundle
public static long installBundle(final File jarFile, final String bundleLocation, final boolean startAtInstall, 
            final Socket socket) throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        byte[] buf = FileUtils.readFileToByteArray(jarFile);
        InstallRequestData request = InstallRequestData.newBuilder().
            setBundleLocation(bundleLocation).
            setBundleFile(ByteString.copyFrom(buf)).
            setStartAtInstall(startAtInstall).
            build();
        TerraHarvestMessage message = createBundleMessage(request, BundleMessageType.InstallRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        Message messageRcvd = 
             listener.waitForMessage(Namespace.Bundle, BundleMessageType.InstallResponse, 1000);
        BundleNamespace namespaceResponse = (BundleNamespace)messageRcvd;
        InstallResponseData responseData = InstallResponseData.parseFrom(namespaceResponse.getData());
        return responseData.getBundleId();
    }
public static long installBundle ( final File jarFile , final String bundleLocation , final boolean startAtInstall , final Socket socket ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; byte [ ] buf = FileUtils . readFileToByteArray ( jarFile ) ; InstallRequestData request = InstallRequestData . newBuilder ( ) . setBundleLocation ( bundleLocation ) . setBundleFile ( ByteString . copyFrom ( buf ) ) . setStartAtInstall ( startAtInstall ) . build ( ) ; TerraHarvestMessage message = createBundleMessage ( request , BundleMessageType . InstallRequest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message messageRcvd = listener . waitForMessage ( Namespace . Bundle , BundleMessageType . InstallResponse , 1000 ) ; BundleNamespace namespaceResponse = ( BundleNamespace ) messageRcvd ; InstallResponseData responseData = InstallResponseData . parseFrom ( namespaceResponse . getData ( ) ) ; return responseData . getBundleId ( ) ; }
Install the bundle at the given file.
Install the bundle at the given file .
//construct request //send message // read in response