If the call to createSoftwarePackage was successful, you can see that the code continues. Create one or more software package volumes associated with your new package. This requires you to copy file elements into the volume for each file or directory that the volume should contain. When you create your volume, associate it with the package ID that you recently created.
Example 6: Creating a simple SoftwarePackageVolume
//This method creates a simple software volume containing one file
private int createSimpleSoftwareVolume() throws Exception
{
CreateSoftwarePackageVolumeProperties props =
new CreateSoftwarePackageVolumeProperties();
//set all the properties to create a software volume
props.setVolumeName(cfg.getVolumeName());
props.setVolumeNameSupplied(true);
//the source is on the local hard disk
props.setVolumeType(SourceMedium.HARDDISK);
props.setVolumeTypeSupplied(true);
props.setSoftwarePackageId(packageID);
props.setSoftwarePackageIdSupplied(true);
//create the software volume
String volID = wsAPIconnector.createSoftwarePackageVolume (getSessionId(), props);
if(volID.equals(""))
return UDSMWebService.PACKAGE_CREATION_ERROR;
//assign the return value
volumeID = volID;
// now add some elements to the volume
ArrayOfFileSystemElementPath array =
new ArrayOfFileSystemElementPath();
FileSystemElementPath path[] = new FileSystemElementPath[1];
path[0] = new FileSystemElementPath();
path[0].setElementName(cfg.getVolumeElementName());
path[0].setElementPath(cfg.getVolumeElementPath());
array.setFileSystemElementPath(path);
Integer retVal = wsAPIconnector.copyElementsToSoftwarePackageVolume (getSessionId(), volumeID, "", array);
if(retVal.intValue() != 0)
return UDSMWebService.ELEMENT_ADDITION_ERROR;
else
return UDSMWebService.RESULT_OK;
}
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|