Java example: GetMetaData

This program shows how to query metadata for a database and print it to the console. In real applications, of course, you'd do something more constructive with the metadata object such as populate variable menus in a GUI.


Running the program

java -cp . GetMetaData -dv -nowin

Program source code

import java.lang.ArrayIndexOutOfBoundsException;
import llnl.visit.avtDatabaseMetaData;

public class GetMetaData extends RunViewer
{
    public GetMetaData()
    {
    }

    protected void work(String[] args)
    {
        // Try and open a database
        if(viewer.GetViewerMethods().RequestMetaData(viewer.GetDataPath() + "noise.silo",0))
        {
            avtDatabaseMetaData md = viewer.GetViewerState().GetDatabaseMetaData();
            System.out.print(md);  
        }
        else
            System.out.println("Could not get the metadata for the database!");
    }

    public static void main(String args[])
    {
        GetMetaData r = new GetMetaData();
        r.run(args);
    }
}