portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r449747 - /portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java
Date Mon, 25 Sep 2006 17:17:38 GMT
Author: taylor
Date: Mon Sep 25 10:17:37 2006
New Revision: 449747

URL: http://svn.apache.org/viewvc?view=rev&rev=449747
Log:
add role manager

Modified:
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java

Modified: portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java?view=diff&rev=449747&r1=449746&r2=449747
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java
(original)
+++ portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java
Mon Sep 25 10:17:37 2006
@@ -25,12 +25,12 @@
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.jetspeed.capabilities.Capabilities;
-import org.apache.jetspeed.capabilities.Client;
-import org.apache.jetspeed.capabilities.MimeType;
 import org.apache.jetspeed.capabilities.MediaType;
 import org.apache.jetspeed.components.ComponentManager;
 import org.apache.jetspeed.components.SpringComponentManager;
 import org.apache.jetspeed.engine.JetspeedEngineConstants;
+import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.serializer.objects.JSCriterion;
 import org.apache.jetspeed.serializer.objects.JSNameValuePair;
 import org.apache.jetspeed.serializer.objects.JSPermission;
@@ -50,7 +50,8 @@
 public class JetspeedImporter 
 {
     //private final static Log log = LogFactory.getLog(JetspeedImporter.class);
-
+    ComponentManager cm = null;
+    
     public JetspeedImporter()
     {
     }
@@ -62,9 +63,9 @@
         try
         {                
             JetspeedImporter importer = new JetspeedImporter();
-//            JSImportData data = importer.importData("jetspeed-import.xml");           

-//            data.debug(System.out);
-            importer.exportData("");
+            JSImportData data = importer.importData("jetspeed-import.xml");            
+            data.debug(System.out);
+//            importer.exportData("");
         }
         catch (Exception e)
         {
@@ -84,7 +85,8 @@
             String applicationRoot = "./";
             Configuration properties = (Configuration) new PropertiesConfiguration();
             properties.setProperty(JetspeedEngineConstants.APPLICATION_ROOT_KEY, applicationRoot);
-            ComponentManager cm = initializeComponentManager(applicationRoot);          
 
+            ComponentManager cm = initializeComponentManager(applicationRoot);
+            this.cm = cm;
             exportCapabilities(cm, xstream);
             cm.stop();
         }
@@ -178,11 +180,24 @@
 
     public void addRoles(List roles)
     {
+        RoleManager roleManager = (RoleManager)cm.getComponent("org.apache.jetspeed.security.RoleManager");
+        if (roleManager == null)
+        {
+            System.err.println("Error!!! Role Manager not available");
+            return;
+        }
         Iterator list = roles.iterator();
         while (list.hasNext())
         {
             String role = (String)list.next();
-            
+            try
+            {
+                roleManager.addRole("/role/" + role);
+            }
+            catch (SecurityException e)
+            {
+                // do whatever
+            }
         }
         
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message