geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r768455 - in /geronimo/server/trunk/plugins/console/plugin-portlets/src/main: java/org/apache/geronimo/console/securitymanager/realm/ resources/ webapp/WEB-INF/view/realmwizard/
Date Sat, 25 Apr 2009 03:31:49 GMT
Author: xuhaihong
Date: Sat Apr 25 03:31:46 2009
New Revision: 768455

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

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

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=768455&r1=768454&r2=768455&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Sat Apr 25 03:31:46 2009
@@ -186,12 +186,21 @@
             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);
+                    String error = getLocalizedString(actionRequest, "plugin.errorMsg03");
+                    addErrorMessage(actionRequest, error);
                 } 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);
             }
@@ -349,6 +358,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 +377,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");
@@ -1155,4 +1172,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo.properties?rev=768455&r1=768454&r2=768455&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo.properties
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo.properties
Sat Apr 25 03:31:46 2009
@@ -31,6 +31,7 @@
 
 plugin.errorMsg01 = Deployment Failed
 plugin.errorMsg02 = The application was not successfully started
+plugin.errorMsg03  = Security realm with the same name already exists, please specify a new
security realm name.
 plugin.infoMsg01  = The application was successfully deployed.
 plugin.infoMsg02  = The application was successfully redeployed.
 plugin.infoMsg03  = The application was successfully started.

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo_zh.properties?rev=768455&r1=768454&r2=768455&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo_zh.properties
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/portletinfo_zh.properties
Sat Apr 25 03:31:46 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
@@ -31,6 +32,7 @@
 
 plugin.errorMsg01 = \u90E8\u7F72\u5931\u8D25
 plugin.errorMsg02 = \u672A\u6210\u529F\u542F\u52A8\u5E94\u7528
+plugin.errorMsg03  = \u540C\u540D\u5B89\u5168\u57DF\u5DF2\u7ECF\u5B58\u5728\uFF0C\u8BF7\u6307\u5B9A\u65B0\u7684\u5B89\u5168\u57DF\u540D\u79F0\u3002
 plugin.infoMsg01  = \u6210\u529F\u90E8\u7F72\u5E94\u7528
 plugin.infoMsg02  = \u6210\u529F\u91CD\u65B0\u90E8\u7F72\u5E94\u7528
 plugin.infoMsg03  = \u6210\u529F\u542F\u52A8\u5E94\u7528

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp?rev=768455&r1=768454&r2=768455&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/realmwizard/selectType.jsp
Sat Apr 25 03:31:46 2009
@@ -20,6 +20,7 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="/WEB-INF/CommonMsg.tld" prefix="CommonMsg"%>
 <fmt:setBundle basename="pluginportlets"/>
 <portlet:defineObjects/>
 
@@ -35,6 +36,7 @@
 }
 </script>
 
+<CommonMsg:commonMsg/>
 <div id="<portlet:namespace/>CommonMsgContainer"></div>
 
 <p><fmt:message key="realmwizard.selectType.title" /></p>



Mime
View raw message