mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/AssetNamespaceUtils.java
public static FactoryObjectInfo tryGetAssetInfoByName(final Socket socket, final String assetName)
    {
        try
        {
            MessageListener listener = new MessageListener(socket); 
            TerraHarvestMessage message = createAssetDirSvcNamespaceMessage(
                    AssetDirectoryServiceMessageType.GetAssetsRequest, null);        
            message.writeDelimitedTo(socket.getOutputStream());
            
            AssetDirectoryServiceNamespace response = (AssetDirectoryServiceNamespace)listener.waitForMessage(
                    Namespace.AssetDirectoryService, AssetDirectoryServiceMessageType.GetAssetsResponse, TIMEOUT);    
            
            GetAssetsResponseData dataResponse = GetAssetsResponseData.parseFrom(response.getData());
            
            for (FactoryObjectInfo assetInfo : dataResponse.getAssetInfoList())
            {
                TerraHarvestMessage nameRequestMsg = AssetNamespaceUtils.createAssetMessage(
                        AssetMessageType.GetNameRequest, 
                        GetNameRequestData.newBuilder().setUuid(assetInfo.getUuid()).build());        
                nameRequestMsg.writeDelimitedTo(socket.getOutputStream());
                
                AssetDirectoryServiceNamespace nameResponseMsg = 
                        (AssetDirectoryServiceNamespace)listener.waitForMessage(Namespace.AssetDirectoryService, 
                                AssetMessageType.GetNameResponse, TIMEOUT);
                
                GetNameResponseData nameResponse = GetNameResponseData.parseFrom(nameResponseMsg.getData());
                
                if (nameResponse.getAssetName().equals(assetName))
                {
                    // found the UUID for the desired asset
                    return assetInfo;
                }
            }
        }
        catch (IOException e)
        {
            throw new IllegalStateException(e);
        }
        
        return null;
    }
/**
     * Get info for an asset of the given name.
     * 
     * @return
     *      info for the asset with the given name or null if not found
     */
Get info for an asset of the given name.

@return
info for the asset with the given name or null if not found
Get info for an asset of the given name . @return info for the asset with the given name or null if not found
public static FactoryObjectInfo tryGetAssetInfoByName(final Socket socket, final String assetName)
    {
        try
        {
            MessageListener listener = new MessageListener(socket); 
            TerraHarvestMessage message = createAssetDirSvcNamespaceMessage(
                    AssetDirectoryServiceMessageType.GetAssetsRequest, null);        
            message.writeDelimitedTo(socket.getOutputStream());
            AssetDirectoryServiceNamespace response = (AssetDirectoryServiceNamespace)listener.waitForMessage(
                    Namespace.AssetDirectoryService, AssetDirectoryServiceMessageType.GetAssetsResponse, TIMEOUT);    
            GetAssetsResponseData dataResponse = GetAssetsResponseData.parseFrom(response.getData());
            for (FactoryObjectInfo assetInfo : dataResponse.getAssetInfoList())
            {
                TerraHarvestMessage nameRequestMsg = AssetNamespaceUtils.createAssetMessage(
                        AssetMessageType.GetNameRequest, 
                        GetNameRequestData.newBuilder().setUuid(assetInfo.getUuid()).build());        
                nameRequestMsg.writeDelimitedTo(socket.getOutputStream());
                AssetDirectoryServiceNamespace nameResponseMsg = 
                        (AssetDirectoryServiceNamespace)listener.waitForMessage(Namespace.AssetDirectoryService, 
                                AssetMessageType.GetNameResponse, TIMEOUT);
                GetNameResponseData nameResponse = GetNameResponseData.parseFrom(nameResponseMsg.getData());
                if (nameResponse.getAssetName().equals(assetName))
                {
                    return assetInfo;
                }
            }
        }
        catch (IOException e)
        {
            throw new IllegalStateException(e);
        }
        return null;
    }
public static FactoryObjectInfo tryGetAssetInfoByName ( final Socket socket , final String assetName ) { try { MessageListener listener = new MessageListener ( socket ) ; TerraHarvestMessage message = createAssetDirSvcNamespaceMessage ( AssetDirectoryServiceMessageType . GetAssetsRequest , null ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; AssetDirectoryServiceNamespace response = ( AssetDirectoryServiceNamespace ) listener . waitForMessage ( Namespace . AssetDirectoryService , AssetDirectoryServiceMessageType . GetAssetsResponse , TIMEOUT ) ; GetAssetsResponseData dataResponse = GetAssetsResponseData . parseFrom ( response . getData ( ) ) ; for ( FactoryObjectInfo assetInfo : dataResponse . getAssetInfoList ( ) ) { TerraHarvestMessage nameRequestMsg = AssetNamespaceUtils . createAssetMessage ( AssetMessageType . GetNameRequest , GetNameRequestData . newBuilder ( ) . setUuid ( assetInfo . getUuid ( ) ) . build ( ) ) ; nameRequestMsg . writeDelimitedTo ( socket . getOutputStream ( ) ) ; AssetDirectoryServiceNamespace nameResponseMsg = ( AssetDirectoryServiceNamespace ) listener . waitForMessage ( Namespace . AssetDirectoryService , AssetMessageType . GetNameResponse , TIMEOUT ) ; GetNameResponseData nameResponse = GetNameResponseData . parseFrom ( nameResponseMsg . getData ( ) ) ; if ( nameResponse . getAssetName ( ) . equals ( assetName ) ) { return assetInfo ; } } } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } return null ; }
Get info for an asset of the given name.
Get info for an asset of the given name .
// found the UUID for the desired asset