org.eclipse.datatools.enablement.oda.xml_1.2.3.v201112061438

16:42:46.561 INFO  jd.cli.Main - Decompiling org.eclipse.datatools.enablement.oda.xml_1.2.3.v201112061438.jar
package org.eclipse.datatools.enablement.oda.xml;

import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;

public final class Constants
{
  public static final String QUERYTEXT_TABLE_NAME_DEFN_DELIMITER = "#-TNAME-#";
  public static final String COLON_MARK = ":";
  public static final String CONST_TABLE_DELIMITER = "#-#";
  public static final String CONST_TABLE_COLUMN_DELIMITER = "#:#";
  public static final String CONST_COLUMN_METAINFO_DELIMITER = ";";
  public static final String CONST_COLUMN_DELIMITER = ",";
  public static final String CONST_NAMESPACE_START = "<";
  public static final String CONST_NAMESPACE_END = ">";
  public static final String CONST_ROW_START = "[";
  public static final String CONST_ROW_END = "]";
  public static final String CONST_COLUMN_START = "{";
  public static final String CONST_COLUMN_END = "}";
  public static final String CONST_PARAMETER_START = "{?";
  public static final String CONST_PARAMETER_END = "?}";
  public static final int DATA_SOURCE_MAJOR_VERSION = 1;
  public static final int DATA_SOURCE_MINOR_VERSION = 0;
  public static final String DATA_SOURCE_PRODUCT_NAME = Messages.getString("Constants.DriverName");
  public static final int CACHED_RESULT_SET_LENGTH = 100;
  public static final String APPCONTEXT_INPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.inputStream";
  public static final String APPCONTEXT_CLOSEINPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.closeInputStream";
  public static final String APPCONTEXT_MEMORY_CACHE_SIZE = "org.eclipse.datatools.enablement.oda.xml.memoryCacheSize";
  public static final String CONST_PROP_RELATIONINFORMATION = "RELATIONINFORMATION";
  public static final String CONST_PROP_FILELIST = "FILELIST";
  public static final String CONST_PROP_ENCODINGLIST = "ENCODINGLIST";
  public static final String CONST_PROP_SCHEMA_FILELIST = "SCHEMAFILELIST";
  public static final String CONST_PROP_XML_FILE = "XML_FILE";
  public static final String CONST_PROP_XML_ENCODING = "XML_ENCODING";
  public static final String CONST_PROP_MAX_ROW = "MAX_ROW";
  public static final String CONST_PROP_XPATH = "XPATHTEXT";
  public static final String CONST_PROP_TABLE_NAME = "TABLENAME";
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.Constants
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.i18n;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.oda.xml.i18n.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.datatools.enablement.oda.xml.i18n.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.i18n.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import com.ibm.icu.util.ULocale;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.IXMLSource;
import org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromInputStream;
import org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromPath;

public class Connection
  implements IConnection
{
  private static final String TRUE_LITERAL = "true";
  private IXMLSource xmlSource;
  private boolean isOpen;
  private Map<String, Object> appContext;
  Properties connProperties;
  private Object ri;
  
  public void open(Properties connProperties)
    throws OdaException
  {
    if (isOpen) {
      return;
    }
    this.connProperties = connProperties;
    
    isOpen = true;
  }
  
  public void close()
    throws OdaException
  {
    isOpen = false;
    if (xmlSource != null) {
      xmlSource.release();
    }
    appContext = null;
  }
  
  public boolean isOpen()
    throws OdaException
  {
    return isOpen;
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {
    if (!(context instanceof Map)) {
      throw new OdaException(Messages.getString("Connection.InvalidAppContext"));
    }
    appContext = ((Map)context);
    
    String legacyInputStreamKey = "org.eclipse.birt.report.data.oda.xml.inputStream";
    if (appContext.get(legacyInputStreamKey) != null)
    {
      appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", 
        appContext.get(legacyInputStreamKey));
      appContext.remove(legacyInputStreamKey);
    }
    String legacyCloseInputStreamKey = "org.eclipse.birt.report.data.oda.xml.closeInputStream";
    if (appContext.get(legacyCloseInputStreamKey) != null)
    {
      appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", 
        appContext.get(legacyCloseInputStreamKey));
      appContext.remove(legacyCloseInputStreamKey);
    }
    ri = appContext.get("org.eclipse.datatools.connectivity.oda.util_consumerResourceIds");
  }
  
  public IDataSetMetaData getMetaData(String dataSetType)
    throws OdaException
  {
    return new DataSetMetaData(this);
  }
  
  public IQuery newQuery(String dataSetType)
    throws OdaException
  {
    return new Query(this);
  }
  
  public int getMaxQueries()
    throws OdaException
  {
    return 0;
  }
  
  public void commit()
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public void rollback()
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setLocale(ULocale locale)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IXMLSource getXMLSource()
    throws OdaException
  {
    if (xmlSource == null) {
      initXMLSource();
    }
    return xmlSource;
  }
  
  private void initXMLSource()
    throws OdaException
  {
    String encoding = connProperties == null ? null : (String)connProperties.get("ENCODINGLIST");
    String file = connProperties == null ? null : (String)connProperties.get("FILELIST");
    if ((appContext != null) && 
      ((appContext.get("org.eclipse.datatools.enablement.oda.xml.inputStream") instanceof InputStream)))
    {
      boolean closeOriginalInputStream = false;
      Object closeInputStream = appContext.get("org.eclipse.datatools.enablement.oda.xml.closeInputStream");
      if ("true".equalsIgnoreCase(closeInputStream == null ? null : closeInputStream.toString())) {
        closeOriginalInputStream = true;
      }
      xmlSource = new XMLSourceFromInputStream(
        (InputStream)appContext.get("org.eclipse.datatools.enablement.oda.xml.inputStream"), 
        encoding, 
        closeOriginalInputStream);
    }
    else
    {
      xmlSource = new XMLSourceFromPath(file, encoding, ri);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.Connection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.Constants;

public class DataSetMetaData
  implements IDataSetMetaData
{
  private static final String DOT = ".";
  private IConnection connection = null;
  
  public DataSetMetaData(Connection connection)
  {
    this.connection = connection;
  }
  
  public IConnection getConnection()
    throws OdaException
  {
    return connection;
  }
  
  public IResultSet getDataSourceObjects(String catalog, String schema, String object, String version)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public int getDataSourceMajorVersion()
    throws OdaException
  {
    return 1;
  }
  
  public int getDataSourceMinorVersion()
    throws OdaException
  {
    return 0;
  }
  
  public String getDataSourceProductName()
    throws OdaException
  {
    return Constants.DATA_SOURCE_PRODUCT_NAME;
  }
  
  public String getDataSourceProductVersion()
    throws OdaException
  {
    return 
      String.valueOf(getDataSourceMajorVersion()) + "." + String.valueOf(getDataSourceMinorVersion());
  }
  
  public int getSQLStateType()
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean supportsMultipleResultSets()
    throws OdaException
  {
    return false;
  }
  
  public boolean supportsMultipleOpenResults()
    throws OdaException
  {
    return false;
  }
  
  public boolean supportsNamedResultSets()
    throws OdaException
  {
    return false;
  }
  
  public boolean supportsNamedParameters()
    throws OdaException
  {
    return true;
  }
  
  public boolean supportsInParameters()
    throws OdaException
  {
    return true;
  }
  
  public boolean supportsOutParameters()
    throws OdaException
  {
    return false;
  }
  
  public int getSortMode()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.DataSetMetaData
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import java.util.Locale;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.util.manifest.DataSetType;
import org.eclipse.datatools.connectivity.oda.util.manifest.DataTypeMapping;
import org.eclipse.datatools.connectivity.oda.util.manifest.ExtensionManifest;
import org.eclipse.datatools.connectivity.oda.util.manifest.ManifestExplorer;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;

public final class DataTypes
{
  public static final int INT = 4;
  public static final int DOUBLE = 8;
  public static final int STRING = 12;
  public static final int DATE = 91;
  public static final int TIME = 92;
  public static final int TIMESTAMP = 93;
  public static final int BLOB = 2004;
  public static final int BIGDECIMAL = 2;
  public static final int BOOLEAN = 16;
  private static final String XML_DATA_SOURCE_ID = "org.eclipse.datatools.enablement.oda.xml";
  
  public static int getType(String typeName)
    throws OdaException
  {
    if ((typeName == null) || (typeName.trim().length() == 0)) {
      return 12;
    }
    String preparedTypeName = typeName.trim().toUpperCase(Locale.ENGLISH);
    
    DataTypeMapping typeMapping = getManifest().getDataSetType(null)
      .getDataTypeMapping(preparedTypeName);
    if (typeMapping != null) {
      return typeMapping.getNativeTypeCode();
    }
    throw new OdaException(
      Messages.getString("dataTypes.typeNameInvalid") + typeName);
  }
  
  public static String getTypeString(int type)
    throws OdaException
  {
    DataTypeMapping typeMapping = getManifest().getDataSetType(null)
      .getDataTypeMapping(type);
    if (typeMapping != null) {
      return typeMapping.getNativeType();
    }
    throw new OdaException(
      Messages.getString("dataTypes.typeNameInvalid") + type);
  }
  
  public static boolean isValidType(String typeName)
  {
    String preparedTypeName = typeName.trim().toUpperCase(Locale.ENGLISH);
    
    DataTypeMapping typeMapping = null;
    try
    {
      typeMapping = 
        getManifest().getDataSetType(null).getDataTypeMapping(preparedTypeName);
    }
    catch (OdaException localOdaException) {}
    return typeMapping != null;
  }
  
  private static ExtensionManifest getManifest()
    throws OdaException
  {
    return 
      ManifestExplorer.getInstance().getExtensionManifest("org.eclipse.datatools.enablement.oda.xml");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.DataTypes
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDriver;
import org.eclipse.datatools.connectivity.oda.LogConfiguration;
import org.eclipse.datatools.connectivity.oda.OdaException;

public class Driver
  implements IDriver
{
  public IConnection getConnection(String dataSourceId)
    throws OdaException
  {
    return new Connection();
  }
  
  public void setLogConfiguration(LogConfiguration logConfig)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public int getMaxConnections()
    throws OdaException
  {
    return 0;
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.Driver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.util.MappedTables;

class Query$1
  implements IParameterMetaData
{
  Query$1(Query paramQuery) {}
  
  public int getParameterCount()
    throws OdaException
  {
    return Query.access$0(this$0).getParameters().length;
  }
  
  public int getParameterMode(int param)
    throws OdaException
  {
    return 1;
  }
  
  public String getParameterName(int param)
    throws OdaException
  {
    return Query.access$0(this$0).getParameters()[(param - 1)];
  }
  
  public int getParameterType(int param)
    throws OdaException
  {
    return 12;
  }
  
  public String getParameterTypeName(int param)
    throws OdaException
  {
    return DataTypes.getTypeString(12);
  }
  
  public int getPrecision(int param)
    throws OdaException
  {
    return -1;
  }
  
  public int getScale(int param)
    throws OdaException
  {
    return -1;
  }
  
  public int isNullable(int param)
    throws OdaException
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.Query.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
import org.eclipse.datatools.connectivity.oda.spec.QuerySpecification;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.MappedTables;

public class Query
  implements IQuery
{
  private String tableName;
  private int maxRows;
  private boolean isClosed;
  private Connection connection;
  private MappedTables mt;
  
  public Query(Connection connection)
  {
    tableName = null;
    maxRows = 0;
    isClosed = false;
    this.connection = connection;
  }
  
  public void prepare(String queryText)
    throws OdaException
  {
    testClosed();
    if (queryText == null) {
      throw new OdaException(Messages.getString("Query.InvalidQueryText"));
    }
    String[] temp = queryText.trim().split("#-TNAME-#");
    if (temp.length != 2) {
      throw new OdaException(Messages.getString("Query.InvalidQueryText"));
    }
    tableName = temp[0];
    
    mt = new MappedTables(temp[1]);
  }
  
  public void setProperty(String name, String value)
    throws OdaException
  {}
  
  public void close()
    throws OdaException
  {
    isClosed = true;
  }
  
  public void setMaxRows(int max)
    throws OdaException
  {
    testClosed();
    maxRows = (max > 0 ? max : 0);
  }
  
  public int getMaxRows()
    throws OdaException
  {
    testClosed();
    return maxRows;
  }
  
  public IResultSetMetaData getMetaData()
    throws OdaException
  {
    testClosed();
    return new ResultSetMetaData(mt, tableName);
  }
  
  public IResultSet executeQuery()
    throws OdaException
  {
    testClosed();
    if ((tableName == null) || (tableName.trim().length() == 0)) {
      throw new OdaException(Messages.getString("Query.QueryHasNotBeenPrepared"));
    }
    ResultSet result = new ResultSet(connection, mt, 
      tableName, 
      getMaxRows());
    
    return result;
  }
  
  public void clearInParameters()
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setInt(String parameterName, int value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setInt(int parameterId, int value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setDouble(String parameterName, double value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setDouble(int parameterId, double value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setBigDecimal(String parameterName, BigDecimal value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setBigDecimal(int parameterId, BigDecimal value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setString(String parameterName, String value)
    throws OdaException
  {
    if (mt != null) {
      mt.setParameterValue(parameterName, value);
    }
  }
  
  public void setString(int parameterId, String value)
    throws OdaException
  {
    if (mt != null) {
      if ((parameterId >= 1) && (parameterId <= mt.getParameters().length)) {
        mt.setParameterValue(mt.getParameters()[(parameterId - 1)], value);
      }
    }
  }
  
  public void setDate(String parameterName, Date value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setDate(int parameterId, Date value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setTime(String parameterName, Time value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setTime(int parameterId, Time value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setTimestamp(String parameterName, Timestamp value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setTimestamp(int parameterId, Timestamp value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setBoolean(String parameterName, boolean value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setBoolean(int parameterId, boolean value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setObject(int parameterId, Object value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setObject(String parameterName, Object value)
    throws OdaException
  {
    setString(parameterName, String.valueOf(value));
  }
  
  public void setNull(String parameterName)
    throws OdaException
  {
    setString(parameterName, "");
  }
  
  public void setNull(int parameterId)
    throws OdaException
  {
    setString(parameterId, "");
  }
  
  public int findInParameter(String parameterName)
    throws OdaException
  {
    if (mt == null) {
      return -1;
    }
    for (int i = 0; i < mt.getParameters().length; i++) {
      if (mt.getParameters()[i].equals(parameterName)) {
        return i + 1;
      }
    }
    return -1;
  }
  
  public IParameterMetaData getParameterMetaData()
    throws OdaException
  {
    if (mt == null) {
      return null;
    }
    new IParameterMetaData()
    {
      public int getParameterCount()
        throws OdaException
      {
        return mt.getParameters().length;
      }
      
      public int getParameterMode(int param)
        throws OdaException
      {
        return 1;
      }
      
      public String getParameterName(int param)
        throws OdaException
      {
        return mt.getParameters()[(param - 1)];
      }
      
      public int getParameterType(int param)
        throws OdaException
      {
        return 12;
      }
      
      public String getParameterTypeName(int param)
        throws OdaException
      {
        return DataTypes.getTypeString(12);
      }
      
      public int getPrecision(int param)
        throws OdaException
      {
        return -1;
      }
      
      public int getScale(int param)
        throws OdaException
      {
        return -1;
      }
      
      public int isNullable(int param)
        throws OdaException
      {
        return 0;
      }
    };
  }
  
  public void setSortSpec(SortSpec sortBy)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public SortSpec getSortSpec()
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public String getEffectiveQueryText()
  {
    throw new UnsupportedOperationException();
  }
  
  public QuerySpecification getSpecification()
  {
    return null;
  }
  
  public void setSpecification(QuerySpecification querySpec)
    throws OdaException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void cancel()
    throws OdaException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  private void testClosed()
    throws OdaException
  {
    if (isClosed) {
      throw new OdaException(Messages.getString("Query.ResultSetClosed"));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.Query
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import com.ibm.icu.text.NumberFormat;
import com.ibm.icu.util.ULocale;
import java.math.BigDecimal;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import org.eclipse.datatools.connectivity.oda.IBlob;
import org.eclipse.datatools.connectivity.oda.IClob;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.MappedTables;
import org.eclipse.datatools.enablement.oda.xml.util.RelationInformation;
import org.eclipse.datatools.enablement.oda.xml.util.SaxParserConsumer;
import org.eclipse.datatools.enablement.oda.xml.util.date.DateUtil;

public class ResultSet
  implements IResultSet
{
  private static final String FALSE_LITERAL = "false";
  private static final String TRUE_LITERAL = "true";
  private static final String SINGLE_SPACE = " ";
  private MappedTables mt;
  private int maxRows;
  private boolean wasNull;
  private boolean isClosed;
  private SaxParserConsumer spConsumer;
  private String tableName;
  private RelationInformation relationInfo;
  private Connection connection;
  private static ULocale JRE_DEFAULT_LOCALE = ;
  private int rowID;
  
  public ResultSet(Connection connection, MappedTables mt, String tableName, int maxRows)
    throws OdaException
  {
    this.mt = mt;
    
    this.maxRows = maxRows;
    
    relationInfo = new RelationInformation(mt, true);
    this.tableName = tableName;
    this.connection = connection;
    
    isClosed = false;
  }
  
  public IResultSetMetaData getMetaData()
    throws OdaException
  {
    testClosed();
    return new ResultSetMetaData(mt, tableName);
  }
  
  private void testClosed()
    throws OdaException
  {
    if (isClosed) {
      throw new OdaException(Messages.getString("ResultSet.ResultSetClosed"));
    }
  }
  
  public void close()
    throws OdaException
  {
    if (spConsumer != null) {
      spConsumer.close();
    }
    isClosed = true;
  }
  
  public void setMaxRows(int max)
    throws OdaException
  {
    testClosed();
    maxRows = max;
  }
  
  public boolean next()
    throws OdaException
  {
    testClosed();
    if (spConsumer == null) {
      spConsumer = new SaxParserConsumer(relationInfo, connection.getXMLSource(), tableName);
    }
    boolean hasNext = spConsumer.next();
    if (hasNext) {
      rowID += 1;
    }
    if ((rowID > maxRows) && (maxRows != 0)) {
      return false;
    }
    return hasNext;
  }
  
  public int getRow()
    throws OdaException
  {
    testClosed();
    return rowID;
  }
  
  public String getString(int index)
    throws OdaException
  {
    testClosed();
    String[] resultRow = spConsumer.getRowValue();
    String result = null;
    if (resultRow != null) {
      result = resultRow[(index - 1)];
    }
    wasNull = (result == null);
    return result;
  }
  
  private int getColumnIndex(String columnName)
    throws OdaException
  {
    return mt.getColumnIndex(tableName, columnName);
  }
  
  public String getString(String name)
    throws OdaException
  {
    testClosed();
    return getString(getColumnIndex(name));
  }
  
  public int getInt(int index)
    throws OdaException
  {
    return stringToInt(getString(index));
  }
  
  public int getInt(String name)
    throws OdaException
  {
    return stringToInt(getString(name));
  }
  
  private int stringToInt(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        return new Integer(stringValue).intValue();
      }
      catch (NumberFormatException localNumberFormatException)
      {
        try
        {
          Number number = NumberFormat.getInstance(JRE_DEFAULT_LOCALE).parse(stringValue);
          if (number != null) {
            return number.intValue();
          }
        }
        catch (ParseException localParseException) {}
      }
    }
    wasNull = true;
    return 0;
  }
  
  public double getDouble(int index)
    throws OdaException
  {
    return stringToDouble(getString(index));
  }
  
  public double getDouble(String name)
    throws OdaException
  {
    return stringToDouble(getString(name));
  }
  
  private double stringToDouble(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        return new Double(stringValue).doubleValue();
      }
      catch (NumberFormatException localNumberFormatException)
      {
        try
        {
          Number number = NumberFormat.getInstance(JRE_DEFAULT_LOCALE).parse(stringValue);
          if (number != null) {
            return number.doubleValue();
          }
        }
        catch (ParseException localParseException) {}
      }
    }
    wasNull = true;
    return 0.0D;
  }
  
  public BigDecimal getBigDecimal(int index)
    throws OdaException
  {
    return stringToBigDecimal(getString(index));
  }
  
  public BigDecimal getBigDecimal(String name)
    throws OdaException
  {
    return stringToBigDecimal(getString(name));
  }
  
  private BigDecimal stringToBigDecimal(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        return new BigDecimal(stringValue);
      }
      catch (NumberFormatException localNumberFormatException)
      {
        try
        {
          Number number = NumberFormat.getInstance(JRE_DEFAULT_LOCALE).parse(stringValue);
          if (number != null) {
            return new BigDecimal(number.toString());
          }
        }
        catch (ParseException localParseException) {}
      }
    }
    wasNull = true;
    return null;
  }
  
  public java.sql.Date getDate(int index)
    throws OdaException
  {
    return stringToDate(getString(index));
  }
  
  public java.sql.Date getDate(String columnName)
    throws OdaException
  {
    return stringToDate(getString(columnName));
  }
  
  private java.sql.Date stringToDate(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        return DateUtil.toSqlDate(stringValue);
      }
      catch (OdaException localOdaException)
      {
        wasNull = true;
        return null;
      }
    }
    return null;
  }
  
  public Time getTime(int index)
    throws OdaException
  {
    return stringToTime(getString(index));
  }
  
  public Time getTime(String columnName)
    throws OdaException
  {
    return stringToTime(getString(columnName));
  }
  
  private Time stringToTime(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        return DateUtil.toSqlTime(stringValue);
      }
      catch (OdaException localOdaException)
      {
        wasNull = true;
        return null;
      }
    }
    wasNull = true;
    return null;
  }
  
  public Timestamp getTimestamp(int index)
    throws OdaException
  {
    return stringToTimestamp(getString(index));
  }
  
  public Timestamp getTimestamp(String columnName)
    throws OdaException
  {
    return stringToTimestamp(getString(columnName));
  }
  
  private Timestamp stringToTimestamp(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null) {
      try
      {
        stringValue = stringValue.replaceAll("\\QT\\E", " ").split("\\QZ\\E")[0];
        return Timestamp.valueOf(stringValue);
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        try
        {
          long timeMills = new Long(stringValue).longValue();
          return new Timestamp(timeMills);
        }
        catch (NumberFormatException localNumberFormatException)
        {
          try
          {
            java.util.Date date = DateUtil.toDate(stringValue);
            return new Timestamp(date.getTime());
          }
          catch (OdaException localOdaException)
          {
            wasNull = true;
            return null;
          }
        }
      }
    }
    wasNull = true;
    return null;
  }
  
  public boolean wasNull()
    throws OdaException
  {
    testClosed();
    return wasNull;
  }
  
  public int findColumn(String columnName)
    throws OdaException
  {
    testClosed();
    return getColumnIndex(columnName);
  }
  
  public IBlob getBlob(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IBlob getBlob(String columnName)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IClob getClob(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IClob getClob(String columnName)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean getBoolean(String columnName)
    throws OdaException
  {
    return stringToBoolean(getString(columnName)).booleanValue();
  }
  
  public boolean getBoolean(int index)
    throws OdaException
  {
    return stringToBoolean(getString(index)).booleanValue();
  }
  
  private Boolean stringToBoolean(String stringValue)
    throws OdaException
  {
    testClosed();
    if (stringValue != null)
    {
      if (stringValue.equalsIgnoreCase("true")) {
        return Boolean.TRUE;
      }
      if (stringValue.equalsIgnoreCase("false")) {
        return Boolean.FALSE;
      }
      try
      {
        if (Integer.parseInt(stringValue) == 0) {
          return Boolean.FALSE;
        }
        return Boolean.TRUE;
      }
      catch (NumberFormatException localNumberFormatException)
      {
        try
        {
          Number number = NumberFormat.getInstance(JRE_DEFAULT_LOCALE).parse(stringValue);
          if (number != null) {
            return number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
          }
        }
        catch (ParseException localParseException) {}
      }
    }
    return Boolean.FALSE;
  }
  
  public Object getObject(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public Object getObject(String columnName)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.ResultSet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.impl;

import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.util.MappedTables;

public class ResultSetMetaData
  implements IResultSetMetaData
{
  private MappedTables mt;
  private String tableName;
  
  public ResultSetMetaData(MappedTables mt, String tableName)
  {
    this.mt = mt;
    this.tableName = tableName;
  }
  
  public int getColumnCount()
    throws OdaException
  {
    return mt.getColumnCount(tableName);
  }
  
  public String getColumnName(int index)
    throws OdaException
  {
    return mt.getColumnName(tableName, index);
  }
  
  public String getColumnLabel(int index)
    throws OdaException
  {
    return getColumnName(index);
  }
  
  public int getColumnType(int index)
    throws OdaException
  {
    return DataTypes.getType(mt.getColumnType(tableName, index));
  }
  
  public String getColumnTypeName(int index)
    throws OdaException
  {
    return mt.getColumnType(tableName, index);
  }
  
  public int getColumnDisplayLength(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public int getPrecision(int index)
    throws OdaException
  {
    return -1;
  }
  
  public int getScale(int index)
    throws OdaException
  {
    return -1;
  }
  
  public int isNullable(int index)
    throws OdaException
  {
    return 2;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.impl.ResultSetMetaData
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.util;

class AnyNumberElementPlaceholderNode
  extends ChildrenAllowedTreeNode
{
  AnyNumberElementPlaceholderNode()
  {
    super("");
  }
  
  boolean matches(IXMLPathNode xpn)
  {
    return !(xpn instanceof XMLAttr);
  }
  
  protected TreeNode addChild(String pathElement)
  {
    assert (pathElement != null);
    if (pathElement.equals("<>")) {
      return this;
    }
    return super.addChild(pathElement);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.util.AnyNumberElementPlaceholderNode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.util;

class AttrNode
  extends TreeNode
{
  AttrNode(String attrName)
  {
    super(attrName);
  }
  
  boolean matches(IXMLPathNode xpn)
  {
    if ((xpn instanceof XMLAttr)) {
      return getPathElemntName().equals(xpn.getName());
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.util.AttrNode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.util;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

abstract class ChildrenAllowedTreeNode
  extends TreeNode
{
  private AnyNumberElementPlaceholderNode anyNumberElementChild = null;
  private OneElementPlaceholderNode oneElementChild = null;
  private Map attrChildren = new HashMap();
  private Map elementChildren = new HashMap();
  private boolean hasChild = false;
  
  public ChildrenAllowedTreeNode(String pathElementName)
  {
    super(pathElementName);
  }
  
  protected TreeNode addChild(String pathElement)
  {
    assert (pathElement != null);
    if (pathElement.equals("<>"))
    {
      if (anyNumberElementChild == null)
      {
        anyNumberElementChild = new AnyNumberElementPlaceholderNode();
        anyNumberElementChild.setParent(this);
      }
      hasChild = true;
      return anyNumberElementChild;
    }
    if (pathElement.equals("*"))
    {
      if (oneElementChild == null)
      {
        oneElementChild = new OneElementPlaceholderNode();
        oneElementChild.setParent(this);
      }
      hasChild = true;
      return oneElementChild;
    }
    if (pathElement.startsWith("@"))
    {
      String attrName = pathElement.substring(1);
      TreeNode existNode = (TreeNode)attrChildren.get(attrName);
      if (existNode == null)
      {
        existNode = new AttrNode(attrName);
        existNode.setParent(this);
        attrChildren.put(attrName, existNode);
      }
      hasChild = true;
      return existNode;
    }
    TreeNode existNode = null;
    String pureElement = pathElement.replaceAll("\\Q[\\E\\d+\\Q]\\E$", "");
    Set elementNodes = (Set)elementChildren.get(pureElement);
    if (elementNodes == null)
    {
      elementNodes = new HashSet();
      elementChildren.put(pureElement, elementNodes);
    }
    Iterator itr = elementNodes.iterator();
    while (itr.hasNext())
    {
      TreeNode node = (TreeNode)itr.next();
      if (node.getPathElemntName().equals(pathElement))
      {
        existNode = node;
        break;
      }
    }
    if (existNode == null)
    {
      existNode = new ElementNode(pathElement);
      existNode.setParent(this);
      elementNodes.add(existNode);
    }
    hasChild = true;
    return existNode;
  }
  
  protected boolean hasChild()
  {
    return hasChild;
  }
  
  protected TreeNode getAnyNumberElementChild()
  {
    return anyNumberElementChild;
  }
  
  public Set getMatchedDownables(IXMLPathNode xpn)
  {
    assert (xpn != null);
    Set result = new HashSet();
    if ((xpn instanceof XMLAttr))
    {
      if (anyNumberElementChild != null) {
        result.addAll(anyNumberElementChild.getMatchedDownables(xpn));
      }
      TreeNode node = (TreeNode)attrChildren.get(xpn.getName());
      if (node != null) {
        result.add(node);
      }
    }
    else
    {
      if (anyNumberElementChild != null)
      {
        result.add(anyNumberElementChild);
        result.addAll(anyNumberElementChild.getMatchedDownables(xpn));
      }
      if (oneElementChild != null) {
        result.add(oneElementChild);
      }
      Set elementNodes = (Set)elementChildren.get(xpn.getName());
      if (elementNodes != null)
      {
        Iterator itr = elementNodes.iterator();
        while (itr.hasNext())
        {
          TreeNode elementNode = (TreeNode)itr.next();
          if (elementNode.matches(xpn)) {
            result.add(elementNode);
          }
        }
      }
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.xml.util.ChildrenAllowedTreeNode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.xml.util;

import java.util.HashMap;
import org.eclipse.datatools.connecti
1 2 3 4 5

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