[jboss-cvs] JBossAS SVN: r59792 - in projects/admin-console/trunk/src: main/org/jboss/admin/console/web/struts/jms and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 18 13:44:12 EST 2007
Author: chilin
Date: 2007-01-18 13:44:12 -0500 (Thu, 18 Jan 2007)
New Revision: 59792
Added:
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseDestinationAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseJmsAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/Constants.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/CreateDestinationAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationForm.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationIdentifierForm.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/JmsForm.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ListDestinationsAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveDestinationAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveMessagesAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveDestinationAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveJmsAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewDestinationAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewJmsAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewMessagesAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewSubscriptionsAction.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Destination.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationIdentifier.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationMessage.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationState.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Jms.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Queue.java
projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Topic.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Constants.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceDestinationHelper.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceJmsHelper.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationService.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationServiceImpl.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Error.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsService.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceException.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceImpl.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceRuntimeException.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerDestinationHelper.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerJmsHelper.java
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/classes/messages/jmsmessages.properties
projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteModelJms.java
projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteServiceJms.java
projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteStrutsJms.java
Modified:
projects/admin-console/trunk/src/main/org/jboss/admin/service/DeploymentServiceHelper.java
projects/admin-console/trunk/src/main/org/jboss/admin/service/MBeanServerHelper.java
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/common/validator-rules.xml
Log:
Initial check-in to support JBoss Messaging.
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseDestinationAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseDestinationAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseDestinationAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.BaseAction;
+import org.jboss.admin.service.jms.DestinationService;
+import org.jboss.admin.service.jms.DestinationServiceImpl;
+
+/**
+ * The BaseDestinationAction type provides routines used to access the
+ * destination service.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @version $Revision: 56034 $
+ */
+public abstract class BaseDestinationAction extends BaseAction {
+
+ /**
+ * The service that manages the destinations.
+ */
+ private DestinationService dest;
+
+ /**
+ * Key used to locate destination service in the servlet context.
+ */
+ protected static final String SERVLET_CONTEXT_DESTINATION_SERVICE_KEY = "destinationService";
+
+ /**
+ * Gets the destination service.
+ * </p>
+ * <p>
+ * Unless setDestinationService has already been called, the first time
+ * through this method will check the servlet context for a
+ * DestinationService implementation stored under
+ * SERVLET_CONTEXT_DESTINATION_SERVICE_KEY. If one is not found then a
+ * DestinationServiceImpl instance is used. This is to enable StrutsTestCase
+ * based unit tests to provide a mock implementation of the
+ * DestinationService.
+ *
+ * @return The destination service.
+ */
+ public DestinationService getDestinationService() {
+
+ if (dest == null) {
+ DestinationService service = (DestinationService) getServlet()
+ .getServletContext()
+ .getAttribute(SERVLET_CONTEXT_DESTINATION_SERVICE_KEY);
+
+ if (service == null) {
+ service = new DestinationServiceImpl();
+ }
+ dest = service;
+ }
+
+ return dest;
+ }
+
+}
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseJmsAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseJmsAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/BaseJmsAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.jboss.admin.AdminConstants;
+import org.jboss.admin.console.web.struts.BaseAction;
+import org.jboss.admin.service.jms.JmsService;
+import org.jboss.admin.service.jms.JmsServiceImpl;
+
+/**
+ * The BaseJmsAction type provides routines used to access the jms service.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public abstract class BaseJmsAction extends BaseAction {
+
+ /**
+ * The service that manages the jms attributes.
+ */
+ private JmsService jms;
+
+ /**
+ * Key used to locate jms service in the servlet context.
+ */
+ protected static final String SERVLET_CONTEXT_JMS_SERVICE_KEY = "jmsService";
+
+ /**
+ * Gets the jms service.
+ * </p>
+ * <p>
+ * Unless setJmsService has already been called, the first time through this
+ * method will check the servlet context for a JmsService implementation
+ * stored under SERVLET_CONTEXT_JMS_SERVICE_KEY. If one is not found then a
+ * JmsServiceImpl instance is used. This is to enable StrutsTestCase based
+ * unit tests to provide a mock implementation of the JmsService.
+ *
+ * @return The jms service.
+ */
+ public JmsService getJmsService() {
+ if (jms == null) {
+ JmsService service = (JmsService) getServlet().getServletContext()
+ .getAttribute(SERVLET_CONTEXT_JMS_SERVICE_KEY);
+
+ if (service == null) {
+ service = new JmsServiceImpl();
+ }
+ jms = service;
+ }
+ return jms;
+ }
+
+ /**
+ * Break the long string of msg sql properties into individual sql statements
+ * and store them into the msgSqlMap.
+ *
+ * @param jmsForm
+ * The jms form bean where the msgSqlMap is located.
+ */
+ protected void buildMsgSqlMap(JmsForm jmsForm) {
+ String SEPARATOR = AdminConstants.LINE_SEPARATOR;
+ String key;
+ String value;
+ int inx;
+ String sqlProperties = jmsForm.getMsgSqlProperties();
+ if (sqlProperties != null) {
+ String[] props = sqlProperties.split(SEPARATOR);
+ for (int i = 0; i < props.length; i++) {
+ if (!props[i].startsWith("#")) {
+ inx = props[i].indexOf("=");
+ key = props[i].substring(0, inx);
+ value = props[i].substring(inx + 1);
+ value = value.replaceAll("\\\\", ""); // Get rid of the
+ // escape characters
+ jmsForm.setMsgSqlEntry(key.trim(), value.trim());
+ }
+ }
+ }
+ }
+
+ /**
+ * Break the long string of user sql properties into individual sql statements
+ * and store them into the userSqlMap.
+ *
+ * @param jmsForm
+ * The jms form bean where the userSqlMap is located.
+ */
+ protected void buildUserSqlMap(JmsForm jmsForm) {
+ String SEPARATOR = AdminConstants.LINE_SEPARATOR;
+ String key;
+ String value;
+ int inx;
+ String sqlProperties = jmsForm.getUserSqlProperties();
+ if (sqlProperties != null) {
+ String[] props = sqlProperties.split(SEPARATOR);
+ for (int i = 0; i < props.length; i++) {
+ if (!props[i].startsWith("#")) {
+ inx = props[i].indexOf("=");
+ key = props[i].substring(0, inx);
+ value = props[i].substring(inx + 1);
+ value = value.replaceAll("\\\\=", "="); // replace "\\=" by
+ // "="
+ jmsForm.setUserSqlEntry(key.trim(), value.trim());
+ }
+ }
+ }
+ }
+}
+
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/Constants.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/Constants.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/Constants.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+/**
+ * Class which draws together some of the constants used by the View and
+ * Controller layers
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @version $Revision: 56034 $
+ */
+public class Constants {
+
+ /**
+ * The DestinationTypes type contains string constants used to identify the
+ * type of destination: topic or queue.
+ */
+ public class DestinationTypes {
+ public static final String TOPIC = "topic", QUEUE = "queue";
+ }
+
+ /**
+ * The Struts type contains the prefix string constant for a destination
+ * global forwarding
+ */
+ public class Struts {
+ public static final String GLOBAL_FORWARD_PREFIX = "destination.list.";
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/CreateDestinationAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/CreateDestinationAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/CreateDestinationAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.commons.beanutils.BeanUtils;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.admin.model.jms.Destination;
+
+/**
+ * The CreateDestinationAction type gathers the data necessary to display the
+ * page that enables a user to create a new destination.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @version $Revision: 56034 $
+ */
+public class CreateDestinationAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(CreateDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+
+ /*
+ * Determine the type of destination the user will create, and create a
+ * value object for that destination:
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ String type = identifierForm.getType();
+ Destination dest = null;
+ if (type.equals(Constants.DestinationTypes.QUEUE)) {
+ dest = getDestinationService().getDefaultQueue();
+ } else if (type.equals(Constants.DestinationTypes.TOPIC)) {
+ dest = getDestinationService().getDefaultTopic();
+ }
+
+ /*
+ * Copy the default values from the value object to the form object:
+ */
+ DestinationForm destinationForm = new DestinationForm();
+ BeanUtils.copyProperties(destinationForm, dest);
+ destinationForm.setType(type);
+ if (logger.isInfoEnabled()) {
+ logger.info(destinationForm.toString());
+ }
+
+ /*
+ * Attach the form to the request so the jsp can access the data:
+ */
+ request.getSession().setAttribute("destination", destinationForm);
+
+ /*
+ * Attach an attribute so that the jsp can see this "create" action
+ */
+ request.setAttribute("operation", "create");
+
+ ActionForward returnActionForward = mapping.findForward("showpage");
+ if (logger.isDebugEnabled()) {
+ logger.debug("<== perform(): " + mapping);
+ }
+ return returnActionForward;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationForm.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationForm.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationForm.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,401 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.validator.ValidatorForm;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * The DestinationForm type holds the form data for a single destination.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationForm extends ValidatorForm {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory.getLog(DestinationForm.class);
+
+ /**
+ * The destination identifier
+ */
+ private DestinationIdentifier identifier;
+
+ /**
+ * The destination type: topic or queue
+ */
+ private String type;
+
+ /*
+ * Common attributes for both queue the topic type destinations
+ */
+
+ /**
+ * The name of the destination
+ */
+ private String name;
+
+ /**
+ * The jndi binding of the destination
+ */
+ private String jndiName;
+
+ /**
+ * True if this destination was created programmatically
+ */
+ private boolean createdProgrammatically;
+
+ /**
+ * The write-cache size
+ */
+ private String downCacheSize;
+
+ /**
+ * The in-memory message limit
+ */
+ private String fullSize;
+
+ /**
+ * The paging size
+ */
+ private String pageSize;
+
+ /**
+ * Security roles
+ */
+ private String securityRoles;
+
+ /**
+ * The name of the server peer this destination was deployed on
+ */
+ private String serverPeerName;
+
+ /*
+ * Attributes specific to Queue type
+ */
+
+ /**
+ * The number of messages in the queue
+ */
+ private String messageCount;
+
+ /*
+ * Attributes specific to Topic type
+ */
+
+ /**
+ * The number of Subscriptions waiting for a message
+ */
+ private String allSubCount;
+
+ /**
+ * The number of DurableSubscriptions waiting for a message
+ */
+ private String durableSubCount;
+
+ /**
+ * The number of NonDurableSubscriptions waiting for a message
+ */
+ private String nonDurableSubCount;
+
+ public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
+ ActionErrors currentErrors = super.validate(arg0, arg1);
+
+ validateDataSize(currentErrors);
+
+ return currentErrors;
+ }
+
+ protected void validateDataSize(ActionErrors currentErrors) {
+ try {
+ int pageSize = Integer.parseInt(getPageSize());
+ try {
+ int downCacheSize = Integer.parseInt(getDownCacheSize());
+ if (pageSize < downCacheSize) {
+ currentErrors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("destination.error.pageSizeTooSmall"));
+ }
+ } catch (NumberFormatException e) {
+ // The error should have been catched already, so do nothing here
+ }
+ } catch (NumberFormatException e) {
+ // The error should have been catched already, so do nothing here
+ }
+ }
+
+ /**
+ * @return Returns the identifier
+ */
+ public DestinationIdentifier getIdentifier() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getIdentifier(): " + identifier);
+ }
+ return identifier;
+ }
+
+ /**
+ * @param identifier
+ * The identifier to set.
+ */
+ public void setIdentifier(DestinationIdentifier identifier) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("setIdentifier(" + identifier + ")");
+ }
+ this.identifier = identifier;
+ }
+
+ /**
+ * @return Returns the type.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type
+ * The type to set.
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Returns the jndiName.
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ /**
+ * @param jndiName
+ * The jndiName to set.
+ */
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ /**
+ * @return Returns the createdProgrammatically.
+ */
+ public boolean isCreatedProgrammatically() {
+ return createdProgrammatically;
+ }
+
+ /**
+ * @param createdProgrammatically
+ * The createdProgrammatically to set.
+ */
+ public void setCreatedProgrammatically(boolean createdProgrammatically) {
+ this.createdProgrammatically = createdProgrammatically;
+ }
+
+ /**
+ * @return Returns the downCacheSize.
+ */
+ public String getDownCacheSize() {
+ return downCacheSize;
+ }
+
+ /**
+ * @param downCacheSize
+ * The downCacheSize to set.
+ */
+ public void setDownCacheSize(String downCacheSize) {
+ this.downCacheSize = downCacheSize;
+ }
+
+ /**
+ * @return Returns the fullSize.
+ */
+ public String getFullSize() {
+ return fullSize;
+ }
+
+ /**
+ * @param fullSize
+ * The fullSize to set.
+ */
+ public void setFullSize(String fullSize) {
+ this.fullSize = fullSize;
+ }
+
+ /**
+ * @return Returns the pageSize.
+ */
+ public String getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @param pageSize
+ * The pageSize to set.
+ */
+ public void setPageSize(String pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ /**
+ * @return Returns the securityRoles
+ */
+ public String getSecurityRoles() {
+ return securityRoles;
+ }
+
+ /**
+ * @param securityRoles
+ * The securityRoles to set.
+ */
+ public void setSecurityRoles(String securityRoles) {
+ this.securityRoles = securityRoles;
+ }
+
+ /**
+ * @return Returns the serverPeerName.
+ */
+ public String getServerPeerName() {
+ return serverPeerName;
+ }
+
+ /**
+ * @param serverPeerName
+ * The serverPeerName to set.
+ */
+ public void setServerPeerName(String serverPeerName) {
+ this.serverPeerName = serverPeerName;
+ }
+
+ /**
+ * @return Returns the messageCount.
+ */
+ public String getMessageCount() {
+ return messageCount;
+ }
+
+ /**
+ * @param messageCount
+ * The messageCount to set.
+ */
+ public void setMessageCount(String messageCount) {
+ this.messageCount = messageCount;
+ }
+
+ /**
+ * @return Returns the allSubCount.
+ */
+ public String getAllSubCount() {
+ return allSubCount;
+ }
+
+ /**
+ * @param allSubCount
+ * The allSubCount to set.
+ */
+ public void setAllSubCount(String allSubCount) {
+ this.allSubCount = allSubCount;
+ }
+
+ /**
+ * @return Returns the durableSubCount.
+ */
+ public String getDurableSubCount() {
+ return durableSubCount;
+ }
+
+ /**
+ * @param durableSubCount
+ * The durableSubCount to set.
+ */
+ public void setDurableSubCount(String durableSubCount) {
+ this.durableSubCount = durableSubCount;
+ }
+
+ /**
+ * @return Returns the nonDurableSubCount.
+ */
+ public String getNonDurableSubCount() {
+ return nonDurableSubCount;
+ }
+
+ /**
+ * @param nonDurableSubCount
+ * The nonDurableSubCount to set.
+ */
+ public void setNonDurableSubCount(String nonDurableSubCount) {
+ this.nonDurableSubCount = nonDurableSubCount;
+ }
+
+ /**
+ * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("reset()");
+ }
+ createdProgrammatically = false;
+ }
+
+ /**
+ * @return A string that identifies the destination form contents.
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ ToStringBuilder builder = new ToStringBuilder(this)
+ .append("type", type).append("name", name).append("jndiName",
+ jndiName);
+ return builder.toString();
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationIdentifierForm.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationIdentifierForm.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/DestinationIdentifierForm.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+
+/**
+ * ActionForm covering all types of DataSources
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationIdentifierForm extends ActionForm {
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(DestinationIdentifierForm.class);
+
+ /**
+ * The identifier of the destination
+ */
+ private String identifier;
+
+ /**
+ * The name of the destination
+ */
+ private String name;
+
+ /**
+ * The destination type
+ */
+ private String type;
+
+ /**
+ * Return the destination identifier
+ *
+ * @return Returns the identifier.
+ */
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * Set the destination with a specified identifier
+ *
+ * @param identifier
+ * The identifier to set.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Gets the name of the destination
+ *
+ * @return The destination name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the destination.
+ *
+ * @param name
+ * The name.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the destination type.
+ *
+ * @return The destination type.
+ */
+ public String getType() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getType(): " + type);
+ }
+ return type;
+ }
+
+ /**
+ * Sets the destination type
+ *
+ * @param type
+ * The destination type.
+ */
+ public void setType(String type) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("setType(" + type + ")");
+ }
+ this.type = type;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/JmsForm.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/JmsForm.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/JmsForm.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,836 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.validator.ValidatorForm;
+
+/**
+ * The JmsForm type holds the form data for Jms attributes.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class JmsForm extends ValidatorForm {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory.getLog(JmsForm.class);
+
+ /*
+ * ********** Attributes from the ConnectionFactory MBean **********
+ */
+
+ /**
+ * The name of the remoting connector this destination will use
+ */
+ private String connectorName;
+
+ /**
+ * The default value of paging down cache size for any temporary queues
+ * created for connections from this connection factory
+ */
+ private String defaultTempQueueDownCacheSize;
+
+ /**
+ * The default value of paging full size for any temporary queues created
+ * for connections from this connection factory
+ */
+ private String defaultTempQueueFullSize;
+
+ /**
+ * The default value of paging page size for any temporary queues created
+ * for connections from this connection factory
+ */
+ private String defaultTempQueuePageSize;
+
+ /**
+ * The maximum number of messages that will be prefetched by the client side
+ * consumer
+ */
+ private String prefetchSize;
+
+ /**
+ * The name of the server peer this destination was deployed on
+ */
+ private String serverPeerName;
+
+ /*
+ * ********** Attributes from the ServerPeer MBean **********
+ */
+
+ /**
+ * The default JNDI context queues are bound under
+ */
+ private String defaultQueueJNDIContext;
+
+ /**
+ * The default security config in text form
+ */
+ private String defaultSecurityRoles;
+
+ /**
+ * The default JNDI context topics are bound under
+ */
+ private String defaultTopicJNDIContext;
+
+ /**
+ * The JMS provider name
+ */
+ private String jmsProviderName;
+
+ /**
+ * The version of the JMS specification implemented by this provider
+ */
+ private String jmsVersion;
+
+ /**
+ * The name of the persistence manager
+ */
+ private String persistenceManagerName;
+
+ /**
+ * The fully qualified provider version string
+ */
+ private String providerVersion;
+
+ /**
+ * The size of the rotating pool from which to allocate QueuedExecutors
+ */
+ private String queuedExecutorPoolSize;
+
+ /**
+ * The Security Domain to be used by the Server Peer
+ */
+ private String securityDomain;
+
+ /**
+ * The ID of the ServerPeer. Must be unique per JBoss instance
+ */
+ private String serverPeerID;
+
+ /*
+ * ********** Attributes from the PersistenceManager MBean **********
+ */
+
+ /**
+ * Should persistence database tables be created on startup?
+ */
+ private boolean createMsgTablesOnStartup;
+
+ /**
+ * The max number of params to be used in a generated Prepared Statement
+ */
+ private String maxParams;
+
+ /**
+ * The name of the DataSource used by the persistence manager
+ */
+ private String msgDataSourceName;
+
+ /**
+ * The sql statements used to implement the persistence service.
+ */
+ private String msgSqlProperties;
+
+ /**
+ * The name of the TransactionManager used by this persistence manager
+ */
+ private String transactionManagerName;
+
+
+ /**
+ * Should JDBC batch updates be used?
+ */
+ private boolean usingBatchUpdates;
+
+ /*
+ * ********** Attributes from the JMSUserManager MBean **********
+ */
+
+ /**
+ * Should user database tables be created on startup?
+ */
+ private boolean createUserTablesOnStartup;
+
+ /**
+ * The name of the DataSource used by the JMSUserManager
+ */
+ private String userDataSourceName;
+
+ /**
+ * The sql statements used to persist the user information.
+ */
+ private String userSqlProperties;
+
+ /*
+ * ********** Attributes from the QueuePostOffice MBean **********
+ */
+
+
+
+ /*
+ * ********** Attributes from the TopicPostOffice MBean **********
+ */
+
+
+
+ /*
+ * *************** Other Attributes ********************************
+ */
+
+ /**
+ * Save the persistence dataSource name. Needed when a new dataSource is selected.
+ */
+ private String savedMsgDataSourceName;
+
+ /**
+ * Save the user dataSource name. Needed when a new dataSource is selected.
+ */
+ private String savedUserDataSourceName;
+
+ /**
+ * The name and driver class of all the available dataSources.
+ */
+ private Map dataSources;
+
+ /**
+ * Map storing SQL properties used by PersistenceManager.
+ */
+ private Map msgSqlMap = new TreeMap();
+
+ /**
+ * Save the msgSqlMap. Used to check if there're any changes.
+ */
+ private Map savedMsgSqlMap = new HashMap();
+
+ /**
+ * Map storing SQL properties used by JMSUserManager.
+ */
+ private Map userSqlMap = new TreeMap();
+
+ /**
+ * Save the userSqlMap. Used to check if there're any changes.
+ */
+ private Map savedUserSqlMap = new HashMap();
+
+ /*
+ * *************** Getters and Setters *****************************
+ */
+
+ /**
+ * @return Returns the createMsgTablesOnStartup.
+ */
+ public boolean isCreateMsgTablesOnStartup() {
+ return createMsgTablesOnStartup;
+ }
+
+ /**
+ * @param createMsgTablesOnStartup The createMsgTablesOnStartup to set.
+ */
+ public void setCreateMsgTablesOnStartup(boolean createMsgTablesOnStartup) {
+ this.createMsgTablesOnStartup = createMsgTablesOnStartup;
+ }
+
+ /**
+ * @return Returns the createUserTablesOnStartup.
+ */
+ public boolean isCreateUserTablesOnStartup() {
+ return createUserTablesOnStartup;
+ }
+
+ /**
+ * @param createUserTablesOnStartup The createUserTablesOnStartup to set.
+ */
+ public void setCreateUserTablesOnStartup(boolean createUserTablesOnStartup) {
+ this.createUserTablesOnStartup = createUserTablesOnStartup;
+ }
+
+ /**
+ * @return Returns the connectorName.
+ */
+ public String getConnectorName() {
+ return connectorName;
+ }
+
+ /**
+ * @param connectorName The connectorName to set.
+ */
+ public void setConnectorName(String connectorName) {
+ this.connectorName = connectorName;
+ }
+
+ /**
+ * @return Returns the dataSources.
+ */
+ public Map getDataSources() {
+ return dataSources;
+ }
+
+ /**
+ * @param dataSources The dataSources to set.
+ */
+ public void setDataSources(Map dataSources) {
+ this.dataSources = dataSources;
+ }
+
+ /**
+ * @return Returns the defaultQueueJNDIContext.
+ */
+ public String getDefaultQueueJNDIContext() {
+ return defaultQueueJNDIContext;
+ }
+
+ /**
+ * @param defaultQueueJNDIContext The defaultQueueJNDIContext to set.
+ */
+ public void setDefaultQueueJNDIContext(String defaultQueueJNDIContext) {
+ this.defaultQueueJNDIContext = defaultQueueJNDIContext;
+ }
+
+ /**
+ * @return Returns the defaultSecurityRoles.
+ */
+ public String getDefaultSecurityRoles() {
+ return defaultSecurityRoles;
+ }
+
+ /**
+ * @param defaultSecurityRoles The defaultSecurityRoles to set.
+ */
+ public void setDefaultSecurityRoles(String defaultSecurityRoles) {
+ this.defaultSecurityRoles = defaultSecurityRoles;
+ }
+
+ /**
+ * @return Returns the defaultTempQueueDownCacheSize.
+ */
+ public String getDefaultTempQueueDownCacheSize() {
+ return defaultTempQueueDownCacheSize;
+ }
+
+ /**
+ * @param defaultTempQueueDownCacheSize The defaultTempQueueDownCacheSize to set.
+ */
+ public void setDefaultTempQueueDownCacheSize(
+ String defaultTempQueueDownCacheSize) {
+ this.defaultTempQueueDownCacheSize = defaultTempQueueDownCacheSize;
+ }
+
+ /**
+ * @return Returns the defaultTempQueueFullSize.
+ */
+ public String getDefaultTempQueueFullSize() {
+ return defaultTempQueueFullSize;
+ }
+
+ /**
+ * @param defaultTempQueueFullSize The defaultTempQueueFullSize to set.
+ */
+ public void setDefaultTempQueueFullSize(String defaultTempQueueFullSize) {
+ this.defaultTempQueueFullSize = defaultTempQueueFullSize;
+ }
+
+ /**
+ * @return Returns the defaultTempQueuePageSize.
+ */
+ public String getDefaultTempQueuePageSize() {
+ return defaultTempQueuePageSize;
+ }
+
+ /**
+ * @param defaultTempQueuePageSize The defaultTempQueuePageSize to set.
+ */
+ public void setDefaultTempQueuePageSize(String defaultTempQueuePageSize) {
+ this.defaultTempQueuePageSize = defaultTempQueuePageSize;
+ }
+
+ /**
+ * @return Returns the defaultTopicJNDIContext.
+ */
+ public String getDefaultTopicJNDIContext() {
+ return defaultTopicJNDIContext;
+ }
+
+ /**
+ * @param defaultTopicJNDIContext The defaultTopicJNDIContext to set.
+ */
+ public void setDefaultTopicJNDIContext(String defaultTopicJNDIContext) {
+ this.defaultTopicJNDIContext = defaultTopicJNDIContext;
+ }
+
+ /**
+ * @return Returns the jmsProviderName.
+ */
+ public String getJmsProviderName() {
+ return jmsProviderName;
+ }
+
+ /**
+ * @param jmsProviderName The jmsProviderName to set.
+ */
+ public void setJmsProviderName(String jmsProviderName) {
+ this.jmsProviderName = jmsProviderName;
+ }
+
+ /**
+ * @return Returns the jmsVersion.
+ */
+ public String getJmsVersion() {
+ return jmsVersion;
+ }
+
+ /**
+ * @param jmsVersion The jmsVersion to set.
+ */
+ public void setJmsVersion(String jmsVersion) {
+ this.jmsVersion = jmsVersion;
+ }
+
+ /**
+ * @return Returns the maxParams.
+ */
+ public String getMaxParams() {
+ return maxParams;
+ }
+
+ /**
+ * @param maxParams The maxParams to set.
+ */
+ public void setMaxParams(String maxParams) {
+ this.maxParams = maxParams;
+ }
+
+ /**
+ * @return Returns the msgDataSourceName.
+ */
+ public String getMsgDataSourceName() {
+ return msgDataSourceName;
+ }
+
+ /**
+ * @param msgDataSourceName The msgDataSourceName to set.
+ */
+ public void setMsgDataSourceName(String msgDataSourceName) {
+ this.msgDataSourceName = msgDataSourceName;
+ }
+
+ /**
+ * @return Returns the msgSqlMap.
+ */
+ public Map getMsgSqlMap() {
+ return msgSqlMap;
+ }
+
+ /**
+ * @param msgSqlMap The msgSqlMap to set.
+ */
+ public void setMsgSqlMap(Map msgSqlMap) {
+ this.msgSqlMap = msgSqlMap;
+ }
+
+ /**
+ * @return Returns the msgSqlProperties.
+ */
+ public String getMsgSqlProperties() {
+ return msgSqlProperties;
+ }
+
+ /**
+ * @param msgSqlProperties The msgSqlProperties to set.
+ */
+ public void setMsgSqlProperties(String msgSqlProperties) {
+ this.msgSqlProperties = msgSqlProperties;
+ }
+
+ /**
+ * @return Returns the persistenceManagerName.
+ */
+ public String getPersistenceManagerName() {
+ return persistenceManagerName;
+ }
+
+ /**
+ * @param persistenceManagerName The persistenceManagerName to set.
+ */
+ public void setPersistenceManagerName(String persistenceManagerName) {
+ this.persistenceManagerName = persistenceManagerName;
+ }
+
+ /**
+ * @return Returns the prefetchSize.
+ */
+ public String getPrefetchSize() {
+ return prefetchSize;
+ }
+
+ /**
+ * @param prefetchSize The prefetchSize to set.
+ */
+ public void setPrefetchSize(String prefetchSize) {
+ this.prefetchSize = prefetchSize;
+ }
+
+ /**
+ * @return Returns the providerVersion.
+ */
+ public String getProviderVersion() {
+ return providerVersion;
+ }
+
+ /**
+ * @param providerVersion The providerVersion to set.
+ */
+ public void setProviderVersion(String providerVersion) {
+ this.providerVersion = providerVersion;
+ }
+
+ /**
+ * @return Returns the queuedExecutorPoolSize.
+ */
+ public String getQueuedExecutorPoolSize() {
+ return queuedExecutorPoolSize;
+ }
+
+ /**
+ * @param queuedExecutorPoolSize The queuedExecutorPoolSize to set.
+ */
+ public void setQueuedExecutorPoolSize(String queuedExecutorPoolSize) {
+ this.queuedExecutorPoolSize = queuedExecutorPoolSize;
+ }
+
+ /**
+ * @return Returns the savedMsgDataSourceName.
+ */
+ public String getSavedMsgDataSourceName() {
+ return savedMsgDataSourceName;
+ }
+
+ /**
+ * @param savedMsgDataSourceName The savedMsgDataSourceName to set.
+ */
+ public void setSavedMsgDataSourceName(String savedMsgDataSourceName) {
+ this.savedMsgDataSourceName = savedMsgDataSourceName;
+ }
+
+ /**
+ * @return Returns the savedUserDataSourceName.
+ */
+ public String getSavedUserDataSourceName() {
+ return savedUserDataSourceName;
+ }
+
+ /**
+ * @param savedUserDataSourceName The savedUserDataSourceName to set.
+ */
+ public void setSavedUserDataSourceName(String savedUserDataSourceName) {
+ this.savedUserDataSourceName = savedUserDataSourceName;
+ }
+
+ /**
+ * @return Returns the securityDomain.
+ */
+ public String getSecurityDomain() {
+ return securityDomain;
+ }
+
+ /**
+ * @param securityDomain The securityDomain to set.
+ */
+ public void setSecurityDomain(String securityDomain) {
+ this.securityDomain = securityDomain;
+ }
+
+ /**
+ * @return Returns the serverPeerID.
+ */
+ public String getServerPeerID() {
+ return serverPeerID;
+ }
+
+ /**
+ * @param serverPeerID The serverPeerID to set.
+ */
+ public void setServerPeerID(String serverPeerID) {
+ this.serverPeerID = serverPeerID;
+ }
+
+ /**
+ * @return Returns the serverPeerName.
+ */
+ public String getServerPeerName() {
+ return serverPeerName;
+ }
+
+ /**
+ * @param serverPeerName The serverPeerName to set.
+ */
+ public void setServerPeerName(String serverPeerName) {
+ this.serverPeerName = serverPeerName;
+ }
+
+ /**
+ * @return Returns the transactionManagerName.
+ */
+ public String getTransactionManagerName() {
+ return transactionManagerName;
+ }
+
+ /**
+ * @param transactionManagerName The transactionManagerName to set.
+ */
+ public void setTransactionManagerName(String transactionManagerName) {
+ this.transactionManagerName = transactionManagerName;
+ }
+
+ /**
+ * @return Returns the userDataSourceName.
+ */
+ public String getUserDataSourceName() {
+ return userDataSourceName;
+ }
+
+ /**
+ * @param userDataSourceName The userDataSourceName to set.
+ */
+ public void setUserDataSourceName(String userDataSourceName) {
+ this.userDataSourceName = userDataSourceName;
+ }
+
+ /**
+ * @return Returns the userSqlMap.
+ */
+ public Map getUserSqlMap() {
+ return userSqlMap;
+ }
+
+ /**
+ * @param userSqlMap The userSqlMap to set.
+ */
+ public void setUserSqlMap(Map userSqlMap) {
+ this.userSqlMap = userSqlMap;
+ }
+
+ /**
+ * @return Returns the userSqlProperties.
+ */
+ public String getUserSqlProperties() {
+ return userSqlProperties;
+ }
+
+ /**
+ * @param userSqlProperties The userSqlProperties to set.
+ */
+ public void setUserSqlProperties(String userSqlProperties) {
+ this.userSqlProperties = userSqlProperties;
+ }
+
+ /**
+ * @return Returns the usingBatchUpdates.
+ */
+ public boolean isUsingBatchUpdates() {
+ return usingBatchUpdates;
+ }
+
+ /**
+ * @param usingBatchUpdates The usingBatchUpdates to set.
+ */
+ public void setUsingBatchUpdates(boolean usingBatchUpdates) {
+ this.usingBatchUpdates = usingBatchUpdates;
+ }
+
+ /**
+ * @return Returns the savedMsgSqlMap.
+ */
+ public Map getSavedMsgSqlMap() {
+ return savedMsgSqlMap;
+ }
+
+ /**
+ * @param savedMsgSqlMap The savedMsgSqlMap to set.
+ */
+ public void setSavedMsgSqlMap(Map savedMsgSqlMap) {
+ this.savedMsgSqlMap = savedMsgSqlMap;
+ }
+
+ /**
+ * @return Returns the savedUserSqlMap.
+ */
+ public Map getSavedUserSqlMap() {
+ return savedUserSqlMap;
+ }
+
+ /**
+ * @param savedUserSqlMap The savedUserSqlMap to set.
+ */
+ public void setSavedUserSqlMap(Map savedUserSqlMap) {
+ this.savedUserSqlMap = savedUserSqlMap;
+ }
+
+ /*
+ * ********************* Other Methods *****************************
+ */
+
+ /**
+ * Gets the dataSources entry with the specified key/name.
+ *
+ * @param key
+ * The key/name for the desired data source.
+ * @return Returns the data source with the specified key, or null if
+ * there's no data source for the given key or the key is null.
+ */
+ public Object getDataSourcesEntry(String key) {
+ Object result = null;
+ if (key != null)
+ result = dataSources.get(key);
+ return result;
+ }
+
+ /**
+ * Builds a dataSourceOptions list from the dataSources map. The list
+ * contains the names of all available dataSources and is used by the jsp to
+ * implement a dropdown list.
+ *
+ * @return A list of data source names.
+ */
+ public List getDataSourceOptions() {
+ String dsName;
+ ArrayList dsOptions = new ArrayList();
+ if (dataSources != null) {
+ Set keySet = dataSources.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ dsName = (String) iter.next();
+ dsOptions.add(dsName);
+ }
+ }
+ return dsOptions;
+ }
+
+ /**
+ * Gets the msgSqlMap entry with the specified key.
+ *
+ * @param key
+ * The key of a map entry.
+ * @return Returns the map entry with the specified key.
+ */
+ public Object getMsgSqlEntry(String key) {
+ return msgSqlMap.get(key);
+ }
+
+ /**
+ * Sets the MsgSqlMap entry with the specified key to the specified value.
+ *
+ * @param key
+ * The key of a map entry.
+ * @param value
+ * The value to be set.
+ */
+ public void setMsgSqlEntry(String key, Object value) {
+ msgSqlMap.put(key, value);
+ }
+
+ /**
+ * Gets the userSqlMap entry with the specified key.
+ *
+ * @param key
+ * The key of a map entry.
+ * @return Returns the map entry with the specified key.
+ */
+ public Object getUserSqlEntry(String key) {
+ return userSqlMap.get(key);
+ }
+
+ /**
+ * Sets the userSqlMap entry with the specified key to the specified value.
+ *
+ * @param key
+ * The key of a map entry.
+ * @param value
+ * The value to be set.
+ */
+ public void setUserSqlEntry(String key, Object value) {
+ userSqlMap.put(key, value);
+ }
+
+ /**
+ * Clears the msgSqlMap.
+ */
+ public void clearMsgSqlMap() {
+ this.msgSqlMap.clear();
+ }
+
+ /**
+ * Clears the userSqlMap.
+ */
+ public void clearUserSqlMap() {
+ this.userSqlMap.clear();
+ }
+
+ /**
+ * Saves a copy of msgSqlMap into savedMsgSqlMap.
+ */
+ public void saveMsgSqlMap() {
+ this.savedMsgSqlMap.clear();
+ this.savedMsgSqlMap.putAll(this.msgSqlMap);
+ }
+
+ /**
+ * Saves a copy of userSqlMap into savedUserSqlMap.
+ */
+ public void saveUserSqlMap() {
+ this.savedUserSqlMap.clear();
+ this.savedUserSqlMap.putAll(this.userSqlMap);
+ }
+
+ /**
+ * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("JmsForm.reset() called");
+ }
+ createMsgTablesOnStartup = false;
+ createUserTablesOnStartup = false;
+ usingBatchUpdates = false;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ListDestinationsAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ListDestinationsAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ListDestinationsAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+
+/**
+ * The ListDestinationsAction type prepares the collection of destinations for
+ * display to the user.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @version $Revision: 56034 $
+ */
+public class ListDestinationsAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(ListDestinationsAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+ ActionForward result = null;
+
+ /*
+ * Is this destination a topic or queue?
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ String type = identifierForm.getType();
+
+ /*
+ * Determine if topics or queues were requested, and obtain the
+ * appropriate text to display.
+ */
+ ActionMessage pageHeader = null;
+ List destinations = null;
+ if (Constants.DestinationTypes.QUEUE.equals(type)) {
+ destinations = getDestinationService().getQueues();
+ if (destinations.isEmpty()) {
+ pageHeader = new ActionMessage(
+ "destination.list.destinations.queue.empty.header");
+ } else {
+ pageHeader = new ActionMessage(
+ "destination.list.destinations.queue.header");
+ }
+ } else if (Constants.DestinationTypes.TOPIC.equals(type)) {
+ destinations = getDestinationService().getTopics();
+ if (destinations.isEmpty()) {
+ pageHeader = new ActionMessage(
+ "destination.list.destinations.topic.empty.header");
+ } else {
+ pageHeader = new ActionMessage(
+ "destination.list.destinations.topic.header");
+ }
+ } else {
+ result = mapping.findForward("error");
+ }
+
+ if (result == null) {
+
+ /*
+ * Add the list of destinations to the request object for retrieval
+ * in the jsp
+ */
+ request.setAttribute("destinations", destinations);
+ request.setAttribute("identifierForm", identifierForm);
+
+ /*
+ * Add the page header text to the messages to display
+ */
+ if (logger.isDebugEnabled()) {
+ logger.debug("pageHeader=" + pageHeader);
+ }
+ ActionMessages messages = getActionMessages(request);
+ messages.add(ActionMessages.GLOBAL_MESSAGE, pageHeader);
+ saveMessages(request, messages);
+
+ /*
+ * Display the list of destinations
+ */
+ result = mapping.findForward("showpage");
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("<== perform(): " + result);
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveDestinationAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveDestinationAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveDestinationAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.service.jms.JmsServiceException;
+
+/**
+ * The RemoveDestinationAction type ...
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class RemoveDestinationAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(RemoveDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+
+ /*
+ * Call on the destination service to remove the designated destination:
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ String identifier = identifierForm.getIdentifier();
+ if (logger.isInfoEnabled()) {
+ logger.info(" removing destination: " + identifier);
+ }
+
+ /*
+ * Let the user know if the destination was removed successfully:
+ */
+ ActionMessages messages = getActionMessages(request);
+ ActionMessage message = null;
+
+ try {
+ getDestinationService().removeDestination(
+ new DestinationIdentifier(identifier));
+ message = new ActionMessage("destination.remove.success",
+ identifierForm.getType());
+ } catch (JmsServiceException e) {
+ logger.error("***", e);
+ message = new ActionMessage("destination.remove.failure",
+ identifierForm.getType());
+ }
+
+ if (logger.isInfoEnabled()) {
+ logger.info(" message: " + message);
+ }
+ messages.add(ActionMessages.GLOBAL_MESSAGE, message);
+ saveMessages(request, messages);
+
+ ActionForward returnActionForward = mapping
+ .findForward(Constants.Struts.GLOBAL_FORWARD_PREFIX
+ + identifierForm.getType());
+ if (logger.isDebugEnabled()) {
+ logger.debug("<== perform()");
+ }
+ return returnActionForward;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveMessagesAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveMessagesAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/RemoveMessagesAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * Removes All Messages
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class RemoveMessagesAction extends BaseDestinationAction {
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ DestinationIdentifier identifier = new DestinationIdentifier(
+ identifierForm.getIdentifier());
+ String type = identifierForm.getType();
+
+ /*
+ * Remove the messages:
+ */
+ getDestinationService().removeMessages(identifier);
+
+ /*
+ * Build the message that lets the user know the destination messages
+ * were removed:
+ */
+ ActionMessages messages = getActionMessages(request);
+ ActionMessage message = new ActionMessage(
+ "destination.msg.removeMessage.success");
+ messages.add(ActionMessages.GLOBAL_MESSAGE, message);
+ saveMessages(request, messages);
+
+ /*
+ * For queue, call method to update the destination message list. For
+ * topic, since we don't have the subscription id, just set it to null.
+ */
+ List destMessages = null;
+
+ if (Constants.DestinationTypes.QUEUE.equals(type)) {
+ destMessages = getDestinationService().getQueueMessages(identifier);
+ }
+
+ request.getSession().setAttribute("destinationMessages", destMessages);
+
+ return mapping.findForward("showpage");
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveDestinationAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveDestinationAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveDestinationAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+import org.jboss.admin.service.jms.JmsServiceException;
+
+/**
+ * The SaveDestinationAction type ...
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class SaveDestinationAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(SaveDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+ ActionForward result = null;
+ DestinationForm destinationForm = (DestinationForm) form;
+ String dispatch = request.getParameter("dispatch");
+ if (logger.isDebugEnabled()) {
+ logger.debug(" dispatch=" + dispatch);
+ logger.debug(" destinationProp="
+ + request.getParameter("destinationProp"));
+ }
+
+ /*
+ * Check if the user hit the cancel button or must move between tabs
+ */
+ if ("navigation".equals(dispatch)) {
+ /*
+ * forward to the appropriate tab:
+ */
+ result = mapping.findForward(request
+ .getParameter("destinationProp"));
+ } else if ("cancel".equals(dispatch)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("destination type=" + destinationForm.getType());
+ }
+ result = mapping.findForward(Constants.Struts.GLOBAL_FORWARD_PREFIX
+ + destinationForm.getType());
+ } else {
+ /*
+ * Call on the service to save the destination:
+ */
+ Destination destination = populateDestination(destinationForm);
+ if (logger.isInfoEnabled()) {
+ logger.debug(" destinationForm: " + destinationForm);
+ logger.debug(" saving destination: " + destination);
+ }
+
+ /*
+ * Determin if the destination is being created or updated
+ */
+ boolean isDestinationBeingCreated = ((destination.getIdentifier() == null));
+
+ /*
+ * Build the message that lets the user know if the destination was
+ * created or saved successfully:
+ */
+ ActionMessages messages = getActionMessages(request);
+ ActionMessage message = null;
+
+ try {
+ getDestinationService().saveDestination(destination);
+ if (isDestinationBeingCreated) {
+ message = new ActionMessage("destination.create.success");
+ } else {
+ message = new ActionMessage("destination.update.success");
+ }
+ } catch (JmsServiceException e) {
+ logger.error("***", e);
+
+ if (isDestinationBeingCreated) {
+ message = new ActionMessage("destination.create.failure");
+ } else {
+ message = new ActionMessage("destination.update.failure");
+ }
+ }
+
+ if (logger.isInfoEnabled()) {
+ logger.debug(" message: " + message);
+ }
+ messages.add(ActionMessages.GLOBAL_MESSAGE, message);
+ saveMessages(request, messages);
+
+ result = mapping.findForward(Constants.Struts.GLOBAL_FORWARD_PREFIX
+ + destinationForm.getType());
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("<== perform(): " + result);
+ }
+ return result;
+ }
+
+ /**
+ * Converts the destination form object into a destination value object.
+ *
+ * @param form
+ * The form object containing the user's input data.
+ * @return A Destination object with the same data as the form object.
+ * @throws Exception
+ * An error occurred
+ */
+ private Destination populateDestination(DestinationForm form)
+ throws Exception {
+ Destination result = null;
+ String type = form.getType();
+ if (type.equals(Constants.DestinationTypes.QUEUE)) {
+ result = new Queue();
+ } else if (type.equals(Constants.DestinationTypes.TOPIC)) {
+ result = new Topic();
+ }
+ BeanUtils.copyProperties(result, form);
+
+ return result;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveJmsAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveJmsAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/SaveJmsAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,630 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.jboss.admin.AdminConstants;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.service.jms.JmsServiceException;
+
+/**
+ * The SaveJmsAction type saves the jms attribute settings
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class SaveJmsAction extends BaseJmsAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory.getLog(SaveJmsAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+ ActionForward result = null;
+ JmsForm jmsForm = (JmsForm) form;
+ String dispatch = request.getParameter("dispatch");
+ if (logger.isDebugEnabled()) {
+ logger.debug(" dispatch=" + dispatch);
+ }
+
+ /*
+ * Check if the user hits the tab or cancel button:
+ */
+ if ("navigation".equals(dispatch)) {
+ /*
+ * Save and reload SQL properties if dataSource changed:
+ */
+ if ((jmsForm.getMsgDataSourceName() != null)
+ && (jmsForm.getSavedMsgDataSourceName() != null)
+ && (jmsForm.getUserDataSourceName() != null)
+ && (jmsForm.getSavedUserDataSourceName() != null)) {
+ if ((!jmsForm.getMsgDataSourceName().equals(
+ jmsForm.getSavedMsgDataSourceName()))
+ || (!jmsForm.getUserDataSourceName().equals(
+ jmsForm.getSavedUserDataSourceName())))
+ SaveAndReloadSqlProperties(jmsForm);
+ }
+
+ /*
+ * Forward to the appropriate tab:
+ */
+ result = mapping.findForward(request.getParameter("destination"));
+ } else if ("cancel".equals(dispatch)) {
+ /*
+ * Get the current JMS attributes:
+ */
+ Jms jms = getJmsService().getJmsAttributes();
+ BeanUtils.copyProperties(jmsForm, jms);
+ buildMsgSqlMap(jmsForm);
+ buildUserSqlMap(jmsForm);
+ jmsForm.setSavedMsgDataSourceName(jmsForm.getMsgDataSourceName());
+ jmsForm.setSavedUserDataSourceName(jmsForm.getUserDataSourceName());
+ jmsForm.saveMsgSqlMap();
+ jmsForm.saveUserSqlMap();
+ request.getSession().setAttribute("jms", jmsForm);
+ result = mapping.findForward("page1");
+ } else {
+ /*
+ * Save and reload SQL properties, if needed:
+ */
+ SaveAndReloadSqlProperties(jmsForm);
+
+ /*
+ * Converts the jms form object into a jms value object:
+ */
+ Jms jms = populateJms(jmsForm);
+
+ /*
+ * Build the message that lets the user know if the attributes were
+ * saved successfully:
+ */
+ ActionMessages messages = getActionMessages(request);
+ ActionMessage message = null;
+
+ try {
+ /*
+ * Call on the service to save the JMS attributes:
+ */
+ getJmsService().saveJmsAttributes(jms);
+ message = new ActionMessage("jms.update.success");
+ } catch (JmsServiceException e) {
+ logger.error("***", e);
+ message = new ActionMessage("jms.update.failure");
+ }
+
+ messages.add(ActionMessages.GLOBAL_MESSAGE, message);
+ saveMessages(request, messages);
+
+ result = mapping.findForward("page1");
+ }
+
+ return result;
+ }
+
+ /**
+ * Converts the jms form object into a jms value object.
+ *
+ * @param jmsform
+ * The form object containing the user's input data.
+ * @return A Jms object with the same data as the form object.
+ * @throws Exception
+ * An error occurred
+ */
+ private Jms populateJms(JmsForm jmsForm) throws Exception {
+ /*
+ * Concatenates the individual sql properties into a string:
+ */
+ jmsForm
+ .setMsgSqlProperties(concatSqlProperties(jmsForm.getMsgSqlMap()));
+ jmsForm.setUserSqlProperties(concatSqlProperties(jmsForm
+ .getUserSqlMap()));
+
+ /*
+ * Copy the jms properties from the form object to the value object:
+ */
+ Jms jms = new Jms();
+ BeanUtils.copyProperties(jms, jmsForm);
+
+ return jms;
+ }
+
+ /**
+ * Concatenates the individual sql properties stored in a map into a string.
+ *
+ * @param sqlMap
+ * The map containing the sql properties.
+ * @return A concatenated sql string.
+ */
+ private String concatSqlProperties(Map sqlMap) {
+ StringBuffer result = new StringBuffer(500);
+ String sqlKey;
+ String sqlValue;
+ String SEPARATOR = AdminConstants.LINE_SEPARATOR;
+ int inx = 0;
+
+ Set keySet = sqlMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ sqlKey = (String) iter.next();
+ sqlValue = (String) sqlMap.get(sqlKey);
+ sqlValue = sqlValue.replaceAll("=", "\\\\="); // Replace "=" by
+ // "\\="
+ result.append(sqlKey).append("=").append(sqlValue);
+ if (inx < keySet.size() - 1) {
+ result.append(SEPARATOR);
+ inx = inx + 1;
+ }
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Reload SQL properties if a different type of persistence database is
+ * selected. The previous SQL properties will be saved into the
+ * persistenceSql.properties file if any changes were made.
+ *
+ * @param jmsForm
+ * The jms form object containing all the jms attributes.
+ */
+ private void SaveAndReloadSqlProperties(JmsForm jmsForm) {
+ boolean error = false;
+ boolean saveMsgSql = false;
+ boolean saveUserSql = false;
+ boolean loadMsgSqlFromFile = false;
+ boolean loadUserSqlFromFile = false;
+ boolean updatePropFile = false;
+
+ /*
+ * Check if the current sql statements need to be saved:
+ */
+ if (!jmsForm.getMsgSqlMap().equals(jmsForm.getSavedMsgSqlMap()))
+ saveMsgSql = true;
+
+ if (!jmsForm.getUserSqlMap().equals(jmsForm.getSavedUserSqlMap()))
+ saveUserSql = true;
+
+ if (saveMsgSql || saveUserSql)
+ updatePropFile = true;
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("saveMsgSql = " + saveMsgSql);
+ logger.debug("saveUserSql = " + saveUserSql);
+ logger.debug("updatePropFile = " + updatePropFile);
+ }
+
+ /*
+ * Check if new sql statements must be loaded from the properties file:
+ */
+ String newMsgDataSource = jmsForm.getMsgDataSourceName();
+ String prevMsgDataSource = jmsForm.getSavedMsgDataSourceName();
+ String newMsgDriverClass = (String) jmsForm
+ .getDataSourcesEntry(newMsgDataSource);
+ String prevMsgDriverClass = (String) jmsForm
+ .getDataSourcesEntry(prevMsgDataSource);
+ if (logger.isDebugEnabled()) {
+ logger.debug("newMsgDataSource = " + newMsgDataSource);
+ logger.debug("prevMsgDataSource = " + prevMsgDataSource);
+ logger.debug("newMsgDriverClass = " + newMsgDriverClass);
+ logger.debug("prevMsgDriverClass = " + prevMsgDriverClass);
+ }
+
+ String newUserDataSource = jmsForm.getUserDataSourceName();
+ String prevUserDataSource = jmsForm.getSavedUserDataSourceName();
+ String newUserDriverClass = (String) jmsForm
+ .getDataSourcesEntry(newUserDataSource);
+ String prevUserDriverClass = (String) jmsForm
+ .getDataSourcesEntry(prevUserDataSource);
+ if (logger.isDebugEnabled()) {
+ logger.debug("newUserDataSource = " + newUserDataSource);
+ logger.debug("prevUserDataSource = " + prevUserDataSource);
+ logger.debug("newUserDriverClass = " + newUserDriverClass);
+ logger.debug("prevUserDriverClass = " + prevUserDriverClass);
+ }
+
+ if ((newMsgDataSource != null) && (newMsgDriverClass != null)) {
+ if (!newMsgDataSource.equals(prevMsgDataSource)
+ && !newMsgDriverClass.equals(prevMsgDriverClass)) {
+ /*
+ * Database type changed. Setup flag:
+ */
+ loadMsgSqlFromFile = true;
+ }
+ }
+
+ if ((newUserDataSource != null) && (newUserDriverClass != null)) {
+ if (!newUserDataSource.equals(prevUserDataSource)
+ && !newUserDriverClass.equals(prevUserDriverClass)) {
+ /*
+ * Database type changed. Setup flag:
+ */
+ loadUserSqlFromFile = true;
+ }
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("loadMsgSqlFromFile = " + loadMsgSqlFromFile);
+ logger.debug("loadUserSqlFromFile = " + loadUserSqlFromFile);
+ }
+
+ if (updatePropFile || loadMsgSqlFromFile || loadUserSqlFromFile) {
+ final String DEFAULT_DB = "default";
+ final String MSG_NODE = ".msg.";
+ final String USER_NODE = ".user.";
+ final String MSG_PERSIST = "message";
+ final String USER_PERSIST = "user";
+
+ File inFile = null;
+ File outFile = null;
+ BufferedReader br = null;
+ PrintWriter pw = null;
+ String line = "";
+ String newMsgDbType = DEFAULT_DB;
+ String newUserDbType = DEFAULT_DB;
+ String prevMsgDbType = "";
+ String prevUserDbType = "";
+ String sqlKey = "";
+ String sqlValue = "";
+ String savedValue = "";
+ boolean newMsgSqlLoaded = false;
+ boolean newUserSqlLoaded = false;
+ boolean prevMsgSqlFound = false;
+ boolean prevUserSqlFound = false;
+ Map tempMsgSqlMap = new HashMap();
+ Map tempUserSqlMap = new HashMap();
+ Map defMsgSqlMap = new HashMap();
+ Map defUserSqlMap = new HashMap();
+
+ /*
+ * Open the persistenceSql.properties file located under
+ * <JBoss-server-dir>/data/jms/ directory:
+ */
+ Properties sysProps = System.getProperties();
+ String dataDir = sysProps.getProperty("jboss.server.data.dir");
+ String propFilePath = dataDir + File.separatorChar + "jms";
+ String inFileName = propFilePath + File.separatorChar
+ + "persistenceSql.properties";
+ String outFileName = propFilePath + File.separatorChar
+ + "temp.properties";
+
+ /*
+ * Open an input stream:
+ */
+ try {
+ inFile = new File(inFileName);
+ br = new BufferedReader(new FileReader(inFile));
+ } catch (FileNotFoundException e) {
+ /*
+ * The persistenceSql.properties file doesn't exist on the path.
+ * Load it from the .war file:
+ */
+ InputStream inStream = this.getClass().getClassLoader()
+ .getResourceAsStream(
+ "WEB-INF/conf/jms/persistenceSql.properties");
+ br = new BufferedReader(new InputStreamReader(inStream));
+ updatePropFile = true;
+ }
+
+ /*
+ * Open an output stream if update is needed:
+ */
+ if (updatePropFile) {
+ try {
+ outFile = new File(outFileName);
+ pw = new PrintWriter(new BufferedWriter(new FileWriter(
+ outFile)));
+ } catch (IOException e) {
+ File outDir = new File(propFilePath);
+ if (!outDir.exists()) {
+ outDir.mkdirs();
+ }
+ try {
+ outFile = new File(outFileName);
+ pw = new PrintWriter(new BufferedWriter(new FileWriter(
+ outFile)));
+ } catch (IOException e1) {
+ if (logger.isDebugEnabled())
+ logger
+ .debug("I/O error accessing temp.properties file:"
+ + outFileName);
+ updatePropFile = false;
+ }
+ }
+ }
+
+ /*
+ * If update is needed, save a temporary copy of the map(s). This is
+ * necessary because the maps may be altered if new sql statements
+ * are loaded first:
+ */
+ if (saveMsgSql)
+ tempMsgSqlMap.putAll(jmsForm.getMsgSqlMap());
+
+ if (saveUserSql)
+ tempUserSqlMap.putAll(jmsForm.getUserSqlMap());
+
+ /*
+ * Clear the maps before loading the new properties from file:
+ */
+ if (loadMsgSqlFromFile)
+ jmsForm.clearMsgSqlMap();
+
+ if (loadUserSqlFromFile)
+ jmsForm.clearUserSqlMap();
+
+ try {
+ while ((!error && (line = br.readLine()) != null)) {
+ if (line.startsWith(newMsgDriverClass)) {
+ newMsgDbType = line.substring(line.indexOf("=") + 1)
+ .trim();
+ if (logger.isDebugEnabled())
+ logger.debug("newMsgDbType = " + newMsgDbType);
+ } else if (line.startsWith(newUserDriverClass)) {
+ newUserDbType = line.substring(line.indexOf("=") + 1)
+ .trim();
+ if (logger.isDebugEnabled())
+ logger.debug("newUserDbType = " + newUserDbType);
+ } else if (line.startsWith(prevMsgDriverClass)) {
+ prevMsgDbType = line.substring(line.indexOf("=") + 1)
+ .trim();
+ if (logger.isDebugEnabled())
+ logger.debug("prevMsgDbType = " + prevMsgDbType);
+ } else if (line.startsWith(prevUserDriverClass)) {
+ prevUserDbType = line.substring(line.indexOf("=") + 1)
+ .trim();
+ if (logger.isDebugEnabled())
+ logger.debug("prevUserDbType = " + prevUserDbType);
+ } else if (loadMsgSqlFromFile
+ && line.startsWith(newMsgDbType + MSG_NODE)) {
+ /*
+ * Load the new msg sql properties:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ jmsForm.setMsgSqlEntry(sqlKey, sqlValue);
+ newMsgSqlLoaded = true;
+ } else if (loadUserSqlFromFile
+ && line.startsWith(newUserDbType + USER_NODE)) {
+ /*
+ * Load the new user sql properties:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ jmsForm.setUserSqlEntry(sqlKey, sqlValue);
+ newUserSqlLoaded = true;
+ } else if (saveMsgSql
+ && line.startsWith(prevUserDbType + MSG_NODE)) {
+ /*
+ * Save the previous msg sql properties, if changed:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ savedValue = (String) tempMsgSqlMap.get(sqlKey);
+ if (!sqlValue.equals(savedValue)) {
+ line = line.substring(0, line.indexOf("=") + 1);
+ line = line + " " + savedValue;
+ }
+ prevMsgSqlFound = true;
+ } else if (saveUserSql
+ && line.startsWith(prevUserDbType + USER_NODE)) {
+ /*
+ * Save the previous user sql properties, if changed:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ savedValue = (String) tempUserSqlMap.get(sqlKey);
+ if (!sqlValue.equals(savedValue)) {
+ line = line.substring(0, line.indexOf("=") + 1);
+ line = line + " " + savedValue;
+ }
+ prevUserSqlFound = true;
+ } else if (line.startsWith(DEFAULT_DB + MSG_NODE)) {
+ /*
+ * Store the default msg sql properties in a map:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ defMsgSqlMap.put(sqlKey, sqlValue);
+ } else if (line.startsWith(DEFAULT_DB + USER_NODE)) {
+ /*
+ * Store the default user sql properties in a map:
+ */
+ sqlKey = getKey(line);
+ sqlValue = line.substring(line.indexOf("=") + 1).trim();
+ defUserSqlMap.put(sqlKey, sqlValue);
+ }
+
+ if (updatePropFile)
+ pw.println(line);
+ }
+
+ /*
+ * Done with the input stream:
+ */
+ br.close();
+
+ /*
+ * If the sql properties for the new database type do not exist
+ * in the properties file, load the default properties:
+ */
+ if (loadMsgSqlFromFile && !newMsgSqlLoaded) {
+ if (logger.isDebugEnabled())
+ logger.debug("Loading default message sql properties");
+ Set keySet = defMsgSqlMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ sqlKey = (String) iter.next();
+ sqlValue = (String) defMsgSqlMap.get(sqlKey);
+ jmsForm.setMsgSqlEntry(sqlKey, sqlValue);
+ }
+ }
+
+ if (loadUserSqlFromFile && !newUserSqlLoaded) {
+ if (logger.isDebugEnabled())
+ logger.debug("Loading default user sql properties");
+ Set keySet = defUserSqlMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ sqlKey = (String) iter.next();
+ sqlValue = (String) defUserSqlMap.get(sqlKey);
+ jmsForm.setUserSqlEntry(sqlKey, sqlValue);
+ }
+ }
+
+ /*
+ * If the sql properties of the previous database type do not
+ * exist in the properties file, save them as indicated:
+ */
+ if (saveMsgSql && !prevMsgSqlFound && prevMsgDbType != "") {
+ if (logger.isDebugEnabled())
+ logger.debug("Saving message sql properties for: "
+ + prevMsgDbType);
+ printHeading(pw, prevMsgDbType, MSG_PERSIST);
+ Set keySet = tempMsgSqlMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ sqlKey = (String) iter.next();
+ sqlValue = (String) tempMsgSqlMap.get(sqlKey);
+ line = prevMsgDbType + MSG_NODE + sqlKey + " = "
+ + sqlValue;
+ pw.println(line);
+ }
+ }
+
+ if (saveUserSql && !prevUserSqlFound && prevUserDbType != "") {
+ if (logger.isDebugEnabled())
+ logger.debug("Saving user sql properties for: "
+ + prevUserDbType);
+ printHeading(pw, prevUserDbType, USER_PERSIST);
+ Set keySet = tempUserSqlMap.keySet();
+ Iterator iter = keySet.iterator();
+ while (iter.hasNext()) {
+ sqlKey = (String) iter.next();
+ sqlValue = (String) tempUserSqlMap.get(sqlKey);
+ line = prevUserDbType + USER_NODE + sqlKey + " = "
+ + sqlValue;
+ pw.println(line);
+ }
+ }
+
+ /*
+ * Update the properties file is needed:
+ */
+ if (updatePropFile) {
+ pw.close();
+ inFile.delete();
+ outFile.renameTo(inFile);
+ }
+
+ /*
+ * Update the saved copy of the data source names and the sql maps:
+ */
+ jmsForm.setSavedMsgDataSourceName(jmsForm.getMsgDataSourceName());
+ jmsForm.setSavedUserDataSourceName(jmsForm.getUserDataSourceName());
+ jmsForm.saveMsgSqlMap();
+ jmsForm.saveUserSqlMap();
+
+ } catch (IOException e) {
+ error = true;
+ if (logger.isDebugEnabled())
+ logger
+ .debug("I/O error accessing persistenceSql.properties file:"
+ + inFileName);
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Returns the key portion of the sql property entry as stored in the
+ * persistenceSql.properties file. For example, if the entry looks like:
+ * hsqldb.msg.BLOB_TYPE = OBJECT_BLOB, the key will be BLOB_TYPE.
+ *
+ * @param line
+ * The sql property entry read from the file
+ * @return The key
+ */
+ private String getKey(String line) {
+ String key = line.trim().substring(0, line.indexOf("="));
+ key = key.substring(key.lastIndexOf(".") + 1);
+ return key.trim();
+ }
+
+ /**
+ * Write a header into the persistenceSql.properties file for the specified
+ * database type and persistent type.
+ *
+ * @param pw
+ * The output stream to write to.
+ * @param dbType
+ * The database type.
+ * @param persistType
+ * The persistence type, may be "msg" or "state".
+ */
+ private void printHeading(PrintWriter pw, String dbType, String persistType) {
+ pw.println("");
+ pw
+ .println("##########################################################");
+ String line = "# " + dbType + " SQL properties for " + persistType
+ + " persistence";
+ pw.println(line);
+ pw
+ .println("##########################################################");
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewDestinationAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewDestinationAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewDestinationAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * The ViewDestinationAction type ...
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewDestinationAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(ViewDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+
+ /*
+ * Call on the destination service to get the designated destination:
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ String name = identifierForm.getName();
+ String type = identifierForm.getType();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(" destination type: " + type);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(" destination name: " + name);
+ }
+
+ DestinationIdentifier identifier = new DestinationIdentifier(
+ identifierForm.getIdentifier());
+ Destination dest = getDestinationService().getDestination(identifier);
+ if (logger.isInfoEnabled()) {
+ logger.debug(" destination: " + dest);
+ }
+
+ /*
+ * Copy the destination properties from the value object to the form
+ * object:
+ */
+ DestinationForm destinationForm = new DestinationForm();
+ BeanUtils.copyProperties(destinationForm, dest);
+ destinationForm.setType(identifierForm.getType());
+ if (logger.isDebugEnabled()) {
+ logger.debug(" destination: " + destinationForm);
+ }
+ request.getSession().setAttribute("destination", destinationForm);
+
+ ActionForward result = mapping.findForward("showpage");
+ if (logger.isDebugEnabled()) {
+ logger.debug("<== perform(): " + result);
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewJmsAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewJmsAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewJmsAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.jboss.admin.model.jms.Jms;
+
+/**
+ * The ViewDestinationAction type ...
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewJmsAction extends BaseJmsAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(ViewDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("==> perform()");
+ }
+
+ /*
+ * Call on the jms service to get the JMS attributes:
+ */
+
+ Jms jms = getJmsService().getJmsAttributes();
+
+ /*
+ * Copy the jms properties from the value object to the form object:
+ */
+ JmsForm jmsForm = (JmsForm) form;
+ BeanUtils.copyProperties(jmsForm, jms);
+
+ /*
+ * Break the sql properties into individual sql statements and store
+ * them into the corresponding map:
+ */
+ buildMsgSqlMap(jmsForm);
+ buildUserSqlMap(jmsForm);
+
+ /*
+ * Save a copy of the data source names and the sql maps:
+ */
+ jmsForm.setSavedMsgDataSourceName(jmsForm.getMsgDataSourceName());
+ jmsForm.setSavedUserDataSourceName(jmsForm.getUserDataSourceName());
+ jmsForm.saveMsgSqlMap();
+ jmsForm.saveUserSqlMap();
+
+ request.getSession().setAttribute("jms", jmsForm);
+
+ ActionForward result = mapping.findForward("showpage");
+
+ return result;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewMessagesAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewMessagesAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewMessagesAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * The ViewMessagesAction type ...
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewMessagesAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(ViewDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+ List messages = null;
+
+ /*
+ * Call on the service to get the messages:
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ DestinationIdentifier identifier = new DestinationIdentifier(
+ identifierForm.getIdentifier());
+ String type = identifierForm.getType();
+
+ if (Constants.DestinationTypes.QUEUE.equals(type)) {
+ messages = getDestinationService().getQueueMessages(identifier);
+ } else if (Constants.DestinationTypes.TOPIC.equals(type)) {
+ String subscriptionID = request.getParameter("subscriptionID");
+ messages = getDestinationService().getTopicMessages(identifier,
+ subscriptionID);
+ }
+
+ request.getSession().setAttribute("destinationMessages", messages);
+
+ return mapping.findForward("showpage");
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewSubscriptionsAction.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewSubscriptionsAction.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/console/web/struts/jms/ViewSubscriptionsAction.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.console.web.struts.jms;
+
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * The ViewSubscriptionsAction type ...
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewSubscriptionsAction extends BaseDestinationAction {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(ViewDestinationAction.class);
+
+ /**
+ * @see org.jboss.admin.console.web.struts.BaseAction#perform(org.apache.struts.action.ActionMapping,
+ * org.apache.struts.action.ActionForm,
+ * javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ public ActionForward perform(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
+
+ /*
+ * Call on the service to get the subscriptions:
+ */
+ DestinationIdentifierForm identifierForm = (DestinationIdentifierForm) form;
+ DestinationIdentifier identifier = new DestinationIdentifier(
+ identifierForm.getIdentifier());
+ List durableSubscriptions = getDestinationService()
+ .getDurableSubscriptions(identifier);
+ List nonDurableSubscriptions = getDestinationService()
+ .getNonDurableSubscriptions(identifier);
+ request.getSession().setAttribute("durableSubscriptions",
+ durableSubscriptions);
+ request.getSession().setAttribute("nonDurableSubscriptions",
+ nonDurableSubscriptions);
+
+ return mapping.findForward("showpage");
+ }
+
+}
+
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Destination.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Destination.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Destination.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,325 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.jboss.admin.service.jms.Error;
+import org.jboss.admin.service.jms.JmsServiceRuntimeException;
+import org.w3c.dom.Element;
+
+/**
+ * The Destination type holds the information related to a single destination.
+ * Clients should never create an instance of this class. It is marked as
+ * non-abstact only to support certain functions required within the JSPs.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public/* abstract */class Destination implements Serializable {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Destination identifier
+ */
+ private DestinationIdentifier identifier;
+
+ /**
+ * The current state of this destination
+ */
+ private DestinationState state;
+
+ /*
+ * Common attributes of a destination for both Queue and Topic types
+ */
+
+ /**
+ * The name of this destination
+ */
+ private String name;
+
+ /**
+ * The JNDI name
+ */
+ private String jndiName;
+
+ /**
+ * True if this destination was created programmatically
+ */
+ private boolean createdProgrammatically;
+
+ /**
+ * The write-cache size
+ */
+ private int downCacheSize;
+
+ /**
+ * The in-memory message limit
+ */
+ private int fullSize;
+
+ /**
+ * The paging size
+ */
+ private int pageSize;
+
+ /**
+ * Security configuration
+ */
+ private Element securityConfig;
+
+ /**
+ * Security roles, a string representation of the securityConfig
+ */
+ private String securityRoles;
+
+ /**
+ * The name of the server peer this destination was deployed on
+ */
+ private String serverPeerName;
+
+ /**
+ * Constructor
+ */
+ public Destination() {
+ }
+
+ public Destination(DestinationIdentifier id) {
+ identifier = id;
+ }
+
+ /**
+ * Get a destination of a specified type.
+ *
+ * @param type
+ * of destination
+ * @return Returns a destination of either Queue or Topic type.
+ */
+ public static Destination getDestination(String type) {
+ if (Queue.class.getName().equals(type)) {
+ return new Queue();
+ } else if (Topic.class.getName().equals(type)) {
+ return new Topic();
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.INVALID_DESTINATION_TYPE, new String[] { type }));
+ }
+ }
+
+ /**
+ * @return Returns the identifier.
+ */
+ public DestinationIdentifier getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * @param identifier
+ * The identifier to set.
+ */
+ public void setIdentifier(DestinationIdentifier identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * @return Returns the state.
+ */
+ public DestinationState getState() {
+ return state;
+ }
+
+ /**
+ * @param state
+ * The state to set.
+ */
+ public void setState(DestinationState state) {
+ this.state = state;
+ }
+
+ /**
+ * @return Returns the jndiName.
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ /**
+ * @param jndiName
+ * The jndiName to set.
+ */
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Returns the createdProgrammatically.
+ */
+ public boolean isCreatedProgrammatically() {
+ return createdProgrammatically;
+ }
+
+ /**
+ * @param createdProgrammatically
+ * The createdProgrammatically to set.
+ */
+ public void setCreatedProgrammatically(boolean createdProgrammatically) {
+ this.createdProgrammatically = createdProgrammatically;
+ }
+
+ /**
+ * @return Returns the downCacheSize.
+ */
+ public int getDownCacheSize() {
+ return downCacheSize;
+ }
+
+ /**
+ * @param downCacheSize
+ * The downCacheSize to set.
+ */
+ public void setDownCacheSize(int downCacheSize) {
+ this.downCacheSize = downCacheSize;
+ }
+
+ /**
+ * @return Returns the fullSize.
+ */
+ public int getFullSize() {
+ return fullSize;
+ }
+
+ /**
+ * @param fullSize
+ * The fullSize to set.
+ */
+ public void setFullSize(int fullSize) {
+ this.fullSize = fullSize;
+ }
+
+ /**
+ * @return Returns the pageSize.
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @param pageSize
+ * The pageSize to set.
+ */
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ /**
+ * @return Returns the securityConfig.
+ */
+ public Element getSecurityConfig() {
+ return securityConfig;
+ }
+
+ /**
+ * @param securityConfig
+ * The securityConfig to set.
+ */
+ public void setSecurityConfig(Element securityConfig) {
+ this.securityConfig = securityConfig;
+ }
+
+ /**
+ * @return Returns the securityRoles.
+ */
+ public String getSecurityRoles() {
+ return securityRoles;
+ }
+
+ /**
+ * @param securityRoles
+ * The securityRoles to set.
+ */
+ public void setSecurityRoles(String securityRoles) {
+ this.securityRoles = securityRoles;
+ }
+
+ /**
+ * @return Returns the serverPeerName.
+ */
+ public String getServerPeerName() {
+ return serverPeerName;
+ }
+
+ /**
+ * @param serverPeerName
+ * The serverPeerName to set.
+ */
+ public void setServerPeerName(String serverPeerName) {
+ this.serverPeerName = serverPeerName;
+ }
+
+ /**
+ * Returns a string that can be used to identify the destination.
+ *
+ * @return A string identifying this destination
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ ToStringBuilder builder = new ToStringBuilder(this)
+ .append("name", name).append("jndiName", jndiName).append(
+ "createdProgrammatically", createdProgrammatically)
+ .append("downCacheSize", downCacheSize).append("fullSize",
+ fullSize).append("pageSize", pageSize).append(
+ "securityRoles", securityRoles);
+ append(builder);
+ return builder.toString();
+ }
+
+ /**
+ * Used by the subclasses to append more information to the toString
+ * results.
+ *
+ * @param builder
+ * The ToStringBuilder.
+ */
+ protected/* abstract */void append(ToStringBuilder builder) {
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationIdentifier.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationIdentifier.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationIdentifier.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.jboss.admin.service.jms.Error;
+import org.jboss.admin.service.jms.JmsServiceRuntimeException;
+
+/**
+ * The DestinationIdentifier type holds the inforation necessary to uniquely
+ * identify a destination.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationIdentifier implements Serializable {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * MBean name of the destination
+ */
+ private String MBeanName;
+
+ /**
+ * Module name of the destination
+ */
+ private String moduleName;
+
+ /**
+ * Constructor
+ */
+ public DestinationIdentifier() {
+ this("|");
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * The Id string of the destination.
+ */
+ public DestinationIdentifier(String id) {
+ if (id == null) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.IDENTIFIER_CTOR_ARG_IS_NULL, null));
+ }
+
+ int separatorPosition = id.indexOf("|");
+ if (separatorPosition < 0) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.IDENTIFIER_CTOR_ARG_MISSING_SEPARATOR, null));
+ }
+ setMBeanName(id.substring(0, separatorPosition));
+ setModuleName(id.substring(separatorPosition + 1));
+ }
+
+ /**
+ * Comparison operator
+ *
+ * @param obj
+ * The object to be compared with
+ * @return true if object compares equal, false otherwise
+ */
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * Returns the hash code of the destination identifier
+ *
+ * @return the hash code
+ */
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * Not for client use. Only public to enable use in service layer.
+ *
+ * @return name of the destination MBean
+ */
+ public String getMBeanName() {
+ return MBeanName;
+ }
+
+ /**
+ * Not for client use. Only public to enable use in service layer.
+ *
+ * @param beanName
+ * name of the destination MBean
+ */
+ public void setMBeanName(String beanName) {
+ MBeanName = beanName;
+ }
+
+ /**
+ * Not for client use. Only public to enable use in service layer.
+ *
+ * @return name of the destination module.
+ */
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ /**
+ * Not for client use. Only public to enable use in service layer.
+ *
+ * @param moduleName
+ * name of the destination module
+ */
+ public void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+
+ /**
+ * This implementation must be consistent for the constructor, since it is
+ * ineffect being used a serialize method on the web tier.
+ *
+ * @return A string that can be used to identify the destination.
+ */
+ public String toString() {
+ return MBeanName + "|" + moduleName;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationMessage.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationMessage.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationMessage.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import java.io.Serializable;
+
+import javax.jms.Message;
+
+/**
+ * The DestinationMessage type holds a message object, it's message type, and
+ * the message body.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationMessage implements Serializable {
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * A Message class to encapsulate the jms message
+ */
+ Message jmsMessage;
+
+ /**
+ * Stores the message type
+ */
+ String msgType;
+
+ /**
+ * Stores the message body in string type
+ */
+ String msgBody;
+
+ /**
+ * Constructor
+ */
+ public DestinationMessage(Message message) {
+ jmsMessage = message;
+ }
+
+ /**
+ * @return Returns the jmsMessage.
+ */
+ public Message getJmsMessage() {
+ return jmsMessage;
+ }
+
+ /**
+ * @param jmsMessage
+ * The jmsMessage to set.
+ */
+ public void setJmsMessage(Message jmsMessage) {
+ this.jmsMessage = jmsMessage;
+ }
+
+ /**
+ * @return Returns the msgType.
+ */
+ public String getMsgType() {
+ return msgType;
+ }
+
+ /**
+ * @param msgType
+ * The type of the message.
+ */
+ public void setMsgType(String msgType) {
+ this.msgType = msgType;
+ }
+
+ /**
+ * @return Returns the msgBody.
+ */
+ public String getMsgBody() {
+ return msgBody;
+ }
+
+ /**
+ * @param msgBody
+ * The msgBody to set.
+ */
+ public void setMsgBody(String msgBody) {
+ this.msgBody = msgBody;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationState.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationState.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/DestinationState.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import org.jboss.admin.model.State;
+import org.jboss.deployment.DeploymentState;
+
+/**
+ * Class which encapsulates information about the deployment state of
+ * destination module.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationState extends State {
+
+ public DestinationState(DeploymentState state, String status) {
+ super(state, status);
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Jms.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Jms.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Jms.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,650 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
+
+/**
+ * The Jms type holds the JBoss Messaging attributes obtained from various MBeans.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class Jms {
+
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory.getLog(Jms.class);
+
+ /*
+ * ********** Attributes from the ConnectionFactory MBean **********
+ */
+
+ /**
+ * The name of the remoting connector this destination will use
+ */
+ private String connectorName;
+
+ /**
+ * The default value of paging down cache size for any temporary queues
+ * created for connections from this connection factory
+ */
+ private int defaultTempQueueDownCacheSize;
+
+ /**
+ * The default value of paging full size for any temporary queues created
+ * for connections from this connection factory
+ */
+ private int defaultTempQueueFullSize;
+
+ /**
+ * The default value of paging page size for any temporary queues created
+ * for connections from this connection factory
+ */
+ private int defaultTempQueuePageSize;
+
+ /**
+ * The maximum number of messages that will be prefetched by the client side
+ * consumer
+ */
+ private int prefetchSize;
+
+ /**
+ * The name of the server peer this destination was deployed on
+ */
+ private String serverPeerName;
+
+ /*
+ * ********** Attributes from the ServerPeer MBean **********
+ */
+
+ /**
+ * The default JNDI context queues are bound under
+ */
+ private String defaultQueueJNDIContext;
+
+ /**
+ * The security config to use when the destination does not supply any
+ */
+ private Element defaultSecurityConfig;
+
+ /**
+ * The default security config in text form
+ */
+ private String defaultSecurityRoles;
+
+ /**
+ * The default JNDI context topics are bound under
+ */
+ private String defaultTopicJNDIContext;
+
+ /**
+ * The JMS provider name
+ */
+ private String jmsProviderName;
+
+ /**
+ * The version of the JMS specification implemented by this provider
+ */
+ private String jmsVersion;
+
+ /**
+ * The name of the persistence manager
+ */
+ private String persistenceManagerName;
+
+ /**
+ * The fully qualified provider version string
+ */
+ private String providerVersion;
+
+ /**
+ * The size of the rotating pool from which to allocate QueuedExecutors
+ */
+ private int queuedExecutorPoolSize;
+
+ /**
+ * The Security Domain to be used by the Server Peer
+ */
+ private String securityDomain;
+
+ /**
+ * The ID of the ServerPeer. Must be unique per JBoss instance
+ */
+ private String serverPeerID;
+
+ /*
+ * ********** Attributes from the PersistenceManager MBean **********
+ */
+
+ /**
+ * Should persistence database tables be created on startup?
+ */
+ private boolean createMsgTablesOnStartup;
+
+ /**
+ * The max number of params to be used in a generated Prepared Statement
+ */
+ private int maxParams;
+
+ /**
+ * The JNDI name of the DataSource used by the persistence manager
+ */
+ private String msgDataSource;
+
+ /**
+ * The name of the DataSource used by the persistence manager, without the JNDI prefix
+ */
+ private String msgDataSourceName;
+
+ /**
+ * The sql statements used to implement the persistence service.
+ */
+ private String msgSqlProperties;
+
+ /**
+ * The name of the TransactionManager used by this persistence manager
+ */
+ private String transactionManagerName;
+
+ /**
+ * Should JDBC batch updates be used?
+ */
+ private boolean usingBatchUpdates;
+
+ /*
+ * ********** Attributes from the JMSUserManager MBean **********
+ */
+
+ /**
+ * Should user database tables be created on startup?
+ */
+ private boolean createUserTablesOnStartup;
+
+ /**
+ * The JNDI name of the DataSource used by the JMSUserManager
+ */
+ private String userDataSource;
+
+ /**
+ * The name of the DataSource used by the JMSUserManager, without the JNDI prefix
+ */
+ private String userDataSourceName;
+
+ /**
+ * The sql statements used to persist the user information.
+ */
+ private String userSqlProperties;
+
+ /*
+ * ********** Attributes from the QueuePostOffice MBean **********
+ */
+
+ /*
+ * ********** Attributes from the TopicPostOffice MBean **********
+ */
+
+ /*
+ * *************** Other Attributes ********************************
+ */
+
+ /**
+ * The names of all the available dataSources.
+ */
+ private Map dataSources;
+
+ /*
+ * *************** Getters and Setters *****************************
+ */
+
+ /**
+ * @return Returns the createMsgTablesOnStartup.
+ */
+ public boolean isCreateMsgTablesOnStartup() {
+ return createMsgTablesOnStartup;
+ }
+
+ /**
+ * @param createMsgTablesOnStartup
+ * The createMsgTablesOnStartup to set.
+ */
+ public void setCreateMsgTablesOnStartup(boolean createMsgTablesOnStartup) {
+ this.createMsgTablesOnStartup = createMsgTablesOnStartup;
+ }
+
+ /**
+ * @return Returns the createUserTablesOnStartup.
+ */
+ public boolean isCreateUserTablesOnStartup() {
+ return createUserTablesOnStartup;
+ }
+
+ /**
+ * @param createUserTablesOnStartup
+ * The createUserTablesOnStartup to set.
+ */
+ public void setCreateUserTablesOnStartup(boolean createUserTablesOnStartup) {
+ this.createUserTablesOnStartup = createUserTablesOnStartup;
+ }
+
+ /**
+ * @return Returns the connectorName.
+ */
+ public String getConnectorName() {
+ return connectorName;
+ }
+
+ /**
+ * @param connectorName The connectorName to set.
+ */
+ public void setConnectorName(String connectorName) {
+ this.connectorName = connectorName;
+ }
+
+ /**
+ * @return Returns the dataSources.
+ */
+ public Map getDataSources() {
+ return dataSources;
+ }
+
+ /**
+ * @param dataSources
+ * The dataSources to set.
+ */
+ public void setDataSources(Map dataSources) {
+ this.dataSources = dataSources;
+ }
+
+ /**
+ * @return Returns the defaultQueueJNDIContext.
+ */
+ public String getDefaultQueueJNDIContext() {
+ return defaultQueueJNDIContext;
+ }
+
+ /**
+ * @param defaultQueueJNDIContext
+ * The defaultQueueJNDIContext to set.
+ */
+ public void setDefaultQueueJNDIContext(String defaultQueueJNDIContext) {
+ this.defaultQueueJNDIContext = defaultQueueJNDIContext;
+ }
+
+ /**
+ * @return Returns the defaultSecurityConfig.
+ */
+ public Element getDefaultSecurityConfig() {
+ return defaultSecurityConfig;
+ }
+
+ /**
+ * @param defaultSecurityConfig
+ * The defaultSecurityConfig to set.
+ */
+ public void setDefaultSecurityConfig(Element defaultSecurityConfig) {
+ this.defaultSecurityConfig = defaultSecurityConfig;
+ }
+
+ /**
+ * @return Returns the defaultSecurityRoles.
+ */
+ public String getDefaultSecurityRoles() {
+ return defaultSecurityRoles;
+ }
+
+ /**
+ * @param defaultSecurityRoles
+ * The defaultSecurityRoles to set.
+ */
+ public void setDefaultSecurityRoles(String defaultSecurityRoles) {
+ this.defaultSecurityRoles = defaultSecurityRoles;
+ }
+
+ /**
+ * @return Returns the defaultTempQueueDownCacheSize.
+ */
+ public int getDefaultTempQueueDownCacheSize() {
+ return defaultTempQueueDownCacheSize;
+ }
+
+ /**
+ * @param defaultTempQueueDownCacheSize The defaultTempQueueDownCacheSize to set.
+ */
+ public void setDefaultTempQueueDownCacheSize(int defaultTempQueueDownCacheSize) {
+ this.defaultTempQueueDownCacheSize = defaultTempQueueDownCacheSize;
+ }
+
+ /**
+ * @return Returns the defaultTempQueueFullSize.
+ */
+ public int getDefaultTempQueueFullSize() {
+ return defaultTempQueueFullSize;
+ }
+
+ /**
+ * @param defaultTempQueueFullSize The defaultTempQueueFullSize to set.
+ */
+ public void setDefaultTempQueueFullSize(int defaultTempQueueFullSize) {
+ this.defaultTempQueueFullSize = defaultTempQueueFullSize;
+ }
+
+ /**
+ * @return Returns the defaultTempQueuePageSize.
+ */
+ public int getDefaultTempQueuePageSize() {
+ return defaultTempQueuePageSize;
+ }
+
+ /**
+ * @param defaultTempQueuePageSize The defaultTempQueuePageSize to set.
+ */
+ public void setDefaultTempQueuePageSize(int defaultTempQueuePageSize) {
+ this.defaultTempQueuePageSize = defaultTempQueuePageSize;
+ }
+
+ /**
+ * @return Returns the defaultTopicJNDIContext.
+ */
+ public String getDefaultTopicJNDIContext() {
+ return defaultTopicJNDIContext;
+ }
+
+ /**
+ * @param defaultTopicJNDIContext
+ * The defaultTopicJNDIContext to set.
+ */
+ public void setDefaultTopicJNDIContext(String defaultTopicJNDIContext) {
+ this.defaultTopicJNDIContext = defaultTopicJNDIContext;
+ }
+
+ /**
+ * @return Returns the jmsProviderName.
+ */
+ public String getJmsProviderName() {
+ return jmsProviderName;
+ }
+
+ /**
+ * @param jmsProviderName
+ * The jmsProviderName to set.
+ */
+ public void setJmsProviderName(String jmsProviderName) {
+ this.jmsProviderName = jmsProviderName;
+ }
+
+ /**
+ * @return Returns the jmsVersion.
+ */
+ public String getJmsVersion() {
+ return jmsVersion;
+ }
+
+ /**
+ * @param jmsVersion
+ * The jmsVersion to set.
+ */
+ public void setJmsVersion(String jmsVersion) {
+ this.jmsVersion = jmsVersion;
+ }
+
+ /**
+ * @return Returns the maxParams.
+ */
+ public int getMaxParams() {
+ return maxParams;
+ }
+
+ /**
+ * @param maxParams
+ * The maxParams to set.
+ */
+ public void setMaxParams(int maxParams) {
+ this.maxParams = maxParams;
+ }
+
+ /**
+ * @return Returns the msgDataSource.
+ */
+ public String getMsgDataSource() {
+ return msgDataSource;
+ }
+
+ /**
+ * @param msgDataSource
+ * The msgDataSource to set.
+ */
+ public void setMsgDataSource(String msgDataSource) {
+ this.msgDataSource = msgDataSource;
+ }
+
+ /**
+ * @return Returns the msgDataSourceName.
+ */
+ public String getMsgDataSourceName() {
+ return msgDataSourceName;
+ }
+
+ /**
+ * @param msgDataSourceName The msgDataSourceName to set.
+ */
+ public void setMsgDataSourceName(String msgDataSourceName) {
+ this.msgDataSourceName = msgDataSourceName;
+ }
+
+ /**
+ * @return Returns the msgSqlProperties.
+ */
+ public String getMsgSqlProperties() {
+ return msgSqlProperties;
+ }
+
+ /**
+ * @param msgSqlProperties
+ * The msgSqlProperties to set.
+ */
+ public void setMsgSqlProperties(String msgSqlProperties) {
+ this.msgSqlProperties = msgSqlProperties;
+ }
+
+ /**
+ * @return Returns the persistenceManagerName.
+ */
+ public String getPersistenceManagerName() {
+ return persistenceManagerName;
+ }
+
+ /**
+ * @param persistenceManagerName The persistenceManagerName to set.
+ */
+ public void setPersistenceManagerName(String persistenceManagerName) {
+ this.persistenceManagerName = persistenceManagerName;
+ }
+
+ /**
+ * @return Returns the prefetchSize.
+ */
+ public int getPrefetchSize() {
+ return prefetchSize;
+ }
+
+ /**
+ * @param prefetchSize The prefetchSize to set.
+ */
+ public void setPrefetchSize(int prefetchSize) {
+ this.prefetchSize = prefetchSize;
+ }
+
+ /**
+ * @return Returns the providerVersion.
+ */
+ public String getProviderVersion() {
+ return providerVersion;
+ }
+
+ /**
+ * @param providerVersion
+ * The providerVersion to set.
+ */
+ public void setProviderVersion(String providerVersion) {
+ this.providerVersion = providerVersion;
+ }
+
+ /**
+ * @return Returns the queuedExecutorPoolSize.
+ */
+ public int getQueuedExecutorPoolSize() {
+ return queuedExecutorPoolSize;
+ }
+
+ /**
+ * @param queuedExecutorPoolSize
+ * The queuedExecutorPoolSize to set.
+ */
+ public void setQueuedExecutorPoolSize(int queuedExecutorPoolSize) {
+ this.queuedExecutorPoolSize = queuedExecutorPoolSize;
+ }
+
+ /**
+ * @return Returns the securityDomain.
+ */
+ public String getSecurityDomain() {
+ return securityDomain;
+ }
+
+ /**
+ * @param securityDomain
+ * The securityDomain to set.
+ */
+ public void setSecurityDomain(String securityDomain) {
+ this.securityDomain = securityDomain;
+ }
+
+ /**
+ * @return Returns the serverPeerID.
+ */
+ public String getServerPeerID() {
+ return serverPeerID;
+ }
+
+ /**
+ * @param serverPeerID
+ * The serverPeerID to set.
+ */
+ public void setServerPeerID(String serverPeerID) {
+ this.serverPeerID = serverPeerID;
+ }
+
+ /**
+ * @return Returns the serverPeerName.
+ */
+ public String getServerPeerName() {
+ return serverPeerName;
+ }
+
+ /**
+ * @param serverPeerName The serverPeerName to set.
+ */
+ public void setServerPeerName(String serverPeerName) {
+ this.serverPeerName = serverPeerName;
+ }
+
+ /**
+ * @return Returns the transactionManagerName.
+ */
+ public String getTransactionManagerName() {
+ return transactionManagerName;
+ }
+
+ /**
+ * @param transactionManagerName The transactionManagerName to set.
+ */
+ public void setTransactionManagerName(String transactionManagerName) {
+ this.transactionManagerName = transactionManagerName;
+ }
+
+ /**
+ * @return Returns the userDataSource.
+ */
+ public String getUserDataSource() {
+ return userDataSource;
+ }
+
+ /**
+ * @param userDataSource
+ * The userDataSource to set.
+ */
+ public void setUserDataSource(String userDataSource) {
+ this.userDataSource = userDataSource;
+ }
+
+ /**
+ * @return Returns the userDataSourceName.
+ */
+ public String getUserDataSourceName() {
+ return userDataSourceName;
+ }
+
+ /**
+ * @param userDataSourceName The userDataSourceName to set.
+ */
+ public void setUserDataSourceName(String userDataSourceName) {
+ this.userDataSourceName = userDataSourceName;
+ }
+
+ /**
+ * @return Returns the userSqlProperties.
+ */
+ public String getUserSqlProperties() {
+ return userSqlProperties;
+ }
+
+ /**
+ * @param userSqlProperties
+ * The userSqlProperties to set.
+ */
+ public void setUserSqlProperties(String userSqlProperties) {
+ this.userSqlProperties = userSqlProperties;
+ }
+
+ /**
+ * @return Returns the usingBatchUpdates.
+ */
+ public boolean isUsingBatchUpdates() {
+ return usingBatchUpdates;
+ }
+
+ /**
+ * @param usingBatchUpdates
+ * The usingBatchUpdates to set.
+ */
+ public void setUsingBatchUpdates(boolean usingBatchUpdates) {
+ this.usingBatchUpdates = usingBatchUpdates;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Queue.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Queue.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Queue.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * The Queue type defines a destination of type queue.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class Queue extends Destination {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The number of messages in the queue
+ */
+ private int messageCount;
+
+ /**
+ * Constructor
+ */
+ public Queue() {
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * the destination identifier
+ */
+ public Queue(DestinationIdentifier id) {
+ super(id);
+ }
+
+ /**
+ * @return Returns the messageCount.
+ */
+ public int getMessageCount() {
+ return messageCount;
+ }
+
+ /**
+ * @param messageCount
+ * The messageCount to set.
+ */
+ public void setMessageCount(int messageCount) {
+ this.messageCount = messageCount;
+ }
+
+ /**
+ * Appends extra information to toString.
+ *
+ * @param builder
+ * @see org.jboss.admin.model.jms.Destination#append(org.apache.commons.lang.builder.ToStringBuilder)
+ */
+ protected void append(ToStringBuilder builder) {
+ builder.append("type", "queue").append("messageCount", messageCount);
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Topic.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Topic.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/model/jms/Topic.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.model.jms;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * The Topic type defines a destination of type topic.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class Topic extends Destination {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Durable subscriptions count
+ */
+ private int durableSubCount;
+
+ /**
+ * Non-Durable subscriptions count
+ */
+ private int nonDurableSubCount;
+
+ /**
+ * All subscriptions count
+ */
+ private int allSubCount;
+
+ /**
+ * Constructor
+ */
+ public Topic() {
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * the destination identifier
+ */
+ public Topic(DestinationIdentifier id) {
+ super(id);
+ }
+
+ /**
+ * @return Returns the allSubCount.
+ */
+ public int getAllSubCount() {
+ return allSubCount;
+ }
+
+ /**
+ * @param allSubCount
+ * The allSubCount to set.
+ */
+ public void setAllSubCount(int allSubCount) {
+ this.allSubCount = allSubCount;
+ }
+
+ /**
+ * @return Returns the durableSubCount.
+ */
+ public int getDurableSubCount() {
+ return durableSubCount;
+ }
+
+ /**
+ * @param durableSubCount
+ * The durableSubCount to set.
+ */
+ public void setDurableSubCount(int durableSubCount) {
+ this.durableSubCount = durableSubCount;
+ }
+
+ /**
+ * @return Returns the nonDurableSubCount.
+ */
+ public int getNonDurableSubCount() {
+ return nonDurableSubCount;
+ }
+
+ /**
+ * @param nonDurableSubCount
+ * The nonDurableSubCount to set.
+ */
+ public void setNonDurableSubCount(int nonDurableSubCount) {
+ this.nonDurableSubCount = nonDurableSubCount;
+ }
+
+ /**
+ * Appends extra information to toString.
+ *
+ * @param builder
+ * @see org.jboss.admin.model.jms.Destination#append(org.apache.commons.lang.builder.ToStringBuilder)
+ */
+ protected void append(ToStringBuilder builder) {
+ builder.append("type", "topic").append("durableSubCount",
+ durableSubCount).append("nonDurableSubCount",
+ nonDurableSubCount).append("allSubCount", allSubCount);
+ }
+}
\ No newline at end of file
Modified: projects/admin-console/trunk/src/main/org/jboss/admin/service/DeploymentServiceHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/DeploymentServiceHelper.java 2007-01-18 18:04:03 UTC (rev 59791)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/DeploymentServiceHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -212,6 +212,7 @@
String roleStr;
String roleName;
String[] roleArray = roles.split(SEPARATOR);
+ int nameInx;
secConfig.append(SECURITY_NODE);
/*
@@ -220,7 +221,10 @@
for (int i = 0; i < roleArray.length; i++) {
roleStr = roleArray[i];
if (roleStr != null && !"".equals(roles.trim())) {
- roleName = roleStr.substring(0, roleStr.indexOf(":"));
+ nameInx = roleStr.indexOf(":");
+ if (nameInx < 0)
+ nameInx = roleStr.length();
+ roleName = roleStr.substring(0, nameInx);
secConfig.append("<" + ROLE_NODE);
secConfig.append(" " + ATT_NAME + "='" + roleName + "'");
Modified: projects/admin-console/trunk/src/main/org/jboss/admin/service/MBeanServerHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/MBeanServerHelper.java 2007-01-18 18:04:03 UTC (rev 59791)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/MBeanServerHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -37,6 +37,8 @@
import org.jboss.admin.AdminConstants;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.services.deployment.DeploymentServiceMBean;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
/*
* Utility class with some useful methods for accessing an MBeanServer
@@ -296,9 +298,10 @@
}
}
- public MBeanServer getMbeanServer() {
- return mbeanServer;
- }
+// TODO: remove?
+// public MBeanServer getMbeanServer() {
+// return mbeanServer;
+// }
public String getConfigPathForTestingUse() {
return configPathForTestingUse;
@@ -307,5 +310,61 @@
public void setConfigPathForTestingUse(String configPathForTestingUse) {
this.configPathForTestingUse = configPathForTestingUse;
}
+
+ /**
+ * Converts the security configuration from an org.w3c.dom.Element to a text
+ * string for displaying.
+ *
+ * @param elem
+ * The security config element
+ * @return The text representation of the security configuration
+ */
+ public String convertSecurityConfigToText(Element configElem) {
+ String SEPARATOR = AdminConstants.LINE_SEPARATOR;
+ String ROLE_ELEMENT_NAME = "role";
+ StringBuffer roleList = new StringBuffer();
+ String attValue = null;
+ int roleSize = 0;
+ Element roleElem = null;
+ if (configElem != null) {
+ NodeList roleNodes = configElem
+ .getElementsByTagName(ROLE_ELEMENT_NAME);
+ roleSize = roleNodes.getLength();
+
+ /*
+ * For each role element, get its attributes and build a string:
+ */
+ for (int i = 0; i < roleSize; i++) {
+ StringBuffer roleStr = new StringBuffer();
+ roleElem = (Element) roleNodes.item(i);
+ attValue = roleElem.getAttribute("name");
+ roleStr.append(attValue);
+
+ attValue = roleElem.getAttribute("read");
+ if (attValue.equals("true")) {
+ roleStr.append(":");
+ roleStr.append("read");
+ }
+
+ attValue = roleElem.getAttribute("write");
+ if (attValue.equals("true")) {
+ roleStr.append(":");
+ roleStr.append("write");
+ }
+
+ attValue = roleElem.getAttribute("create");
+ if (attValue.equals("true")) {
+ roleStr.append(":");
+ roleStr.append("create");
+ }
+
+ roleList.append(roleStr);
+ roleList.append(SEPARATOR);
+ attValue = null;
+ }
+ }
+ return roleList.toString();
+ }
+
}
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Constants.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Constants.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Constants.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+/**
+ * Class which draws together some of the constants used by the Destination
+ * service module.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class Constants {
+
+ /**
+ * The JmsAttributes contains the attributes of various MBeans of JBossMQ
+ */
+ public class JmsAttributes {
+ protected static final String
+ // Attributes of ConnectionFactory:
+ CONNECTOR = "Connector",
+ DEFAULT_TEMP_QUEUE_DOWN_CACHE_SIZE = "DefaultTempQueueDownCacheSize",
+ DEFAULT_TEMP_QUEUE_FULL_SIZE = "DefaultTempQueueFullSize",
+ DEFAULT_TEMP_QUEUE_PAGE_SIZE = "DefaultTempQueuePageSize",
+ PREFETCH_SIZE = "PrefetchSize",
+ SERVER_PEER = "ServerPeer",
+
+ // Attributes of ServerPeer:
+ DEFAULT_QUEUE_JNDI_CONTEXT = "DefaultQueueJNDIContext",
+ DEFAULT_SECURITY_CONFIG = "DefaultSecurityConfig",
+ DEFAULT_TOPIC_JNDI_CONTEXT = "DefaultTopicJNDIContext",
+ JMS_PROVIDER_NAME = "JMSProviderName",
+ JMS_VERSION = "JMSVersion",
+ PERSISTENCE_MANAGER = "PersistenceManager",
+ PROVIDER_VERSION = "ProviderVersion",
+ QUEUED_EXECUTOR_POOL_SIZE = "QueuedExecutorPoolSize",
+ SECURITY_DOMAIN = "SecurityDomain",
+ SERVER_PEER_ID = "serverPeerID",
+
+ // Attributes of PersistenceManager:
+ CREATE_TABLES_ON_STARTUP = "CreateTablesOnStartup",
+ MAX_PARAMS = "MaxParams",
+ DATA_SOURCE = "DataSource",
+ SQL_PROPERTIES = "SqlProperties",
+ TRANSACTION_MANAGER = "TransactionManager",
+ USING_BATCH_UPDATES = "UsingBatchUpdates";
+
+ protected static final String
+ CONNECTION_FACTORY_NAME = "jboss.messaging.destination:service=ConnectionFactory",
+ SERVER_PEER_NAME = "jboss.messaging:service=ServerPeer",
+ PERSISTENCE_MANAGER_NAME = "jboss.messaging:service=PersistenceManager",
+ JMS_USER_MANAGER_NAME = "jboss.messaging:service=JMSUserManager";
+ }
+
+ /**
+ * The CommonAttributes contains the common attributes for both Queue and
+ * Topic types
+ */
+ public class CommonAttributes {
+ protected static final String NAME = "Name",
+ JNDI_NAME = "JNDIName",
+ CREATED_PROGRAMMATICALLY = "CreatedProgrammatically",
+ DOWN_CACHE_SIZE = "DownCacheSize",
+ FULL_SIZE = "FullSize",
+ PAGE_SIZE = "PageSize",
+ SECURITY_CONFIG = "SecurityConfig",
+ SECURITY_ROLES = "SecurityRoles",
+ SERVER_PEER = "ServerPeer";
+ }
+
+ /**
+ * The QueueAttributes contains the attributes specific to a destination of
+ * Queue type
+ */
+ public class QueueAttributes {
+ protected static final String MESSAGE_COUNT = "MessageCount";
+ }
+
+ /**
+ * The TopicAttributes contains the attributes specific to a destination of
+ * Topic type
+ */
+ public class TopicAttributes {
+ protected static final String
+ DURABLE_SUBSCRIPTIONS_COUNT = "DurableSubscriptionsCount",
+ NON_DURABLE_SUBSCRIPTIONS_COUNT = "NonDurableSubscriptionsCount",
+ ALL_SUBSCRIPTIONS_COUNT = "AllSubscriptionsCount";
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceDestinationHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceDestinationHelper.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceDestinationHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,483 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.management.MBeanException;
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+import org.jboss.admin.service.DeploymentServiceHelper;
+import org.jboss.admin.service.MBeanServerHelper;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.services.deployment.DeploymentServiceMBean;
+
+/**
+ * DeploymentService helper class that contains Destination specific attributes
+ * and methods.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DeploymentServiceDestinationHelper extends DeploymentServiceHelper {
+ private static Log logger = LogFactory
+ .getLog(DeploymentServiceDestinationHelper.class);
+
+ /**
+ * Defines constant strings used in the class
+ */
+ protected static final String JMS_QUEUE_TEMPLATE_NAME = "jms-queue",
+ JMS_TOPIC_TEMPLATE_NAME = "jms-topic",
+ JMS_QUEUE_DEF_JNDI_PREFIX = "queue/",
+ JMS_TOPIC_DEF_JNDI_PREFIX = "topic/";
+
+ /**
+ * Constructor
+ *
+ * @param mbeanServerHelper
+ * An instance of the MbeanServerHelper class
+ */
+ public DeploymentServiceDestinationHelper(
+ MBeanServerHelper mbeanServerHelper) {
+ super(mbeanServerHelper);
+ }
+
+ /**
+ * Create a destination
+ *
+ * @param destination
+ * @throws JmsServiceException
+ */
+ public void createDestination(Destination destination)
+ throws JmsServiceException {
+ if (destination instanceof Queue) {
+ Queue queue = (Queue) destination;
+ if ("".equals(queue.getJndiName()) || queue.getJndiName() == null) {
+ queue.setJndiName(JMS_QUEUE_DEF_JNDI_PREFIX + queue.getName()); // TODO:
+ // TODO: get
+ // prefix
+ // from
+ // jms
+ }
+ Map attributes = getDestinationAttributes(queue);
+ createDestination(queue.getName(), JMS_QUEUE_TEMPLATE_NAME,
+ attributes);
+ } else if (destination instanceof Topic) {
+ Topic topic = (Topic) destination;
+ if ("".equals(topic.getJndiName()) || topic.getJndiName() == null) {
+ topic.setJndiName(JMS_TOPIC_DEF_JNDI_PREFIX + topic.getName()); // TODO:
+ // TODO: get
+ // prefix
+ // from
+ // jms
+ }
+ Map attributes = getDestinationAttributes(topic);
+ createDestination(topic.getName(), JMS_TOPIC_TEMPLATE_NAME,
+ attributes);
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.INVALID_DESTINATION_TYPE, new String[] { destination
+ .getName() }));
+ }
+ }
+
+ /**
+ * Create a destination
+ *
+ * @param moduleName
+ * the module name of a destination used by the DeploymentService
+ * to create and deploy the destination
+ * @param templateName
+ * the name of a tamplete (jms-queue or jms-topic)used by the
+ * DeploymentService to creae a destination
+ * @param attributes
+ * the attributes of the destination
+ * @throws JmsServiceException
+ */
+ protected void createDestination(String moduleName, String templateName,
+ Map attributes) throws JmsServiceException {
+
+ /*
+ * Get a type-safe dynamic proxy:
+ */
+ DeploymentServiceMBean deploymentService = getDeploymentService();
+
+ try {
+ moduleName = deploymentService.createModule(moduleName,
+ templateName, (HashMap) attributes);
+
+ } catch (Exception e) {
+ throw new JmsServiceException(new Error(Error.FAILED_CREATE_MODULE,
+ null), e);
+ }
+
+ try {
+ deploymentService.deployModuleAsynch(moduleName);
+ } catch (Exception e) {
+ deploymentService.removeModule(moduleName);
+ throw new JmsServiceException(new Error(Error.FAILED_DEPLOY_MODULE,
+ null), e);
+ }
+ }
+
+ /**
+ * Get common attributes of a destination
+ *
+ * @param destination
+ * @return a hashmap containing the attributes
+ */
+ protected Map getCommonDestinationAttributes(Destination destination) {
+ Map map = new HashMap();
+ putAttribute(Constants.CommonAttributes.NAME, destination.getName(),
+ map);
+ putAttribute(Constants.CommonAttributes.JNDI_NAME, destination
+ .getJndiName(), map);
+ putAttribute(Constants.CommonAttributes.DOWN_CACHE_SIZE, destination
+ .getDownCacheSize(), map);
+ putAttribute(Constants.CommonAttributes.FULL_SIZE, destination
+ .getFullSize(), map);
+ putAttribute(Constants.CommonAttributes.PAGE_SIZE, destination
+ .getPageSize(), map);
+ putSecurityRolesAttribute(destination.getSecurityRoles(), map);
+ return map;
+ }
+
+ /**
+ * Get queue specific attributes needed by DeploymentService.
+ *
+ * @param destination
+ * @return a hashmap containing the attributes
+ */
+ protected Map getDestinationAttributes(Queue destination) {
+ Map map = getCommonDestinationAttributes(destination);
+
+ /*
+ * Get other queue specific writable attributes. None for now.
+ */
+
+ return map;
+ }
+
+ /**
+ * Get topic specific attributes needed by DeploymentService.
+ *
+ * @param destination
+ * @return a hashmap containing the attributes
+ */
+ protected Map getDestinationAttributes(Topic destination) {
+ Map map = getCommonDestinationAttributes(destination);
+
+ /*
+ * Get other topic specific writable attributes. None for now.
+ */
+
+ return map;
+ }
+
+ /**
+ * This method converts a compond String of security roles to an array of
+ * role strings required by the DeploymentService
+ *
+ * @param roles
+ * a company string of security roles
+ * @param map
+ * a map that holds an array of the security roles and associated
+ * it with a key
+ */
+ protected void putSecurityRolesAttribute(String roles, Map map) {
+ String ROLE_SEPARATOR = "\r\n";
+ String key = Constants.CommonAttributes.SECURITY_ROLES;
+
+ if (roles != null && !"".equals(roles)) {
+ String[] roleArray = roles.split(ROLE_SEPARATOR);
+ if (roleArray.length > 0) {
+ map.put(key, roleArray);
+ }
+ }
+ }
+
+ /**
+ * This method determines whether the specifed destination was created via
+ * the DeploymentService.
+ *
+ * TODO Update the DeploymentService so getDeployedURL returns null for
+ * modules it doesn't know about, rather than throwing an MBeanException
+ *
+ * @param id
+ * the identifier of the destination
+ * @return a boolean of ture if the destination was created via the
+ * DeploymentService, otherswise false
+ */
+ public boolean wasDestinationCreatedViaDeploymentService(
+ DestinationIdentifier id) {
+ if (id == null) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.DESTINATION_IDENTIFIER_IS_NULL, null));
+ }
+
+ if (id.getModuleName() == null) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.MODULE_NAME_IS_NULL, null));
+ }
+
+ boolean returnValue = false;
+ try {
+ getMBeanServerHelper().getMBeanServer().invoke(
+ new ObjectName(DEPLOYMENT_SERVICE_OBJECT_NAME),
+ "getDeployedURL", new Object[] { id.getModuleName() },
+ new String[] { "java.lang.String" });
+ /*
+ * if no exception is thrown, then the Destination must be managed
+ * by the DeploymentService
+ */
+ returnValue = true;
+ } catch (MBeanException e) {
+ /*
+ * eat this exception
+ */
+ logger
+ .debug("MBeanException thrown by DeploymentService.getDeployedURL(), "
+ + "therefore Destination is not managed by the DeploymentService.");
+ } catch (Exception e) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_CALL_DEPLOYMENT_SERVICE_METHOD, null), e);
+ }
+
+ return returnValue;
+ }
+
+ /**
+ * Determines whether the module described by the specified DeploymentInfo
+ * object was created using the DestinationService.
+ *
+ * @param deploymentModule
+ * the destination module
+ * @return a boolean of ture if the module was created via the
+ * DeploymentService, otherswise false.
+ */
+ protected boolean wasDestinationCreatedViaDeploymentService(
+ DeploymentInfo deploymentModule) {
+ URL moduleURL = deploymentModule.url;
+ boolean createdByService = false;
+
+ if (moduleURL != null) {
+ String moduleLocation = moduleURL.toString();
+ if (moduleLocation.indexOf(PARTIAL_DEPLOYMENT_FOLDER) > 0) {
+ createdByService = true;
+ }
+ }
+ return createdByService;
+ }
+
+ /**
+ * Undeploy the destination
+ *
+ * @param identifier
+ * the identifier of the destination
+ * @throws JmsServiceException
+ */
+ public void undeployDestination(DestinationIdentifier identifier)
+ throws JmsServiceException {
+ logger.debug("Attempting to undeploy Destination with ID ["
+ + identifier + "].");
+ /*
+ * Get a type-safe dynamic proxy
+ */
+ DeploymentServiceMBean deploymentService = getDeploymentService();
+
+ try {
+ deploymentService.undeployModuleAsynch(identifier.getModuleName());
+ } catch (Exception e) {
+ throw new JmsServiceException(new Error(
+ Error.FAILED_UNDEPLOY_MODULE, null), e);
+ }
+ }
+
+ /**
+ * Remove the destination
+ *
+ * @param identifier
+ * the identifier of the destination
+ * @throws JmsServiceException
+ */
+ public void removeDestination(DestinationIdentifier identifier)
+ throws JmsServiceException {
+ logger.debug("Attempting to remove Destination with ID [" + identifier
+ + "].");
+ /*
+ * Get a type-safe dynamic proxy
+ */
+ DeploymentServiceMBean deploymentService = getDeploymentService();
+
+ boolean success = deploymentService.removeModule(identifier
+ .getModuleName());
+ if (!success) {
+ throw new JmsServiceException(new Error(Error.FAILED_REMOVE_MODULE,
+ null));
+ }
+ }
+
+ /**
+ * Remove the definition of a destination mbean from its configuration file
+ * but leave the other mbean definition unchanged.
+ *
+ * @param identifier
+ * the identifier of the destination whose mbean definition is to
+ * be removed
+ */
+ public void removeDestinationMBean(DestinationIdentifier identifier) {
+ String mbeanName = identifier.getMBeanName();
+ removeMBean(mbeanName);
+ }
+
+ /**
+ * Update the attributes of the specified destination
+ *
+ * @param destination
+ * The destination to be updated
+ * @throws JmsServiceException
+ */
+ public void updateDestination(Destination destination)
+ throws JmsServiceException {
+ Properties props = new Properties();
+ Properties depends = new Properties();
+
+ if (destination instanceof Queue) {
+ Queue queue = (Queue) destination;
+ // TODO: get jndi prefix from jms
+ if ("".equals(queue.getJndiName()) || queue.getJndiName() == null) {
+ queue.setJndiName(JMS_QUEUE_DEF_JNDI_PREFIX + queue.getName());
+ }
+
+ /*
+ * Get updatable queue properties:
+ */
+ props = getWritableDestinationProperties(queue);
+ } else if (destination instanceof Topic) {
+ Topic topic = (Topic) destination;
+ // TODO: get jndi prefix from jms
+ if ("".equals(topic.getJndiName()) || topic.getJndiName() == null) {
+ topic.setJndiName(JMS_TOPIC_DEF_JNDI_PREFIX
+ + topic.getName());
+ }
+
+ /*
+ * Get updatable topic properties:
+ */
+ props = getWritableDestinationProperties(topic);
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.INVALID_DESTINATION_TYPE, new String[] { destination
+ .getName() }));
+ }
+
+ /*
+ * Setup depend properties:
+ */
+ putProperty(Constants.CommonAttributes.SERVER_PEER, destination
+ .getServerPeerName(), depends);
+
+ /*
+ * Invoke DeploymentService to perform update:
+ */
+ String mbeanName = destination.getIdentifier().getMBeanName();
+ updateMBeanAttributes(mbeanName, props, depends);
+ }
+
+ /**
+ * Get writable common attributes of a destination
+ *
+ * @param destination
+ * @return a Properties object containing the attributes
+ */
+ protected Properties getWritableCommonDestinationProperties(
+ Destination destination) {
+ Properties props = new Properties();
+ putProperty(Constants.CommonAttributes.JNDI_NAME, destination
+ .getJndiName(), props);
+ putProperty(Constants.CommonAttributes.DOWN_CACHE_SIZE, destination
+ .getDownCacheSize(), props);
+ putProperty(Constants.CommonAttributes.FULL_SIZE, destination
+ .getFullSize(), props);
+ putProperty(Constants.CommonAttributes.PAGE_SIZE, destination
+ .getPageSize(), props);
+ putSecurityRolesProperty(destination.getSecurityRoles(), props);
+ return props;
+ }
+
+ /**
+ * Get queue specific attributes that are writable.
+ *
+ * @param destination
+ * @return a Properties object containing the attributes
+ */
+ protected Properties getWritableDestinationProperties(Queue destination) {
+ Properties props = getWritableCommonDestinationProperties(destination);
+
+ /*
+ * Get other queue specific writable attributes. None for now.
+ */
+
+ return props;
+ }
+
+ /**
+ * Get topic specific attributes that are writable.
+ *
+ * @param destination
+ * @return a Properties object containing the attributes
+ */
+ protected Properties getWritableDestinationProperties(Topic destination) {
+ Properties props = getWritableCommonDestinationProperties(destination);
+
+ /*
+ * Get other topic specific writable attributes. None for now.
+ */
+
+ return props;
+ }
+
+ /**
+ * Convert a compond String of security roles to the security configuration
+ * in xml syntax and add the property to the Properties object.
+ *
+ * @param roles
+ * a compond string of security roles
+ * @param props
+ * the Properties object where the new property will be added
+ */
+ protected void putSecurityRolesProperty(String roles, Properties props) {
+ String secConfig = convertSecurityRolesToXml(roles);
+ putProperty(Constants.CommonAttributes.SECURITY_CONFIG, secConfig,
+ props);
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceJmsHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceJmsHelper.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DeploymentServiceJmsHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.service.DeploymentServiceHelper;
+import org.jboss.admin.service.MBeanServerHelper;
+
+/**
+ * DeploymentService helper class that contains JBossMQ specific attributes and
+ * methods.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DeploymentServiceJmsHelper extends DeploymentServiceHelper {
+ /**
+ * Logger for this class
+ */
+ private static Log logger = LogFactory
+ .getLog(DeploymentServiceJmsHelper.class);
+
+ /**
+ * Constructor
+ *
+ * @param mbeanServerHelper
+ * An instance of the MbeanServerHelper class
+ */
+ public DeploymentServiceJmsHelper(MBeanServerHelper mbeanServerHelper) {
+ super(mbeanServerHelper);
+ }
+
+ /**
+ * Update jms attributes belong to several different MBeans.
+ *
+ * @param jms
+ * The Jms object containing all the jms attributes
+ * @throws JmsServiceException
+ */
+ public void updateJmsAttributes(Jms jms) throws JmsServiceException {
+ /*
+ * Update attributes of the ConnectionFactory MBean:
+ */
+ Properties attrs = new Properties();
+ putProperty(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_DOWN_CACHE_SIZE,
+ jms.getDefaultTempQueueDownCacheSize(), attrs);
+ putProperty(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_FULL_SIZE, jms
+ .getDefaultTempQueueFullSize(), attrs);
+ putProperty(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_PAGE_SIZE, jms
+ .getDefaultTempQueuePageSize(), attrs);
+ putProperty(Constants.JmsAttributes.PREFETCH_SIZE, jms
+ .getPrefetchSize(), attrs);
+
+ Properties depends = new Properties();
+ putProperty(Constants.JmsAttributes.CONNECTOR, jms.getConnectorName(),
+ depends);
+ putProperty(Constants.JmsAttributes.SERVER_PEER, jms
+ .getServerPeerName(), depends);
+
+ updateMBeanAttributes(Constants.JmsAttributes.CONNECTION_FACTORY_NAME,
+ attrs, depends);
+
+ /*
+ * Update attributes of the ServerPeer MBean:
+ */
+ attrs.clear();
+ String secConfig = convertSecurityRolesToXml(jms
+ .getDefaultSecurityRoles());
+ putProperty(Constants.JmsAttributes.DEFAULT_SECURITY_CONFIG, secConfig,
+ attrs);
+ putProperty(Constants.JmsAttributes.QUEUED_EXECUTOR_POOL_SIZE, jms
+ .getQueuedExecutorPoolSize(), attrs);
+ putProperty(Constants.JmsAttributes.SECURITY_DOMAIN, jms
+ .getSecurityDomain(), attrs);
+
+ depends.clear();
+ putProperty(Constants.JmsAttributes.PERSISTENCE_MANAGER, jms
+ .getPersistenceManagerName(), depends);
+
+ updateMBeanAttributes(Constants.JmsAttributes.SERVER_PEER, attrs,
+ depends);
+
+ /*
+ * Update attributes of the PersistenceManager MBean:
+ */
+ attrs.clear();
+ putProperty(Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP, jms
+ .isCreateMsgTablesOnStartup(), attrs);
+
+ String dataSourceName = jms.getMsgDataSource();
+ int inx = dataSourceName.indexOf("/");
+ dataSourceName = dataSourceName.substring(0, inx)
+ + jms.getMsgDataSourceName();
+ putProperty(Constants.JmsAttributes.DATA_SOURCE, dataSourceName, attrs);
+
+ putProperty(Constants.JmsAttributes.MAX_PARAMS, jms.getMaxParams(),
+ attrs);
+ putProperty(Constants.JmsAttributes.SQL_PROPERTIES, jms
+ .getMsgSqlProperties(), attrs);
+ putProperty(Constants.JmsAttributes.USING_BATCH_UPDATES, jms
+ .isUsingBatchUpdates(), attrs);
+
+ depends.clear();
+ putProperty(Constants.JmsAttributes.TRANSACTION_MANAGER, jms
+ .getTransactionManagerName(), depends);
+
+ updateMBeanAttributes(Constants.JmsAttributes.PERSISTENCE_MANAGER_NAME,
+ attrs, depends);
+
+ /*
+ * Update attributes of the JMSUserManager MBean. Note that it uses the
+ * same depends object as PersistenceManager:
+ */
+ attrs.clear();
+ putProperty(Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP, jms
+ .isCreateUserTablesOnStartup(), attrs);
+
+ dataSourceName = jms.getUserDataSource();
+ inx = dataSourceName.indexOf("/");
+ dataSourceName = dataSourceName.substring(0, inx)
+ + jms.getUserDataSourceName();
+ putProperty(Constants.JmsAttributes.DATA_SOURCE, dataSourceName, attrs);
+
+ putProperty(Constants.JmsAttributes.SQL_PROPERTIES, jms
+ .getUserSqlProperties(), attrs);
+
+ updateMBeanAttributes(Constants.JmsAttributes.JMS_USER_MANAGER_NAME,
+ attrs, depends);
+
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationService.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationService.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationService.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.util.List;
+
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+
+/**
+ * The DestinationService type ...
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public interface DestinationService {
+ /**
+ * Gets a collection of all of the queues.
+ *
+ * @return A List of Queue objects.
+ */
+ public List getQueues();
+
+ /**
+ * Gets a collection of all of the topics.
+ *
+ * @return A List of Topic objects.
+ */
+ public List getTopics();
+
+ /**
+ * Gets the indicated destination
+ *
+ * @param id
+ * The identifier for the destination.
+ * @return The indicated destination.
+ */
+ public Destination getDestination(DestinationIdentifier id);
+
+ /**
+ * Saves the given destination. If no such destination, it is created. If
+ * the destination is a duplicate, then overwrites the existing destination
+ * information.
+ *
+ * @param dest
+ * The destination to create/update.
+ * @throws JmsServiceException
+ * Error encountered.
+ */
+ public void saveDestination(Destination dest)
+ throws JmsServiceException;
+
+ /**
+ * Deletes the indicated destination.
+ *
+ * @param identifier
+ * The id of the destination to remove.
+ */
+ public void removeDestination(DestinationIdentifier identifier)
+ throws JmsServiceException;
+
+ /**
+ * Builds a new queue object with default values.
+ *
+ * @return The new queue object.
+ */
+ public Queue getDefaultQueue();
+
+ /**
+ * Builds a new topic object with default values.
+ *
+ * @return The new topic object.
+ */
+ public Topic getDefaultTopic();
+
+ /**
+ * Gets all the messages currently stored in the specified destination queue
+ *
+ * @param identifier
+ * The id of the destination queue
+ * @return A list of messages
+ */
+ public List getQueueMessages(DestinationIdentifier identifier);
+
+ /**
+ * Gets all the messages currently stored in the specified destination topic
+ *
+ * @param identifier
+ * The id of the destination topic
+ * @param subscriptionID
+ * The id of a subscription
+ * @return A list of messages
+ */
+ public List getTopicMessages(DestinationIdentifier identifier,
+ String subscriptionID);
+
+ /**
+ * Gets the durable subscriptions of the specified topic
+ *
+ * @param identifier
+ * The id of the topic
+ * @return A list of durable subscriptions
+ */
+ public List getDurableSubscriptions(DestinationIdentifier identifier);
+
+ /**
+ * Gets the non-durable subscriptions of the specified topic
+ *
+ * @param identifier
+ * The id of the topic
+ * @return A list of non-durable subscriptions
+ */
+ public List getNonDurableSubscriptions(DestinationIdentifier identifier);
+
+ /**
+ * Removes all the messages from the specified destination
+ *
+ * @param identifier
+ * The id of the destination
+ */
+ public void removeMessages(DestinationIdentifier identifier);
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationServiceImpl.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationServiceImpl.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/DestinationServiceImpl.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,504 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.DestinationState;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * The DestinationServiceImpl type imlements the destination service. This class
+ * manages the collection of destinations.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationServiceImpl implements DestinationService {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(DestinationServiceImpl.class);
+
+ /**
+ * An instance of the MBeanServerDestinationHelper class
+ */
+ private MBeanServerDestinationHelper mbeanServerHelper;
+
+ /**
+ * An instance of the MBeanServerJmsHelper class
+ */
+ private MBeanServerJmsHelper mbeanServerJmsHelper;
+
+ /**
+ * An instance of the DeploymentServiceDestinationHelper class
+ */
+ private DeploymentServiceDestinationHelper deploymentServiceHelper;
+
+ /**
+ * Constructor
+ */
+ public DestinationServiceImpl() {
+ super();
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#getQueues()
+ * @return A List of Queue objects. The list could be empty, but will never
+ * be null.
+ */
+ public List getQueues() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getQueues()");
+ }
+ return getDestinationsByType(Queue.class.getName());
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#getTopics()
+ * @return A List of Topic objects. The list could be empty, but will never
+ * be null.
+ */
+ public List getTopics() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getTopics()");
+ }
+ return getDestinationsByType(Topic.class.getName());
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#getDestination(org.jboss.admin.model.jms.DestinationIdentifier)
+ * @param id
+ * the identifier of the destination
+ * @return a destination specified by the id
+ */
+ public Destination getDestination(DestinationIdentifier id) {
+ ObjectName destinationObjectName = getDestinationObjectName(id);
+ String destinationType = getMBeanServerHelper().getDestinationTypeName(
+ destinationObjectName);
+
+ Destination destination = Destination.getDestination(destinationType);
+ destination.setIdentifier(id);
+ getMBeanServerHelper().populateDestinationData(destinationObjectName,
+ destination);
+
+ return destination;
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#saveDestination(org.jboss.admin.model.jms.Destination)
+ * @param destination
+ * @throws JmsServiceException
+ */
+ public void saveDestination(Destination destination)
+ throws JmsServiceException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("saveDestination(" + destination + ")");
+ }
+
+ if (destination.getIdentifier() == null) {
+ createDestination(destination);
+ } else {
+ updateDestination(destination);
+ }
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#removeDestination(org.jboss.admin.model.jms.DestinationIdentifier)
+ * @param identifier
+ * the identifier of the destination
+ */
+ public void removeDestination(DestinationIdentifier identifier)
+ throws JmsServiceException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("removeDestination(" + identifier + ")");
+ }
+
+ if (getDeploymentServiceHelper()
+ .wasDestinationCreatedViaDeploymentService(identifier)) {
+ getDeploymentServiceHelper().undeployDestination(identifier);
+ getDeploymentServiceHelper().removeDestination(identifier);
+ } else {
+ getDeploymentServiceHelper().removeDestinationMBean(identifier);
+ }
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#getDefaultQueue()
+ * @return a default queue
+ */
+ public Queue getDefaultQueue() {
+ Queue queue = new Queue();
+ init(queue);
+ return queue;
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.DestinationService#getDefaultTopic()
+ * @return a default topic
+ */
+ public Topic getDefaultTopic() {
+ Topic topic = new Topic();
+ init(topic);
+ return topic;
+ }
+
+ /**
+ * Initializes the general destination properties for a new destination.
+ *
+ * @param destination
+ * The new destination.
+ * @throws NullPointerException
+ * @throws MalformedObjectNameException
+ */
+ public void init(Destination destination) {
+ Jms jms = new Jms();
+ getMBeanServerJmsHelper().populateJmsData(jms);
+
+ destination.setDownCacheSize(2000);
+ destination.setFullSize(75000);
+ destination.setPageSize(2000);
+ destination.setSecurityRoles(jms.getDefaultSecurityRoles());
+ }
+
+ /**
+ * Gets all the messages currently stored in the specified destination queue
+ *
+ * @param identifier
+ * The id of the destination queue
+ * @return A list of messages
+ */
+ public List getQueueMessages(DestinationIdentifier identifier) {
+ ObjectName destinationObjectName = getDestinationObjectName(identifier);
+ List messages = getMBeanServerHelper().getQueueMessages(
+ destinationObjectName);
+ return messages;
+ }
+
+ /**
+ * Gets all the messages currently stored in the specified destination topic
+ *
+ * @param identifier
+ * The id of the destination topic
+ * @param subscriptionID
+ * The id of a subscription
+ * @return A list of messages
+ */
+ public List getTopicMessages(DestinationIdentifier identifier,
+ String subscriptionID) {
+ ObjectName destinationObjectName = getDestinationObjectName(identifier);
+ List messages = getMBeanServerHelper().getTopicMessages(
+ destinationObjectName, subscriptionID);
+ return messages;
+ }
+
+ /**
+ * Gets the durable subscriptions of the specified topic
+ *
+ * @param identifier
+ * The id of the topic
+ * @return A list of durable subscriptions
+ */
+ public List getDurableSubscriptions(DestinationIdentifier identifier) {
+ ObjectName destinationObjectName = getDestinationObjectName(identifier);
+ List durableSubscriptions = getMBeanServerHelper()
+ .getDurableSubscriptions(destinationObjectName);
+ return durableSubscriptions;
+ }
+
+ /**
+ * Gets the non-durable subscriptions of the specified topic
+ *
+ * @param identifier
+ * The id of the topic
+ * @return A list of non-durable subscriptions
+ */
+ public List getNonDurableSubscriptions(DestinationIdentifier identifier) {
+ ObjectName destinationObjectName = getDestinationObjectName(identifier);
+ List nonDurableSubscriptions = getMBeanServerHelper()
+ .getNonDurableSubscriptions(destinationObjectName);
+ return nonDurableSubscriptions;
+ }
+
+ /**
+ * Removes all messages from the specified destination
+ *
+ * @param identifier
+ * The id of the destination
+ */
+ public void removeMessages(DestinationIdentifier identifier) {
+ ObjectName destinationObjectName = getDestinationObjectName(identifier);
+ getMBeanServerHelper().removeDestinationMessages(destinationObjectName);
+ }
+
+ /**
+ * Returns a collection of all of the destinations of a particular type.
+ *
+ * @param destinationType
+ * @return A List of Destination objects. The list could be empty, but will
+ * never be null.
+ */
+ protected List getDestinationsByType(String destinationType) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getDestinationsByType(" + destinationType + ")");
+ }
+
+ Set destinationObjectNamesByType = getMBeanServerHelper()
+ .getAllDestinationObjectNamesByType(destinationType);
+
+ Collection deploymentInfo = getMBeanServerHelper()
+ .getAllDeployedInstanceInformation();
+
+ List destinationsByType = getDestinationsWithBasicInfo(deploymentInfo,
+ destinationObjectNamesByType, destinationType);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("getDestinationsByType() #="
+ + destinationsByType.size());
+ }
+ return destinationsByType;
+ }
+
+ /**
+ * Returns a list of Destinations populated with state and identity
+ * information
+ *
+ * @param deploymentInfo
+ * @param destinationObjectNames
+ * @param destinationType
+ * @return a list of Destination
+ */
+ protected List getDestinationsWithBasicInfo(Collection deploymentInfo,
+ Set destinationObjectNames, String destinationType) {
+
+ List destinations = new ArrayList();
+ for (Iterator iter = deploymentInfo.iterator(); iter.hasNext();) {
+ DeploymentInfo deploymentModule = (DeploymentInfo) iter.next();
+
+ /*
+ * Find all the matching mbeans in this deployment module:
+ */
+ List matchingDestinationObjectNames = checkForModuleAndObjectNameMatch(
+ deploymentModule, destinationObjectNames);
+
+ if (matchingDestinationObjectNames.size() != 0) {
+ for (Iterator iter2 = matchingDestinationObjectNames.iterator(); iter2
+ .hasNext();) {
+ ObjectName matchingObjectName = (ObjectName) iter2.next();
+
+ destinations.add(getDestinationWithBasicInfo(
+ matchingObjectName, deploymentModule,
+ destinationType));
+
+ /*
+ * Remove 'matchingDestinationObjectName' from the
+ * 'destinationObjectNames' list since it won't match twice.
+ * This would make the loop in getDestinationWithBasicInfo
+ * smaller the next time through.
+ */
+ destinationObjectNames.remove(matchingObjectName);
+ }
+
+ /*
+ * Break out of the loop if the 'destinationObjectNames' list
+ * becomes empty.
+ */
+ if (destinationObjectNames.size() == 0) {
+ break;
+ }
+ }
+ } // end of deploymentInfo loop
+ return destinations;
+ }
+
+ /**
+ * Checks to see if the specified deployment module contains in its list of
+ * MBeans any of the ObjectNames in the specified list. Returns all the
+ * ObjectNames which match.
+ *
+ * @param deploymentModule
+ * @param destinationObjectNames
+ * @return a list of ObjectNames
+ */
+ protected List checkForModuleAndObjectNameMatch(
+ DeploymentInfo deploymentModule, Set destinationObjectNames) {
+
+ List associatedMBeanObjectNames = deploymentModule.mbeans;
+ List matchingObjectNames = new ArrayList();
+
+ for (Iterator iterator = destinationObjectNames.iterator(); iterator
+ .hasNext();) {
+ ObjectName destinationObjectName = (ObjectName) iterator.next();
+ if (associatedMBeanObjectNames.contains(destinationObjectName)) {
+ matchingObjectNames.add(destinationObjectName);
+ }
+ }
+
+ return matchingObjectNames;
+ }
+
+ /**
+ * Get the a destination object with only its basic information data set
+ *
+ * @param destinationObjectName
+ * @param deploymentModule
+ * @param destinationType
+ * @return destination
+ */
+ protected Destination getDestinationWithBasicInfo(
+ ObjectName destinationObjectName, DeploymentInfo deploymentModule,
+ String destinationType) {
+
+ DestinationIdentifier identifier = new DestinationIdentifier();
+ identifier.setMBeanName(destinationObjectName.getCanonicalName());
+ identifier.setModuleName(getDeploymentServiceHelper().getModuleName(
+ deploymentModule.url));
+
+ DestinationState state = new DestinationState(deploymentModule.state,
+ deploymentModule.status);
+
+ Destination destination = Destination.getDestination(destinationType);
+
+ destination.setIdentifier(identifier);
+ destination.setState(state);
+
+ destination.setName(getMBeanServerHelper().getMBeanStringAttribute(
+ destinationObjectName, Constants.CommonAttributes.NAME));
+
+ destination.setJndiName(getMBeanServerHelper().getMBeanStringAttribute(
+ destinationObjectName, Constants.CommonAttributes.JNDI_NAME));
+
+ return destination;
+ }
+
+ /**
+ * Return an object of the JMX ObjectName type
+ *
+ * @param id
+ * The id of the destination
+ * @return an ObjectName
+ */
+ protected ObjectName getDestinationObjectName(DestinationIdentifier id) {
+ try {
+ return new ObjectName(id.getMBeanName());
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with
+ */
+ } catch (Exception e) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_CREATE_MBEAN_FROM_IDENTIFIER, null), e);
+ }
+ }
+
+ /**
+ * Create a destination
+ *
+ * @param destination
+ * @throws JmsServiceException
+ */
+ protected void createDestination(Destination destination)
+ throws JmsServiceException {
+ getDeploymentServiceHelper().createDestination(destination);
+ }
+
+ /**
+ * Update a destination
+ *
+ * @param destination
+ * @throws JmsServiceException
+ */
+ protected void updateDestination(Destination destination)
+ throws JmsServiceException {
+ if (getDeploymentServiceHelper()
+ .wasDestinationCreatedViaDeploymentService(destination.getIdentifier())) {
+ removeDestination(destination.getIdentifier());
+ createDestination(destination);
+ } else {
+ getDeploymentServiceHelper().updateDestination(destination);
+ }
+ }
+
+ /**
+ * Check if mbeanServerHelper is null before creating a new
+ * MBeanServerHelper. This supports having tests supply their own mock
+ * implementation
+ *
+ * @return an object of MBeanServerDestinationHelper
+ */
+ protected MBeanServerDestinationHelper getMBeanServerHelper() {
+ if (mbeanServerHelper == null) {
+ mbeanServerHelper = new MBeanServerDestinationHelper(
+ MBeanServerLocator.locateJBoss());
+ }
+ return mbeanServerHelper;
+ }
+
+ /**
+ * Check if mbeanServerJmsHelper is null before creating a new
+ * MBeanServerJmsHelper. This supports having tests supply their own mock
+ * implementation
+ *
+ * @return an object of MBeanServerJmsHelper
+ */
+ protected MBeanServerJmsHelper getMBeanServerJmsHelper() {
+ if (mbeanServerJmsHelper == null) {
+ mbeanServerJmsHelper = new MBeanServerJmsHelper(MBeanServerLocator
+ .locateJBoss());
+ }
+ return mbeanServerJmsHelper;
+ }
+
+ /**
+ * Check if deploymentServiceHelper is null before creating a new
+ * DeploymentServiceHelper. This supports having tests supply their own mock
+ * implementation
+ *
+ * @return an object of DeploymentServerDestinationHelper
+ */
+ protected DeploymentServiceDestinationHelper getDeploymentServiceHelper() {
+ if (deploymentServiceHelper == null) {
+ deploymentServiceHelper = new DeploymentServiceDestinationHelper(
+ getMBeanServerHelper());
+ }
+ return deploymentServiceHelper;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Error.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Error.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/Error.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Formats error text for display to the end user. Also contains the error
+ * number constants used by the rest of the application to identify errors.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class Error {
+ private static Log logger = LogFactory.getLog(Error.class);
+
+ /**
+ * Name of the resource properties file
+ */
+ private static final String ERR_PROP = "messages.messagingmessages";
+
+ /**
+ * Error id for each exception message defined in the properties file
+ */
+ public static final int INVALID_DESTINATION_TYPE = 101;
+
+ public static final int DESTINATION_TYPE_IS_NULL = 102;
+
+ public static final int IDENTIFIER_CTOR_ARG_IS_NULL = 103;
+
+ public static final int IDENTIFIER_CTOR_ARG_MISSING_SEPARATOR = 104;
+
+ public static final int FAILED_CREATE_MODULE = 105;
+
+ public static final int FAILED_DEPLOY_MODULE = 106;
+
+ public static final int FAILED_UNDEPLOY_MODULE = 107;
+
+ public static final int FAILED_REMOVE_MODULE = 108;
+
+ public static final int DESTINATION_IDENTIFIER_IS_NULL = 109;
+
+ public static final int MODULE_NAME_IS_NULL = 110;
+
+ public static final int FAILED_CALL_DEPLOYMENT_SERVICE_METHOD = 111;
+
+ public static final int FAILED_GET_DESTINATION_MBEANS = 112;
+
+ public static final int FAILED_CREATE_MBEAN_FROM_IDENTIFIER = 113;
+
+ public static final int FAILED_LIST_DEPLOYED_MODULES = 114;
+
+ public static final int FAILED_LIST_DESTINATION_MESSAGES = 115;
+
+ public static final int FAILED_LIST_RECEIVERS = 116;
+
+ public static final int FAILED_LIST_SUB_SCRIPTIONS = 117;
+
+ public static final int FAILED_GET_MESSAGE_STATISTICS = 118;
+
+ public static final int FAILED_LIST_MESSAGE_COUNTER_HISTORY = 119;
+
+ public static final int FAILED_REMOVE_DESTINATION_MESSAGES = 120;
+
+ public static final int FAILED_RESET_MESSAGE_COUNTER = 121;
+
+ public static final int FAILED_RESET_MESSAGE_COUNTER_HISTORY = 122;
+
+ public static final int FAILED_UPDATE_MBEAN = 123;
+
+ public static final int FAILED_INVOKE_MBEAN_OPERATION = 124;
+
+ /**
+ * Identifies the error number.
+ */
+ private int id;
+
+ /**
+ * The arguments for the error text;
+ */
+ private String[] mvArgs;
+
+ /**
+ * The formatted, localized error text.
+ */
+ private String strMessage;
+
+ /**
+ * The resource bundle used to read the localized error text.
+ */
+ private static ResourceBundle rb;
+
+ /**
+ * The format used to display the error number and text. {0} is the error
+ * number and {1} is the error text. The default format is provided here,
+ * the actual format is read from the resource bundle.
+ *
+ */
+ private static String strFormat = "{1} [{0}]";
+
+ /**
+ * The name, in the resource bundle, of the error formatting string.
+ */
+ private static final String FORMAT = "error.format";
+
+ /*
+ * Initialize static variables
+ */
+ static {
+ try {
+ rb = ResourceBundle.getBundle(ERR_PROP);
+
+ /*
+ * Only use the error display format from the resource bundle if it
+ * contains entries for both the error number and text:
+ */
+ String format = rb.getString(Error.FORMAT);
+ if ((format != null) && (format.indexOf("{0}") >= 0)
+ && (format.indexOf("{1}") >= 0)) {
+ strFormat = format;
+ }
+
+ } catch (MissingResourceException e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Get the error id number.
+ *
+ * @return Returns the error number.
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * Gets the formatted, localized error messages. Lazy evaluation is used,
+ * thus calling this method the first time causes the message to be
+ * formatted.
+ *
+ * @return Returns the message.
+ */
+ public String getMessage() {
+ /*
+ * If the messages has not yet been formatted, do so now:
+ */
+ if (strMessage == null) {
+ String strId = Integer.toString(id);
+ try {
+ String text = MessageFormat.format(rb.getString(strId), mvArgs);
+ strMessage = MessageFormat.format(strFormat, new Object[] {
+ strId, text });
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("id=" + strId + " - " + e.getMessage());
+ }
+ }
+
+ }
+
+ return strMessage;
+ }
+
+ /**
+ * Constructs the text to use for an application exception. The text based
+ * on a given error id and, optionally, the arguments for the error message.
+ *
+ * @param id
+ * Identifies the error by id number.
+ * @param args
+ * Identifies the arguments for the error. Can be null.
+ */
+ public Error(int id, String[] args) {
+ this.id = id;
+ mvArgs = args;
+ }
+
+ /**
+ * Overwrite the default toString() method.
+ *
+ * @return Returns the text string of this Error object
+ */
+ public String toString() {
+ return getMessage();
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsService.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsService.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsService.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import org.jboss.admin.model.jms.Jms;
+
+/**
+ * The JmsService interface defines services used to manage JMS.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public interface JmsService {
+ /**
+ * Gets the JMS attributes.
+ *
+ * @return Jms object containing the jms attributes
+ */
+ public Jms getJmsAttributes();
+
+ /**
+ * Saves the JMS attributes.
+ *
+ * @param jms
+ * Jms object containing the jms attributes to be updated.
+ * @throws JmsServiceException
+ * Error encountered.
+ */
+ public void saveJmsAttributes(Jms jms) throws JmsServiceException;
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceException.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceException.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceException.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.service.AdminConsoleException;
+
+/**
+ * Class encapsulating exceptions from executing the DestinationService which
+ * the clients should be expected to handle gracefully.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @version $Revision: 56034 $
+ */
+public class JmsServiceException extends AdminConsoleException {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Logger for this class
+ */
+ private final Log logger = LogFactory
+ .getLog(JmsServiceException.class);
+
+ /**
+ * The id number for the error. The error id numbers are listed in the Error
+ * class.
+ *
+ * @see org.jboss.admin.service.jms.Error
+ */
+ private int id;
+
+ /**
+ * Default constructor
+ *
+ */
+ public JmsServiceException() {
+ super();
+ }
+
+ /**
+ * Constructs a destination exception based on a given Error object.
+ *
+ * @param err
+ * Identifies the error.
+ */
+ public JmsServiceException(Error err) {
+ super(err.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + err.toString() + ")");
+ }
+ id = err.getId();
+ }
+
+ /**
+ * Constructs a destination exception based on a given exception object.
+ *
+ * @param e
+ * The exception that caused this exception.
+ */
+ public JmsServiceException(Throwable e) {
+ super(e);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + e + ")");
+ }
+ }
+
+ /**
+ * Constructs an destination exception based on a given Error object and, an
+ * excpetion that caused this exception.
+ *
+ * @param e
+ * The exception that caused this exception.
+ */
+ public JmsServiceException(Error err, Throwable e) {
+ super(err.getMessage(), e);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + err.toString() + ", " + e + ")");
+ }
+ id = err.getId();
+ }
+
+ /**
+ * Gets the error id number. The id numbers are listed in the Error class.
+ *
+ * @return The error id number.
+ * @see org.jboss.admin.service.jms.Error
+ */
+ public int getId() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getId(): " + id);
+ }
+ return id;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceImpl.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceImpl.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceImpl.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * The JmsServiceImpl type implements services used to manage JMS.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class JmsServiceImpl implements JmsService {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory.getLog(JmsServiceImpl.class);
+
+ /**
+ * An instance of the MBeanServerDestinationHelper class
+ */
+ private MBeanServerJmsHelper mbeanServerHelper;
+
+ /**
+ * An instance of the DeploymentServiceDestinationHelper class
+ */
+ private DeploymentServiceJmsHelper deploymentServiceHelper;
+
+ /**
+ * @see org.jboss.admin.service.jms.JmsService#getJmsAttributes()
+ */
+ public Jms getJmsAttributes() {
+ Jms jms = new Jms();
+ getMBeanServerHelper().populateJmsData(jms);
+ return jms;
+ }
+
+ /**
+ * @see org.jboss.admin.service.jms.JmsService#saveJmsAttributes()
+ */
+ public void saveJmsAttributes(Jms jms) throws JmsServiceException {
+ getDeploymentServiceHelper().updateJmsAttributes(jms);
+ }
+
+ /**
+ * Check if mbeanServerHelper is null before creating a new
+ * MBeanServerHelper. This supports having tests supply their own mock
+ * implementation
+ *
+ * @return an object of MBeanServerDestinationHelper
+ */
+ protected MBeanServerJmsHelper getMBeanServerHelper() {
+ if (mbeanServerHelper == null) {
+ mbeanServerHelper = new MBeanServerJmsHelper(MBeanServerLocator
+ .locateJBoss());
+ }
+ return mbeanServerHelper;
+ }
+
+ /**
+ * Check if deploymentServiceHelper is null before creating a new
+ * DeploymentServiceHelper. This supports having tests supply their own mock
+ * implementation
+ *
+ * @return an object of DeploymentServerDestinationHelper
+ */
+ protected DeploymentServiceJmsHelper getDeploymentServiceHelper() {
+ if (deploymentServiceHelper == null) {
+ deploymentServiceHelper = new DeploymentServiceJmsHelper(
+ getMBeanServerHelper());
+ }
+ return deploymentServiceHelper;
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceRuntimeException.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceRuntimeException.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/JmsServiceRuntimeException.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.service.AdminConsoleRuntimeException;
+
+/**
+ * Class encapsulating exceptions from executing the DestinationService which
+ * the clients should be expected to handle gracefully.
+ *
+ * @author <a href="peter.johnson2 at unisys.com">Peter Johnson </a>
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @version $Revision: 56034 $
+ */
+public class JmsServiceRuntimeException extends
+ AdminConsoleRuntimeException {
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Logger for this class
+ */
+ private final Log logger = LogFactory
+ .getLog(JmsServiceRuntimeException.class);
+
+ /**
+ * The id number for the error. The error id numbers are listed in the Error
+ * class.
+ *
+ * @see org.jboss.admin.service.jms.Error
+ */
+ private int id;
+
+ /**
+ * Default constructor
+ */
+ public JmsServiceRuntimeException() {
+ super();
+ }
+
+ /**
+ * Constructs a destination runtime exception based on a given Error object.
+ *
+ * @param err
+ * Identifies the error.
+ */
+ public JmsServiceRuntimeException(Error err) {
+ super(err.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + err.toString() + ")");
+ }
+ id = err.getId();
+ }
+
+ /**
+ * Constructs a destination runtime exception based on a given exception
+ * object.
+ *
+ * @param e
+ * The exception that caused this exception.
+ */
+ public JmsServiceRuntimeException(Throwable e) {
+ super(e);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + e + ")");
+ }
+ }
+
+ /**
+ * Constructs an destination runtime exception based on a given Error object
+ * and, an excpetion that caused this exception.
+ *
+ * @param err
+ * Identifies the error.
+ * @param e
+ * The exception that caused this exception.
+ */
+ public JmsServiceRuntimeException(Error err, Throwable e) {
+ super(err.getMessage(), e);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ctor(" + err.toString() + ", " + e + ")");
+ }
+ id = err.getId();
+ }
+
+ /**
+ * Gets the error id number. The id numbers are listed in the Error class.
+ *
+ * @return The error id number.
+ * @see org.jboss.admin.service.jms.Error
+ */
+ public int getId() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getId(): " + id);
+ }
+ return id;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerDestinationHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerDestinationHelper.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerDestinationHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,421 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.admin.AdminConstants;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationMessage;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+import org.jboss.admin.service.MBeanServerHelper;
+import org.jboss.admin.service.jms.Constants;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Contains Destination specific attributes and methods related to accessing the
+ * MBeanServer.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class MBeanServerDestinationHelper extends MBeanServerHelper {
+ private static Log logger = LogFactory
+ .getLog(MBeanServerDestinationHelper.class);
+
+ /**
+ * The name of the key in the destination MBeans ObjectName which stores the
+ * type information
+ */
+ private static final String DESTINATION_SERVICE_KEY = "service";
+
+ /**
+ * The value corresponding to the DESTINATION_SERVICE_KEY in the destination
+ * MBean's ObjectName
+ */
+ private static final String QUEUE_DESTINATION_SERVICE_VALUE = "Queue",
+ TOPIC_DESTINATION_SERVICE_VALUE = "Topic";
+
+ /**
+ * String used to filter the destination queue mbeans
+ */
+ private static final String DESTINATION_QUEUE_MBEAN_FILTER = "jboss.messaging.destination:service=Queue,*";
+
+ /**
+ * String used to filter the destination topic mbeans
+ */
+ private static final String DESTINATION_TOPIC_MBEAN_FILTER = "jboss.messaging.destination:service=Topic,*";
+
+ /**
+ * Constant strings used in the class
+ */
+ private static final String DESTINATION_LIST_MESSAGES_NAME = "listMessages",
+ DESTINATION_LIST_DURABLE_SUBSCRIPTIONS_NAME = "listDurableSubscriptions",
+ DESTINATION_LIST_NONDURABLE_SUBSCRIPTIONS_NAME = "listNonDurableSubscriptions",
+ DESTINATION_REMOVE_ALL_MESSAGES_NAME = "removeAllMessages",
+ SUBSCRIPTION_COUNT = "subscriptionCount";
+
+ /**
+ * constructor
+ */
+ public MBeanServerDestinationHelper(MBeanServer mbeanServer) {
+ super(mbeanServer);
+ }
+
+ /**
+ * public no-arg constructor required for tests
+ */
+ public MBeanServerDestinationHelper() {
+ super();
+ }
+
+ /**
+ * Get all ObjectNames of a specific destination type (queue or topic)
+ *
+ * @param type
+ * @return a set of ObjectNames
+ */
+ protected Set getAllDestinationObjectNamesByType(String type) {
+ ObjectName filterName = null;
+ try {
+ if (Queue.class.getName().equals(type)) {
+ filterName = new ObjectName(DESTINATION_QUEUE_MBEAN_FILTER);
+ } else if (Topic.class.getName().equals(type)) {
+ filterName = new ObjectName(DESTINATION_TOPIC_MBEAN_FILTER);
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.INVALID_DESTINATION_TYPE, new String[] { type }));
+ }
+ return getMBeanServer().queryNames(filterName, null);
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with
+ */
+ } catch (Exception e) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_GET_DESTINATION_MBEANS, null), e);
+ }
+ }
+
+ /**
+ * Get the type of the destination (queue or topic) from an ObjectName
+ *
+ * @param destinationObjectName
+ * @return the type of the destination as a string
+ */
+ public String getDestinationTypeName(ObjectName destinationObjectName) {
+ String typeName;
+ String destinationServiceValue = destinationObjectName
+ .getKeyProperty(DESTINATION_SERVICE_KEY);
+ if (destinationServiceValue != null) {
+ if (QUEUE_DESTINATION_SERVICE_VALUE.equals(destinationServiceValue)) {
+ typeName = Queue.class.getName();
+ } else if (TOPIC_DESTINATION_SERVICE_VALUE
+ .equals(destinationServiceValue)) {
+ typeName = Topic.class.getName();
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.INVALID_DESTINATION_TYPE,
+ new String[] { destinationServiceValue }));
+ }
+ } else {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.DESTINATION_TYPE_IS_NULL, null));
+ }
+ return typeName;
+ }
+
+ /**
+ * Populate the destination with all attribute values
+ *
+ * @param destinationObjectName
+ * @param destination
+ */
+ protected void populateDestinationData(ObjectName destinationObjectName,
+ Destination destination) {
+ /*
+ * Set common destinatin attributes:
+ */
+ destination.setName(getMBeanStringAttribute(destinationObjectName,
+ Constants.CommonAttributes.NAME));
+ destination.setJndiName(getMBeanStringAttribute(destinationObjectName,
+ Constants.CommonAttributes.JNDI_NAME));
+ destination.setCreatedProgrammatically(getMBeanBooleanAttribute(destinationObjectName,
+ Constants.CommonAttributes.CREATED_PROGRAMMATICALLY));
+ destination.setDownCacheSize(getMBeanIntAttribute(
+ destinationObjectName,
+ Constants.CommonAttributes.DOWN_CACHE_SIZE));
+ destination.setFullSize(getMBeanIntAttribute(destinationObjectName,
+ Constants.CommonAttributes.FULL_SIZE));
+ destination.setPageSize(getMBeanIntAttribute(
+ destinationObjectName,
+ Constants.CommonAttributes.PAGE_SIZE));
+ Element elem = (Element) getMBeanAttribute(
+ destinationObjectName,
+ Constants.CommonAttributes.SECURITY_CONFIG);
+ destination.setSecurityConfig(elem);
+ destination.setSecurityRoles(convertSecurityConfigToText(elem));
+
+ try {
+ ObjectName serverPeerObjectName = getMBeanObjectNameAttribute(
+ destinationObjectName,
+ Constants.CommonAttributes.SERVER_PEER);
+ if (serverPeerObjectName != null && !"".equals(serverPeerObjectName)) {
+ destination.setServerPeerName(serverPeerObjectName
+ .getCanonicalName());
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger
+ .debug("Failed to get DestinationManager ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+
+ /*
+ * Set Queue specific attributes:
+ */
+ if (destination instanceof Queue) {
+ ((Queue) destination).setMessageCount(getMBeanIntAttribute(
+ destinationObjectName,
+ Constants.QueueAttributes.MESSAGE_COUNT));
+ }
+
+ /*
+ * Set Topic specific attributes:
+ */
+ if (destination instanceof Topic) {
+ Object[] paramTrue = { Boolean.TRUE };
+ Object[] paramFalse = { Boolean.FALSE};
+ String[] signature = { "boolean" };
+ try {
+ Integer durableSubCount = (Integer) getMBeanServer().invoke(
+ destinationObjectName, SUBSCRIPTION_COUNT,
+ paramTrue, signature);
+ ((Topic) destination).setDurableSubCount(durableSubCount.intValue());
+ Integer nonDurableSubCount = (Integer) getMBeanServer().invoke(
+ destinationObjectName, SUBSCRIPTION_COUNT,
+ paramFalse, signature);
+ ((Topic) destination).setNonDurableSubCount(nonDurableSubCount.intValue());
+ Integer allSubCount = (Integer) getMBeanServer().invoke(
+ destinationObjectName, SUBSCRIPTION_COUNT,
+ null, null);
+ ((Topic) destination).setAllSubCount(allSubCount.intValue());
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_INVOKE_MBEAN_OPERATION, null), e);
+ }
+ }
+ }
+
+ /**
+ * Gets all the messages currently stored in the specified queue
+ *
+ * @param destinationObjectName
+ * @return A list of DestinationMessage objects
+ */
+ protected List getQueueMessages(ObjectName destinationObjectName) {
+ List destMessages = null;
+ try {
+ Object[] params = { "" };
+ String[] signature = { "java.lang.String" };
+ List messages = (List) getMBeanServer().invoke(
+ destinationObjectName, DESTINATION_LIST_MESSAGES_NAME,
+ params, signature);
+
+ /*
+ * Construct DestinationMessage objects for jsp display:
+ */
+ destMessages = buildDestinationMessages(messages);
+
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_LIST_DESTINATION_MESSAGES, null), e);
+ }
+ return destMessages;
+ }
+
+ /**
+ * Gets all the messages currently stored in the specified topic for the
+ * specified subscriber.
+ *
+ * @param destinationObjectName
+ * @return A list of DestinationMessage objects
+ */
+ protected List getTopicMessages(ObjectName destinationObjectName,
+ String subscriptionID) {
+ List destMessages = null;
+ try {
+ Object[] params = { subscriptionID };
+ String[] signature = { "java.lang.String" };
+ List messages = (List) getMBeanServer().invoke(
+ destinationObjectName, DESTINATION_LIST_MESSAGES_NAME,
+ params, signature);
+
+ /*
+ * Construct DestinationMessage objects for jsp display:
+ */
+ destMessages = buildDestinationMessages(messages);
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_LIST_DESTINATION_MESSAGES, null), e);
+ }
+ return destMessages;
+ }
+
+ /**
+ * Construct DestinationMessages from a list of JBossMessage objects so jsp
+ * tag library can access the information conveniently.
+ *
+ * @param messages
+ * a list of JBossMessages
+ * @return A list of DestinationMessage objects
+ */
+ private List buildDestinationMessages(List messages) {
+ List destMessages = new ArrayList();
+ for (Iterator iter = messages.iterator(); iter.hasNext();) {
+ Message jmsMsg = (Message) iter.next();
+ DestinationMessage destMsg = new DestinationMessage(jmsMsg);
+
+ if (jmsMsg instanceof TextMessage) {
+ destMsg.setMsgType(TextMessage.class.getName());
+
+ try {
+ destMsg.setMsgBody(((TextMessage) jmsMsg).getText());
+ } catch (JMSException e) {
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_LIST_DESTINATION_MESSAGES, null), e);
+ }
+ } else if (jmsMsg instanceof BytesMessage) {
+ destMsg.setMsgType(BytesMessage.class.getName());
+ } else if (jmsMsg instanceof MapMessage) {
+ destMsg.setMsgType(MapMessage.class.getName());
+ } else if (jmsMsg instanceof ObjectMessage) {
+ destMsg.setMsgType(ObjectMessage.class.getName());
+ } else if (jmsMsg instanceof StreamMessage) {
+ destMsg.setMsgType(StreamMessage.class.getName());
+ }
+
+ destMessages.add(destMsg);
+ }
+ return destMessages;
+ }
+
+ /**
+ * Gets the durable subscriptions of the specified topic
+ *
+ * @param destinationObjectName
+ * @return A list of subscriptions
+ */
+ protected List getDurableSubscriptions(ObjectName destinationObjectName) {
+ List durableSubscriptions = null;
+ try {
+ durableSubscriptions = (List) getMBeanServer().invoke(
+ destinationObjectName,
+ DESTINATION_LIST_DURABLE_SUBSCRIPTIONS_NAME, null, null);
+
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_LIST_SUB_SCRIPTIONS, null), e);
+ }
+ return durableSubscriptions;
+ }
+
+ /**
+ * Gets the non-durable subscriptions of the specified topic
+ *
+ * @param destinationObjectName
+ * @return A list of subscriptions
+ */
+ protected List getNonDurableSubscriptions(ObjectName destinationObjectName) {
+ List nonDurableSubscriptions = null;
+ try {
+ nonDurableSubscriptions = (List) getMBeanServer().invoke(
+ destinationObjectName,
+ DESTINATION_LIST_NONDURABLE_SUBSCRIPTIONS_NAME, null, null);
+
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_LIST_SUB_SCRIPTIONS, null), e);
+ }
+ return nonDurableSubscriptions;
+ }
+
+ /**
+ * Removes all the messages from the specified destination
+ *
+ * @param destinationObjectName
+ */
+ protected void removeDestinationMessages(ObjectName destinationObjectName) {
+ try {
+ getMBeanServer().invoke(destinationObjectName,
+ DESTINATION_REMOVE_ALL_MESSAGES_NAME, null, null);
+ } catch (Exception e) {
+ /*
+ * a bunch of stuff can get thrown here, none on which we can deal
+ * with:
+ */
+ throw new JmsServiceRuntimeException(new Error(
+ Error.FAILED_REMOVE_DESTINATION_MESSAGES, null), e);
+ }
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerJmsHelper.java
===================================================================
--- projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerJmsHelper.java (rev 0)
+++ projects/admin-console/trunk/src/main/org/jboss/admin/service/jms/MBeanServerJmsHelper.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,298 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin.service.jms;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.model.datasource.DataSource;
+import org.jboss.admin.model.datasource.LocalTxDataSource;
+import org.jboss.admin.model.datasource.NoTxDataSource;
+import org.jboss.admin.model.datasource.XATxDataSource;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.service.MBeanServerHelper;
+import org.jboss.admin.service.datasource.DataSourceService;
+import org.jboss.admin.service.datasource.DataSourceServiceImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Contains JBossMQ specific attributes and methods related to accessing the
+ * MBeanServer.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class MBeanServerJmsHelper extends MBeanServerHelper {
+ private static Log logger = LogFactory.getLog(MBeanServerJmsHelper.class);
+
+ /**
+ * This service is used to look up all the data sources. The variable is
+ * available for testing by calling setDataSource( datasource ) with a mock
+ * DataSource object.
+ */
+ private DataSourceService dataSource;
+
+ /**
+ * constructor
+ */
+ public MBeanServerJmsHelper(MBeanServer mbeanServer) {
+ super(mbeanServer);
+ }
+
+ /**
+ * public no-arg constructor required for tests
+ */
+ public MBeanServerJmsHelper() {
+ super();
+ }
+
+ /**
+ * Populate the Jms object with attribute values from various MBeans
+ *
+ * @param jms
+ * The Jms object
+ */
+ protected void populateJmsData(Jms jms) {
+ ObjectName connectionFactory = null;
+ ObjectName serverPeer = null;
+ ObjectName persistenceManager = null;
+ ObjectName userManager = null;
+
+ /*
+ * Get the ObjectName of the ConectionFactory:
+ */
+
+ try {
+ connectionFactory = new ObjectName(Constants.JmsAttributes.CONNECTION_FACTORY_NAME);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get ConnectionFactory ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+
+
+ /*
+ * Get attributes from the ConnectionFactory MBean:
+ */
+ if (connectionFactory != null) {
+ try {
+ ObjectName connector = getMBeanObjectNameAttribute(
+ connectionFactory, Constants.JmsAttributes.CONNECTOR);
+ if (connector != null && !connector.equals("")) {
+ jms.setConnectorName(connector.getCanonicalName());
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get Connector ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+ jms.setDefaultTempQueueDownCacheSize(getMBeanIntAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_DOWN_CACHE_SIZE));
+ jms.setDefaultTempQueueFullSize(getMBeanIntAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_FULL_SIZE));
+ jms.setDefaultTempQueuePageSize(getMBeanIntAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_PAGE_SIZE));
+ jms.setPrefetchSize(getMBeanIntAttribute(connectionFactory,
+ Constants.JmsAttributes.PREFETCH_SIZE));
+ try {
+ serverPeer = getMBeanObjectNameAttribute(
+ connectionFactory, Constants.JmsAttributes.SERVER_PEER);
+ if (serverPeer != null && !serverPeer.equals("")) {
+ jms.setServerPeerName(serverPeer.getCanonicalName());
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get ServerPeer ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+ }
+
+ /*
+ * Get attributes from the ServerPeer MBean:
+ */
+ if (serverPeer != null) {
+ jms.setDefaultQueueJNDIContext(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.DEFAULT_QUEUE_JNDI_CONTEXT));
+
+ Element elem = (Element) getMBeanAttribute(
+ serverPeer,
+ Constants.JmsAttributes.DEFAULT_SECURITY_CONFIG);
+ jms.setDefaultSecurityConfig(elem);
+ jms.setDefaultSecurityRoles(convertSecurityConfigToText(elem));
+
+ jms.setDefaultTopicJNDIContext(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.DEFAULT_TOPIC_JNDI_CONTEXT));
+ jms.setJmsProviderName(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.JMS_PROVIDER_NAME));
+ jms.setJmsVersion(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.JMS_VERSION));
+ try {
+ persistenceManager = getMBeanObjectNameAttribute(
+ serverPeer, Constants.JmsAttributes.PERSISTENCE_MANAGER);
+ if (persistenceManager != null && !persistenceManager.equals("")) {
+ jms.setPersistenceManagerName(persistenceManager.getCanonicalName());
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get PersistenceManager ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+ jms.setProviderVersion(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.PROVIDER_VERSION));
+ jms.setQueuedExecutorPoolSize(getMBeanIntAttribute(serverPeer,
+ Constants.JmsAttributes.QUEUED_EXECUTOR_POOL_SIZE));
+ jms.setSecurityDomain(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.SECURITY_DOMAIN));
+ jms.setServerPeerID(getMBeanStringAttribute(serverPeer,
+ Constants.JmsAttributes.SERVER_PEER_ID));
+ }
+
+ /*
+ * Get attributes from the PersistenceManager MBean:
+ */
+ if (persistenceManager != null) {
+ jms.setCreateMsgTablesOnStartup(getMBeanBooleanAttribute(persistenceManager,
+ Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP));
+ jms.setMsgDataSource(getMBeanStringAttribute(persistenceManager,
+ Constants.JmsAttributes.DATA_SOURCE));
+ // Get rid of the jndi prefix:
+ String dataSourceName = jms.getMsgDataSource();
+ int inx = dataSourceName.indexOf("/");
+ dataSourceName = dataSourceName.substring(inx+1);
+ jms.setMsgDataSourceName(dataSourceName);
+
+ jms.setMaxParams(getMBeanIntAttribute(persistenceManager,
+ Constants.JmsAttributes.MAX_PARAMS));
+ jms.setMsgSqlProperties(getMBeanStringAttribute(persistenceManager,
+ Constants.JmsAttributes.SQL_PROPERTIES));
+ try {
+ ObjectName transactionManager = getMBeanObjectNameAttribute(
+ persistenceManager,
+ Constants.JmsAttributes.TRANSACTION_MANAGER);
+ if (transactionManager != null && !transactionManager.equals("")) {
+ jms.setTransactionManagerName(transactionManager.getCanonicalName());
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger
+ .debug("Failed to get TransactionManager ObjectName, cause:");
+ logger.error(e);
+ }
+ }
+ jms.setUsingBatchUpdates(getMBeanBooleanAttribute(persistenceManager,
+ Constants.JmsAttributes.USING_BATCH_UPDATES));
+ }
+
+ /*
+ * Get attributes from the JMSUserManager MBean:
+ */
+ if (userManager != null) {
+ jms.setCreateUserTablesOnStartup(getMBeanBooleanAttribute(userManager,
+ Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP));
+ jms.setUserDataSource(getMBeanStringAttribute(userManager,
+ Constants.JmsAttributes.DATA_SOURCE));
+ // Get rid of the jndi prefix:
+ String dataSourceName = jms.getUserDataSource();
+ int inx = dataSourceName.indexOf("/");
+ dataSourceName = dataSourceName.substring(inx+1);
+ jms.setUserDataSourceName(dataSourceName);
+
+ jms.setUserSqlProperties(getMBeanStringAttribute(userManager,
+ Constants.JmsAttributes.SQL_PROPERTIES));
+ }
+
+ /*
+ * Setup the dataSources map:
+ */
+ jms.setDataSources(buildDataSourceMap());
+ }
+
+ /**
+ * Build a map of dataSources where the key of the map entry is the
+ * dataSource name, and the value is its driver class.
+ *
+ * @return The dataSource map.
+ */
+ protected Map buildDataSourceMap() {
+ Map dsMap = new HashMap();
+ List dataSources = null;
+ DataSource ds = null;
+ String dsName = "";
+ String dsClass = "";
+ DataSourceService dsService = getDataSource();
+
+ dataSources = dsService.getNoTxDataSources();
+ Iterator i = dataSources.iterator();
+ while (i.hasNext()) {
+ ds = (DataSource) i.next();
+ ds = dsService.getDataSource(ds.getIdentifier());
+ dsName = ds.getJNDIname();
+ dsClass = ((NoTxDataSource) ds).getDriverClassName();
+ dsMap.put(dsName.trim(), dsClass.trim());
+ }
+
+ dataSources = dsService.getLocalTxDataSources();
+ i = dataSources.iterator();
+ while (i.hasNext()) {
+ ds = (DataSource) i.next();
+ ds = dsService.getDataSource(ds.getIdentifier());
+ dsName = ds.getJNDIname();
+ dsClass = ((LocalTxDataSource) ds).getDriverClassName();
+ dsMap.put(dsName.trim(), dsClass.trim());
+ }
+
+ dataSources = dsService.getXATxDataSources();
+ i = dataSources.iterator();
+ while (i.hasNext()) {
+ ds = (DataSource) i.next();
+ ds = dsService.getDataSource(ds.getIdentifier());
+ dsName = ds.getJNDIname();
+ dsClass = ((XATxDataSource) ds).getDataSourceClassName();
+ dsMap.put(dsName.trim(), dsClass.trim());
+ }
+
+ return dsMap;
+ }
+
+ private DataSourceService getDataSource() {
+ if (dataSource == null) {
+ dataSource = new DataSourceServiceImpl();
+ }
+ return dataSource;
+ }
+
+ protected void setDataSource(DataSourceService dataSource) {
+ this.dataSource = dataSource;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/classes/messages/jmsmessages.properties
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/classes/messages/jmsmessages.properties (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/classes/messages/jmsmessages.properties 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,222 @@
+#####################################################################
+#
+# File: jmsmessages.properties.
+#
+#
+# This file will hold all of the JMS-related strings.
+#
+#####################################################################
+
+
+#####################################################
+# Navigation
+#####################################################
+navigation.destination.title=Destinations:
+navigation.destination.item.queue=Queues
+navigation.destination.item.topic=Topics
+
+#####################################################
+# JMS text
+#####################################################
+jms.section.heading.manage=Manage JBoss Messaging:
+jms.section.heading.settings.page=Settings
+jms.section.heading.more.page=More...
+jms.section.heading.msgSql.page=Message SQL
+jms.section.heading.userSql.page=User SQL
+jms.section.heading.configurable=Configurable Attributes
+jms.section.heading.readonly=Read-Only Attributes
+jms.section.heading.msgSql=SQL Properties for Message Persistence
+jms.section.heading.userSql=SQL Properties for user info Persistence
+
+#page1
+jms.view.defaultTempQueueDownCacheSize=Default Temp Queue Down Cache Size:
+jms.view.defaultTempQueueFullSize=Default Temp Queue Full Size:
+jms.view.defaultTempQueuePageSize=Default Temp Queue Page Size:
+jms.view.prefetchSize=Prefetch Size:
+jms.view.defaultSecurityRoles=Default Security Roles:
+jms.view.queuedExecutorPoolSize=Queued Executor Pool Size:
+jms.view.securityDomain=Security Domain:
+jms.view.createMsgTablesOnStartup=Create Msg Tables On Startup:
+jms.view.maxParams=Max Params:
+jms.view.msgDataSource=Msg Data Source:
+jms.view.usingBatchUpdates=Using Batch Updates:
+jms.view.createUserTablesOnStartup=Create User Tables On Startup:
+jms.view.userDataSource=User Data Source:
+
+#page2
+jms.view.defaultQueueJNDIContext=Default Queue JNDI Context:
+jms.view.defaultTopicJNDIContext=Default Topic JNDI Context:
+jms.view.jmsVersion=JMS Version:
+jms.view.jmsProviderName=JMS Provider Name:
+jms.view.providerVersion=Provider Version:
+jms.view.serverPeerID=Server Peer ID:
+
+jms.update.success=JMS attributes have been updated successfully
+jms.update.failure=Failed to update the JMS attributes
+
+
+#####################################################
+# Destination text
+#####################################################
+destination.list.destinations.page.header=Destinations
+destination.list.destinations.queue.header=Queues:
+destination.list.destinations.topic.header=Topics:
+
+destination.list.destinations.queue.empty.header=No queues are currently defined
+destination.list.destinations.topic.empty.header=No topics are currently defined
+
+destination.section.heading.create=Create
+destination.section.heading.view=View
+destination.section.heading.topic=Topic:
+destination.section.heading.queue=Queue:
+destination.section.heading.settings.page=Settings
+destination.section.heading.more.page=More...
+destination.section.heading.configurable=Configurable Attributes
+destination.section.heading.readonly=Read-Only Attributes
+destination.section.heading.messages.page=Messages
+destination.section.heading.subscriptions.page=Subscriptions
+
+destination.list.header.name=Name
+destination.list.header.jndiname=JNDI Name
+destination.list.header.deploymentStatus=Deployment Status
+destination.list.header.view=View
+destination.list.header.remove=Remove
+destination.list.header.viewMessage=Message
+
+#page1
+destination.view.name=Name:
+destination.view.jndiName=JNDI Name:
+destination.view.downCacheSize=Down Cache Size:
+destination.view.fullSize=Full Size:
+destination.view.pageSize=Page Size:
+destination.view.securityRoles=Security Roles:
+
+#page2
+destination.view.createdProgrammatically=Created Programmatically?
+destination.view.messageCount=Message Count:
+destination.view.durableSubCount=Durable Subscription Count:
+destination.view.nonDurableSubCount=Non-Durable Subscription Count:
+destination.view.allSubCount=All Subscription Count:
+
+#Other page
+#destination.view.msgCounter=Message counter
+#destination.view.msgStatistics=Message statistics
+
+destination.create.success=Destination has been created successfully, but may not yet have been deployed. If the destination you created is not in the list please wait a few seconds and click the Refresh List button.
+destination.create.failure=Failed to create the destination, please check the server log file for detail.
+destination.update.success=Destination has been updated successfully, but may not yet have been deployed. If the destination you updated is not in the list please wait a few seconds and click the Refresh List button.
+destination.update.failure=Failed to update the destination, please check the server log file for detail.
+destination.remove.success=The process of removing the {0} has been started successfully, but may not yet have completed. If the {0} you removed is still in the list please wait a few seconds and click the Refresh List button.
+destination.remove.failure=Failed to remove the {0}, please check the server log file for detail.
+
+# 0 - topic or queue
+# 1 - name
+destination.remove.confirm=Are you sure that you want to remove {0} {1}?
+
+# View Messages
+destination.msg.view.messages.page.header=Destination Messages: {0}/{1}
+destination.msg.view.subscriptions.page.header=Subscriptions: {0}/{1}
+destination.msg.view.durableSubscriptions.page.header=Durable Subscriptions
+destination.msg.view.nonDurableSubscriptions.page.header=Non-durable Subscriptions
+destination.msg.view.queueMessages.empty=No messages found
+destination.msg.view.topicMessages.empty=No messages found for the specified subscription
+destination.msg.view.durableSubscriptions.empty=No durable subscriptions found
+destination.msg.view.nonDurableSubscriptions.empty=No non-durable subscriptions found
+destination.msg.removeMessage.success=Destination messages were removed
+
+destination.msg.view.header.jmsDeliveryMode=JmsDeliveryMode
+destination.msg.view.header.jmsExpiration=JmsExpiration
+destination.msg.view.header.jmsPriority=JmsPriority
+destination.msg.view.header.jmsMessageID=JmsMessageID
+destination.msg.view.header.jmsTimeStamp=JmsTimeStamp
+destination.msg.view.header.jmsCorrelationID=JmsCorrelationID
+destination.msg.view.header.jmsReplyTo=JmsReplyTo
+destination.msg.view.header.jmsType=JmsType
+destination.msg.view.header.jmsRedelivered=JmsRedelivered
+destination.msg.view.header.jmsProperties=JmsProperties
+destination.msg.view.header.jmsPropReadWrite=jmsPropReadWrite
+destination.msg.view.header.msgReadOnly=MsgReadOnly
+destination.msg.view.header.producerClientId=producerClientId
+destination.msg.view.body=Message Body
+
+destination.subs.view.header.clientID=Client ID
+destination.subs.view.header.subName=Subscription Name
+destination.subs.view.header.subID=Subscription ID
+destination.subs.view.header.sessionID= Session ID
+destination.subs.view.header.selector=Selector
+destination.subs.view.header.msgSelector=Message Selector
+destination.subs.view.header.noLocal=No Local
+destination.subs.view.header.destroyDurableSub=Destroy Durable Subscription
+destination.subs.view.header.message=Message
+
+destination.button.remove=Remove
+destination.button.test=Test
+destination.button.view=View
+destination.button.viewData=View Data
+destination.button.create=Create
+destination.button.save=Save
+destination.button.refresh=Refresh List
+destination.button.cancel=Cancel
+destination.button.viewMessages=View Messages
+destination.button.removeMessages=Remove All Messages
+destination.button.resetMessageCounter=Reset Message Counter
+destination.button.resetMessageCounterHistory=Reset Message Counter History
+
+destination.error.pageSizeTooSmall=Page size cannot be smaller than Down cache size
+
+#################################
+# Struts Validator Error Messages
+#################################
+errors.required={0} is required.
+errors.minlength={0} can not be less than {1} characters.
+errors.maxlength={0} can not be greater than {1} characters.
+errors.invalid={0} is invalid.
+
+errors.byte={0} must be a byte.
+errors.short={0} must be a short.
+errors.integer={0} must be an integer.<br/>
+errors.long={0} must be a long.
+errors.float={0} must be a float.
+errors.double={0} must be a double.
+
+errors.date={0} is not a date.
+errors.range={0} is not in the range {1} through {2}.
+errors.creditcard={0} is an invalid credit card number.
+errors.email={0} is an invalid e-mail address.
+
+errors.class={0} must be a valid class name.
+
+
+#################################
+# Exception Messages
+#################################
+
+# {0} - the error id number
+# {1} - the error text
+jms.error.format={1} [{0}]
+
+# {0} - the name of the destination type
+101=Destination type {0} is invalid
+102=Null destination service value returned
+103=The identifier constructor argument cannot be null
+104=The identifier argument must contain a separator
+105=Failed to create module
+106=Failed to deploy module
+107=Failed to undeploy module
+108=Failed to remove module
+109=The specified DestinationIdentifier is null
+110=Module name on the specified DestinationIdentifier is null
+111=Failed to call the DeploymentService.getDeployedURL() method
+112=Failed to get destination MBeans
+113=Failed to create MBean from the DestinationIdentifier
+114=Failed to list deployed modules
+115=Failed to list destination messages
+116=Failed to list receivers
+117=Failed to list subscriptions
+118=Failed to get message statistics
+119=Failed to list message counter history
+120=Failed to remove destination messages
+121=Failed to reset message counter
+122=Failed to reset message counter history
+123=Failed to update mbean attributes
+124=Failed to invoke mbean operation
Modified: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/common/validator-rules.xml
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/common/validator-rules.xml 2007-01-18 18:04:03 UTC (rev 59791)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/common/validator-rules.xml 2007-01-18 18:44:12 UTC (rev 59792)
@@ -269,7 +269,7 @@
msg="errors.url"/>
<validator name="classFound"
- classname="org.jboss.admin.console.web.struts.jms.DestinationInputsValidator"
+ classname="org.jboss.admin.console.web.struts.jbossmq.DestinationInputsValidator"
method="validateClassFound"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
Added: projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteModelJms.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteModelJms.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteModelJms.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin;
+
+import org.jboss.admin.model.jms.DestinationIdentifierTest;
+import org.jboss.admin.model.jms.DestinationMessageTest;
+import org.jboss.admin.model.jms.DestinationTest;
+import org.jboss.admin.model.jms.JmsTest;
+import org.jboss.admin.model.jms.QueueTest;
+import org.jboss.admin.model.jms.TopicTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestSuiteModelJms {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.jboss.admin.model.jms");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(JmsTest.class);
+ suite.addTestSuite(QueueTest.class);
+ suite.addTestSuite(DestinationTest.class);
+ suite.addTestSuite(DestinationMessageTest.class);
+ suite.addTestSuite(TopicTest.class);
+ suite.addTestSuite(DestinationIdentifierTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added: projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteServiceJms.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteServiceJms.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteServiceJms.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin;
+
+import org.jboss.admin.service.jms.DeploymentServiceDestinationHelperTest;
+import org.jboss.admin.service.jms.DeploymentServiceJmsHelperTest;
+import org.jboss.admin.service.jms.MBeanServerDestinationHelperTest;
+import org.jboss.admin.service.jms.MBeanServerJmsHelperTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestSuiteServiceJms {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.jboss.admin.service.jms");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(MBeanServerDestinationHelperTest.class);
+ suite.addTestSuite(MBeanServerJmsHelperTest.class);
+ suite.addTestSuite(DeploymentServiceJmsHelperTest.class);
+ suite.addTestSuite(DeploymentServiceDestinationHelperTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added: projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteStrutsJms.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteStrutsJms.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/TestSuiteStrutsJms.java 2007-01-18 18:44:12 UTC (rev 59792)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jboss.admin;
+
+import org.jboss.admin.console.web.struts.jms.CreateDestinationActionTest;
+import org.jboss.admin.console.web.struts.jms.ListDestinationsActionTest;
+import org.jboss.admin.console.web.struts.jms.RemoveDestinationActionTest;
+import org.jboss.admin.console.web.struts.jms.RemoveMessagesActionTest;
+import org.jboss.admin.console.web.struts.jms.SaveDestinationActionTest;
+import org.jboss.admin.console.web.struts.jms.SaveJmsActionTest;
+import org.jboss.admin.console.web.struts.jms.ViewDestinationActionTest;
+import org.jboss.admin.console.web.struts.jms.ViewJmsActionTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestSuiteStrutsJms {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.jboss.admin.console.web.struts.jms");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ListDestinationsActionTest.class);
+ suite.addTestSuite(RemoveMessagesActionTest.class);
+ suite.addTestSuite(SaveDestinationActionTest.class);
+ suite.addTestSuite(ViewJmsActionTest.class);
+ suite.addTestSuite(ViewDestinationActionTest.class);
+ suite.addTestSuite(RemoveDestinationActionTest.class);
+ suite.addTestSuite(SaveJmsActionTest.class);
+ suite.addTestSuite(CreateDestinationActionTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
More information about the jboss-cvs-commits
mailing list