JavaImageIOIdentify implements Identify { public ServiceDescription describe() { ServiceDescription.Builder mds = new ServiceDescription.Builder(NAME, Identify.class.getCanonicalName()); mds.description("A DigitalObject Identification Service based on the Java SE built-in ImageIO library."); mds.author("Andrew Jackson <Andrew.Jackson@bl.uk>"); mds.classname(this.getClass().getCanonicalName()); mds.version("1.0.1"); mds.tool(JavaImageIOIdentify.tool); String[] formatNames = ImageIO.getReaderFormatNames(); formatNames = unique(formatNames); formatNames = ImageIO.getWriterFormatNames(); formatNames = unique(formatNames); formatNames = ImageIO.getReaderMIMETypes(); formatNames = unique(formatNames); formatNames = ImageIO.getWriterMIMETypes(); formatNames = unique(formatNames); List<URI> ifs = new ArrayList<URI>(); for( String fmt_name : unique( ImageIO.getReaderFormatNames() ) ) { ifs.add( FormatRegistryFactory.getFormatRegistry().createExtensionUri( fmt_name ) ); } mds.inputFormats(ifs.toArray(new URI[]{})); return mds.build(); }  ServiceDescription describe(); IdentifyResult identify(DigitalObject dob, List<Parameter> parameters ); static String[] unique(String[] strings); static String sanitize( String format ); static final String NAME; }
@Test public void testDescribe() { ServiceDescription desc = ids.describe(); assertTrue("The ServiceDescription should not be NULL.", desc != null ); System.out.println("Recieved service description: " + desc.toXmlFormatted()); }