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 2014/05/05 22:08:45 UTC
[31/51] [partial] FLEX-34306 - [BlazeDS] Make the BlazeDS build run
on Windows machines - Added some mkdir commands to the ANT Build.java - Did
some fine-tuning to resolve some compile errors
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FactoryInstance.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FactoryInstance.java b/modules/core/src/flex/messaging/FactoryInstance.java
old mode 100755
new mode 100644
index 8b01292..1e80655
--- a/modules/core/src/flex/messaging/FactoryInstance.java
+++ b/modules/core/src/flex/messaging/FactoryInstance.java
@@ -1,179 +1,179 @@
-/*
- * 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;
-import flex.messaging.config.ConfigurationException;
-
-/**
- * This class is used by the FlexFactory to store the configuration
- * for an instance created by the factory. There is one of these for
- * each destination currently since only destinations create these components.
- *
- * @see flex.messaging.FlexFactory
- */
-public class FactoryInstance
-{
- private static final int INVALID_SCOPE = 10653;
-
- private FlexFactory factory;
- private String id;
- private String scope = FlexFactory.SCOPE_REQUEST;
- private String source;
- private ConfigMap properties;
-
- /**
- * Normally FactoryInstances are constructed by Data Services during startup so you
- * do not need to use this method. It is typically called from the
- * FlexFactory.createFactoryInstance method as Data Services is parsing
- * the destination configuration information for a given destination.
- * You can override this method to extract additional configuration for
- * your component from the properties argument.
- *
- * @param factory the FlexFactory this FactoryInstance is created from
- * @param id the Destination's id
- * @param properties the configuration properties for this destination.
- *
- * @see flex.messaging.config.ConfigMap
- */
- public FactoryInstance(FlexFactory factory, String id, ConfigMap properties)
- {
- this.factory = factory;
- this.id = id;
- this.properties = properties;
- }
-
- /**
- * Get the factory instance ID.
- * @return The destination's id that this FactoryInstance is associated with.
- */
- public String getId()
- {
- return id;
- }
-
- /**
- * Since many factories may provide components in different
- * scopes, this is abstracted in the base factory instance class.
- * @param scope the scope
- */
- public void setScope(String scope)
- {
- this.scope = scope;
-
- if (!FlexFactory.SCOPE_SESSION.equals(scope)
- && !FlexFactory.SCOPE_APPLICATION.equals(scope)
- && !FlexFactory.SCOPE_REQUEST.equals(scope))
- {
- // Invalid scope setting for RemotingService destination '{id}'.
- // Valid options are 'request', 'session', or 'application'.
- ConfigurationException ex = new ConfigurationException();
- ex.setMessage(INVALID_SCOPE, new Object[] {id, "\'request\', \'session\', or \'application\'"});
- throw ex;
- }
-
- }
-
- /**
- * Get the scope.
- * @return String the scope
- */
- public String getScope()
- {
- return scope;
- }
-
- /**
- * This is by convention the main property for the defining the
- * instance we create with this factory. It may be the class name
- * for the JavaFactory or the id for a factory that uses ids.
- */
- public void setSource(String source)
- {
- this.source = source;
- }
-
- /**
- * Get the source.
- * @return String the source string
- */
- public String getSource()
- {
- return source;
- }
-
- /**
- * If possible, returns the class for the underlying configuration.
- * This method can return null if the class is not known until the lookup
- * method is called. The goal is so the factories which know the class
- * at startup time can provide earlier error detection. If the class is not
- * known, this method can return null and validation will wait until the
- * first lookup call.
- *
- * @return the class for this configured instance or null if the class
- * is not known until lookup time.
- */
- public Class getInstanceClass()
- {
- return null;
- }
-
- /**
- * Returns the ConfigMap that this factory instance was created with. You can
- * use this ConfigMap to retrieve additional properties which this factory
- * instance is configured with. For example, if you are defining a remote object
- * destination, your FactoryInstance can be configured with additional XML tags
- * underneath the properties tag for your destination. It is important that
- * if you expect additional properties that you access in the ConfigMap or call
- * allowProperty on that property when the FactoryInstance is created. Otherwise,
- * these properties can generate warnings about "unexpected" configuration.
- * @return ConfigMap the ConfigMap that this factory was created with
- * @see flex.messaging.config.ConfigMap
- */
- public ConfigMap getProperties()
- {
- return properties;
- }
-
- /**
- * Return an instance as appropriate for this instance of the given
- * factory. This just calls the lookup method on the factory that this
- * instance was created on. You override this method to return the
- * specific component for this destination.
- * @return Object the object lookup
- */
- public Object lookup()
- {
- return factory.lookup(this);
- }
-
- /**
- * When the caller is done with the instance, this method is called. For
- * session scoped components, this gives you the opportunity to update
- * any state modified in the instance in a remote persistence store.
- * This method is not called when the object should be destroyed.
- * To get a destroy notification, you should register for the appropriate
- * events via the FlexContext.
- *
- * @param instance the instance returned via the lookup method for this
- * destination for this operation.
- */
- public void operationComplete(Object instance)
- {
- }
-}
+/*
+ * 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;
+import flex.messaging.config.ConfigurationException;
+
+/**
+ * This class is used by the FlexFactory to store the configuration
+ * for an instance created by the factory. There is one of these for
+ * each destination currently since only destinations create these components.
+ *
+ * @see flex.messaging.FlexFactory
+ */
+public class FactoryInstance
+{
+ private static final int INVALID_SCOPE = 10653;
+
+ private FlexFactory factory;
+ private String id;
+ private String scope = FlexFactory.SCOPE_REQUEST;
+ private String source;
+ private ConfigMap properties;
+
+ /**
+ * Normally FactoryInstances are constructed by Data Services during startup so you
+ * do not need to use this method. It is typically called from the
+ * FlexFactory.createFactoryInstance method as Data Services is parsing
+ * the destination configuration information for a given destination.
+ * You can override this method to extract additional configuration for
+ * your component from the properties argument.
+ *
+ * @param factory the FlexFactory this FactoryInstance is created from
+ * @param id the Destination's id
+ * @param properties the configuration properties for this destination.
+ *
+ * @see flex.messaging.config.ConfigMap
+ */
+ public FactoryInstance(FlexFactory factory, String id, ConfigMap properties)
+ {
+ this.factory = factory;
+ this.id = id;
+ this.properties = properties;
+ }
+
+ /**
+ * Get the factory instance ID.
+ * @return The destination's id that this FactoryInstance is associated with.
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ * Since many factories may provide components in different
+ * scopes, this is abstracted in the base factory instance class.
+ * @param scope the scope
+ */
+ public void setScope(String scope)
+ {
+ this.scope = scope;
+
+ if (!FlexFactory.SCOPE_SESSION.equals(scope)
+ && !FlexFactory.SCOPE_APPLICATION.equals(scope)
+ && !FlexFactory.SCOPE_REQUEST.equals(scope))
+ {
+ // Invalid scope setting for RemotingService destination '{id}'.
+ // Valid options are 'request', 'session', or 'application'.
+ ConfigurationException ex = new ConfigurationException();
+ ex.setMessage(INVALID_SCOPE, new Object[] {id, "\'request\', \'session\', or \'application\'"});
+ throw ex;
+ }
+
+ }
+
+ /**
+ * Get the scope.
+ * @return String the scope
+ */
+ public String getScope()
+ {
+ return scope;
+ }
+
+ /**
+ * This is by convention the main property for the defining the
+ * instance we create with this factory. It may be the class name
+ * for the JavaFactory or the id for a factory that uses ids.
+ */
+ public void setSource(String source)
+ {
+ this.source = source;
+ }
+
+ /**
+ * Get the source.
+ * @return String the source string
+ */
+ public String getSource()
+ {
+ return source;
+ }
+
+ /**
+ * If possible, returns the class for the underlying configuration.
+ * This method can return null if the class is not known until the lookup
+ * method is called. The goal is so the factories which know the class
+ * at startup time can provide earlier error detection. If the class is not
+ * known, this method can return null and validation will wait until the
+ * first lookup call.
+ *
+ * @return the class for this configured instance or null if the class
+ * is not known until lookup time.
+ */
+ public Class getInstanceClass()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the ConfigMap that this factory instance was created with. You can
+ * use this ConfigMap to retrieve additional properties which this factory
+ * instance is configured with. For example, if you are defining a remote object
+ * destination, your FactoryInstance can be configured with additional XML tags
+ * underneath the properties tag for your destination. It is important that
+ * if you expect additional properties that you access in the ConfigMap or call
+ * allowProperty on that property when the FactoryInstance is created. Otherwise,
+ * these properties can generate warnings about "unexpected" configuration.
+ * @return ConfigMap the ConfigMap that this factory was created with
+ * @see flex.messaging.config.ConfigMap
+ */
+ public ConfigMap getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ * Return an instance as appropriate for this instance of the given
+ * factory. This just calls the lookup method on the factory that this
+ * instance was created on. You override this method to return the
+ * specific component for this destination.
+ * @return Object the object lookup
+ */
+ public Object lookup()
+ {
+ return factory.lookup(this);
+ }
+
+ /**
+ * When the caller is done with the instance, this method is called. For
+ * session scoped components, this gives you the opportunity to update
+ * any state modified in the instance in a remote persistence store.
+ * This method is not called when the object should be destroyed.
+ * To get a destroy notification, you should register for the appropriate
+ * events via the FlexContext.
+ *
+ * @param instance the instance returned via the lookup method for this
+ * destination for this operation.
+ */
+ public void operationComplete(Object instance)
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FlexComponent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FlexComponent.java b/modules/core/src/flex/messaging/FlexComponent.java
old mode 100755
new mode 100644
index f37856c..8f76444
--- a/modules/core/src/flex/messaging/FlexComponent.java
+++ b/modules/core/src/flex/messaging/FlexComponent.java
@@ -1,48 +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.messaging;
-
-/**
- * Defines the lifecycle interface for FlexComponents, allowing
- * the server to manage the running state of server components
- * through a consistent interface.
- */
-public interface FlexComponent extends FlexConfigurable
-{
- /**
- * Invoked to start the component.
- * The {@link FlexConfigurable#initialize(String, flex.messaging.config.ConfigMap)} method inherited
- * from the {@link FlexConfigurable} interface must be invoked before this method is invoked.
- * Once this method returns, {@link #isStarted()} must return true.
- */
- void start();
-
- /**
- * Invoked to stop the component.
- * Once this method returns, {@link #isStarted()} must return false.
- */
- void stop();
-
- /**
- * Indicates whether the component is started and running.
- *
- * @return <code>true</code> if the component has started;
- * otherwise <code>false</code>.
- */
- boolean isStarted();
-}
+/*
+ * 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;
+
+/**
+ * Defines the lifecycle interface for FlexComponents, allowing
+ * the server to manage the running state of server components
+ * through a consistent interface.
+ */
+public interface FlexComponent extends FlexConfigurable
+{
+ /**
+ * Invoked to start the component.
+ * The {@link FlexConfigurable#initialize(String, flex.messaging.config.ConfigMap)} method inherited
+ * from the {@link FlexConfigurable} interface must be invoked before this method is invoked.
+ * Once this method returns, {@link #isStarted()} must return true.
+ */
+ void start();
+
+ /**
+ * Invoked to stop the component.
+ * Once this method returns, {@link #isStarted()} must return false.
+ */
+ void stop();
+
+ /**
+ * Indicates whether the component is started and running.
+ *
+ * @return <code>true</code> if the component has started;
+ * otherwise <code>false</code>.
+ */
+ boolean isStarted();
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FlexConfigurable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FlexConfigurable.java b/modules/core/src/flex/messaging/FlexConfigurable.java
old mode 100755
new mode 100644
index 881b068..402d3c3
--- a/modules/core/src/flex/messaging/FlexConfigurable.java
+++ b/modules/core/src/flex/messaging/FlexConfigurable.java
@@ -1,35 +1,35 @@
-/*
- * 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;
-
-/**
- * Components created in the Flex configuration environment can implement
- * the FlexConfigurable interface to get access to the configuration
- * properties like a regular component in the system.
- */
-public interface FlexConfigurable
-{
- /**
- * Initializes the component with configuration information.
- *
- * @param id The id of the component.
- * @param configMap The properties for configuring component.
- */
- void initialize(String id, ConfigMap configMap);
-}
+/*
+ * 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;
+
+/**
+ * Components created in the Flex configuration environment can implement
+ * the FlexConfigurable interface to get access to the configuration
+ * properties like a regular component in the system.
+ */
+public interface FlexConfigurable
+{
+ /**
+ * Initializes the component with configuration information.
+ *
+ * @param id The id of the component.
+ * @param configMap The properties for configuring component.
+ */
+ void initialize(String id, ConfigMap configMap);
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FlexContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FlexContext.java b/modules/core/src/flex/messaging/FlexContext.java
old mode 100755
new mode 100644
index d7645b5..eb8e42f
--- a/modules/core/src/flex/messaging/FlexContext.java
+++ b/modules/core/src/flex/messaging/FlexContext.java
@@ -1,473 +1,473 @@
-/*
- * 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.client.FlexClient;
-import flex.messaging.endpoints.Endpoint;
-import flex.messaging.io.TypeMarshallingContext;
-import flex.messaging.security.LoginManager;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.security.Principal;
-
-/**
- * The <tt>FlexContext</tt> is a utility class that exposes the current execution context.
- * It provides access to <tt>FlexSession</tt> and <tt>FlexClient</tt> instances associated
- * with the current message being processed, as well as global context via the <tt>MessageBroker</tt>,
- * <tt>ServletContext</tt> and <tt>ServletConfig</tt> for the application.
- * Any, or all, of the properties exposed by this class may be <code>null</code> depending upon
- * the current execution context so test for that before attempting to interact with them.
- */
-public class FlexContext
-{
- private static ThreadLocal<FlexClient> flexClients = new ThreadLocal<FlexClient>();
- private static ThreadLocal<FlexSession> sessions = new ThreadLocal<FlexSession>();
- private static ThreadLocal<MessageBroker> messageBrokers = new ThreadLocal<MessageBroker>();
- private static ThreadLocal<Endpoint> endpoints = new ThreadLocal<Endpoint>();
- private static ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
- private static ThreadLocal<HttpServletRequest> requests = new ThreadLocal<HttpServletRequest>();
- private static ThreadLocal<HttpServletRequest> tunnelRequests = new ThreadLocal<HttpServletRequest>();
- private static ThreadLocal<ServletConfig> servletConfigs = new ThreadLocal<ServletConfig>();
- private static ThreadLocal<Boolean> messageFromPeer = new ThreadLocal<Boolean>();
- private static ThreadLocal<MessageRoutedNotifier> messageRoutedNotifiers = new ThreadLocal<MessageRoutedNotifier>();
- private static ServletConfig lastGoodServletConfig;
-
- private FlexContext()
- {
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalObjects(FlexClient flexClient,
- FlexSession session,
- MessageBroker broker,
- HttpServletRequest request,
- HttpServletResponse response,
- ServletConfig servletConfig)
- {
- if (flexClients == null) // In case releaseThreadLocalObjects has been called.
- return;
-
- flexClients.set(flexClient);
- sessions.set(session);
- messageBrokers.set(broker);
- requests.set(request);
- responses.set(response);
- setThreadLocalServletConfig(servletConfig);
- messageFromPeer.set(Boolean.FALSE);
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalObjects(FlexClient flexClient, FlexSession session, MessageBroker broker)
- {
- setThreadLocalObjects(flexClient, session, broker, null, null, null);
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void clearThreadLocalObjects()
- {
- if (flexClients == null) // In case releaseThreadLocalObjects has been called.
- return;
-
- flexClients.remove();
- sessions.remove();
- messageBrokers.remove();
- endpoints.remove();
- requests.remove();
- responses.remove();
- tunnelRequests.remove();
- servletConfigs.remove();
- messageFromPeer.remove();
- messageRoutedNotifiers.remove();
-
- TypeMarshallingContext.clearThreadLocalObjects();
- }
-
- /**
- * The HttpServletResponse for the current request if the request is via HTTP.
- * Returns null if the client is using a non-HTTP channel.
- * Available for users.
- * @return HttpServletRequest current HttpServletRequest object
- */
- public static HttpServletRequest getHttpRequest()
- {
- return requests != null? requests.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalHttpRequest(HttpServletRequest value)
- {
- if (requests == null)
- return;
-
- if (value == null)
- requests.remove();
- else
- requests.set(value);
- }
-
- /**
- * The HttpServletResponse for the current request if the request is via HTTP.
- * Returns null if the using an non-HTTP channel.
- * Available for users.
- * @return HttpServletResponse current HttpServletResponse object
- */
- public static HttpServletResponse getHttpResponse()
- {
- return responses != null? responses.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalHttpResponse(HttpServletResponse value)
- {
- if (responses == null)
- return;
-
- if (value == null)
- responses.remove();
- else
- responses.set(value);
- }
-
- /**
- * The HttpServletRequest for the current request if it is transporting a tunneled protocol.
- * Returns null if the current request protocol it not tunneled.
- * Available for users.
- * @return HttpServletRequest tunnel HttpServletRequest object
- */
- public static HttpServletRequest getTunnelHttpRequest()
- {
- return tunnelRequests != null? tunnelRequests.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalTunnelHttpRequest(HttpServletRequest value)
- {
- if (tunnelRequests == null)
- return;
-
- if (value == null)
- tunnelRequests.remove();
- else
- tunnelRequests.set(value);
- }
-
- /**
- * The ServletConfig for the current request, uses the last known ServletConfig
- * when the request is not via HTTP. Available for users.
- * @return ServletConfig current ServletConfig object
- */
- public static ServletConfig getServletConfig()
- {
- if (servletConfigs != null && servletConfigs.get() != null)
- {
- return servletConfigs.get();
- }
- return lastGoodServletConfig;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalServletConfig(ServletConfig value)
- {
- if (servletConfigs == null)
- return;
-
- if (value == null)
- {
- servletConfigs.remove();
- }
- else
- {
- servletConfigs.set(value);
- lastGoodServletConfig = value;
- }
- }
-
- /**
- * The ServletContext for the current web application.
- * @return ServletContext current ServletContext object
- */
- public static ServletContext getServletContext()
- {
- return getServletConfig() != null? getServletConfig().getServletContext() : null;
- }
-
- /**
- * The FlexClient for the current request. Available for users.
- * @return FlexClient the current FlexClient object
- */
- public static FlexClient getFlexClient()
- {
- return flexClients != null? flexClients.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalFlexClient(FlexClient flexClient)
- {
- if (flexClients == null)
- return;
-
- if (flexClient == null)
- flexClients.remove();
- else
- flexClients.set(flexClient);
- }
-
- /**
- * The FlexSession for the current request. Available for users.
- * @return FlexSession the current FlexSession object
- */
- public static FlexSession getFlexSession()
- {
- return sessions != null? sessions.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalSession(FlexSession session)
- {
- if (sessions == null)
- return;
-
- if (session == null)
- sessions.remove();
- else
- sessions.set(session);
- }
-
- /**
- * The MessageBroker for the current request. Not available for users.
- *
- * @exclude
- */
- public static MessageBroker getMessageBroker()
- {
- return messageBrokers != null? messageBrokers.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalMessageBroker(MessageBroker value)
- {
- // This is a special case because MessageBroker is sometimes accessed by
- // services, destinations, adapters during shutdown so it needs to be set
- // on the context even if a previous MessageBrokerServlet#destroy called
- // releaseThreadLocalObjects.
- if (messageBrokers == null)
- messageBrokers = new ThreadLocal<MessageBroker>();
-
- if (value == null)
- messageBrokers.remove();
- else
- messageBrokers.set(value);
- }
-
- /**
- * The Endpoint for the current message. Not available for users.
- * @exclude
- */
- public static Endpoint getEndpoint()
- {
- return endpoints != null? endpoints.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setThreadLocalEndpoint(Endpoint value)
- {
- if (endpoints == null)
- return;
-
- if (value == null)
- endpoints.remove();
- else
- endpoints.set(value);
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static MessageRoutedNotifier getMessageRoutedNotifier()
- {
- return messageRoutedNotifiers != null? messageRoutedNotifiers.get() : null;
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static void setMessageRoutedNotifier(MessageRoutedNotifier value)
- {
- if (messageRoutedNotifiers == null)
- return;
-
- if (value == null)
- messageRoutedNotifiers.remove();
- else
- messageRoutedNotifiers.set(value);
- }
-
- /**
- * Indicates whether the current message being processed came from a server peer
- * in a cluster.
- *
- * @return true if message from a peer
- */
- public static boolean isMessageFromPeer()
- {
- return messageFromPeer != null? messageFromPeer.get() : false;
- }
-
- /**
- * Sets a thread local indicating whether the message being processed came from
- * a server peer in a cluster.
- *
- * @param value True if the message came from a peer; otherwise false.
- *
- * @exclude
- */
- public static void setMessageFromPeer(boolean value)
- {
- if (messageFromPeer == null)
- return;
-
- messageFromPeer.set(value);
- }
-
- /**
- * Users should not call this.
- * @exclude
- */
- public static boolean isPerClientAuthentication()
- {
- MessageBroker messageBroker = getMessageBroker();
- if (messageBroker == null)
- return false;
-
- LoginManager loginManager = messageBroker.getLoginManager();
- return loginManager == null? false : loginManager.isPerClientAuthentication();
- }
-
- /**
- * Returns the principal associated with the session or client depending on whether
- * perClientauthentication is being used. If the client has not
- * authenticated the principal will be null.
- *
- * @return The principal associated with the session.
- */
- public static Principal getUserPrincipal()
- {
- if (isPerClientAuthentication())
- {
- FlexClient client = getFlexClient();
- return client != null? client.getUserPrincipal() : null;
- }
-
- FlexSession session = getFlexSession();
- return session != null? session.getUserPrincipal() : null;
- }
-
- /**
- * Sets the Principal on either the current FlexClient or FlexSession depending upon whether
- * perClientAuthentication is in use.
- *
- * @param userPrincipal The principal to associate with the FlexClient or FlexSession
- * depending upon whether perClientAuthentication is in use.
- */
- public static void setUserPrincipal(Principal userPrincipal)
- {
- if (isPerClientAuthentication())
- getFlexClient().setUserPrincipal(userPrincipal);
- else
- getFlexSession().setUserPrincipal(userPrincipal);
- }
-
- /**
- * @exclude
- * Create the static thread local storage.
- */
- public static void createThreadLocalObjects()
- {
- if (flexClients == null) // Allocate if needed.
- {
- flexClients = new ThreadLocal<FlexClient>();
- sessions = new ThreadLocal<FlexSession>();
- messageBrokers = new ThreadLocal<MessageBroker>();
- endpoints = new ThreadLocal<Endpoint>();
- responses = new ThreadLocal<HttpServletResponse>();
- requests = new ThreadLocal<HttpServletRequest>();
- tunnelRequests = new ThreadLocal<HttpServletRequest>();
- servletConfigs = new ThreadLocal<ServletConfig>();
- messageFromPeer = new ThreadLocal<Boolean>();
- messageRoutedNotifiers = new ThreadLocal<MessageRoutedNotifier>();
- }
- }
-
- /**
- * @exclude
- * Destroy the static thread local storage.
- * Call ONLY on shutdown
- */
- public static void releaseThreadLocalObjects()
- {
- clearThreadLocalObjects();
-
- flexClients = null;
- sessions = null;
- messageBrokers = null;
- endpoints = null;
- responses = null;
- requests = null;
- tunnelRequests = null;
- servletConfigs = null;
- messageFromPeer = null;
- messageRoutedNotifiers = null;
- }
-}
+/*
+ * 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.client.FlexClient;
+import flex.messaging.endpoints.Endpoint;
+import flex.messaging.io.TypeMarshallingContext;
+import flex.messaging.security.LoginManager;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.security.Principal;
+
+/**
+ * The <tt>FlexContext</tt> is a utility class that exposes the current execution context.
+ * It provides access to <tt>FlexSession</tt> and <tt>FlexClient</tt> instances associated
+ * with the current message being processed, as well as global context via the <tt>MessageBroker</tt>,
+ * <tt>ServletContext</tt> and <tt>ServletConfig</tt> for the application.
+ * Any, or all, of the properties exposed by this class may be <code>null</code> depending upon
+ * the current execution context so test for that before attempting to interact with them.
+ */
+public class FlexContext
+{
+ private static ThreadLocal<FlexClient> flexClients = new ThreadLocal<FlexClient>();
+ private static ThreadLocal<FlexSession> sessions = new ThreadLocal<FlexSession>();
+ private static ThreadLocal<MessageBroker> messageBrokers = new ThreadLocal<MessageBroker>();
+ private static ThreadLocal<Endpoint> endpoints = new ThreadLocal<Endpoint>();
+ private static ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
+ private static ThreadLocal<HttpServletRequest> requests = new ThreadLocal<HttpServletRequest>();
+ private static ThreadLocal<HttpServletRequest> tunnelRequests = new ThreadLocal<HttpServletRequest>();
+ private static ThreadLocal<ServletConfig> servletConfigs = new ThreadLocal<ServletConfig>();
+ private static ThreadLocal<Boolean> messageFromPeer = new ThreadLocal<Boolean>();
+ private static ThreadLocal<MessageRoutedNotifier> messageRoutedNotifiers = new ThreadLocal<MessageRoutedNotifier>();
+ private static ServletConfig lastGoodServletConfig;
+
+ private FlexContext()
+ {
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalObjects(FlexClient flexClient,
+ FlexSession session,
+ MessageBroker broker,
+ HttpServletRequest request,
+ HttpServletResponse response,
+ ServletConfig servletConfig)
+ {
+ if (flexClients == null) // In case releaseThreadLocalObjects has been called.
+ return;
+
+ flexClients.set(flexClient);
+ sessions.set(session);
+ messageBrokers.set(broker);
+ requests.set(request);
+ responses.set(response);
+ setThreadLocalServletConfig(servletConfig);
+ messageFromPeer.set(Boolean.FALSE);
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalObjects(FlexClient flexClient, FlexSession session, MessageBroker broker)
+ {
+ setThreadLocalObjects(flexClient, session, broker, null, null, null);
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void clearThreadLocalObjects()
+ {
+ if (flexClients == null) // In case releaseThreadLocalObjects has been called.
+ return;
+
+ flexClients.remove();
+ sessions.remove();
+ messageBrokers.remove();
+ endpoints.remove();
+ requests.remove();
+ responses.remove();
+ tunnelRequests.remove();
+ servletConfigs.remove();
+ messageFromPeer.remove();
+ messageRoutedNotifiers.remove();
+
+ TypeMarshallingContext.clearThreadLocalObjects();
+ }
+
+ /**
+ * The HttpServletResponse for the current request if the request is via HTTP.
+ * Returns null if the client is using a non-HTTP channel.
+ * Available for users.
+ * @return HttpServletRequest current HttpServletRequest object
+ */
+ public static HttpServletRequest getHttpRequest()
+ {
+ return requests != null? requests.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalHttpRequest(HttpServletRequest value)
+ {
+ if (requests == null)
+ return;
+
+ if (value == null)
+ requests.remove();
+ else
+ requests.set(value);
+ }
+
+ /**
+ * The HttpServletResponse for the current request if the request is via HTTP.
+ * Returns null if the using an non-HTTP channel.
+ * Available for users.
+ * @return HttpServletResponse current HttpServletResponse object
+ */
+ public static HttpServletResponse getHttpResponse()
+ {
+ return responses != null? responses.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalHttpResponse(HttpServletResponse value)
+ {
+ if (responses == null)
+ return;
+
+ if (value == null)
+ responses.remove();
+ else
+ responses.set(value);
+ }
+
+ /**
+ * The HttpServletRequest for the current request if it is transporting a tunneled protocol.
+ * Returns null if the current request protocol it not tunneled.
+ * Available for users.
+ * @return HttpServletRequest tunnel HttpServletRequest object
+ */
+ public static HttpServletRequest getTunnelHttpRequest()
+ {
+ return tunnelRequests != null? tunnelRequests.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalTunnelHttpRequest(HttpServletRequest value)
+ {
+ if (tunnelRequests == null)
+ return;
+
+ if (value == null)
+ tunnelRequests.remove();
+ else
+ tunnelRequests.set(value);
+ }
+
+ /**
+ * The ServletConfig for the current request, uses the last known ServletConfig
+ * when the request is not via HTTP. Available for users.
+ * @return ServletConfig current ServletConfig object
+ */
+ public static ServletConfig getServletConfig()
+ {
+ if (servletConfigs != null && servletConfigs.get() != null)
+ {
+ return servletConfigs.get();
+ }
+ return lastGoodServletConfig;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalServletConfig(ServletConfig value)
+ {
+ if (servletConfigs == null)
+ return;
+
+ if (value == null)
+ {
+ servletConfigs.remove();
+ }
+ else
+ {
+ servletConfigs.set(value);
+ lastGoodServletConfig = value;
+ }
+ }
+
+ /**
+ * The ServletContext for the current web application.
+ * @return ServletContext current ServletContext object
+ */
+ public static ServletContext getServletContext()
+ {
+ return getServletConfig() != null? getServletConfig().getServletContext() : null;
+ }
+
+ /**
+ * The FlexClient for the current request. Available for users.
+ * @return FlexClient the current FlexClient object
+ */
+ public static FlexClient getFlexClient()
+ {
+ return flexClients != null? flexClients.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalFlexClient(FlexClient flexClient)
+ {
+ if (flexClients == null)
+ return;
+
+ if (flexClient == null)
+ flexClients.remove();
+ else
+ flexClients.set(flexClient);
+ }
+
+ /**
+ * The FlexSession for the current request. Available for users.
+ * @return FlexSession the current FlexSession object
+ */
+ public static FlexSession getFlexSession()
+ {
+ return sessions != null? sessions.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalSession(FlexSession session)
+ {
+ if (sessions == null)
+ return;
+
+ if (session == null)
+ sessions.remove();
+ else
+ sessions.set(session);
+ }
+
+ /**
+ * The MessageBroker for the current request. Not available for users.
+ *
+ * @exclude
+ */
+ public static MessageBroker getMessageBroker()
+ {
+ return messageBrokers != null? messageBrokers.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalMessageBroker(MessageBroker value)
+ {
+ // This is a special case because MessageBroker is sometimes accessed by
+ // services, destinations, adapters during shutdown so it needs to be set
+ // on the context even if a previous MessageBrokerServlet#destroy called
+ // releaseThreadLocalObjects.
+ if (messageBrokers == null)
+ messageBrokers = new ThreadLocal<MessageBroker>();
+
+ if (value == null)
+ messageBrokers.remove();
+ else
+ messageBrokers.set(value);
+ }
+
+ /**
+ * The Endpoint for the current message. Not available for users.
+ * @exclude
+ */
+ public static Endpoint getEndpoint()
+ {
+ return endpoints != null? endpoints.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setThreadLocalEndpoint(Endpoint value)
+ {
+ if (endpoints == null)
+ return;
+
+ if (value == null)
+ endpoints.remove();
+ else
+ endpoints.set(value);
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static MessageRoutedNotifier getMessageRoutedNotifier()
+ {
+ return messageRoutedNotifiers != null? messageRoutedNotifiers.get() : null;
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static void setMessageRoutedNotifier(MessageRoutedNotifier value)
+ {
+ if (messageRoutedNotifiers == null)
+ return;
+
+ if (value == null)
+ messageRoutedNotifiers.remove();
+ else
+ messageRoutedNotifiers.set(value);
+ }
+
+ /**
+ * Indicates whether the current message being processed came from a server peer
+ * in a cluster.
+ *
+ * @return true if message from a peer
+ */
+ public static boolean isMessageFromPeer()
+ {
+ return messageFromPeer != null? messageFromPeer.get() : false;
+ }
+
+ /**
+ * Sets a thread local indicating whether the message being processed came from
+ * a server peer in a cluster.
+ *
+ * @param value True if the message came from a peer; otherwise false.
+ *
+ * @exclude
+ */
+ public static void setMessageFromPeer(boolean value)
+ {
+ if (messageFromPeer == null)
+ return;
+
+ messageFromPeer.set(value);
+ }
+
+ /**
+ * Users should not call this.
+ * @exclude
+ */
+ public static boolean isPerClientAuthentication()
+ {
+ MessageBroker messageBroker = getMessageBroker();
+ if (messageBroker == null)
+ return false;
+
+ LoginManager loginManager = messageBroker.getLoginManager();
+ return loginManager == null? false : loginManager.isPerClientAuthentication();
+ }
+
+ /**
+ * Returns the principal associated with the session or client depending on whether
+ * perClientauthentication is being used. If the client has not
+ * authenticated the principal will be null.
+ *
+ * @return The principal associated with the session.
+ */
+ public static Principal getUserPrincipal()
+ {
+ if (isPerClientAuthentication())
+ {
+ FlexClient client = getFlexClient();
+ return client != null? client.getUserPrincipal() : null;
+ }
+
+ FlexSession session = getFlexSession();
+ return session != null? session.getUserPrincipal() : null;
+ }
+
+ /**
+ * Sets the Principal on either the current FlexClient or FlexSession depending upon whether
+ * perClientAuthentication is in use.
+ *
+ * @param userPrincipal The principal to associate with the FlexClient or FlexSession
+ * depending upon whether perClientAuthentication is in use.
+ */
+ public static void setUserPrincipal(Principal userPrincipal)
+ {
+ if (isPerClientAuthentication())
+ getFlexClient().setUserPrincipal(userPrincipal);
+ else
+ getFlexSession().setUserPrincipal(userPrincipal);
+ }
+
+ /**
+ * @exclude
+ * Create the static thread local storage.
+ */
+ public static void createThreadLocalObjects()
+ {
+ if (flexClients == null) // Allocate if needed.
+ {
+ flexClients = new ThreadLocal<FlexClient>();
+ sessions = new ThreadLocal<FlexSession>();
+ messageBrokers = new ThreadLocal<MessageBroker>();
+ endpoints = new ThreadLocal<Endpoint>();
+ responses = new ThreadLocal<HttpServletResponse>();
+ requests = new ThreadLocal<HttpServletRequest>();
+ tunnelRequests = new ThreadLocal<HttpServletRequest>();
+ servletConfigs = new ThreadLocal<ServletConfig>();
+ messageFromPeer = new ThreadLocal<Boolean>();
+ messageRoutedNotifiers = new ThreadLocal<MessageRoutedNotifier>();
+ }
+ }
+
+ /**
+ * @exclude
+ * Destroy the static thread local storage.
+ * Call ONLY on shutdown
+ */
+ public static void releaseThreadLocalObjects()
+ {
+ clearThreadLocalObjects();
+
+ flexClients = null;
+ sessions = null;
+ messageBrokers = null;
+ endpoints = null;
+ responses = null;
+ requests = null;
+ tunnelRequests = null;
+ servletConfigs = null;
+ messageFromPeer = null;
+ messageRoutedNotifiers = null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FlexFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FlexFactory.java b/modules/core/src/flex/messaging/FlexFactory.java
old mode 100755
new mode 100644
index 3a762c5..2633460
--- a/modules/core/src/flex/messaging/FlexFactory.java
+++ b/modules/core/src/flex/messaging/FlexFactory.java
@@ -1,87 +1,87 @@
-/*
- * 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;
-
-/**
- * The FlexFactory interface is implemented by factory components that provide
- * instances to the Flex messaging framework. You can implement this interface
- * if you want to tie together Flex Data Services with another system which maintains
- * component instances (often called the "services layer" in a typical enterprise
- * architecture). By implementing FlexFactory, you can configure a Flex
- * RemoteObject destination or a Flex Data Management Services assembler which
- * uses a Java object instance in your services layer rather than having Data Services
- * create a new component instance. In some cases, this means you avoid writing
- * glue code for each service you want to expose to flex clients.
- */
-public interface FlexFactory extends FlexConfigurable
-{
- /** Request scope string. */
- String SCOPE_REQUEST = "request";
- /** Session scope string. */
- String SCOPE_SESSION = "session";
- /** Application scope string .*/
- String SCOPE_APPLICATION = "application";
- /** Scope string. */
- String SCOPE = "scope";
- /** Source string. */
- String SOURCE = "source";
-
- /**
- * Called when the
- * definition of an instance that this factory looks up is initialized.
- * It should validate that
- * the properties supplied are valid to define an instance
- * and returns an instance of the type FactoryInstance
- * that contains all configuration necessary to construct
- * an instance of this object. If the instance is application
- * scoped, the FactoryInstance may contain a reference to the
- * instance directly.
- * <p>
- * Any valid properties used for this configuration
- * must be accessed to avoid warnings about unused configuration
- * elements. If your factory is only used for application
- * scoped components, you do not need to implement
- * this method as the lookup method itself can be used
- * to validate its configuration.
- * </p><p>
- * The id property is used as a name to help you identify
- * this factory instance for any errors it might generate.
- * </p>
- *
- */
- FactoryInstance createFactoryInstance(String id, ConfigMap properties);
-
- /**
- * This method is called by the default implementation of FactoryInstance.lookup.
- * When Data Services wants an instance of a given factory destination, it calls the
- * FactoryInstance.lookup to retrieve that instance. That method in turn
- * calls this method by default.
- *
- * For simple FlexFactory implementations which do not need to
- * add additional configuration properties or logic to the FactoryInstance class,
- * by implementing this method you can avoid having to add an additional subclass of
- * FactoryInstance for your factory. If you do extend FactoryInstance, it is
- * recommended that you just override FactoryInstance.lookup and put your logic
- * there to avoid the extra level of indirection.
- *
- * @param instanceInfo The FactoryInstance for this destination
- * @return the Object instance to use for the given operation for this destination.
- */
- Object lookup(FactoryInstance instanceInfo);
-}
+/*
+ * 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;
+
+/**
+ * The FlexFactory interface is implemented by factory components that provide
+ * instances to the Flex messaging framework. You can implement this interface
+ * if you want to tie together Flex Data Services with another system which maintains
+ * component instances (often called the "services layer" in a typical enterprise
+ * architecture). By implementing FlexFactory, you can configure a Flex
+ * RemoteObject destination or a Flex Data Management Services assembler which
+ * uses a Java object instance in your services layer rather than having Data Services
+ * create a new component instance. In some cases, this means you avoid writing
+ * glue code for each service you want to expose to flex clients.
+ */
+public interface FlexFactory extends FlexConfigurable
+{
+ /** Request scope string. */
+ String SCOPE_REQUEST = "request";
+ /** Session scope string. */
+ String SCOPE_SESSION = "session";
+ /** Application scope string .*/
+ String SCOPE_APPLICATION = "application";
+ /** Scope string. */
+ String SCOPE = "scope";
+ /** Source string. */
+ String SOURCE = "source";
+
+ /**
+ * Called when the
+ * definition of an instance that this factory looks up is initialized.
+ * It should validate that
+ * the properties supplied are valid to define an instance
+ * and returns an instance of the type FactoryInstance
+ * that contains all configuration necessary to construct
+ * an instance of this object. If the instance is application
+ * scoped, the FactoryInstance may contain a reference to the
+ * instance directly.
+ * <p>
+ * Any valid properties used for this configuration
+ * must be accessed to avoid warnings about unused configuration
+ * elements. If your factory is only used for application
+ * scoped components, you do not need to implement
+ * this method as the lookup method itself can be used
+ * to validate its configuration.
+ * </p><p>
+ * The id property is used as a name to help you identify
+ * this factory instance for any errors it might generate.
+ * </p>
+ *
+ */
+ FactoryInstance createFactoryInstance(String id, ConfigMap properties);
+
+ /**
+ * This method is called by the default implementation of FactoryInstance.lookup.
+ * When Data Services wants an instance of a given factory destination, it calls the
+ * FactoryInstance.lookup to retrieve that instance. That method in turn
+ * calls this method by default.
+ *
+ * For simple FlexFactory implementations which do not need to
+ * add additional configuration properties or logic to the FactoryInstance class,
+ * by implementing this method you can avoid having to add an additional subclass of
+ * FactoryInstance for your factory. If you do extend FactoryInstance, it is
+ * recommended that you just override FactoryInstance.lookup and put your logic
+ * there to avoid the extra level of indirection.
+ *
+ * @param instanceInfo The FactoryInstance for this destination
+ * @return the Object instance to use for the given operation for this destination.
+ */
+ Object lookup(FactoryInstance instanceInfo);
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/FlexRemoteCredentials.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/FlexRemoteCredentials.java b/modules/core/src/flex/messaging/FlexRemoteCredentials.java
old mode 100755
new mode 100644
index bd0f695..99a927b
--- a/modules/core/src/flex/messaging/FlexRemoteCredentials.java
+++ b/modules/core/src/flex/messaging/FlexRemoteCredentials.java
@@ -1,93 +1,93 @@
-/*
- * 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;
-
-/**
- * A wrapper object used for holding onto remote credentials. When you are using
- * the proxy service, the remote credentials are used for authenticating against
- * the proxy server. The remote credentials are distinct from the local credentials
- * used to authenticate against the local server. You use this class along with
- * the FlexSession methods getRemoteCredentials and putRemoteCredentials to associate
- * the remote credentials with a specific destination.
- */
-public class FlexRemoteCredentials
-{
- private String service;
-
- private String destination;
-
- private String username;
-
- private Object credentials;
-
- /**
- * Normally you do not have to create the FlexRemoteCredentials as they are
- * created automatically when the client specifies them via the setRemoteCredentials
- * method in ActionScript. You'd use this if you wanted to set your remote credentials
- * on the server and not have them specified on the client.
- * @param service the service id
- * @param destination the destination id
- * @param username the user name
- * @param credentials the user credentials
- */
- public FlexRemoteCredentials(String service, String destination,
- String username, Object credentials)
- {
- super();
- this.service = service;
- this.destination = destination;
- this.username = username;
- this.credentials = credentials;
- }
-
- /**
- * Returns the user name from the remote credentials.
- * @return String the user name
- */
- public String getUsername()
- {
- return username;
- }
-
- /**
- * Returns the credentials themselves (usually a password).
- * @return Object the credentials object
- */
- public Object getCredentials()
- {
- return credentials;
- }
-
- /**
- * Returns the id of the service these credentials are registered for.
- * @return String the service id
- */
- public String getService()
- {
- return service;
- }
-
- /**
- * Returns the destination for the service.
- * @return String the destination id
- */
- public String getDestination()
- {
- return destination;
- }
-}
+/*
+ * 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;
+
+/**
+ * A wrapper object used for holding onto remote credentials. When you are using
+ * the proxy service, the remote credentials are used for authenticating against
+ * the proxy server. The remote credentials are distinct from the local credentials
+ * used to authenticate against the local server. You use this class along with
+ * the FlexSession methods getRemoteCredentials and putRemoteCredentials to associate
+ * the remote credentials with a specific destination.
+ */
+public class FlexRemoteCredentials
+{
+ private String service;
+
+ private String destination;
+
+ private String username;
+
+ private Object credentials;
+
+ /**
+ * Normally you do not have to create the FlexRemoteCredentials as they are
+ * created automatically when the client specifies them via the setRemoteCredentials
+ * method in ActionScript. You'd use this if you wanted to set your remote credentials
+ * on the server and not have them specified on the client.
+ * @param service the service id
+ * @param destination the destination id
+ * @param username the user name
+ * @param credentials the user credentials
+ */
+ public FlexRemoteCredentials(String service, String destination,
+ String username, Object credentials)
+ {
+ super();
+ this.service = service;
+ this.destination = destination;
+ this.username = username;
+ this.credentials = credentials;
+ }
+
+ /**
+ * Returns the user name from the remote credentials.
+ * @return String the user name
+ */
+ public String getUsername()
+ {
+ return username;
+ }
+
+ /**
+ * Returns the credentials themselves (usually a password).
+ * @return Object the credentials object
+ */
+ public Object getCredentials()
+ {
+ return credentials;
+ }
+
+ /**
+ * Returns the id of the service these credentials are registered for.
+ * @return String the service id
+ */
+ public String getService()
+ {
+ return service;
+ }
+
+ /**
+ * Returns the destination for the service.
+ * @return String the destination id
+ */
+ public String getDestination()
+ {
+ return destination;
+ }
+}