jcommon-1.0.12

16:37:19.840 INFO  jd.cli.Main - Decompiling jcommon-1.0.12.jar
package com.keypoint;

import java.awt.Image;
import java.awt.image.PixelGrabber;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.zip.CRC32;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;

public class PngEncoder
{
  public static final boolean ENCODE_ALPHA = true;
  public static final boolean NO_ALPHA = false;
  public static final int FILTER_NONE = 0;
  public static final int FILTER_SUB = 1;
  public static final int FILTER_UP = 2;
  public static final int FILTER_LAST = 2;
  protected static final byte[] IHDR = { 73, 72, 68, 82 };
  protected static final byte[] IDAT = { 73, 68, 65, 84 };
  protected static final byte[] IEND = { 73, 69, 78, 68 };
  protected static final byte[] PHYS = { 112, 72, 89, 115 };
  protected byte[] pngBytes;
  protected byte[] priorRow;
  protected byte[] leftBytes;
  protected Image image;
  protected int width;
  protected int height;
  protected int bytePos;
  protected int maxPos;
  protected CRC32 crc = new CRC32();
  protected long crcValue;
  protected boolean encodeAlpha;
  protected int filter;
  protected int bytesPerPixel;
  private int xDpi = 0;
  private int yDpi = 0;
  private static float INCH_IN_METER_UNIT = 0.0254F;
  protected int compressionLevel;
  
  public PngEncoder()
  {
    this(null, false, 0, 0);
  }
  
  public PngEncoder(Image image)
  {
    this(image, false, 0, 0);
  }
  
  public PngEncoder(Image image, boolean encodeAlpha)
  {
    this(image, encodeAlpha, 0, 0);
  }
  
  public PngEncoder(Image image, boolean encodeAlpha, int whichFilter)
  {
    this(image, encodeAlpha, whichFilter, 0);
  }
  
  public PngEncoder(Image image, boolean encodeAlpha, int whichFilter, int compLevel)
  {
    this.image = image;
    this.encodeAlpha = encodeAlpha;
    setFilter(whichFilter);
    if ((compLevel >= 0) && (compLevel <= 9)) {
      compressionLevel = compLevel;
    }
  }
  
  public void setImage(Image image)
  {
    this.image = image;
    pngBytes = null;
  }
  
  public Image getImage()
  {
    return image;
  }
  
  public byte[] pngEncode(boolean encodeAlpha)
  {
    byte[] pngIdBytes = { -119, 80, 78, 71, 13, 10, 26, 10 };
    if (image == null) {
      return null;
    }
    width = image.getWidth(null);
    height = image.getHeight(null);
    
    pngBytes = new byte[(width + 1) * height * 3 + 200];
    
    maxPos = 0;
    
    bytePos = writeBytes(pngIdBytes, 0);
    
    writeHeader();
    writeResolution();
    if (writeImageData())
    {
      writeEnd();
      pngBytes = resizeByteArray(pngBytes, maxPos);
    }
    else
    {
      pngBytes = null;
    }
    return pngBytes;
  }
  
  public byte[] pngEncode()
  {
    return pngEncode(encodeAlpha);
  }
  
  public void setEncodeAlpha(boolean encodeAlpha)
  {
    this.encodeAlpha = encodeAlpha;
  }
  
  public boolean getEncodeAlpha()
  {
    return encodeAlpha;
  }
  
  public void setFilter(int whichFilter)
  {
    filter = 0;
    if (whichFilter <= 2) {
      filter = whichFilter;
    }
  }
  
  public int getFilter()
  {
    return filter;
  }
  
  public void setCompressionLevel(int level)
  {
    if ((level >= 0) && (level <= 9)) {
      compressionLevel = level;
    }
  }
  
  public int getCompressionLevel()
  {
    return compressionLevel;
  }
  
  protected byte[] resizeByteArray(byte[] array, int newLength)
  {
    byte[] newArray = new byte[newLength];
    int oldLength = array.length;
    
    System.arraycopy(array, 0, newArray, 0, Math.min(oldLength, newLength));
    return newArray;
  }
  
  protected int writeBytes(byte[] data, int offset)
  {
    maxPos = Math.max(maxPos, offset + data.length);
    if (data.length + offset > pngBytes.length) {
      pngBytes = resizeByteArray(pngBytes, pngBytes.length + Math.max(1000, data.length));
    }
    System.arraycopy(data, 0, pngBytes, offset, data.length);
    return offset + data.length;
  }
  
  protected int writeBytes(byte[] data, int nBytes, int offset)
  {
    maxPos = Math.max(maxPos, offset + nBytes);
    if (nBytes + offset > pngBytes.length) {
      pngBytes = resizeByteArray(pngBytes, pngBytes.length + Math.max(1000, nBytes));
    }
    System.arraycopy(data, 0, pngBytes, offset, nBytes);
    return offset + nBytes;
  }
  
  protected int writeInt2(int n, int offset)
  {
    byte[] temp = { (byte)(n >> 8 & 0xFF), (byte)(n & 0xFF) };
    return writeBytes(temp, offset);
  }
  
  protected int writeInt4(int n, int offset)
  {
    byte[] temp = { (byte)(n >> 24 & 0xFF), (byte)(n >> 16 & 0xFF), (byte)(n >> 8 & 0xFF), (byte)(n & 0xFF) };
    
    return writeBytes(temp, offset);
  }
  
  protected int writeByte(int b, int offset)
  {
    byte[] temp = { (byte)b };
    return writeBytes(temp, offset);
  }
  
  protected void writeHeader()
  {
    int startPos = bytePos = writeInt4(13, bytePos);
    bytePos = writeBytes(IHDR, bytePos);
    width = image.getWidth(null);
    height = image.getHeight(null);
    bytePos = writeInt4(width, bytePos);
    bytePos = writeInt4(height, bytePos);
    bytePos = writeByte(8, bytePos);
    bytePos = writeByte(encodeAlpha ? 6 : 2, bytePos);
    
    bytePos = writeByte(0, bytePos);
    bytePos = writeByte(0, bytePos);
    bytePos = writeByte(0, bytePos);
    crc.reset();
    crc.update(pngBytes, startPos, bytePos - startPos);
    crcValue = crc.getValue();
    bytePos = writeInt4((int)crcValue, bytePos);
  }
  
  protected void filterSub(byte[] pixels, int startPos, int width)
  {
    int offset = bytesPerPixel;
    int actualStart = startPos + offset;
    int nBytes = width * bytesPerPixel;
    int leftInsert = offset;
    int leftExtract = 0;
    for (int i = actualStart; i < startPos + nBytes; i++)
    {
      leftBytes[leftInsert] = pixels[i];
      pixels[i] = ((byte)((pixels[i] - leftBytes[leftExtract]) % 256));
      
      leftInsert = (leftInsert + 1) % 15;
      leftExtract = (leftExtract + 1) % 15;
    }
  }
  
  protected void filterUp(byte[] pixels, int startPos, int width)
  {
    int nBytes = width * bytesPerPixel;
    for (int i = 0; i < nBytes; i++)
    {
      byte currentByte = pixels[(startPos + i)];
      pixels[(startPos + i)] = ((byte)((pixels[(startPos + i)] - priorRow[i]) % 256));
      
      priorRow[i] = currentByte;
    }
  }
  
  protected boolean writeImageData()
  {
    int rowsLeft = height;
    int startRow = 0;
    
    bytesPerPixel = (encodeAlpha ? 4 : 3);
    
    Deflater scrunch = new Deflater(compressionLevel);
    ByteArrayOutputStream outBytes = new ByteArrayOutputStream(1024);
    
    DeflaterOutputStream compBytes = new DeflaterOutputStream(outBytes, scrunch);
    try
    {
      while (rowsLeft > 0)
      {
        int nRows = Math.min(32767 / (width * (bytesPerPixel + 1)), rowsLeft);
        
        nRows = Math.max(nRows, 1);
        
        int[] pixels = new int[width * nRows];
        
        PixelGrabber pg = new PixelGrabber(image, 0, startRow, width, nRows, pixels, 0, width);
        try
        {
          pg.grabPixels();
        }
        catch (Exception e)
        {
          System.err.println("interrupted waiting for pixels!");
          return false;
        }
        if ((pg.getStatus() & 0x80) != 0)
        {
          System.err.println("image fetch aborted or errored");
          return false;
        }
        byte[] scanLines = new byte[width * nRows * bytesPerPixel + nRows];
        if (filter == 1) {
          leftBytes = new byte[16];
        }
        if (filter == 2) {
          priorRow = new byte[width * bytesPerPixel];
        }
        int scanPos = 0;
        int startPos = 1;
        for (int i = 0; i < width * nRows; i++)
        {
          if (i % width == 0)
          {
            scanLines[(scanPos++)] = ((byte)filter);
            startPos = scanPos;
          }
          scanLines[(scanPos++)] = ((byte)(pixels[i] >> 16 & 0xFF));
          scanLines[(scanPos++)] = ((byte)(pixels[i] >> 8 & 0xFF));
          scanLines[(scanPos++)] = ((byte)(pixels[i] & 0xFF));
          if (encodeAlpha) {
            scanLines[(scanPos++)] = ((byte)(pixels[i] >> 24 & 0xFF));
          }
          if ((i % width == width - 1) && (filter != 0))
          {
            if (filter == 1) {
              filterSub(scanLines, startPos, width);
            }
            if (filter == 2) {
              filterUp(scanLines, startPos, width);
            }
          }
        }
        compBytes.write(scanLines, 0, scanPos);
        
        startRow += nRows;
        rowsLeft -= nRows;
      }
      compBytes.close();
      
      byte[] compressedLines = outBytes.toByteArray();
      int nCompressed = compressedLines.length;
      
      crc.reset();
      bytePos = writeInt4(nCompressed, bytePos);
      bytePos = writeBytes(IDAT, bytePos);
      crc.update(IDAT);
      bytePos = writeBytes(compressedLines, nCompressed, bytePos);
      
      crc.update(compressedLines, 0, nCompressed);
      
      crcValue = crc.getValue();
      bytePos = writeInt4((int)crcValue, bytePos);
      scrunch.finish();
      return true;
    }
    catch (IOException e)
    {
      System.err.println(e.toString());
    }
    return false;
  }
  
  protected void writeEnd()
  {
    bytePos = writeInt4(0, bytePos);
    bytePos = writeBytes(IEND, bytePos);
    crc.reset();
    crc.update(IEND);
    crcValue = crc.getValue();
    bytePos = writeInt4((int)crcValue, bytePos);
  }
  
  public void setXDpi(int xDpi)
  {
    this.xDpi = Math.round(xDpi / INCH_IN_METER_UNIT);
  }
  
  public int getXDpi()
  {
    return Math.round(xDpi * INCH_IN_METER_UNIT);
  }
  
  public void setYDpi(int yDpi)
  {
    this.yDpi = Math.round(yDpi / INCH_IN_METER_UNIT);
  }
  
  public int getYDpi()
  {
    return Math.round(yDpi * INCH_IN_METER_UNIT);
  }
  
  public void setDpi(int xDpi, int yDpi)
  {
    this.xDpi = Math.round(xDpi / INCH_IN_METER_UNIT);
    this.yDpi = Math.round(yDpi / INCH_IN_METER_UNIT);
  }
  
  protected void writeResolution()
  {
    if ((xDpi > 0) && (yDpi > 0))
    {
      int startPos = bytePos = writeInt4(9, bytePos);
      bytePos = writeBytes(PHYS, bytePos);
      bytePos = writeInt4(xDpi, bytePos);
      bytePos = writeInt4(yDpi, bytePos);
      bytePos = writeByte(1, bytePos);
      
      crc.reset();
      crc.update(pngBytes, startPos, bytePos - startPos);
      crcValue = crc.getValue();
      bytePos = writeInt4((int)crcValue, bytePos);
    }
  }
}

/* Location:
 * Qualified Name:     com.keypoint.PngEncoder
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import org.jfree.base.config.HierarchicalConfiguration;
import org.jfree.base.config.PropertyFileConfiguration;
import org.jfree.base.config.SystemPropertyConfiguration;
import org.jfree.base.modules.PackageManager;
import org.jfree.base.modules.SubSystem;
import org.jfree.util.Configuration;
import org.jfree.util.ExtendedConfiguration;
import org.jfree.util.ExtendedConfigurationWrapper;
import org.jfree.util.Log;
import org.jfree.util.ObjectUtilities;

public abstract class AbstractBoot
  implements SubSystem
{
  private ExtendedConfigurationWrapper extWrapper;
  private PackageManager packageManager;
  private Configuration globalConfig;
  private boolean bootInProgress;
  private boolean bootDone;
  
  public synchronized PackageManager getPackageManager()
  {
    if (packageManager == null) {
      packageManager = PackageManager.createInstance(this);
    }
    return packageManager;
  }
  
  public synchronized Configuration getGlobalConfig()
  {
    if (globalConfig == null) {
      globalConfig = loadConfiguration();
    }
    return globalConfig;
  }
  
  public final synchronized boolean isBootInProgress()
  {
    return bootInProgress;
  }
  
  public final synchronized boolean isBootDone()
  {
    return bootDone;
  }
  
  protected abstract Configuration loadConfiguration();
  
  public final void start()
  {
    synchronized (this)
    {
      if (isBootDone()) {
        return;
      }
      while (isBootInProgress()) {
        try
        {
          wait();
        }
        catch (InterruptedException e) {}
      }
      if (isBootDone()) {
        return;
      }
      bootInProgress = true;
    }
    BootableProjectInfo info = getProjectInfo();
    if (info != null)
    {
      BootableProjectInfo[] childs = info.getDependencies();
      for (int i = 0; i < childs.length; i++)
      {
        AbstractBoot boot = loadBooter(childs[i].getBootClass());
        if (boot != null) {
          synchronized (boot)
          {
            boot.start();
            while (!boot.isBootDone()) {
              try
              {
                boot.wait();
              }
              catch (InterruptedException e) {}
            }
          }
        }
      }
    }
    performBoot();
    if (info != null) {
      Log.info(info.getName() + " " + info.getVersion() + " started.");
    } else {
      Log.info(getClass() + " started.");
    }
    synchronized (this)
    {
      bootInProgress = false;
      bootDone = true;
      notifyAll();
    }
  }
  
  protected abstract void performBoot();
  
  protected abstract BootableProjectInfo getProjectInfo();
  
  protected AbstractBoot loadBooter(String classname)
  {
    if (classname == null) {
      return null;
    }
    try
    {
      Class c = ObjectUtilities.getClassLoader(getClass()).loadClass(classname);
      
      Method m = c.getMethod("getInstance", (Class[])null);
      return (AbstractBoot)m.invoke(null, (Object[])null);
    }
    catch (Exception e)
    {
      Log.info("Unable to boot dependent class: " + classname);
    }
    return null;
  }
  
  protected Configuration createDefaultHierarchicalConfiguration(String staticConfig, String userConfig, boolean addSysProps)
  {
    return createDefaultHierarchicalConfiguration(staticConfig, userConfig, addSysProps, PropertyFileConfiguration.class);
  }
  
  protected Configuration createDefaultHierarchicalConfiguration(String staticConfig, String userConfig, boolean addSysProps, Class source)
  {
    HierarchicalConfiguration globalConfig = new HierarchicalConfiguration();
    if (staticConfig != null)
    {
      PropertyFileConfiguration rootProperty = new PropertyFileConfiguration();
      
      rootProperty.load(staticConfig, getClass());
      globalConfig.insertConfiguration(rootProperty);
      globalConfig.insertConfiguration(getPackageManager().getPackageConfiguration());
    }
    if (userConfig != null)
    {
      String userConfigStripped;
      String userConfigStripped;
      if (userConfig.startsWith("/")) {
        userConfigStripped = userConfig.substring(1);
      } else {
        userConfigStripped = userConfig;
      }
      try
      {
        Enumeration userConfigs = ObjectUtilities.getClassLoader(getClass()).getResources(userConfigStripped);
        
        ArrayList configs = new ArrayList();
        while (userConfigs.hasMoreElements())
        {
          URL url = (URL)userConfigs.nextElement();
          try
          {
            PropertyFileConfiguration baseProperty = new PropertyFileConfiguration();
            
            InputStream in = url.openStream();
            baseProperty.load(in);
            in.close();
            configs.add(baseProperty);
          }
          catch (IOException ioe)
          {
            Log.warn("Failed to load the user configuration at " + url, ioe);
          }
        }
        for (int i = configs.size() - 1; i >= 0; i--)
        {
          PropertyFileConfiguration baseProperty = (PropertyFileConfiguration)configs.get(i);
          
          globalConfig.insertConfiguration(baseProperty);
        }
      }
      catch (IOException e)
      {
        Log.warn("Failed to lookup the user configurations.", e);
      }
    }
    if (addSysProps)
    {
      SystemPropertyConfiguration systemConfig = new SystemPropertyConfiguration();
      
      globalConfig.insertConfiguration(systemConfig);
    }
    return globalConfig;
  }
  
  public synchronized ExtendedConfiguration getExtendedConfig()
  {
    if (extWrapper == null) {
      extWrapper = new ExtendedConfigurationWrapper(getGlobalConfig());
    }
    return extWrapper;
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.AbstractBoot
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import org.jfree.JCommon;
import org.jfree.base.config.ModifiableConfiguration;
import org.jfree.base.log.DefaultLogModule;
import org.jfree.base.modules.PackageManager;
import org.jfree.util.Configuration;
import org.jfree.util.ObjectUtilities;

public class BaseBoot
  extends AbstractBoot
{
  private static BaseBoot singleton;
  private BootableProjectInfo bootableProjectInfo;
  
  private BaseBoot()
  {
    bootableProjectInfo = JCommon.INFO;
  }
  
  public static ModifiableConfiguration getConfiguration()
  {
    return (ModifiableConfiguration)getInstance().getGlobalConfig();
  }
  
  protected synchronized Configuration loadConfiguration()
  {
    return createDefaultHierarchicalConfiguration("/org/jfree/base/jcommon.properties", "/jcommon.properties", true, BaseBoot.class);
  }
  
  public static synchronized AbstractBoot getInstance()
  {
    if (singleton == null) {
      singleton = new BaseBoot();
    }
    return singleton;
  }
  
  protected void performBoot()
  {
    ObjectUtilities.setClassLoaderSource(getConfiguration().getConfigProperty("org.jfree.ClassLoader"));
    
    getPackageManager().addModule(DefaultLogModule.class.getName());
    getPackageManager().load("org.jfree.jcommon.modules.");
    getPackageManager().initializeModules();
  }
  
  protected BootableProjectInfo getProjectInfo()
  {
    return bootableProjectInfo;
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.BaseBoot
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import java.lang.reflect.Method;
import org.jfree.util.ObjectUtilities;

class BasicProjectInfo$OptionalLibraryHolder
{
  private String libraryClass;
  private transient Library library;
  
  public BasicProjectInfo$OptionalLibraryHolder(String libraryClass)
  {
    if (libraryClass == null) {
      throw new NullPointerException("LibraryClass must not be null.");
    }
    this.libraryClass = libraryClass;
  }
  
  public BasicProjectInfo$OptionalLibraryHolder(Library library)
  {
    if (library == null) {
      throw new NullPointerException("Library must not be null.");
    }
    this.library = library;
    libraryClass = library.getClass().getName();
  }
  
  public String getLibraryClass()
  {
    return libraryClass;
  }
  
  public Library getLibrary()
  {
    if (library == null) {
      library = loadLibrary(libraryClass);
    }
    return library;
  }
  
  protected Library loadLibrary(String classname)
  {
    if (classname == null) {
      return null;
    }
    try
    {
      Class c = ObjectUtilities.getClassLoader(getClass()).loadClass(classname);
      try
      {
        Method m = c.getMethod("getInstance", (Class[])null);
        return (Library)m.invoke(null, (Object[])null);
      }
      catch (Exception e)
      {
        return (Library)c.newInstance();
      }
      return null;
    }
    catch (Exception e) {}
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.BasicProjectInfo.OptionalLibraryHolder
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.jfree.util.ObjectUtilities;

public class BasicProjectInfo
  extends Library
{
  private String copyright;
  private List libraries;
  private List optionalLibraries;
  
  private static class OptionalLibraryHolder
  {
    private String libraryClass;
    private transient Library library;
    
    public OptionalLibraryHolder(String libraryClass)
    {
      if (libraryClass == null) {
        throw new NullPointerException("LibraryClass must not be null.");
      }
      this.libraryClass = libraryClass;
    }
    
    public OptionalLibraryHolder(Library library)
    {
      if (library == null) {
        throw new NullPointerException("Library must not be null.");
      }
      this.library = library;
      libraryClass = library.getClass().getName();
    }
    
    public String getLibraryClass()
    {
      return libraryClass;
    }
    
    public Library getLibrary()
    {
      if (library == null) {
        library = loadLibrary(libraryClass);
      }
      return library;
    }
    
    protected Library loadLibrary(String classname)
    {
      if (classname == null) {
        return null;
      }
      try
      {
        Class c = ObjectUtilities.getClassLoader(getClass()).loadClass(classname);
        try
        {
          Method m = c.getMethod("getInstance", (Class[])null);
          return (Library)m.invoke(null, (Object[])null);
        }
        catch (Exception e)
        {
          return (Library)c.newInstance();
        }
        return null;
      }
      catch (Exception e) {}
    }
  }
  
  public BasicProjectInfo()
  {
    libraries = new ArrayList();
    optionalLibraries = new ArrayList();
  }
  
  public BasicProjectInfo(String name, String version, String licence, String info)
  {
    this();
    setName(name);
    setVersion(version);
    setLicenceName(licence);
    setInfo(info);
  }
  
  public BasicProjectInfo(String name, String version, String info, String copyright, String licenceName)
  {
    this(name, version, licenceName, info);
    setCopyright(copyright);
  }
  
  public String getCopyright()
  {
    return copyright;
  }
  
  public void setCopyright(String copyright)
  {
    this.copyright = copyright;
  }
  
  public void setInfo(String info)
  {
    super.setInfo(info);
  }
  
  public void setLicenceName(String licence)
  {
    super.setLicenceName(licence);
  }
  
  public void setName(String name)
  {
    super.setName(name);
  }
  
  public void setVersion(String version)
  {
    super.setVersion(version);
  }
  
  public Library[] getLibraries()
  {
    return (Library[])libraries.toArray(new Library[libraries.size()]);
  }
  
  public void addLibrary(Library library)
  {
    if (library == null) {
      throw new NullPointerException();
    }
    libraries.add(library);
  }
  
  public Library[] getOptionalLibraries()
  {
    ArrayList libraries = new ArrayList();
    for (int i = 0; i < optionalLibraries.size(); i++)
    {
      OptionalLibraryHolder holder = (OptionalLibraryHolder)optionalLibraries.get(i);
      
      Library l = holder.getLibrary();
      if (l != null) {
        libraries.add(l);
      }
    }
    return (Library[])libraries.toArray(new Library[libraries.size()]);
  }
  
  public void addOptionalLibrary(String libraryClass)
  {
    if (libraryClass == null) {
      throw new NullPointerException("Library classname must be given.");
    }
    optionalLibraries.add(new OptionalLibraryHolder(libraryClass));
  }
  
  public void addOptionalLibrary(Library library)
  {
    if (library == null) {
      throw new NullPointerException("Library must be given.");
    }
    optionalLibraries.add(new OptionalLibraryHolder(library));
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.BasicProjectInfo
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import java.util.ArrayList;

public class BootableProjectInfo
  extends BasicProjectInfo
{
  private String bootClass;
  private boolean autoBoot;
  
  public BootableProjectInfo()
  {
    autoBoot = true;
  }
  
  public BootableProjectInfo(String name, String version, String licence, String info)
  {
    this();
    setName(name);
    setVersion(version);
    setLicenceName(licence);
    setInfo(info);
  }
  
  public BootableProjectInfo(String name, String version, String info, String copyright, String licenceName)
  {
    this();
    setName(name);
    setVersion(version);
    setLicenceName(licenceName);
    setInfo(info);
    setCopyright(copyright);
  }
  
  public BootableProjectInfo[] getDependencies()
  {
    ArrayList dependencies = new ArrayList();
    Library[] libraries = getLibraries();
    for (int i = 0; i < libraries.length; i++)
    {
      Library lib = libraries[i];
      if ((lib instanceof BootableProjectInfo)) {
        dependencies.add(lib);
      }
    }
    Library[] optionalLibraries = getOptionalLibraries();
    for (int i = 0; i < optionalLibraries.length; i++)
    {
      Library lib = optionalLibraries[i];
      if ((lib instanceof BootableProjectInfo)) {
        dependencies.add(lib);
      }
    }
    return (BootableProjectInfo[])dependencies.toArray(new BootableProjectInfo[dependencies.size()]);
  }
  
  /**
   * @deprecated
   */
  public void addDependency(BootableProjectInfo projectInfo)
  {
    if (projectInfo == null) {
      throw new NullPointerException();
    }
    addLibrary(projectInfo);
  }
  
  public String getBootClass()
  {
    return bootClass;
  }
  
  public void setBootClass(String bootClass)
  {
    this.bootClass = bootClass;
  }
  
  public boolean isAutoBoot()
  {
    return autoBoot;
  }
  
  public void setAutoBoot(boolean autoBoot)
  {
    this.autoBoot = autoBoot;
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.BootableProjectInfo
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

import java.io.PrintStream;
import java.util.Enumeration;
import org.jfree.util.ObjectUtilities;

public class ClassPathDebugger
{
  public static void main(String[] args)
  {
    System.out.println("Listing the various classloaders:");
    System.out.println("Defined classloader source: " + ObjectUtilities.getClassLoaderSource());
    System.out.println("User classloader: " + ObjectUtilities.getClassLoader());
    System.out.println("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class));
    System.out.println("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class));
    System.out.println("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader());
    System.out.println("Defined System classloader: " + ClassLoader.getSystemClassLoader());
    System.out.println();
    try
    {
      System.out.println("Listing sources for '/jcommon.properties':");
      Enumeration resources = ObjectUtilities.getClassLoader(ObjectUtilities.class).getResources("jcommon.properties");
      while (resources.hasMoreElements()) {
        System.out.println(" " + resources.nextElement());
      }
      System.out.println();
      System.out.println("Listing sources for 'org/jfree/JCommonInfo.class':");
      resources = ObjectUtilities.getClassLoader(ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class");
      while (resources.hasMoreElements()) {
        System.out.println(" " + resources.nextElement());
      }
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.ClassPathDebugger
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.config;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.jfree.util.Configuration;
import org.jfree.util.PublicCloneable;

public class HierarchicalConfiguration
  implements ModifiableConfiguration, PublicCloneable
{
  private Properties configuration;
  private transient Configuration parentConfiguration;
  
  public HierarchicalConfiguration()
  {
    configuration = new Properties();
  }
  
  public HierarchicalConfiguration(Configuration parentConfiguration)
  {
    this();
    this.parentConfiguration = parentConfiguration;
  }
  
  public String getConfigProperty(String key)
  {
    return getConfigProperty(key, null);
  }
  
  public String getConfigProperty(String key, String defaultValue)
  {
    String value = configuration.getProperty(key);
    if (value == null) {
      if (isRootConfig()) {
        value = defaultValue;
      } else {
        value = parentConfiguration.getConfigProperty(key, defaultValue);
      }
    }
    return value;
  }
  
  public void setConfigProperty(String key, String value)
  {
    if (key == null) {
      throw new NullPointerException();
    }
    if (value == null) {
      configuration.remove(key);
    } else {
      configuration.setProperty(key, value);
    }
  }
  
  private boolean isRootConfig()
  {
    return parentConfiguration == null;
  }
  
  public boolean isLocallyDefined(String key)
  {
    return configuration.containsKey(key);
  }
  
  protected Properties getConfiguration()
  {
    return configuration;
  }
  
  public void insertConfiguration(HierarchicalConfiguration config)
  {
    config.setParentConfig(getParentConfig());
    setParentConfig(config);
  }
  
  protected void setParentConfig(Configuration config)
  {
    if (parentConfiguration == this) {
      throw new IllegalArgumentException("Cannot add myself as parent configuration.");
    }
    parentConfiguration = config;
  }
  
  protected Configuration getParentConfig()
  {
    return parentConfiguration;
  }
  
  public Enumeration getConfigProperties()
  {
    return configuration.keys();
  }
  
  public Iterator findPropertyKeys(String prefix)
  {
    TreeSet keys = new TreeSet();
    collectPropertyKeys(prefix, this, keys);
    return Collections.unmodifiableSet(keys).iterator();
  }
  
  private void collectPropertyKeys(String prefix, Configuration config, TreeSet collector)
  {
    Enumeration enum1 = config.getConfigProperties();
    while (enum1.hasMoreElements())
    {
      String key = (String)enum1.nextElement();
      if (key.startsWith(prefix)) {
        if (!collector.contains(key)) {
          collector.add(key);
        }
      }
    }
    if ((config instanceof HierarchicalConfiguration))
    {
      HierarchicalConfiguration hconfig = (HierarchicalConfiguration)config;
      if (parentConfiguration != null) {
        collectPropertyKeys(prefix, parentConfiguration, collector);
      }
    }
  }
  
  protected boolean isParentSaved()
  {
    return true;
  }
  
  protected void configurationLoaded() {}
  
  private void writeObject(ObjectOutputStream out)
    throws IOException
  {
    out.defaultWriteObject();
    if (!isParentSaved())
    {
      out.writeBoolean(false);
    }
    else
    {
      out.writeBoolean(true);
      out.writeObject(parentConfiguration);
    }
  }
  
  private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
  {
    in.defaultReadObject();
    boolean readParent = in.readBoolean();
    if (readParent) {
      parentConfiguration = ((ModifiableConfiguration)in.readObject());
    } else {
      parentConfiguration = null;
    }
    configurationLoaded();
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    HierarchicalConfiguration config = (HierarchicalConfiguration)super.clone();
    configuration = ((Properties)configuration.clone());
    return config;
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.config.HierarchicalConfiguration
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.config;

import java.util.Enumeration;
import java.util.Iterator;
import org.jfree.util.Configuration;

public abstract interface ModifiableConfiguration
  extends Configuration
{
  public abstract void setConfigProperty(String paramString1, String paramString2);
  
  public abstract Enumeration getConfigProperties();
  
  public abstract Iterator findPropertyKeys(String paramString);
}

/* Location:
 * Qualified Name:     org.jfree.base.config.ModifiableConfiguration
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.config;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.jfree.util.Log;
import org.jfree.util.ObjectUtilities;

public class PropertyFileConfiguration
  extends HierarchicalConfiguration
{
  public void load(String resourceName)
  {
    load(resourceName, PropertyFileConfiguration.class);
  }
  
  public void load(String resourceName, Class resourceSource)
  {
    InputStream in = ObjectUtilities.getResourceRelativeAsStream(resourceName, resourceSource);
    if (in != null) {
      try
      {
        load(in);
        try
        {
          in.close();
        }
        catch (IOException e) {}
        Log.debug("Configuration file not found in the classpath: " + resourceName);
      }
      finally
      {
        try
        {
          in.close();
        }
        catch (IOException e) {}
      }
    }
  }
  
  public void load(InputStream in)
  {
    if (in == null) {
      throw new NullPointerException();
    }
    try
    {
      BufferedInputStream bin = new BufferedInputStream(in);
      Properties p = new Properties();
      p.load(bin);
      getConfiguration().putAll(p);
      bin.close();
    }
    catch (IOException ioe)
    {
      Log.warn("Unable to read configuration", ioe);
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.config.PropertyFileConfiguration
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.config;

import java.util.Enumeration;
import java.util.Properties;
import java.util.Vector;

public class SystemPropertyConfiguration
  extends HierarchicalConfiguration
{
  public void setConfigProperty(String key, String value)
  {
    throw new UnsupportedOperationException("The SystemPropertyConfiguration is readOnly");
  }
  
  public String getConfigProperty(String key, String defaultValue)
  {
    try
    {
      String value = System.getProperty(key);
      if (value != null) {
        return value;
      }
    }
    catch (SecurityException se) {}
    return super.getConfigProperty(key, defaultValue);
  }
  
  public boolean isLocallyDefined(String key)
  {
    try
    {
      return System.getProperties().containsKey(key);
    }
    catch (SecurityException se) {}
    return false;
  }
  
  public Enumeration getConfigProperties()
  {
    try
    {
      return System.getProperties().keys();
    }
    catch (SecurityException se) {}
    return new Vector().elements();
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.config.SystemPropertyConfiguration
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base;

public class Library
{
  private String name;
  private String version;
  private String licenceName;
  private String info;
  
  public Library(String name, String version, String licence, String info)
  {
    this.name = name;
    this.version = version;
    licenceName = licence;
    this.info = info;
  }
  
  protected Library() {}
  
  public String getName()
  {
    return name;
  }
  
  public String getVersion()
  {
    return version;
  }
  
  public String getLicenceName()
  {
    return licenceName;
  }
  
  public String getInfo()
  {
    return info;
  }
  
  protected void setInfo(String info)
  {
    this.info = info;
  }
  
  protected void setLicenceName(String licenceName)
  {
    this.licenceName = licenceName;
  }
  
  protected void setName(String name)
  {
    this.name = name;
  }
  
  protected void setVersion(String version)
  {
    this.version = version;
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if ((o == null) || (getClass() != o.getClass())) {
      return false;
    }
    Library library = (Library)o;
    if (name != null ? !name.equals(name) : name != null) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return name != null ? name.hashCode() : 0;
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.Library
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.log;

import org.jfree.util.Log;
import org.jfree.util.LogTarget;
import org.jfree.util.PrintStreamLogTarget;

public class DefaultLog
  extends Log
{
  private static final PrintStreamLogTarget DEFAULT_LOG_TARGET = new PrintStreamLogTarget();
  private static final DefaultLog defaultLogInstance = new DefaultLog();
  
  static
  {
    defaultLogInstance.addTarget(DEFAULT_LOG_TARGET);
    try
    {
      String property = System.getProperty("org.jfree.DebugDefault", "false");
      if (Boolean.valueOf(property).booleanValue()) {
        defaultLogInstance.setDebuglevel(3);
      } else {
        defaultLogInstance.setDebuglevel(1);
      }
    }
    catch (SecurityException se)
    {
      defaultLogInstance.setDebuglevel(1);
    }
  }
  
  public void init()
  {
    removeTarget(DEFAULT_LOG_TARGET);
    String logLevel = LogConfiguration.getLogLevel();
    if (logLevel.equalsIgnoreCase("error")) {
      setDebuglevel(0);
    } else if (logLevel.equalsIgnoreCase("warn")) {
      setDebuglevel(1);
    } else if (logLevel.equalsIgnoreCase("info")) {
      setDebuglevel(2);
    } else if (logLevel.equalsIgnoreCase("debug")) {
      setDebuglevel(3);
    }
  }
  
  public synchronized void addTarget(LogTarget target)
  {
    super.addTarget(target);
    if (target != DEFAULT_LOG_TARGET) {
      removeTarget(DEFAULT_LOG_TARGET);
    }
  }
  
  public static DefaultLog getDefaultLog()
  {
    return defaultLogInstance;
  }
  
  public static void installDefaultLog()
  {
    Log.defineLog(defaultLogInstance);
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.log.DefaultLog
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.log;

import org.jfree.base.modules.AbstractModule;
import org.jfree.base.modules.ModuleInitializeException;
import org.jfree.base.modules.SubSystem;
import org.jfree.util.Configuration;
import org.jfree.util.Log;
import org.jfree.util.PrintStreamLogTarget;

public class DefaultLogModule
  extends AbstractModule
{
  public DefaultLogModule()
    throws ModuleInitializeException
  {
    loadModuleInfo();
  }
  
  public void initialize(SubSystem subSystem)
    throws ModuleInitializeException
  {
    if (LogConfiguration.isDisableLogging()) {
      return;
    }
    if (LogConfiguration.getLogTarget().equals(PrintStreamLogTarget.class.getName()))
    {
      DefaultLog.installDefaultLog();
      Log.getInstance().addTarget(new PrintStreamLogTarget());
      if ("true".equals(subSystem.getGlobalConfig().getConfigProperty("org.jfree.base.LogAutoInit"))) {
        Log.getInstance().init();
      }
      Log.info("Default log target started ... previous log messages could have been ignored.");
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.base.log.DefaultLogModule
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.base.log;

import org.jfree.base.AbstractBoot;
import org.jfree.base.BaseBoot;
import org.jfree.base.config.ModifiableConfiguration;
import org.jfree.util.Configuration;
import org.jfree.util.PrintStreamLogTarget;

public class LogConfiguration
{
  public static final String DISABLE_LOGGING_DEFAULT = "false";
  public static final String LOGLEVEL = "org.jfree.base.LogLevel";
  public static final String LOGLEVEL_DEFAULT = "Info";
  public static final String LOGTARGET = "org.jfree.base.LogTarget";
  public static final String LOGTARGET_DEFAULT = PrintStreamLogTarget.class.getName();
  public static final String DISABLE_LOGGING = "org.jfree.base.NoDefaultDebug";
  
  public static String getLogTarget()
  {
    return BaseBoot.getInstance().getGlobalConfig().getConfigProperty("org.jfree.base.LogTarget", LOGTA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd