Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C400C200C2B for ; Wed, 15 Feb 2017 23:42:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C1A20160B88; Wed, 15 Feb 2017 22:42:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9210C160B5E for ; Wed, 15 Feb 2017 23:42:43 +0100 (CET) Received: (qmail 71300 invoked by uid 500); 15 Feb 2017 22:42:42 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 71167 invoked by uid 99); 15 Feb 2017 22:42:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2017 22:42:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9BBBFDFE41; Wed, 15 Feb 2017 22:42:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cdutz@apache.org To: commits@flex.apache.org Date: Wed, 15 Feb 2017 22:42:43 -0000 Message-Id: In-Reply-To: <299783f720494887a2a646a2035519f4@git.apache.org> References: <299783f720494887a2a646a2035519f4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/51] [partial] flex-blazeds git commit: - Major code scrub archived-at: Wed, 15 Feb 2017 22:42:46 -0000 http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/log/LogManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/log/LogManager.java b/core/src/main/java/flex/management/runtime/messaging/log/LogManager.java new file mode 100644 index 0000000..b9c63b5 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/log/LogManager.java @@ -0,0 +1,260 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package flex.management.runtime.messaging.log; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.lang.reflect.Field; + +import flex.management.ManageableComponent; +import flex.messaging.config.ConfigurationException; +import flex.messaging.log.Log; +import flex.messaging.log.LogCategories; +import flex.messaging.log.Target; + + +/** + * The LogManager is an interface between the Log and the LogControl which exists + * because Log lives in the common package, so it cannot extend ManageableComponent itself, + * which is necessary for a class to be exposed through MBeans. + */ +public class LogManager extends ManageableComponent +{ + + private static final String LOG_CATEGORY = LogCategories.CONFIGURATION; // Log category used by LogManager (ManageableComponent) + private static final int NULL_LOG_REF_EXCEPTION = 10031; + + private Log log; + private String ID = "log"; + private CategoryManager categoryManager; + private LogControl controller; + + private boolean isSetup; + + /** + * Public constructor required by ManageableComponent. + */ + public LogManager() + { + this(true); + } + + public LogManager(boolean enableManagement) + { + super(enableManagement); + setId(ID); + + categoryManager = new CategoryManager(); + + } + + + public void setupLogControl() + { + if (!isSetup) + { + controller = new LogControl(getParent().getControl(), this); + setControl(controller); + controller.register(); + isSetup = true; + } + } + + public void stop() + { + if (!isStarted()) + { + return; + } + + + super.stop(); + + // Remove management + if (isManaged()) + { + if (getControl() != null) + { + getControl().unregister(); + setControl(null); + } + setManaged(false); + } + } + + public void setLog(Log logInstance) + { + log = logInstance; + } + + /* (non-Javadoc) + * @see flex.management.ManageableComponent#getLogCategory() + */ + protected String getLogCategory() + { + return LOG_CATEGORY; + } + + /** + * Gets the Loggers as a string array. + * @return a String array + */ + public String[] getLoggers() + { + return log.getLoggers(); + } + + /** + * Gets the Target IDs. + * @return a string array + */ + public String[] getTargetIds() + { + return (String[]) Log.getTargetMap().keySet().toArray(new String[0]); + } + + /** + * Get a Target for a targetId. + * + * @param targetId the target ID + * @return the target from the Log, or null if it is not found + */ + public Target getTarget(String targetId) + { + return (Target) Log.getTargetMap().get(targetId); + } + + /** + * Gets the filters for a given target. + * @param targetId the target ID + * @return a string array + */ + public String[] getTargetFilters(String targetId) + { + + Target target = getTarget(targetId); + + if (target == null) + return new String[0]; + + List filterObjects = target.getFilters(); + String[] filters = new String[filterObjects.size()]; + for (int i = 0; i < filterObjects.size(); i++) + { + filters[i] = (String)filterObjects.get(i); + } + + return filters; + } + + /** + * Check whether a filter is valid. + * @param filter the filter string to check + * @return whether the category exists in LogCategories + */ + public boolean checkFilter(String filter) + { + return categoryManager.checkFilter(filter); + } + + /** + * Return a list of categories in LogCategories. + * @return the list of categories in LogCategories + */ + public List getCategories() + { + return categoryManager.getCategories(); + } + + protected void validate() + { + if (isValid()) + return; + + super.validate(); + + if (log == null) + { + invalidate(); + ConfigurationException ex = new ConfigurationException(); + ex.setMessage(NULL_LOG_REF_EXCEPTION, new Object[]{}); + throw ex; + } + + } + + /** + * This private class keeps track of what categories exist in LogCategories by implementing + * LogCategories and reflecting the interface's properties. + */ + private class CategoryManager implements LogCategories + { + private List categories; + + /** + * Construct an ArrayList for each category in the reflected public properties + * Note this will be incorrect if additional public properties are added to this class + * or to the interface LogCategories. + */ + public CategoryManager() + { + categories = new ArrayList(); + + Field[] categoryFields = this.getClass().getFields(); + for (int i = 0; i < categoryFields.length; i++) + { + try + { + categories.add((String)categoryFields[i].get(this)); + } + catch (IllegalAccessException iae) + { + // Illegal Access on reflection + } + } + } + + + /** + * Check if any categories match with the filter (the filter is valid or not). + * @param filter the filter string to check + * @return whether the filter is valid (with or without a trailing .*) + */ + public boolean checkFilter(String filter) + { + + for (int i = 0; i < categories.size(); i++) + { + if (Log.checkFilterToCategory((String)filter, (String)categories.get(i))) + { + return true; + } + } + return false; + } + + /** + * Return a list of log categories. + * @return List a list of the categories + */ + public List getCategories() + { + return Collections.unmodifiableList(new ArrayList(categories)); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/log/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/log/package-info.java b/core/src/main/java/flex/management/runtime/messaging/log/package-info.java new file mode 100644 index 0000000..a3e940b --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/log/package-info.java @@ -0,0 +1,18 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package flex.management.runtime.messaging.log; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/package-info.java b/core/src/main/java/flex/management/runtime/messaging/package-info.java new file mode 100644 index 0000000..c87a5f5 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControl.java b/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControl.java new file mode 100644 index 0000000..99e0e85 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControl.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + +import flex.management.BaseControl; +import flex.messaging.services.MessageService; + +/** + * The MessageServiceControl class is the MBean implemenation + * for monitoring and managing a MessageService at runtime. + */ +public class MessageServiceControl extends ServiceControl implements + MessageServiceControlMBean +{ + private static final String TYPE = "MessageService"; + + /** + * Constructs a MessageServiceControl, assigning its id, managed + * message service and parent MBean. + * + * @param service The MessageService managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public MessageServiceControl(MessageService service, BaseControl parent) + { + super(service, parent); + } + + /** {@inheritDoc} */ + public String getType() + { + return TYPE; + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControlMBean.java new file mode 100644 index 0000000..72ac1c8 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/MessageServiceControlMBean.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + + +/** + * Defines the runtime monitoring and management interface for managed message services. + */ +public interface MessageServiceControlMBean extends ServiceControlMBean +{ + // Empty for now. +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControl.java b/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControl.java new file mode 100644 index 0000000..69c99e7 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControl.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + +import java.util.Date; + +import flex.management.BaseControl; +import flex.management.runtime.messaging.DestinationControl; +import flex.messaging.services.ServiceAdapter; + +/** + * The ServiceAdapterControl class is the base MBean implementation + * for monitoring and managing a ServiceAdapter at runtime. + */ +public abstract class ServiceAdapterControl extends BaseControl implements + ServiceAdapterControlMBean +{ + protected ServiceAdapter serviceAdapter; + + /** + * Constructs a ServiceAdapterControl, assigning its id, managed service + * adapter and parent MBean. + * + * @param serviceAdapter The ServiceAdapter managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public ServiceAdapterControl(ServiceAdapter serviceAdapter, BaseControl parent) + { + super(parent); + this.serviceAdapter = serviceAdapter; + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getId() + */ + public String getId() + { + return serviceAdapter.getId(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ServiceAdapterControlMBean#isRunning() + */ + public Boolean isRunning() + { + return Boolean.valueOf(serviceAdapter.isStarted()); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ServiceAdapterControlMBean#getStartTimestamp() + */ + public Date getStartTimestamp() + { + return startTimestamp; + } + + /* + * (non-Javadoc) + * @see javax.management.MBeanRegistration#preDeregister() + */ + public void preDeregister() throws Exception + { + DestinationControl parent = (DestinationControl)getParentControl(); + parent.setAdapter(null); + + super.preDeregister(); + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControlMBean.java new file mode 100644 index 0000000..5bcc57c --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/ServiceAdapterControlMBean.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + +import java.io.IOException; +import java.util.Date; + +import flex.management.BaseControlMBean; + +/** + * Defines the runtime monitoring and management interface for service adapters. + */ +public interface ServiceAdapterControlMBean extends BaseControlMBean +{ + /** + * Returns true if the ServiceAdapter is running. + * + * @return true if the ServiceAdapter is running. + * @throws IOException Throws IOException. + */ + Boolean isRunning() throws IOException; + + /** + * Returns the start timestamp for the ServiceAdapter. + * + * @return The start timestamp for the ServiceAdapter. + * @throws IOException Throws IOException. + */ + Date getStartTimestamp() throws IOException; + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/ServiceControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/ServiceControl.java b/core/src/main/java/flex/management/runtime/messaging/services/ServiceControl.java new file mode 100644 index 0000000..da3c605 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/ServiceControl.java @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + +import flex.management.BaseControl; +import flex.management.runtime.messaging.MessageBrokerControl; +import flex.messaging.Destination; +import flex.messaging.services.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.management.ObjectName; + +/** + * The ServiceControl class is the MBean implementation for + * monitoring and managing a Service at runtime. + */ +public abstract class ServiceControl extends BaseControl implements ServiceControlMBean +{ + protected Service service; + private List destinations; + + /** + * Constructs a ServiceControl, assigning its id, managed service and + * parent MBean. + * + * @param service The Service managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public ServiceControl(Service service, BaseControl parent) + { + super(parent); + this.service = service; + destinations = new ArrayList(); + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getId() + */ + public String getId() + { + return service.getId(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ServiceControlMBean#isRunning() + */ + public Boolean isRunning() + { + return Boolean.valueOf(service.isStarted()); + } + + + /** + * Adds the ObjectName of a destination registered with the managed service. + * + * @param value The ObjectName of a destination registered with the managed service. + */ + public void addDestination(ObjectName value) + { + destinations.add(value); + } + + /** + * Removes the ObjectName of a destination registered with the managed service. + * + * @param value The ObjectName of a destination registered with the managed service. + */ + public void removeDestination(ObjectName value) + { + destinations.remove(value); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ServiceControlMBean#getDestinations() + */ + public ObjectName[] getDestinations() + { + int size = destinations.size(); + ObjectName[] destinationNames = new ObjectName[size]; + for (int i = 0; i < size; ++i) + { + destinationNames[i] = (ObjectName)destinations.get(i); + } + return destinationNames; + } + + + /* + * (non-Javadoc) + * @see flex.management.runtime.ServiceControlMBean#getStartTimestamp() + */ + public Date getStartTimestamp() + { + return startTimestamp; + } + + + /* + * (non-Javadoc) + * @see javax.management.MBeanRegistration#preDeregister() + */ + public void preDeregister() throws Exception + { + MessageBrokerControl parent = (MessageBrokerControl)getParentControl(); + parent.removeService(getObjectName()); + + // Unregister destinations of the service + for (Iterator iter = service.getDestinations().values().iterator(); iter.hasNext();) { + Destination child = (Destination) iter.next(); + if (child.getControl() != null) + { + child.getControl().unregister(); + child.setControl(null); + child.setManaged(false); + } + + } + + super.preDeregister(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/ServiceControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/ServiceControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/ServiceControlMBean.java new file mode 100644 index 0000000..4baa624 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/ServiceControlMBean.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services; + +import flex.management.BaseControlMBean; + +import java.io.IOException; +import java.util.Date; +import javax.management.ObjectName; + +/** + * Defines the runtime monitoring and management interface for managed services. + */ +public interface ServiceControlMBean extends BaseControlMBean +{ + + /** + * Returns true if the Service is running. + * + * @return true if the Service is running. + * @throws IOException Throws IOException. + */ + Boolean isRunning() throws IOException; + + + /** + * Returns the start timestamp for the Service. + * + * @return The start timestamp for the Service. + * @throws IOException Throws IOException. + */ + Date getStartTimestamp() throws IOException; + + /** + * Returns the ObjectNames of all destinations registered with the + * managed service. + * + * @return The ObjectNames of all destinations registered with the + * managed service. + * @throws IOException Throws IOException. + */ + ObjectName[] getDestinations() throws IOException; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java new file mode 100644 index 0000000..48362fa --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging; + +import flex.management.BaseControl; +import flex.messaging.MessageClient; +import flex.messaging.services.messaging.SubscriptionManager; + +import java.util.Set; + +/** + * The SubscriptionManagerControl class is the MBean implementation for + * monitoring and managing a SubscriptionManager at runtime. + */ +public class SubscriptionManagerControl extends BaseControl implements + SubscriptionManagerControlMBean +{ + private SubscriptionManager subscriptionManager; + + /** + * Constructs a new SubscriptionManagerControl instance, assigning its + * backing SubscriptionManager. + * + * @param subscriptionManager The SubscriptionManager managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public SubscriptionManagerControl(SubscriptionManager subscriptionManager, BaseControl parent) + { + super(parent); + this.subscriptionManager = subscriptionManager; + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getId() + */ + public String getId() + { + return subscriptionManager.getId(); + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getType() + */ + public String getType() + { + return SubscriptionManager.TYPE; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.SubscriptionManagerControlMBean#getSubscriberCount() + */ + public Integer getSubscriberCount() + { + Set subscriberIds = subscriptionManager.getSubscriberIds(); + if (subscriberIds != null) + { + return new Integer(subscriberIds.size()); + } + else + { + return new Integer(0); + } + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.SubscriptionManagerControlMBean#getSubscriberIds() + */ + public String[] getSubscriberIds() + { + Set subscriberIds = subscriptionManager.getSubscriberIds(); + if (subscriberIds != null) + { + String[] ids = new String[subscriberIds.size()]; + return (String[])subscriberIds.toArray(ids); + } + else + { + return new String[0]; + } + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.SubscriptionManagerControlMBean#removeSubscriber(java.lang.String) + */ + public void removeSubscriber(String subscriberId) + { + MessageClient subscriber = subscriptionManager.getSubscriber(subscriberId); + if (subscriber != null) + { + subscriptionManager.removeSubscriber(subscriber); + } + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.SubscriptionManagerControlMBean#removeAllSubscribers() + */ + public void removeAllSubscribers() + { + String[] subscriberIds = getSubscriberIds(); + int length = subscriberIds.length; + for (int i = 0; i < length; ++i) + { + removeSubscriber(subscriberIds[i]); + } + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java new file mode 100644 index 0000000..50e60d8 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging; + +import java.io.IOException; + +import flex.management.BaseControlMBean; + +/** + * Defines the runtime monitoring and management interface for + * SubscriptionManagers. + */ +public interface SubscriptionManagerControlMBean extends BaseControlMBean +{ + /** + * Returns the count of active subscribers. + * + * @return The count of active subscribers. + * @throws IOException Throws IOException. + */ + Integer getSubscriberCount() throws IOException; + + /** + * Returns the ids for all active subscribers. + * + * @return The ids for all active subscribers. + * @throws IOException Throws IOException. + */ + String[] getSubscriberIds() throws IOException; + + /** + * Unsubscribes the target subscriber. + * + * @param subscriberId The id for the subscriber to unsubscribe. + * @throws IOException Throws IOException. + */ + void removeSubscriber(String subscriberId) throws IOException; + + /** + * Unsubscribes all active subscribers. + * + * @throws IOException Throws IOException. + */ + void removeAllSubscribers() throws IOException; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java new file mode 100644 index 0000000..dc89ee2 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java @@ -0,0 +1,302 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging; + +import flex.management.BaseControl; +import flex.management.runtime.AdminConsoleTypes; +import flex.messaging.services.messaging.ThrottleManager; + +import java.util.Date; + +/** + * The ThrottleManagerControl class is the MBean implementation for + * monitoring and managing a ThrottleManager at runtime. + */ +public class ThrottleManagerControl extends BaseControl implements + ThrottleManagerControlMBean +{ + private ThrottleManager throttleManager; + private long clientIncomingMessageThrottleStart; + private int clientIncomingMessageThrottleCount; + private Date lastClientIncomingMessageThrottleTimestamp; + private long clientOutgoingMessageThrottleStart; + private int clientOutgoingMessageThrottleCount; + private Date lastClientOutgoingMessageThrottleTimestamp; + private long destinationIncomingMessageThrottleStart; + private int destinationIncomingMessageThrottleCount; + private Date lastDestinationIncomingMessageThrottleTimestamp; + private long destinationOutgoingMessageThrottleStart; + private int destinationOutgoingMessageThrottleCount; + private Date lastDestinationOutgoingMessageThrottleTimestamp; + + /** + * Constructs a new ThrottleManagerControl instance, assigning its + * backing ThrottleManager. + * + * @param throttleManager The ThrottleManager managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public ThrottleManagerControl(ThrottleManager throttleManager, BaseControl parent) + { + super(parent); + this.throttleManager = throttleManager; + clientIncomingMessageThrottleStart = System.currentTimeMillis(); + clientOutgoingMessageThrottleStart = clientIncomingMessageThrottleStart; + destinationIncomingMessageThrottleStart = clientIncomingMessageThrottleStart; + destinationOutgoingMessageThrottleStart = clientIncomingMessageThrottleStart; + } + + @Override + protected void onRegistrationComplete() + { + String name = this.getObjectName().getCanonicalName(); + String[] attributes = { + "ClientIncomingMessageThrottleCount", "ClientIncomingMessageThrottleFrequency", + "ClientOutgoingMessageThrottleCount", "ClientOutgoingMessageThrottleFrequency", + "DestinationIncomingMessageThrottleCount", "DestinationIncomingMessageThrottleFrequency", + "DestinationOutgoingMessageThrottleCount", "DestinationOutgoingMessageThrottleFrequency", + "LastClientIncomingMessageThrottleTimestamp", "LastClientOutgoingMessageThrottleTimestamp", + "LastDestinationIncomingMessageThrottleTimestamp", "LastDestinationOutgoingMessageThrottleTimestamp" + }; + + getRegistrar().registerObjects(AdminConsoleTypes.DESTINATION_POLLABLE, name, attributes); + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getId() + */ + @Override + public String getId() + { + return throttleManager.getId(); + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getType() + */ + @Override + public String getType() + { + return ThrottleManager.TYPE; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getClientIncomingMessageThrottleCount() + */ + public Integer getClientIncomingMessageThrottleCount() + { + return Integer.valueOf(clientIncomingMessageThrottleCount); + } + + /** + * Increments the count of throttled incoming client messages. + */ + public void incrementClientIncomingMessageThrottleCount() + { + ++clientIncomingMessageThrottleCount; + lastClientIncomingMessageThrottleTimestamp = new Date(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#resetClientIncomingMessageThrottleCount() + */ + public void resetClientIncomingMessageThrottleCount() + { + clientIncomingMessageThrottleStart = System.currentTimeMillis(); + clientIncomingMessageThrottleCount = 0; + lastClientIncomingMessageThrottleTimestamp = null; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getLastClientIncomingMessageThrottleTimestamp() + */ + public Date getLastClientIncomingMessageThrottleTimestamp() + { + return lastClientIncomingMessageThrottleTimestamp; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getClientIncomingMessageThrottleFrequency() + */ + public Double getClientIncomingMessageThrottleFrequency() + { + if (clientIncomingMessageThrottleCount > 0) + { + double runtime = differenceInMinutes(clientIncomingMessageThrottleStart, System.currentTimeMillis()); + return new Double(clientIncomingMessageThrottleCount/runtime); + } + return new Double(0); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getClientOutgoingMessageThrottleCount() + */ + public Integer getClientOutgoingMessageThrottleCount() + { + return Integer.valueOf(clientOutgoingMessageThrottleCount); + } + + /** + * Increments the count of throttled outgoing client messages. + */ + public void incrementClientOutgoingMessageThrottleCount() + { + ++clientOutgoingMessageThrottleCount; + lastClientOutgoingMessageThrottleTimestamp = new Date(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#resetClientOutgoingMessageThrottleCount() + */ + public void resetClientOutgoingMessageThrottleCount() + { + clientOutgoingMessageThrottleStart = System.currentTimeMillis(); + clientOutgoingMessageThrottleCount = 0; + lastClientOutgoingMessageThrottleTimestamp = null; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getLastClientOutgoingMessageThrottleTimestamp() + */ + public Date getLastClientOutgoingMessageThrottleTimestamp() + { + return lastClientOutgoingMessageThrottleTimestamp; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getClientOutgoingMessageThrottleFrequency() + */ + public Double getClientOutgoingMessageThrottleFrequency() + { + if (clientOutgoingMessageThrottleCount > 0) + { + double runtime = differenceInMinutes(clientOutgoingMessageThrottleStart, System.currentTimeMillis()); + return new Double(clientOutgoingMessageThrottleCount/runtime); + } + return new Double(0); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getDestinationIncomingMessageThrottleCount() + */ + public Integer getDestinationIncomingMessageThrottleCount() + { + return Integer.valueOf(destinationIncomingMessageThrottleCount); + } + + /** + * Increments the count of throttled incoming destination messages. + */ + public void incrementDestinationIncomingMessageThrottleCount() + { + ++destinationIncomingMessageThrottleCount; + lastDestinationIncomingMessageThrottleTimestamp = new Date(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#resetDestinationIncomingMessageThrottleCount() + */ + public void resetDestinationIncomingMessageThrottleCount() + { + destinationIncomingMessageThrottleStart = System.currentTimeMillis(); + destinationIncomingMessageThrottleCount = 0; + lastDestinationIncomingMessageThrottleTimestamp = null; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getLastDestinationIncomingMessageThrottleTimestamp() + */ + public Date getLastDestinationIncomingMessageThrottleTimestamp() + { + return lastDestinationIncomingMessageThrottleTimestamp; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getDestinationIncomingMessageThrottleFrequency() + */ + public Double getDestinationIncomingMessageThrottleFrequency() + { + if (destinationIncomingMessageThrottleCount > 0) + { + double runtime = differenceInMinutes(destinationIncomingMessageThrottleStart, System.currentTimeMillis()); + return new Double(destinationIncomingMessageThrottleCount/runtime); + } + return new Double(0); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getDestinationOutgoingMessageThrottleCount() + */ + public Integer getDestinationOutgoingMessageThrottleCount() + { + return Integer.valueOf(destinationOutgoingMessageThrottleCount); + } + + /** + * Increments the count of throttled outgoing destination messages. + */ + public void incrementDestinationOutgoingMessageThrottleCount() + { + ++destinationOutgoingMessageThrottleCount; + lastDestinationOutgoingMessageThrottleTimestamp = new Date(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#resetDestinationOutgoingMessageThrottleCount() + */ + public void resetDestinationOutgoingMessageThrottleCount() + { + destinationOutgoingMessageThrottleStart = System.currentTimeMillis(); + destinationOutgoingMessageThrottleCount = 0; + lastDestinationOutgoingMessageThrottleTimestamp = null; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.ThrottleManagerControlMBean#getLastDestinationOutgoingMessageThrottleTimestamp() + */ + public Date getLastDestinationOutgoingMessageThrottleTimestamp() + { + return lastDestinationOutgoingMessageThrottleTimestamp; + } + + public Double getDestinationOutgoingMessageThrottleFrequency() + { + if (destinationOutgoingMessageThrottleCount > 0) + { + double runtime = differenceInMinutes(destinationOutgoingMessageThrottleStart, System.currentTimeMillis()); + return new Double(destinationOutgoingMessageThrottleCount/runtime); + } + return new Double(0); + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java new file mode 100644 index 0000000..75ba9ba --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java @@ -0,0 +1,177 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging; + +import flex.management.BaseControlMBean; + +import java.io.IOException; +import java.util.Date; + +/** + * Defines the runtime monitoring and management interface for + * ThrottleManagers. + */ +public interface ThrottleManagerControlMBean extends BaseControlMBean +{ + /** + * Returns the number of incoming client messages that have been + * throttled. + * + * @return The number of incoming client messages that have been + * throttled. + * @throws IOException Throws IOException. + */ + Integer getClientIncomingMessageThrottleCount() throws IOException; + + /** + * Resets the number of throttled incoming client messages to 0. + * + * @throws IOException Throws IOException. + */ + void resetClientIncomingMessageThrottleCount() throws IOException; + + /** + * Returns the timestamp when an incoming client message was + * most recently throttled. + * + * @return The timestamp when an incoming client message was + * most recently throttled. + * @throws IOException Throws IOException. + */ + Date getLastClientIncomingMessageThrottleTimestamp() throws IOException; + + /** + * Returns the number of incoming client messages that have been + * throttled per minute. + * + * @return The number of incoming client messages that have been + * throttled per minute. + * @throws IOException Throws IOException. + */ + Double getClientIncomingMessageThrottleFrequency() throws IOException; + + /** + * Returns the number of outgoing client messages that have been + * throttled. + * + * @return The number of outgoing client messages that have been + * throttled. + * @throws IOException Throws IOException. + */ + Integer getClientOutgoingMessageThrottleCount() throws IOException; + + /** + * Resets the number of throttled outgoing client messages to 0. + * + * @throws IOException Throws IOException. + */ + void resetClientOutgoingMessageThrottleCount() throws IOException; + + /** + * Returns the timestamp when an outgoing client message was most + * recently throttled. + * + * @return The timestamp when an outgoing client message was most + * recently throttled. + * @throws IOException Throws IOException. + */ + Date getLastClientOutgoingMessageThrottleTimestamp() throws IOException; + + /** + * Returns the number of outgoing client messages that have been + * throttled per minute. + * + * @return The number of outgoing client messages that have been + * throttled per minute. + * @throws IOException Throws IOException. + */ + Double getClientOutgoingMessageThrottleFrequency() throws IOException; + + /** + * Returns the number of incoming destination messages that have + * been throttled. + * + * @return The number of incoming destination messages that have + * been throttled. + * @throws IOException Throws IOException. + */ + Integer getDestinationIncomingMessageThrottleCount() throws IOException; + + /** + * Resets the number of throttled incoming destination messages to 0. + * + * @throws IOException Throws IOException. + */ + void resetDestinationIncomingMessageThrottleCount() throws IOException; + + /** + * Returns the timestamp when an incoming destination message was + * most recently throttled. + * + * @return The timestamp when an incoming destination message was + * most recently throttled. + * @throws IOException Throws IOException. + */ + Date getLastDestinationIncomingMessageThrottleTimestamp() throws IOException; + + /** + * Returns the number of incoming destination messages that have + * been throttled per minute. + * + * @return The number of incoming destination messages that have + * been throttled per minute. + * @throws IOException Throws IOException. + */ + Double getDestinationIncomingMessageThrottleFrequency() throws IOException; + + /** + * Returns the number of outgoing destination messages that have + * been throttled. + * + * @return The number of outgoing destination messages that have + * been throttled. + * @throws IOException Throws IOException. + */ + Integer getDestinationOutgoingMessageThrottleCount() throws IOException; + + /** + * Resets the number of throttled outgoing destination messages to 0. + * + * @throws IOException Throws IOException. + */ + void resetDestinationOutgoingMessageThrottleCount() throws IOException; + + /** + * Returns the timestamp when an outgoing destination message was + * most recently throttled. + * + * @return The timestamp when an outgoing destination message was + * most recently throttled. + * @throws IOException Throws IOException. + */ + Date getLastDestinationOutgoingMessageThrottleTimestamp() throws IOException; + + /** + * Returns the number of outgoing destination messages that have been + * throttled per minute. + * + * @return The number of outgoing destination messages that have been + * throttled per minute. + * @throws IOException Throws IOException. + */ + Double getDestinationOutgoingMessageThrottleFrequency() throws IOException; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java new file mode 100644 index 0000000..597f0b0 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging.adapters; + +import flex.messaging.services.messaging.adapters.ActionScriptAdapter; +import flex.management.BaseControl; +import flex.management.runtime.messaging.services.ServiceAdapterControl; + +/** + * The ActionScriptAdapterControl class is the MBean implemenation + * for monitoring and managing ActionScriptAdapters at runtime. + */ +public class ActionScriptAdapterControl extends ServiceAdapterControl implements ActionScriptAdapterControlMBean +{ + private static final String TYPE = "ActionScriptAdapter"; + + /** + * Constructs a ActionScriptAdapterControl, assigning its id, managed + * ActionScriptAdapter and parent MBean. + * + * @param serviceAdapter The ActionScriptAdapter managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public ActionScriptAdapterControl(ActionScriptAdapter serviceAdapter, BaseControl parent) + { + super(serviceAdapter, parent); + } + + /** {@inheritDoc} */ + public String getType() + { + return TYPE; + } + + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java new file mode 100644 index 0000000..6c7f534 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging.adapters; + +import flex.management.runtime.messaging.services.ServiceAdapterControlMBean; + +/** + * Defines the runtime monitoring and management interface for managed + * ActionScript messaging adapters. + */ +public interface ActionScriptAdapterControlMBean extends ServiceAdapterControlMBean +{ + // empty for now +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java new file mode 100644 index 0000000..d65bff0 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging.adapters; + +import flex.management.BaseControl; +import flex.management.runtime.messaging.services.ServiceAdapterControl; +import flex.messaging.services.messaging.adapters.JMSAdapter; + +/** + * The JMSAdapterControl class is the MBean implemenation + * for monitoring and managing JMSAdapters at runtime. + */ +public class JMSAdapterControl extends ServiceAdapterControl implements + JMSAdapterControlMBean +{ + private static final String TYPE = "JMSAdapter"; + private JMSAdapter jmsAdapter; + + /** + * Constructs a JMSAdapterControl, assigning its id, managed + * JMSAdapter and parent MBean. + * + * @param serviceAdapter The JMSAdapter managed by this MBean. + * @param parent The parent MBean in the management hierarchy. + */ + public JMSAdapterControl(JMSAdapter serviceAdapter, BaseControl parent) + { + super(serviceAdapter, parent); + jmsAdapter = serviceAdapter; + } + + /* + * (non-Javadoc) + * @see flex.management.BaseControlMBean#getType() + */ + public String getType() + { + return TYPE; + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getTopicProducerCount() + */ + public Integer getTopicProducerCount() + { + return new Integer(jmsAdapter.getTopicProducerCount()); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getTopicConsumerCount() + */ + public Integer getTopicConsumerCount() + { + return new Integer(jmsAdapter.getTopicConsumerCount()); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getTopicConsumerIds() + */ + public String[] getTopicConsumerIds() + { + return jmsAdapter.getTopicConsumerIds(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getQueueProducerCount() + */ + public Integer getQueueProducerCount() + { + return new Integer(jmsAdapter.getQueueProducerCount()); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getQueueConsumerCount() + */ + public Integer getQueueConsumerCount() + { + return new Integer(jmsAdapter.getQueueConsumerCount()); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#getQueueConsumerIds() + */ + public String[] getQueueConsumerIds() + { + return jmsAdapter.getQueueConsumerIds(); + } + + /* + * (non-Javadoc) + * @see flex.management.runtime.JMSAdapterControlMBean#removeConsumer(java.lang.String) + */ + public void removeConsumer(String consumerId) + { + jmsAdapter.removeConsumer(consumerId); + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java new file mode 100644 index 0000000..2683f4e --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging.adapters; + +import java.io.IOException; + +import flex.management.runtime.messaging.services.ServiceAdapterControlMBean; + +/** + * Defines the runtime monitoring and management interface for managed JMS adapters. + */ +public interface JMSAdapterControlMBean extends ServiceAdapterControlMBean +{ + /** + * Returns the number of topic producers for the adapter. + * + * @return The number of topic producers for the adapter. + * @throws IOException Throws IOException. + */ + Integer getTopicProducerCount() throws IOException; + + /** + * Returns the number of topic consumers for the adapter. + * + * @return The number of topic consumers for the adapter. + * @throws IOException Throws IOException. + */ + Integer getTopicConsumerCount() throws IOException; + + /** + * Returns the ids of all topic consumers. + * + * @return The ids of all topic consumers. + * @throws IOException Throws IOException. + */ + String[] getTopicConsumerIds() throws IOException; + + /** + * Returns the number of queue producers for the adapter. + * + * @return The number of queue producers for the adapter. + * @throws IOException Throws IOException. + */ + Integer getQueueProducerCount() throws IOException; + + /** + * Returns the number of queue consumers for the adapter. + * + * @return The number of queue consumers for the adapter. + * @throws IOException Throws IOException. + */ + Integer getQueueConsumerCount() throws IOException; + + /** + * Returns the ids of all queue consumers. + * + * @return The ids of all queue consumers. + * @throws IOException Throws IOException. + */ + String[] getQueueConsumerIds() throws IOException; + + /** + * Unsubscribes the consumer (for either a topic or queue). + * + * @param consumerId The id of the consumer to unsubscribe. + * @throws IOException Throws IOException. + */ + void removeConsumer(String consumerId) throws IOException; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/package-info.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/package-info.java new file mode 100644 index 0000000..d94216b --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/adapters/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime.messaging.services.messaging.adapters; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/messaging/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/messaging/package-info.java b/core/src/main/java/flex/management/runtime/messaging/services/messaging/package-info.java new file mode 100644 index 0000000..3e0f105 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/messaging/package-info.java @@ -0,0 +1,18 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package flex.management.runtime.messaging.services.messaging; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/services/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/messaging/services/package-info.java b/core/src/main/java/flex/management/runtime/messaging/services/package-info.java new file mode 100644 index 0000000..e9cdb22 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/messaging/services/package-info.java @@ -0,0 +1,18 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package flex.management.runtime.messaging.services; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/package-info.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/management/runtime/package-info.java b/core/src/main/java/flex/management/runtime/package-info.java new file mode 100644 index 0000000..5bbb1f7 --- /dev/null +++ b/core/src/main/java/flex/management/runtime/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.management.runtime; http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/messaging/AbstractConnectionAwareSession.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/messaging/AbstractConnectionAwareSession.java b/core/src/main/java/flex/messaging/AbstractConnectionAwareSession.java new file mode 100644 index 0000000..6c93dc1 --- /dev/null +++ b/core/src/main/java/flex/messaging/AbstractConnectionAwareSession.java @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.messaging; + +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * + * Abstract base class for ConnectionAwareSession implementations. + * Provides support for registering FlexSessionConnectivityListeners + * along with protected methods to notify registered listeners of FlexSessionConnectivityEvents. + */ +public abstract class AbstractConnectionAwareSession extends FlexSession implements ConnectionAwareSession +{ + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + /** + * + * Constructs a new instance. + * + * @param sessionProvider The provider that instantiated this instance. + */ + public AbstractConnectionAwareSession(AbstractFlexSessionProvider sessionProvider) + { + super(sessionProvider); + } + + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // connected + //---------------------------------- + + /** + * Connected flag for the session. + */ + private boolean connected; + + /** + * Returns whether the session is connected. + * + * @return true if the session is connected; otherwise false. + */ + public boolean isConnected() + { + synchronized (lock) + { + return connected; + } + } + + /** + * Sets the connected state for the session. + * + * @param value true for a connected session; false for a disconnected session. + */ + public void setConnected(boolean value) + { + boolean notify = false; + synchronized (lock) + { + if (connected != value) + { + connected = value; + notify = true; + } + } + if (notify) + { + if (!value) + notifySessionDisconnected(); + else + notifySessionConnected(); + } + } + + //---------------------------------- + // connectivityListeners + //---------------------------------- + + /** + * The list of connectivity listeners for the session. + */ + private volatile CopyOnWriteArrayList connectivityListeners; + + /** + * (non-JavaDoc) + * @see flex.messaging.ConnectionAwareSession#addConnectivityListener(FlexSessionConnectivityListener) + */ + public void addConnectivityListener(FlexSessionConnectivityListener listener) + { + if (connectivityListeners == null) + { + synchronized (lock) + { + if (connectivityListeners == null) + connectivityListeners = new CopyOnWriteArrayList(); + } + } + if (connectivityListeners.addIfAbsent(listener) && isConnected()) + { + // If the listener is added when the session has already connected, notify it at add time. + FlexSessionConnectivityEvent event = new FlexSessionConnectivityEvent(this); + listener.sessionConnected(event); + } + } + + /** + * (non-JavaDoc) + * @see flex.messaging.ConnectionAwareSession#removeConnectivityListener(FlexSessionConnectivityListener) + */ + public void removeConnectivityListener(FlexSessionConnectivityListener listener) + { + if (connectivityListeners == null) return; + connectivityListeners.remove(listener); + } + + //-------------------------------------------------------------------------- + // + // Protected Methods + // + //-------------------------------------------------------------------------- + + /** + * Notifies registered FlexSessionConnectivityListeners that the session has connected. + */ + protected void notifySessionConnected() + { + if (connectivityListeners != null) + { + FlexSessionConnectivityEvent event = new FlexSessionConnectivityEvent(this); + for (FlexSessionConnectivityListener listener : connectivityListeners) + listener.sessionDisconnected(event); + } + } + + /** + * Notifies registered FlexSessionConnectivityListeners that the session has disconnected. + */ + protected void notifySessionDisconnected() + { + if (connectivityListeners != null) + { + FlexSessionConnectivityEvent event = new FlexSessionConnectivityEvent(this); + for (FlexSessionConnectivityListener listener : connectivityListeners) + listener.sessionDisconnected(event); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/messaging/AbstractFlexSessionProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/messaging/AbstractFlexSessionProvider.java b/core/src/main/java/flex/messaging/AbstractFlexSessionProvider.java new file mode 100644 index 0000000..07c17be --- /dev/null +++ b/core/src/main/java/flex/messaging/AbstractFlexSessionProvider.java @@ -0,0 +1,146 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.messaging; + +import flex.messaging.config.ConfigMap; + +/** + * + * Base for FlexSessionProvider implementations. + * Providers are protocol-specific factories for concrete FlexSession implementations. + * They are registered with a FlexSessionManager, which acts as the central point of control + * for tracking all active FlexSessions and for dispatching creation events to FlexSessionListeners. + */ +public abstract class AbstractFlexSessionProvider implements FlexComponent +{ + //-------------------------------------------------------------------------- + // + // Variables + // + //-------------------------------------------------------------------------- + + /** + * Instance lock. + */ + protected final Object lock = new Object(); + + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // flexSessionManager + //---------------------------------- + + private volatile FlexSessionManager flexSessionManager; + + /** + * Returns the FlexSessionManager this provider is currently registered to. + * + * @return The FlexSessionManager this provider is currently registered to. + */ + public FlexSessionManager getFlexSessionManager() + { + return flexSessionManager; + } + + /** + * Sets the FlexSessionManager this provider is registered to. + * + * @param value The FlexSessionManager this provider is registered to. + */ + public void setFlexSessionManager(final FlexSessionManager value) + { + flexSessionManager = value; + } + + //---------------------------------- + // logCategory + //---------------------------------- + + private boolean started; + + /** + * Indicates whether the component is started and running. + * + * @return true if the component has started; + * otherwise false. + */ + public boolean isStarted() + { + synchronized (lock) + { + return started; + } + } + + //-------------------------------------------------------------------------- + // + // Public Methods + // + //-------------------------------------------------------------------------- + + /** + * Initializes the component with configuration information. + * + * @param id The id of the component. + * @param configMap The properties for configuring component. + */ + public void initialize(final String id, final ConfigMap configMap) + { + // No-op. + } + + /** + * Removes a FlexSession created by this provider. + * This callback is invoked by FlexSessions when they are invalidated. + * + * @param session The FlexSession being invalidated. + */ + public void removeFlexSession(final FlexSession session) + { + FlexSessionManager manager = getFlexSessionManager(); + if (manager != null) + manager.unregisterFlexSession(session); + } + + /** + * Invoked to start the component. + * This base implementation changes the components state such that {@link #isStarted()} returns true. + */ + public void start() + { + synchronized (lock) + { + started = true; + } + } + + /** + * Invoked to stop the component. + * This base implementation changes the components state such that {@link #isStarted()} returns false. + */ + public void stop() + { + synchronized (lock) + { + started = false; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/messaging/ConnectionAwareSession.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/flex/messaging/ConnectionAwareSession.java b/core/src/main/java/flex/messaging/ConnectionAwareSession.java new file mode 100644 index 0000000..41132f2 --- /dev/null +++ b/core/src/main/java/flex/messaging/ConnectionAwareSession.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.messaging; + +/** + * Sessions that directly track their connection state support notifying interested + * listeners of connectivity changes. + */ +public interface ConnectionAwareSession +{ + //---------------------------------- + // connected + //---------------------------------- + + /** + * Returns true if the session is connected; otherwise false. + * + * @return true if the session is connected; otherwise false. + */ + boolean isConnected(); + + /** + * Sets the connected state for the session. + * + * @param value true if the session is connected; false if disconnected. + */ + void setConnected(boolean value); + + //---------------------------------- + // connectivityListeners + //---------------------------------- + + /** + * Registers a session connectivity listener with the session. + * This listener will be notified when the session acquires or looses connectivity + * to the remote host. + * + * @param listener The FlexSessionConnectivityListener to register with the session. + */ + void addConnectivityListener(FlexSessionConnectivityListener listener); + + /** + * Unregisters a session connectivity listener from the session. + * The unregistered listener will no longer be notified of session connectivity changes. + * + * @param listener The FlexSessionConnectivityListener to unregister from the session. + */ + void removeConnectivityListener(FlexSessionConnectivityListener listener); +}