http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java old mode 100755 new mode 100644 index 5776d87..235a455 --- a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java +++ b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControl.java @@ -1,119 +1,119 @@ -/* - * 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. - * - * @author shodgson - */ -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); - } -} +/* + * 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. + * + * @author shodgson + */ +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/4f6a3052/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java old mode 100755 new mode 100644 index 33b4fc2..aa85177 --- a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java +++ b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/JMSAdapterControlMBean.java @@ -1,85 +1,85 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package flex.management.runtime.messaging.services.messaging.adapters; - -import java.io.IOException; - -import flex.management.runtime.messaging.services.ServiceAdapterControlMBean; - -/** - * Defines the runtime monitoring and management interface for managed JMS adapters. - * - * @author shodgson - */ -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; -} +/* + * 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. + * + * @author shodgson + */ +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/4f6a3052/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java old mode 100755 new mode 100644 index dbfa228..d94216b --- a/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java +++ b/modules/core/src/flex/management/runtime/messaging/services/messaging/adapters/package-info.java @@ -1,17 +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. - */ +/* + * 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/4f6a3052/modules/core/src/flex/management/runtime/messaging/services/messaging/package-info.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/messaging/services/messaging/package-info.java b/modules/core/src/flex/management/runtime/messaging/services/messaging/package-info.java old mode 100755 new mode 100644 index e96d8dd..3e0f105 --- a/modules/core/src/flex/management/runtime/messaging/services/messaging/package-info.java +++ b/modules/core/src/flex/management/runtime/messaging/services/messaging/package-info.java @@ -1,18 +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. - */ - +/* + * 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/4f6a3052/modules/core/src/flex/management/runtime/messaging/services/package-info.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/messaging/services/package-info.java b/modules/core/src/flex/management/runtime/messaging/services/package-info.java old mode 100755 new mode 100644 index bc0bad4..e9cdb22 --- a/modules/core/src/flex/management/runtime/messaging/services/package-info.java +++ b/modules/core/src/flex/management/runtime/messaging/services/package-info.java @@ -1,18 +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. - */ - +/* + * 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/4f6a3052/modules/core/src/flex/management/runtime/package-info.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/management/runtime/package-info.java b/modules/core/src/flex/management/runtime/package-info.java old mode 100755 new mode 100644 index e3a8bc7..5bbb1f7 --- a/modules/core/src/flex/management/runtime/package-info.java +++ b/modules/core/src/flex/management/runtime/package-info.java @@ -1,17 +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; +/* + * 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/4f6a3052/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java b/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java old mode 100755 new mode 100644 index ad48501..95bed9b --- a/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java +++ b/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java @@ -1,171 +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; - -/** - * @exclude - * 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 - // - //-------------------------------------------------------------------------- - - /** - * @exclude - * 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); - } - } +/* + * 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; + +/** + * @exclude + * 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 + // + //-------------------------------------------------------------------------- + + /** + * @exclude + * 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/4f6a3052/modules/core/src/flex/messaging/AbstractFlexSessionProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/messaging/AbstractFlexSessionProvider.java b/modules/core/src/flex/messaging/AbstractFlexSessionProvider.java old mode 100755 new mode 100644 index 3dfdc12..4b57518 --- a/modules/core/src/flex/messaging/AbstractFlexSessionProvider.java +++ b/modules/core/src/flex/messaging/AbstractFlexSessionProvider.java @@ -1,146 +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; - -/** - * @exclude - * 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; - } - } -} +/* + * 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; + +/** + * @exclude + * 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/4f6a3052/modules/core/src/flex/messaging/ConnectionAwareSession.java ---------------------------------------------------------------------- diff --git a/modules/core/src/flex/messaging/ConnectionAwareSession.java b/modules/core/src/flex/messaging/ConnectionAwareSession.java old mode 100755 new mode 100644 index 573b506..41132f2 --- a/modules/core/src/flex/messaging/ConnectionAwareSession.java +++ b/modules/core/src/flex/messaging/ConnectionAwareSession.java @@ -1,63 +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); -} +/* + * 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); +}