-
public interface ImageFactoryThis interface is used for classes which can produce instances of Image implementers.
Classes that implement this interface should provide a zero argument, public constructor so that they can be created using
e.g.Class.newInstance().Image image; try { Class<?> factoryClass = Class.forName("com.ibm.dtfj.image.j9.ImageFactory"); ImageFactory factory = (ImageFactory) factoryClass.newInstance(); image = factory.getImage(new File(coreFileName), new File(xmlFileName)); } catch (ClassNotFoundException e) { System.err.println("Could not find DTFJ factory class:"); e.printStackTrace(System.err); } catch (IllegalAccessException e) { System.err.println("Could not instantiate DTFJ factory class:"); e.printStackTrace(System.err); } catch (InstantiationException e) { System.err.println("Could not instantiate DTFJ factory class:"); e.printStackTrace(System.err); } catch (IOException e) { System.err.println("Could not find file required for bootstrapping:"); e.printStackTrace(System.err); }
-
-
Field Summary
Fields Modifier and Type Field Description static StringDTFJ_LOGGER_NAMEThis is the name of thejava.util.logging.Loggersubsystem to which DTFJ passes verbose messages.static intDTFJ_MAJOR_VERSIONThe major version number of the current API.static intDTFJ_MINOR_VERSIONThe minor version number of the current API.static StringSYSTEM_PROPERTY_TMPDIRIf the image is to be created from a core file inside an archive, this property controls where the file will extracted.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetDTFJMajorVersion()Fetch the DTFJ major version number.intgetDTFJMinorVersion()Fetch the DTFJ minor version number.intgetDTFJModificationLevel()Fetch the DTFJ modification level.ImagegetImage(File imageFile)Creates a newImageobject based on the contents ofimageFile.ImagegetImage(File imageFile, File metadata)Creates a newImageobject based on the contents ofimageFileandmetadata.ImagegetImage(ImageInputStream in, URI sourceID)Creates a newImageobject based on the contents of the given input stream.ImagegetImage(ImageInputStream in, ImageInputStream metadata, URI sourceID)Creates a newImageobject based on the contents of the given input stream.Image[]getImagesFromArchive(File archive, boolean extract)Creates an array ofImageobjects from an archive such as a zip or jar file.
-
-
-
Field Detail
-
DTFJ_MAJOR_VERSION
static final int DTFJ_MAJOR_VERSION
The major version number of the current API.- See Also:
- Constant Field Values
-
DTFJ_MINOR_VERSION
static final int DTFJ_MINOR_VERSION
The minor version number of the current API.- See Also:
- Constant Field Values
-
DTFJ_LOGGER_NAME
static final String DTFJ_LOGGER_NAME
This is the name of thejava.util.logging.Loggersubsystem to which DTFJ passes verbose messages.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_TMPDIR
static final String SYSTEM_PROPERTY_TMPDIR
If the image is to be created from a core file inside an archive, this property controls where the file will extracted. If this is not specified then the value of java.io.tmpdir will be used.- Since:
- 1.10
- See Also:
- Constant Field Values
-
-
Method Detail
-
getImage
Image getImage(File imageFile) throws IOException
Creates a newImageobject based on the contents ofimageFile.- Parameters:
imageFile- a file with Image information, typically a core file- Returns:
- an instance of Image
- Throws:
IOException- if there's a problem reading the specified fileNullPointerException- ifimageFileis null
-
getImage
Image getImage(ImageInputStream in, URI sourceID) throws IOException
Creates a newImageobject based on the contents of the given input stream.- Parameters:
in- a stream with image information, typically a core filesourceID-URIidentifying the source of the image stream- Returns:
- an instance of
Image - Throws:
IOException- if there's a problem reading the given streamUnsupportedOperationException- if the factory does not support this methodNullPointerException- if either ofinorsourceIDis null- Since:
- 1.10
-
getImage
Image getImage(ImageInputStream in, ImageInputStream metadata, URI sourceID) throws IOException
Creates a newImageobject based on the contents of the given input stream.- Parameters:
in- a stream with image information, typically a core filemetadata- a stream with metadata associated with the image streamsourceID-URIidentifying the source of the image stream- Returns:
- an instance of
Image - Throws:
IOException- if there's a problem reading the given streamsUnsupportedOperationException- if the factory does not support this methodNullPointerException- if any ofin,metadataorsourceIDis null- Since:
- 1.10
-
getImagesFromArchive
Image[] getImagesFromArchive(File archive, boolean extract) throws IOException
Creates an array ofImageobjects from an archive such as a zip or jar file.- Parameters:
archive- which typically contains one or more diagnostic artifactsextract- true if the files in the archive should be extracted to a temporary directory- Returns:
- an array of
Images - Throws:
IOException- if there's a problem reading the specified archiveUnsupportedOperationException- if the factory does not support this method- Since:
- 1.10
-
getImage
Image getImage(File imageFile, File metadata) throws IOException
Creates a newImageobject based on the contents ofimageFileandmetadata.- Parameters:
imageFile- a file with image information, typically a core filemetadata- an (implementation-defined) file with additional image information (or null if not required)- Returns:
- an instance of
Image - Throws:
IOException- if there's a problem reading either of the specified filesNullPointerException- ifimageFileis null
-
getDTFJMajorVersion
int getDTFJMajorVersion()
Fetch the DTFJ major version number.- Returns:
- an integer corresponding to the DTFJ API major version number
-
getDTFJMinorVersion
int getDTFJMinorVersion()
Fetch the DTFJ minor version number.- Returns:
- an integer corresponding to the DTFJ API minor version number
-
getDTFJModificationLevel
int getDTFJModificationLevel()
Fetch the DTFJ modification level.- Returns:
- an integer corresponding to the DTFJ API modification level
- Since:
- SDK 6.0 SR1 (DTFJ version 1.2)
-
-