geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r768485 - in /geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main: java/org/apache/geronimo/console/securitymanager/realm/ resources/ webapp/WEB-INF/view/realmwizard/
Date Sat, 25 Apr 2009 07:06:10 GMT
Author: xuhaihong
Date: Sat Apr 25 07:06:10 2009
New Revision: 768485

URL: http://svn.apache.org/viewvc?rev=768485&view=rev
Log:
GERONIMO-4620 Database Security Realm is removed from admin consonle after delete datasource
it's based, thanks for Han Hong Fang for the patch !

Modified:
    geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
    geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
    geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets_zh.properties
    geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp

Modified: geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=768485&r1=768484&r2=768485&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
(original)
+++ geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Sat Apr 25 07:06:10 2009
@@ -136,6 +136,7 @@
     private static final String SAVE_MODE = "save";
     private static final String MODE_KEY = "mode";
     private static final String CUSTOM_MODE = "custom";
+    private static final String MESSAGE_KEY = "messagekey";
 
     private static Kernel kernel;
 
@@ -186,12 +187,20 @@
             actionResponse.setRenderParameter(MODE_KEY, SELECT_TYPE_MODE);
         } else if (mode.equals("process-" + SELECT_TYPE_MODE)) {
             if (data.getName() != null && !data.getName().trim().equals("")) {
-                // Config properties have to be set in render since they have values of null
-                if (data.getRealmType().equals("Other")) {
-                    actionResponse.setRenderParameter(MODE_KEY, CUSTOM_MODE);
+                // Check if realm with the same name already exists
+                Artifact artifact = new Artifact("console.realm", getArtifactId(data.getName()),
"1.0", "car");
+                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(PortletManager.getKernel());
+                if (configurationManager.isInstalled(artifact)) {
+                    actionResponse.setRenderParameter(MODE_KEY, SELECT_TYPE_MODE);
+                    actionResponse.setRenderParameter(MESSAGE_KEY, "realmwizard.message.sameRealmName");
                 } else {
-                    actionResponse.setRenderParameter(MODE_KEY, CONFIGURE_MODE);
-                }
+                    // Config properties have to be set in render since they have values
of null
+                    if (data.getRealmType().equals("Other")) {
+                        actionResponse.setRenderParameter(MODE_KEY, CUSTOM_MODE);
+                    } else {
+                        actionResponse.setRenderParameter(MODE_KEY, CONFIGURE_MODE);
+                    }
+                } 
             } else {
                 actionResponse.setRenderParameter(MODE_KEY, SELECT_TYPE_MODE);
             }
@@ -254,6 +263,10 @@
         }
         try {
             String mode = renderRequest.getParameter(MODE_KEY);
+            String sMessageKey = renderRequest.getParameter(MESSAGE_KEY);
+			if (sMessageKey != null) {
+				renderRequest.setAttribute(MESSAGE_KEY, sMessageKey);
+			}
             RealmData data = new RealmData();
             data.load(renderRequest);
             renderRequest.setAttribute("realm", data);
@@ -349,6 +362,18 @@
         }
     }
 
+    private String getArtifactId(String name) {
+        
+        String artifactId = name;
+        if(artifactId.indexOf('/') != -1) {
+            // slash in artifact-id results in invalid configuration-id and leads to deployment
errors.
+            // Note: 0x002F = '/'
+            artifactId = artifactId.replaceAll("/", "%2F");
+        }
+        
+        return artifactId;
+    }
+    
     private XmlObject actionGeneratePlan(PortletRequest request, RealmData data) {
         normalize(data);
         ModuleDocument doc = ModuleDocument.Factory.newInstance();
@@ -356,12 +381,8 @@
         EnvironmentType environment = root.addNewEnvironment();
         ArtifactType configId = environment.addNewModuleId();
         configId.setGroupId("console.realm");
-        String artifactId = data.getName();
-        if(artifactId.indexOf('/') != -1) {
-            // slash in artifact-id results in invalid configuration-id and leads to deployment
errors.
-            // Note: 0x002F = '/'
-            artifactId = artifactId.replaceAll("/", "%2F");
-        }
+        String artifactId = getArtifactId(data.getName());
+        
         configId.setArtifactId(artifactId);
         configId.setVersion("1.0");
         configId.setType("car");
@@ -1159,4 +1180,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties?rev=768485&r1=768484&r2=768485&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
(original)
+++ geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
Sat Apr 25 07:06:10 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -286,6 +287,7 @@
 realmwizard.list.noSecurityRealms                            = There are no security realms
defined
 realmwizard.list.seeExamples                                 = For each realm listed, you
can click the <b>usage</b> link to see examples of how to use the realm from your
application.\r\n
 realmwizard.list.title                                       = This page lists all the available
security realms.  Server-wide security realms can be edited, while security realms deployed
as part of a single application cannot (change the deployment plan in the application instead).
+realmwizard.message.sameRealmName                            = Security realm with the same
name already exists, please specify a new security realm name.
 realmwizard.selectType.nameOfSecurityRealmExp                = A name that is different than
the name for any other security realms in the server (no spaces in the name please). Other
components will use this name to refer to the security realm.
 realmwizard.selectType.realmTypeExp                          = The type of login module used
as the master for this security realm. Select "Other" for manual configuration options including
custom login modules and realms that use multiple login modules to populate user principals.
 realmwizard.selectType.title                                 = <b>Create Security Realm</b>
-- Step 1: Select Name and Type

Modified: geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets_zh.properties?rev=768485&r1=768484&r2=768485&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets_zh.properties
(original)
+++ geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/resources/pluginportlets_zh.properties
Sat Apr 25 07:06:10 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -61,8 +62,8 @@
 car.download.foundDependencies                = \u4E0B\u9762\u662F\u627E\u5230\u7684\u8FD9\u4E2A\u63D2\u4EF6\u7684\u4F9D\u8D56\u9879\u3002\u5982\u679C\u4F60\u7EE7\u7EED\u7684\u8BDD\uFF0C\u5C06\u4F1A\u81EA\u52A8\u5730\u5B89\u88C5\u4EFB\u4F55\u7F3A\u5C11\u7684\u4F9D\u8D56\u9879\u3002
 car.download.processing                       = \u5904\u7406{0}\u4E2D...
 car.downloadStatus.processing                 = \u5904\u7406\u4E2D{0}...
-car.index.assembleServerLong                  = Assemble a server from plugins in this one
 car.index.assembleServer                      = Assemble a server
+car.index.assembleServerLong                  = Assemble a server from plugins in this one
 car.index.createGeronimoPluginExp             = \u5728\u5F53\u524DGeronimo\u670D\u52A1\u5668\u4E2D\u9009\u62E9\u8981\u4F5C\u4E3AGeronimo\u63D2\u4EF6\u5BFC\u51FA\u7684\u914D\u7F6E\u3002\u8FD9\u4E2A\u914D\u7F6E\u5C06\u4EE5CAR\u6587\u4EF6\u7684\u5F62\u5F0F\u4FDD\u5B58\u5230\u4F60\u672C\u5730\u7CFB\u7EDF\u4E2D\u3002<i>\u6CE8\u610F\uFF1A\u5728\u4F60\u5C06\u5B83\u5BFC\u51FA\u540E\uFF0C\u76EE\u524D\u8981\u4F7F\u5B83\u5F53\u4F5C\u4E00\u4E2A\u6709\u6548\u7684\u63D2\u4EF6\uFF0C\u4F60\u5FC5\u987B\u624B\u52A8\u5730\u6DFB\u52A0<tt>META-INF/geronimo-plugin.xml</tt>\u6587\u4EF6\u5230CAR\u4E2D\u3002</i>
 car.index.optionalAuthentication              = \u53EF\u9009\u9A8C\u8BC1\u4FE1\u606F
 car.index.removePluginsExp                    = \u4E3A\u4E86\u5220\u9664\u4E00\u4E2A\u63D2\u4EF6\uFF0C\u5728\u53F3\u8FB9\u5BFC\u822A\u9762\u677F\u7684<b>\u5E94\u7528\u7A0B\u5E8F</b>\u4E0B\u76F8\u5E94\u7684\u7C7B\u522B\u4E2D\u627E\u5230\u63D2\u4EF6\u7684\u6A21\u5757\uFF0C\u5E76\u5378\u8F7D\u5B83\u3002
@@ -143,8 +144,8 @@
 #consolebase.common.returnToList    = Return to List
 consolebase.common.save            = \u4FDD\u5B58
 consolebase.common.start           = \u542F\u52A8
-consolebase.common.stop            = \u505C\u6B62
 consolebase.common.state           = \u72B6\u6001
+consolebase.common.stop            = \u505C\u6B62
 consolebase.common.uninstall       = \u5378\u8F7D
 consolebase.common.usage           = \u7528\u6CD5
 consolebase.common.user            = \u7528\u6237
@@ -228,6 +229,7 @@
 realmwizard.list.noSecurityRealms                = \u4E0D\u5B58\u5728\u9884\u5B9A\u4E49\u7684\u5B89\u5168\u57DF
 realmwizard.list.seeExamples                     = \u5BF9\u4E8E\u6BCF\u4E00\u4E2A\u57DF\uFF0C\u53EF\u4EE5\u70B9\u51FB<b>\u7528\u6CD5</b>\u6765\u770B\u5982\u4F55\u5728\u4F60\u7684\u5E94\u7528\u4E2D\u4F7F\u7528\u6B64\u57DF\u3002
 realmwizard.list.title                           = \u8FD9\u4E2A\u9875\u9762\u663E\u793A\u4E86\u6240\u6709\u53EF\u7528\u7684\u5B89\u5168\u57DF\u3002\u53EF\u4EE5\u7F16\u8F91\u670D\u52A1\u5668\u7EA7\u522B\u7684\u5B89\u5168\u57DF\uFF0C\u4F46\u662F\u88AB\u90E8\u7F72\u4E3A\u5355\u4E2A\u5E94\u7528\u4E00\u90E8\u5206\u7684\u5B89\u5168\u57DF\u5219\u4E0D\u80FD\u88AB\u7F16\u8F91\uFF08\u800C\u662F\u4FEE\u6539\u5E94\u7528\u7684\u90E8\u7F72\u8BA1\u5212\uFF09\u3002
+realmwizard.message.sameRealmName                = \u540C\u540D\u5B89\u5168\u57DF\u5DF2\u7ECF\u5B58\u5728,
\u8BF7\u6307\u5B9A\u65B0\u7684\u5B89\u5168\u57DF\u540D\u79F0\u3002
 realmwizard.selectType.nameOfSecurityRealmExp    = \u7ED9\u5B89\u5168\u57DF\u9009\u53D6\u4E00\u4E2A\u4E0D\u540C\u4E8E\u670D\u52A1\u5668\u4E2D\u5176\u5B83\u5B89\u5168\u57DF\u7684\u540D\u79F0\uFF0C\u540D\u79F0\u4E2D\u8BF7\u4E0D\u8981\u6709\u7A7A\u683C\u3002\u5176\u5B83\u7EC4\u4EF6\u5C06\u4F7F\u7528\u8FD9\u4E2A\u540D\u79F0\u6765\u6307\u5411\u8FD9\u4E2A\u5B89\u5168\u57DF\u3002
 realmwizard.selectType.realmTypeExp              = \u767B\u5F55\u6A21\u5757\u7684\u7C7B\u578B\u7528\u6765\u8868\u793A\u5B89\u5168\u57DF\u5B58\u50A8\u4F4D\u7F6E\u3002\u9009\u62E9"Other"\uFF0C\u53EF\u4EE5\u624B\u52A8\u914D\u7F6E\u4E00\u4E9B\u9009\u9879\uFF0C\u6BD4\u5982\u8BF4\uFF1A\u81EA\u5B9A\u4E49\u767B\u5F55\u6A21\u5757\uFF0C\u548C\u5B89\u5168\u57DF\u6765\u4F7F\u7528\u591A\u4E2A\u767B\u5F55\u6A21\u5757\u6765\u83B7\u5F97\u7528\u6237\u8EAB\u4EFD\u4FE1\u606F\u3002
 realmwizard.selectType.title                     = <b>\u521B\u5EFA\u5B89\u5168\u57DF</b>
--\u6B65\u9AA41: \u9009\u62E9\u540D\u79F0\u548C\u7C7B\u578B

Modified: geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp?rev=768485&r1=768484&r2=768485&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
(original)
+++ geronimo/server/branches/2.1/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
Sat Apr 25 07:06:10 2009
@@ -30,7 +30,9 @@
     return textElementsNotEmpty(<portlet:namespace/>formName,<portlet:namespace/>requiredFields);
 }
 </script>
-
+<c:if test="${!(empty messagekey)}">
+	<fmt:message key="${messagekey}" />
+</c:if>
 <p><fmt:message key="realmwizard.selectType.title" /></p>
 
 <!--   FORM TO COLLECT DATA FOR THIS PAGE   -->



Mime
View raw message