Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.JAI


            System.setSecurityManager(new RMISecurityManager());
        }

  // Load all JAIServerConfigurationSpi implementations on the CLASSPATH
  Iterator spiIter = Service.providers(JAIServerConfigurationSpi.class);
  JAI jai = JAI.getDefaultInstance();

  while (spiIter.hasNext()) {

      JAIServerConfigurationSpi serverSpi =
    (JAIServerConfigurationSpi)spiIter.next();
      serverSpi.updateServer(jai);
  }

        // Set the host name and port number.
        String host = null;
  int rmiRegistryPort = 1099; // default port is 1099
  int serverport = 0;

  if (args.length != 0) {

      String value;

      for (int i=0; i<args.length; i++) {

    if (args[i].equalsIgnoreCase("-help")) {

        System.out.println("Usage: java -Djava.rmi.server.codebase=file:$JAI/lib/jai.jar \\");
        System.out.println("-Djava.rmi.server.useCodebaseOnly=false \\");
        System.out.println("-Djava.security.policy=file:`pwd`/policy \\");
        System.out.println("com.lightcrafts.media.jai.rmi.JAIRMIImageServer \\");
        System.out.println("\nwhere options are:");
        System.out.println("\t-host <string> The server name or server IP address");
        System.out.println("\t-port <integer> The port that rmiregistry is running on");
        System.out.println("\t-rmiRegistryPort <integer> Same as -port option");
        System.out.println("\t-serverPort <integer> The port that the server should listen on, for connections from clients");
        System.out.println("\t-cacheMemCapacity <long> The memory capacity in bytes.");
        System.out.println("\t-cacheMemThreshold <float> The memory threshold, which is the fractional amount of cache memory to retain during tile removal");
        System.out.println("\t-disableDefaultCache Disable use of default tile cache. Tiles are not stored.");
        System.out.println("\t-schedulerParallelism <integer> The degree of parallelism of the default TileScheduler");
        System.out.println("\t-schedulerPrefetchParallelism <integer> The degree of parallelism of the default TileScheduler for tile prefetching");
        System.out.println("\t-schedulerPriority <integer> The priority of tile scheduling for the default TileScheduler");
        System.out.println("\t-schedulerPrefetchPriority <integer> The priority of tile prefetch scheduling for the default TileScheduler");
        System.out.println("\t-defaultTileSize <integer>x<integer> The default tile dimensions in the form <xSize>x<ySize>");
        System.out.println("\t-defaultRenderingSize <integer>x<integer> The default size to render a RenderableImage to, in the form <xSize>x<ySize>");
        System.out.println("\t-serializeDeepCopy <boolean> Whether a deep copy of the image data should be used when serializing images");
        System.out.println("\t-tileCodecFormat <string> The default format to be used for tile serialization via TileCodecs");
        System.out.println("\t-retryInterval <integer> The retry interval value to be used for dealing with network errors during remote imaging");
        System.out.println("\t-numRetries <integer> The number of retries to be used for dealing with network errors during remote imaging");

    } else if (args[i].equalsIgnoreCase("-host")) {

        host = args[++i];

    } else if (args[i].equalsIgnoreCase("-port") ||
         args[i].equalsIgnoreCase("-rmiRegistryPort")) {

        rmiRegistryPort = Integer.parseInt(args[++i]);

    } else if (args[i].equalsIgnoreCase("-serverport")) {

        serverport = Integer.parseInt(args[++i]);

    } else if (args[i].equalsIgnoreCase("-cacheMemCapacity")) {

        jai.getTileCache().setMemoryCapacity(
              Long.parseLong(args[++i]));

    } else if (args[i].equalsIgnoreCase("-cacheMemThreshold")) {

        jai.getTileCache().setMemoryThreshold(
              Float.parseFloat(args[++i]));

    } else if (args[i].equalsIgnoreCase("-disableDefaultCache")) {

        jai.disableDefaultTileCache();

    } else if (args[i].equalsIgnoreCase("-schedulerParallelism")) {

        jai.getTileScheduler().setParallelism(
              Integer.parseInt(args[++i]));

    } else if (args[i].equalsIgnoreCase("-schedulerPrefetchParallelism")) {

        jai.getTileScheduler().setPrefetchParallelism(
              Integer.parseInt(args[++i]));

    } else if (args[i].equalsIgnoreCase("-schedulerPriority")) {

        jai.getTileScheduler().setPriority(
              Integer.parseInt(args[++i]));

    } else if (args[i].equalsIgnoreCase("-schedulerPrefetchPriority")) {

        jai.getTileScheduler().setPrefetchPriority(
              Integer.parseInt(args[++i]));

    } else if (args[i].equalsIgnoreCase("-defaultTileSize")) {

        value = args[++i].toLowerCase();
        int xpos = value.indexOf("x");
        int xSize = Integer.parseInt(value.substring(0, xpos));
        int ySize = Integer.parseInt(value.substring(xpos+1));

        jai.setDefaultTileSize(new Dimension(xSize, ySize));

    } else if (args[i].equalsIgnoreCase("-defaultRenderingSize")) {

        value = args[++i].toLowerCase();
        int xpos = value.indexOf("x");
        int xSize = Integer.parseInt(value.substring(0, xpos));
        int ySize = Integer.parseInt(value.substring(xpos+1));

        jai.setDefaultRenderingSize(new Dimension(xSize, ySize));

    } else if (args[i].equalsIgnoreCase("-serializeDeepCopy")) {

        jai.setRenderingHint(JAI.KEY_SERIALIZE_DEEP_COPY,
           Boolean.valueOf(args[++i]));

    } else if (args[i].equalsIgnoreCase("-tileCodecFormat")) {

        jai.setRenderingHint(JAI.KEY_TILE_CODEC_FORMAT, args[++i]);

    } else if (args[i].equalsIgnoreCase("-retryInterval")) {

        jai.setRenderingHint(JAI.KEY_RETRY_INTERVAL,
           Integer.valueOf(args[++i]));

    } else if (args[i].equalsIgnoreCase("-numRetries")) {

        jai.setRenderingHint(JAI.KEY_NUM_RETRIES,
           Integer.valueOf(args[++i]));
    }
      }
  }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.JAI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.