/*
 * @(#) SimpleRemoteImageServer.java 1.0 2000/10/4
 * Copyright (c) 2000 Larry Rodrigues
 */
package com.vistech.rmi;
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import javax.media.jai.*;
import com.sun.media.jai.codec.*;

/** A remote server application that loads
  * images by using the JAI "FileLoad" operator.
  * @version 1.0 12 june 2000
  * @author Lawrence Rodrigues
  **/
public class JAIImageServer extends
        SimpleImageServer implements JAIImageLoader{

   public JAIImageServer()throws java.rmi.RemoteException{}

   public synchronized RenderedOp loadJAIImage(String filename)throws java.rmi.RemoteException {
      try {
         return JAI.create("fileload", filename);
      } catch (Exception e) {
      return null;
      }
   }

   public static void main(String args[]){
      System.setSecurityManager(new RMISecurityManager());
      try {
        JAIImageServer fileserver = new JAIImageServer();
        System.out.println("JAI Image Server started");
        Naming.rebind("JAIImageServer", fileserver);
        System.out.println("JAI Image Server is running");
      }catch(Exception e){
        System.out.println("server1 exception " +e);
      }
   }
}
