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 2017/02/15 22:42:44 UTC
[03/51] [partial] flex-blazeds git commit: - Major code scrub
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/MessageBrokerControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/MessageBrokerControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/MessageBrokerControlMBean.java
new file mode 100644
index 0000000..7270133
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/MessageBrokerControlMBean.java
@@ -0,0 +1,130 @@
+/*
+ * 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;
+
+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 <code>MessageBroker</code>s.
+ */
+public interface MessageBrokerControlMBean extends BaseControlMBean
+{
+ /**
+ * Returns <code>true</code> if the <code>MessageBroker</code> is running.
+ *
+ * @return <code>true</code> if the <code>MessageBroker</code> is running.
+ * @throws IOException Throws IOException.
+ */
+ Boolean isRunning() throws IOException;
+
+ /**
+ * Returns the start timestamp for the <code>MessageBroker</code>.
+ *
+ * @return The start timestamp for the <code>MessageBroker</code>.
+ * @throws IOException Throws IOException.
+ */
+ Date getStartTimestamp() throws IOException;
+
+ /**
+ * Returns the <code>ObjectName</code>s for endpoints that are registered with the
+ * managed <code>MessageBroker</code>.
+ *
+ * @return The <code>ObjectName</code>s for endpoints registered with the managed <code>MessageBroker</code>.
+ * @throws IOException Throws IOException.
+ */
+ ObjectName[] getEndpoints() throws IOException;
+
+ /**
+ * Returns the <code>ObjectName</code>s for services that are registered with the
+ * managed <code>MessageBroker</code>.
+ *
+ * @return The <code>ObjectName</code>s for services registered with the managed <code>MessageBroker</code>.
+ * @throws IOException Throws IOException.
+ */
+ ObjectName[] getServices() throws IOException;
+
+ /**
+ * Returns Flex session count for the <code>MessageBroker</code>.
+ *
+ * @return Flex session count for the <code>MessageBroker</code>.
+ * @throws IOException Throws IOException.
+ */
+ Integer getFlexSessionCount() throws IOException;
+
+ /**
+ * Returns the maximum concurrent Flex session count for the
+ * <code>MessageBroker</code> in the current hour.
+ *
+ * @return The maximum concurrent Flex session count for the
+ * <code>MessageBroker</code> over the course of the last hour.
+ * @throws IOException Throws IOException.
+ */
+ Integer getMaxFlexSessionsInCurrentHour() throws IOException;
+
+ /**
+ * Returns the number of Enterprise Connections across all
+ * Enterprise Endpoints.
+ *
+ * @return The number of Enterprise Connections
+ * @throws IOException Throws IOException.
+ */
+ Integer getEnterpriseConnectionCount() throws IOException;
+
+ /**
+ * Returns the total number of bytes passing through all AMF endpoints.
+ *
+ * @return The total number of bytes passing through all AMF endpoints.
+ * @throws IOException Throws IOException.
+ */
+ Long getAMFThroughput() throws IOException;
+
+ /**
+ * Returns the total number of bytes passing through all HTTP endpoints.
+ *
+ * @return The total number of bytes passing through all HTTP endpoints.
+ * @throws IOException Throws IOException.
+ */
+ Long getHTTPThroughput() throws IOException;
+
+ /**
+ * Returns the total number of bytes passing through all Enterprise endpoints.
+ *
+ * @return The total number of bytes passing through all Enterprise endpoints.
+ * @throws IOException Throws IOException.
+ */
+ Long getEnterpriseThroughput() throws IOException;
+
+ /**
+ * Returns the total number of bytes passing through all streaming AMF endpoints.
+ *
+ * @return The total number of bytes passing through all streaming AMF endpoints.
+ * @throws IOException Throws IOException.
+ */
+ Long getStreamingAMFThroughput() throws IOException;
+
+ /**
+ * Returns the total number of bytes passing through all streaming HTTP endpoints.
+ *
+ * @return The total number of bytes passing through all streaming HTTP endpoints.
+ * @throws IOException Throws IOException.
+ */
+ Long getStreamingHTTPThroughput() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControl.java b/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControl.java
new file mode 100644
index 0000000..9dc7411
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControl.java
@@ -0,0 +1,310 @@
+/*
+ * 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;
+
+import java.util.Date;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import flex.management.BaseControl;
+import flex.management.runtime.AdminConsoleTypes;
+import flex.messaging.Destination;
+
+import javax.management.ObjectName;
+
+/**
+ * The <code>MessageDestinationControl</code> class is the MBean implementation for
+ * monitoring and managing a <code>MessageDestination</code> at runtime.
+ */
+public class MessageDestinationControl extends DestinationControl implements
+ MessageDestinationControlMBean
+{
+ private static final String TYPE = "MessageDestination";
+ private ObjectName messageCache;
+ private ObjectName throttleManager;
+ private ObjectName subscriptionManager;
+
+ private AtomicInteger serviceMessageCount = new AtomicInteger(0);
+ private Date lastServiceMessageTimestamp;
+ private long serviceMessageStart;
+ private AtomicInteger serviceCommandCount = new AtomicInteger(0);
+ private Date lastServiceCommandTimestamp;
+ private long serviceCommandStart;
+ private AtomicInteger serviceMessageFromAdapterCount = new AtomicInteger(0);
+ private Date lastServiceMessageFromAdapterTimestamp;
+ private long serviceMessageFromAdapterStart;
+ /**
+ * Constructs a new <code>MessageDestinationControl</code> instance.
+ *
+ * @param destination The destination managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public MessageDestinationControl(Destination destination, BaseControl parent)
+ {
+ super(destination, parent);
+ serviceMessageStart = System.currentTimeMillis();
+ serviceCommandStart = serviceMessageStart;
+ serviceMessageFromAdapterStart = serviceMessageStart;
+ }
+
+ protected void onRegistrationComplete()
+ {
+ String name = this.getObjectName().getCanonicalName();
+
+ String[] pollablePerInterval = { "ServiceCommandCount", "ServiceMessageCount",
+ "ServiceMessageFromAdapterCount" };
+ String[] pollableGeneral = { "ServiceCommandFrequency", "ServiceMessageFrequency",
+ "ServiceMessageFromAdapterFrequency", "LastServiceCommandTimestamp",
+ "LastServiceMessageTimestamp", "LastServiceMessageFromAdapterTimestamp"};
+
+ getRegistrar().registerObjects(
+ new int[] {AdminConsoleTypes.DESTINATION_POLLABLE, AdminConsoleTypes.GRAPH_BY_POLL_INTERVAL},
+ name, pollablePerInterval);
+ getRegistrar().registerObjects(AdminConsoleTypes.DESTINATION_POLLABLE, name,
+ pollableGeneral);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.BaseControlMBean#getType()
+ */
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.MessageDestinationControlMBean#getMessageCache()
+ */
+ public ObjectName getMessageCache()
+ {
+ return messageCache;
+ }
+
+ /**
+ * Sets the <code>ObjectName</code> for the message cache used by the managed destination.
+ *
+ * @param value The <code>ObjectName</code> for the message cache.
+ */
+ public void setMessageCache(ObjectName value)
+ {
+ messageCache = value;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.MessageDestinationControlMBean#getThrottleManager()
+ */
+ public ObjectName getThrottleManager()
+ {
+ return throttleManager;
+ }
+
+ /**
+ * Sets the <code>ObjectName</code> for the throttle manager used by the managed destination.
+ *
+ * @param value The <code>ObjectName</code> for the throttle manager.
+ */
+ public void setThrottleManager(ObjectName value)
+ {
+ throttleManager = value;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.MessageDestinationControlMBean#getSubscriptionManager()
+ */
+ public ObjectName getSubscriptionManager()
+ {
+ return subscriptionManager;
+ }
+
+ /**
+ * Sets the <code>ObjectName</code> for the subscription manager used by the managed destination.
+ *
+ * @param value The <code>ObjectName</code> for the subscription manager.
+ */
+ public void setSubscriptionManager(ObjectName value)
+ {
+ subscriptionManager = value;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceMessageCount()
+ */
+ public Integer getServiceMessageCount()
+ {
+ return Integer.valueOf(serviceMessageCount.get());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#resetServiceMessageCount()
+ */
+ public void resetServiceMessageCount()
+ {
+ serviceMessageStart = System.currentTimeMillis();
+ serviceMessageCount = new AtomicInteger(0);
+ lastServiceMessageTimestamp = null;
+ }
+
+ /**
+ * Increments the count of messages serviced.
+ */
+ public void incrementServiceMessageCount()
+ {
+ serviceMessageCount.incrementAndGet();
+ lastServiceMessageTimestamp = new Date();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getLastServiceMessageTimestamp()
+ */
+ public Date getLastServiceMessageTimestamp()
+ {
+ return lastServiceMessageTimestamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceMessageFrequency()
+ */
+ public Double getServiceMessageFrequency()
+ {
+ if (serviceMessageCount.get() > 0)
+ {
+ double runtime = differenceInMinutes(serviceMessageStart, System.currentTimeMillis());
+ return new Double(serviceMessageCount.get()/runtime);
+ }
+ else
+ {
+ return new Double(0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceCommandCount()
+ */
+ public Integer getServiceCommandCount()
+ {
+ return Integer.valueOf(serviceCommandCount.get());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#resetServiceCommandCount()
+ */
+ public void resetServiceCommandCount()
+ {
+ serviceCommandStart = System.currentTimeMillis();
+ serviceCommandCount = new AtomicInteger(0);
+ lastServiceCommandTimestamp = null;
+ }
+
+ /**
+ * Increments the count of command messages serviced.
+ */
+ public void incrementServiceCommandCount()
+ {
+ serviceCommandCount.incrementAndGet();
+ lastServiceCommandTimestamp = new Date();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getLastServiceCommandTimestamp()
+ */
+ public Date getLastServiceCommandTimestamp()
+ {
+ return lastServiceCommandTimestamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceCommandFrequency()
+ */
+ public Double getServiceCommandFrequency()
+ {
+ if (serviceCommandCount.get() > 0)
+ {
+ double runtime = differenceInMinutes(serviceCommandStart, System.currentTimeMillis());
+ return new Double(serviceCommandCount.get()/runtime);
+ }
+ else
+ {
+ return new Double(0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceMessageFromAdapterCount()
+ */
+ public Integer getServiceMessageFromAdapterCount()
+ {
+ return Integer.valueOf(serviceMessageFromAdapterCount.get());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#resetServiceMessageFromAdapterCount()
+ */
+ public void resetServiceMessageFromAdapterCount()
+ {
+ serviceMessageFromAdapterStart = System.currentTimeMillis();
+ serviceMessageFromAdapterCount = new AtomicInteger(0);
+ lastServiceMessageFromAdapterTimestamp = null;
+ }
+
+ /**
+ * Increments the count of messages from adapters processed.
+ */
+ public void incrementServiceMessageFromAdapterCount()
+ {
+ serviceMessageFromAdapterCount.incrementAndGet();
+ lastServiceMessageFromAdapterTimestamp = new Date();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getLastServiceMessageFromAdapterTimestamp()
+ */
+ public Date getLastServiceMessageFromAdapterTimestamp()
+ {
+ return lastServiceMessageFromAdapterTimestamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.MessageDestinationControlMBean#getServiceMessageFromAdapterFrequency()
+ */
+ public Double getServiceMessageFromAdapterFrequency()
+ {
+ if (serviceMessageFromAdapterCount.get() > 0)
+ {
+ double runtime = differenceInMinutes(serviceMessageFromAdapterStart, System.currentTimeMillis());
+ return new Double(serviceMessageFromAdapterCount.get()/runtime);
+ }
+ else
+ {
+ return new Double(0);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControlMBean.java
new file mode 100644
index 0000000..cbe4492
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/MessageDestinationControlMBean.java
@@ -0,0 +1,153 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.Date;
+
+import javax.management.ObjectName;
+
+
+/**
+ * Defines the runtime monitoring and management interface for managed
+ * <code>MessageDestination</code>s.
+ */
+public interface MessageDestinationControlMBean extends DestinationControlMBean
+{
+ /**
+ * Returns the <code>ObjectName</code> for the message cache used by the managed
+ * destination.
+ *
+ * @return The <code>ObjectName</code> for the message cache.
+ * @throws IOException Throws IOException.
+ */
+ ObjectName getMessageCache() throws IOException;
+
+ /**
+ * Returns the <code>ObjectName</code> for the throttle manager used by the
+ * managed destination.
+ *
+ * @return The <code>ObjectName</code> for the throttle manager.
+ * @throws IOException Throws IOException.
+ */
+ ObjectName getThrottleManager() throws IOException;
+
+ /**
+ * Returns the <code>ObjectName</code> for the subscription manager used
+ * by the managed destination.
+ *
+ * @return The <code>ObjectName</code> for the subscription manager.
+ * @throws IOException Throws IOException.
+ */
+ ObjectName getSubscriptionManager() throws IOException;
+
+ /**
+ * Returns the number of service message invocations.
+ *
+ * @return The number of service message invocations.
+ * @throws IOException Throws IOException.
+ */
+ Integer getServiceMessageCount() throws IOException;
+
+ /**
+ * Resets the count of service message invocations.
+ *
+ * @throws IOException Throws IOException.
+ */
+ void resetServiceMessageCount() throws IOException;
+
+ /**
+ * Returns the timestamp for the most recent service message
+ * invocation.
+ *
+ * @return The timestamp for the most recent service message invocation.
+ * @throws IOException Throws IOException.
+ */
+ Date getLastServiceMessageTimestamp() throws IOException;
+
+ /**
+ * Returns the number of service message invocations per minute.
+ *
+ * @return The number of service message invocations per minute.
+ * @throws IOException Throws IOException.
+ */
+ Double getServiceMessageFrequency() throws IOException;
+
+ /**
+ * Returns the number of service command invocations.
+ *
+ * @return The number of service command invocations.
+ * @throws IOException Throws IOException.
+ */
+ Integer getServiceCommandCount() throws IOException;
+
+ /**
+ * Resets the count of service command invocations.
+ *
+ * @throws IOException Throws IOException.
+ */
+ void resetServiceCommandCount() throws IOException;
+
+ /**
+ * Returns the timestamp for the most recent service command invocation.
+ *
+ * @return The timestamp for the most recent service command invocation.
+ * @throws IOException Throws IOException.
+ */
+ Date getLastServiceCommandTimestamp() throws IOException;
+
+ /**
+ * Returns the number of service command invocations per minute.
+ *
+ * @return The number of service command invocations per minute.
+ * @throws IOException Throws IOException.
+ */
+ Double getServiceCommandFrequency() throws IOException;
+
+ /**
+ * Returns the number of messages from an adapter that the managed service
+ * has processed.
+ *
+ * @return The number of messages from an adapter that the managed service
+ * has processed
+ * @throws IOException Throws IOException.
+ */
+ Integer getServiceMessageFromAdapterCount() throws IOException;
+
+ /**
+ * Resets the count of service message from adapter invocations.
+ *
+ * @throws IOException Throws IOException.
+ */
+ void resetServiceMessageFromAdapterCount() throws IOException;
+
+ /**
+ * Returns the timestamp of the most recent service message from adapter invocation.
+ *
+ * @return The timestamp of the most recent service message from adapter invocation.
+ * @throws IOException Throws IOException.
+ */
+ Date getLastServiceMessageFromAdapterTimestamp() throws IOException;
+
+ /**
+ * Returns the number of service message from adapter invocations per minute.
+ *
+ * @return The number of service message from adapter invocations per minute.
+ * @throws IOException Throws IOException.
+ */
+ Double getServiceMessageFromAdapterFrequency() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControl.java b/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControl.java
new file mode 100644
index 0000000..273da33
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControl.java
@@ -0,0 +1,97 @@
+/*
+ * 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.client;
+
+import flex.management.BaseControl;
+import flex.management.runtime.AdminConsoleTypes;
+import flex.messaging.client.FlexClientManager;
+
+/**
+ *
+ */
+public class FlexClientManagerControl extends BaseControl implements FlexClientManagerControlMBean
+{
+ private FlexClientManager flexClientManager;
+
+ public FlexClientManagerControl(BaseControl parent, FlexClientManager manager)
+ {
+ super(parent);
+ flexClientManager = manager;
+ }
+
+ public void onRegistrationComplete()
+ {
+ String name = getObjectName().getCanonicalName();
+ getRegistrar().registerObject(AdminConsoleTypes.GENERAL_POLLABLE, name, "FlexClientCount");
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.BaseControl#getId()
+ */
+ public String getId()
+ {
+ return flexClientManager.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.BaseControl#getType()
+ */
+ public String getType()
+ {
+ return flexClientManager.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.client.FlexClientManagerControlMBean#getClientIds()
+ */
+ public String[] getClientIds()
+ {
+ return flexClientManager.getClientIds();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.client.FlexClientManagerControlMBean#getClientLastUse(java.lang.String)
+ */
+ public Long getClientLastUse(String clientId)
+ {
+ return new Long(flexClientManager.getFlexClient(clientId).getLastUse());
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.client.FlexClientManagerControlMBean#getClientSessionCount(java.lang.String)
+ */
+ public Integer getClientSessionCount(String clientId)
+ {
+ return new Integer(flexClientManager.getFlexClient(clientId).getSessionCount());
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.client.FlexClientManagerControlMBean#getClientSubscriptionCount(java.lang.String)
+ */
+ public Integer getClientSubscriptionCount(String clientId)
+ {
+ return new Integer(flexClientManager.getFlexClient(clientId).getSubscriptionCount());
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.client.FlexClientManagerControlMBean#getFlexClientCount()
+ */
+ public Integer getFlexClientCount()
+ {
+ return new Integer(flexClientManager.getFlexClientCount());
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControlMBean.java
new file mode 100644
index 0000000..f063259
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/client/FlexClientManagerControlMBean.java
@@ -0,0 +1,70 @@
+/*
+ * 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.client;
+
+import java.io.IOException;
+
+import flex.management.BaseControlMBean;
+
+/**
+ * Defines the runtime monitoring and management interface for managed flex client managers.
+ */
+public interface FlexClientManagerControlMBean extends BaseControlMBean
+{
+ /**
+ * Returns ids of managed clients.
+ *
+ * @return An array of client ids.
+ * @throws IOException Throws IOException.
+ */
+ String[] getClientIds() throws IOException;
+
+ /**
+ * Returns the number of subscriptions for the client with the clientId.
+ *
+ * @param clientId The client id.
+ * @return The number of subscriptions for the client with the cliendId
+ * @throws IOException Throws IOException.
+ */
+ Integer getClientSubscriptionCount(String clientId) throws IOException;
+
+ /**
+ * Returns the number of sessiosn for the client with the clientId.
+ *
+ * @param clientId The client id.
+ * @return The number of sessions for the client with the cliendId
+ * @throws IOException Throws IOException.
+ */
+ Integer getClientSessionCount(String clientId) throws IOException;
+
+ /**
+ * Returns the last use by the client with the clientId.
+ *
+ * @param clientId The client id.
+ * @return The last use by the client with the clientId
+ * @throws IOException Throws IOException.
+ */
+ Long getClientLastUse(String clientId) throws IOException;
+
+ /**
+ * Returns the number of clients.
+ *
+ * @return The number of clients.
+ * @throws IOException Throws IOException.
+ */
+ Integer getFlexClientCount() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/client/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/client/package-info.java b/core/src/main/java/flex/management/runtime/messaging/client/package-info.java
new file mode 100644
index 0000000..713b8b3
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/client/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.client;
\ 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/endpoints/AMFEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControl.java
new file mode 100644
index 0000000..cd224d4
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.messaging.endpoints.AMFEndpoint;
+
+/**
+ * The <code>AMFEndpointControl</code> class is the MBean implemenation
+ * for monitoring and managing an <code>AMFEndpoint</code> at runtime.
+ */
+public class AMFEndpointControl extends PollingEndpointControl implements
+ AMFEndpointControlMBean
+{
+ private static final String TYPE = "AMFEndpoint";
+
+ /**
+ * Constructs a <code>AMFEndpointControl</code>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>AMFEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public AMFEndpointControl(AMFEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, 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/endpoints/AMFEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControlMBean.java
new file mode 100644
index 0000000..22c8cc6
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/AMFEndpointControlMBean.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.endpoints;
+
+
+/**
+ * Defines the runtime monitoring and management interface for managed AMF endpoints.
+ */
+public interface AMFEndpointControlMBean extends PollingEndpointControlMBean
+{
+ // Empty for now.
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControl.java
new file mode 100644
index 0000000..f6bbfb6
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControl.java
@@ -0,0 +1,239 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.management.runtime.AdminConsoleTypes;
+import flex.management.runtime.messaging.MessageBrokerControl;
+import flex.messaging.config.SecurityConstraint;
+import flex.messaging.endpoints.Endpoint;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * The <code>EndpointControl</code> class is the MBean implementation for
+ * monitoring and managing an <code>Endpoint</code> at runtime.
+ */
+public abstract class EndpointControl extends BaseControl implements EndpointControlMBean
+{
+ protected Endpoint endpoint;
+ private AtomicInteger serviceMessageCount = new AtomicInteger(0);
+ private Date lastServiceMessageTimestamp;
+ private long serviceMessageStart;
+ private AtomicLong bytesDeserialized = new AtomicLong(0);
+ private AtomicLong bytesSerialized = new AtomicLong(0);
+
+ /**
+ * Constructs an <code>EndpointControl</code>, assigning its managed endpoint and
+ * parent MBean.
+ *
+ * @param endpoint The <code>Endpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public EndpointControl(Endpoint endpoint, BaseControl parent)
+ {
+ super(parent);
+ this.endpoint = endpoint;
+ serviceMessageStart = System.currentTimeMillis();
+ }
+
+
+ protected void onRegistrationComplete()
+ {
+ String name = this.getObjectName().getCanonicalName();
+ String[] generalNames = { "SecurityConstraint"};
+ String[] generalPollables = { "ServiceMessageCount", "LastServiceMessageTimestamp", "ServiceMessageFrequency"};
+ String[] pollableGraphByInterval = {"BytesDeserialized", "BytesSerialized"};
+
+ getRegistrar().registerObjects(AdminConsoleTypes.ENDPOINT_SCALAR,
+ name, generalNames);
+ getRegistrar().registerObjects(AdminConsoleTypes.ENDPOINT_POLLABLE,
+ name, generalPollables);
+ getRegistrar().registerObjects(new int[] {AdminConsoleTypes.GRAPH_BY_POLL_INTERVAL, AdminConsoleTypes.ENDPOINT_POLLABLE},
+ name, pollableGraphByInterval);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.BaseControlMBean#getId()
+ */
+ public String getId()
+ {
+ return endpoint.getId();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#isRunning()
+ */
+ public Boolean isRunning()
+ {
+ return Boolean.valueOf(endpoint.isStarted());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getStartTimestamp()
+ */
+ public Date getStartTimestamp()
+ {
+ return startTimestamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getServiceMessageCount()
+ */
+ public Integer getServiceMessageCount()
+ {
+ return Integer.valueOf(serviceMessageCount.get());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#resetServiceMessageCount()
+ */
+ public void resetServiceMessageCount()
+ {
+ serviceMessageStart = System.currentTimeMillis();
+ serviceMessageCount = new AtomicInteger(0);
+ lastServiceMessageTimestamp = null;
+ }
+
+ /**
+ * Increments the count of <code>serviceMessage()</code> invocations by the endpoint.
+ */
+ public void incrementServiceMessageCount()
+ {
+ serviceMessageCount.incrementAndGet();
+ lastServiceMessageTimestamp = new Date();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getLastServiceMessageTimestamp()
+ */
+ public Date getLastServiceMessageTimestamp()
+ {
+ return lastServiceMessageTimestamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getServiceMessageFrequency()
+ */
+ public Double getServiceMessageFrequency()
+ {
+ if (serviceMessageCount.get() > 0)
+ {
+ double runtime = differenceInMinutes(serviceMessageStart, System.currentTimeMillis());
+ return new Double(serviceMessageCount.get()/runtime);
+ }
+ else
+ {
+ return new Double(0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.management.MBeanRegistration#preDeregister()
+ */
+ public void preDeregister() throws Exception
+ {
+ MessageBrokerControl parent = (MessageBrokerControl)getParentControl();
+ parent.removeEndpoint(getObjectName());
+ }
+
+ public String getURI()
+ {
+ return endpoint.getUrl();
+ }
+
+ public String getSecurityConstraint()
+ {
+ return getSecurityConstraintOf(endpoint);
+ }
+
+ public static String getSecurityConstraintOf(Endpoint endpoint)
+ {
+ String result = "None";
+
+ SecurityConstraint constraint = endpoint.getSecurityConstraint();
+ if (constraint != null)
+ {
+ String authMethod = constraint.getMethod();
+ if (authMethod != null)
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(authMethod);
+
+ List roles = constraint.getRoles();
+ if ((roles != null) && !roles.isEmpty())
+ {
+ buffer.append(':');
+ for (int i = 0; i < roles.size(); i++)
+ {
+ if (i > 0)
+ {
+ buffer.append(',');
+ }
+ buffer.append(' ');
+ buffer.append(roles.get(i));
+ }
+ }
+ result = buffer.toString();
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getBytesDeserialized()
+ */
+ public Long getBytesDeserialized(){
+ return Long.valueOf(bytesDeserialized.get());
+ }
+
+ /**
+ * Increments the count of bytes deserialized by the endpoint.
+ * @param currentBytesDeserialized the bytes is deserialized
+ */
+ public void addToBytesDeserialized(int currentBytesDeserialized) {
+ bytesDeserialized.addAndGet(currentBytesDeserialized);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.EndpointControlMBean#getBytesSerialized()
+ */
+ public Long getBytesSerialized() {
+ return Long.valueOf(bytesSerialized.get());
+ }
+
+ /**
+ * Increments the count of bytes serialized by the endpoint.
+ * @param currentBytesSerialized the bytes is serialized
+ */
+ public void addToBytesSerialized(int currentBytesSerialized) {
+ bytesSerialized.addAndGet(currentBytesSerialized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java
new file mode 100644
index 0000000..48844a3
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java
@@ -0,0 +1,111 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControlMBean;
+
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * Defines the runtime monitoring and management interface for managed endpoints.
+ */
+public interface EndpointControlMBean extends BaseControlMBean
+{
+ /**
+ * Returns <code>true</code> if the <code>Endpoint</code> is running.
+ *
+ * @return <code>true</code> if the <code>Endpoint</code> is running.
+ * @throws IOException Throws IOException.
+ */
+ Boolean isRunning() throws IOException;
+
+ /**
+ * Returns the start timestamp for the <code>Endpoint</code>.
+ *
+ * @return The start timestamp for the <code>Endpoint</code>.
+ * @throws IOException Throws IOException.
+ */
+ Date getStartTimestamp() throws IOException;
+
+ /**
+ * Returns the count of messages decoded by this endpoint and routed to the broker.
+ *
+ * @return The count of messages decoded by this endpoint and routed to the broker.
+ * @throws IOException Throws IOException.
+ */
+ Integer getServiceMessageCount() throws IOException;
+
+ /**
+ * Resets the count of service message invocations.
+ *
+ * @throws IOException Throws IOException.
+ */
+ void resetServiceMessageCount() throws IOException;
+
+ /**
+ * Returns the timestamp for the most recent message decoded by this endpoint and
+ * routed to the broker.
+ *
+ * @return The timestamp for the most recent message decoded by this endpoint and
+ * routed to the broker.
+ * @throws IOException Throws IOException.
+ */
+ Date getLastServiceMessageTimestamp() throws IOException;
+
+ /**
+ * Returns the number of service message invocations per minute.
+ *
+ * @return The number of service message invocations per minute.
+ * @throws IOException Throws IOException.
+ */
+ Double getServiceMessageFrequency() throws IOException;
+
+ /**
+ * Returns the URI that corresponds to this endpoint.
+ *
+ * @return The URI that corresponds to this endpoint.
+ * @throws IOException Throws IOException.
+ */
+ String getURI() throws IOException;
+
+ /**
+ * Returns the security constraint that is associated with this endpoint.
+ *
+ * @return The security constraint that is associated with this endpoint.
+ * @throws IOException Throws IOException.
+ */
+ String getSecurityConstraint() throws IOException;
+
+ /**
+ * Returns the total Bytes that have been deserialized by this endpoint
+ * during its lifetime.
+ *
+ * @return total Bytes deserialized.
+ * @throws IOException Throws IOException.
+ */
+ Long getBytesDeserialized() throws IOException;
+
+ /**
+ * Returns the total Bytes that have been serialized by this endpoint
+ * during its lifetime.
+ *
+ * @return total Bytes serialized.
+ * @throws IOException Throws IOException.
+ */
+ Long getBytesSerialized() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControl.java
new file mode 100644
index 0000000..e0daf9a
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.messaging.endpoints.HTTPEndpoint;
+
+/**
+ * The <code>HTTPEndpointControl</code> class is the MBean implemenation
+ * for monitoring and managing a <code>HTTPEndpoint</code> at runtime.
+ */
+public class HTTPEndpointControl extends PollingEndpointControl implements
+ HTTPEndpointControlMBean
+{
+ private static final String TYPE = "HTTPEndpoint";
+
+ /**
+ * Constructs a <code>HTTPEndpointControl</code>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>HTTPEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public HTTPEndpointControl(HTTPEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, 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/endpoints/HTTPEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControlMBean.java
new file mode 100644
index 0000000..7d4f8e7
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/HTTPEndpointControlMBean.java
@@ -0,0 +1,25 @@
+/*
+ * 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.endpoints;
+
+/**
+ * Defines the runtime monitoring and management interface for managed HTTP endpoints.
+ */
+public interface HTTPEndpointControlMBean extends PollingEndpointControlMBean
+{
+ // Empty for now.
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControl.java
new file mode 100644
index 0000000..de4db0f
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControl.java
@@ -0,0 +1,72 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.management.runtime.AdminConsoleTypes;
+import flex.messaging.endpoints.BasePollingHTTPEndpoint;
+
+/**
+ * The <tt>PollingEndpointControl</tt> class is the base MBean implementation
+ * for monitoring and managing a <tt>BasePollingHTTPEndpoint</tt> at runtime.
+ */
+public abstract class PollingEndpointControl extends EndpointControl implements
+ PollingEndpointControlMBean
+{
+ /**
+ * Constructs a <tt>PollingEndpointControl</tt>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>BasePollingHTTPEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public PollingEndpointControl(BasePollingHTTPEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, parent);
+ }
+
+ protected void onRegistrationComplete()
+ {
+ super.onRegistrationComplete();
+
+ String name = this.getObjectName().getCanonicalName();
+ String[] generalPollables = {"WaitingPollRequestsCount"};
+
+ getRegistrar().registerObjects(AdminConsoleTypes.ENDPOINT_POLLABLE, name, generalPollables);
+ getRegistrar().registerObject(AdminConsoleTypes.ENDPOINT_SCALAR, name, "MaxWaitingPollRequests");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.PollingEndpointControlMBean#getMaxWaitingPollRequests()
+ */
+ public Integer getMaxWaitingPollRequests()
+ {
+ int maxWaitingPollRequests = ((BasePollingHTTPEndpoint)endpoint).getMaxWaitingPollRequests();
+ return new Integer(maxWaitingPollRequests);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.PollingEndpointControlMBean#getWaitingPollRequestsCount()
+ */
+ public Integer getWaitingPollRequestsCount()
+ {
+ int waitingPollRequestsCount = ((BasePollingHTTPEndpoint)endpoint).getWaitingPollRequestsCount();
+ return new Integer(waitingPollRequestsCount);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControlMBean.java
new file mode 100644
index 0000000..2c30b49
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/PollingEndpointControlMBean.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.endpoints;
+
+import java.io.IOException;
+
+/**
+ * Defines the runtime monitoring and management interface for managed polling
+ * endpoints.
+ */
+public interface PollingEndpointControlMBean extends EndpointControlMBean
+{
+ /**
+ * Returns the maximum number of server poll response threads that will be
+ * waiting for messages to arrive for clients.
+ *
+ * @return The maximum number of server poll response threads that will be
+ * waiting for messages to arrive for clients.
+ * @throws IOException Throws IOException.
+ */
+ Integer getMaxWaitingPollRequests() throws IOException;
+
+ /**
+ * Returns the number of request threads that are currently in the wait state
+ * (including those on their way into or out of it).
+ *
+ * @return The number of request threads that are currently in the wait state.
+ * @throws IOException Throws IOException.
+ */
+ Integer getWaitingPollRequestsCount() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControl.java
new file mode 100644
index 0000000..00d7022
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.messaging.endpoints.StreamingAMFEndpoint;
+
+/**
+ * The <code>StreamingAMFEndpointControl</code> class is the MBean implemenation
+ * for monitoring and managing an <code>StreamingAMFEndpoint</code> at runtime.
+ */
+public class StreamingAMFEndpointControl extends StreamingEndpointControl implements
+ StreamingAMFEndpointControlMBean
+{
+ private static final String TYPE = "StreamingAMFEndpoint";
+
+ /**
+ * Constructs a <code>StreamingAMFEndpointControl</code>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>StreamingAMFEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public StreamingAMFEndpointControl(StreamingAMFEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, 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/endpoints/StreamingAMFEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControlMBean.java
new file mode 100644
index 0000000..32d05b9
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingAMFEndpointControlMBean.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.endpoints;
+
+/**
+ * Defines the runtime monitoring and management interface for managed streaming
+ * AMF endpoints.
+ */
+public interface StreamingAMFEndpointControlMBean extends StreamingEndpointControlMBean
+{
+ // Empty for now
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControl.java
new file mode 100644
index 0000000..b3cdc64
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControl.java
@@ -0,0 +1,133 @@
+/*
+ * 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.endpoints;
+
+import java.util.Date;
+
+import flex.management.BaseControl;
+import flex.management.runtime.AdminConsoleTypes;
+import flex.messaging.endpoints.BaseStreamingHTTPEndpoint;
+
+/**
+ * The <code>StreamingEndpointControl</code> class is the base MBean implementation
+ * for monitoring and managing a <code>BaseStreamingHTTPEndpoint</code> at runtime.
+ */
+public abstract class StreamingEndpointControl extends EndpointControl implements
+ StreamingEndpointControlMBean
+{
+ private int pushCount;
+ private Date lastPushTimeStamp;
+ private long pushStart;
+
+ /**
+ * Constructs a <code>StreamingEndpointControl</code>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>BaseStreamingHTTPEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public StreamingEndpointControl(BaseStreamingHTTPEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, parent);
+ }
+
+ protected void onRegistrationComplete()
+ {
+ super.onRegistrationComplete();
+
+ String name = this.getObjectName().getCanonicalName();
+ String[] generalPollables = { "LastPushTimestamp", "PushCount", "PushFrequency", "StreamingClientsCount"};
+
+ getRegistrar().registerObjects(AdminConsoleTypes.ENDPOINT_POLLABLE, name, generalPollables);
+ getRegistrar().registerObject(AdminConsoleTypes.ENDPOINT_SCALAR, name, "MaxStreamingClients");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#getMaxStreamingClients()
+ */
+ public Integer getMaxStreamingClients()
+ {
+ int maxStreamingClientsCount = ((BaseStreamingHTTPEndpoint)endpoint).getMaxStreamingClients();
+ return new Integer(maxStreamingClientsCount);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#getPushCount()
+ */
+ public Integer getPushCount()
+ {
+ return new Integer(pushCount);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#resetPushCount()
+ */
+ public void resetPushCount()
+ {
+ pushStart = System.currentTimeMillis();
+ pushCount = 0;
+ lastPushTimeStamp = null;
+ }
+
+ /**
+ * Increments the count of messages pushed by the endpoint.
+ */
+ public void incrementPushCount()
+ {
+ ++pushCount;
+ lastPushTimeStamp = new Date();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#getLastPushTimestamp()
+ */
+ public Date getLastPushTimestamp()
+ {
+ return lastPushTimeStamp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#getPushFrequency()
+ */
+ public Double getPushFrequency()
+ {
+ if (pushCount > 0)
+ {
+ double runtime = differenceInMinutes(pushStart, System.currentTimeMillis());
+ return new Double(pushCount/runtime);
+ }
+ else
+ {
+ return new Double(0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see flex.management.runtime.messaging.endpoints.StreamingEndpointControlMBean#isRunning()
+ */
+ public Integer getStreamingClientsCount()
+ {
+ int streamingClientsCount = ((BaseStreamingHTTPEndpoint)endpoint).getStreamingClientsCount();
+ return new Integer(streamingClientsCount);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControlMBean.java
new file mode 100644
index 0000000..b8c684e
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingEndpointControlMBean.java
@@ -0,0 +1,76 @@
+/*
+ * 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.endpoints;
+
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * Defines the runtime monitoring and management interface for managed streaming
+ * endpoints.
+ */
+public interface StreamingEndpointControlMBean extends EndpointControlMBean
+{
+ /**
+ * Returns the maximum number of clients that will be allowed to establish
+ * a streaming HTTP connection with the endpoint.
+ *
+ * @return The maximum number of clients that will be allowed to establish
+ * a streaming HTTP connection with the endpoint.
+ * @throws IOException Throws IOException.
+ */
+ Integer getMaxStreamingClients() throws IOException;
+
+ /**
+ * Returns the count of push invocations.
+ *
+ * @return The count of push invocations.
+ * @throws IOException Throws IOException.
+ */
+ Integer getPushCount() throws IOException;
+
+ /**
+ * Resets the count of push invocations.
+ *
+ * @throws IOException Throws IOException.
+ */
+ void resetPushCount() throws IOException;
+
+ /**
+ * Returns the timestamp for the most recent push invocation.
+ *
+ * @return The timestamp for the most recent push invocation.
+ * @throws IOException Throws IOException.
+ */
+ Date getLastPushTimestamp() throws IOException;
+
+ /**
+ * Returns the number of push invocations per minute.
+ *
+ * @return The number of push invocations per minute.
+ * @throws IOException Throws IOException.
+ */
+ Double getPushFrequency() throws IOException;
+
+ /**
+ * Returns the the number of clients that are currently in the streaming state.
+ *
+ * @return The number of clients that are currently in the streaming state.
+ * @throws IOException Throws IOException.
+ */
+ Integer getStreamingClientsCount() throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControl.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControl.java
new file mode 100644
index 0000000..a103b95
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.endpoints;
+
+import flex.management.BaseControl;
+import flex.messaging.endpoints.StreamingHTTPEndpoint;
+
+/**
+ * The <code>StreamingHTTPEndpointControl</code> class is the MBean implemenation
+ * for monitoring and managing a <code>StreamingHTTPEndpoint</code> at runtime.
+ */
+public class StreamingHTTPEndpointControl extends StreamingEndpointControl implements
+ StreamingHTTPEndpointControlMBean
+{
+ private static final String TYPE = "StreamingHTTPEndpoint";
+
+ /**
+ * Constructs a <code>StreamingHTTPEndpointControl</code>, assigning managed message
+ * endpoint and parent MBean.
+ *
+ * @param endpoint The <code>StreamingHTTPEndpoint</code> managed by this MBean.
+ * @param parent The parent MBean in the management hierarchy.
+ */
+ public StreamingHTTPEndpointControl(StreamingHTTPEndpoint endpoint, BaseControl parent)
+ {
+ super(endpoint, 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/endpoints/StreamingHTTPEndpointControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControlMBean.java
new file mode 100644
index 0000000..f17cb85
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/StreamingHTTPEndpointControlMBean.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.endpoints;
+
+/**
+ * Defines the runtime monitoring and management interface for managed streaming
+ * HTTP endpoints.
+ */
+public interface StreamingHTTPEndpointControlMBean extends StreamingEndpointControlMBean
+{
+ // Empty for now
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/endpoints/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/endpoints/package-info.java b/core/src/main/java/flex/management/runtime/messaging/endpoints/package-info.java
new file mode 100644
index 0000000..0936f70
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/endpoints/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.endpoints;
\ 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/log/LogControl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/log/LogControl.java b/core/src/main/java/flex/management/runtime/messaging/log/LogControl.java
new file mode 100644
index 0000000..d0b5843
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/log/LogControl.java
@@ -0,0 +1,147 @@
+/*
+ * 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 flex.management.BaseControl;
+import flex.messaging.log.AbstractTarget;
+import flex.messaging.log.Log;
+import flex.messaging.log.Target;
+
+/**
+ * The <code>LogControl</code> class is the MBean implemenation
+ * for monitoring and managing a <code>Log</code> at runtime through the <code>LogManager</code>.
+ */
+public class LogControl extends BaseControl implements
+ LogControlMBean
+{
+
+ private static final String TYPE = "Log"; // The type registered with the mbean server
+ private LogManager logManager; // Reference to the LogManager which interfaces with Log
+
+
+ /**
+ * Creates the mbean and registers it with the mbean server.
+ *
+ * @param parent BaseControl
+ * @param manager A reference to the LogManager
+ */
+ public LogControl(BaseControl parent, LogManager manager)
+ {
+ super(parent);
+ this.logManager = manager;
+ register();
+ }
+
+
+ /**
+ * Sets the logging level for the target associated with the unique ID searchId.
+ * @param searchId the search ID
+ * @param level the log level
+ */
+ public void changeTargetLevel(String searchId, String level)
+ {
+ Target selectedTarget = Log.getTarget(searchId);
+ if (selectedTarget != null)
+ {
+ selectedTarget.setLevel(new Short(level).shortValue());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.BaseControl#getId()
+ */
+ public String getId()
+ {
+ return logManager.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.BaseControl#getType()
+ */
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ /**
+ * Return a string array of the loggers.
+ * @return a string array of loggers
+ */
+ public String[] getLoggers()
+ {
+ return logManager.getLoggers();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.log.LogControlMBean#getTargets()
+ */
+ public String[] getTargets()
+ {
+ return logManager.getTargetIds();
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.log.LogControlMBean#addFilterForTarget(java.lang.String, java.lang.String)
+ */
+ public void addFilterForTarget(String targetId, String filter)
+ {
+ AbstractTarget target = (AbstractTarget) logManager.getTarget(targetId);
+
+ if (target != null && logManager.checkFilter(filter))
+ target.addFilter(filter);
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.log.LogControlMBean#getTargetFilters(java.lang.String)
+ */
+ public String[] getTargetFilters(String targetId)
+ {
+ return logManager.getTargetFilters(targetId);
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.log.LogControlMBean#removeFilterForTarget(java.lang.String, java.lang.String)
+ */
+ public void removeFilterForTarget(String targetId, String filter)
+ {
+ AbstractTarget target = (AbstractTarget) logManager.getTarget(targetId);
+
+ if (target != null && target.containsFilter(filter))
+ target.removeFilter(filter);
+ }
+
+ /* (non-Javadoc)
+ * @see flex.management.runtime.messaging.log.LogControlMBean#getCategories()
+ */
+ public String[] getCategories()
+ {
+ return (String[]) logManager.getCategories().toArray(new String[0]);
+ }
+
+
+ public Integer getTargetLevel(String searchId)
+ {
+ AbstractTarget target = (AbstractTarget) logManager.getTarget(searchId);
+
+ if (target != null)
+ {
+ return new Integer(target.getLevel());
+ } else
+ return new Integer(-1);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/main/java/flex/management/runtime/messaging/log/LogControlMBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/flex/management/runtime/messaging/log/LogControlMBean.java b/core/src/main/java/flex/management/runtime/messaging/log/LogControlMBean.java
new file mode 100644
index 0000000..762c895
--- /dev/null
+++ b/core/src/main/java/flex/management/runtime/messaging/log/LogControlMBean.java
@@ -0,0 +1,80 @@
+/*
+ * 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 flex.management.BaseControlMBean;
+
+
+/**
+ * Defines the exposed properties and operations of the LogControl.
+ */
+public interface LogControlMBean extends BaseControlMBean
+{
+ /**
+ * Returns the array of log targets.
+ *
+ * @return The array of log targets.
+ */
+ String[] getTargets();
+
+ /**
+ * Returns the array of log target filters.
+ *
+ * @param targetId The target id.
+ * @return The array of log target filters.
+ */
+ String[] getTargetFilters(String targetId);
+
+ /**
+ * Returns the array of log categories.
+ *
+ * @return The array of log categories.
+ */
+ String[] getCategories();
+
+ /**
+ * Returns the target level.
+ *
+ * @param targetId The target id.
+ * @return The target level.
+ */
+ Integer getTargetLevel(String targetId);
+
+ /**
+ * Changes the target level.
+ *
+ * @param targetId The target id.
+ * @param level The target level.
+ */
+ void changeTargetLevel(String targetId, String level);
+
+ /**
+ * Adds a filter for the target.
+ *
+ * @param filter The filter.
+ * @param targetId The target id.
+ */
+ void addFilterForTarget(String filter, String targetId);
+
+ /**
+ * Removes a filter from the target.
+ *
+ * @param filter The filter.
+ * @param targetId The target id.
+ */
+ void removeFilterForTarget(String filter, String targetId);
+}