The Diagnostic Tooling For Java image factory.
Details of how to get hold of and use the ImageFactory for this Kato implementation.
A readable description of this Kato implementation.
The name of the ImageFactory class.
An identifier used to refer to this factory.
A set of one or two files which the Image Factory can make a Kato image from.
A name for this pair of files.
The string is a org.eclipse.core.contenttype.contentTypes content-type ID. It describes the file which is the first or only parameter of ImageFactory.getImage(File f) or ImageFactory.getImage(File f1, File f2). See <a href="http://www.eclipse.org/eclipse/platform-core/documents/content_types.html">'A central content type catalog for Eclipse'</a> for more details.
The string is a org.eclipse.core.contenttype.contentTypes content-type ID. It describes the file which is the second parameter of ImageFactory.getImage(File f1, File f2). See <a href="http://www.eclipse.org/eclipse/platform-core/documents/content_types.html">'A central content type catalog for Eclipse'</a> for more details.
<code>
<pre>
String dumpfile, metaFile;
File file1 = new File(file);
File file2 = new File(metaFile);
FileInputStream is1 = null;
IContentType ct0;
try {
is1 = new FileInputStream(file1);
ct0 = Platform.getContentTypeManager().findContentTypeFor(is1, name);
} finally {
if (is1 != null) is1.close();
}
IExtensionPoint point = reg.getExtensionPoint("org.apache.kato.api","imagefactory");
if (point != null) {
for (IExtension ex : point.getExtensions()) {
for (IConfigurationElement el: ex.getConfigurationElements()) {
if (el.getName().equals("factory")) {
ImageFactory fact = (ImageFactory)el.createExecutableExtension("action");
for (IConfigurationElement el2 :el.getChildren()) {
if (el2.getName().equals("content-types")) {
String extId = el2.getAttribute("dump-type");
String metaId = el2.getAttribute("meta-type");
IContentType cext = Platform.getContentTypeManager().getContentType(extId);
IContentType cmeta = Platform.getContentTypeManager().getContentType(metaId);
if (ct0.isKindOf(cext) {
Image img = fact.getImage(dump);
}
}
}
}
}
}
}
</pre>
</code>
An example of a plug-in using this extension point is as follows:
<code>
<pre>
<plugin>
<extension
id="myKato1"
name="Sample Kato implementation"
point="org.apache.kato.api.api">
<factory
id="Sample Kato"
action="com.usercompany.user.MyKatoImageFactory"
label="Sample Kato from text files">
<content-types
dump-type="com.usercompany.file1"
meta-type="com.usercompany.file2"
name="Type 1">
</content-types>
</factory>
</extension>
<extension
id="myKato"
name="My company Kato types"
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="com.usercompany.base"
file-extensions="abc"
id="com.usercompany.file1"
name="My Kato binary">
<describer class="org.eclipse.core.runtime.content.BinarySignatureDescriber"
plugin="org.eclipse.core.runtime">
<parameter
name="signature"
value="12 34">
</parameter>
<parameter
name="required"
value="true">
</parameter>
</describer>
</content-type>
<content-type
base-type="com.usercompany.base.xml"
file-extensions="myxml"
id="com.usercompany.file2"
name="Meta data XML"
priority="high">
<describer
class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber"
plugin="org.eclipse.core.runtime">
<parameter
name="element"
value="myfirstelement">
</parameter>
</describer>
</content-type>
<content-type
alias-for="org.apache.kato.base"
base-type="org.eclipse.core.runtime.xml"
id="com.usercompany.base.xml"
name="Base xml">
</content-type>
<content-type
alias-for="org.apache.kato.base"
id="com.usercompany.base.xml"
name="Base dump">
</content-type>
</extension>
</plugin>
</pre>
</code>
Javadoc for Kato is available from the org.apache.kato.api plug-in. See <a href ="http://incubator.apache.org/kato/site/index.html">Using Kato</a> for help with using Kato.
<p>The action attribute must give the name of a class which implements the <code>org.apache.kato.ImageFactory</code> interface.
<p>A useful convention is to make all Kato content-types derived from a place holder type (or types) which is an alias-for <code>org.apache.kato.base</code>. That type is not declared by any implementation, so the content-types will be derived from the whatever the place holder type is itself derived from, for example <code>org.eclipse.core.runtime.xml</code>. If however an application wants to refer to all Kato files then the application can define the <code>org.apache.kato.base</code> type which will then replace the place holder type (or types) which have an alias-for <code>org.apache.kato.base</code>. All the Kato files will then be be a kind of <code>org.apache.kato.base</code>.
The API definition is in the org.apache.kato.api plug-in, supplied by Apache.
<p>
Different implementations of Kato are available as extra plug-ins.