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

16:42:46.028 INFO  jd.cli.Main - Decompiling org.eclipse.datatools.enablement.oda.ws_1.2.3.v201112061438.jar
package org.eclipse.datatools.enablement.oda.ws;

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends Plugin
{
  public static final String PLUGIN_ID = "org.eclipse.datatools.enablement.oda.ws";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
}

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

import java.util.Map;

public abstract interface IWSConnection
{
  public abstract Object executeQuery(String paramString, Map paramMap1, Map paramMap2);
  
  public abstract void close();
}

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

import java.util.Map;

public abstract interface IWSDriver
{
  public abstract IWSConnection connect(Map paramMap1, Map paramMap2);
}

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

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.oda.ws.i18n.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.datatools.enablement.oda.ws.i18n.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
  
  public static String getFormattedString(String key, Object[] arguments)
  {
    return MessageFormat.format(getString(key), arguments);
  }
}

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

import com.ibm.icu.util.ULocale;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
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.ws.util.Java2SOAPManager;
import org.eclipse.datatools.enablement.oda.ws.util.RawMessageSender;
import org.eclipse.datatools.enablement.oda.ws.util.WSUtil;

public class Connection
  implements IConnection
{
  private boolean m_isOpen = false;
  private RawMessageSender rawMessageSender;
  private Properties connProperties;
  private Java2SOAPManager java2SOAPManager;
  private boolean isCustom = false;
  private Map appContext = null;
  
  public void open(Properties connProperties)
    throws OdaException
  {
    this.connProperties = connProperties;
    isCustom = (!WSUtil.isNull(connProperties.getProperty("connectionClass")));
    if (isCustom)
    {
      java2SOAPManager = new Java2SOAPManager();
      java2SOAPManager.setConnectionProperties(connProperties);
      java2SOAPManager.setAppConext(appContext);
      String driverPath = connProperties.getProperty("driverClassPath");
      try
      {
        java2SOAPManager.newQuery(connProperties.getProperty("connectionClass"), driverPath);
      }
      catch (Exception e)
      {
        throw new OdaException(e);
      }
    }
    else
    {
      rawMessageSender = new RawMessageSender();
    }
    try
    {
      ping(connProperties);
    }
    catch (Exception localException1)
    {
      throw new OdaException();
    }
    m_isOpen = true;
  }
  
  private void ping(Properties connProperties)
    throws OdaException, MalformedURLException, IOException
  {
    if ((WSUtil.isNull(connProperties.getProperty("wsdlURI"))) && 
      (WSUtil.isNull(connProperties.getProperty("soapEndPoint"))) && 
      (WSUtil.isNull(connProperties.getProperty("connectionClass")))) {
      throw new OdaException();
    }
    pingURL(connProperties.getProperty("wsdlURI"));
  }
  
  private void pingURL(String spec)
    throws MalformedURLException, IOException
  {
    if ((!WSUtil.isNull(spec)) && 
      (!new File(spec).exists())) {
      new URL(spec).openStream();
    }
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {
    if ((context instanceof Map)) {
      appContext = ((Map)context);
    }
  }
  
  public void close()
    throws OdaException
  {
    m_isOpen = false;
    if (isCustom) {
      java2SOAPManager = null;
    } else {
      rawMessageSender = null;
    }
  }
  
  public boolean isOpen()
    throws OdaException
  {
    return m_isOpen;
  }
  
  public IDataSetMetaData getMetaData(String dataSetType)
    throws OdaException
  {
    return new DataSetMetaData(this);
  }
  
  public IQuery newQuery(String dataSetType)
    throws OdaException
  {
    if (isCustom) {
      return byCustom();
    }
    return new Query(rawMessageSender, connProperties);
  }
  
  private IQuery byCustom()
    throws OdaException
  {
    try
    {
      java2SOAPManager.newQuery(connProperties.getProperty("connectionClass"), connProperties.getProperty("driverClassPath"));
    }
    catch (Exception e)
    {
      throw new OdaException(e);
    }
    return new Query(java2SOAPManager);
  }
  
  public int getMaxQueries()
    throws OdaException
  {
    return 0;
  }
  
  public void commit()
    throws OdaException
  {}
  
  public void rollback()
    throws OdaException
  {}
  
  public void setLocale(ULocale locale)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.ws.impl.Connection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.ws.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;

public class DataSetMetaData
  implements IDataSetMetaData
{
  private IConnection m_connection;
  
  DataSetMetaData(IConnection connection)
  {
    m_connection = connection;
  }
  
  public IConnection getConnection()
    throws OdaException
  {
    return m_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 "DTP Web Service Data Source";
  }
  
  public String getDataSourceProductVersion()
    throws OdaException
  {
    return 
      Integer.toString(getDataSourceMajorVersion()) + "." + Integer.toString(getDataSourceMinorVersion());
  }
  
  public int getSQLStateType()
    throws OdaException
  {
    return 1;
  }
  
  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 false;
  }
  
  public boolean supportsInParameters()
    throws OdaException
  {
    return true;
  }
  
  public boolean supportsOutParameters()
    throws OdaException
  {
    return false;
  }
  
  public int getSortMode()
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.datatools.enablement.oda.ws.impl.DataSetMetaData
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.ws.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;
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;

public class Driver
  implements IDriver
{
  public IConnection getConnection(String dataSourceType)
    throws OdaException
  {
    return new Connection();
  }
  
  public void setLogConfiguration(LogConfiguration logConfig)
    throws OdaException
  {}
  
  public int getMaxConnections()
    throws OdaException
  {
    return 0;
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {}
  
  static ExtensionManifest getManifest()
    throws OdaException
  {
    return 
      ManifestExplorer.getInstance().getExtensionManifest("org.eclipse.datatools.enablement.oda.ws");
  }
  
  static String getNativeDataTypeName(int nativeDataTypeCode)
    throws OdaException
  {
    DataTypeMapping typeMapping = 
      getManifest().getDataSetType(null)
      .getDataTypeMapping(nativeDataTypeCode);
    if (typeMapping != null) {
      return typeMapping.getNativeType();
    }
    return "Non-defined";
  }
}

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

import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.ws.soap.SOAPParameter;

public class ParameterMetaData
  implements IParameterMetaData
{
  private SOAPParameter[] parameters;
  
  public ParameterMetaData(SOAPParameter[] parameters)
  {
    this.parameters = parameters;
  }
  
  public int getParameterCount()
    throws OdaException
  {
    assertNotNull();
    return parameters.length;
  }
  
  public int getParameterMode(int param)
    throws OdaException
  {
    assertNotNull();
    return 1;
  }
  
  public int getParameterType(int param)
    throws OdaException
  {
    assertNotNull();
    return 1;
  }
  
  public String getParameterTypeName(int param)
    throws OdaException
  {
    assertNotNull();
    int nativeTypeCode = getParameterType(param);
    return Driver.getNativeDataTypeName(nativeTypeCode);
  }
  
  public int getPrecision(int param)
    throws OdaException
  {
    assertNotNull();
    return -1;
  }
  
  public int getScale(int param)
    throws OdaException
  {
    assertNotNull();
    return -1;
  }
  
  public int isNullable(int param)
    throws OdaException
  {
    assertNotNull();
    return 0;
  }
  
  public String getParameterName(int param)
    throws OdaException
  {
    assertNotNull();
    return parameters[(param - 1)].getName();
  }
  
  private void assertNotNull()
    throws OdaException
  {
    if (parameters == null) {
      throw new OdaException();
    }
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDriver;
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.ws.soap.SOAPParameter;
import org.eclipse.datatools.enablement.oda.ws.soap.SOAPRequest;
import org.eclipse.datatools.enablement.oda.ws.soap.SOAPResponse;
import org.eclipse.datatools.enablement.oda.ws.util.Java2SOAPManager;
import org.eclipse.datatools.enablement.oda.ws.util.RawMessageSender;
import org.eclipse.datatools.enablement.oda.ws.util.WSDLAdvisor;
import org.eclipse.datatools.enablement.oda.ws.util.WSUtil;
import org.eclipse.datatools.enablement.oda.xml.impl.Driver;

public class Query
  implements IQuery
{
  private SOAPRequest soapRequest;
  private RawMessageSender rawMessageSender;
  private Java2SOAPManager java2SOAPManager;
  private IQuery dataQuery;
  private IQuery metadataQuery;
  private int m_maxRows;
  private boolean isCustom = false;
  private String xmlQueryText = "";
  private String soapEndPoint = "";
  private String operationTrace = "";
  private String wsdlURI = "";
  private long connectionTimeout;
  
  public Query(RawMessageSender rawMessageSender, Properties connProperties)
  {
    this.rawMessageSender = rawMessageSender;
    wsdlURI = connProperties.getProperty("wsdlURI");
    soapEndPoint = connProperties.getProperty("soapEndPoint");
    connectionTimeout = WSUtil.parseLong(connProperties.getProperty("connectionTimeOut"));
    m_maxRows = 0;
  }
  
  public Query(Java2SOAPManager java2SOAPManager)
  {
    this.java2SOAPManager = java2SOAPManager;
    isCustom = true;
    m_maxRows = 0;
  }
  
  public void prepare(String queryText)
    throws OdaException
  {
    if (isCustom) {
      java2SOAPManager.setQueryText(queryText);
    }
    soapRequest = new SOAPRequest(queryText);
  }
  
  public void setAppContext(Object context)
    throws OdaException
  {}
  
  public void close()
    throws OdaException
  {}
  
  public IResultSetMetaData getMetaData()
    throws OdaException
  {
    if (metadataQuery == null) {
      metadataQuery = initXMLQuery(true);
    }
    return metadataQuery.getMetaData();
  }
  
  public IResultSet executeQuery()
    throws OdaException
  {
    if (dataQuery == null) {
      dataQuery = initXMLQuery(false);
    }
    return dataQuery.executeQuery();
  }
  
  private IQuery initXMLQuery(boolean fromWsdl)
    throws OdaException
  {
    InputStream inputStream = getInputStream(fromWsdl);
    if (WSUtil.isNull(inputStream)) {
      throw new OdaException();
    }
    IDriver xmlDriver = new Driver();
    IConnection conn = xmlDriver.getConnection(null);
    
    Map map = new HashMap();
    map.put("org.eclipse.birt.report.data.oda.xml.inputStream", inputStream);
    
    conn.setAppContext(map);
    conn.open(new Properties());
    
    IQuery query = conn.newQuery(null);
    query.setMaxRows(getMaxRows());
    query.prepare(xmlQueryText);
    
    return query;
  }
  
  private InputStream getInputStream(boolean fromWsdl)
    throws OdaException
  {
    if (isCustom) {
      return byCustom();
    }
    rawMessageSender.setMessage(soapRequest.toXML());
    if (WSUtil.isNull(soapEndPoint)) {
      soapEndPoint = WSDLAdvisor.getLocationURI(wsdlURI, 
        operationTrace);
    }
    rawMessageSender.setSpec(soapEndPoint);
    rawMessageSender.setSoapAction(WSDLAdvisor.getSOAPActionURI(wsdlURI, 
      operationTrace));
    
    SOAPResponse soapResponse = null;
    if (fromWsdl)
    {
      WSDLAdvisor wsdlAdvisor = new WSDLAdvisor();
      String temlate = wsdlAdvisor.getLocalSOAPResponseTemplate(wsdlURI, 
        operationTrace);
      soapResponse = new SOAPResponse(new ByteArrayInputStream(temlate.toString()
        .getBytes()));
    }
    else
    {
      soapResponse = rawMessageSender.getSOAPResponse(connectionTimeout);
    }
    if (WSUtil.isNull(soapResponse)) {
      return null;
    }
    return soapResponse.getInputStream();
  }
  
  private InputStream byCustom()
    throws OdaException
  {
    try
    {
      Map parameterMap = new HashMap();
      SOAPParameter[] parameters = soapRequest.getParameters();
      for (int i = 0; (parameters != null) && (i < parameters.length); i++) {
        parameterMap.put(parameters[i].getName(), 
          parameters[i].getDefaultValue());
      }
      java2SOAPManager.setParameterValues(parameterMap);
      Object o = java2SOAPManager.executeQuery();
      if ((o instanceof InputStream)) {
        return (InputStream)o;
      }
      if ((o instanceof String)) {
        return new ByteArrayInputStream(o.toString().getBytes());
      }
      return null;
    }
    catch (Exception e)
    {
      throw new OdaException(e);
    }
  }
  
  public void setProperty(String name, String value)
    throws OdaException
  {
    if ("xmlQueryText".equals(name)) {
      xmlQueryText = value;
    } else if ("operationTrace".equals(name)) {
      operationTrace = value;
    }
  }
  
  public void setMaxRows(int max)
    throws OdaException
  {
    m_maxRows = max;
  }
  
  public int getMaxRows()
    throws OdaException
  {
    return m_maxRows;
  }
  
  public void clearInParameters()
    throws OdaException
  {}
  
  public void setInt(String parameterName, int value)
    throws OdaException
  {}
  
  public void setInt(int parameterId, int value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setDouble(String parameterName, double value)
    throws OdaException
  {}
  
  public void setDouble(int parameterId, double value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setBigDecimal(String parameterName, BigDecimal value)
    throws OdaException
  {}
  
  public void setBigDecimal(int parameterId, BigDecimal value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setString(String parameterName, String value)
    throws OdaException
  {}
  
  public void setString(int parameterId, String value)
    throws OdaException
  {
    if (WSUtil.isNull(soapRequest)) {
      return;
    }
    soapRequest.setParameterValue(parameterId, value);
  }
  
  public void setDate(String parameterName, Date value)
    throws OdaException
  {}
  
  public void setDate(int parameterId, Date value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setTime(String parameterName, Time value)
    throws OdaException
  {}
  
  public void setTime(int parameterId, Time value)
    throws OdaException
  {}
  
  public void setTimestamp(String parameterName, Timestamp value)
    throws OdaException
  {}
  
  public void setTimestamp(int parameterId, Timestamp value)
    throws OdaException
  {}
  
  public int findInParameter(String parameterName)
    throws OdaException
  {
    return 0;
  }
  
  public IParameterMetaData getParameterMetaData()
    throws OdaException
  {
    if (WSUtil.isNull(soapRequest)) {
      return null;
    }
    return new ParameterMetaData(soapRequest.getParameters());
  }
  
  public void setSortSpec(SortSpec sortBy)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public SortSpec getSortSpec()
    throws OdaException
  {
    return null;
  }
  
  public String getEffectiveQueryText()
  {
    throw new UnsupportedOperationException();
  }
  
  public QuerySpecification getSpecification()
  {
    return null;
  }
  
  public void setSpecification(QuerySpecification querySpec)
    throws OdaException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setBoolean(String parameterName, boolean value)
    throws OdaException
  {}
  
  public void setBoolean(int parameterId, boolean value)
    throws OdaException
  {
    setString(parameterId, String.valueOf(value));
  }
  
  public void setObject(int parameterId, Object value)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setObject(String parameterName, Object value)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public void setNull(String parameterName)
    throws OdaException
  {}
  
  public void setNull(int parameterId)
    throws OdaException
  {}
  
  public void cancel()
    throws OdaException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
}

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

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
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;

public class ResultSet
  implements IResultSet
{
  private int m_maxRows;
  private int m_currentRowId;
  
  public IResultSetMetaData getMetaData()
    throws OdaException
  {
    return new ResultSetMetaData();
  }
  
  public void setMaxRows(int max)
    throws OdaException
  {
    m_maxRows = max;
  }
  
  protected int getMaxRows()
  {
    return m_maxRows;
  }
  
  public boolean next()
    throws OdaException
  {
    int maxRows = getMaxRows();
    if (maxRows <= 0) {
      maxRows = 5;
    }
    if (m_currentRowId < maxRows)
    {
      m_currentRowId += 1;
      return true;
    }
    return false;
  }
  
  public void close()
    throws OdaException
  {
    m_currentRowId = 0;
  }
  
  public int getRow()
    throws OdaException
  {
    return m_currentRowId;
  }
  
  public String getString(int index)
    throws OdaException
  {
    return "row" + getRow() + "_column" + index + " value";
  }
  
  public String getString(String columnName)
    throws OdaException
  {
    return getString(findColumn(columnName));
  }
  
  public int getInt(int index)
    throws OdaException
  {
    return getRow();
  }
  
  public int getInt(String columnName)
    throws OdaException
  {
    return getInt(findColumn(columnName));
  }
  
  public double getDouble(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public double getDouble(String columnName)
    throws OdaException
  {
    return getDouble(findColumn(columnName));
  }
  
  public BigDecimal getBigDecimal(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public BigDecimal getBigDecimal(String columnName)
    throws OdaException
  {
    return getBigDecimal(findColumn(columnName));
  }
  
  public Date getDate(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public Date getDate(String columnName)
    throws OdaException
  {
    return getDate(findColumn(columnName));
  }
  
  public Time getTime(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public Time getTime(String columnName)
    throws OdaException
  {
    return getTime(findColumn(columnName));
  }
  
  public Timestamp getTimestamp(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public Timestamp getTimestamp(String columnName)
    throws OdaException
  {
    return getTimestamp(findColumn(columnName));
  }
  
  public IBlob getBlob(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IBlob getBlob(String columnName)
    throws OdaException
  {
    return getBlob(findColumn(columnName));
  }
  
  public IClob getClob(int index)
    throws OdaException
  {
    throw new UnsupportedOperationException();
  }
  
  public IClob getClob(String columnName)
    throws OdaException
  {
    return getClob(findColumn(columnName));
  }
  
  public boolean wasNull()
    throws OdaException
  {
    return false;
  }
  
  public int findColumn(String columnName)
    throws OdaException
  {
    int columnId = 1;
    if ((columnName == null) || (columnName.length() == 0)) {
      return columnId;
    }
    String lastChar = columnName.substring(columnName.length() - 1, 1);
    try
    {
      columnId = Integer.parseInt(lastChar);
    }
    catch (NumberFormatException localNumberFormatException) {}
    return columnId;
  }
  
  public boolean getBoolean(int index)
    throws OdaException
  {
    return false;
  }
  
  public boolean getBoolean(String columnName)
    throws OdaException
  {
    return 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.ws.impl.ResultSet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.ws.impl;

import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;

public class ResultSetMetaData
  implements IResultSetMetaData
{
  public int getColumnCount()
    throws OdaException
  {
    return 2;
  }
  
  public String getColumnName(int index)
    throws OdaException
  {
    return "Column" + index;
  }
  
  public String getColumnLabel(int index)
    throws OdaException
  {
    return getColumnName(index);
  }
  
  public int getColumnType(int index)
    throws OdaException
  {
    if (index == 1) {
      return 4;
    }
    return 1;
  }
  
  public String getColumnTypeName(int index)
    throws OdaException
  {
    int nativeTypeCode = getColumnType(index);
    return Driver.getNativeDataTypeName(nativeTypeCode);
  }
  
  public int getColumnDisplayLength(int index)
    throws OdaException
  {
    return 8;
  }
  
  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.ws.impl.ResultSetMetaData
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.datatools.enablement.oda.ws.soap;

public class SOAPParameter
{
  private int id;
  private String name;
  private int type;
  private String value;
  private boolean used = true;
  private int minOccurs = 1;
  private int maxOccurs = 1;
  
  public SOAPParameter(int id, String name)
  {
    this(id, name, 12);
  }
  
  public SOAPParameter(int id, String name, int type)
  {
    this(id, name, type, "");
  }
  
  public SOAPParameter(int id, String name, String defaultValue)
  {
    this(id, name, 12, defaultValue);
  }
  
  public SOAPParameter(int id, String name, int type, String defaultValue)
  {
    this.id = id;
    this.name = name;
    this.type = type;
    value = defaultValue;
  }
  
  public int getId()
  {
    return id;
  }
  
  public String getName()
  {
    return name;
  }
  
  public int getType()
  {
    return type;
  }
  
  public String getDefaultValue()
  {
    return value;
  }
  
  public void setDefaultValue(String value)
  {
    this.value = value;
  }
  
  public boolean isUsed()
  {
    return used;
  }
  
  public void setUsed(boolean used)
  {
    this.used = used;
  }
  
  public int getMinOccurs()
  {
    return minOccurs;
  }
  
  public void setMinOccurs(int minOccurs)
  {
    this.minOccurs = minOccurs;
  }
  
  public int getMaxOccurs()
  {
    return maxOccurs;
  }
  
  public void setMaxOccurs(int maxOccurs)
  {
    this.maxOccurs = maxOccurs;
  }
}

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

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.datatools.enablement.oda.ws.util.WSUtil;

public class SOAPRequest
{
  private static final String RE_PARAMETER = "\\Q&?\\E\\w+\\Q?&\\E";
  private String[] template;
  private SOAPParameter[] parameters;
  
  public SOAPRequest(String queryText)
  {
    if (WSUtil.isNull(queryText)) {
      return;
    }
    generateTemplate(queryText);
    generateParameters(queryText);
  }
  
  private void generateTemplate(String queryText)
  {
    template = queryText.split("\\Q&?\\E\\w+\\Q?&\\E");
  }
  
  private void generateParameters(String queryText)
  {
    if ((!WSUtil.isNull(template)) && (template.length > 1))
    {
      parameters = new SOAPParameter[template.length - 1];
      int paramId = -1;
      Pattern pattern = Pattern.compile("\\Q&?\\E\\w+\\Q?&\\E");
      Matcher matcher = pattern.matcher(queryText);
      while (matcher.find())
      {
        String paramName = queryText.substring(matcher.start() + 2, 
          matcher.end() - 2);
        parameters[(++paramId)] = new SOAPParameter(paramId + 1, 
          paramName);
      }
    }
  }
  
  public String[] getTemplate()
  {
    return template;
  }
  
  public SOAPParameter[] getParameters()
  {
    return parameters;
  }
  
  public void setParameterValue(int parameterId, String value)
  {
    if ((!WSUtil.isNull(parameters)) && (parameters.length >= parameterId)) {
      parameters[(parameterId - 1)].setDefaultValue(value);
    }
  }
  
  public void setParameterValue(String name, String value)
  {
    if ((!WSUtil.isNull(parameters)) && (!WSUtil.isNull(name))) {
      for (int i = 0; i < parameters.length; i++) {
        if (parameters[i].getName().equals(name)) {
          parameters[i].setDefaultValue(value);
        }
      }
    }
  }
  
  public String toXML()
  {
    if (template == null) {
      return "";
    }
    if (parameters == null) {
      return template[(template.length - 1)];
    }
    StringBuffer soapRequest = new StringBuffer();
    for (int i = 0; i < parameters.length; i++)
    {
      soapRequest.append(template[i]);
      soapRequest.append(parameters[i].getDefaultValue());
    }
    soapRequest.append(template[(template.length - 1)]);
    
    return soapRequest.toString();
  }
}

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

import java.io.IOException;
import java.io.InputStream;
import org.eclipse.datatools.enablement.oda.ws.util.WSUtil;

public class SOAPResponse
{
  public static final int INPUT_STREAM = 0;
  public static final int ERROR_STREAM = 1;
  private InputStream inputStream;
  private int streamType;
  private String streamInfo = "";
  
  public SOAPResponse(InputStream inputStream)
  {
    this(inputStream, 0, "");
  }
  
  public SOAPResponse(InputStream inputStream, int streamType, String streamInfo)
  {
    this.inputStream = inputStream;
    this.streamType = streamType;
    this.streamInfo = streamInfo;
  }
  
  public InputStream getInputStream()
  {
    return inputStream;
  }
  
  public int getStreamType()
  {
    return streamType;
  }
  
  public String getStreamInfo()
  {
    return streamInfo;
  }
  
  public void close()
    throws IOException
  {
    if (WSUtil.isNull(inputStream)) {
      return;
    }
    inputStream.close();
  }
}

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

import java.io.IOException;
import java.io.InputStream;

class CompositeInputStream
  extends InputStream
{
  private byte[] buf;
  private int pos;
  private InputStream stream;
  
  public CompositeInputStream(byte[] buffer, InputStream stream)
  {
    buf = buffer;
    this.stream = stream;
    pos = 0;
  }
  
  public synchronized int read()
    throws IOException
  {
    if (pos < buf.length) {
      return buf[(pos++)] & 0xFF;
    }
    pos += 1;
    return stream.read();
  }
  
  public synchronized int read(byte[] b, int off, int len)
    throws IOException
  {
    if (pos + len <= buf.length)
    {
      System.arraycopy(buf, pos, b, off, len);
      pos += len;
      return len;
    }
    if (pos < buf.length)
    {
      int readLen = buf.length - pos;
      System.arraycopy(buf, pos, b, off, readLen);
      int sReadLen = readFromStream(stream, b, off + readLen, len - readLen);
      if (sReadLen != -1) {
        readLen += sReadLen;
      }
      pos += readLen;
      return readLen;
    }
    int readLen = readFromStream(stream, b, off, len);
    if (readLen != -1) {
      pos += readLen;
    }
    return readLen;
  }
  
  private int readFromStream(InputStream is, byte[] b, int off, int len)
    throws IOException
  {
    int readLen = 0;
    int oneTimeReadLen = -1;
    do
    {
      oneTimeReadLen = stream.read(b, off + readLen, len - readLen);
      if (oneTimeReadLen >= 0) {
        readLen += oneTimeReadLen;
      }
    } while ((oneTimeReadLen >= 0) && (readLen < len));
    if (readLen == 0) {
      return -1;
    }
    return readLen;
  }
  
  public synchronized long skip(long n)
    throws IOException
  {
    if (pos + n <= buf.length)
    {
      pos = ((int)(pos + n));
      return n;
    }
    if (pos < buf.length)
    {
      pos = ((int)(pos + n));
      return stream.skip(pos - buf.length);
    }
    return stream.skip(n);
  }
  
  public synchronized int available()
    throws IOException
  {
    return stream.available() + buf.length - pos;
  }
  
  public boolean markSupported()
  {
    return false;
  }
  
  public void mark(int readAheadLimit) {}
  
  public synchronized void reset() {}
  
  public void close()
    throws IOException
  {
    stream.close();
  }
}

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

public class Constants
{
  public static final String SOAP_ENDPOINT = "soapEndPoint";
  public static final String CUSTOM_CONNECTION_CLASS = "connectionClass";
  public static final String CONNECTION_TIMEOUT = "connectionTimeOut";
  public static final String CUSTOM_DRIVER_CLASS_PATH = "driverClassPath";
  public static final String WSDL_URI = "wsdlURI";
  public static final String INPUTSTREAM_XML = "org.eclipse.birt.report.data.oda.xml.inputStream";
  public static final String XML_FILE_URI = "xmlFileURI";
  public static final String XSD_FILE_URI = "xsdFileURI";
  public static final String WS_QUERYTEXT = "wsQueryText";
  public static final String XML_TEMP_FILE_URI = "xmlTempFileURI";
  public static final String RESPONSE_SCHEMA = "ResponseSchema";
  public static final String FROM_WS_SERVER = "FromWSServer";
  public static final String FROM_WSDL = "FromWSDL";
  public static final String OPERATION_TRACE = "operationTrace";
  public static final String XML_QUERYTEXT = "xmlQueryText";
  public static final String DATA_SOURCE_ID = "org.eclipse.datatools.enablement.oda.ws";
  public static final String DIRECTORY_LIB = "lib";
}

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

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.util.manifest.ExtensionManifest;
import org.eclipse.datatools.connectivity.oda.util.manifest.ManifestExplorer;
import org.eclipse.datatools.enablement.oda.ws.api.IWSConnection;
import org.eclipse.datatools.enablement.oda.ws.api.IWSDriver;

public class Java2SOAPManager
{
  private static final String METHOD_CONNECT = "connect";
  private static final String METHOD_QUERY = "executeQuery";
  private static final String METHOD_CLOSE = "close";
  private static final String semicolon = ";";
  private Map connectionProperties;
  private Map appConext;
  private String queryText;
  private Map parameterValues;
  private Map queryProperties;
  private Object aQuery;
  
  public void newQuery(String className)
    throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException, OdaException, IOException, URISyntaxException
  {
    Class clazz = loadClass(className);
    
    newQuery(clazz);
  }
  
  private void newQuery(Class clazz)
    throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
  {
    try
    {
      Object driver = null;
      driver = clazz.newInstance();
      if ((driver instanceof IWSDriver))
      {
        aQuery = ((IWSDriver)driver).connect(connectionProperties, 
          getAppConext());
        return;
      }
    }
    catch (InstantiationException localInstantiationException) {}catch (IllegalAccessException localIllegalAccessException) {}
    Class[] parameterTypes = {
      Map.class, Map.class };
    
    Object[] arguments = {
      connectionProperties, getAppConext() };
    
    Method connect = clazz.getMethod("connect", parameterTypes);
    
    aQuery = connect.invoke(clazz.newInstance(), arguments);
  }
  
  public void newQuery(String className, String driverPath)
    throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException, OdaException, IOException, URISyntaxException
  {
    URL[] urlList = (URL[])null;
    if (driverPath != null)
    {
      String[] dPath = driverPath.split(";");
      
      urlList = new URL[dPath.length];
      for (int i = 0; i < dPath.length; i++)
      {
        File file = new File(dPath[i].toString());
        urlList[i] = file.toURI().toURL();
      }
    }
    Class clazz = loadClass(className, urlList);
    
    newQuery(clazz);
  }
  
  public Object executeQuery()
    throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException
  {
    if (WSUtil.isNull(aQuery)) {
      return null;
    }
    if ((aQuery instanceof IWSConnection)) {
      return ((IWSConnection)aQuery).executeQuery(queryText, 
        parameterValues, 
        queryProperties);
    }
    Class clazz = aQuery.getClass();
    Class[] parameterTypes = {
      String.class, Map.class, Map.class };
    
    Object[] arguments = {
      queryText, parameterValues, queryPr
1 2 3

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