// MiniDataServer.java import java.awt.event.*; import java.net.*; import java.rmi.*; import javax.swing.*; import visad.*; import visad.data.*; import visad.java2d.DisplayImplJ2D; /* This example creates a RemoteServer and loads a data object into it. Start it up by typing: java MiniDataServer ServerName DataName dataFile where ServerName is the desired name for the RMI server, DataName is the desired name for the data reference, and dataFile is the name of the data file to load up and serve. Be sure you start up rmiregistry before running MiniDataServer. Then, load up the SpreadSheet and try: rmi://ip.address/ServerName/DataName (where ip.address is your machine's IP address) and you should see the data in the SpreadSheet cell. */ public class MiniDataServer { public static void main(String[] args) throws Exception { if (args.length < 3) { System.err.println("Please specify three command line arguments:"); System.err.println(" - Server name (e.g., MyServer)"); System.err.println(" - Cell name (e.g., A1)"); System.err.println(" - Data file (e.g., mydata.nc)"); System.exit(-1); } String server = args[0]; String cell = args[1]; String file = args[2]; // load data System.out.println("Loading " + file + "..."); DefaultFamily loader = new DefaultFamily("loader"); Data data = loader.open(file); // set up display System.out.println("Setting up display..."); ScalarMap[] maps = data.getType().guessMaps(false); DisplayImplJ2D display = new DisplayImplJ2D("MiniDataServer"); for (int i=0; i