geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r477279 - in /geronimo/server/trunk/applications/console/geronimo-console-standard/src/main: java/org/apache/geronimo/console/keystores/ webapp/WEB-INF/view/keystore/
Date Mon, 20 Nov 2006 18:42:27 GMT
Author: vamsic007
Date: Mon Nov 20 10:42:26 2006
New Revision: 477279

URL: http://svn.apache.org/viewvc?view=rev&rev=477279
Log:
GERONIMO-2588 KeyStorePortlet: Locking and unlocking could use some error and info messages

Modified:
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/keystore/unlockKey.jsp

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java?view=diff&rev=477279&r1=477278&r2=477279
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
Mon Nov 20 10:42:26 2006
@@ -39,6 +39,7 @@
         String keystore = request.getParameter("keystore");
         KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX
+ keystore));
         data.lockEdit();
+        response.setRenderParameter(INFO_MSG, "Keysore '"+keystore+"' is now edit locked.");
         return LIST_MODE+BEFORE_ACTION;
     }
 

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java?view=diff&rev=477279&r1=477278&r2=477279
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
Mon Nov 20 10:42:26 2006
@@ -27,7 +27,7 @@
 import java.io.IOException;
 
 /**
- * Handler for locking and unlocked keystore
+ * Handler for locking an unlocked keystore
  *
  * @version $Rev$ $Date$
  */
@@ -41,6 +41,7 @@
         KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX
+ keystore));
         try {
             data.lockUse();
+            response.setRenderParameter(INFO_MSG, "Availability of keystore '"+keystore+"'
is locked.");
         } catch (KeystoreException e) {
             throw new PortletException(e);
         }

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java?view=diff&rev=477279&r1=477278&r2=477279
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
Mon Nov 20 10:42:26 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.keystores;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.management.geronimo.KeystoreException;
 
@@ -27,11 +29,12 @@
 import java.io.IOException;
 
 /**
- * Handler for entering a password to unlock a keystore
+ * Handler for entering a password to unlock a key
  *
  * @version $Rev$ $Date$
  */
 public class UnlockKeyHandler extends BaseKeystoreHandler {
+    private final static Log log = LogFactory.getLog(UnlockKeyHandler.class);
     public UnlockKeyHandler() {
         super(UNLOCK_KEY, "/WEB-INF/view/keystore/unlockKey.jsp");
     }
@@ -41,9 +44,15 @@
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        String[] params = {ERROR_MSG, INFO_MSG};
+        for(int i = 0; i < params.length; ++i) {
+            String value = request.getParameter(params[i]);
+            if(value != null) request.setAttribute(params[i], value);
+        }
         String keystore = request.getParameter("keystore");
         String password = request.getParameter("password");
         request.setAttribute("keystore", keystore);
+        request.setAttribute("password", password);
         KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX
+ keystore));
         try {
             request.setAttribute("keys", data.getInstance().listPrivateKeys(password.toCharArray()));
@@ -54,6 +63,7 @@
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         String keystore = request.getParameter("keystore");
+        String password = request.getParameter("password");
         String alias = request.getParameter("keyAlias");
         String keyPassword = request.getParameter("keyPassword");
         if(keystore == null || keystore.equals("")) {
@@ -63,8 +73,13 @@
         try {
             data.unlockPrivateKey(alias, keyPassword.toCharArray());
         } catch (KeystoreException e) {
-            throw new PortletException(e);
+            response.setRenderParameter("keystore", keystore);
+            response.setRenderParameter("password", password);
+            response.setRenderParameter(ERROR_MSG, "Unable to unlock key '"+alias+"'." +
e);
+            log.error("Unable to unlock key '"+alias+"'.", e);
+            return getMode()+BEFORE_ACTION;
         }
+        response.setRenderParameter(INFO_MSG, "Successfully unlocked key '"+alias+"' in keystore
'"+keystore+"'.");
         return LIST_MODE+BEFORE_ACTION;
     }
 }

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java?view=diff&rev=477279&r1=477278&r2=477279
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
Mon Nov 20 10:42:26 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.keystores;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
 
 import javax.portlet.ActionRequest;
@@ -31,6 +33,7 @@
  * @version $Rev$ $Date$
  */
 public class UnlockKeystoreHandler extends BaseKeystoreHandler {
+    private final static Log log = LogFactory.getLog(UnlockKeystoreHandler.class);
     public UnlockKeystoreHandler() {
         super(UNLOCK_KEYSTORE_FOR_USAGE, "/WEB-INF/view/keystore/unlockKeystore.jsp");
     }
@@ -44,6 +47,11 @@
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        String[] params = {ERROR_MSG, INFO_MSG};
+        for(int i = 0; i < params.length; ++i) {
+            String value = request.getParameter(params[i]);
+            if(value != null) request.setAttribute(params[i], value);
+        }
         String keystore = request.getParameter("keystore");
         request.setAttribute("keystore", keystore);
         request.setAttribute("mode", "unlockKeystore");
@@ -76,8 +84,11 @@
                 return UNLOCK_KEY+BEFORE_ACTION;
             } // otherwise it has no keys
         } catch (Exception e) {
-            throw new PortletException(e);
+            response.setRenderParameter(ERROR_MSG, "Unable to unlock keystore '"+keystore+"'
for availability. "+e.toString());
+            log.error("Unable to unlock keystore '"+keystore+"' for availability.", e);
+            return getMode()+BEFORE_ACTION;
         }
+        response.setRenderParameter(INFO_MSG, "Successfully unlocked keystore '"+keystore+"'
for availability.");
         return LIST_MODE+BEFORE_ACTION;
     }
 }

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/keystore/unlockKey.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/keystore/unlockKey.jsp?view=diff&rev=477279&r1=477278&r2=477279
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/keystore/unlockKey.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/keystore/unlockKey.jsp
Mon Nov 20 10:42:26 2006
@@ -14,6 +14,9 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 --%>
+
+<%-- $Rev$ $Date$ --%>
+
 <%@ page import="org.apache.geronimo.console.util.PortletManager"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
@@ -23,8 +26,11 @@
 also needs to be unlocked in order for SSL to work properly.  Please specify
 the password for the private key within the keystore.</p>
 
+<jsp:include page="_header.jsp" />
+
 <form name="<portlet:namespace/>KeystoreForm" action="<portlet:actionURL/>">
     <input type="hidden" name="keystore" value="${keystore}" />
+    <input type="hidden" name="password" value="${password}" />
     <input type="hidden" name="mode" value="unlockKey-after" />
     <b>Unlock Private Key:</b>
     <select name="keyAlias">



Mime
View raw message