Bruma

Description

Bruma (brume in Portuguese) is a library that allows the manipulation of Isis databases. It allows:

  • Database creation.
  • Database deletion.
  • To import a database from other data formats as ISO2709 and mx "ID' files.
  • To export a database to other data formats as ISO2709, mx 'ID' file, XML and JSON.
  • To copy a database from another Isis database.
  • To add new records.
  • To delete records.
  • To change the contents of an existing record.
  • To do some database statistics.

Characteristics

  • Easy to learn and use.
  • Database records, fields and subfields can be accessed via Iterable interface, easing the data manipulation without compromising the performance.
  • Only one file required (bruma.jar) which is less than 450 Kbytes.
  • Multiplataform - programed in Java language, it is compiled to bycodes that runs in Windows, Linux and Mac operational systems in 32 or 64 bits, "Big Endian" and "Little Endian" processors.
  • Does not require instalation - No instalation required - all the library is in only one jar file.
  • Automatic master type recognition - Recognizes the record type (Isis standard or extended - FFI) and the maximum master size - from 512 Mbytes until 512 Gigabytes.
  • Uses only dynamic areas - does not require to know the size of the size of the bigger record of a FFI type database.
  • Internal data representation using unicode.
  • Embeded graphical application - Lupa - requires only a double click on the library file.

Requirement

Java Virtual Machine version 1.5 or higher.

Download

source:Bruma/trunk/jar/Bruma.jar

Software documentation - API

source:Bruma/trunk/jar/javadoc

Examples

Exemple 1 - Copy an Isis database.

private static void usage() {
     System.err.println("usage: CopyMaster <dbfrom> <encoding> <dbto>");
     System.exit(1);
 }

 public static void main(final String[] args) throws ZeusException {
      if (args.length != 3) {
          usage();
      }

      final Master from = MasterFactory.getInstance(args[0])
                                       .setEncoding(args[1])
                                       .open();
      final Master to = MasterFactory.getInstance(args[2])
                                     .asAnotherMaster(from)
                                     .create();

      for (Record rec : from) {
          to.writeRecord(rec);
      }

      from.close();
      to.close();
  }

Example 2 - Dumping the database records.

private static void usage() {
       System.err.println("usage: DumpDb <dbname> [<encoding>]");
       System.exit(1);
   }

   public static void main(final String[] args) throws ZeusException {
        if (args.length < 1) {
            usage();
        }
        final String encoding = (args.length > 1) ? args[1]
                                                  : Master.DEFAULT_ENCODING;
        final Master mst = MasterFactory.getInstance(args[0])
                                        .setEncoding(encoding)
                                        .open();
        for (Record rec : mst) {
            if (rec.getStatus() == Record.Status.ACTIVE) {
                System.out.println(rec);
            }
        }

        mst.close();
    }

Exemplo 3 - Importing records from another Isis database or from an ISO2709 file or from a mx 'ID' format file.

private static void usage() {
        System.err.println(
          "usage: ImportMaster {isis|iso|id}=<filename> <encoding> <toDbname>");
        System.exit(1);
    }

    public static void main(final String[] args) throws ZeusException {
        if (args.length != 3) {
            usage();
        }

        AbstractRecordIterator iterator = null;

        if (args[0].startsWith("isis=")) {
            iterator = new IsisRecordIterator(args[0].substring(5), args[1]);
        } else if (args[0].startsWith("iso=")) {
            iterator = new ISO2709RecordIterator(args[0].substring(4), args[1]);
        } else if (args[0].startsWith("id=")) {
            iterator = new IdFileRecordIterator(
                                       new File(args[0].substring(3)), args[1]);
        } else {
            usage();
        }

        final Master to = MasterFactory.getInstance(args[2])
                                       .setEncoding(args[1])
                                       .create();

        for (Record rec : iterator) {
            to.writeRecord(rec);
        }

        iterator.close();
    }