teiid SVN: r2014 - in trunk: engine/src/main/java/com/metamatrix/query/optimizer/relational and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-31 18:15:05 -0400 (Wed, 31 Mar 2010)
New Revision: 2014
Modified:
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
Log:
TEIID-1026 logging annotation information if we're at the detail level
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-03-31 21:44:15 UTC (rev 2013)
+++ trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-03-31 22:15:05 UTC (rev 2014)
@@ -57,7 +57,7 @@
private PrintWriter debugWriter; // public
public AnalysisRecord(boolean recordQueryPlan, boolean recordDebug) {
- this.recordQueryPlan = recordQueryPlan;
+ this.recordQueryPlan = recordQueryPlan | LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.DETAIL);
this.logDebug = recordDebug;
this.recordDebug = recordDebug | LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.TRACE);
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-03-31 21:44:15 UTC (rev 2013)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-03-31 22:15:05 UTC (rev 2014)
@@ -262,8 +262,9 @@
if(! appliedHint) {
String msg = QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName);
- LogManager.logInfo(LogConstants.CTX_QUERY_PLANNER, msg);
- this.analysisRecord.addAnnotation(new QueryAnnotation(QueryAnnotation.HINTS, msg, "ignoring hint", QueryAnnotation.MEDIUM)); //$NON-NLS-1$
+ if (this.analysisRecord.recordAnnotations()) {
+ this.analysisRecord.addAnnotation(new QueryAnnotation(QueryAnnotation.HINTS, msg, "ignoring hint", QueryAnnotation.MEDIUM)); //$NON-NLS-1$
+ }
}
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-31 21:44:15 UTC (rev 2013)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-31 22:15:05 UTC (rev 2014)
@@ -453,6 +453,9 @@
if(debugLog != null && debugLog.length() > 0) {
LogManager.log(analysisRecord.logDebug()?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);
}
+ if (analysisRecord.recordAnnotations() && analysisRecord.getAnnotations() != null && !analysisRecord.getAnnotations().isEmpty()) {
+ LogManager.logDetail(LogConstants.CTX_QUERY_PLANNER, analysisRecord.getAnnotations());
+ }
}
LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { DQPPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
} catch (QueryMetadataException e) {
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-03-31 21:44:15 UTC (rev 2013)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-03-31 22:15:05 UTC (rev 2014)
@@ -31,16 +31,16 @@
import org.mockito.Mockito;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.connector.jdbc.oracle.OracleCapabilities;
-import org.teiid.dqp.internal.datamgr.impl.CapabilitiesConverter;
-import org.teiid.metadata.CompositeMetadataStore;
+import org.teiid.connector.api.SourceSystemFunctions;
import org.teiid.metadata.TransformationMetadata;
import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.processor.HardcodedDataManager;
import com.metamatrix.query.unittest.TimestampUtil;
@@ -55,7 +55,11 @@
//NOTE that the gMonth and gDay values are invalid (but properly formatted)
public void testXSDTranslations() throws Exception {
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
- finder.addCapabilities("sample", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
+ BasicSourceCapabilities bsc = new BasicSourceCapabilities();
+ bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+ bsc.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+ finder.addCapabilities("sample", bsc); //$NON-NLS-1$
QueryMetadataInterface metadata = createMetadata(UnitTestUtil.getTestDataPath()+"/test.vdb"); //$NON-NLS-1$
@@ -63,7 +67,7 @@
HardcodedDataManager dataMgr = new HardcodedDataManager();
- Set models = new HashSet();
+ Set<String> models = new HashSet<String>();
models.add("sample"); //$NON-NLS-1$
dataMgr.setValidModels(models);
@@ -91,7 +95,7 @@
public void testGetXmlSchemas() throws Exception {
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
- finder.addCapabilities("sample", CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
+ finder.addCapabilities("sample", new BasicSourceCapabilities()); //$NON-NLS-1$
TransformationMetadata metadata = createMetadata(UnitTestUtil.getTestDataPath()+"/test.vdb"); //$NON-NLS-1$
14 years, 8 months
teiid SVN: r2013 - in trunk: client/src/main/java/org/teiid/adminapi and 12 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-31 17:44:15 -0400 (Wed, 31 Mar 2010)
New Revision: 2013
Added:
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java
trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java
Removed:
trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/FakeCryptor.java
trunk/jboss-integration/src/test/java/com/
Modified:
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/client/src/main/java/org/teiid/net/socket/Message.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java
trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/pom.xml
trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-943 adding streaming from server to client using the same method as client to server.
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -22,7 +22,8 @@
package org.teiid.adminapi;
-import java.net.URL;
+import java.io.InputStream;
+import java.io.Reader;
import java.util.Collection;
import java.util.Properties;
import java.util.Set;
@@ -60,10 +61,10 @@
* Add Connector Type, will import Connector Type from a file
*
* @param name of the Connector Type to add
- * @param URL URL to RAR file
+ * @param rar RAR file
* @throws AdminException if there's a system error.
*/
- void addConnectorType(String name, URL rarURL) throws AdminException;
+ void addConnectorType(String name, InputStream rar) throws AdminException;
/**
* Delete Connector Type from Next Configuration
@@ -81,7 +82,7 @@
* @return InputStream of contents of the rar file
* @throws AdminException if there's a system error.
*/
- byte[] exportConnectorType(String name) throws AdminException;
+ InputStream exportConnectorType(String name) throws AdminException;
/**
* Deploy a {@link ConnectorBinding} to Configuration
@@ -106,21 +107,21 @@
* Export a {@link ConnectorBinding} to character Array in XML format
*
* @param deployedName the unique identifier for a {@link ConnectorBinding}.
- * @return character Array in XML format
+ * @return Reader in XML format
* @throws AdminException
* if there's a system error.
*/
- char[] exportConnectorBinding(String deployedName) throws AdminException;
+ Reader exportConnectorBinding(String deployedName) throws AdminException;
/**
* Deploy a {@link VDB} file.
* @param name Name of the VDB file to save under
- * @param URL VDB file location.
+ * @param VDB VDB.
* @throws AdminException
* if there's a system error.
* @return the {@link VDB} representing the current property values and runtime state.
*/
- public void deployVDB(String fileName, URL vdbURL) throws AdminException;
+ public void deployVDB(String fileName, InputStream vdb) throws AdminException;
/**
@@ -139,7 +140,7 @@
* @return InputStream of the VDB
* @throws AdminException if there's a system error.
*/
- byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException;
+ InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException;
/**
* Set a process level property.
@@ -354,4 +355,5 @@
* Closes the admin connection
*/
void close();
+
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Properties;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -123,11 +122,6 @@
}
@Override
- public Properties getProperties() {
- return new Properties(super.getProperties());
- }
-
- @Override
@XmlElement(name = "property", type = PropertyMetadata.class)
@ManagementProperty(description = "Model Properties", managed=true)
public List<PropertyMetadata> getJAXBProperties(){
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -228,11 +228,6 @@
return list;
}
- @Override
- public Properties getProperties() {
- return super.getProperties();
- }
-
// This one manages the JAXB binding
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
Modified: trunk/client/src/main/java/org/teiid/net/socket/Message.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/Message.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/net/socket/Message.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -31,24 +31,24 @@
public class Message implements Externalizable {
public static final long serialVersionUID = 1063704220782714098L;
- private Serializable contents;
+ private Object contents;
private Serializable messageKey;
public String toString() {
return "MessageHolder: contents=" + contents; //$NON-NLS-1$
}
- public void setContents(Serializable contents) {
+ public void setContents(Object contents) {
this.contents = contents;
}
- public Serializable getContents() {
+ public Object getContents() {
return contents;
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.contents = (Serializable) in.readObject();
+ this.contents = in.readObject();
this.messageKey = (Serializable) in.readObject();
}
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -60,7 +60,7 @@
static final int TYPE_PRIMITIVE = 0;
static final int TYPE_NON_PRIMITIVE = 1;
- private List<InputStream> lobs = new LinkedList<InputStream>();
+ private List<InputStream> streams = new LinkedList<InputStream>();
private List<StreamFactoryReference> references = new LinkedList<StreamFactoryReference>();
public CompactObjectOutputStream(OutputStream out) throws IOException {
@@ -68,8 +68,8 @@
enableReplaceObject(true);
}
- public List<InputStream> getLobs() {
- return lobs;
+ public List<InputStream> getStreams() {
+ return streams;
}
public List<StreamFactoryReference> getReferences() {
@@ -99,27 +99,27 @@
}
try {
if (obj instanceof Reader) {
- lobs.add(new ReaderInputStream((Reader)obj, Charset.forName(Streamable.ENCODING)));
+ streams.add(new ReaderInputStream((Reader)obj, Charset.forName(Streamable.ENCODING)));
StreamFactoryReference sfr = new SerializableReader();
references.add(sfr);
return sfr;
} else if (obj instanceof InputStream) {
- lobs.add((InputStream)obj);
+ streams.add((InputStream)obj);
StreamFactoryReference sfr = new SerializableInputStream();
references.add(sfr);
return sfr;
} else if (obj instanceof SQLXML) {
- lobs.add(new ReaderInputStream(((SQLXML)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
+ streams.add(new ReaderInputStream(((SQLXML)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
StreamFactoryReference sfr = new SQLXMLImpl((InputStreamFactory)null);
references.add(sfr);
return sfr;
} else if (obj instanceof Clob) {
- lobs.add(new ReaderInputStream(((Clob)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
+ streams.add(new ReaderInputStream(((Clob)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
StreamFactoryReference sfr = new ClobImpl(null, -1);
references.add(sfr);
return sfr;
} else if (obj instanceof Blob) {
- lobs.add(((Blob)obj).getBinaryStream());
+ streams.add(((Blob)obj).getBinaryStream());
StreamFactoryReference sfr = new BlobImpl(null);
references.add(sfr);
return sfr;
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -22,14 +22,26 @@
*/
package org.teiid.netty.handler.codec.serialization;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
+import java.io.OutputStream;
import java.io.StreamCorruptedException;
+import java.util.List;
+import com.metamatrix.common.types.InputStreamFactory;
+import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
+import com.metamatrix.core.util.ExternalizeUtil;
+
/**
* An {@link ObjectInput} which is interoperable with {@link ObjectEncoder}
* and {@link ObjectEncoderOutputStream}.
@@ -49,6 +61,11 @@
private boolean foundLength;
private byte[] buffer;
private int count;
+
+ private Object result;
+ private int streamIndex;
+ private OutputStream stream;
+ private List<StreamFactoryReference> streams;
public ObjectDecoderInputStream(InputStream in, ClassLoader classLoader, int maxObjectSize) throws SecurityException, IOException {
super();
@@ -60,35 +77,93 @@
@Override
protected final Object readObjectOverride() throws IOException,
ClassNotFoundException {
- if (!foundLength) {
- if (buffer == null) {
- buffer = new byte[4];
- }
- fillBuffer();
- int dataLen = getIntFromBytes(buffer);
- if (dataLen <= 0) {
- throw new StreamCorruptedException("invalid data length: " + dataLen); //$NON-NLS-1$
+ if (result == null) {
+ if (!foundLength) {
+ int dataLen = findLength(4);
+ if (dataLen <= 0) {
+ throw new StreamCorruptedException("invalid data length: " + dataLen); //$NON-NLS-1$
+ }
+ if (dataLen > maxObjectSize) {
+ throw new StreamCorruptedException(
+ "data length too big: " + dataLen + " (max: " + maxObjectSize + ')'); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
- if (dataLen > maxObjectSize) {
- throw new StreamCorruptedException(
- "data length too big: " + dataLen + " (max: " + maxObjectSize + ')'); //$NON-NLS-1$ //$NON-NLS-2$
+ fillBuffer();
+ foundLength = false;
+ ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
+ buffer = null;
+ CompactObjectInputStream cois = new CompactObjectInputStream(bais, classLoader);
+ result = cois.readObject();
+ streams = ExternalizeUtil.readList(cois, StreamFactoryReference.class);
+ streamIndex = 0;
+ }
+ while (streamIndex < streams.size()) {
+ if (!foundLength) {
+ findLength(2);
+ }
+ if (stream == null) {
+ final File f = File.createTempFile("teiid", null); //$NON-NLS-1$
+ StreamFactoryReference sfr = streams.get(streamIndex);
+ sfr.setStreamFactory(new InputStreamFactory(Streamable.ENCODING) {
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new BufferedInputStream(new FileInputStream(f)) {
+ @Override
+ public void close() throws IOException {
+ super.close();
+ f.delete();
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ f.delete();
+ }
+ };
+ }
+
+ });
+ this.stream = new BufferedOutputStream(new FileOutputStream(f));
}
- //check if the underlying buffer can be used
- if (in.available() >= dataLen) {
- return new CompactObjectInputStream(in, classLoader).readObject();
+ if (buffer.length == 0) {
+ stream.close();
+ stream = null;
+ streamIndex++;
+ foundLength = false;
+ buffer = null;
+ continue;
}
- buffer = new byte[dataLen];
- foundLength = true;
- }
- fillBuffer();
- foundLength = false;
- ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
- buffer = null;
- return new CompactObjectInputStream(bais, classLoader).readObject();
+ fillBuffer();
+ foundLength = false;
+ this.stream.write(buffer);
+ buffer = null;
+ }
+ Object toReturn = result;
+ result = null;
+ streams = null;
+ stream = null;
+ return toReturn;
}
+ private int findLength(int bytes) throws IOException, EOFException,
+ StreamCorruptedException {
+ if (buffer == null) {
+ buffer = new byte[bytes];
+ }
+ fillBuffer();
+ int dataLen = getIntFromBytes(buffer);
+ buffer = new byte[dataLen];
+ foundLength = true;
+ return dataLen;
+ }
+
static int getIntFromBytes(byte[] buffer) {
- return ((buffer[0] & 0xff) << 24) + ((buffer[1] & 0xff) << 16) + ((buffer[2] & 0xff) << 8) + (buffer[3] & 0xff);
+ int result = 0;
+ for (int i = 0; i < buffer.length; i++) {
+ result += ((buffer[i] & 0xff) << (buffer.length - i - 1)*8);
+ }
+ return result;
}
private void fillBuffer() throws IOException, EOFException {
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -64,11 +64,12 @@
out.writeInt(baos.getCount()); //includes the lob references
out.write(baos.getBuffer(), 0, baos.getCount());
byte[] chunk = new byte[1 << 16];
- for (InputStream is : oout.getLobs()) {
+ for (InputStream is : oout.getStreams()) {
while (true) {
int bytes = is.read(chunk);
out.writeShort(Math.max(0, bytes));
if (bytes < 1) {
+ is.close();
break;
}
out.write(chunk, 0, bytes);
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -128,7 +128,7 @@
}
}
- public synchronized Serializable unsealObject(Serializable object) throws CryptoException {
+ public synchronized Object unsealObject(Object object) throws CryptoException {
if (!(object instanceof SealedObject)) {
return object;
@@ -137,7 +137,7 @@
SealedObject so = (SealedObject)object;
try {
- return (Serializable)so.getObject(decryptCipher);
+ return so.getObject(decryptCipher);
} catch ( Exception e ) {
try {
initDecryptCipher();
@@ -204,9 +204,12 @@
}
}
- public synchronized Serializable sealObject(Serializable object) throws CryptoException {
+ public synchronized Object sealObject(Object object) throws CryptoException {
+ if (object != null && !(object instanceof Serializable)) {
+ throw new CryptoException(ErrorMessageKeys.CM_UTIL_ERR_0081, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0081, "not Serializable")); //$NON-NLS-1$
+ }
try {
- return new SealedObject(object, encryptCipher);
+ return new SealedObject((Serializable)object, encryptCipher);
} catch ( Exception e ) {
try {
initEncryptCipher();
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -22,7 +22,6 @@
package com.metamatrix.common.util.crypto;
-import java.io.Serializable;
/**
* Interface defining a utility that can perform both encryption and decryption.
@@ -43,7 +42,7 @@
*/
String encrypt( String cleartext ) throws CryptoException;
- Serializable sealObject(Serializable object) throws CryptoException;
+ Object sealObject(Object object) throws CryptoException;
/**
* Decrypt the ciphertext in byte array format to yield the original
@@ -61,6 +60,6 @@
*/
String decrypt( String ciphertext ) throws CryptoException;
- Serializable unsealObject(Serializable object) throws CryptoException;
+ Object unsealObject(Object object) throws CryptoException;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -22,7 +22,6 @@
package com.metamatrix.common.util.crypto;
-import java.io.Serializable;
public class NullCryptor implements Cryptor {
@@ -34,7 +33,7 @@
return cleartext;
}
- public Serializable sealObject(Serializable object) throws CryptoException {
+ public Object sealObject(Object object) throws CryptoException {
return object;
}
@@ -46,7 +45,7 @@
return ciphertext;
}
- public Serializable unsealObject(Serializable object)
+ public Object unsealObject(Object object)
throws CryptoException {
return object;
}
Deleted: trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/FakeCryptor.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/FakeCryptor.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/FakeCryptor.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.util.crypto;
-
-import java.io.Serializable;
-
-/**
- * This class implements the {@link com.metamatrix.common.util.crypto.Cryptor Cryptor}
- * interface with methods that return fake data.
- * <br></br>
- * It is used to provide testing of cryptographic functionality without actually
- * doing encryption or decryption.
- */
-public class FakeCryptor implements Cryptor, Serializable {
- private String fakeEncrypted;
- private String fakeDecrypted;
-
- public FakeCryptor(String fakeEncrypted, String fakeDecrypted) {
- this.fakeEncrypted = fakeEncrypted;
- this.fakeDecrypted = fakeDecrypted;
- }
-
- /**
- * Decrypt the ciphertext in byte array format to yield the original
- * cleartext.
- * @param ciphertext The text to be encrypted, in byte form
- * @param The decrypted cleartext, in byte form
- */
- public byte[] decrypt(byte[] ciphertext) throws CryptoException {
- if (ciphertext.length > 100) {
- throw new CryptoException("can't decrypt: too long"); //$NON-NLS-1$
- }
- return fakeDecrypted.getBytes();
- }
-
- /**
- * Decrypt the ciphertext in character array format to yield the original
- * cleartext. This requires a byte-to-char encoding.
- * @param ciphertext The text to be encrypted, in character form
- * @param The decrypted cleartext, in character form
- */
- public String decrypt(String ciphertext) throws CryptoException {
- if (ciphertext.length() > 100) {
- throw new CryptoException("can't decrypt: too long"); //$NON-NLS-1$
- }
- return fakeDecrypted;
- }
-
- /**
- * Encrypt the cleartext in character array format. This requires
- * a byte-to-char encoding.
- * @param cleartext The text to be encrypted, in character form
- * @param The encrypted ciphertext, in character form
- */
- public String encrypt(String cleartext) throws CryptoException {
- if (cleartext.length() > 100) {
- throw new CryptoException("can't encrypt: too long"); //$NON-NLS-1$
- }
- return fakeEncrypted;
- }
-
- /**
- * Encrypt the cleartext in byte array format.
- * @param cleartext The text to be encrypted, in byte form
- * @param The encrypted ciphertext, in byte form
- */
- public byte[] encrypt(byte[] cleartext) throws CryptoException {
- if (cleartext.length > 100) {
- throw new CryptoException("can't encrypt: too long"); //$NON-NLS-1$
- }
- return fakeEncrypted.getBytes();
- }
-
- /**
- * @see com.metamatrix.common.util.crypto.Encryptor#sealObject(java.io.Serializable)
- */
- public Serializable sealObject(Serializable object) throws CryptoException {
- return fakeEncrypted;
- }
-
- /**
- * @see com.metamatrix.common.util.crypto.Decryptor#unsealObject(java.io.Serializable)
- */
- public Serializable unsealObject(Serializable object) throws CryptoException {
- return fakeDecrypted;
- }
-}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -29,7 +29,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -198,7 +197,7 @@
ArrayList test = new ArrayList(Arrays.asList(new String[] {ALPHA_L, ALPHA_U, CLEARTEXT, NUMBERS}));
- Serializable result = randomSymCryptor.sealObject(test);
+ Object result = randomSymCryptor.sealObject(test);
//ensure that we can serialize
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -207,7 +206,7 @@
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
- result = (Serializable)ois.readObject();
+ result = ois.readObject();
ArrayList clearObject = (ArrayList)randomSymCryptor.unsealObject(result);
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -23,10 +23,12 @@
package org.teiid.adminapi.jboss;
import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -86,8 +88,6 @@
import org.teiid.jboss.IntegrationPlugin;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-import com.metamatrix.core.util.FileUtils;
-
public class Admin extends TeiidAdmin {
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
@@ -174,20 +174,18 @@
}
@Override
- public char[] exportConnectorBinding(String deployedName) throws AdminException {
+ public Reader exportConnectorBinding(String deployedName) throws AdminException {
ManagedComponent mc = getConnectorBindingComponent(deployedName);
if (mc != null) {
- return new String(exportDeployment(mc.getDeployment().getName()).toByteArray()).toCharArray();
+ return new InputStreamReader(exportDeployment(mc.getDeployment().getName()));
}
return null;
}
- private ByteArrayOutputStream exportDeployment(String url) throws AdminComponentException {
+ private InputStream exportDeployment(String url) throws AdminComponentException {
try {
URL contentURL = new URL(url);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- FileUtils.write(contentURL.openStream(), bos, FileUtils.DEFAULT_BUFFER_SIZE);
- return bos;
+ return contentURL.openStream();
} catch (MalformedURLException e) {
throw new AdminComponentException(e);
} catch (IOException e) {
@@ -382,11 +380,11 @@
}
@Override
- public void deployVDB(String fileName, URL vdbURL) throws AdminException {
+ public void deployVDB(String fileName, InputStream vdb) throws AdminException {
if (!fileName.endsWith(".vdb") && !fileName.endsWith("-vdb.xml")) {//$NON-NLS-1$ //$NON-NLS-2$
throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_vdb_extension")); //$NON-NLS-1$
}
- ManagedUtil.deployArchive(getDeploymentManager(), fileName, vdbURL, false);
+ ManagedUtil.deployArchive(getDeploymentManager(), fileName, vdb, false);
}
@@ -399,10 +397,10 @@
}
@Override
- public byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException{
+ public InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException{
ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
if (mc != null) {
- return exportDeployment(mc.getDeployment().getName()).toByteArray();
+ return exportDeployment(mc.getDeployment().getName());
}
return null;
}
@@ -592,7 +590,7 @@
}
@Override
- public void addConnectorType(String connectorName, URL rarURL) throws AdminException{
+ public void addConnectorType(String connectorName, InputStream rar) throws AdminException{
if (!connectorName.startsWith("connector-")) {//$NON-NLS-1$
throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name")); //$NON-NLS-1$
}
@@ -606,7 +604,7 @@
throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_exists", deployerName)); //$NON-NLS-1$
}
- ManagedUtil.deployArchive(getDeploymentManager(), connectorName, rarURL, false);
+ ManagedUtil.deployArchive(getDeploymentManager(), connectorName, rar, false);
//also need to add a template for the properties
try {
@@ -635,19 +633,17 @@
}
@Override
- public byte[] exportConnectorType(String connectorName) throws AdminException {
+ public InputStream exportConnectorType(String connectorName) throws AdminException {
if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
connectorName = connectorName + ".rar";//$NON-NLS-1$
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
- return exportDeployment(deployerName).toByteArray();
+ return exportDeployment(deployerName);
}
return null;
}
-
-
@Override
public Collection<String> getCacheTypes() throws AdminException {
try {
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -21,9 +21,14 @@
*/
package org.teiid.adminapi.jboss;
+import java.io.IOException;
+import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.net.MalformedURLException;
import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -50,6 +55,7 @@
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.profileservice.spi.DeploymentOption;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.jboss.IntegrationPlugin;
import com.metamatrix.core.MetaMatrixRuntimeException;
@@ -96,7 +102,7 @@
SimpleValue simple = (SimpleValue)v1;
return simple.getValue().toString();
}
- throw new MetaMatrixRuntimeException("Failed to convert value to string value");
+ throw new MetaMatrixRuntimeException("Failed to convert value to string value"); //$NON-NLS-1$
}
return null;
}
@@ -113,7 +119,7 @@
EnumValue enumValue = (EnumValue)mp.getValue();
return expectedType.cast((enumValue != null) ? enumValue.getValue() : null);
}
- throw new IllegalStateException(prop+ " is not a simple type");
+ throw new IllegalArgumentException(prop+ " is not a simple type"); //$NON-NLS-1$
}
return null;
}
@@ -135,7 +141,7 @@
}
return props;
}
- throw new IllegalStateException(prop+ " is not a properties type");
+ throw new IllegalArgumentException(prop+ " is not a properties type"); //$NON-NLS-1$
}
return null;
}
@@ -152,7 +158,7 @@
list.add(expectedType.cast(simpleValue.getValue()));
}
else {
- throw new IllegalStateException(prop+ " is not a simple type");
+ throw new IllegalArgumentException(prop+ " is not a simple type"); //$NON-NLS-1$
}
}
}
@@ -181,9 +187,9 @@
return new SimpleValueSupport(st,value.charAt(0));
} else if (SimpleMetaType.DATE.equals(st)) {
try {
- return new SimpleValueSupport(st, new SimpleDateFormat().parse(value));
+ return new SimpleValueSupport(st, SimpleDateFormat.getInstance().parse(value));
} catch (ParseException e) {
- throw new MetaMatrixRuntimeException("Failed to convert the String to date value");
+ throw new MetaMatrixRuntimeException(e, IntegrationPlugin.Util.getString("failed_to_convert", type.getClassName())); //$NON-NLS-1$
}
} else if (SimpleMetaType.DOUBLE.equals(st)) {
return new SimpleValueSupport(st, Double.valueOf(value));
@@ -209,23 +215,24 @@
return new SimpleValueSupport(st,value);
}
}
- throw new MetaMatrixRuntimeException("Failed to convert from String value to \""+ type.getClassName() +"\" type");
+ throw new MetaMatrixRuntimeException(IntegrationPlugin.Util.getString("failed_to_convert", type.getClassName())); //$NON-NLS-1$
}
+ public static void deployArchive(DeploymentManager deploymentManager, String fileName, final InputStream resource, boolean deployExploded) throws AdminProcessingException {
+ deployArchive(deploymentManager, fileName, getTempURL(resource), deployExploded);
+ }
public static void deployArchive(DeploymentManager deploymentManager, String fileName, URL resourceURL, boolean deployExploded) throws AdminProcessingException {
-
List<DeploymentOption> deploymentOptions = new ArrayList<DeploymentOption>();
deploymentOptions.add(DeploymentOption.FailIfExists);
if (deployExploded) {
deploymentOptions.add(DeploymentOption.Explode);
}
-
// try to deploy
DeploymentProgress progress = null;
try {
progress = deploymentManager.distribute(fileName, resourceURL, deploymentOptions.toArray(new DeploymentOption[deploymentOptions.size()]));
- execute(progress, fileName+" Distribute failed for unknown reason.");
+ execute(progress, IntegrationPlugin.Util.getString("distribute_failed", fileName)); //$NON-NLS-1$
} catch (Exception e) {
handleException(e);
}
@@ -235,11 +242,11 @@
String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
try {
progress = deploymentManager.start(deploymentNames);
- execute(progress, "Start of the deployment Failed");
+ execute(progress, IntegrationPlugin.Util.getString("deployment_start_failed", fileName)); //$NON-NLS-1$
} catch(Exception e) {
try {
// if failed to start remove it.
- execute(deploymentManager.remove(deploymentNames), "Failed to remove the deployment");
+ execute(deploymentManager.remove(deploymentNames), IntegrationPlugin.Util.getString("failed_to_remove")); //$NON-NLS-1$
} catch (Exception e1) {
handleException(e1);
}
@@ -247,6 +254,31 @@
}
}
+ static URL getTempURL(final InputStream resource) {
+ try {
+ return new URL(null, "temp:#temp", new URLStreamHandler() { //$NON-NLS-1$
+
+ @Override
+ protected URLConnection openConnection(URL u) throws IOException {
+ return new URLConnection(u) {
+
+ @Override
+ public void connect() throws IOException {
+
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return resource;
+ }
+ };
+ }
+ });
+ } catch (MalformedURLException e2) {
+ throw new MetaMatrixRuntimeException(e2);
+ }
+ }
+
public static void handleException(Exception e) throws AdminProcessingException {
if (e instanceof AdminProcessingException) {
throw (AdminProcessingException)e;
@@ -268,7 +300,7 @@
public static void removeArchive(DeploymentManager deploymentManager, String... deploymentNames) throws AdminProcessingException{
try {
- execute(deploymentManager.remove(deploymentNames), "Failed to remove the deployment");
+ execute(deploymentManager.remove(deploymentNames), IntegrationPlugin.Util.getString("failed_to_remove")); //$NON-NLS-1$
} catch (Exception e) {
handleException(e);
}
@@ -280,6 +312,6 @@
return mo.invoke(args);
}
}
- throw new MetaMatrixRuntimeException("No operation found with given name =" + operation);
+ throw new MetaMatrixRuntimeException(IntegrationPlugin.Util.getString("no_operation", operation)); //$NON-NLS-1$
}
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-03-31 21:44:15 UTC (rev 2013)
@@ -40,4 +40,9 @@
connector_stopped=Teiid connector {0} stopped
vdb_activated={0}.{1} status has been changed to active
vdb_inactivated={0}.{1} status has been changed to inactive. Check the connector mappings!
-jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
\ No newline at end of file
+jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
+no_operation=No operation found with given name = {0}
+failed_to_remove=Failed to remove the deployment
+distibute_failed={0} distribute failed.
+deployment_start_failed={0} deployment start failed
+failed_to_convert=Failed to convert from String value to {0} type
\ No newline at end of file
Added: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java (rev 0)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.jboss;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+
+import org.junit.Test;
+
+import com.metamatrix.core.util.ObjectConverterUtil;
+
+public class TestManagedUtil {
+
+ @Test public void testTempURL() throws Exception {
+ ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100]);
+ URL url = ManagedUtil.getTempURL(bais);
+ assertEquals(100, ObjectConverterUtil.convertToByteArray(url.openStream()).length);
+ }
+
+}
Property changes on: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/pom.xml 2010-03-31 21:44:15 UTC (rev 2013)
@@ -457,7 +457,7 @@
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.0.2.GA</version>
+ <version>3.1.5.GA</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
Modified: trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -127,19 +127,13 @@
new ChannelBufferInputStream(buffer, dataLen), classLoader);
result = cois.readObject();
streams = ExternalizeUtil.readList(cois, StreamFactoryReference.class);
+ streamIndex = 0;
}
while (streamIndex < streams.size()) {
if (buffer.readableBytes() < 2) {
return null;
}
- int dataLen = buffer.getShort(buffer.readerIndex()) & 0xff;
- if (dataLen == 0) {
- stream.close();
- stream = null;
- streamIndex++;
- buffer.skipBytes(2);
- continue;
- }
+ int dataLen = buffer.getShort(buffer.readerIndex()) & 0xffff;
if (buffer.readableBytes() < dataLen + 2) {
return null;
}
@@ -158,10 +152,18 @@
});
this.stream = new BufferedOutputStream(store.createOutputStream());
}
+ if (dataLen == 0) {
+ stream.close();
+ stream = null;
+ streamIndex++;
+ continue;
+ }
buffer.readBytes(this.stream, dataLen);
}
Object toReturn = result;
result = null;
+ streams = null;
+ stream = null;
return toReturn;
}
}
Added: trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid.transport;
+
+import static org.jboss.netty.buffer.ChannelBuffers.*;
+import static org.jboss.netty.channel.Channels.*;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferOutputStream;
+import org.jboss.netty.channel.ChannelDownstreamHandler;
+import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.channel.DownstreamMessageEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.handler.stream.ChunkedInput;
+import org.jboss.netty.handler.stream.ChunkedStream;
+import org.teiid.netty.handler.codec.serialization.CompactObjectOutputStream;
+import org.teiid.netty.handler.codec.serialization.ObjectDecoderInputStream;
+
+import com.metamatrix.core.util.ExternalizeUtil;
+
+/**
+ * An encoder which serializes a Java object into a {@link ChannelBuffer}.
+ * <p>
+ * Please note that the serialized form this encoder produces is not
+ * compatible with the standard {@link ObjectInputStream}. Please use
+ * {@link ObjectDecoder} or {@link ObjectDecoderInputStream} to ensure the
+ * interoperability with this encoder.
+ *
+ * @author The Netty Project (netty-dev(a)lists.jboss.org)
+ * @author Trustin Lee (tlee(a)redhat.com)
+ *
+ * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $
+ *
+ * @apiviz.landmark
+ * @apiviz.has org.jboss.netty.handler.codec.serialization.ObjectEncoderOutputStream - - - compatible with
+ */
+@ChannelPipelineCoverage("all")
+public class ObjectEncoder implements ChannelDownstreamHandler {
+ private static final byte[] LENGTH_PLACEHOLDER = new byte[4];
+ private static final int CHUNK_SIZE = 1 << 16;
+
+ private final int estimatedLength;
+
+ /**
+ * Creates a new encoder with the estimated length of 512 bytes.
+ */
+ public ObjectEncoder() {
+ this(512);
+ }
+
+ /**
+ * Creates a new encoder.
+ *
+ * @param estimatedLength
+ * the estimated byte length of the serialized form of an object.
+ * If the length of the serialized form exceeds this value, the
+ * internal buffer will be expanded automatically at the cost of
+ * memory bandwidth. If this value is too big, it will also waste
+ * memory bandwidth. To avoid unnecessary memory copy or allocation
+ * cost, please specify the properly estimated value.
+ */
+ public ObjectEncoder(int estimatedLength) {
+ if (estimatedLength < 0) {
+ throw new IllegalArgumentException(
+ "estimatedLength: " + estimatedLength);
+ }
+ this.estimatedLength = estimatedLength;
+ }
+
+ public void handleDownstream(
+ final ChannelHandlerContext ctx, ChannelEvent evt) throws Exception {
+ if (!(evt instanceof MessageEvent)) {
+ ctx.sendDownstream(evt);
+ return;
+ }
+
+ MessageEvent e = (MessageEvent) evt;
+
+ if (e.getMessage() instanceof ChunkedInput) {
+ ctx.sendDownstream(evt);
+ return;
+ }
+
+ ChannelBufferOutputStream bout =
+ new ChannelBufferOutputStream(dynamicBuffer(
+ estimatedLength, ctx.getChannel().getConfig().getBufferFactory()));
+ bout.write(LENGTH_PLACEHOLDER);
+ final CompactObjectOutputStream oout = new CompactObjectOutputStream(bout);
+ oout.writeObject(e.getMessage());
+ ExternalizeUtil.writeCollection(oout, oout.getReferences());
+ oout.flush();
+ oout.close();
+
+ ChannelBuffer encoded = bout.buffer();
+ encoded.setInt(0, encoded.writerIndex() - 4);
+ write(ctx, e.getFuture(), encoded, e.getRemoteAddress());
+ for (InputStream is : oout.getStreams()) {
+ Channels.write(ctx.getChannel(), new AnonymousChunkedStream(new BufferedInputStream(is, CHUNK_SIZE)));
+ }
+ }
+
+ static class AnonymousChunkedStream extends ChunkedStream {
+
+ public AnonymousChunkedStream(InputStream in) {
+ super(in, CHUNK_SIZE);
+ }
+
+ @Override
+ public Object nextChunk() throws Exception {
+ ChannelBuffer cb = (ChannelBuffer)super.nextChunk();
+ int length = cb.capacity();
+ ChannelBuffer prefix = wrappedBuffer(new byte[2]);
+ prefix.setShort(0, (short)length);
+ if (!hasNextChunk()) {
+ //append a 0 short
+ return wrappedBuffer(prefix, cb, wrappedBuffer(new byte[2]));
+ }
+
+ return wrappedBuffer(prefix, cb);
+ }
+
+ }
+
+}
Property changes on: trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -49,8 +49,8 @@
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
-import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
import org.jboss.netty.handler.ssl.SslHandler;
+import org.jboss.netty.handler.stream.ChunkedWriteHandler;
import org.teiid.net.NetPlugin;
import org.teiid.net.socket.ObjectChannel;
@@ -228,6 +228,7 @@
pipeline.addLast("ssl", new SslHandler(engine)); //$NON-NLS-1$
}
pipeline.addLast("decoder", new ObjectDecoder(1 << 20, classLoader, storageManager)); //$NON-NLS-1$
+ pipeline.addLast("chunker", new ChunkedWriteHandler()); //$NON-NLS-1$
pipeline.addLast("encoder", new ObjectEncoder()); //$NON-NLS-1$
pipeline.addLast("handler", this); //$NON-NLS-1$
return pipeline;
Modified: trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -83,11 +83,11 @@
throw e.getCause();
}
if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
- ResultsFuture<Serializable> future = (ResultsFuture<Serializable>) methodResult;
- future.addCompletionListener(new ResultsFuture.CompletionListener<Serializable>() {
+ ResultsFuture<Object> future = (ResultsFuture<Object>) methodResult;
+ future.addCompletionListener(new ResultsFuture.CompletionListener<Object>() {
public void onCompletion(
- ResultsFuture<Serializable> completedFuture) {
+ ResultsFuture<Object> completedFuture) {
Message asynchResult = new Message();
try {
asynchResult.setContents(completedFuture.get());
@@ -102,7 +102,7 @@
});
} else { // synch call
Message resultHolder = new Message();
- resultHolder.setContents((Serializable)methodResult);
+ resultHolder.setContents(methodResult);
result = resultHolder;
}
} catch (Throwable t) {
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -26,6 +26,7 @@
import static org.mockito.Mockito.*;
import java.io.ByteArrayInputStream;
+import java.io.Serializable;
import java.io.StringReader;
import java.net.InetSocketAddress;
import java.util.Properties;
@@ -49,8 +50,10 @@
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.common.buffer.BufferManagerFactory;
import com.metamatrix.common.util.crypto.NullCryptor;
+import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.dqp.service.SessionService;
+@SuppressWarnings("nls")
public class TestCommSockets {
SocketListener listener;
@@ -124,7 +127,15 @@
SocketServerConnection conn = helpEstablishConnection(false);
FakeService fs = conn.getService(FakeService.class);
assertEquals(150, fs.lobMethod(new ByteArrayInputStream(new byte[100]), new StringReader(new String(new char[50]))));
+ assertEquals(0, fs.lobMethod(new ByteArrayInputStream(new byte[0]), new StringReader(new String(new char[0]))));
}
+
+ @Test public void testServerRemoteStreaming() throws Exception {
+ SocketServerConnection conn = helpEstablishConnection(false);
+ FakeService fs = conn.getService(FakeService.class);
+ assertEquals("hello world", ObjectConverterUtil.convertToString(fs.getReader()));
+ assertTrue(Serializable.class.isAssignableFrom(fs.getReader().getClass()));
+ }
@Test public void testConnectWithoutClientEncryption() throws Exception {
SSLConfiguration config = new SSLConfiguration();
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -28,6 +28,7 @@
import java.io.InputStream;
import java.io.Reader;
import java.io.Serializable;
+import java.io.StringReader;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -70,6 +71,8 @@
int lobMethod(InputStream is, Reader r) throws IOException;
+ Reader getReader() throws IOException;
+
}
static class FakeServiceImpl implements FakeService {
@@ -88,6 +91,11 @@
public int lobMethod(InputStream is, Reader r) throws IOException {
return ObjectConverterUtil.convertToByteArray(is).length + ObjectConverterUtil.convertToString(r).length();
}
+
+ @Override
+ public Reader getReader() throws IOException {
+ return new StringReader("hello world"); //$NON-NLS-1$
+ }
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-31 20:48:49 UTC (rev 2012)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-31 21:44:15 UTC (rev 2013)
@@ -1,13 +1,13 @@
package org.teiid.adminapi.jboss;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
import java.io.File;
-import java.net.MalformedURLException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.sql.Connection;
import java.util.Collection;
import java.util.HashSet;
@@ -227,11 +227,16 @@
}
}
- private static void installVDB() throws AdminException, MalformedURLException {
+ private static void installVDB() throws AdminException, FileNotFoundException {
VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
if (vdb == null) {
File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb"); //$NON-NLS-1$
- admin.deployVDB(f.getName(), f.toURI().toURL());
+ FileInputStream fis = new FileInputStream(f);
+ admin.deployVDB(f.getName(), fis);
+ try {
+ fis.close();
+ } catch (IOException e) {
+ }
}
}
@@ -299,7 +304,9 @@
@Test
public void testTemplate() throws Exception{
File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar"); //$NON-NLS-1$
- admin.addConnectorType("connector-loopy", f.toURI().toURL()); //$NON-NLS-1$
+ FileInputStream fis = new FileInputStream(f);
+ admin.addConnectorType("connector-loopy", fis); //$NON-NLS-1$
+ fis.close();
Set<String> names = admin.getConnectorTypes();
assertTrue(names.contains("connector-loopy")); //$NON-NLS-1$
@@ -316,7 +323,7 @@
assertTrue(!f.exists());
- byte[] contents = admin.exportVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ InputStream contents = admin.exportVDB("TransactionsRevisited", 1); //$NON-NLS-1$
if (contents != null) {
ObjectConverterUtil.write(contents, f.getCanonicalPath());
}
14 years, 8 months
teiid SVN: r2012 - trunk/connectors/connector-salesforce/src/main/rar/META-INF.
by teiid-commits@lists.jboss.org
Author: jdoyle
Date: 2010-03-31 16:48:49 -0400 (Wed, 31 Mar 2010)
New Revision: 2012
Modified:
trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml
Log:
Removing bad URL value.
Modified: trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml 2010-03-31 03:11:58 UTC (rev 2011)
+++ trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml 2010-03-31 20:48:49 UTC (rev 2012)
@@ -106,7 +106,6 @@
<description>{$display:"Salesforce URL",$description:"URL for connecting to Salesforce",$advanced:"true"}</description>
<config-property-name>URL</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.salesforce.ConnectorState</config-property-value>
</config-property>
<config-property>
14 years, 8 months
teiid SVN: r2011 - in trunk: client/src/main/java/org/teiid/net/socket and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-30 23:11:58 -0400 (Tue, 30 Mar 2010)
New Revision: 2011
Added:
trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
Removed:
trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
trunk/runtime/src/test/java/com/metamatrix/platform/security/
Modified:
trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java
trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java
trunk/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
Log:
TEIID-943 adding streaming from client to server.
Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -49,17 +49,17 @@
import java.util.TreeMap;
import javax.sql.rowset.serial.SerialBlob;
-import javax.sql.rowset.serial.SerialClob;
import org.teiid.client.RequestMessage;
import org.teiid.client.RequestMessage.ResultsMode;
import org.teiid.client.RequestMessage.StatementType;
import org.teiid.client.metadata.MetadataResult;
-
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.types.BlobImpl;
+import com.metamatrix.common.types.ClobImpl;
+import com.metamatrix.common.types.InputStreamFactory;
import com.metamatrix.common.types.JDBCSQLTypeInfo;
import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
@@ -278,13 +278,8 @@
return metadataResults;
}
- public void setAsciiStream (int parameterIndex, java.io.InputStream in, int length) throws SQLException {
- //create a clob from the ascii stream
- try {
- setObject(parameterIndex, new SerialClob(ObjectConverterUtil.convertToCharArray(in, length, "ASCII"))); //$NON-NLS-1$
- } catch (IOException e) {
- throw TeiidSQLException.create(e);
- }
+ public void setAsciiStream(int parameterIndex, java.io.InputStream in, int length) throws SQLException {
+ setAsciiStream(parameterIndex, in);
}
/**
@@ -299,7 +294,6 @@
}
public void setBinaryStream(int parameterIndex, java.io.InputStream in, int length) throws SQLException {
- //create a blob from the ascii stream
try {
setObject(parameterIndex, new SerialBlob(ObjectConverterUtil.convertToByteArray(in, length)));
} catch (IOException e) {
@@ -345,17 +339,11 @@
* @param bytes array to which the parameter value is to be set.
*/
public void setBytes(int parameterIndex, byte bytes[]) throws SQLException {
- //create a blob from the ascii stream
setObject(parameterIndex, new SerialBlob(bytes));
}
public void setCharacterStream (int parameterIndex, java.io.Reader reader, int length) throws SQLException {
- //create a clob from the ascii stream
- try {
- setObject(parameterIndex, new SerialClob(ObjectConverterUtil.convertToCharArray(reader, length)));
- } catch (IOException e) {
- throw TeiidSQLException.create(e);
- }
+ setCharacterStream(parameterIndex, reader);
}
/**
@@ -692,52 +680,68 @@
throw SqlUtil.createFeatureNotSupportedException();
}
- public void setAsciiStream(int parameterIndex, InputStream x)
+ public void setAsciiStream(int parameterIndex, final InputStream x)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory("US-ASCII") { //$NON-NLS-1$
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return x;
+ }
+ }, -1));
}
public void setAsciiStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setAsciiStream(parameterIndex, x);
}
public void setBinaryStream(int parameterIndex, InputStream x)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setBlob(parameterIndex, x);
}
public void setBinaryStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setBinaryStream(parameterIndex, x);
}
- public void setBlob(int parameterIndex, InputStream inputStream)
+ public void setBlob(int parameterIndex, final InputStream inputStream)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ this.setObject(parameterIndex, new BlobImpl(new InputStreamFactory() {
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return inputStream;
+ }
+ }));
}
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setBlob(parameterIndex, inputStream);
}
public void setCharacterStream(int parameterIndex, Reader reader)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setClob(parameterIndex, reader);
}
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setCharacterStream(parameterIndex, reader);
}
public void setClob(int parameterIndex, Reader reader) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory() {
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return null;
+ }
+ }, -1));
}
public void setClob(int parameterIndex, Reader reader, long length)
throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ setClob(parameterIndex, reader);
}
public void setNCharacterStream(int parameterIndex, Reader value)
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -44,7 +44,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.teiid.client.DQP;
+import org.teiid.client.security.ILogon;
import org.teiid.client.util.ExceptionUtil;
import org.teiid.client.util.ResultsFuture;
import org.teiid.client.util.ResultsReceiver;
@@ -300,7 +300,7 @@
public RemoteInvocationHandler(Class<?> targetClass) {
this.targetClass = targetClass;
- this.secure = !DQP.class.isAssignableFrom(targetClass);
+ this.secure = ILogon.class.isAssignableFrom(targetClass);
}
//## JDBC4.0-begin ##
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -36,7 +36,7 @@
* @version $Rev: 381 $, $Date: 2008-10-01 06:06:18 -0500 (Wed, 01 Oct 2008) $
*
*/
-class CompactObjectInputStream extends ObjectInputStream {
+public class CompactObjectInputStream extends ObjectInputStream {
private final ClassLoader classLoader;
@@ -44,7 +44,7 @@
this(in, null);
}
- CompactObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
+ public CompactObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
super(in);
this.classLoader = classLoader;
}
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -22,11 +22,32 @@
*/
package org.teiid.netty.handler.codec.serialization;
+import java.io.Externalizable;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.nio.charset.Charset;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.util.LinkedList;
+import java.util.List;
+import com.metamatrix.common.types.BlobImpl;
+import com.metamatrix.common.types.ClobImpl;
+import com.metamatrix.common.types.InputStreamFactory;
+import com.metamatrix.common.types.SQLXMLImpl;
+import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
+import com.metamatrix.common.util.ReaderInputStream;
+
/**
* @author The Netty Project (netty-dev(a)lists.jboss.org)
* @author Trustin Lee (tlee(a)redhat.com)
@@ -34,14 +55,26 @@
* @version $Rev: 6 $, $Date: 2008-08-07 20:40:10 -0500 (Thu, 07 Aug 2008) $
*
*/
-class CompactObjectOutputStream extends ObjectOutputStream {
+public class CompactObjectOutputStream extends ObjectOutputStream {
static final int TYPE_PRIMITIVE = 0;
static final int TYPE_NON_PRIMITIVE = 1;
-
- CompactObjectOutputStream(OutputStream out) throws IOException {
+
+ private List<InputStream> lobs = new LinkedList<InputStream>();
+ private List<StreamFactoryReference> references = new LinkedList<StreamFactoryReference>();
+
+ public CompactObjectOutputStream(OutputStream out) throws IOException {
super(out);
+ enableReplaceObject(true);
}
+
+ public List<InputStream> getLobs() {
+ return lobs;
+ }
+
+ public List<StreamFactoryReference> getReferences() {
+ return references;
+ }
@Override
protected void writeStreamHeader() throws IOException {
@@ -58,4 +91,113 @@
writeUTF(desc.getName());
}
}
+
+ @Override
+ protected Object replaceObject(Object obj) throws IOException {
+ if (obj instanceof Serializable) {
+ return obj;
+ }
+ try {
+ if (obj instanceof Reader) {
+ lobs.add(new ReaderInputStream((Reader)obj, Charset.forName(Streamable.ENCODING)));
+ StreamFactoryReference sfr = new SerializableReader();
+ references.add(sfr);
+ return sfr;
+ } else if (obj instanceof InputStream) {
+ lobs.add((InputStream)obj);
+ StreamFactoryReference sfr = new SerializableInputStream();
+ references.add(sfr);
+ return sfr;
+ } else if (obj instanceof SQLXML) {
+ lobs.add(new ReaderInputStream(((SQLXML)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
+ StreamFactoryReference sfr = new SQLXMLImpl((InputStreamFactory)null);
+ references.add(sfr);
+ return sfr;
+ } else if (obj instanceof Clob) {
+ lobs.add(new ReaderInputStream(((Clob)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
+ StreamFactoryReference sfr = new ClobImpl(null, -1);
+ references.add(sfr);
+ return sfr;
+ } else if (obj instanceof Blob) {
+ lobs.add(((Blob)obj).getBinaryStream());
+ StreamFactoryReference sfr = new BlobImpl(null);
+ references.add(sfr);
+ return sfr;
+ }
+ } catch (SQLException e) {
+ throw new IOException(e);
+ }
+ return super.replaceObject(obj);
+ }
+
+ static class SerializableInputStream extends InputStream implements Externalizable, StreamFactoryReference {
+
+ private InputStreamFactory isf;
+ private InputStream is;
+
+ public SerializableInputStream() {
+ }
+
+ public void setStreamFactory(InputStreamFactory streamFactory) {
+ this.isf = streamFactory;
+ }
+
+ @Override
+ public int read() throws IOException {
+ if (is == null) {
+ is = isf.getInputStream();
+ }
+ return is.read();
+ }
+
+ @Override
+ public void close() throws IOException {
+ isf.free();
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ }
+ }
+
+ static class SerializableReader extends Reader implements Externalizable, StreamFactoryReference {
+
+ private InputStreamFactory isf;
+ private Reader r;
+
+ public SerializableReader() {
+ }
+
+ public void setStreamFactory(InputStreamFactory streamFactory) {
+ this.isf = streamFactory;
+ }
+
+ @Override
+ public void close() throws IOException {
+ isf.free();
+ }
+
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ if (r == null) {
+ r = isf.getCharacterStream();
+ }
+ return r.read(cbuf, off, len);
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ }
+ }
+
}
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectEncoderOutputStream.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -24,10 +24,12 @@
import java.io.DataOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import com.metamatrix.core.util.AccessibleByteArrayOutputStream;
+import com.metamatrix.core.util.ExternalizeUtil;
/**
* An {@link ObjectOutput} which is interoperable with {@link ObjectDecoder}
@@ -53,13 +55,25 @@
@Override
final protected void writeObjectOverride(Object obj) throws IOException {
AccessibleByteArrayOutputStream baos = new AccessibleByteArrayOutputStream(estimatedLength);
- ObjectOutputStream oout = new CompactObjectOutputStream(baos);
+ CompactObjectOutputStream oout = new CompactObjectOutputStream(baos);
oout.writeObject(obj);
+ ExternalizeUtil.writeCollection(oout, oout.getReferences());
oout.flush();
oout.close();
-
- out.writeInt(baos.getCount());
+
+ out.writeInt(baos.getCount()); //includes the lob references
out.write(baos.getBuffer(), 0, baos.getCount());
+ byte[] chunk = new byte[1 << 16];
+ for (InputStream is : oout.getLobs()) {
+ while (true) {
+ int bytes = is.read(chunk);
+ out.writeShort(Math.max(0, bytes));
+ if (bytes < 1) {
+ break;
+ }
+ out.write(chunk, 0, bytes);
+ }
+ }
}
@Override
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -2,17 +2,24 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Reader;
+import java.io.Serializable;
import java.sql.SQLException;
-public class BaseLob {
+import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
+
+public class BaseLob implements Serializable, StreamFactoryReference {
+ private static final long serialVersionUID = -1586959324208959519L;
private InputStreamFactory streamFactory;
protected BaseLob(InputStreamFactory streamFactory) {
this.streamFactory = streamFactory;
}
+
+ public void setStreamFactory(InputStreamFactory streamFactory) {
+ this.streamFactory = streamFactory;
+ }
public InputStreamFactory getStreamFactory() throws SQLException {
if (this.streamFactory == null) {
@@ -36,7 +43,7 @@
public Reader getCharacterStream() throws SQLException {
try {
- return new InputStreamReader(this.getStreamFactory().getInputStream(), this.getStreamFactory().getEncoding());
+ return this.getStreamFactory().getCharacterStream();
} catch (IOException e) {
SQLException ex = new SQLException(e.getMessage());
ex.initCause(e);
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/InputStreamFactory.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -24,13 +24,20 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.nio.charset.Charset;
import javax.xml.transform.Source;
-//TODO: add support for Readers
public abstract class InputStreamFactory implements Source {
+ public interface StreamFactoryReference {
+
+ void setStreamFactory(InputStreamFactory inputStreamFactory);
+
+ }
+
private String encoding;
private String systemId;
private long length = -1;
@@ -74,4 +81,8 @@
public void setLength(long length) {
this.length = length;
}
+
+ public Reader getCharacterStream() throws IOException {
+ return new InputStreamReader(this.getInputStream(), this.getEncoding());
+ }
}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -71,8 +71,8 @@
out.writeInt(0);
} else {
final int size = coll.size();
+ out.writeInt(coll.size());
if (size > 0) {
- out.writeInt(coll.size());
for (Object object : coll) {
out.writeObject(object);
}
Modified: trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -26,6 +26,8 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.List;
import junit.framework.TestCase;
@@ -36,10 +38,6 @@
private ByteArrayOutputStream bout;
private ObjectOutputStream oout;
- private ByteArrayInputStream bin;
- private ObjectInputStream oin;
-
-
/**
* Constructor for TestExternalizeUtil.
* @param name
@@ -53,18 +51,6 @@
oout = new ObjectOutputStream(bout);
}
- public void tearDown() throws Exception {
- oout.close();
- bout.close();
-
- if (oin!=null) {
- oin.close();
- }
- if (bin!=null) {
- bin.close();
- }
- }
-
/**
* Test ExternalizeUtil writeThrowable() and readThrowable() on Throwables.
* @throws Exception
@@ -76,8 +62,8 @@
ExternalizeUtil.writeThrowable(oout, t1);
oout.flush();
- bin = new ByteArrayInputStream(bout.toByteArray());
- oin = new ObjectInputStream(bin);
+ ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream oin = new ObjectInputStream(bin);
Throwable result1 = ExternalizeUtil.readThrowable(oin);
assertEqualThrowables(t1, result1);
@@ -102,8 +88,8 @@
ExternalizeUtil.writeThrowable(oout, t1);
oout.flush();
- bin = new ByteArrayInputStream(bout.toByteArray());
- oin = new ObjectInputStream(bin);
+ ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream oin = new ObjectInputStream(bin);
MetaMatrixCoreException result1 = (MetaMatrixCoreException) ExternalizeUtil.readThrowable(oin);
assertEqualThrowables(t1, result1);
@@ -129,5 +115,15 @@
assertEquals(stack1[i], stack2[i]);
}
}
+
+ public void testEmptyCollection() throws Exception {
+ ExternalizeUtil.writeCollection(oout, Arrays.asList(new Object[0]));
+ oout.flush();
+ ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream oin = new ObjectInputStream(bin);
+
+ List<?> result = ExternalizeUtil.readList(oin);
+ assertEquals(0, result.size());
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -34,7 +34,7 @@
* how to store data. The buffer manager should also be aware of memory
* management issues.
*/
-public interface BufferManager {
+public interface BufferManager extends StorageManager {
public enum TupleSourceType {
/**
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/FileStore.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -218,6 +218,25 @@
};
}
+ public OutputStream createOutputStream() {
+ return new OutputStream() {
+
+ @Override
+ public void write(int b) throws IOException {
+ throw new UnsupportedOperationException("buffered reading must be used"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ try {
+ FileStore.this.write(b, off, len);
+ } catch (MetaMatrixComponentException e) {
+ throw new IOException(e);
+ }
+ }
+ };
+ }
+
public FileStoreOutputStream createOutputStream(int maxMemorySize) {
return new FileStoreOutputStream(maxMemorySize);
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -23,9 +23,11 @@
package com.metamatrix.common.buffer.impl;
import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.OutputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Iterator;
@@ -213,12 +215,11 @@
LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_BUFFER_MGR, "Writing batch to disk", writeCount.incrementAndGet()); //$NON-NLS-1$
synchronized (store) {
offset = store.getLength();
- FileStoreOutputStream fsos = store.createOutputStream(IO_BUFFER_SIZE);
+ OutputStream fsos = new BufferedOutputStream(store.createOutputStream(), IO_BUFFER_SIZE);
ObjectOutputStream oos = new ObjectOutputStream(fsos);
batch.writeExternal(oos);
oos.flush();
oos.close();
- fsos.flushBuffer();
}
}
this.batchReference = new WeakReference<TupleBatch>(batch);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -33,6 +33,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.core.CoreConstants;
+import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
@@ -73,7 +74,7 @@
try {
ConnectorManager mgr = this.connectorRepo.getConnectorManager(model.getSourceJndiName(sourceName));
if (mgr == null) {
- throw new ConnectorException(DQPPlugin.Util.getString("CachedFinder.no_connector_found", model.getSourceJndiName(sourceName), modelName, sourceName));
+ throw new ConnectorException(DQPPlugin.Util.getString("CachedFinder.no_connector_found", model.getSourceJndiName(sourceName), modelName, sourceName)); //$NON-NLS-1$
}
caps = mgr.getCapabilities();
break;
@@ -88,6 +89,10 @@
throw new MetaMatrixComponentException(exception);
}
+ if (caps == null) {
+ throw new MetaMatrixRuntimeException("No sources were given for the model " + modelName); //$NON-NLS-1$
+ }
+
userCache.put(modelName, caps);
return caps;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -578,7 +578,7 @@
this.dataTierMgr = dataTierMgr;
}
- BufferManager getBufferManager() {
+ public BufferManager getBufferManager() {
return bufferManager;
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -66,7 +66,7 @@
import org.teiid.transport.ClientServiceRegistryImpl;
import org.teiid.transport.LogonImpl;
import org.teiid.transport.SocketConfiguration;
-import org.teiid.transport.SocketTransport;
+import org.teiid.transport.SocketListener;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -85,8 +85,8 @@
private transient SocketConfiguration jdbcSocketConfiguration;
private transient SocketConfiguration adminSocketConfiguration;
- private transient SocketTransport jdbcSocket;
- private transient SocketTransport adminSocket;
+ private transient SocketListener jdbcSocket;
+ private transient SocketListener adminSocket;
private transient TransactionServerImpl transactionServerImpl = new TransactionServerImpl();
private transient DQPCore dqpCore = new DQPCore();
@@ -123,16 +123,14 @@
this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin), LogConstants.CTX_ADMIN_API);
if (this.jdbcSocketConfiguration.isEnabled()) {
- this.jdbcSocket = new SocketTransport(this.jdbcSocketConfiguration, csr);
- this.jdbcSocket.start();
+ this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, csr, this.dqpCore.getBufferManager());
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC = ",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+this.jdbcSocketConfiguration.getPortNumber())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
if (this.adminSocketConfiguration.isEnabled()) {
- this.adminSocket = new SocketTransport(this.adminSocketConfiguration, csr);
- this.adminSocket.start();
+ this.adminSocket = new SocketListener(this.adminSocketConfiguration, csr, this.dqpCore.getBufferManager());
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin", (this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+this.adminSocketConfiguration.getPortNumber())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "admin connections")); //$NON-NLS-1$ //$NON-NLS-2$
Added: trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid.transport;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.StreamCorruptedException;
+import java.util.List;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferInputStream;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoder;
+import org.jboss.netty.handler.codec.serialization.CompatibleObjectEncoder;
+import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
+import org.teiid.netty.handler.codec.serialization.CompactObjectInputStream;
+import org.teiid.netty.handler.codec.serialization.ObjectEncoderOutputStream;
+
+import com.metamatrix.common.buffer.FileStore;
+import com.metamatrix.common.buffer.StorageManager;
+import com.metamatrix.common.types.InputStreamFactory;
+import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
+import com.metamatrix.core.util.ExternalizeUtil;
+
+/**
+ * A decoder which deserializes the received {@link ChannelBuffer}s into Java
+ * objects.
+ * <p>
+ * Please note that the serialized form this decoder expects is not
+ * compatible with the standard {@link ObjectOutputStream}. Please use
+ * {@link ObjectEncoder} or {@link ObjectEncoderOutputStream} to ensure the
+ * interoperability with this decoder.
+ * <p>
+ * Unless there's a requirement for the interoperability with the standard
+ * object streams, it is recommended to use {@link ObjectEncoder} and
+ * {@link ObjectDecoder} rather than {@link CompatibleObjectEncoder} and
+ * {@link CompatibleObjectDecoder}.
+ *
+ * @author The Netty Project (netty-dev(a)lists.jboss.org)
+ * @author Trustin Lee (tlee(a)redhat.com)
+ *
+ * @version $Rev: 381 $, $Date: 2008-10-01 20:06:18 +0900 (Wed, 01 Oct 2008) $
+ *
+ * @apiviz.landmark
+ */
+public class ObjectDecoder extends FrameDecoder {
+
+ private final int maxObjectSize;
+ private final ClassLoader classLoader;
+
+ private Object result;
+ private int streamIndex;
+ private OutputStream stream;
+ private List<StreamFactoryReference> streams;
+ private StorageManager storageManager;
+
+ /**
+ * Creates a new decoder with the specified maximum object size.
+ *
+ * @param maxObjectSize the maximum byte length of the serialized object.
+ * if the length of the received object is greater
+ * than this value, {@link StreamCorruptedException}
+ * will be raised.
+ * @param classLoader the {@link ClassLoader} which will load the class
+ * of the serialized object
+ */
+ public ObjectDecoder(int maxObjectSize, ClassLoader classLoader, StorageManager storageManager) {
+ if (maxObjectSize <= 0) {
+ throw new IllegalArgumentException("maxObjectSize: " + maxObjectSize);
+ }
+
+ this.maxObjectSize = maxObjectSize;
+ this.classLoader = classLoader;
+ this.storageManager = storageManager;
+ }
+
+ @Override
+ protected Object decode(
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
+ if (result == null) {
+ if (buffer.readableBytes() < 4) {
+ return null;
+ }
+
+ int dataLen = buffer.getInt(buffer.readerIndex());
+ if (dataLen <= 0) {
+ throw new StreamCorruptedException("invalid data length: " + dataLen);
+ }
+ if (dataLen > maxObjectSize) {
+ throw new StreamCorruptedException(
+ "data length too big: " + dataLen + " (max: " + maxObjectSize + ')');
+ }
+
+ if (buffer.readableBytes() < dataLen + 4) {
+ return null;
+ }
+
+ buffer.skipBytes(4);
+ CompactObjectInputStream cois = new CompactObjectInputStream(
+ new ChannelBufferInputStream(buffer, dataLen), classLoader);
+ result = cois.readObject();
+ streams = ExternalizeUtil.readList(cois, StreamFactoryReference.class);
+ }
+ while (streamIndex < streams.size()) {
+ if (buffer.readableBytes() < 2) {
+ return null;
+ }
+ int dataLen = buffer.getShort(buffer.readerIndex()) & 0xff;
+ if (dataLen == 0) {
+ stream.close();
+ stream = null;
+ streamIndex++;
+ buffer.skipBytes(2);
+ continue;
+ }
+ if (buffer.readableBytes() < dataLen + 2) {
+ return null;
+ }
+ buffer.skipBytes(2);
+
+ if (stream == null) {
+ final FileStore store = storageManager.createFileStore("temp-stream"); //$NON-NLS-1$
+ StreamFactoryReference sfr = streams.get(streamIndex);
+ store.setCleanupReference(sfr);
+ sfr.setStreamFactory(new InputStreamFactory(Streamable.ENCODING) {
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new BufferedInputStream(store.createInputStream(0));
+ }
+ });
+ this.stream = new BufferedOutputStream(store.createOutputStream());
+ }
+ buffer.readBytes(this.stream, dataLen);
+ }
+ Object toReturn = result;
+ result = null;
+ return toReturn;
+ }
+}
Property changes on: trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -27,9 +27,8 @@
import java.io.IOException;
import java.net.SocketAddress;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -50,12 +49,12 @@
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
-import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
import org.jboss.netty.handler.ssl.SslHandler;
import org.teiid.net.NetPlugin;
import org.teiid.net.socket.ObjectChannel;
+import com.metamatrix.common.buffer.StorageManager;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
@@ -140,7 +139,8 @@
private final ChannelListener.ChannelListenerFactory listenerFactory;
private final SSLConfiguration config;
private final ClassLoader classLoader;
- private Map<Channel, ChannelListener> listeners = Collections.synchronizedMap(new HashMap<Channel, ChannelListener>());
+ private final StorageManager storageManager;
+ private Map<Channel, ChannelListener> listeners = new ConcurrentHashMap<Channel, ChannelListener>();
private AtomicLong objectsRead = new AtomicLong(0);
private AtomicLong objectsWritten = new AtomicLong(0);
private volatile int maxChannels;
@@ -158,20 +158,19 @@
};
public SSLAwareChannelHandler(ChannelListener.ChannelListenerFactory listenerFactory,
- SSLConfiguration config, ClassLoader classloader) {
+ SSLConfiguration config, ClassLoader classloader, StorageManager storageManager) {
this.listenerFactory = listenerFactory;
this.config = config;
this.classLoader = classloader;
+ this.storageManager = storageManager;
}
@Override
public void channelConnected(ChannelHandlerContext ctx,
final ChannelStateEvent e) throws Exception {
ChannelListener listener = this.listenerFactory.createChannelListener(new ObjectChannelImpl(e.getChannel()));
- synchronized (this.listeners) {
- this.listeners.put(e.getChannel(), listener);
- maxChannels = Math.max(maxChannels, this.listeners.size());
- }
+ this.listeners.put(e.getChannel(), listener);
+ maxChannels = Math.max(maxChannels, this.listeners.size());
SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
if (sslHandler != null) {
sslHandler.handshake(e.getChannel()).addListener(new ChannelFutureListener() {
@@ -228,7 +227,7 @@
if (engine != null) {
pipeline.addLast("ssl", new SslHandler(engine)); //$NON-NLS-1$
}
- pipeline.addLast("decoder", new ObjectDecoder(1 << 24, classLoader)); //$NON-NLS-1$
+ pipeline.addLast("decoder", new ObjectDecoder(1 << 20, classLoader, storageManager)); //$NON-NLS-1$
pipeline.addLast("encoder", new ObjectEncoder()); //$NON-NLS-1$
pipeline.addLast("handler", this); //$NON-NLS-1$
return pipeline;
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -31,8 +31,10 @@
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.teiid.net.socket.ObjectChannel;
+import org.teiid.runtime.RuntimePlugin;
import org.teiid.transport.ChannelListener.ChannelListenerFactory;
+import com.metamatrix.common.buffer.StorageManager;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.ApplicationInfo;
@@ -49,6 +51,12 @@
private ExecutorService nettyPool;
private ClientServiceRegistryImpl csr;
+ public SocketListener(SocketConfiguration config, ClientServiceRegistryImpl csr, StorageManager storageManager) {
+ this(config.getPortNumber(), config.getHostAddress().getHostAddress(), config.getInputBufferSize(), config.getOutputBufferSize(), config.getMaxSocketThreads(), config.getSSLConfiguration(), csr, storageManager);
+
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, RuntimePlugin.Util.getString("SocketTransport.1", new Object[] {config.getHostAddress().getHostAddress(), String.valueOf(config.getPortNumber())})); //$NON-NLS-1$
+ }
+
/**
*
* @param port
@@ -59,7 +67,7 @@
* @param server
*/
public SocketListener(int port, String bindAddress, int inputBufferSize,
- int outputBufferSize, int maxWorkers, SSLConfiguration config, ClientServiceRegistryImpl csr) {
+ int outputBufferSize, int maxWorkers, SSLConfiguration config, ClientServiceRegistryImpl csr, StorageManager storageManager) {
this.isClientEncryptionEnabled = config.isClientEncryptionEnabled();
this.csr = csr;
if (port < 0 || port > 0xFFFF) {
@@ -74,7 +82,7 @@
ChannelFactory factory = new NioServerSocketChannelFactory(this.nettyPool, this.nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
ServerBootstrap bootstrap = new ServerBootstrap(factory);
- this.channelHandler = new SSLAwareChannelHandler(this, config, Thread.currentThread().getContextClassLoader());
+ this.channelHandler = new SSLAwareChannelHandler(this, config, Thread.currentThread().getContextClassLoader(), storageManager);
bootstrap.setPipelineFactory(channelHandler);
if (inputBufferSize != 0) {
bootstrap.setOption("receiveBufferSize", new Integer(inputBufferSize)); //$NON-NLS-1$
Deleted: trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.transport;
-
-import org.teiid.runtime.RuntimePlugin;
-
-import com.metamatrix.common.log.LogConstants;
-import com.metamatrix.common.log.LogManager;
-
-/**
- * This class starts a Socket for DQP connections and listens on the port and hands out the connections to the
- * users
- */
-public class SocketTransport {
-
- private SocketListener listener;
- private SocketConfiguration config;
- private ClientServiceRegistryImpl csr;
-
- public SocketTransport(SocketConfiguration config, ClientServiceRegistryImpl csr) {
- this.config = config;
- this.csr = csr;
- }
-
- public void start() {
- String bindAddress = this.config.getHostAddress().getHostAddress();
-
- LogManager.logDetail(LogConstants.CTX_TRANSPORT, RuntimePlugin.Util.getString("SocketTransport.1", new Object[] {bindAddress, String.valueOf(this.config.getPortNumber())})); //$NON-NLS-1$
- this.listener = new SocketListener(this.config.getPortNumber(), bindAddress, this.config.getInputBufferSize(), this.config.getOutputBufferSize(), this.config.getMaxSocketThreads(), this.config.getSSLConfiguration(), csr);
- }
-
- public void stop() {
- this.listener.stop();
- }
-
- public SocketListenerStats getStats() {
- return this.listener.getStats();
- }
-
-}
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -25,6 +25,8 @@
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
import java.net.InetSocketAddress;
import java.util.Properties;
@@ -42,8 +44,10 @@
import org.teiid.net.socket.SocketServerConnectionFactory;
import org.teiid.net.socket.SocketUtil;
import org.teiid.net.socket.UrlServerDiscovery;
+import org.teiid.transport.TestSocketRemoting.FakeService;
import com.metamatrix.api.exception.ComponentNotFoundException;
+import com.metamatrix.common.buffer.BufferManagerFactory;
import com.metamatrix.common.util.crypto.NullCryptor;
import com.metamatrix.dqp.service.SessionService;
@@ -65,7 +69,7 @@
@Test public void testFailedConnect() throws Exception {
SSLConfiguration config = new SSLConfiguration();
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),1024, 1024, 1, config, null);
+ listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),1024, 1024, 1, config, null, BufferManagerFactory.getStandaloneBufferManager());
try {
Properties p = new Properties();
@@ -116,6 +120,11 @@
assertEquals(1, stats.maxSockets);
}
+ @Test public void testLobs() throws Exception {
+ SocketServerConnection conn = helpEstablishConnection(false);
+ FakeService fs = conn.getService(FakeService.class);
+ assertEquals(150, fs.lobMethod(new ByteArrayInputStream(new byte[100]), new StringReader(new String(new char[50]))));
+ }
@Test public void testConnectWithoutClientEncryption() throws Exception {
SSLConfiguration config = new SSLConfiguration();
@@ -141,7 +150,8 @@
}
}, null);
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(), 1024, 1024, 1, config, server);
+ server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
+ listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
SocketListenerStats stats = listener.getStats();
assertEquals(0, stats.maxSockets);
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2010-03-30 21:24:33 UTC (rev 2010)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2010-03-31 03:11:58 UTC (rev 2011)
@@ -25,6 +25,8 @@
import static org.junit.Assert.*;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
import java.io.Serializable;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
@@ -56,6 +58,7 @@
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.util.crypto.Cryptor;
import com.metamatrix.common.util.crypto.NullCryptor;
+import com.metamatrix.core.util.ObjectConverterUtil;
public class TestSocketRemoting {
@@ -65,9 +68,11 @@
String exceptionMethod() throws MetaMatrixProcessingException;
+ int lobMethod(InputStream is, Reader r) throws IOException;
+
}
- private static class FakeServiceImpl implements FakeService {
+ static class FakeServiceImpl implements FakeService {
public ResultsFuture<Integer> asynchResult() {
ResultsFuture<Integer> result = new ResultsFuture<Integer>();
@@ -79,6 +84,11 @@
throw new MetaMatrixProcessingException();
}
+ @Override
+ public int lobMethod(InputStream is, Reader r) throws IOException {
+ return ObjectConverterUtil.convertToByteArray(is).length + ObjectConverterUtil.convertToString(r).length();
+ }
+
}
private static class FakeClientServerInstance extends SocketServerInstanceImpl implements ClientInstance {
14 years, 8 months
teiid SVN: r2010 - in trunk/connectors: connector-xml-file/src/main/java/org/teiid/connector and 19 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-30 17:24:33 -0400 (Tue, 30 Mar 2010)
New Revision: 2010
Added:
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/
trunk/connectors/connector-xml-file/src/main/resources/org/teiid/connector/xml/
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnection.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileExecution.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/TrustedPayloadHandler.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/XMLSourcePlugin.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapDocLiteralRequest.java
trunk/connectors/connector-xml-soap/src/main/resources/org/teiid/connector/xml/
trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/
trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/
Removed:
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/
trunk/connectors/connector-xml-file/src/main/resources/org/teiid/connector/xmlsource/
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapRequest.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/TrustedPayloadHandler.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/XMLSourcePlugin.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/
trunk/connectors/connector-xml-soap/src/main/resources/org/teiid/connector/xmlsource/
trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xmlsource/soap/
Modified:
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnection.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnector.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileManagedConnectionFactory.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileProcedureExecution.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileResultSetExecution.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileSourceCapabilities.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/XMLSourcePlugin.java
trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestCachingFileConnector.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestXMLConnector.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/FakeFileManagedConnectionfactory.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestCachingFileConnectorLong.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnector.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnectorLong.java
trunk/connectors/connector-xml-http/pom.xml
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/BaseRequest.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPRequest.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPResultSetExecution.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityManagedConnectionFactory.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityToken.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/ServiceOperation.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnection.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnector.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapManagedConnectionFactory.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapProcedureExecution.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapService.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapSourceCapabilities.java
trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapConnector.java
trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapExecution.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java
Log:
TEIID-861: minor issues with configuration in running the XML file soap connectors
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -61,6 +61,16 @@
this.inputStreamFilterClass = inputStreamFilterClass;
}
+ private boolean logRequestResponseDocs;
+
+ public boolean isLogRequestResponseDocs() {
+ return logRequestResponseDocs;
+ }
+
+ public void setLogRequestResponseDocs(Boolean logRequestResponseDocs) {
+ this.logRequestResponseDocs = logRequestResponseDocs;
+ }
+
public SQLXML getResponse(String key) {
return this.responses.get(key);
}
Copied: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file (from rev 2009, trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file)
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnection.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnection.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnection.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import java.io.File;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnector.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,4 +1,4 @@
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import org.teiid.connector.api.Connection;
import org.teiid.connector.api.ConnectorCapabilities;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileManagedConnectionFactory.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileManagedConnectionFactory.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileProcedureExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileProcedureExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import java.io.BufferedInputStream;
import java.io.File;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileResultSetExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileResultSetExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import java.io.BufferedInputStream;
import java.io.File;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileSourceCapabilities.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileSourceCapabilities.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/FileSourceCapabilities.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import com.metamatrix.connector.xml.base.XMLCapabilities;
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/XMLSourcePlugin.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/XMLSourcePlugin.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xml/file/XMLSourcePlugin.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.file;
+package org.teiid.connector.xml.file;
import java.util.ResourceBundle;
@@ -34,7 +34,7 @@
/**
* The plug-in identifier of this plugin
*/
- public static final String PLUGIN_ID = "org.teiid.connector.xmlsource" ; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.teiid.connector.xml" ; //$NON-NLS-1$
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-30 21:24:33 UTC (rev 2010)
@@ -38,20 +38,20 @@
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>org.teiid.connector.xmlsource.file.FileManagedConnectionFactory</managedconnectionfactory-class>
+ <managedconnectionfactory-class>org.teiid.connector.xml.file.FileManagedConnectionFactory</managedconnectionfactory-class>
<config-property>
<description>{$display:"Connector Class",$advanced:"true"}</description>
<config-property-name>ConnectorClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>org.teiid.connector.xmlsource.file.FileConnector</config-property-value>
+ <config-property-value>org.teiid.connector.xml.file.FileConnector</config-property-value>
</config-property>
<config-property>
<description>{$display:"Connector Capabilities",$description:"The class to use to provide the Connector Capabilities",$advanced:"true"}</description>
<config-property-name>CapabilitiesClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>org.teiid.connector.xmlsource.file.FileSourceCapabilities</config-property-value>
+ <config-property-value>org.teiid.connector.xml.file.FileSourceCapabilities</config-property-value>
</config-property>
<config-property>
Copied: trunk/connectors/connector-xml-file/src/main/resources/org/teiid/connector/xml (from rev 2009, trunk/connectors/connector-xml-file/src/main/resources/org/teiid/connector/xmlsource)
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestCachingFileConnector.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestCachingFileConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestCachingFileConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -10,8 +10,8 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.xml.file.FakeFileManagedConnectionfactory;
-import org.teiid.connector.xmlsource.file.FileConnector;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileConnector;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
import com.metamatrix.cdk.api.ConnectorHost;
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestXMLConnector.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestXMLConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/TestXMLConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -27,8 +27,8 @@
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.xml.file.FakeFileManagedConnectionfactory;
-import org.teiid.connector.xmlsource.file.FileConnection;
-import org.teiid.connector.xmlsource.file.FileConnector;
+import org.teiid.connector.xml.file.FileConnection;
+import org.teiid.connector.xml.file.FileConnector;
public class TestXMLConnector extends TestCase {
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/FakeFileManagedConnectionfactory.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/FakeFileManagedConnectionfactory.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/FakeFileManagedConnectionfactory.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,6 +1,6 @@
package org.teiid.connector.xml.file;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
import com.metamatrix.core.util.UnitTestUtil;
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestCachingFileConnectorLong.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestCachingFileConnectorLong.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestCachingFileConnectorLong.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -9,8 +9,8 @@
import org.teiid.connector.api.Connector;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xmlsource.file.FileConnector;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileConnector;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
import com.metamatrix.cdk.api.ConnectorHost;
Copied: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnection.java (from rev 2009, trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileConnection.java)
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnection.java (rev 0)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnection.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.xml.file;
+
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ConnectorLogger;
+import org.teiid.connector.xml.file.FileConnection;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
+
+import com.metamatrix.core.util.UnitTestUtil;
+
+
+/**
+ */
+public class TestFileConnection extends TestCase {
+
+
+ public void testBadDirectory() {
+ FileManagedConnectionFactory config = Mockito.mock(FileManagedConnectionFactory.class);
+ Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+ Mockito.stub(config.getDirectoryLocation()).toReturn("BadDirectory");
+
+ try {
+ new FileConnection(config);
+ fail("Must have failed because of bad directory location"); //$NON-NLS-1$
+ } catch (ConnectorException e) {
+ }
+ }
+
+
+ public void testGoodDirectory() {
+ String file = UnitTestUtil.getTestDataPath();
+
+ FileManagedConnectionFactory config = Mockito.mock(FileManagedConnectionFactory.class);
+ Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+ Mockito.stub(config.getDirectoryLocation()).toReturn(file);
+
+ try {
+ FileConnection conn = new FileConnection(config);
+ assertTrue(conn.isConnected());
+ } catch (ConnectorException e) {
+ fail("mast have passed connection"); //$NON-NLS-1$
+ }
+ }
+
+ public void testNoDirectory() {
+ FileManagedConnectionFactory config = Mockito.mock(FileManagedConnectionFactory.class);
+ Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+
+ try {
+ new FileConnection(config);
+ fail("Must have failed because of bad directory location"); //$NON-NLS-1$
+ } catch (ConnectorException e) {
+ }
+ }
+
+}
Property changes on: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnector.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -8,8 +8,8 @@
import org.mockito.Mockito;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xmlsource.file.FileConnector;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileConnector;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
import com.metamatrix.cdk.api.ConnectorHost;
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnectorLong.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnectorLong.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileConnectorLong.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -9,8 +9,8 @@
import org.teiid.connector.api.Connector;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xmlsource.file.FileConnector;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileConnector;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
import com.metamatrix.cdk.api.ConnectorHost;
Copied: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileExecution.java (from rev 2009, trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileExecution.java)
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileExecution.java (rev 0)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.xml.file;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.sql.SQLXML;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.LanguageFactory;
+import org.teiid.connector.metadata.runtime.Procedure;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+import org.teiid.connector.xml.file.FileConnection;
+import org.teiid.connector.xml.file.FileManagedConnectionFactory;
+import org.teiid.connector.xml.file.FileProcedureExecution;
+
+import com.metamatrix.core.util.ObjectConverterUtil;
+import com.metamatrix.core.util.UnitTestUtil;
+
+
+/**
+ */
+@SuppressWarnings("nls")
+public class TestFileExecution extends TestCase {
+
+ public void testGoodFile() throws Exception {
+ String file = UnitTestUtil.getTestDataPath();
+ FileManagedConnectionFactory config = new FileManagedConnectionFactory();
+ config.setLogWriter(Mockito.mock(PrintWriter.class));
+ config.setDirectoryLocation(file);
+
+ FileConnection conn = new FileConnection(config);
+ assertTrue(conn.isConnected());
+ RuntimeMetadata metadata = Mockito.mock(RuntimeMetadata.class);
+
+ LanguageFactory fact = config.getLanguageFactory();
+ Call procedure = fact.createCall("GetXMLFile", null, createMockProcedureMetadata("BookCollection.xml")); //$NON-NLS-1$
+
+ FileProcedureExecution exec = (FileProcedureExecution)conn.createExecution(procedure, Mockito.mock(ExecutionContext.class), metadata); //$NON-NLS-1$ //$NON-NLS-2$
+
+ exec.execute();
+
+ List<?> result = exec.next();
+ assertNotNull(result);
+ assertNull(exec.next());
+ try {
+ exec.getOutputParameterValues();
+ fail("should have thrown error in returning a return"); //$NON-NLS-1$
+ }catch(Exception e) {
+ }
+ SQLXML xmlSource = (SQLXML)result.get(0);
+ assertNotNull(xmlSource);
+ String xml = xmlSource.getString();
+
+ String fileContents = ObjectConverterUtil.convertFileToString(new File(file+"/BookCollection.xml")); //$NON-NLS-1$
+ fileContents = fileContents.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ //System.out.println(fileContents);
+
+ assertEquals(fileContents, xml);
+ }
+
+ public void testBadFile() throws Exception {
+ String file = UnitTestUtil.getTestDataPath();
+ FileManagedConnectionFactory config = new FileManagedConnectionFactory();
+ config.setLogWriter(Mockito.mock(PrintWriter.class));
+ config.setDirectoryLocation(file);
+
+
+ try {
+ FileConnection conn = new FileConnection(config);
+ assertTrue(conn.isConnected());
+ RuntimeMetadata metadata = Mockito.mock(RuntimeMetadata.class);
+ LanguageFactory fact = config.getLanguageFactory();
+ FileProcedureExecution exec = (FileProcedureExecution)conn.createExecution(fact.createCall("GetXMLFile", null, createMockProcedureMetadata("nofile.xml")), Mockito.mock(ExecutionContext.class), metadata); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+
+ exec.execute();
+ fail("mast have failed to find the file"); //$NON-NLS-1$
+ } catch (ConnectorException e) {
+ //pass
+ }
+ }
+
+ public static Procedure createMockProcedureMetadata(String nameInSource) {
+ Procedure rm = Mockito.mock(Procedure.class);
+ Mockito.stub(rm.getNameInSource()).toReturn(nameInSource);
+ return rm;
+ }
+}
Property changes on: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xml/file/TestFileExecution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-xml-http/pom.xml
===================================================================
--- trunk/connectors/connector-xml-http/pom.xml 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-http/pom.xml 2010-03-30 21:24:33 UTC (rev 2010)
@@ -73,9 +73,6 @@
<goals>
<goal>jar</goal>
</goals>
- <configuration>
- <classifier>export</classifier>
- </configuration>
</execution>
<execution>
<id>deploy_jar</id>
Copied: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/TrustedPayloadHandler.java (from rev 2009, trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/TrustedPayloadHandler.java)
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/TrustedPayloadHandler.java (rev 0)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/TrustedPayloadHandler.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+
+
+package org.teiid.connector.xml;
+
+import javax.security.auth.Subject;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorLogger;
+
+
+public interface TrustedPayloadHandler {
+
+ public String getUser();
+
+ public String getPassword();
+
+ public void setLogger(ConnectorLogger logger);
+
+ public void setSubject(Subject subject);
+
+ public void setConnectorEnvironment(ConnectorEnvironment connEnv);
+
+ public void processPayloads() throws Exception;
+
+ public void setUser(String userName);
+
+ public void setPassword(String password);
+}
Property changes on: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/TrustedPayloadHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/XMLSourcePlugin.java (from rev 2009, trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/XMLSourcePlugin.java)
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/XMLSourcePlugin.java (rev 0)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/XMLSourcePlugin.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.xml;
+
+import java.util.ResourceBundle;
+
+import com.metamatrix.core.BundleUtil;
+
+/**
+ * For logging purposes
+ */
+public class XMLSourcePlugin {
+
+ /**
+ * The plug-in identifier of this plugin
+ */
+ public static final String PLUGIN_ID = "org.teiid.connector.xml" ; //$NON-NLS-1$
+
+ public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
+ PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+}
Property changes on: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/XMLSourcePlugin.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap (from rev 2009, trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap)
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/BaseRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/BaseRequest.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/BaseRequest.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,4 +1,4 @@
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.net.MalformedURLException;
import java.net.URL;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPRequest.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPRequest.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.io.StringReader;
import java.sql.SQLException;
@@ -40,7 +40,7 @@
import org.jdom.output.XMLOutputter;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
+import org.teiid.connector.xml.XMLSourcePlugin;
import com.metamatrix.connector.xml.Constants;
import com.metamatrix.connector.xml.base.CriteriaDesc;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPResultSetExecution.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPResultSetExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.util.ArrayList;
import java.util.Arrays;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SecurityManagedConnectionFactory.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityManagedConnectionFactory.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import org.teiid.connector.api.ConnectorEnvironment;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityToken.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SecurityToken.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SecurityToken.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,11 +20,11 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import javax.xml.ws.Dispatch;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
+import org.teiid.connector.xml.XMLSourcePlugin;
/**
* Security provider for calling the Web Service
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/ServiceOperation.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/ServiceOperation.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/ServiceOperation.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.io.StringReader;
@@ -28,7 +28,7 @@
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
+import org.teiid.connector.xml.XMLSourcePlugin;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnection.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnection.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnection.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnector.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,4 +1,4 @@
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.net.MalformedURLException;
import java.net.URL;
@@ -16,7 +16,7 @@
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.basic.BasicConnector;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
+import org.teiid.connector.xml.XMLSourcePlugin;
public class SoapConnector extends BasicConnector {
Added: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapDocLiteralRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapDocLiteralRequest.java (rev 0)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapDocLiteralRequest.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.xml.soap;
+
+import java.sql.SQLXML;
+import java.util.List;
+
+import javax.xml.transform.Source;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.xml.XMLSourcePlugin;
+import org.teiid.connector.xml.soap.ServiceOperation.ExcutionFailedException;
+import org.teiid.connector.xml.soap.SoapService.OperationNotFoundException;
+
+
+
+/**
+ * A soap call executor - handles all styles doc/literal, rpc/encoded etc.
+ */
+public abstract class SoapDocLiteralRequest {
+
+ // Connection object.
+ private SoapManagedConnectionFactory env;
+ private SoapService service;
+
+ /**
+ * @param env
+ */
+ public SoapDocLiteralRequest(SoapManagedConnectionFactory env, SoapService service) {
+ this.env = env;
+ this.service = service;
+ }
+
+ protected abstract String getProcedureName();
+
+ protected abstract List getInputParameters();
+
+ protected abstract SecurityToken getSecurityToken();
+
+ /**
+ * @see org.teiid.connector.api.ProcedureExecution#execute(org.teiid.connector.language.IProcedure, int)
+ */
+ public SQLXML execute() throws ConnectorException {
+
+
+ String sourceProcedureName = getProcedureName();
+
+ // if the source procedure name is not supplied then throw an exception
+ if (sourceProcedureName == null || sourceProcedureName.length() == 0) {
+ String msg = XMLSourcePlugin.Util.getString("source_name_not_supplied"); //$NON-NLS-1$
+ throw new ConnectorException(msg);
+ }
+
+ this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("exec_soap_procedure", new Object[] {sourceProcedureName})); //$NON-NLS-1$
+
+ // extract all the input parameters to send to the service
+ List argsList = getInputParameters();
+
+ // convert lists to arrays
+ Object[] args = argsList.toArray(new Object[argsList.size()]);
+
+ try {
+ ServiceOperation operation = this.service.findOperation(sourceProcedureName);
+
+ this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("service_execute", new Object[] {operation.getName()})); //$NON-NLS-1$
+ for (int i = 0; i < args.length; i++) {
+ this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString( "service_params", new Object[] {args[i]})); //$NON-NLS-1$
+ }
+
+ Source returnValue = operation.execute(args, getSecurityToken());
+
+ this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("xml_contents", new Object[] {returnValue})); //$NON-NLS-1$
+
+ return convertToXMLType(returnValue);
+
+ } catch (OperationNotFoundException e) {
+ throw new ConnectorException(e);
+ } catch (ExcutionFailedException e) {
+ throw new ConnectorException(e);
+ }
+ }
+
+ protected SQLXML convertToXMLType(Source value) {
+ return (SQLXML)env.getTypeFacility().convertToRuntimeType(value);
+ }
+
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ throw new ConnectorException(XMLSourcePlugin.Util.getString("No_outputs_allowed")); //$NON-NLS-1$
+ }
+}
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapManagedConnectionFactory.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapManagedConnectionFactory.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import com.metamatrix.connector.xml.base.XMLBaseManagedConnectionFactory;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapProcedureExecution.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapProcedureExecution.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapProcedureExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.sql.SQLXML;
import java.util.ArrayList;
@@ -38,7 +38,7 @@
import org.teiid.connector.language.Argument.Direction;
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
+import org.teiid.connector.xml.XMLSourcePlugin;
/**
* A soap call executor - handles all styles doc/literal, rpc/encoded etc.
@@ -72,7 +72,7 @@
*/
public void execute() throws ConnectorException {
- SoapRequest request = new SoapRequest(this.env, this.service) {
+ SoapDocLiteralRequest request = new SoapDocLiteralRequest(this.env, this.service) {
@Override
protected String getProcedureName() {
Deleted: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapRequest.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapRequest.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.xmlsource.soap;
-
-import java.sql.SQLXML;
-import java.util.List;
-
-import javax.xml.transform.Source;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.xmlsource.XMLSourcePlugin;
-import org.teiid.connector.xmlsource.soap.ServiceOperation.ExcutionFailedException;
-import org.teiid.connector.xmlsource.soap.SoapService.OperationNotFoundException;
-
-
-
-/**
- * A soap call executor - handles all styles doc/literal, rpc/encoded etc.
- */
-public abstract class SoapRequest {
-
- // Connection object.
- private SoapManagedConnectionFactory env;
- private SoapService service;
-
- /**
- * @param env
- */
- public SoapRequest(SoapManagedConnectionFactory env, SoapService service) {
- this.env = env;
- this.service = service;
- }
-
- protected abstract String getProcedureName();
-
- protected abstract List getInputParameters();
-
- protected abstract SecurityToken getSecurityToken();
-
- /**
- * @see org.teiid.connector.api.ProcedureExecution#execute(org.teiid.connector.language.IProcedure, int)
- */
- public SQLXML execute() throws ConnectorException {
-
-
- String sourceProcedureName = getProcedureName();
-
- // if the source procedure name is not supplied then throw an exception
- if (sourceProcedureName == null || sourceProcedureName.length() == 0) {
- String msg = XMLSourcePlugin.Util.getString("source_name_not_supplied"); //$NON-NLS-1$
- throw new ConnectorException(msg);
- }
-
- this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("exec_soap_procedure", new Object[] {sourceProcedureName})); //$NON-NLS-1$
-
- // extract all the input parameters to send to the service
- List argsList = getInputParameters();
-
- // convert lists to arrays
- Object[] args = argsList.toArray(new Object[argsList.size()]);
-
- try {
- ServiceOperation operation = this.service.findOperation(sourceProcedureName);
-
- this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("service_execute", new Object[] {operation.getName()})); //$NON-NLS-1$
- for (int i = 0; i < args.length; i++) {
- this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString( "service_params", new Object[] {args[i]})); //$NON-NLS-1$
- }
-
- Source returnValue = operation.execute(args, getSecurityToken());
-
- this.env.getLogger().logDetail(XMLSourcePlugin.Util.getString("xml_contents", new Object[] {returnValue})); //$NON-NLS-1$
-
- return convertToXMLType(returnValue);
-
- } catch (OperationNotFoundException e) {
- throw new ConnectorException(e);
- } catch (ExcutionFailedException e) {
- throw new ConnectorException(e);
- }
- }
-
- protected SQLXML convertToXMLType(Source value) {
- return (SQLXML)env.getTypeFacility().convertToRuntimeType(value);
- }
-
- public List<?> getOutputParameterValues() throws ConnectorException {
- throw new ConnectorException(XMLSourcePlugin.Util.getString("No_outputs_allowed")); //$NON-NLS-1$
- }
-}
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapService.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapService.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapService.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.net.URL;
import java.util.Iterator;
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapSourceCapabilities.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapSourceCapabilities.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SoapSourceCapabilities.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import org.teiid.connector.basic.BasicConnectorCapabilities;
Deleted: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/TrustedPayloadHandler.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/TrustedPayloadHandler.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/TrustedPayloadHandler.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-
-
-package org.teiid.connector.xmlsource;
-
-import javax.security.auth.Subject;
-
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorLogger;
-
-
-public interface TrustedPayloadHandler {
-
- public String getUser();
-
- public String getPassword();
-
- public void setLogger(ConnectorLogger logger);
-
- public void setSubject(Subject subject);
-
- public void setConnectorEnvironment(ConnectorEnvironment connEnv);
-
- public void processPayloads() throws Exception;
-
- public void setUser(String userName);
-
- public void setPassword(String password);
-}
Deleted: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/XMLSourcePlugin.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/XMLSourcePlugin.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/XMLSourcePlugin.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.xmlsource;
-
-import java.util.ResourceBundle;
-
-import com.metamatrix.core.BundleUtil;
-
-/**
- * For logging purposes
- */
-public class XMLSourcePlugin {
-
- /**
- * The plug-in identifier of this plugin
- */
- public static final String PLUGIN_ID = "org.teiid.connector.xmlsource" ; //$NON-NLS-1$
-
- public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
- PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
-}
Modified: trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-30 21:24:33 UTC (rev 2010)
@@ -38,20 +38,20 @@
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>org.teiid.connector.xmlsource.soap.SoapManagedConnectionFactory</managedconnectionfactory-class>
+ <managedconnectionfactory-class>org.teiid.connector.xml.soap.SoapManagedConnectionFactory</managedconnectionfactory-class>
<config-property>
<description>{$display:"Connector Class",$advanced:"true"}</description>
<config-property-name>ConnectorClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>org.teiid.connector.xmlsource.soap.SoapConnector</config-property-value>
+ <config-property-value>org.teiid.connector.xml.soap.SoapConnector</config-property-value>
</config-property>
<config-property>
<description>{$display:"Connector Capabilities",$description:"The class to use to provide the Connector Capabilities",$advanced:"true"}</description>
<config-property-name>CapabilitiesClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>org.teiid.connector.xmlsource.soap.SoapSourceCapabilities</config-property-value>
+ <config-property-value>org.teiid.connector.xml.soap.SoapSourceCapabilities</config-property-value>
</config-property>
<config-property>
Copied: trunk/connectors/connector-xml-soap/src/main/resources/org/teiid/connector/xml (from rev 2009, trunk/connectors/connector-xml-soap/src/main/resources/org/teiid/connector/xmlsource)
Copied: trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap (from rev 2009, trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xmlsource/soap)
Modified: trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapConnector.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xmlsource/soap/TestSoapConnector.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapConnector.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
@@ -33,7 +33,9 @@
import org.mockito.Mockito;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.xmlsource.soap.SoapService.OperationNotFoundException;
+import org.teiid.connector.xml.soap.SoapConnector;
+import org.teiid.connector.xml.soap.SoapManagedConnectionFactory;
+import org.teiid.connector.xml.soap.SoapService.OperationNotFoundException;
import com.metamatrix.core.util.UnitTestUtil;
Modified: trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapExecution.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xmlsource/soap/TestSoapExecution.java 2010-03-29 17:40:18 UTC (rev 2009)
+++ trunk/connectors/connector-xml-soap/src/test/java/org/teiid/connector/xml/soap/TestSoapExecution.java 2010-03-30 21:24:33 UTC (rev 2010)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.connector.xmlsource.soap;
+package org.teiid.connector.xml.soap;
import java.io.File;
import java.io.PrintWriter;
@@ -44,6 +44,10 @@
import org.teiid.connector.language.Argument.Direction;
import org.teiid.connector.metadata.runtime.Procedure;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+import org.teiid.connector.xml.soap.SecurityToken;
+import org.teiid.connector.xml.soap.SoapConnection;
+import org.teiid.connector.xml.soap.SoapConnector;
+import org.teiid.connector.xml.soap.SoapManagedConnectionFactory;
import com.metamatrix.connector.xmlsource.soap.service.WebServiceServer;
import com.metamatrix.core.util.UnitTestUtil;
14 years, 8 months
teiid SVN: r2009 - trunk/engine/src/main/java/org/teiid/dqp/internal/process.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-29 13:40:18 -0400 (Mon, 29 Mar 2010)
New Revision: 2009
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
Log:
TEIID-1015 ensuring that suspend is called when the thread exits
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-03-29 03:06:28 UTC (rev 2008)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-03-29 17:40:18 UTC (rev 2009)
@@ -330,6 +330,8 @@
} catch (XATransactionException e1) {
LogManager.logWarning(LogConstants.CTX_DQP, e1, DQPPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
}
+ } else {
+ suspend();
}
}
14 years, 9 months