Previous Topic: Finding a DSM ObjectNext Topic: Creating a Software Package Volume


Creating a Software Package

To deliver a software package, note the following UUIDs:

private String packageID = "";
private String volumeID = "";
private String procID = "";  //procedure ID

First, create the software package. In this example, all the input values have been taken from an external ‘cfg’ config object that was responsible for reading the values from a java properties file on application startup.

Example 5: The Steps for Creating a Software Package

protected int createSoftwarePackage() throws Exception
{
	try
	{
		//set up the properties that you are going to
		//create for the software package
		CreateSoftwarePackageProperties props =
		new CreateSoftwarePackageProperties();
		props.setSoftwarePackageName(cfg.getPackageName());
		props.setSoftwarePackageNameSupplied(true);
		props.setSoftwarePackageVersion(cfg.getPackageVersion());
		props.setSoftwarePackageVersionSupplied(true);
		props.setSupplier(cfg.getPackageVendor());
		props.setSupplierSupplied(true);
		props.setComment(cfg.getPackageComment());
		props.setCommentSupplied(true);
		//create the software package mask to indicate
		//whether a checksum is required
		SoftwarePackageMask mask = new SoftwarePackageMask();
		mask.setChecksum(cfg.getPackageCheckSum());
		props.setSoftwarePackageMask(mask);
		props.setSoftwarePackageMaskSupplied(true);
		//Create the software package (c)
		packageID =wsAPIconnector.createSoftwarePackage (getSessionId(), props);
		if(packageID.equals(""))
		{
			return UDSMWebService.PACKAGE_CREATION_ERROR;
		}
		System.out.println("Successfully created software package"+ "with ID 			"+packageID);
		//if the package was successfully created, carry on
		int retVal = 0;
		//create a software volume for this package
		retVal = createSimpleSoftwareVolume();
		if(retVal != UDSMWebService.RESULT_OK)
		return retVal;
		System.out.println("Successfully created software volume"+
		"with ID "+volumeID);
		//create a software procedure for this package
		retVal = createSimpleSoftwareProcedure();
		if(retVal != UDSMWebService.RESULT_OK)
		{
		return retVal;
		}
		System.out.println("Successfully created software procedure"+ "with ID               		"+procID);
		//seal the package now the volume and procedure are defined
		retVal = sealSoftwarePackage();
		if(retVal != UDSMWebService.RESULT_OK)
		return retVal;
		System.out.println("Successfully sealed complete software"+ "package ready for 		delivery.");
	}
	catch(Exception e)
	{
		throw e;
	}
	return UDSMWebService.RESULT_OK;
}