[Carbon-commits] [Carbon-Components] svn commit r67409 - in trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main: java/org/wso2/carbon/bam/data/publishers/servicestats/ui resources/META-INF resources/org/wso2/carbon/bam/data/publisher resources/org/wso2/carbon/bam/data/publishers resources/org/wso2/carbon/bam/data/publishers/servicestats resources/org/wso2/carbon/bam/data/publishers/servicestats/ui resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n resources/web/bampubsvcstat
rathav at wso2.com
rathav at wso2.com
Tue Jun 1 00:22:08 PDT 2010
Author: rathav
Date: Tue Jun 1 00:22:08 2010
New Revision: 67409
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=67409
Log:
fixing an i18n issue+pkg issue
Added:
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n/
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n/Resources.properties
Removed:
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publisher/
Modified:
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/java/org/wso2/carbon/bam/data/publishers/servicestats/ui/ServiceStatPublisherAdminClient.java
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/META-INF/component.xml
trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/web/bampubsvcstat/configure_eventing.jsp
Modified: trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/java/org/wso2/carbon/bam/data/publishers/servicestats/ui/ServiceStatPublisherAdminClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/java/org/wso2/carbon/bam/data/publishers/servicestats/ui/ServiceStatPublisherAdminClient.java?rev=67409&r1=67408&r2=67409&view=diff
==============================================================================
--- trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/java/org/wso2/carbon/bam/data/publishers/servicestats/ui/ServiceStatPublisherAdminClient.java (original)
+++ trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/java/org/wso2/carbon/bam/data/publishers/servicestats/ui/ServiceStatPublisherAdminClient.java Tue Jun 1 00:22:08 2010
@@ -1,75 +1,75 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.wso2.carbon.bam.data.publishers.servicestats.ui;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.bam.data.publishers.servicestats.ui.types.carbon.EventingConfigData;
-
-import java.rmi.RemoteException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Client to the statistics admin service, that uses the code generated stub to access backend service.
- */
-public class ServiceStatPublisherAdminClient {
-
- private static final Log log = LogFactory.getLog(ServiceStatPublisherAdminClient.class);
- private static final String BUNDLE = "org.wso2.carbon.bam.data.publisher.servicestats.i18n.Resources";
- private ServiceStatisticsPublisherAdminStub stub;
- private ResourceBundle bundle;
-
- public ServiceStatPublisherAdminClient(String cookie,
- String backendServerURL,
- ConfigurationContext configCtx,
- Locale locale) throws AxisFault {
- String serviceURL = backendServerURL + "ServiceStatisticsPublisherAdmin";
- bundle = ResourceBundle.getBundle(BUNDLE, locale);
-
- stub = new ServiceStatisticsPublisherAdminStub(configCtx, serviceURL);
- ServiceClient client = stub._getServiceClient();
- Options option = client.getOptions();
- option.setManageSession(true);
- option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
- }
-
- public EventingConfigData getEventingConfigData() throws RemoteException {
- try {
- return stub.getEventingConfigData();
- } catch (RemoteException e) {
- handleException(bundle.getString("cannot.get.eventing.config"), e);
- }
- return null;
- }
-
- public void setEventingConfigData(EventingConfigData eventingConfigData) throws RemoteException {
- try {
- stub.configureEventing(eventingConfigData);
- } catch (Exception e) {
- handleException(bundle.getString("cannot.set.eventing.config"), e);
- }
- }
-
- private void handleException(String msg, java.lang.Exception e) throws RemoteException {
- log.error(msg, e);
- throw new RemoteException(msg, e);
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.wso2.carbon.bam.data.publishers.servicestats.ui;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.bam.data.publishers.servicestats.ui.types.carbon.EventingConfigData;
+
+import java.rmi.RemoteException;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Client to the statistics admin service, that uses the code generated stub to access backend service.
+ */
+public class ServiceStatPublisherAdminClient {
+
+ private static final Log log = LogFactory.getLog(ServiceStatPublisherAdminClient.class);
+ private static final String BUNDLE = "org.wso2.carbon.bam.data.publishers.servicestats.ui.i18n.Resources";
+ private ServiceStatisticsPublisherAdminStub stub;
+ private ResourceBundle bundle;
+
+ public ServiceStatPublisherAdminClient(String cookie,
+ String backendServerURL,
+ ConfigurationContext configCtx,
+ Locale locale) throws AxisFault {
+ String serviceURL = backendServerURL + "ServiceStatisticsPublisherAdmin";
+ bundle = ResourceBundle.getBundle(BUNDLE, locale);
+
+ stub = new ServiceStatisticsPublisherAdminStub(configCtx, serviceURL);
+ ServiceClient client = stub._getServiceClient();
+ Options option = client.getOptions();
+ option.setManageSession(true);
+ option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+ }
+
+ public EventingConfigData getEventingConfigData() throws RemoteException {
+ try {
+ return stub.getEventingConfigData();
+ } catch (RemoteException e) {
+ handleException(bundle.getString("cannot.get.eventing.config"), e);
+ }
+ return null;
+ }
+
+ public void setEventingConfigData(EventingConfigData eventingConfigData) throws RemoteException {
+ try {
+ stub.configureEventing(eventingConfigData);
+ } catch (Exception e) {
+ handleException(bundle.getString("cannot.set.eventing.config"), e);
+ }
+ }
+
+ private void handleException(String msg, java.lang.Exception e) throws RemoteException {
+ log.error(msg, e);
+ throw new RemoteException(msg, e);
+ }
+}
Modified: trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/META-INF/component.xml
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/META-INF/component.xml?rev=67409&r1=67408&r2=67409&view=diff
==============================================================================
--- trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/META-INF/component.xml (original)
+++ trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/META-INF/component.xml Tue Jun 1 00:22:08 2010
@@ -1,17 +1,17 @@
-<component xmlns="http://products.wso2.org/carbon">
- <!-- sample menu configuration -->
- <menus>
- <menu>
- <id>bam_data_publisher_service_statistics_menu</id>
- <i18n-key>eventing.menu</i18n-key>
- <i18n-bundle>org.wso2.carbon.bam.data.publisher.servicestats.i18n.Resources</i18n-bundle>
- <parent-menu>configure_menu</parent-menu>
- <link>../bampubsvcstat/configure_eventing.jsp</link>
- <region>region1</region>
- <order>27</order>
- <style-class>monitor</style-class>
- <icon>../bampubsvcstat/images/chart_bar.gif</icon>
- <require-permission>/permissions/admin/manage</require-permission>
- </menu>
-</menus>
-</component>
+<component xmlns="http://products.wso2.org/carbon">
+ <!-- sample menu configuration -->
+ <menus>
+ <menu>
+ <id>bam_data_publisher_service_statistics_menu</id>
+ <i18n-key>eventing.menu</i18n-key>
+ <i18n-bundle>org.wso2.carbon.bam.data.publishers.servicestats.ui.i18n.Resources</i18n-bundle>
+ <parent-menu>configure_menu</parent-menu>
+ <link>../bampubsvcstat/configure_eventing.jsp</link>
+ <region>region1</region>
+ <order>27</order>
+ <style-class>monitor</style-class>
+ <icon>../bampubsvcstat/images/chart_bar.gif</icon>
+ <require-permission>/permissions/admin/manage</require-permission>
+ </menu>
+</menus>
+</component>
Added: trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n/Resources.properties
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n/Resources.properties?pathrev=67409
==============================================================================
--- (empty file)
+++ trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/org/wso2/carbon/bam/data/publishers/servicestats/ui/i18n/Resources.properties Tue Jun 1 00:22:08 2010
@@ -0,0 +1,12 @@
+bam.statpublisher.config=Service Data Publisher Configuration
+update=Update
+eventing.menu=Service Data Publishing
+eventing.configuration=Eventing Configuration
+enable.eventing=Enable Eventing
+system.request.threshold=System Request Count Threshold
+service.request.threshold=Service Request Count Threshold
+operation.request.threshold=Operation Request Count Threshold
+cannot.get.eventing.config=Cannot get eventing configuration. Backend server may be unavailable.
+cannot.set.eventing.config=Cannot set eventing configuration. Backend server may be unavailable.
+eventing.note.1=NOTE: To disable eventing at a certain level, use zero or a negative value, in the following fields.
+eventing.note.2=Positive threshold values indicate request count intervals, at which an event will be fired, at each level.
Modified: trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/web/bampubsvcstat/configure_eventing.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/web/bampubsvcstat/configure_eventing.jsp?rev=67409&r1=67408&r2=67409&view=diff
==============================================================================
--- trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/web/bampubsvcstat/configure_eventing.jsp (original)
+++ trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publishers.servicestats.ui/src/main/resources/web/bampubsvcstat/configure_eventing.jsp Tue Jun 1 00:22:08 2010
@@ -1,216 +1,216 @@
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
-<%@ page import="org.wso2.carbon.CarbonConstants" %>
-<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.Utils" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
-<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.ServiceStatPublisherAdminClient" %>
-<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.types.carbon.EventingConfigData" %>
-
-<fmt:bundle basename="org.wso2.carbon.bam.data.publisher.servicestats.i18n.Resources">
- <carbon:breadcrumb
- label="system.statistics"
- resourceBundle="org.wso2.carbon.bam.data.publisher.servicestats.i18n.Resources"
- topPage="true"
- request="<%=request%>"/>
-
- <%
- int systemRequestThreshold = 0;
- if (request.getParameter("systemRequestThreshold") != null) {
- try {
- systemRequestThreshold = Integer.parseInt(request.getParameter("systemRequestThreshold"));
- } catch (NumberFormatException ignored) {
- // let systemRequestThreshold be 0, meaning it is not set
- }
- }
-
- int serviceRequestThreshold = 0;
- if (request.getParameter("serviceRequestThreshold") != null) {
- try {
- serviceRequestThreshold = Integer.parseInt(request.getParameter("serviceRequestThreshold"));
- } catch (NumberFormatException ignored) {
- // let serviceRequestThreshold be 0, meaning it is not set
- }
- }
-
- int operationRequestThreshold = 0;
- if (request.getParameter("operationRequestThreshold") != null) {
- try {
- operationRequestThreshold = Integer.parseInt(request.getParameter("operationRequestThreshold"));
- } catch (NumberFormatException ignored) {
- // let operationRequestThreshold be 0, meaning it is not set
- }
- }
-
- String setConfig = request.getParameter("setConfig"); // hidden parameter to check if the form is being submitted
- String enableEventing = request.getParameter("enableEventing"); // String value is "on" of checkbox clicked, else null
-
- String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
- ConfigurationContext configContext =
- (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-
- String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
- ServiceStatPublisherAdminClient client = new ServiceStatPublisherAdminClient(cookie, backendServerURL,
- configContext, request.getLocale());
- EventingConfigData eventingConfigData = null;
- if (setConfig != null) { // form submitted requesing to set eventing config
- eventingConfigData = new EventingConfigData();
- if (enableEventing != null) {
- eventingConfigData.setEnableEventing(Utils.EVENTING_ON);
- eventingConfigData.setSystemRequestCountThreshold(systemRequestThreshold);
- eventingConfigData.setServiceRequestCountThreshold(serviceRequestThreshold);
- eventingConfigData.setOperationRequestCountThreshold(operationRequestThreshold);
- } else {
- eventingConfigData.setEnableEventing("OFF");
- }
- try {
- client.setEventingConfigData(eventingConfigData);
- %>
-<script type="text/javascript">
- jQuery(document).init(function() {
- function handleOK() {
-
- }
-
- CARBON.showInfoDialog("Eventing Configuration Successfully Updated!", handleOK);
- });
-</script>
- <%
- } catch (Exception e) {
- if(e.getCause().getMessage().toLowerCase().indexOf("you are not authorized") == -1){
- response.setStatus(500);
- CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
- session.setAttribute(CarbonUIMessage.ID, uiMsg);
- %>
- <jsp:include page="../admin/error.jsp"/>
- <%
- }
- }
- } else { // this is the initial loading of the page, hence load current values from backend
- try {
- eventingConfigData = client.getEventingConfigData();
- } catch (Exception e) {
- if(e.getCause().getMessage().toLowerCase().indexOf("you are not authorized") == -1){
- response.setStatus(500);
- CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
- session.setAttribute(CarbonUIMessage.ID, uiMsg);
-%>
- <jsp:include page="../admin/error.jsp"/>
-<%
- }
- }
- }
- boolean eventingOn = Utils.EVENTING_ON.equals(eventingConfigData.getEnableEventing());
- if (eventingOn) {
-
- systemRequestThreshold = eventingConfigData.getSystemRequestCountThreshold();
- serviceRequestThreshold = eventingConfigData.getServiceRequestCountThreshold();
- operationRequestThreshold = eventingConfigData.getOperationRequestCountThreshold();
- }
-%>
- <script id="source" type="text/javascript">
- function showHideDiv(divId){
- var theDiv = document.getElementById(divId);
- if(theDiv.style.display=="none"){
- theDiv.style.display="";
- }else{
- theDiv.style.display="none";
- }
- }
- </script>
-
- <div id="middle">
- <h2>
- <fmt:message key="bam.statpublisher.config"/>
- </h2>
-
- <div id="workArea">
- <div id="result"></div>
- <p> </p>
-
- <form action="configure_eventing.jsp" method="post">
- <input type="hidden" name="setConfig" value="on" />
- <table width="100%" class="styledLeft" style="margin-left: 0px;">
- <thead>
- <tr>
- <th colspan="4">
- <fmt:message key="eventing.configuration"/>
- </th>
- </tr>
- </thead>
- <tr>
- <td>
- <% if (eventingOn) { %>
- <input type="checkbox" name="enableEventing" onclick="showHideDiv('thresholdTr')" checked="true">
- <% } else { %>
- <input type="checkbox" name="enableEventing" onclick="showHideDiv('thresholdTr')">
- <% } %>
- <fmt:message key="enable.eventing"/>
-
- </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
-
- <% if (eventingOn) { %>
- <tr id="thresholdTr" style="display:block">
- <% } else { %>
- <tr id="thresholdTr" style="display:none">
- <% } %>
-
- <td>
- <table>
- <tr>
- <td colspan="2">
- <strong><i>
- <fmt:message key="eventing.note.1"/><br/>
- <fmt:message key="eventing.note.2"/>
- </i></strong></td>
- </tr>
- <tr>
- <td width="20%">
- <fmt:message key="system.request.threshold"/>
- </td>
- <td width="30%">
- <input type="text" size="5" value="<%= systemRequestThreshold%>"
- name="systemRequestThreshold"
- maxlength="4"/>
- </td>
- </tr>
- <tr>
- <td width="20%">
- <fmt:message key="service.request.threshold"/>
- </td>
- <td width="30%">
- <input type="text" size="5" value="<%= serviceRequestThreshold%>"
- name="serviceRequestThreshold"
- maxlength="4"/>
- </td>
- </tr>
- <tr>
- <td width="20%">
- <fmt:message key="operation.request.threshold"/>
- </td>
- <td width="30%">
- <input type="text" size="5" value="<%= operationRequestThreshold%>"
- name="operationRequestThreshold"
- maxlength="4"/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td colspan="4" class="buttonRow">
- <input type="submit" class="button" value="<fmt:message key="update"/>" id="updateStats"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
-</fmt:bundle>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.Utils" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.ServiceStatPublisherAdminClient" %>
+<%@ page import="org.wso2.carbon.bam.data.publishers.servicestats.ui.types.carbon.EventingConfigData" %>
+
+<fmt:bundle basename="org.wso2.carbon.bam.data.publishers.servicestats.ui.i18n.Resources">
+ <carbon:breadcrumb
+ label="system.statistics"
+ resourceBundle="org.wso2.carbon.bam.data.publishers.servicestats.ui.i18n.Resources"
+ topPage="true"
+ request="<%=request%>"/>
+
+ <%
+ int systemRequestThreshold = 0;
+ if (request.getParameter("systemRequestThreshold") != null) {
+ try {
+ systemRequestThreshold = Integer.parseInt(request.getParameter("systemRequestThreshold"));
+ } catch (NumberFormatException ignored) {
+ // let systemRequestThreshold be 0, meaning it is not set
+ }
+ }
+
+ int serviceRequestThreshold = 0;
+ if (request.getParameter("serviceRequestThreshold") != null) {
+ try {
+ serviceRequestThreshold = Integer.parseInt(request.getParameter("serviceRequestThreshold"));
+ } catch (NumberFormatException ignored) {
+ // let serviceRequestThreshold be 0, meaning it is not set
+ }
+ }
+
+ int operationRequestThreshold = 0;
+ if (request.getParameter("operationRequestThreshold") != null) {
+ try {
+ operationRequestThreshold = Integer.parseInt(request.getParameter("operationRequestThreshold"));
+ } catch (NumberFormatException ignored) {
+ // let operationRequestThreshold be 0, meaning it is not set
+ }
+ }
+
+ String setConfig = request.getParameter("setConfig"); // hidden parameter to check if the form is being submitted
+ String enableEventing = request.getParameter("enableEventing"); // String value is "on" of checkbox clicked, else null
+
+ String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+ ConfigurationContext configContext =
+ (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+ String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+ ServiceStatPublisherAdminClient client = new ServiceStatPublisherAdminClient(cookie, backendServerURL,
+ configContext, request.getLocale());
+ EventingConfigData eventingConfigData = null;
+ if (setConfig != null) { // form submitted requesing to set eventing config
+ eventingConfigData = new EventingConfigData();
+ if (enableEventing != null) {
+ eventingConfigData.setEnableEventing(Utils.EVENTING_ON);
+ eventingConfigData.setSystemRequestCountThreshold(systemRequestThreshold);
+ eventingConfigData.setServiceRequestCountThreshold(serviceRequestThreshold);
+ eventingConfigData.setOperationRequestCountThreshold(operationRequestThreshold);
+ } else {
+ eventingConfigData.setEnableEventing("OFF");
+ }
+ try {
+ client.setEventingConfigData(eventingConfigData);
+ %>
+<script type="text/javascript">
+ jQuery(document).init(function() {
+ function handleOK() {
+
+ }
+
+ CARBON.showInfoDialog("Eventing Configuration Successfully Updated!", handleOK);
+ });
+</script>
+ <%
+ } catch (Exception e) {
+ if(e.getCause().getMessage().toLowerCase().indexOf("you are not authorized") == -1){
+ response.setStatus(500);
+ CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+ session.setAttribute(CarbonUIMessage.ID, uiMsg);
+ %>
+ <jsp:include page="../admin/error.jsp"/>
+ <%
+ }
+ }
+ } else { // this is the initial loading of the page, hence load current values from backend
+ try {
+ eventingConfigData = client.getEventingConfigData();
+ } catch (Exception e) {
+ if(e.getCause().getMessage().toLowerCase().indexOf("you are not authorized") == -1){
+ response.setStatus(500);
+ CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+ session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+ <jsp:include page="../admin/error.jsp"/>
+<%
+ }
+ }
+ }
+ boolean eventingOn = Utils.EVENTING_ON.equals(eventingConfigData.getEnableEventing());
+ if (eventingOn) {
+
+ systemRequestThreshold = eventingConfigData.getSystemRequestCountThreshold();
+ serviceRequestThreshold = eventingConfigData.getServiceRequestCountThreshold();
+ operationRequestThreshold = eventingConfigData.getOperationRequestCountThreshold();
+ }
+%>
+ <script id="source" type="text/javascript">
+ function showHideDiv(divId){
+ var theDiv = document.getElementById(divId);
+ if(theDiv.style.display=="none"){
+ theDiv.style.display="";
+ }else{
+ theDiv.style.display="none";
+ }
+ }
+ </script>
+
+ <div id="middle">
+ <h2>
+ <fmt:message key="bam.statpublisher.config"/>
+ </h2>
+
+ <div id="workArea">
+ <div id="result"></div>
+ <p> </p>
+
+ <form action="configure_eventing.jsp" method="post">
+ <input type="hidden" name="setConfig" value="on" />
+ <table width="100%" class="styledLeft" style="margin-left: 0px;">
+ <thead>
+ <tr>
+ <th colspan="4">
+ <fmt:message key="eventing.configuration"/>
+ </th>
+ </tr>
+ </thead>
+ <tr>
+ <td>
+ <% if (eventingOn) { %>
+ <input type="checkbox" name="enableEventing" onclick="showHideDiv('thresholdTr')" checked="true">
+ <% } else { %>
+ <input type="checkbox" name="enableEventing" onclick="showHideDiv('thresholdTr')">
+ <% } %>
+ <fmt:message key="enable.eventing"/>
+
+ </td>
+ </tr>
+ <tr>
+ <td colspan="4"> </td>
+ </tr>
+
+ <% if (eventingOn) { %>
+ <tr id="thresholdTr" style="display:block">
+ <% } else { %>
+ <tr id="thresholdTr" style="display:none">
+ <% } %>
+
+ <td>
+ <table>
+ <tr>
+ <td colspan="2">
+ <strong><i>
+ <fmt:message key="eventing.note.1"/><br/>
+ <fmt:message key="eventing.note.2"/>
+ </i></strong></td>
+ </tr>
+ <tr>
+ <td width="20%">
+ <fmt:message key="system.request.threshold"/>
+ </td>
+ <td width="30%">
+ <input type="text" size="5" value="<%= systemRequestThreshold%>"
+ name="systemRequestThreshold"
+ maxlength="4"/>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%">
+ <fmt:message key="service.request.threshold"/>
+ </td>
+ <td width="30%">
+ <input type="text" size="5" value="<%= serviceRequestThreshold%>"
+ name="serviceRequestThreshold"
+ maxlength="4"/>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%">
+ <fmt:message key="operation.request.threshold"/>
+ </td>
+ <td width="30%">
+ <input type="text" size="5" value="<%= operationRequestThreshold%>"
+ name="operationRequestThreshold"
+ maxlength="4"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="4" class="buttonRow">
+ <input type="submit" class="button" value="<fmt:message key="update"/>" id="updateStats"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </div>
+</fmt:bundle>
More information about the Carbon-commits
mailing list