You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2015/12/20 14:13:54 UTC
[14/51] [partial] flex-blazeds git commit: Removed legacy directories
and made the content of the modules directory the new root - Please use the
maven build for now as the Ant build will no longer work untill it is
adjusted to the new directory structur
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/management/runtime/messaging/services/ServiceControl.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/ServiceControl.java b/core/src/flex/management/runtime/messaging/services/ServiceControl.java
new file mode 100644
index 0000000..da3c605
--- /dev/null
+++ b/core/src/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 <code>ServiceControl</code> class is the MBean implementation for
+ * monitoring and managing a <code>Service</code> at runtime.
+ */
+public abstract class ServiceControl extends BaseControl implements ServiceControlMBean
+{
+ protected Service service;
+ private List destinations;
+
+ /**
+ * Constructs a <code>ServiceControl</code>, assigning its id, managed service and
+ * parent MBean.
+ *
+ * @param service The <code>Service</code> 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 <code>ObjectName</code> of a destination registered with the managed service.
+ *
+ * @param value The <code>ObjectName</code> of a destination registered with the managed service.
+ */
+ public void addDestination(ObjectName value)
+ {
+ destinations.add(value);
+ }
+
+ /**
+ * Removes the <code>ObjectName</code> of a destination registered with the managed service.
+ *
+ * @param value The <code>ObjectName</code> 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/ServiceControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/ServiceControlMBean.java b/core/src/flex/management/runtime/messaging/services/ServiceControlMBean.java
new file mode 100644
index 0000000..4baa624
--- /dev/null
+++ b/core/src/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 <code>true</code> if the <code>Service</code> is running.
+ *
+ * @return <code>true</code> if the <code>Service</code> is running.
+ * @throws IOException Throws IOException.
+ */
+ Boolean isRunning() throws IOException;
+
+
+ /**
+ * Returns the start timestamp for the <code>Service</code>.
+ *
+ * @return The start timestamp for the <code>Service</code>.
+ * @throws IOException Throws IOException.
+ */
+ Date getStartTimestamp() throws IOException;
+
+ /**
+ * Returns the <code>ObjectName</code>s of all destinations registered with the
+ * managed service.
+ *
+ * @return The <code>ObjectName</code>s 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java b/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControl.java
new file mode 100644
index 0000000..48362fa
--- /dev/null
+++ b/core/src/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 <code>SubscriptionManagerControl</code> class is the MBean implementation for
+ * monitoring and managing a <code>SubscriptionManager</code> at runtime.
+ */
+public class SubscriptionManagerControl extends BaseControl implements
+ SubscriptionManagerControlMBean
+{
+ private SubscriptionManager subscriptionManager;
+
+ /**
+ * Constructs a new <code>SubscriptionManagerControl</code> instance, assigning its
+ * backing <code>SubscriptionManager</code>.
+ *
+ * @param subscriptionManager The <code>SubscriptionManager</code> 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java b/core/src/flex/management/runtime/messaging/services/messaging/SubscriptionManagerControlMBean.java
new file mode 100644
index 0000000..50e60d8
--- /dev/null
+++ b/core/src/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
+ * <code>SubscriptionManager</code>s.
+ */
+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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java b/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControl.java
new file mode 100644
index 0000000..dc89ee2
--- /dev/null
+++ b/core/src/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 <code>ThrottleManagerControl</code> class is the MBean implementation for
+ * monitoring and managing a <code>ThrottleManager</code> 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 <code>ThrottleManagerControl</code> instance, assigning its
+ * backing <code>ThrottleManager</code>.
+ *
+ * @param throttleManager The <code>ThrottleManager</code> 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java b/core/src/flex/management/runtime/messaging/services/messaging/ThrottleManagerControlMBean.java
new file mode 100644
index 0000000..75ba9ba
--- /dev/null
+++ b/core/src/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
+ * <code>ThrottleManager</code>s.
+ */
+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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java b/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControl.java
new file mode 100644
index 0000000..597f0b0
--- /dev/null
+++ b/core/src/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 <code>ActionScriptAdapterControl</code> class is the MBean implemenation
+ * for monitoring and managing <code>ActionScriptAdapter</code>s at runtime.
+ */
+public class ActionScriptAdapterControl extends ServiceAdapterControl implements ActionScriptAdapterControlMBean
+{
+ private static final String TYPE = "ActionScriptAdapter";
+
+ /**
+ * Constructs a <code>ActionScriptAdapterControl</code>, assigning its id, managed
+ * <code>ActionScriptAdapter</code> and parent MBean.
+ *
+ * @param serviceAdapter The <code>ActionScriptAdapter</code> 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java b/core/src/flex/management/runtime/messaging/services/messaging/adapters/ActionScriptAdapterControlMBean.java
new file mode 100644
index 0000000..6c7f534
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java b/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java
new file mode 100644
index 0000000..d65bff0
--- /dev/null
+++ b/core/src/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 <code>JMSAdapterControl</code> class is the MBean implemenation
+ * for monitoring and managing <code>JMSAdapter</code>s at runtime.
+ */
+public class JMSAdapterControl extends ServiceAdapterControl implements
+ JMSAdapterControlMBean
+{
+ private static final String TYPE = "JMSAdapter";
+ private JMSAdapter jmsAdapter;
+
+ /**
+ * Constructs a <code>JMSAdapterControl</code>, assigning its id, managed
+ * <code>JMSAdapter</code> and parent MBean.
+ *
+ * @param serviceAdapter The <code>JMSAdapter</code> 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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java b/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java
new file mode 100644
index 0000000..2683f4e
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java b/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java
new file mode 100644
index 0000000..d94216b
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/messaging/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/messaging/package-info.java b/core/src/flex/management/runtime/messaging/services/messaging/package-info.java
new file mode 100644
index 0000000..3e0f105
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/management/runtime/messaging/services/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/messaging/services/package-info.java b/core/src/flex/management/runtime/messaging/services/package-info.java
new file mode 100644
index 0000000..e9cdb22
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/management/runtime/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/management/runtime/package-info.java b/core/src/flex/management/runtime/package-info.java
new file mode 100644
index 0000000..5bbb1f7
--- /dev/null
+++ b/core/src/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/bf2e1dc9/core/src/flex/messaging/AbstractConnectionAwareSession.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/AbstractConnectionAwareSession.java b/core/src/flex/messaging/AbstractConnectionAwareSession.java
new file mode 100644
index 0000000..6c93dc1
--- /dev/null
+++ b/core/src/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 <tt>ConnectionAwareSession</tt> implementations.
+ * Provides support for registering <tt>FlexSessionConnectivityListener</tt>s
+ * along with protected methods to notify registered listeners of <tt>FlexSessionConnectivityEvent</tt>s.
+ */
+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<FlexSessionConnectivityListener> 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<FlexSessionConnectivityListener>();
+ }
+ }
+ 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 <tt>FlexSessionConnectivityListener</tt>s 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 <tt>FlexSessionConnectivityListener</tt>s 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/bf2e1dc9/core/src/flex/messaging/AbstractFlexSessionProvider.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/AbstractFlexSessionProvider.java b/core/src/flex/messaging/AbstractFlexSessionProvider.java
new file mode 100644
index 0000000..07c17be
--- /dev/null
+++ b/core/src/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 <tt>FlexSessionManager</tt> this provider is currently registered to.
+ *
+ * @return The <tt>FlexSessionManager</tt> this provider is currently registered to.
+ */
+ public FlexSessionManager getFlexSessionManager()
+ {
+ return flexSessionManager;
+ }
+
+ /**
+ * Sets the <tt>FlexSessionManager</tt> this provider is registered to.
+ *
+ * @param value The <tt>FlexSessionManager</tt> 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 <code>true</code> if the component has started;
+ * otherwise <code>false</code>.
+ */
+ 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 <tt>FlexSession</tt> created by this provider.
+ * This callback is invoked by <tt>FlexSession</tt>s when they are invalidated.
+ *
+ * @param session The <tt>FlexSession</tt> 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/bf2e1dc9/core/src/flex/messaging/ConnectionAwareSession.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/ConnectionAwareSession.java b/core/src/flex/messaging/ConnectionAwareSession.java
new file mode 100644
index 0000000..41132f2
--- /dev/null
+++ b/core/src/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 <tt>FlexSessionConnectivityListener</tt> 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 <tt>FlexSessionConnectivityListener</tt> to unregister from the session.
+ */
+ void removeConnectivityListener(FlexSessionConnectivityListener listener);
+}