[gatein-commits] gatein SVN: r5676 - in components/wsrp/trunk/admin-gui/src/main: webapp/WEB-INF and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jan 4 05:00:14 EST 2011
Author: chris.laprun at jboss.com
Date: 2011-01-04 05:00:13 -0500 (Tue, 04 Jan 2011)
New Revision: 5676
Added:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/RedirectToErrorIfWSRPUnavailablePhaseListener.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/WSRPVersionBean.java
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/error.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/errorTemplate.xhtml
Log:
- GTNWSRP-191: Added PhaseListener to check if the WSRP service is available before restoring the view.
- GTNWSRP-193: Added WSRPVersionBean to display version of the WSRP service.
Added: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/RedirectToErrorIfWSRPUnavailablePhaseListener.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/RedirectToErrorIfWSRPUnavailablePhaseListener.java (rev 0)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/RedirectToErrorIfWSRPUnavailablePhaseListener.java 2011-01-04 10:00:13 UTC (rev 5676)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.admin.ui;
+
+import javax.faces.application.NavigationHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RedirectToErrorIfWSRPUnavailablePhaseListener implements PhaseListener
+{
+ /** Same value as used in faces-config.xml to set the ConsumerRegistry */
+ private static final String CONSUMER_REGISTRY = "ConsumerRegistry";
+ /** Same value as used in faces-config.xml to set the ProducerConfigurationService */
+ private static final String PRODUCER_CONFIGURATION_SERVICE = "ProducerConfigurationService";
+
+ public void afterPhase(PhaseEvent event)
+ {
+ // nothing to do
+ }
+
+ public void beforePhase(PhaseEvent event)
+ {
+ FacesContext context = event.getFacesContext();
+
+ // if we don't have a ConsumerRegistry or ProducerConfigurationService set in the application scope, then it means
+ // that the WSRP is not properly setup and we need to redirect to the error page
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> applicationMap = externalContext.getApplicationMap();
+ if (!applicationMap.containsKey(CONSUMER_REGISTRY) || !applicationMap.containsKey(PRODUCER_CONFIGURATION_SERVICE))
+ {
+ NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();
+ navigationHandler.handleNavigation(context, null, "error");
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RESTORE_VIEW;
+ }
+}
Added: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/WSRPVersionBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/WSRPVersionBean.java (rev 0)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/WSRPVersionBean.java 2011-01-04 10:00:13 UTC (rev 5676)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.admin.ui;
+
+import org.gatein.wsrp.WSRPConstants;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPVersionBean
+{
+ public String getVersion()
+ {
+ return WSRPConstants.WSRP_SERVICE_VERSION;
+ }
+}
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,6 +1,6 @@
#
# JBoss, a division of Red Hat
-# Copyright 2010, Red Hat Middleware, LLC, and individual
+# Copyright 2011, Red Hat Middleware, LLC, and individual
# contributors as indicated by the @authors tag. See the
# copyright.txt in the distribution for a full listing of
# individual contributors.
@@ -220,4 +220,5 @@
org.jboss.portal.object.name.admin.WSRP=WSRP
INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '/', '.', '\\', '<', '>', '(', ')', '=' or '%5c'
-DUPLICATE_ERROR=A {1} named ''{0}'' already exists!
\ No newline at end of file
+DUPLICATE_ERROR=A {1} named ''{0}'' already exists!
+unavailable_service = WSRP service is unavailble. Please activate it before using this portlet.
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,6 +1,6 @@
#
# JBoss, a division of Red Hat
-# Copyright 2010, Red Hat Middleware, LLC, and individual
+# Copyright 2011, Red Hat Middleware, LLC, and individual
# contributors as indicated by the @authors tag. See the
# copyright.txt in the distribution for a full listing of
# individual contributors.
@@ -182,4 +182,5 @@
edit_consumer_import_title=Portlets en import
bean_consumermanager_refresh_failure_wsdl=Le rafra\u00eechissement a \u00e9chou\u00e9 (probablement \u00e0 cause d'URL WSDL non valide)
producer_config_wsdl_v1=Adresse WSDL pour le Producteur WSRP v1:
-producer_config_wsdl_v2=Adresse WSDL pour le Producteur WSRP v2:
\ No newline at end of file
+producer_config_wsdl_v2=Adresse WSDL pour le Producteur WSRP v2:
+unavailable_service=Le service WSRP n''est pas disponible. Veuillez l''activer avant d'utiliser cette portlet.
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, Red Hat Middleware, LLC, and individual
~ contributors as indicated by the @authors tag. See the
~ copyright.txt in the distribution for a full listing of
~ individual contributors.
@@ -40,6 +40,10 @@
</locale-config>
</application>
+ <lifecycle>
+ <phase-listener>org.gatein.wsrp.admin.ui.RedirectToErrorIfWSRPUnavailablePhaseListener</phase-listener>
+ </lifecycle>
+
<converter>
<converter-for-class>org.gatein.wsrp.registration.LocalizedString</converter-for-class>
<converter-class>org.gatein.wsrp.admin.ui.LocalizedStringConverter</converter-class>
@@ -56,6 +60,11 @@
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>version</managed-bean-name>
+ <managed-bean-class>org.gatein.wsrp.admin.ui.WSRPVersionBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>consumersMgr</managed-bean-name>
<managed-bean-class>org.gatein.wsrp.admin.ui.ConsumerManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
@@ -176,4 +185,11 @@
<to-view-id>/jsf/consumers/exports/import.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>error</from-outcome>
+ <to-view-id>/jsf/error.xhtml</to-view-id>
+ <!--<redirect/>-->
+ </navigation-case>
+ </navigation-rule>
</faces-config>
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, Red Hat Middleware, LLC, and individual
~ contributors as indicated by the @authors tag. See the
~ copyright.txt in the distribution for a full listing of
~ individual contributors.
@@ -21,6 +21,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
+
+
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
@@ -56,5 +58,6 @@
</div>
</div>
</div>
+ <p align="right" style="font-size: 8px">WSRP version #{version.version}</p>
</div>
</ui:composition>
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/error.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/error.xhtml 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/error.xhtml 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, Red Hat Middleware, LLC, and individual
~ contributors as indicated by the @authors tag. See the
~ copyright.txt in the distribution for a full listing of
~ individual contributors.
@@ -21,13 +21,21 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
+
+
<ui:decorate template="errorTemplate.xhtml" xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:webui="http://jboss.org/gatein">
+ xmlns:h="http://java.sun.com/jsf/html">
<ui:define name="content">
- An Error Has Occured.
+ <div class="portlet-msg">
+ <div class="portlet-msg-icon">
+ <h:graphicImage url="/img/msgIcon_Warning.gif" alt="/!\"/>
+ </div>
+ <div class="portlet-msg-body">
+ <p class="portlet-msg-alert">
+ #{i18n.unavailable_service}
+ </p>
+ </div>
+ </div>
</ui:define>
</ui:decorate>
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/errorTemplate.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/errorTemplate.xhtml 2011-01-04 09:57:01 UTC (rev 5675)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/errorTemplate.xhtml 2011-01-04 10:00:13 UTC (rev 5676)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, Red Hat Middleware, LLC, and individual
~ contributors as indicated by the @authors tag. See the
~ copyright.txt in the distribution for a full listing of
~ individual contributors.
@@ -21,12 +21,11 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
+
+
<ui:decorate template="common/template.xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:webui="http://jboss.org/gatein">
+ xmlns:h="http://java.sun.com/jsf/html">
<ui:define name="topnav">
<h:form id="cons-temp-form" styleClass="cons-temp-form">
@@ -40,7 +39,8 @@
<div class="LeftTab">
<div class="RightTab">
<div class="MiddleTab">
- #{i18n.nav_tabs_consumers}
+ <h:commandLink id="consumersTab" action="consumers"
+ value="#{i18n.nav_tabs_consumers}"/>
</div>
</div>
</div>
More information about the gatein-commits
mailing list