[teiid-commits] teiid SVN: r2559 - in branches/7.1.x: client/src/main/java/org/teiid/adminapi and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Sep 13 12:55:46 EDT 2010


Author: shawkins
Date: 2010-09-13 12:55:45 -0400 (Mon, 13 Sep 2010)
New Revision: 2559

Modified:
   branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
   branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
Log:
TEIID-1231 adding the ability to set any authenticated through admin api

Modified: branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-09-10 20:43:42 UTC (rev 2558)
+++ branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-09-13 16:55:45 UTC (rev 2559)
@@ -108,12 +108,12 @@
 	    p = props;
 	}
 
-	@Doc(text = "Adds a role to the specified policy")
+	@Doc(text = "Adds a mapped role to the specified data role")
 	public static void addDataRoleMapping(
 			@Doc(text = "vdb name") String vdbName, 
 			@Doc(text = "vdb version") int vdbVersion,
-			@Doc(text = "policy name") String policyName, 
-			@Doc(text = "role") String role) throws AdminException {
+			@Doc(text = "dataRole name") String policyName, 
+			@Doc(text = "mapped role name") String role) throws AdminException {
 		getAdmin().addDataRoleMapping(vdbName, vdbVersion, policyName, role);
 	}
 
@@ -237,16 +237,25 @@
 		return getAdmin().getCacheStats(identifier);
 	}
 	
-	@Doc(text = "Remove a role for the data policy")
+	@Doc(text = "Remove a mapped role for the data role")
 	public static void removeDataRoleMapping(
 			@Doc(text = "vdb name") String vdbName, 
 			@Doc(text = "vdb version") int vdbVersion,
-			@Doc(text = "policy name") String policyName, 
-			@Doc(text = "role name") String role) throws AdminException {
+			@Doc(text = "dataRole name") String policyName, 
+			@Doc(text = "mapped role name") String role) throws AdminException {
 		getAdmin()
 				.removeDataRoleMapping(vdbName, vdbVersion, policyName, role);
 	}
 
+	@Doc(text = "Set the any authenticated flag for the data role")
+    public static void setAnyAuthenticatedForDataRole(
+    		@Doc(text = "vdb name")String vdbName, 
+    		@Doc(text = "vdb version")int vdbVersion, 
+    		@Doc(text = "dataRole name")String dataRole, 
+    		@Doc(text = "any authenticated") boolean anyAuthenticated) throws AdminException {
+    	getAdmin().setAnyAuthenticatedForDataRole(vdbName, vdbVersion, dataRole, anyAuthenticated);
+    }
+
 	@Doc(text = "Set a runtime property")
 	public static void setRuntimeProperty(
 			@Doc(text = "name") String propertyName, 

Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java	2010-09-10 20:43:42 UTC (rev 2558)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java	2010-09-13 16:55:45 UTC (rev 2559)
@@ -234,21 +234,30 @@
      *  
      * @param vdbName
      * @param vdbVersion
-     * @param policyName
-     * @param role
+     * @param dataRole
+     * @param mappedRoleName
      */
-    void addDataRoleMapping(String vdbName, int vdbVersion, String policyName, String role) throws AdminException;
+    void addDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException;
     
     /**
-     * Assign a Role name to the Data Role in a given VDB
+     * Remove a Role name to the Data Role in a given VDB
      *  
      * @param vdbName
      * @param vdbVersion
-     * @param policyName
-     * @param role
+     * @param dataRole
+     * @param mappedRoleName
      */
-    void removeDataRoleMapping(String vdbName, int vdbVersion, String policyName, String role) throws AdminException;
+    void removeDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException;
     
+    /**
+     * Set the any authenticated flag on the Data Role in a given VDB
+     *  
+     * @param vdbName
+     * @param vdbVersion
+     * @param dataRole
+     * @param anyAuthenticated
+     */
+    void setAnyAuthenticatedForDataRole(String vdbName, int vdbVersion, String dataRole, boolean anyAuthenticated) throws AdminException;
     
     /**
      * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to

Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-09-10 20:43:42 UTC (rev 2558)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-09-13 16:55:45 UTC (rev 2559)
@@ -544,29 +544,34 @@
 			throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, vdbName, vdbVersion)); //$NON-NLS-1$
 		}
 		
-        ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
-        CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
-        ArrayList<MetaValue> modifiedRoleNames = new ArrayList<MetaValue>();
-        if (roleCollection != null) {
-	        MetaValue[] roleNames = roleCollection.getElements();
-	        for (MetaValue mv:roleNames) {
-	        	String existing = (String)((SimpleValueSupport)mv).getValue();
-	        	if (!existing.equals(role)) {
-	        		modifiedRoleNames.add(mv);
-	        	}
+		if (role != null) {
+	        ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
+	        CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
+	        ArrayList<MetaValue> modifiedRoleNames = new ArrayList<MetaValue>();
+	        if (roleCollection != null) {
+		        MetaValue[] roleNames = roleCollection.getElements();
+		        for (MetaValue mv:roleNames) {
+		        	String existing = (String)((SimpleValueSupport)mv).getValue();
+		        	if (!existing.equals(role)) {
+		        		modifiedRoleNames.add(mv);
+		        	}
+		        }
 	        }
-        }
-        else {
-        	roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
-        	mappedRoleNames.setValue(roleCollection);
-        }
-        
-        if (add) {
-        	modifiedRoleNames.add(ManagedUtil.wrap(SimpleMetaType.STRING, role));
-        }
-        
-        roleCollection.setElements(modifiedRoleNames.toArray(new MetaValue[modifiedRoleNames.size()]));
-        
+	        else {
+	        	roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
+	        	mappedRoleNames.setValue(roleCollection);
+	        }
+	        
+	        if (add) {
+	        	modifiedRoleNames.add(ManagedUtil.wrap(SimpleMetaType.STRING, role));
+	        }
+	        
+	        roleCollection.setElements(modifiedRoleNames.toArray(new MetaValue[modifiedRoleNames.size()]));
+		} else {
+			ManagedProperty anyAuthenticated = managedPolicy.getProperty("anyAuthenticated");//$NON-NLS-1$
+			anyAuthenticated.setValue(SimpleValueSupport.wrap(add));
+		}
+		
 		try {
 			getView().updateComponent(mc);
 		} catch (Exception e) {
@@ -584,6 +589,12 @@
 	public void removeDataRoleMapping(String vdbName, int vdbVersion, String policyName, String role)  throws AdminException{
 		manageRoleToDataPolicy(vdbName, vdbVersion, policyName, role, false);
 	}	
+	
+	@Override
+	public void setAnyAuthenticatedForDataRole(String vdbName, int vdbVersion,
+			String dataRole, boolean anyAuthenticated) throws AdminException {
+		manageRoleToDataPolicy(vdbName, vdbVersion, dataRole, null, anyAuthenticated);
+	}
 
 	@Override
 	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {



More information about the teiid-commits mailing list