[teiid-commits] teiid SVN: r2483 - in branches/7.1.x: client/src/main/java/org/teiid/jdbc and 8 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Aug 23 13:44:21 EDT 2010


Author: shawkins
Date: 2010-08-23 13:44:19 -0400 (Mon, 23 Aug 2010)
New Revision: 2483

Added:
   branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/dataroles.xml
Removed:
   branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
Modified:
   branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
   branches/7.1.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
   branches/7.1.x/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
   branches/7.1.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
   branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java
   branches/7.1.x/client/src/main/java/org/teiid/net/ServerConnection.java
   branches/7.1.x/client/src/main/java/org/teiid/net/socket/ServerDiscovery.java
   branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
   branches/7.1.x/client/src/main/java/org/teiid/net/socket/UrlServerDiscovery.java
   branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
   branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
   branches/7.1.x/documentation/reference/src/main/docbook/en-US/Reference.xml
   branches/7.1.x/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
   branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
Log:
TEIID-1211 refining load balancing support utilizing a set statement.

Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-08-23 17:44:19 UTC (rev 2483)
@@ -26,31 +26,7 @@
 </UL>
 <H2><A NAME="Highlights"></A>Highlights</H2>
 <UL>
-    <LI><B>ODBC Support</B> - Support for ODBC access is now available through PostgreSQL ODBC driver clients.  See the Client Developer's Guide for more on how
-    to use Teiid's ODBC access.
-    <LI><B>Native Materialized Tables</B> - views marked as materialized without a target table will be materialized internally by Teiid.  Materialized view tables will 
-    be indexed by the primary key of the view if present and can be controlled through the expanded cache hint.  
-    There are also new system procedures refreshMatView and refreshMatViewRow to refresh internal materialized view contents.
-    <LI><B>Expanded Cache Hint</B> - The cache hint can now specify pref_mem to indicate that data should prefer to be held in memory, ttl to indicate the time-to-live, 
-    and updatable to indicate that a materialized view with a primary key can be updated by row with the refreshMatViewRow system procedure.
-    <LI><B>SQL Support</B>
-        <ul> 
-           <li>Added NULLS FIST/LAST handling - including pushdown support.  
-           <li>Added enhanced numeric stat aggregate functions STDDEV_POP, STDDEV_SAMP, VAR_POP, VAR_SAMP, with pushdown and aggregate decomposition.  
-           <li>Added support for the boolean aggregate functions ANY, SOME, EVERY.
-           <li>Added support for using boolean value expression as both criteria and expressions, e.g. "... where boolean_value" or "select x = 1 as boolean_value ...".
-           <li>Changed named procedure syntax to accept param=>value, rather than param=value.
-           <li>Added PRIMARY KEY and the associated index support to temp tables.
-        </ul>
-    <LI>
-    <LI><B>Parallel Source Queries</B> - reestablished parallel execution of source queries within a query plan along with a prioritized work system to help prevent resource contention.
-    <LI><B>Improved Insert Support</B> - Cross source inserts using a query expression can defer to the source to perform the entire insert atomically with source controlled batching.  
-    See maxPreparedInsertBatchSize on any JDBC translator supporting the InsertWithIterator capability.
-    <LI><B>SHOW Statement</B> - added client handling for the SHOW statement to retrieve query plan information and see parameter values.
-    <LI><B>User Identity</B> - Teiid DataSources in JBossAS connecting to a local Teiid instance can preserve the thread's user identity, rather than requiring
-    a new authentication.  See TeiidDataSource.setPassthroughAuthentication.
-    <LI><B>VDB Versioning</B> - The VDB version may be determined by the deployed file name.  The expected pattern is &lt;VDB Name&gt;.&lt;Version&gt;.vdb.  See the Admin Guide 
-    for more on how to use VDB versioning.
+    <LI><B>Refined Load Balancing and Fail Over</B> - clients can use use the statement "SET NEWINSTANCE TRUE" to allow their connection to select a new server instance.  See the Client Developer's Guide for more information. 
 </UL>
 
 <h2><a name="Compatibility">Compatibility Issues</a></h2>
@@ -155,174 +131,7 @@
 
 <h2><a name="Details">Detailed Release Notes</a></h2>
         Detailed Release Notes - Teiid - Version ${project.version}
-<h2>        Bug
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-76'>TEIID-76</a>] -         Attempting to execute a procedure from MM to MM returns error &quot;&lt;procedure&gt;() does not exist&quot;
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-108'>TEIID-108</a>] -         xsd type conversion should be consistent
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1107'>TEIID-1107</a>] -         Add support for raising criteria if it has been pushed too far
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1140'>TEIID-1140</a>] -         Unnecessary jars in the Teiid deployment
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1141'>TEIID-1141</a>] -         getCatalogs call on DatabaseMetadata is returning no rows
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1144'>TEIID-1144</a>] -         PostgreSQL (simple capabilities) returning an unexpected number of rows
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1145'>TEIID-1145</a>] -         Unable to deploy VDB with virtual BQT2 model
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1147'>TEIID-1147</a>] -         Sybase concat function handling
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1149'>TEIID-1149</a>] -         Importing tables from a deployed VDB does not import columns
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1152'>TEIID-1152</a>] -         Jopr Plugin Needs to Handle Secure ProfileService Connection
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1153'>TEIID-1153</a>] -         Turned of ProfileService authenticatiion and it caused an NPE in the Teiid RHQ Plugin
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1157'>TEIID-1157</a>] -         NPE with texttable planning
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1166'>TEIID-1166</a>] -         Receiving ASSERTION FAILED: expected reference to be not null from SQL query with sub-select
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1169'>TEIID-1169</a>] -         VDBs are not being displayed in Jopr
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1172'>TEIID-1172</a>] -         Loopback translator fails to be invoked when a property is set
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1178'>TEIID-1178</a>] -         Jopr VDB loading error when Data Source is not available
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1180'>TEIID-1180</a>] -         the deprecated input group qualifier should be replaced with inputs
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1181'>TEIID-1181</a>] -         Teiid Pushdown queries producing unexpected results (Sybase 12.5)
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1182'>TEIID-1182</a>] -         UDF model is not being loaded if the file is not placed in the root location of VDB
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1183'>TEIID-1183</a>] -         Cannot create a SalesForce datasource throught the admin API.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1185'>TEIID-1185</a>] -         Shutting down JBoss AS server causes NPE in ClusterableCacheFactory
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1186'>TEIID-1186</a>] -         broken internal link in Teiid Reference Documentation
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1188'>TEIID-1188</a>] -         Error while reading the template properties for LDAP
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1192'>TEIID-1192</a>] -         JDBC driver doesn&#39;t accept underscores _ in server names
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1200'>TEIID-1200</a>] -         Non-parsable SQL in transformation provides no help to user - NPE in stack trace
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1201'>TEIID-1201</a>] -         Property &#39;Url&#39; with value &#39;vfsfile:/home/pnittel/Teiid71/jboss-5.1.0.GA/server/default/deploy/EyeTuneZ-vdb.xml&#39; is not a valid URL
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1203'>TEIID-1203</a>] -         &quot;connector-ws&quot; is not visible as one of the avaialble connectors
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1206'>TEIID-1206</a>] -         NPE during the JDBC Metadata read when &quot;resultSetCacheMode=true&quot; turned on
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1208'>TEIID-1208</a>] -         VDB &quot;getStatus&quot; through Admin API always returning &quot;INACTIVE&quot;
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1216'>TEIID-1216</a>] -         Cannot pass xml result from one select as critera to another select
-</li>
-</ul>
-        
-<h2>        Feature Request
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-168'>TEIID-168</a>] -         Refine caching behavior
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-250'>TEIID-250</a>] -         Enable Axis data compression in SFDC Connector, per SFDC API guidelines
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-715'>TEIID-715</a>] -         Add support for nulls first/last
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-829'>TEIID-829</a>] -         revamp code table caching
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-860'>TEIID-860</a>] -         Add odbc support
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-886'>TEIID-886</a>] -         Request for more statistical functions in Teiid
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-892'>TEIID-892</a>] -         Add a capability to control bulk insert batch size
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-908'>TEIID-908</a>] -         Enable access to the query plan without reference to Teiid classes.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-968'>TEIID-968</a>] -         Timestamp literals with fractional seconds result in source query execution performance when being compared to less percise time types
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1006'>TEIID-1006</a>] -         Dynamic vdb metadata load enhancements
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1028'>TEIID-1028</a>] -         Make Materialized Views first class objects in the system
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1048'>TEIID-1048</a>] -         Embedded Connection should support the pass though authentication
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1151'>TEIID-1151</a>] -         Re-enable multi-threaded source query execution
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1155'>TEIID-1155</a>] -         Allow boolean value expressions to be used as criteria or expressions
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1167'>TEIID-1167</a>] -         Add support for primary key handling in temp tables
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1177'>TEIID-1177</a>] -         Allow for implicit temp table definition with just a query, omitting the columns 
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1179'>TEIID-1179</a>] -         Add a CommandContext interface to the teiid api
-</li>
-</ul>
     
-<h2>        Patch
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1184'>TEIID-1184</a>] -         Patch to refactor numbered &lt;sect&gt; tags in documentation to &lt;section&gt;
-</li>
-</ul>
-    
-<h2>        Quality Risk
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-954'>TEIID-954</a>] -         Need method to control max amount of buffer disk space
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1150'>TEIID-1150</a>] -         Introduce alternative named parameter syntax
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1154'>TEIID-1154</a>] -         Remove JDOM
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1187'>TEIID-1187</a>] -         Refine vdb version logic
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1190'>TEIID-1190</a>] -         Procedure logic clean up
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1199'>TEIID-1199</a>] -         Use consistent names for security concepts
-</li>
-</ul>
-            
-<h2>        Task
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-749'>TEIID-749</a>] -         Replace the TestNoArgConnector Test with an integration test.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-882'>TEIID-882</a>] -         Look into using javax.xml.xpath in the XML-Relational connectors.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-996'>TEIID-996</a>] -         Administration of the granular entitlements to data elements should be supported using the  management console.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1055'>TEIID-1055</a>] -         Secure profile service access
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1142'>TEIID-1142</a>] -         Teiid should work with EAP 5.1 
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1143'>TEIID-1143</a>] -         Remove the version number from the RAR files, to promote easy migration between the versions
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1160'>TEIID-1160</a>] -         Add Support for Discovery of Dynamic VDBs in Teiid Jopr Plugin
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1165'>TEIID-1165</a>] -         Upgrade to Netty 3.2.0 final
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1173'>TEIID-1173</a>] -         Provide a facility to create &quot;empty&quot; VDBs for preview purpose
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1174'>TEIID-1174</a>] -         Allow &#39;-&#39; character in VDB names.
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1194'>TEIID-1194</a>] -         Document the recommended approach to using Teiid entitlements
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1207'>TEIID-1207</a>] -         Fix Yahoo Translator to work with &quot;Dynamic Portfoilo&quot; example
-</li>
-</ul>
-            
-<h2>        Sub-task
-</h2>
-<ul>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-958'>TEIID-958</a>] -         Provide ability to monitor buffer manager disk space usage and free space
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1189'>TEIID-1189</a>] -         JOPR support for multiple versions
-</li>
-<li>[<a href='https://jira.jboss.org/browse/TEIID-1198'>TEIID-1198</a>] -         Allow specifying the VDB version as part of the VDB name in the JDBC URL connection string.
-</li>
-</ul>
-    
 <h2><a name="Documentation">Documentation and Help</a></h2>
 
 The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.

Modified: branches/7.1.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -900,10 +900,7 @@
         	logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
         }
         
-		//perform load balancing
-		if (this.serverConn instanceof SocketServerConnection) {
-			((SocketServerConnection)this.serverConn).selectNewServerInstance();
-		}
+		this.serverConn.cleanUp();
 	}
 	
 	public boolean isSameProcess(ConnectionImpl conn) throws CommunicationException {

Modified: branches/7.1.x/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -100,5 +100,7 @@
      */
     public static final String NOEXEC = "NOEXEC"; //$NON-NLS-1$
     
+    public static final String NEWINSTANCE = "NEWINSTANCE"; //$NON-NLS-1$
+    
 }
     
\ No newline at end of file

Modified: branches/7.1.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -395,7 +395,11 @@
         		}
         		String key = match.group(1);
         		String value = match.group(2);
-        		JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
+        		if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
+        			this.getMMConnection().getServerConnection().cleanUp();
+        		} else {
+        			JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
+        		}
         		this.updateCounts = new int[] {0};
         		return;
         	}

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -32,6 +32,10 @@
 
 /**
  * Defines the hostname/port or {@link InetAddress} to connect to a host.
+ * 
+ * Similar to an {@link InetSocketAddress} except that it can be constructed
+ * fully resolved, with an {@link InetAddress} and a hostname.
+ * 
  * @since 4.2
  */
 public class HostInfo {
@@ -41,12 +45,23 @@
     private InetAddress inetAddress;
     private boolean ssl;
     
+    /**
+     * Construct a fully resolved {@link HostInfo}.
+     * @param hostName
+     * @param addr
+     */
     public HostInfo(String hostName, InetSocketAddress addr) {
     	this.hostName = hostName;
     	this.portNumber = addr.getPort();
     	this.inetAddress = addr.getAddress();
     }
     
+    /**
+     * Construct a {@link HostInfo} that can resolve each
+     * time an {@link InetAddress} is asked for.
+     * @param host
+     * @param port
+     */
     public HostInfo (String host, int port) {
     	ArgCheck.isNotNull(host);
 		this.hostName = host.toLowerCase();
@@ -101,6 +116,9 @@
         if (inetAddress != null && hostInfo.inetAddress != null) {
         	return inetAddress.equals(hostInfo.inetAddress);
         }
+        if (ssl != hostInfo.ssl) {
+        	return false;
+        }
         return hostName.equals(hostInfo.getHostName());
     }
 

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/ServerConnection.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/ServerConnection.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/ServerConnection.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -38,4 +38,6 @@
 	
 	boolean isSameInstance(ServerConnection conn) throws CommunicationException;
 	
+	void cleanUp();
+	
 }
\ No newline at end of file

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/socket/ServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/ServerDiscovery.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/ServerDiscovery.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -44,7 +44,8 @@
 	void init(TeiidURL url, Properties p);
 	
 	/**
-	 * Get the currently known hosts. 
+	 * Get the currently known hosts.  Will be called prior to connecting and after
+	 * authentication for each connection. 
 	 * @param result, the current {@link LogonResult} - may be null if unauthenticated 
 	 * @param instance, the currently connected instance - may be null if not connected
 	 * @return
@@ -67,5 +68,14 @@
 	 * Shutdown this {@link ServerDiscovery}
 	 */
 	void shutdown();
+	
+	/**
+	 * Select the next instance to try.  The entry should be removed from the list
+	 * when no more attempts are desired.  
+	 * and not return null.
+	 * @param hosts
+	 * @return a non-null HostInfo to try
+	 */
+	HostInfo selectNextInstance(List<HostInfo> hosts);
 		
 }

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -114,7 +113,7 @@
 		List<HostInfo> hostCopy = new ArrayList<HostInfo>(hostKeys);
 		int knownHosts = hostKeys.size();
 		while (hostKeys.size() > 0) {
-			HostInfo hostInfo = hostKeys.remove((int) (Math.random() * hostKeys.size()));
+			HostInfo hostInfo = this.serverDiscovery.selectNextInstance(hostKeys);
 
 			Exception ex = null;
 			try {
@@ -165,9 +164,6 @@
 
 	private ILogon connect(HostInfo hostInfo) throws CommunicationException,
 			IOException {
-		if (!hostInfo.isResolved()) {
-			hostInfo = new HostInfo(hostInfo.getHostName(), new InetSocketAddress(hostInfo.getInetAddress(), hostInfo.getPortNumber()));
-		}
 		hostInfo.setSsl(secure);
 		this.serverInstance = connectionFactory.getServerInstance(hostInfo);
 		this.logonResult = logonResults.get(hostInfo);
@@ -305,7 +301,7 @@
 		}
 	}
 	
-	public void selectNewServerInstance() {
+	public void cleanUp() {
 		closeServerInstance();
 	}
 	

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/socket/UrlServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/UrlServerDiscovery.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/UrlServerDiscovery.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -31,7 +31,8 @@
 
 
 /**
- * Simple URL discovery strategy
+ * Simple URL discovery strategy with a random load balancing policy
+ * TOOD: add black listing support
  */
 public class UrlServerDiscovery implements ServerDiscovery {
 
@@ -70,4 +71,9 @@
 		
 	}
 	
+	@Override
+	public HostInfo selectNextInstance(List<HostInfo> hosts) {
+		return hosts.remove((int) (Math.random() * hosts.size()));
+	}
+	
 }

Modified: branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -64,7 +64,7 @@
 		processes.add(p2);
 		Mockito.stub(serverAdmin.getProcesses("*")).toReturn(processes); //$NON-NLS-1$
 		Mockito.stub(instance.getService(Admin.class)).toReturn(serverAdmin);
-		Mockito.stub(instance.getHostInfo().getHostName()).toReturn("foo"); //$NON-NLS-1$
+		Mockito.stub(instance.getHostInfo()).toReturn(knownHost);
 		
 		discovery.connectionSuccessful(knownHost);
 		List<HostInfo> knownHosts = discovery.getKnownHosts(new LogonResult(), instance);

Modified: branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2010-08-23 17:44:19 UTC (rev 2483)
@@ -278,15 +278,15 @@
                         </entry>
                         <entry>Server where the Teiid runtime installed</entry>
                     </row>
-                    <!-- <row>
+                    <row>
                         <entry>
                             <code>AlternateServers</code>
                         </entry>
                         <entry>
                             <code>String</code>
                         </entry>
-                        <entry>Optional , delimited list of host:port entries.  See the <link linkend="multiple_hosts">multiple hosts</link> section for more information.</entry>
-                    </row> -->
+                        <entry>Optional delimited list of host:port entries.  See the <link linkend="multiple_hosts">multiple hosts</link> section for more information.</entry>
+                    </row>
                     <row>
                         <entry>
                             <code>AdditionalProperties</code>
@@ -488,27 +488,61 @@
     
     <section id="multiple_hosts">
         <title>Using Multiple Hosts</title>
-        <para>A group of Teiid Servers in the same AS cluster may be connected using connection time failover and load-balancing.
-        To enable this feature the client needs to specify multiple host name and port number combinations on the URL connection string. 
-        The client will randomly pick any one the Teiid server from the list and will have session established with that server.  
-        If that server cannot be contacted, then a connection will be attempted to each of the remaining servers in random order.</para>   
-        
-        <!-- If the "autoFailover" connection property is set to "true", a failure with the connected server will cause the client to automatically failover 
-        to other available servers.  Even if autoFailover is not set, when using a managed DataSource based connection, the connection will randomly select a new server instance when it is returned to the pool.</para>
-        -->
-        <example><title>Example URL connection string</title><programlisting><![CDATA[jdbc:teiid:&lt;vdb-name&gt;@mm://host1:31000, host1:31001, host2:31000;version=2]]></programlisting></example>        
-        
-        <!-- <para>Currently when the fail over happens, the user is re-authenticated with the new server. The clustering 
-        feature coming up in the Teiid 7.1 release will define how the transparent session fail over will occur with out the 
-        re-authentication.</para>
-        
-        <para>You can also use this feature to distribute the query load among various avaialble Teiid Servers available. 
-        Load balancing happens automatically, when you are using a data source along with connection pooling. Each time a connection is 
-        grabbed from the pool, it will randomly select a Teiid Server to distribute the load. Note, that load balacing feature 
-        is not avaialble if you are using Teiid Driver to make your connection.</para>-->
-        
-        <para>If you are using DataSource to connect to Teiid Server, use "AlternateServers" property/method to define the failover servers.
-        Check out the Javadoc on the format of the string.</para>
+        <para>A group of Teiid Servers in the same JBoss AS cluster may be connected using failover and load-balancing features.
+        To enable theses features in their simplest form, the client needs to specify multiple host name and port number combinations on the URL connection string. 
+        <example><title>Example URL connection string</title><programlisting><![CDATA[jdbc:teiid:&lt;vdb-name&gt;@mm://host1:31000,host1:31001,host2:31000;version=2]]></programlisting></example>
+        </para>
+        <para>If you are using a DataSource to connect to Teiid Server, use the "AlternateServers" property/method to define the failover servers.  The format is also a comma separated list of host:port combinations.</para> 
+		<para>The client will randomly pick one the Teiid server from the list and establish a session with that server.  
+        If that server cannot be contacted, then a connection will be attempted to each of the remaining servers in random order.  
+        This allows for both connection time fail-over and random server selection load balancing.                
+        </para>
+        <section id="failover">
+        	<title>Fail Over</title>
+        	<para>Post connection fail over will be sued if you're using an admin connection (such as what is used by AdminShell) or if the autoFailover connection property is set to true. 
+        	Post connection failover works by sending a ping, at most every second, to test the connection prior to use.  If the ping fails, a new instance will be selected prior to the operation being attempted.  
+        	This is not true "transparent application failover" as the client will not restart the transaction/query/recreate session scoped temp tables, etc.  So this feature should be used with caution by non-admin connections.</para>
+        </section>
+        <section id="loadbalancing">
+        	<title>Load Balancing</title>
+        	<para>Post connection load balancing can be utilized in one of two ways.  First if you are using <code>TeiidDataSource</code> and the Connections returned by 
+        	Teiid <code>PooledConnections</code> have their <code>close</code> method called, then a new server instance will be selected automatically. 
+        	However when using driver based connections or even when using <code>TeiidDataSource</code> in a connection pool (such as JBoss AS), the automatic load balancing will not happen.  
+        	Second you can explicitly trigger load balancing through the use of the set statement: <programlisting>SET NEWINSTANCE TRUE</programlisting>
+        	Typically you will not need want to issue this statement manually, but instead use it as the connection test query on your DataSource configuration.
+        	<example>
+        		<title>JBoss AS DataSource With Post Connection Load Balancing</title>
+        	<programlisting><![CDATA[<datasources> 
+  <local-tx-datasource> 
+    <jndi-name>TEIID-DS</jndi-name> 
+    <connection-url>jdbc:metamatrix:myVDB at mm://localhost:31000,mm://localhost:32000</connection-url> 
+    <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>              
+    <user-name>admin</user-name>
+    <password>teiid</password>
+     
+    <!-- pool and other JBoss datasource properties -->
+    <check-valid-connection-sql>SET NEWINSTANCE TRUE</check-valid-connection-sql>
+    <min-pool-size>5</min-pool-size> 
+    <max-pool-size>10</max-pool-size>
+  </local-tx-datasource> 
+</datasources>]]></programlisting>
+</example>
+        	</para>
+        	<para>Teiid by default maintians a pool of extra socket connections that are reused.  For load balancing, this reduces the potential cost of switching a connection to another server instance.  
+        	The default setting is to maintain 16 connections (see <code>org.teiid.sockets.maxCachedInstances</code> in the client jar's teiid-client-settings.properties file.  
+        	If you're client is connecting to large numbers of Teiid instances and you're using post connection time load balancing, then consider increasing the number of cached instances.  
+        	You may either set an analogous system property or create another version of teiid-client-settings.properties file and place it into the classpath ahead of the client jar.</para>
+        </section>
+        <section id="advancedconfig">
+        	<title>Advanced Configuration</title>
+        	<para>Server discovery, load balancing, fail over, retry, retry delay, etc. may be customize if the default policy is not sufficient.  
+        	See the <code>org.teiid.net.socket.ServerDiscovery</code> interface and default implementaion <code>org.teiid.net.socket.UrlServerDiscovery</code> for how to start with your customization.
+        	The <code>UrlServerDiscovery</code> implemenation provides the following: discovery of servers from the URL hosts (DataSource server/alternativeServers), random selection for load balancing and failover, 1 connection attempt per host, no biasing, black listing, or other advanced features.  
+        	Typically you'll want to extend the <code>UrlServerDiscovery</code> so that it can be used as the fallback strategy and to only implement the necessary changed methods.  
+        	It's important to consider that 1 <code>ServerDiscovery</code> instance will be created for each connection.  Any sharing of information between instances should be done through static state or some other shared lookup.       	
+        	</para>
+        	<para>Your customized server discovery class will then need to be referenced by the discoveryStategy connection/DataSource property by its full class name.</para>
+        </section>
     </section>
     
 </chapter>
\ No newline at end of file

Modified: branches/7.1.x/documentation/reference/src/main/docbook/en-US/Reference.xml
===================================================================
--- branches/7.1.x/documentation/reference/src/main/docbook/en-US/Reference.xml	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/documentation/reference/src/main/docbook/en-US/Reference.xml	2010-08-23 17:44:19 UTC (rev 2483)
@@ -53,7 +53,7 @@
   <xi:include href="content/scalar_functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="content/procedures.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="content/transaction_support.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-  <xi:include href="content/entitlements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="content/dataroles.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="content/system_schema.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="content/translators.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="content/federated_planning.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />

Copied: branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/dataroles.xml (from rev 2478, branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml)
===================================================================
--- branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/dataroles.xml	                        (rev 0)
+++ branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/dataroles.xml	2010-08-23 17:44:19 UTC (rev 2483)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="dataroles">
+    <title>Data Roles</title>
+    <para>Data roles, also called entitlements, are sets of permissions that are defined 
+    per VDB that dictate data access (create, read,  update, delete). The use of data roles is controlled system wide with the property in 
+    <code>&lt;jboss-install&gt;/server/&lt;profile&gt;/deploy/teiid/teiid-jboss-beans.xml</code> file
+    in bean configuration section of <code>RuntimeEngineDeployer</code> with property <code>useDataRoles</code>.</para>
+    
+    <para>Once data roles are enabled, the access permissions defined in a VDB will be enforced by the Teiid Server.  
+    </para>
+    
+    <warning><para>Teiid uses a deny by default permission system, so all VDBs deployed to the server will need roles granting access with this feature enabled.</para></warning>
+
+    <section>
+    	<title>Permissions</title>
+
+		<para>CREATE, READ, UPDATE, DELETE (CRUD) permissions can be set for any resource path in a VDB.  
+		A resource path can be as specific as the fully qualified name of a column or as general a top level model (schema) name.
+		Permissions granted to a particular path apply to it and any resource paths that share the same partial name.  
+		For example, granting read to "model" will also grant read to "model.table", "model.table.column", etc.
+		Allowing or denying a particular action is determined by searching for permissions from the most to least specific resource paths.
+		The first permission found with a specific allow or deny will be used.  
+		Thus it is possible to set very general permissions at high-level resource path names and to override only as necessary at more specific resource paths. 
+		</para>
+
+		<para>Permission grants are only needed for resources that are visible.
+			All non-visible, typically physical, models in a VDB are automatically
+			inaccessible by user level requests. Permissions are also only applied
+			to the columns and tables in the user query - not to every resource
+			accessed transitively through views and procedures.
+			It is important therefore to ensure that permission grants are applied
+			consistently across visible models that access the same resources.
+		</para>
+		    	
+   	    <orderedlist>
+	        <para>To process a <emphasis>SELECT</emphasis> statement or a stored procedure execution, the user account requires the following access rights:</para>
+	        <listitem> <para><emphasis>READ</emphasis> - on the Table(s) being accessed or the procedure being called.</para></listitem>
+	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced.</para></listitem>
+	    </orderedlist>   
+	    
+	    <orderedlist>
+	        <para>To process an <emphasis>INSERT</emphasis> statement, the user account requires the following access rights:</para>
+	        <listitem> <para><emphasis>CREATE</emphasis> - on the Table being inserted into.</para></listitem>
+	        <listitem> <para><emphasis>CREATE</emphasis> - on every column being inserted on that Table.</para></listitem>
+	    </orderedlist>   
+	    
+	    <orderedlist>
+	        <para>To process an <emphasis>UPDATE</emphasis> statement, the user account requires the following access rights:</para>
+	        <listitem> <para><emphasis>UPDATE</emphasis> - on the Table being updated.</para></listitem>
+	        <listitem> <para><emphasis>UPDATE</emphasis> - on every column being updated on that Table.</para></listitem>
+	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced in the criteria.</para></listitem>
+	    </orderedlist>    
+	    
+	    <orderedlist>
+	    	<para>To process a <emphasis>DELETE</emphasis> statement, the user account requires the following access rights:</para>
+	        <listitem> <para><emphasis>DELETE</emphasis> - on the Table being deleted.</para></listitem>
+	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced in the criteria.</para></listitem>
+	    </orderedlist> 
+	    
+	    <orderedlist>
+	    	<para>To process a <emphasis>EXEC</emphasis> statement, the user account requires the following access rights:</para>
+	        <listitem> <para><emphasis>READ</emphasis> - on the Procedure being executed.</para></listitem>
+	    </orderedlist>
+	       
+    </section>
+
+	<section>
+		<title>XML Definition</title>
+	    <para>Data roles are defined inside the <code>vdb.xml</code> file (inside the .vdb Zip archive under META-INF/vdb.xml) if you used Designer. 
+    This example will show a sample "vdb.xml" file with few simple data rules.</para>
+    
+    <para>For example, if a VDB defines a table "TableA" in schema "modelName" with columns (column1, column2) - note that the column types do not matter.  And we wish to define three roles "RoleA", "RoleB", "RoleC" with following permissions:
+   <orderedlist>
+    <listitem><para>RoleA has privileges to read, write access to TableA, but can not delete.</para></listitem>
+    <listitem><para>RoleB has no privileges that allow access to TableA</para></listitem>
+    <listitem><para>RoleC has privileges that only allow read access to TableA.column1</para></listitem>
+   </orderedlist>
+	</para>
+    <example><title>vdb.xml defining RoleA, RoleB, and RoleC</title>
+   <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<vdb name="sample" version="1">
+
+    <model name="modelName">
+        <source name="source-name" translator-name="oracle" connection-jndi-name="java:myDS" />
+    </model>
+
+    <data-role name="RoleA">
+        <description>Allow all, except Delete</description>
+
+        <permission>
+            <resource-name>modelName.TableA</resource-name>
+            <allow-create>true</allow-create>
+            <allow-read>true</allow-read>
+            <allow-update>true</allow-update>
+        </permission>
+
+        <permission>
+            <resource-name>modelName.TableA.colum1</resource-name>
+            <allow-create>true</allow-create>
+            <allow-read>true</allow-read>
+            <allow-update>true</allow-update>
+        </permission>
+
+        <permission>
+            <resource-name>modelName.TableA.column2</resource-name>
+            <allow-create>true</allow-create>
+            <allow-read>true</allow-read>
+            <allow-update>true</allow-update>
+        </permission>
+
+        <mapped-role-name>role1</mapped-role-name>
+
+    </data-role>
+
+    <data-role name="RoleC">
+        <description>Allow read only</description>
+
+        <permission>
+            <resource-name>modelName.TableA</resource-name>
+            <allow-read>true</allow-read>
+        </permission>
+
+        <permission>
+            <resource-name>modelName.TableA.colum1</resource-name>
+            <allow-read>true</allow-read>
+        </permission>
+
+        <mapped-role-name>role2</mapped-role-name>
+    </data-role>
+</vdb>]]></programlisting>    
+</example>   
+   <para>The above XML defined two data roles, "RoleA" which allows everything except delete on the table, "RoleC" that 
+   allows only read operation on the table. Since Teiid uses deny by default, there is no explicit data-role entry needed for "RoleB".  The "mapped-role-name" defines the JAAS "role" to whom these policies are applicable.</para>
+   
+   <para>For assigning roles to your users in the JBoss AS, 
+   check out the instructions for the selected Login Module. Check the "Admin Guide" for configuring Login Modules.</para> 
+   
+   <para>The "vdb.xml" file is checked against the schema file <code>vdb-deployer.xsd</code>, check the documents sections of the Teiid kit
+   to find a copy of the schema file.</para>
+   
+	</section>
+
+</chapter>
\ No newline at end of file


Property changes on: branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/dataroles.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
===================================================================
--- branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml	2010-08-23 17:44:19 UTC (rev 2483)
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
-%CustomDTD;
-]>
-<chapter id="entitlements">
-    <title>Data Roles</title>
-    <para>Data roles, also called entitlements, are sets of permissions that are defined 
-    per VDB that dictate data access (create, read,  update, delete). The use of data roles is controlled system wide with the property in 
-    <code>&lt;jboss-install&gt;/server/&lt;profile&gt;/deploy/teiid/teiid-jboss-beans.xml</code> file
-    in bean configuration section of <code>RuntimeEngineDeployer</code> with property <code>useDataRoles</code>.</para>
-    
-    <para>Once data roles are enabled, the access permissions defined in a VDB will be enforced by the Teiid Server.  
-    </para>
-    
-    <warning><para>Teiid uses a deny by default permission system, so all VDBs deployed to the server will need roles granting access with this feature enabled.</para></warning>
-
-    <section>
-    	<title>Permissions</title>
-
-		<para>CREATE, READ, UPDATE, DELETE (CRUD) permissions can be set for any resource path in a VDB.  
-		A resource path can be as specific as the fully qualified name of a column or as general a top level model (schema) name.
-		Permissions granted to a particular path apply to it and any resource paths that share the same partial name.  
-		For example, granting read to "model" will also grant read to "model.table", "model.table.column", etc.
-		Allowing or denying a particular action is determined by searching for permissions from the most to least specific resource paths.
-		The first permission found with a specific allow or deny will be used.  
-		Thus it is possible to set very general permissions at high-level resource path names and to override only as necessary at more specific resource paths. 
-		</para>
-
-		<para>Permission grants are only needed for resources that are visible.
-			All non-visible, typically physical, models in a VDB are automatically
-			inaccessible by user level requests. Permissions are also only applied
-			to the columns and tables in the user query - not to every resource
-			accessed transitively through views and procedures.
-			It is important therefore to ensure that permission grants are applied
-			consistently across visible models that access the same resources.
-		</para>
-		    	
-   	    <orderedlist>
-	        <para>To process a <emphasis>SELECT</emphasis> statement or a stored procedure execution, the user account requires the following access rights:</para>
-	        <listitem> <para><emphasis>READ</emphasis> - on the Table(s) being accessed or the procedure being called.</para></listitem>
-	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced.</para></listitem>
-	    </orderedlist>   
-	    
-	    <orderedlist>
-	        <para>To process an <emphasis>INSERT</emphasis> statement, the user account requires the following access rights:</para>
-	        <listitem> <para><emphasis>CREATE</emphasis> - on the Table being inserted into.</para></listitem>
-	        <listitem> <para><emphasis>CREATE</emphasis> - on every column being inserted on that Table.</para></listitem>
-	    </orderedlist>   
-	    
-	    <orderedlist>
-	        <para>To process an <emphasis>UPDATE</emphasis> statement, the user account requires the following access rights:</para>
-	        <listitem> <para><emphasis>UPDATE</emphasis> - on the Table being updated.</para></listitem>
-	        <listitem> <para><emphasis>UPDATE</emphasis> - on every column being updated on that Table.</para></listitem>
-	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced in the criteria.</para></listitem>
-	    </orderedlist>    
-	    
-	    <orderedlist>
-	    	<para>To process a <emphasis>DELETE</emphasis> statement, the user account requires the following access rights:</para>
-	        <listitem> <para><emphasis>DELETE</emphasis> - on the Table being deleted.</para></listitem>
-	        <listitem> <para><emphasis>READ</emphasis> - on every column referenced in the criteria.</para></listitem>
-	    </orderedlist> 
-	    
-	    <orderedlist>
-	    	<para>To process a <emphasis>EXEC</emphasis> statement, the user account requires the following access rights:</para>
-	        <listitem> <para><emphasis>READ</emphasis> - on the Procedure being executed.</para></listitem>
-	    </orderedlist>
-	       
-    </section>
-
-	<section>
-		<title>XML Definition</title>
-	    <para>Data roles are defined inside the <code>vdb.xml</code> file (inside the .vdb Zip archive under META-INF/vdb.xml) if you used Designer. 
-    This example will show a sample "vdb.xml" file with few simple data rules.</para>
-    
-    <para>For example, if a VDB defines a table "TableA" in schema "modelName" with columns (column1, column2) - note that the column types do not matter.  And we wish to define three roles "RoleA", "RoleB", "RoleC" with following permissions:
-   <orderedlist>
-    <listitem><para>RoleA has privileges to read, write access to TableA, but can not delete.</para></listitem>
-    <listitem><para>RoleB has no privileges that allow access to TableA</para></listitem>
-    <listitem><para>RoleC has privileges that only allow read access to TableA.column1</para></listitem>
-   </orderedlist>
-	</para>
-    <example><title>vdb.xml defining RoleA, RoleB, and RoleC</title>
-   <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<vdb name="sample" version="1">
-
-    <model name="modelName">
-        <source name="source-name" translator-name="oracle" connection-jndi-name="java:myDS" />
-    </model>
-
-    <data-role name="RoleA">
-        <description>Allow all, except Delete</description>
-
-        <permission>
-            <resource-name>modelName.TableA</resource-name>
-            <allow-create>true</allow-create>
-            <allow-read>true</allow-read>
-            <allow-update>true</allow-update>
-        </permission>
-
-        <permission>
-            <resource-name>modelName.TableA.colum1</resource-name>
-            <allow-create>true</allow-create>
-            <allow-read>true</allow-read>
-            <allow-update>true</allow-update>
-        </permission>
-
-        <permission>
-            <resource-name>modelName.TableA.column2</resource-name>
-            <allow-create>true</allow-create>
-            <allow-read>true</allow-read>
-            <allow-update>true</allow-update>
-        </permission>
-
-        <mapped-role-name>role1</mapped-role-name>
-
-    </data-role>
-
-    <data-role name="RoleC">
-        <description>Allow read only</description>
-
-        <permission>
-            <resource-name>modelName.TableA</resource-name>
-            <allow-read>true</allow-read>
-        </permission>
-
-        <permission>
-            <resource-name>modelName.TableA.colum1</resource-name>
-            <allow-read>true</allow-read>
-        </permission>
-
-        <mapped-role-name>role2</mapped-role-name>
-    </data-role>
-</vdb>]]></programlisting>    
-</example>   
-   <para>The above XML defined two data roles, "RoleA" which allows everything except delete on the table, "RoleC" that 
-   allows only read operation on the table. Since Teiid uses deny by default, there is no explicit data-role entry needed for "RoleB".  The "mapped-role-name" defines the JAAS "role" to whom these policies are applicable.</para>
-   
-   <para>For assigning roles to your users in the JBoss AS, 
-   check out the instructions for the selected Login Module. Check the "Admin Guide" for configuring Login Modules.</para> 
-   
-   <para>The "vdb.xml" file is checked against the schema file <code>vdb-deployer.xsd</code>, check the documents sections of the Teiid kit
-   to find a copy of the schema file.</para>
-   
-	</section>
-
-</chapter>
\ No newline at end of file

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -38,7 +38,6 @@
 import org.teiid.client.security.LogonException;
 import org.teiid.client.security.LogonResult;
 import org.teiid.client.util.ExceptionUtil;
-import org.teiid.client.util.ResultsFuture;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.dqp.internal.process.DQPWorkContext;
@@ -165,4 +164,9 @@
 	public boolean isSameInstance(ServerConnection conn) throws CommunicationException {
 		return (conn instanceof LocalServerConnection);
 	}
+	
+	@Override
+	public void cleanUp() {
+		
+	}
 }

Modified: branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2010-08-20 22:18:46 UTC (rev 2482)
+++ branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2010-08-23 17:44:19 UTC (rev 2483)
@@ -35,11 +35,14 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
 import org.teiid.client.security.LogonException;
 import org.teiid.client.security.LogonResult;
 import org.teiid.client.security.SessionToken;
+import org.teiid.client.util.ResultsFuture;
 import org.teiid.common.buffer.BufferManagerFactory;
 import org.teiid.core.ComponentNotFoundException;
+import org.teiid.core.TeiidComponentException;
 import org.teiid.core.crypto.NullCryptor;
 import org.teiid.core.util.ObjectConverterUtil;
 import org.teiid.dqp.service.SessionService;
@@ -155,6 +158,18 @@
 						throws LogonException, ComponentNotFoundException {
 					return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
 				}
+				
+				@Override
+				public ResultsFuture<?> ping() throws InvalidSessionException,
+						TeiidComponentException {
+					return ResultsFuture.NULL_FUTURE;
+				}
+				
+				@Override
+				public void assertIdentity(SessionToken checkSession)
+						throws InvalidSessionException, TeiidComponentException {
+					return;
+				}
 
 			}, null); 
 			server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
@@ -206,4 +221,19 @@
 		helpEstablishConnection(true, config, p);
 	}
 	
+	@Test public void testSelectNewInstance() throws Exception {
+		SSLConfiguration config = new SSLConfiguration();
+		Properties p = new Properties();
+		SocketServerConnection conn = helpEstablishConnection(false, config, p);
+		SocketListenerStats stats = listener.getStats();
+		assertEquals(2, stats.objectsRead); // handshake response, logon,
+		assertEquals(1, stats.sockets);
+		conn.cleanUp();
+		assertTrue(conn.isOpen(1000));
+		stats = listener.getStats();
+		assertEquals(5, stats.objectsRead); // ping (pool test), assert identity, ping (isOpen)
+		assertEquals(1, stats.sockets);
+		conn.close();
+	}
+	
 }



More information about the teiid-commits mailing list