Rational Developer for Power Systems Software
V8.0

com.ibm.etools.iseries.projects.resources
Class ObjectArchiveResource

java.lang.Object
  extended by com.ibm.etools.iseries.projects.resources.ObjectArchiveResource

public class ObjectArchiveResource
extends Object

This class represents object archive which contains a save file and xml manifest file


Constructor Summary
ObjectArchiveResource(IResource resource)
          Constructor to be used when restoring a binary object from object archive.
ObjectArchiveResource(String objLibrary, String objName, String objType, String objSubtype, String oarName)
          Constructor to be used when creating an object archive from binary object.
 
Method Summary
 String getObjLibrary()
           
 String getObjName()
           
 String getObjType()
           
 File packObjectArchiveFile(File srcFile, String filePath)
          Creates an archive file (OAR file) in the directory specified by the filePath, using the attributes specified on the constructor.
 void readArchiveManifest(File manifest)
          Reads the archive manifest in the argument into the state variables of this object.
 File unpackObjectArchiveFile(String destPath)
          Unpacks the OAR file into a folder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectArchiveResource

public ObjectArchiveResource(String objLibrary,
                             String objName,
                             String objType,
                             String objSubtype,
                             String oarName)
Constructor to be used when creating an object archive from binary object.

Parameters:
objLibrary - Original library name of the binary object inside the save file
objName - Original name of the binary object inside the save file
objType - Original type of the binary object inside the save file
objSubtype - Original subtype of the binary object inside the save file
oarName - Name of the object archive to be created

ObjectArchiveResource

public ObjectArchiveResource(IResource resource)
Constructor to be used when restoring a binary object from object archive.

Parameters:
resource - Object archive file inside an i project.
Method Detail

packObjectArchiveFile

public File packObjectArchiveFile(File srcFile,
                                  String filePath)
Creates an archive file (OAR file) in the directory specified by the filePath, using the attributes specified on the constructor. The srcFile argument is considered to be a temporary file and will be deleted by this method.

Parameters:
srcFile - The file on the file system that is the local copy of a save file. This will be packed into the OAR file along with a manifest. This file is then deleted from the file system.
filePath - the directory that will contain the OAR file consisting of the save file and the manifest file.
Returns:
the file handle to the created OAR file.

unpackObjectArchiveFile

public File unpackObjectArchiveFile(String destPath)
Unpacks the OAR file into a folder. If the folder does not exist, it will be created. Assumes the constructor specifying the resource was specified. Also reads the manifest and sets the properties of the original resource. These are then retrievable with the various get methods.

Parameters:
destPath - the directory in which to unpack the OAR file. This is a native file system path pointing to a folder.
Returns:
the File object pointing to the save file of the unpacked OAR or null if the OAR could not be unpacked.

readArchiveManifest

public void readArchiveManifest(File manifest)
Reads the archive manifest in the argument into the state variables of this object.

Parameters:
manifest - the File object referencing the manifest.

getObjLibrary

public String getObjLibrary()
Returns:
Library name of the object inside the archive file. This is the original library of the object. It may be necessary to use this on restore.

getObjName

public String getObjName()
Returns:
Name of the object inside the archive file. This is the original name of the object. It may be necessary to use this on restore to rename the object when it is restored.

getObjType

public String getObjType()
Returns:
Type of the object inside the archive file.

Rational Developer for Power Systems Software
V8.0

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.