Wenn der Aufruf "createSoftwarePackage" erfolgreich war, können Sie sehen, dass der Code fortgesetzt wird. Erstellen Sie mindestens ein Softwarepaket-Volume, das mit Ihrem neuen Paket verknüpft ist. Hierfür kopieren Sie für alle Dateien bzw. Verzeichnisse, die das Volume enthalten soll, Dateielemente in das Volume. Ordnen Sie das Volume bei der Erstellung der zuvor erstellten Paket-ID zu.
Beispiel 6: Erstellen eines einfachen SoftwarePackageVolume
//Diese Methode erstellt ein einfaches Softwarevolume, das eine Datei enthält.
private int createSimpleSoftwareVolume() throws Exception
{
CreateSoftwarePackageVolumeProperties props =
new CreateSoftwarePackageVolumeProperties();
///Festlegen aller Eigenschaften zum Erstellen eines Softwarevolumes.
props.setVolumeName(cfg.getVolumeName());
props.setVolumeNameSupplied(true);
//Die Quelle befindet sich auf der lokalen Festplatte.
props.setVolumeType(SourceMedium.HARDDISK);
props.setVolumeTypeSupplied(true);
props.setSoftwarePackageId(packageID);
props.setSoftwarePackageIdSupplied(true);
//Erstellen des Softwarevolumes.
String volID = wsAPIconnector.createSoftwarePackageVolume (getSessionId(), props);
if(volID.equals(""))
return UDSMWebService.PACKAGE_CREATION_ERROR;
//Den Rückgabewert zuweisen.
volumeID = volID;
// Jetzt einige Elemente zum Volume hinzufügen.
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.
Alle Rechte vorbehalten.
|
|