home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / edtplug / classes / netscape / plugin / composer / ImageEncoderFactory.java < prev    next >
Encoding:
Java Source  |  1998-04-08  |  3.0 KB  |  61 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. package netscape.plugin.composer;
  20. import java.util.*;
  21. import java.io.*;
  22.  
  23. /** Used to create image encoders at runtime. When the composer starts up, it examins
  24.  * each plugin file's netscape_plugin_composer.ini file to see if it defines the property
  25.  * "netscape.plugin.composer.ImageEncoderFactory".
  26.  * If it does, the value of that property is taken to be a classname of a class
  27.  * derived from ImageEncoderFactory. That class is instantiated, and it's getImageEncoders method
  28.  * is called. This method is responsible for creating and returning an enumerator of
  29.  * ImageEncoders.
  30.  *
  31.  * <p>Most developers don't need to use this class -- they can simply use the
  32.  * "netscape.plugin.composer.ImageEncoder.classes" property to name their
  33.  * ImageEncoder classes
  34.  * directly. However, the ImageEncoderFactory class provides additional flexability. Some
  35.  * possible uses of a ImageEncoderFactory class include:
  36.  * <ol><li>A wrapper for another application's image encoders. The wrapper would
  37.  * search the other application's data base, find the other application's image encoders,
  38.  * and synthasize ImageEncoder instances that wrapped the other application's
  39.  * image encoders.
  40.  * <li>A remote repository of image encoders that's searched at run time.
  41.  * </ol>
  42.  */
  43. public class ImageEncoderFactory {
  44.     /** If you have a default constructor, it must be public, or else you class cannot be
  45.      * instantiated by name. (And your class should be public, too.)
  46.      */
  47.     public ImageEncoderFactory() {}
  48.     /** Return an Enumeration of Plugins.
  49.      * By default, searches the properties for the property "netscape.plugin.composer.ImageEncoder.classes",
  50.      * and creates one instance of each of the plugins names in that string.
  51.      * @param pluginFile The plugin file that's being scanned.
  52.      * @param properties The properties of the plugin file that's being scanned.
  53.      * @return the ImageEncoders to add to the Composer.
  54.      *
  55.     */
  56.     public Enumeration getImageEncoders(File pluginFileName, Properties properties){
  57.         String classNames = properties.getProperty("netscape.plugin.composer.ImageEncoder.classes");
  58.         return PluginManager.instantiateClassList(classNames);
  59.     }
  60. }
  61.