[teiid-commits] teiid SVN: r2035 - in trunk: client/src/main/java/org/teiid/adminapi and 3 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Apr 7 15:55:10 EDT 2010


Author: rareddy
Date: 2010-04-07 15:55:09 -0400 (Wed, 07 Apr 2010)
New Revision: 2035

Modified:
   trunk/adminshell/src/main/resources/scripts/adminapi.bsh
   trunk/client/src/main/java/org/teiid/adminapi/Admin.java
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
   trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-910: Changing the start/stop connection factory methods to work based on the "deployedName" rather than the 

Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh	2010-04-07 19:26:47 UTC (rev 2034)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh	2010-04-07 19:55:09 UTC (rev 2035)
@@ -7,10 +7,8 @@
 
 /**
  * Deploy a {@link VDB} file.
- * @param name  Name of the VDB file to save under
- * @param URL 	VDB file location.
+ * @param vdbFile - VDB File Name
  * @throws AdminException
- *             if there's a system error.
  * @return the {@link VDB} representing the current property values and runtime state.
  */
 VDB deployVDB(String vdbFile) {
@@ -21,8 +19,8 @@
 
 /**
  * Delete the VDB with the given name and version
- * @param vdbName
- * @param version
+ * @param name - name of VDB
+ * @param version - version of the VDB
  * @throws AdminException
  */
 void deleteVDB(String name, int version) {
@@ -35,13 +33,13 @@
  *
  * @param vdbName identifier of the {@link VDB}
  * @param vdbVersion {@link VDB} version
- * @return InputStream of the VDB
- * @throws AdminException if there's a system error.
+ * @param fileName - File name to save the VDB
+ * @throws AdminException
  */
-void exportVDB(String name, int vdbVersion, String fileName){
-    debug("Exporting VDB " + name + " version " + vdbVersion + " to file " + fileName);
+void exportVDB(String vdbName, int vdbVersion, String fileName){
+    debug("Exporting VDB " + vdbName + " version " + vdbVersion + " to file " + fileName);
     checkAdmin();
-    contents = internalAdmin.exportVDB(name, vdbVersion);
+    contents = internalAdmin.exportVDB(vdbName, vdbVersion);
     if (contents != null) {
     	ObjectConverterUtil.write(contents, fileName);
     }
@@ -71,10 +69,10 @@
  * @param deployedName - deployed name of the connection factory
  * @throws AdminException  
  */
-void deleteConnectionFactory(String bindingName) throws AdminException {
-    debug("Deleting Connection Factory " + bindingName);
+void deleteConnectionFactory(String deployedName) throws AdminException {
+    debug("Deleting Connection Factory " + deployedName);
     checkAdmin();    
-    internalAdmin.deleteConnectionFactory(bindingName);
+    internalAdmin.deleteConnectionFactory(deployedName);
 }
 
 /**
@@ -83,12 +81,11 @@
  * @param deployedName the unique identifier for a {@link ConnectionFactory}.
  * @param fileName - Name under which exported content stored under
  * @throws AdminException
- *             
  */
-void exportConnectionFactory(String bindingName, String fileName){
-    debug("Exporting Connection Factory " + bindingName + " to file " + fileName);
+void exportConnectionFactory(String deployedName, String fileName){
+    debug("Exporting Connection Factory " + deployedName + " to file " + fileName);
     checkAdmin();
-    contents = internalAdmin.exportConnectionFactory(bindingName);
+    contents = internalAdmin.exportConnectionFactory(deployedName);
     if (contents != null) {
     	ObjectConverterUtil.write(contents, fileName);	
     }
@@ -120,10 +117,10 @@
  * @param properties - properties
  * @throws AdminException
  */
-void addDataSource(String deploymentName, Properties properties) {
-    debug("Adding Datasource " + deploymentName);
+void addDataSource(String dsName, Properties properties) {
+    debug("Adding Datasource " + dsName);
     checkAdmin();    
-    return internalAdmin.addDataSource(deploymentName, properties);	
+    return internalAdmin.addDataSource(dsName, properties);	
 }
 
 /**
@@ -131,10 +128,10 @@
  * @param dsName
  * @throws AdminException
  */
-void deleteDataSource(String deploymentName) {
-    debug("Deleting Datasource " + deploymentName);
+void deleteDataSource(String dsName) {
+    debug("Deleting Datasource " + dsName);
     checkAdmin();    
-    return internalAdmin.deleteDataSource(deploymentName);	
+    return internalAdmin.deleteDataSource(dsName);	
 }
 
 
@@ -219,9 +216,6 @@
     internalAdmin.terminateTransaction(transactionId);	
 }
 
-//** property methods******************************************************************
-
-
 /**
  * Set/update the property for the Connection Factory identified by the given deployed name.
  * @param deployedName
@@ -391,6 +385,7 @@
 
 /**
  * Get the Requests for the given session
+ * @param sessionId - session id 
  * @return Collection of {@link Request}
  * @throws AdminException if there's a system error.
  */
@@ -442,7 +437,7 @@
 /**
  * Start Connection Factory
  *
- * @param factory 
+ * @param deployedName 
  * @throws AdminException  
  */
 void startConnectionFactory(String deployedName) {
@@ -454,7 +449,7 @@
 /**
  * Stop Connection Factory
  *
- * @param factory
+ * @param deployedName
  * @throws AdminException  
  */
 void stopConnectionFactory(String deployedName) {
@@ -478,9 +473,8 @@
 /**
  * Terminate the Session
  *
- * @param identifier  Session Identifier {@link org.teiid.adminapi.Session}.
- * No wild cards currently supported, must be explicit
- * @throws AdminException  if there's a system error.
+ * @param sessionId  Session Identifier {@link org.teiid.adminapi.Session}.
+ * @throws AdminException
  */
 void terminateSession(long sessionId) {
     debug("Terminating Session " + sessionId);
@@ -493,8 +487,7 @@
  *
  * @param sessionId session Identifier for the request.
  * @param requestId request Identifier
- * 
- * @throws AdminException  if there's a system error.
+ * @throws AdminException
  */
 void cancelRequest(long sessionId, long requestId) {
     debug("Canceling Request Session=" + sessionId + " request id = "+requestId);

Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-07 19:26:47 UTC (rev 2034)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-07 19:55:09 UTC (rev 2035)
@@ -278,18 +278,18 @@
     /**
      * Start Connection Factory
      *
-     * @param factory 
+     @param deployedName - name of the deployed Connection Factory 
      * @throws AdminException  
      */
-    void startConnectionFactory(ConnectionFactory factory) throws AdminException;
+    void startConnectionFactory(String deployedName) throws AdminException;
 
     /**
      * Stop Connection Factory
      *
-     * @param factory
+     * @param deployedName - name of the deployed Connection Factory 
      * @throws AdminException  
      */
-    void stopConnectionFactory(ConnectionFactory factory) throws AdminException;
+    void stopConnectionFactory(String deployedName) throws AdminException;
 
     /**
      * Clear the cache or caches specified by the cacheIdentifier.
@@ -370,6 +370,17 @@
      * @param policyName
      * @param role
      */
-    void removeRoleFromDataPolicy(String vdbName, int vdbVersion, String policyName, String role) throws AdminException;  
+    void removeRoleFromDataPolicy(String vdbName, int vdbVersion, String policyName, String role) throws AdminException;
+    
+    
+//    /**
+//     * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to
+//     * succeed. The changes will not be persistent between server restarts.
+//     * @param sourceVDBName
+//     * @param sourceVDBVersion
+//     * @param targetVDBName
+//     * @param targetVDBVersion
+//     */
+//    void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
 
 }

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-04-07 19:26:47 UTC (rev 2034)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-04-07 19:55:09 UTC (rev 2035)
@@ -319,26 +319,34 @@
 	}
 	
 	@Override
-	public void startConnectionFactory(ConnectionFactory binding) throws AdminException {
+	public void startConnectionFactory(String deployedName) throws AdminException {
 		try {
-			String deployerName = binding.getPropertyValue("deployer-name"); //$NON-NLS-1$
+			ConnectionFactory factory = getConnectionFactory(deployedName);
+			if (factory == null) {
+				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
+			}
+			String deployerName = factory.getPropertyValue("deployer-name"); //$NON-NLS-1$
 			if (deployerName == null) {
 				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
 			}
-			ManagedUtil.execute(getDeploymentManager().start(deployerName), IntegrationPlugin.Util.getString("failed_to_start_connector", binding.getName())); //$NON-NLS-1$
+			ManagedUtil.execute(getDeploymentManager().start(deployerName), IntegrationPlugin.Util.getString("failed_to_start_connector", factory.getName())); //$NON-NLS-1$
 		} catch (Exception e) {
 			ManagedUtil.handleException(e);
 		}
 	}
 
 	@Override
-	public void stopConnectionFactory(ConnectionFactory binding) throws AdminException {
+	public void stopConnectionFactory(String deployedName) throws AdminException {
 		try {
-			String deployerName = binding.getPropertyValue("deployer-name");//$NON-NLS-1$
+			ConnectionFactory factory = getConnectionFactory(deployedName);
+			if (factory == null) {
+				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
+			}			
+			String deployerName = factory.getPropertyValue("deployer-name");//$NON-NLS-1$
 			if (deployerName == null) {
 				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
 			}			
-			ManagedUtil.execute(getDeploymentManager().stop(deployerName), IntegrationPlugin.Util.getString("failed_to_stop_connector", binding.getName())); //$NON-NLS-1$
+			ManagedUtil.execute(getDeploymentManager().stop(deployerName), IntegrationPlugin.Util.getString("failed_to_stop_connector", factory.getName())); //$NON-NLS-1$
 		} catch (Exception e) {
 			ManagedUtil.handleException(e);
 		}
@@ -1052,4 +1060,17 @@
 		manageRoleToDataPolicy(vdbName, vdbVersion, policyName, role, false);
 	}	
 
+//	@Override
+//	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {
+//		try {
+//			ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);	
+//			ManagedUtil.executeOperation(mc, "mergeVDBs", 
+//					SimpleValueSupport.wrap(sourceVDBName), 
+//					SimpleValueSupport.wrap(sourceVDBVersion), 
+//					SimpleValueSupport.wrap(targetVDBName), 
+//					SimpleValueSupport.wrap(targetVDBVersion));//$NON-NLS-1$
+//		} catch (Exception e) {
+//			throw new AdminComponentException(e.getMessage(), e);
+//		}   		
+//	}
 }

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java	2010-04-07 19:26:47 UTC (rev 2034)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java	2010-04-07 19:55:09 UTC (rev 2035)
@@ -205,7 +205,7 @@
 
 		    api.assignConnectionFactoryToModel(vdb.getName(), vdb.getVersion(), m.getName(), ds.getName(), ds.getProperty("jndi-name"));
 
-		    api.startConnectionFactory(api.getConnectionFactory(ds.getName()));
+		    api.startConnectionFactory(ds.getName());
 		} else {
 		    throw new QueryTestFailedException(
 			    "Error: Unable to create binding to map to model : "

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-04-07 19:26:47 UTC (rev 2034)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java	2010-04-07 19:55:09 UTC (rev 2035)
@@ -91,9 +91,9 @@
 		
 		assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
 		
-		admin.stopConnectionFactory(binding);
+		admin.stopConnectionFactory("test-mysql-cb");
 		
-		admin.startConnectionFactory(binding);
+		admin.startConnectionFactory("test-mysql-cb");
 		
 		admin.setConnectionFactoryProperty("test-mysql-cb", "SourceJNDIName", "DummyDS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		



More information about the teiid-commits mailing list