derbytools

16:35:18.043 INFO  jd.cli.Main - Decompiling derbytools.jar
package org.apache.derby.iapi.reference;

public abstract interface Attribute
{
  public static final String PROTOCOL = "jdbc:derby:";
  public static final String SQLJ_NESTED = "jdbc:default:connection";
  public static final String DNC_PROTOCOL = "jdbc:derby://";
  public static final String JCC_PROTOCOL = "jdbc:derby:net:";
  public static final String DATA_ENCRYPTION = "dataEncryption";
  public static final String BOOT_PASSWORD = "bootPassword";
  public static final String NEW_BOOT_PASSWORD = "newBootPassword";
  public static final String REPLICATION_START_MASTER = "startMaster";
  public static final String REPLICATION_STOP_MASTER = "stopMaster";
  public static final String REPLICATION_START_SLAVE = "startSlave";
  public static final String REPLICATION_STOP_SLAVE = "stopSlave";
  public static final String REPLICATION_INTERNAL_SHUTDOWN_SLAVE = "internal_stopslave";
  public static final String REPLICATION_SLAVE_HOST = "slaveHost";
  public static final String REPLICATION_FAILOVER = "failover";
  public static final String REPLICATION_SLAVE_PORT = "slavePort";
  public static final String DBNAME_ATTR = "databaseName";
  public static final String SHUTDOWN_ATTR = "shutdown";
  public static final String DEREGISTER_ATTR = "deregister";
  public static final String CREATE_ATTR = "create";
  public static final String DROP_ATTR = "drop";
  public static final String USERNAME_ATTR = "user";
  public static final String PASSWORD_ATTR = "password";
  public static final String DRDAID_ATTR = "drdaID";
  public static final String UPGRADE_ATTR = "upgrade";
  public static final String LOG_DEVICE = "logDevice";
  public static final String TERRITORY = "territory";
  public static final String CRYPTO_PROVIDER = "encryptionProvider";
  public static final String CRYPTO_ALGORITHM = "encryptionAlgorithm";
  public static final String CRYPTO_KEY_LENGTH = "encryptionKeyLength";
  public static final String CRYPTO_EXTERNAL_KEY = "encryptionKey";
  public static final String NEW_CRYPTO_EXTERNAL_KEY = "newEncryptionKey";
  public static final String CRYPTO_EXTERNAL_KEY_VERIFY_FILE = "verifyKey.dat";
  public static final String CREATE_FROM = "createFrom";
  public static final String RESTORE_FROM = "restoreFrom";
  public static final String ROLL_FORWARD_RECOVERY_FROM = "rollForwardRecoveryFrom";
  public static final String CLIENT_SECURITY_MECHANISM = "securityMechanism";
  public static final String DRDA_SECTKN_IN = "drdaSecTokenIn";
  public static final String DRDA_SECTKN_OUT = "drdaSecTokenOut";
  public static final String DRDA_SECMEC = "drdaSecMec";
  public static final String SOFT_UPGRADE_NO_FEATURE_CHECK = "softUpgradeNoFeatureCheck";
  public static final String COLLATION = "collation";
}

/* Location:
 * Qualified Name:     org.apache.derby.iapi.reference.Attribute
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.iapi.services.info;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;

public final class ProductVersionHolder
  implements PrivilegedAction
{
  private static final int BAD_NUMBER = -1;
  private static final String ALPHA = "alpha";
  private static final String BETA = "beta";
  public static final int MAINT_ENCODING = 1000000;
  private String productVendorName;
  private String productName;
  private String productTechnologyName;
  private int majorVersion = -1;
  private int minorVersion = -1;
  private int maintVersion = -1;
  private int drdaMaintVersion = -1;
  private String buildNumber = "????";
  private Boolean isBeta;
  private String productGenus;
  
  private ProductVersionHolder() {}
  
  private ProductVersionHolder(String paramString1, String paramString2, String paramString3, int paramInt1, int paramInt2, int paramInt3, int paramInt4, String paramString4, Boolean paramBoolean)
  {
    if (paramString1 != null) {
      productVendorName = paramString1.trim();
    }
    if (paramString2 != null) {
      productName = paramString2.trim();
    }
    if (paramString3 != null) {
      productTechnologyName = paramString3.trim();
    }
    majorVersion = paramInt1;
    minorVersion = paramInt2;
    maintVersion = paramInt3;
    drdaMaintVersion = paramInt4;
    buildNumber = paramString4;
    isBeta = paramBoolean;
  }
  
  public static ProductVersionHolder getProductVersionHolder(String paramString1, String paramString2, String paramString3, int paramInt1, int paramInt2, int paramInt3, int paramInt4, String paramString4, Boolean paramBoolean)
  {
    ProductVersionHolder localProductVersionHolder = new ProductVersionHolder(paramString1, paramString2, paramString3, paramInt1, paramInt2, paramInt3, paramInt4, paramString4, paramBoolean);
    return localProductVersionHolder;
  }
  
  public static ProductVersionHolder getProductVersionHolderFromMyEnv(String paramString)
  {
    ProductVersionHolder localProductVersionHolder = new ProductVersionHolder();
    productGenus = paramString;
    Properties localProperties = (Properties)AccessController.doPrivileged(localProductVersionHolder);
    if (localProperties == null) {
      return null;
    }
    return getProductVersionHolder(localProperties);
  }
  
  public static ProductVersionHolder getProductVersionHolderFromMyEnv(InputStream paramInputStream)
  {
    if (paramInputStream == null) {
      return null;
    }
    localProperties = new Properties();
    try
    {
      localProperties.load(paramInputStream);
      ProductVersionHolder localProductVersionHolder;
      return getProductVersionHolder(localProperties);
    }
    catch (IOException localIOException2)
    {
      System.out.println("IOE " + localIOException2.getMessage());
      localProductVersionHolder = null;
      return localProductVersionHolder;
    }
    finally
    {
      try
      {
        paramInputStream.close();
      }
      catch (IOException localIOException4) {}
    }
  }
  
  public static ProductVersionHolder getProductVersionHolder(Properties paramProperties)
  {
    String str1 = paramProperties.getProperty("derby.product.vendor");
    String str2 = paramProperties.getProperty("derby.product.external.name");
    String str3 = paramProperties.getProperty("derby.product.technology.name");
    int i = parseInt(paramProperties.getProperty("derby.version.major"));
    int j = parseInt(paramProperties.getProperty("derby.version.minor"));
    int k = parseInt(paramProperties.getProperty("derby.version.maint"));
    int m = parseInt(paramProperties.getProperty("derby.version.drdamaint"));
    String str4 = paramProperties.getProperty("derby.build.number");
    Boolean localBoolean = Boolean.valueOf(paramProperties.getProperty("derby.version.beta"));
    return getProductVersionHolder(str1, str2, str3, i, j, k, m, str4, localBoolean);
  }
  
  public String getProductVendorName()
  {
    return productVendorName;
  }
  
  public String getProductName()
  {
    return productName;
  }
  
  public String getProductTechnologyName()
  {
    return productTechnologyName;
  }
  
  public int getMajorVersion()
  {
    return majorVersion;
  }
  
  public int getMinorVersion()
  {
    return minorVersion;
  }
  
  public int getMaintVersion()
  {
    return maintVersion;
  }
  
  public int getDrdaMaintVersion()
  {
    return drdaMaintVersion;
  }
  
  public int getFixPackVersion()
  {
    return maintVersion / 1000000;
  }
  
  public boolean isBeta()
  {
    return isBeta.booleanValue();
  }
  
  public boolean isAlpha()
  {
    return (majorVersion >= 5) && (minorVersion > 2) && (maintVersion / 1000000 == 0);
  }
  
  public String getBuildNumber()
  {
    return buildNumber;
  }
  
  public int getBuildNumberAsInt()
  {
    if (buildNumber == null) {
      return -1;
    }
    int i = 0;
    int j = buildNumber.indexOf('M');
    if (j == -1) {
      j = buildNumber.indexOf(':');
    } else {
      i = 1;
    }
    if (j == -1) {
      j = buildNumber.length();
    } else {
      i = 1;
    }
    try
    {
      int k = Integer.parseInt(buildNumber.substring(0, j));
      if (i != 0) {
        k = -k;
      }
      return k;
    }
    catch (NumberFormatException localNumberFormatException) {}
    return -1;
  }
  
  private static int parseInt(String paramString)
  {
    int i = -1;
    try
    {
      if (paramString != null) {
        i = Integer.parseInt(paramString);
      }
    }
    catch (NumberFormatException localNumberFormatException) {}
    if (i < 0) {
      i = -1;
    }
    return i;
  }
  
  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append(getProductVendorName());
    localStringBuffer.append(" - ");
    localStringBuffer.append(getProductName());
    localStringBuffer.append(" - ");
    localStringBuffer.append(getVersionBuildString(true));
    return localStringBuffer.toString();
  }
  
  public String getSimpleVersionString()
  {
    return simpleVersionString(majorVersion, minorVersion, isBeta());
  }
  
  public static String simpleVersionString(int paramInt1, int paramInt2, boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append(paramInt1);
    localStringBuffer.append('.');
    localStringBuffer.append(paramInt2);
    if (paramBoolean)
    {
      localStringBuffer.append(' ');
      localStringBuffer.append("beta");
    }
    return localStringBuffer.toString();
  }
  
  public static String fullVersionString(int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean, String paramString)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append(paramInt1);
    localStringBuffer.append('.');
    localStringBuffer.append(paramInt2);
    localStringBuffer.append('.');
    String str = null;
    if ((paramInt1 == 5) && (paramInt2 <= 2) && (paramInt3 < 1000000))
    {
      localStringBuffer.append(paramInt3);
      if (paramBoolean) {
        str = "beta";
      }
    }
    else
    {
      int i = paramInt3 / 1000000;
      int j = paramInt3 % 1000000;
      localStringBuffer.append(i);
      localStringBuffer.append('.');
      localStringBuffer.append(j);
      if (i == 0) {
        str = "alpha";
      } else if (paramBoolean) {
        str = "beta";
      }
    }
    if (str != null)
    {
      localStringBuffer.append(' ');
      localStringBuffer.append(str);
    }
    if (paramString != null)
    {
      localStringBuffer.append(" - (");
      localStringBuffer.append(paramString);
      localStringBuffer.append(')');
    }
    return localStringBuffer.toString();
  }
  
  public String getVersionBuildString(boolean paramBoolean)
  {
    return fullVersionString(majorVersion, minorVersion, maintVersion, isBeta(), paramBoolean ? buildNumber : null);
  }
  
  public final Object run()
  {
    return loadProperties(productGenus);
  }
  
  private Properties loadProperties(String paramString)
  {
    String str = "/org/apache/derby/info/" + paramString + ".properties";
    InputStream localInputStream = getClass().getResourceAsStream(str);
    if (localInputStream == null) {
      return null;
    }
    Properties localProperties = new Properties();
    try
    {
      localProperties.load(localInputStream);
      return localProperties;
    }
    catch (IOException localIOException) {}
    return null;
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.iapi.services.info.ProductVersionHolder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.iapi.tools.i18n;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

public class LocalizedInput
  extends BufferedReader
{
  private InputStream in;
  
  public LocalizedInput(InputStream paramInputStream)
  {
    super(new InputStreamReader(paramInputStream));
    in = paramInputStream;
  }
  
  LocalizedInput(InputStream paramInputStream, String paramString)
    throws UnsupportedEncodingException
  {
    super(new InputStreamReader(paramInputStream, paramString));
    in = paramInputStream;
  }
  
  public boolean isStandardInput()
  {
    return in == System.in;
  }
  
  public void close()
    throws IOException
  {
    if (!isStandardInput()) {
      super.close();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.iapi.tools.i18n.LocalizedInput
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.iapi.tools.i18n;

import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class LocalizedOutput
  extends PrintWriter
{
  private OutputStream out;
  
  public LocalizedOutput(OutputStream paramOutputStream)
  {
    super(new OutputStreamWriter(paramOutputStream), true);
    out = paramOutputStream;
  }
  
  LocalizedOutput(OutputStream paramOutputStream, String paramString)
    throws UnsupportedEncodingException
  {
    super(new OutputStreamWriter(paramOutputStream, paramString), true);
    out = paramOutputStream;
  }
  
  public boolean isStandardOutput()
  {
    return out == System.out;
  }
  
  public void close()
  {
    if (!isStandardOutput()) {
      super.close();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.iapi.tools.i18n.LocalizedOutput
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.iapi.tools.i18n;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.FieldPosition;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.StringTokenizer;

public final class LocalizedResource
  implements PrivilegedAction
{
  private static final boolean SUPPORTS_BIG_DECIMAL_CALLS;
  private ResourceBundle res;
  private Locale locale;
  private String encode;
  private static final String MESSAGE_FILE = "org.apache.derby.loc.toolsmessages";
  private static final String ENV_CODESET = "derby.ui.codeset";
  private static final String ENV_LOCALE = "derby.ui.locale";
  private String messageFileName;
  private String resourceKey;
  private LocalizedOutput out;
  private LocalizedInput in;
  private boolean enableLocalized;
  private boolean unicodeEscape;
  private static LocalizedResource local;
  private int dateSize;
  private int timeSize;
  private int timestampSize;
  private DateFormat formatDate;
  private DateFormat formatTime;
  private DateFormat formatTimestamp;
  private NumberFormat formatNumber;
  private DecimalFormat formatDecimal;
  
  public LocalizedResource()
  {
    init();
  }
  
  public LocalizedResource(String paramString1, String paramString2, String paramString3)
  {
    init(paramString1, paramString2, paramString3);
  }
  
  public static LocalizedResource getInstance()
  {
    if (local == null) {
      local = new LocalizedResource();
    }
    return local;
  }
  
  public static void resetLocalizedResourceCache()
  {
    local = null;
  }
  
  public void init()
  {
    init(null, null, null);
  }
  
  public void init(String paramString1, String paramString2, String paramString3)
  {
    if (paramString1 != null) {
      encode = paramString1;
    }
    String str;
    if (encode == null)
    {
      str = getEnvProperty("derby.ui.codeset");
      if (str != null) {
        encode = str;
      }
    }
    locale = getNewLocale(paramString2);
    if (locale == null)
    {
      str = getEnvProperty("derby.ui.locale");
      locale = getNewLocale(str);
    }
    if (locale == null) {
      locale = Locale.getDefault();
    }
    if (paramString3 != null) {
      messageFileName = paramString3;
    } else {
      messageFileName = "org.apache.derby.loc.toolsmessages";
    }
    out = getNewOutput(System.out);
    in = getNewInput(System.in);
    if ((enableLocalized) && (locale != null))
    {
      formatDecimal = ((DecimalFormat)DecimalFormat.getInstance(locale));
      formatNumber = NumberFormat.getInstance(locale);
      formatDate = DateFormat.getDateInstance(1, locale);
      formatTime = DateFormat.getTimeInstance(1, locale);
      formatTimestamp = DateFormat.getDateTimeInstance(1, 1, locale);
    }
    else
    {
      formatDecimal = ((DecimalFormat)DecimalFormat.getInstance());
      formatNumber = NumberFormat.getInstance();
      formatDate = DateFormat.getDateInstance(1);
      formatTime = DateFormat.getTimeInstance(1);
      formatTimestamp = DateFormat.getDateTimeInstance(1, 1);
    }
    initMaxSizes2();
  }
  
  private void setResource()
  {
    if (res != null) {
      return;
    }
    if ((locale == null) || (locale.toString().equals("none"))) {
      res = ResourceBundle.getBundle(messageFileName);
    } else {
      try
      {
        res = ResourceBundle.getBundle(messageFileName, locale);
      }
      catch (MissingResourceException localMissingResourceException)
      {
        res = ResourceBundle.getBundle(messageFileName, Locale.ENGLISH);
      }
    }
  }
  
  private void initMaxSizes2()
  {
    dateSize = 0;
    timeSize = 0;
    timestampSize = 0;
    java.util.Date localDate1 = new java.util.Date(60907276800000L);
    Timestamp localTimestamp = new Timestamp(localDate1.getTime());
    int j = 0;
    while (j <= 11)
    {
      i = getDateAsString(localDate1).length();
      if (i > dateSize) {
        dateSize = i;
      }
      localTimestamp.setTime(localDate1.getTime() + 79199L);
      i = getTimestampAsString(localTimestamp).length();
      if (i > timestampSize) {
        timestampSize = i;
      }
      j++;
      localDate1.setTime(localDate1.getTime() + 2592000000L);
    }
    int i = 18;
    for (j = 0; j < 24; j++)
    {
      long l1 = j * 3600L + 3540L + 59L;
      long l2 = l1 * 1000L;
      java.util.Date localDate2 = new java.util.Date(l2);
      String str = formatTime.format(localDate2);
      if (str.length() > i) {
        i = str.length();
      }
    }
    timeSize = i;
  }
  
  public LocalizedInput getNewInput(InputStream paramInputStream)
  {
    try
    {
      if (encode != null) {
        return new LocalizedInput(paramInputStream, encode);
      }
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    return new LocalizedInput(paramInputStream);
  }
  
  public LocalizedInput getNewEncodedInput(InputStream paramInputStream, String paramString)
  {
    try
    {
      return new LocalizedInput(paramInputStream, paramString);
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    return new LocalizedInput(paramInputStream);
  }
  
  public LocalizedOutput getNewOutput(OutputStream paramOutputStream)
  {
    try
    {
      if (encode != null) {
        return new LocalizedOutput(paramOutputStream, encode);
      }
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    return new LocalizedOutput(paramOutputStream);
  }
  
  public LocalizedOutput getNewEncodedOutput(OutputStream paramOutputStream, String paramString)
    throws UnsupportedEncodingException
  {
    return new LocalizedOutput(paramOutputStream, paramString);
  }
  
  public String getTextMessage(String paramString)
  {
    return getTextMessage(paramString, new Object[0]);
  }
  
  public String getTextMessage(String paramString, Object paramObject)
  {
    Object[] arrayOfObject = { paramObject };
    return getTextMessage(paramString, arrayOfObject);
  }
  
  public String getTextMessage(String paramString, Object paramObject1, Object paramObject2)
  {
    Object[] arrayOfObject = { paramObject1, paramObject2 };
    return getTextMessage(paramString, arrayOfObject);
  }
  
  public String getTextMessage(String paramString, Object paramObject1, Object paramObject2, Object paramObject3)
  {
    Object[] arrayOfObject = { paramObject1, paramObject2, paramObject3 };
    return getTextMessage(paramString, arrayOfObject);
  }
  
  public String getTextMessage(String paramString, Object paramObject1, Object paramObject2, Object paramObject3, Object paramObject4)
  {
    Object[] arrayOfObject = { paramObject1, paramObject2, paramObject3, paramObject4 };
    return getTextMessage(paramString, arrayOfObject);
  }
  
  private Locale getNewLocale(String paramString)
  {
    String str1 = "";
    String str2 = "";
    String str3 = "";
    if (paramString == null) {
      return null;
    }
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, "_");
    try
    {
      str1 = localStringTokenizer.nextToken();
      if (localStringTokenizer.hasMoreTokens() == true) {
        str2 = localStringTokenizer.nextToken();
      }
      if (localStringTokenizer.hasMoreTokens() == true) {
        str3 = localStringTokenizer.nextToken();
      }
      return new Locale(str1, str2, str3);
    }
    catch (Exception localException) {}
    return null;
  }
  
  public String getTextMessage(String paramString, Object[] paramArrayOfObject)
  {
    if (res == null) {
      setResource();
    }
    try
    {
      return MessageFormat.format(res.getString(paramString), paramArrayOfObject);
    }
    catch (Exception localException)
    {
      String str = paramString;
      for (int i = 0; i < paramArrayOfObject.length; i++) {
        str = str + ", <{" + i + "}>";
      }
      return MessageFormat.format(str, paramArrayOfObject);
    }
  }
  
  public String getLocalizedString(ResultSet paramResultSet, ResultSetMetaData paramResultSetMetaData, int paramInt)
    throws SQLException
  {
    if (!enableLocalized) {
      return paramResultSet.getString(paramInt);
    }
    int i = paramResultSetMetaData.getColumnType(paramInt);
    if (i == 91) {
      return getDateAsString(paramResultSet.getDate(paramInt));
    }
    if ((i == 4) || (i == 5) || (i == -5) || (i == -6)) {
      return getNumberAsString(paramResultSet.getLong(paramInt));
    }
    if ((i == 7) || (i == 6) || (i == 8)) {
      return getNumberAsString(paramResultSet.getDouble(paramInt));
    }
    if ((SUPPORTS_BIG_DECIMAL_CALLS) && ((i == 2) || (i == 3))) {
      return getNumberAsString(paramResultSet.getObject(paramInt));
    }
    if (i == 92) {
      return getTimeAsString(paramResultSet.getTime(paramInt));
    }
    if (i == 93) {
      return getTimestampAsString(paramResultSet.getTimestamp(paramInt));
    }
    return paramResultSet.getString(paramInt);
  }
  
  public String getDateAsString(java.util.Date paramDate)
  {
    if (!enableLocalized) {
      return paramDate.toString();
    }
    return formatDate.format(paramDate);
  }
  
  public String getTimeAsString(java.util.Date paramDate)
  {
    if (!enableLocalized) {
      return paramDate.toString();
    }
    return formatTime.format(paramDate, new StringBuffer(), new FieldPosition(0)).toString();
  }
  
  public String getNumberAsString(int paramInt)
  {
    if (enableLocalized) {
      return formatNumber.format(paramInt);
    }
    return String.valueOf(paramInt);
  }
  
  public String getNumberAsString(long paramLong)
  {
    if (enableLocalized) {
      return formatNumber.format(paramLong);
    }
    return String.valueOf(paramLong);
  }
  
  public String getNumberAsString(Object paramObject)
  {
    if (enableLocalized) {
      return formatNumber.format(paramObject, new StringBuffer(), new FieldPosition(0)).toString();
    }
    return paramObject.toString();
  }
  
  public String getNumberAsString(double paramDouble)
  {
    if (!enableLocalized) {
      return String.valueOf(paramDouble);
    }
    return formatDecimal.format(paramDouble);
  }
  
  public String getTimestampAsString(Timestamp paramTimestamp)
  {
    if (!enableLocalized) {
      return paramTimestamp.toString();
    }
    return formatTimestamp.format(paramTimestamp, new StringBuffer(), new FieldPosition(0)).toString();
  }
  
  public int getColumnDisplaySize(ResultSetMetaData paramResultSetMetaData, int paramInt)
    throws SQLException
  {
    if (!enableLocalized) {
      return paramResultSetMetaData.getColumnDisplaySize(paramInt);
    }
    int i = paramResultSetMetaData.getColumnType(paramInt);
    if (i == 91) {
      return dateSize;
    }
    if (i == 92) {
      return timeSize;
    }
    if (i == 93) {
      return timestampSize;
    }
    return paramResultSetMetaData.getColumnDisplaySize(paramInt);
  }
  
  public String getStringFromDate(String paramString)
    throws ParseException
  {
    if (!enableLocalized) {
      return paramString;
    }
    java.util.Date localDate = formatDate.parse(paramString);
    return new java.sql.Date(localDate.getTime()).toString();
  }
  
  public String getStringFromTime(String paramString)
    throws ParseException
  {
    if (!enableLocalized) {
      return paramString;
    }
    java.util.Date localDate = formatTime.parse(paramString);
    return new Time(localDate.getTime()).toString();
  }
  
  public String getStringFromValue(String paramString)
    throws ParseException
  {
    if (!enableLocalized) {
      return paramString;
    }
    return formatNumber.parse(paramString).toString();
  }
  
  public String getStringFromTimestamp(String paramString)
    throws ParseException
  {
    if (!enableLocalized) {
      return paramString;
    }
    java.util.Date localDate = formatTimestamp.parse(paramString);
    return new Timestamp(localDate.getTime()).toString();
  }
  
  public Locale getLocale()
  {
    return locale;
  }
  
  private final synchronized String getEnvProperty(String paramString)
  {
    String str;
    try
    {
      resourceKey = paramString;
      str = (String)AccessController.doPrivileged(this);
    }
    catch (SecurityException localSecurityException)
    {
      str = null;
    }
    return str;
  }
  
  public final Object run()
  {
    String str = System.getProperty(resourceKey);
    return str;
  }
  
  public static boolean enableLocalization(boolean paramBoolean)
  {
    getInstanceenableLocalized = paramBoolean;
    getInstance().init();
    return paramBoolean;
  }
  
  public boolean isLocalized()
  {
    return getInstanceenableLocalized;
  }
  
  public static String getMessage(String paramString)
  {
    return getInstance().getTextMessage(paramString);
  }
  
  public static String getMessage(String paramString, Object paramObject)
  {
    return getInstance().getTextMessage(paramString, paramObject);
  }
  
  public static String getMessage(String paramString, Object paramObject1, Object paramObject2)
  {
    return getInstance().getTextMessage(paramString, paramObject1, paramObject2);
  }
  
  public static String getMessage(String paramString, Object paramObject1, Object paramObject2, Object paramObject3)
  {
    return getInstance().getTextMessage(paramString, paramObject1, paramObject2, paramObject3);
  }
  
  public static String getMessage(String paramString, Object paramObject1, Object paramObject2, Object paramObject3, Object paramObject4)
  {
    return getInstance().getTextMessage(paramString, paramObject1, paramObject2, paramObject3, paramObject4);
  }
  
  public static LocalizedOutput OutputWriter()
  {
    return getInstanceout;
  }
  
  public static LocalizedInput InputReader()
  {
    return getInstancein;
  }
  
  public static String getNumber(long paramLong)
  {
    return getInstance().getNumberAsString(paramLong);
  }
  
  public static String getNumber(int paramInt)
  {
    return getInstance().getNumberAsString(paramInt);
  }
  
  public String toString()
  {
    String str = "toString(){\nlocale=" + (locale == null ? "null" : locale.toString()) + "\n" + "encode=" + encode + "\n" + "messageFile=" + messageFileName + "\n" + "resourceKey=" + resourceKey + "\n" + "enableLocalized=" + enableLocalized + " \n" + "dateSize=" + dateSize + "\n" + "timeSize=" + timeSize + "\n" + "timestampSize=" + timestampSize + "\n}";
    return str;
  }
  
  static
  {
    boolean bool;
    try
    {
      Class.forName("java.math.BigDecimal");
      bool = true;
      Method localMethod = class$java$sql$ResultSet.getMethod("getBigDecimal", new Class[] { Integer.TYPE });
      bool = true;
    }
    catch (Throwable localThrowable)
    {
      bool = false;
    }
    SUPPORTS_BIG_DECIMAL_CALLS = bool;
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.iapi.tools.i18n.LocalizedResource
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.impl.tools.dblook;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.apache.derby.tools.dblook;

public class DB_Alias
{
  private static final char UDT_TYPE = 'A';
  private static final char PROCEDURE_TYPE = 'P';
  private static final char FUNCTION_TYPE = 'F';
  
  public static void doProceduresFunctionsAndUDTs(Connection paramConnection, boolean paramBoolean)
    throws SQLException
  {
    PreparedStatement localPreparedStatement = paramConnection.prepareStatement("SELECT ALIAS, ALIASINFO, ALIASID, SCHEMAID, JAVACLASSNAME, SYSTEMALIAS FROM SYS.SYSALIASES WHERE ALIASTYPE=?");
    if (paramBoolean) {
      generateDDL(localPreparedStatement, 'A');
    }
    generateDDL(localPreparedStatement, 'P');
    generateDDL(localPreparedStatement, 'F');
    localPreparedStatement.close();
  }
  
  private static void generateDDL(PreparedStatement paramPreparedStatement, char paramChar)
    throws SQLException
  {
    paramPreparedStatement.setString(1, new String(new char[] { paramChar }));
    ResultSet localResultSet = paramPreparedStatement.executeQuery();
    generateDDL(localResultSet, paramChar);
    localResultSet.close();
  }
  
  private static void generateDDL(ResultSet paramResultSet, char paramChar)
    throws SQLException
  {
    int i = 1;
    while (paramResultSet.next()) {
      if (!paramResultSet.getBoolean(6))
      {
        String str1 = dblook.lookupSchemaId(paramResultSet.getString(4));
        if (!dblook.isIgnorableSchema(str1))
        {
          if (i != 0)
          {
            Logs.reportString("----------------------------------------------");
            switch (paramChar)
            {
            case 'A': 
              Logs.reportMessage("DBLOOK_UDTHeader");
              break;
            case 'P': 
              Logs.reportMessage("DBLOOK_StoredProcHeader");
              break;
            case 'F': 
              Logs.reportMessage("DBLOOK_FunctionHeader");
            }
            Logs.reportString("----------------------------------------------\n");
          }
          String str2 = paramResultSet.getString(1);
          String str3 = dblook.addQuotes(dblook.expandDoubleQuotes(str2));
          str3 = str1 + "." + str3;
          String str4 = createProcFuncOrUDTString(str3, paramResultSet, paramChar);
          Logs.writeToNewDDL(str4);
          Logs.writeStmtEndToNewDDL();
          Logs.writeNewlineToNewDDL();
          i = 0;
        }
      }
    }
  }
  
  private static String createProcFuncOrUDTString(String paramString, ResultSet paramResultSet, char paramChar)
    throws SQLException
  {
    StringBuffer localStringBuffer = new StringBuffer("CREATE ");
    switch (paramChar)
    {
    case 'A': 
      localStringBuffer.append("TYPE ");
      break;
    case 'P': 
      localStringBuffer.append("PROCEDURE ");
      break;
    case 'F': 
      localStringBuffer.append("FUNCTION ");
    }
    localStringBuffer.append(paramString);
    localStringBuffer.append(" ");
    String str = paramResultSet.getString(2);
    if (paramChar != 'A')
    {
      localStringBuffer.append(str.substring(str.indexOf("("), str.length()));
      localStringBuffer.append(" ");
    }
    localStringBuffer.append("EXTERNAL NAME '");
    localStringBuffer.append(paramResultSet.getString(5));
    if (paramChar == 'A')
    {
      localStringBuffer.append("' ");
      localStringBuffer.append(str);
    }
    else
    {
      localStringBuffer.append(".");
      localStringBuffer.append(str.substring(0, str.indexOf("(")));
      localStringBuffer.append("' ");
    }
    return localStringBuffer.toString();
  }
  
  public static void doSynonyms(Connection paramConnection)
    throws SQLException
  {
    Statement localStatement = paramConnection.createStatement();
    ResultSet localResultSet = localStatement.executeQuery("SELECT ALIAS, SCHEMAID, ALIASINFO, SYSTEMALIAS FROM SYS.SYSALIASES A WHERE ALIASTYPE='S'");
    int i = 1;
    while (localResultSet.next()) {
      if (!localResultSet.getBoolean(4))
      {
        String str1 = dblook.lookupSchemaId(localResultSet.getString(2));
        if (!dblook.isIgnorableSchema(str1))
        {
          if (i != 0)
          {
            Logs.reportString("----------------------------------------------");
            Logs.reportMessage("DBLOOK_SynonymHeader");
            Logs.reportString("----------------------------------------------\n");
          }
          String str2 = localResultSet.getString(1);
          String str3 = dblook.addQuotes(dblook.expandDoubleQuotes(str2));
          str3 = str1 + "." + str3;
          Logs.writeToNewDDL("CREATE SYNONYM " + str3 + " FOR " + localResultSet.getString(3));
          Logs.writeStmtEndToNewDDL();
          Logs.writeNewlineToNewDDL();
          i = 0;
        }
      }
    }
    localResultSet.close();
    localStatement.close();
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.impl.tools.dblook.DB_Alias
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.impl.tools.dblook;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.apache.derby.tools.dblook;

public class DB_Check
{
  public static void doChecks(Connection paramConnection)
    throws SQLException
  {
    Statement localStatement = paramConnection.createStatement();
    ResultSet localResultSet = localStatement.executeQuery("SELECT CS.CONSTRAINTNAME, CS.TABLEID, CS.SCHEMAID, CK.CHECKDEFINITION FROM SYS.SYSCONSTRAINTS CS, SYS.SYSCHECKS CK WHERE CS.CONSTRAINTID = CK.CONSTRAINTID AND CS.STATE != 'D' ORDER BY CS.TABLEID");
    int i = 1;
    while (localResultSet.next())
    {
      String str1 = localResultSet.getString(2);
      String str2 = dblook.lookupTableId(str1);
      if (!dblook.isExcludedTable(str2))
      {
        if (i != 0)
        {
          Logs.reportString("----------------------------------------------");
          Logs.reportMessage("DBLOOK_ChecksHeader");
          Logs.reportString("----------------------------------------------\n");
        }
        StringBuffer localStringBuffer = createCheckString(str2, localResultSet);
        Logs.writeToNewDDL(localStringBuffer.toString());
        Logs.writeStmtEndToNewDDL();
        Logs.writeNewlineToNewDDL();
        i = 0;
      }
    }
    localStatement.close();
    localResultSet.close();
  }
  
  private static StringBuffer createCheckString(String paramString, ResultSet paramResultSet)
    throws SQLException
  {
    StringBuffer localStringBuffer = new StringBuffer("ALTER TABLE ");
    localStringBuffer.append(paramString);
    localStringBuffer.append(" ADD");
    String str = dblook.addQuotes(dblook.expandDoubleQuotes(paramResultSet.getString(1)));
    localStringBuffer.append(" CONSTRAINT ");
    localStringBuffer.append(str);
    localStringBuffer.append(" CHECK ");
    localStringBuffer.append(dblook.removeNewlines(paramResultSet.getString(4)));
    return localStringBuffer;
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.impl.tools.dblook.DB_Check
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.impl.tools.dblook;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.StringTokenizer;
import org.apache.derby.tools.dblook;

public class DB_GrantRevoke
{
  public static void doAuthorizations(Connection paramConnection, boolean paramBoolean)
    throws SQLException
  {
    Statement localStatement = paramConnection.createStatement();
    if (paramBoolean)
    {
      localResultSet = localStatement.executeQuery("SELECT P.GRANTEE, S.SCHEMANAME, A.ALIAS, P.PERMISSION, P.OBJECTTYPE FROM SYS.SYSPERMS P, SYS.SYSALIASES A, SYS.SYSSCHEMAS S WHERE A.SCHEMAID = S.SCHEMAID AND P.OBJECTID = A.ALIASID AND A.ALIASTYPE='A'");
      generateUDTPrivs(localResultSet);
      localResultSet = localStatement.executeQuery("SELECT P.GRANTEE, S.SCHEMANAME, SEQ.SEQUENCENAME, P.PERMISSION, P.OBJECTTYPE FROM SYS.SYSPERMS P, SYS.SYSSEQUENCES SEQ, SYS.SYSSCHEMAS S WHERE SEQ.SCHEMAID = S.SCHEMAID AND P.OBJECTID = SEQ.SEQUENCEID");
      generateSequencePrivs(localResultSet);
    }
    ResultSet localResultSet = localStatement.executeQuery("SELECT GRANTEE, SCHEMANAME, TABLENAME, SELECTPRIV, DELETEPRIV, INSERTPRIV, UPDATEPRIV, REFERENCESPRIV, TRIGGERPRIV FROM SYS.SYSTABLEPERMS P, SYS.SYSTABLES T, SYS.SYSSCHEMAS S WHERE T.SCHEMAID = S.SCHEMAID AND T.TABLEID = P.TABLEID");
    generateTablePrivs(localResultSet);
    localResultSet = localStatement.executeQuery("SELECT GRANTEE, SCHEMANAME, TABLENAME, TYPE, COLUMNS FROM SYS.SYSCOLPERMS P, SYS.SYSTABLES T, SYS.SYSSCHEMAS S WHERE T.SCHEMAID = S.SCHEMAID AND T.TABLEID = P.TABLEID");
    generateColumnPrivs(localResultSet, paramConnection);
    localResultSet = localStatement.executeQuery("SELECT GRANTEE, SCHEMANAME, ALIAS, ALIASTYPE FROM SYS.SYSROUTINEPERMS P, SYS.SYSALIASES A, SYS.SYSSCHEMAS S WHERE A.SCHEMAID = S.SCHEMAID AND P.ALIASID = A.ALIASID");
    generateRoutinePrivs(localResultSet);
    localResultSet.close();
    localStatement.close();
  }
  
  private static void generateTablePrivs(ResultSet paramResultSet)
    throws SQLException
  {
    int i = 1;
    while (paramResultSet.next())
    {
      if (i != 0)
      {
        Logs.reportString("----------------------------------------------");
        Logs.reportMessage("DBLOOK_TablePrivHeader");
        Logs.reportString("----------------------------------------------\n");
      }
      String str1 = dblook.addQuotes(dblook.expandDoubleQuotes(paramResultSet.getString(1)));
      String str2 = dblook.addQuotes(dblook.expandDoubleQuotes(paramResultSet.getString(2)));
      String str3 = dblook.addQuotes(dblook.expandDoubleQuotes(paramResultSet.getString(3)));
      String str4 = str2 + "." + str3;
      if (!dblook.isIgnorableSchema(str2))
      {
        Logs.writeToNewDDL(tablePrivStatement(paramResultSet, str4, str1));
        Logs.writeStmtEndToNewDDL();
        Logs.writeNewlineToNewDDL();
        i = 0;
      }
    }
  }
  
  private static String separatorStr(boolean paramBoolean)
  {
    return paramBoolean ? ", " : "";
  }
  
  private static String tablePrivStatement(ResultSet paramResultSet, String paramString1, String paramString2)
    throws SQLException
  {
    boolean bool = false;
    StringBuffer localStringBuffer = new StringBuffer("GRANT ");
    if (paramResultSet.getString(4).toUpperCase().equals("Y"))
    {
      localStringBuffer.append("SELECT");
      bool = true;
    }
    if (paramResultSet.getString(5).toUpperCase().equals("Y"))
    {
      localStringBuffer.append(separatorStr(bool) + "DELETE");
      bool = true;
    }
    if (paramResultSet.getString(6).toUpperCase().equals("Y"))
    {
      localStringBuffer.append(separatorStr(bool) 
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