Para recuperar un activo del servidor, primero necesita un objeto com.ibm.ram.client.RAMAsset. Este objeto representa los metadatos de un activo. Desde este objeto, puede utilizar el método getContents() para obtener el activo como archivo RAS.
// Captar un activo por el GUID y la versión (con esto se obtienen los metadatos del activo)
RAMAsset asset = session.getAsset(new AssetIdentification("{AC0D54C1-E349-69EC-030F-E51CB557B0D7}", "7.1"));
Una vez que
tenga un activo, puede obtener obtener/establecer (get/set) propiedades a través de getters y setters. Por ejemplo: // Verificar los metadatos del activo
assertEquals("RAM Client API Javadoc", asset.getName());
assertEquals("Javadoc for the Rational Asset Manager Client API", asset.getDescription());
assertEquals("Documentation", asset.getAssetType().getName());
assertEquals("RAM Development", asset.getCommunity().getName());
assertEquals("Kevin Jones", asset.getOwners()[0].getName());
Para descargar
el activo como archivo RAS, utilice el método getContents(): // Descargar el contenido como un archivo .ras
ZipInputStream in = null;
File file = null;
FileOutputStream output = null;
byte[] buffer = new byte[100000];
try {
file = new File("D:\\temp\\newAsset.ras"); //$NON-NLS-1$
output = new FileOutputStream(file);
in = new ZipInputStream(asset.getContents());
int read;
int start = 0;
while ((read = in.read(buffer, start, buffer.length - start)) > -1) {
start += read;
if (start >= buffer.length) {
output.write(buffer);
start = 0;
}
}
if (start > 0)
output.write(buffer, 0, start);
} finally {
try {
if (in != null)
in.close();
} catch (IOException e) {
}
try {
if (output != null)
output.close();
} catch (IOException e) {
}
}