You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2015/12/20 14:13:43 UTC

[03/51] [partial] flex-blazeds git commit: Removed legacy directories and made the content of the modules directory the new root - Please use the maven build for now as the Ant build will no longer work untill it is adjusted to the new directory structur

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/ServletResourceResolver.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/ServletResourceResolver.java b/core/src/flex/messaging/config/ServletResourceResolver.java
new file mode 100644
index 0000000..b79bc27
--- /dev/null
+++ b/core/src/flex/messaging/config/ServletResourceResolver.java
@@ -0,0 +1,156 @@
+/*
+ * 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.config;
+
+import flex.messaging.io.ArrayList;
+
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Stack;
+
+/**
+ *
+ */
+public class ServletResourceResolver implements ConfigurationFileResolver
+{
+    private ServletContext context;
+    private Stack configurationPathStack = new Stack();
+
+    /**
+     * Constructor.
+     *
+     * @param context servlet context
+     */
+    public ServletResourceResolver(ServletContext context)
+    {
+        this.context = context;
+    }
+
+    /**
+     * Is the configuration file available.
+     *
+     * @param path path to check
+     * @param throwError true if wmethod shold throw a ConfigurationException if path no found.
+     * @return true if path is available
+     * @throws ConfigurationException if throwError is true and path is not available
+     */
+    public boolean isAvailable(String path, boolean throwError) throws ConfigurationException
+    {
+        boolean available = false;
+        InputStream is = context.getResourceAsStream(path);
+        if (is != null)
+        {
+            try { is.close(); } catch (IOException ignore) { /* ignore */}
+            pushConfigurationFile(path);
+            available = true;
+        }
+        else
+        {
+            if (throwError)
+            {
+                // Please specify a valid ''services.configuration.file'' in web.xml.
+                ConfigurationException e = new ConfigurationException();
+                e.setMessage(11108, new Object[] {path});
+                throw e;
+            }
+        }
+
+        return available;
+    }
+
+    public InputStream getConfigurationFile(String path)
+    {
+        InputStream is = context.getResourceAsStream(path);
+        if (is != null)
+        {
+            pushConfigurationFile(path);
+            return is;
+        }
+        else
+        {
+            // Please specify a valid ''services.configuration.file'' in web.xml.
+            ConfigurationException e = new ConfigurationException();
+            e.setMessage(11108, new Object[] {path});
+            throw e;
+        }
+    }
+
+    public InputStream getIncludedFile(String src)
+    {
+        String path = configurationPathStack.peek() + "/" + src;
+        InputStream is = context.getResourceAsStream(path);
+
+        if (is != null)
+        {
+            pushConfigurationFile(path);
+            return is;
+        }
+        else
+        {
+            // Please specify a valid include file. ''{0}'' is invalid.
+            ConfigurationException e = new ConfigurationException();
+            e.setMessage(11107, new Object[] {path});
+            throw e;
+        }
+    }
+
+    public void popIncludedFile()
+    {
+        configurationPathStack.pop();
+    }
+
+    /**
+     * Returns the list of XML files (denoted by .xml extension) in the directory
+     * relative to the current configuration file.
+     */
+    public List getFiles(String dir)
+    {
+        List result =  new ArrayList();
+        String prefix = configurationPathStack.peek() + "/";
+        Set paths = context.getResourcePaths(prefix + dir);
+        if (paths != null)
+        {
+            for (Object entry : paths)
+            {
+                String path = (String) entry;
+                if (path.endsWith(".xml"))
+                {
+                    result.add(path.substring(prefix.length()));
+                }
+            }
+            return result;
+        }
+        else
+        {
+            // Please specify a valid include directory. ''{0}'' is invalid.
+            ConfigurationException e = new ConfigurationException();
+            e.setMessage(11113, new Object[]{dir});
+            throw e;
+        }
+    }
+
+    private void pushConfigurationFile(String path)
+    {
+        String topLevelPath = path.substring(0, path.lastIndexOf('/'));
+        configurationPathStack.push(topLevelPath);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/SharedServerSettings.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/SharedServerSettings.java b/core/src/flex/messaging/config/SharedServerSettings.java
new file mode 100644
index 0000000..8fe815a
--- /dev/null
+++ b/core/src/flex/messaging/config/SharedServerSettings.java
@@ -0,0 +1,65 @@
+/*
+ * 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.config;
+
+/**
+ * Stores configuration settings for a shared server instance.
+ * <tt>ServerConfigurationParser</tt> will generate an instance for each shared server
+ * defined in the configuration file.
+ * The <tt>MessagingConfiguration</tt> instance using the parser will store these and
+ * use them to configure the <tt>MessageBroker</tt> with shared server instances.
+ *
+ *
+ */
+public class SharedServerSettings extends PropertiesSettings
+{
+    private String id;
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId(String value)
+    {
+        id = value;
+    }
+
+    private String className;
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public void setClassName(String value)
+    {
+        className = value;
+    }
+    
+    private String sourceFile;
+    
+    public String getSourceFile()
+    {
+        return sourceFile;
+    }
+    
+    public void setSourceFile(String value)
+    {
+        sourceFile = value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/SystemSettings.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/SystemSettings.java b/core/src/flex/messaging/config/SystemSettings.java
new file mode 100644
index 0000000..cf4cd49
--- /dev/null
+++ b/core/src/flex/messaging/config/SystemSettings.java
@@ -0,0 +1,300 @@
+/*
+ * 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.config;
+
+import flex.messaging.log.Log;
+import flex.messaging.log.Logger;
+import flex.messaging.util.PropertyStringResourceLoader;
+import flex.messaging.util.ResourceLoader;
+import flex.messaging.util.WatchedObject;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ */
+public class SystemSettings
+{
+    private ResourceLoader resourceLoader;
+    private Locale defaultLocale;
+    private boolean enforceEndpointValidation;
+    private boolean manageable;
+    private boolean redeployEnabled;
+    private int watchInterval;
+    private List watches;
+    private List touches;
+    private String uuidGeneratorClassName;
+    private String dotNetFrameworkVersion;
+
+    public SystemSettings()
+    {
+        enforceEndpointValidation = false;
+        manageable = true;
+        redeployEnabled = false;
+        resourceLoader = new PropertyStringResourceLoader();
+        touches = new ArrayList();
+        watches = new ArrayList();
+        watchInterval = 20;
+        dotNetFrameworkVersion = null;
+    }
+
+    public void setDefaultLocale(Locale locale)
+    {
+        defaultLocale = locale;
+        resourceLoader.setDefaultLocale(defaultLocale);
+    }
+
+    public Locale getDefaultLocale()
+    {
+        return defaultLocale;
+    }
+
+    public boolean isManageable()
+    {
+        return manageable;
+    }
+
+    public void setManageable(String manageable)
+    {
+        manageable = manageable.toLowerCase();
+        if (manageable.startsWith("f"))
+            this.manageable = false;
+    }
+
+    public boolean isEnforceEndpointValidation()
+    {
+        return enforceEndpointValidation;
+    }
+
+    public void setEnforceEndpointValidation(String enforceEndpointValidation)
+    {
+        if (enforceEndpointValidation == null || enforceEndpointValidation.length() == 0)
+            return;
+        if (enforceEndpointValidation.toLowerCase().startsWith("t"))
+            this.enforceEndpointValidation = true;
+    }
+
+    public ResourceLoader getResourceLoader()
+    {
+        return resourceLoader;
+    }
+
+    public void setResourceLoader(ResourceLoader resourceLoader)
+    {
+        this.resourceLoader = resourceLoader;
+    }
+
+    public void setRedeployEnabled(String enabled)
+    {
+        enabled = enabled.toLowerCase();
+        if (enabled.startsWith("t"))
+            this.redeployEnabled = true;
+    }
+
+    public boolean getRedeployEnabled()
+    {
+        return redeployEnabled;
+    }
+
+    public void setWatchInterval(String interval)
+    {
+        this.watchInterval = Integer.parseInt(interval);
+    }
+
+    public int getWatchInterval()
+    {
+        return watchInterval;
+    }
+
+    public void addWatchFile(String watch)
+    {
+        this.watches.add(watch);
+    }
+
+    public List getWatchFiles()
+    {
+        return watches;
+    }
+
+    public void addTouchFile(String touch)
+    {
+        this.touches.add(touch);
+    }
+
+    public List getTouchFiles()
+    {
+        return touches;
+    }
+
+    public void setPaths(ServletContext context)
+    {
+        if (redeployEnabled)
+        {
+            List resolvedWatches = new ArrayList();
+            for (int i = 0; i < watches.size(); i++)
+            {
+                String path = (String)watches.get(i);
+                String resolvedPath = null;
+                if (path.startsWith("{context.root}") || path.startsWith("{context-root}"))
+                {
+                    path = path.substring(14);
+                    resolvedPath = context.getRealPath(path);
+
+                    if (resolvedPath != null)
+                    {
+                        try
+                        {
+                            resolvedWatches.add(new WatchedObject(resolvedPath));
+                        }
+                        catch (FileNotFoundException fnfe)
+                        {
+                            Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                            if (logger != null)
+                            {
+                                logger.warn("The watch-file, " + path + ", could not be found and will be ignored.");
+                            }
+                        }
+                    }
+                    else
+                    {
+                        Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                        logger.warn("The watch-file, " + path + ", could not be resolved to a path and will be ignored.");
+                    }
+                }
+                else
+                {
+                    try
+                    {
+                        resolvedWatches.add(new WatchedObject(path));
+                    }
+                    catch (FileNotFoundException fnfe)
+                    {
+                        Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                        if (logger != null)
+                        {
+                            logger.warn("The watch-file, " + path + ", could not be found and will be ignored.");
+                        }
+                    }
+                }
+            }
+            watches = resolvedWatches;
+
+            List resolvedTouches = new ArrayList();
+            for (int i = 0; i < touches.size(); i++)
+            {
+                String path = (String)touches.get(i);
+                String resolvedPath = null;
+                if (path.startsWith("{context.root}") || path.startsWith("{context-root}"))
+                {
+                    path = path.substring(14);
+                    resolvedPath = context.getRealPath(path);
+
+                    if (resolvedPath != null)
+                    {
+                        File file = new File(resolvedPath);
+                        if (!file.exists() || (!file.isFile() && !file.isDirectory()) || (!file.isAbsolute()))
+                        {
+                            Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                            logger.warn("The touch-file, " + path + ", could not be found and will be ignored.");
+                        }
+                        else
+                        {
+                            resolvedTouches.add(resolvedPath);
+                        }
+                    }
+                    else
+                    {
+                        Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                        logger.warn("The touch-file, " + path + ", could not be resolved to a path and will be ignored.");
+                    }
+                }
+                else
+                {
+                    try
+                    {
+                        resolvedTouches.add(new WatchedObject(path));
+                    }
+                    catch (FileNotFoundException fnfe)
+                    {
+                        Logger logger = Log.getLogger(ConfigurationManager.LOG_CATEGORY);
+                        if (logger != null)
+                        {
+                            logger.warn("The touch-file, " + path + ", could not be found and will be ignored.");
+                        }
+                    }
+                }
+            }
+            touches = resolvedTouches;
+        }
+    }
+
+    /**
+     * Returns the UUID generator class name.
+     * 
+     * @return The UUID generator class name.
+     */
+    public String getUUIDGeneratorClassName()
+    {
+        return uuidGeneratorClassName;
+    }
+
+    /**
+     * Sets the UUID generator class name.
+     * 
+     * @param value The UUID generator class name.
+     */
+    public void setUUIDGeneratorClassName(String value)
+    {
+        uuidGeneratorClassName = value;
+    }
+
+    /**
+     * Set the dotnet framework version to use.
+     * @param version the configured dotnet framework version
+     */
+    public void setDotNetFrameworkVersion(String version)
+    {
+        dotNetFrameworkVersion = version;
+    }
+    
+    /**
+     * Get the dotnet framework version.
+     * @return String the dotnet framework version
+     */
+    public String getDotNetFrameworkVersion()
+    {
+        return dotNetFrameworkVersion;
+    }
+    /**
+     * Clean up static member variables.
+     */
+    public void clear()
+    {
+        resourceLoader = null;
+        defaultLocale = null;
+        watches = null;
+        touches = null;
+        dotNetFrameworkVersion = null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/ThrottleSettings.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/ThrottleSettings.java b/core/src/flex/messaging/config/ThrottleSettings.java
new file mode 100644
index 0000000..96b5a3b
--- /dev/null
+++ b/core/src/flex/messaging/config/ThrottleSettings.java
@@ -0,0 +1,373 @@
+/*
+ * 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.config;
+
+/**
+ * This configuration class is derived from optional properties that
+ * may be supplied in the &lt;properties&gt; section of a destination.
+ * It exists to capture properties related to message throttling in a way
+ * that simplifies the ThrottleManager's usage of the configuration.
+ */
+public class ThrottleSettings
+{
+    /**
+     * The Policy enum.
+     */
+    public enum Policy
+    {
+        NONE,
+        ERROR,
+        IGNORE,
+        BUFFER,
+        CONFLATE
+    };
+
+
+    public static final String ELEMENT_INBOUND = "throttle-inbound";
+
+    public static final String ELEMENT_OUTBOUND = "throttle-outbound";
+
+    public static final String ELEMENT_POLICY = "policy";
+
+    public static final String ELEMENT_DEST_FREQ = "max-frequency";
+
+    public static final String ELEMENT_CLIENT_FREQ = "max-client-frequency";
+
+    // Errors
+    private static final int ERR_MSG_INVALID_INBOUND_POLICY = 11130;
+    private static final int ERR_MSG_INVALID_INCOMING_CLENT_FREQ = 11131;
+    private static final int ERR_MSG_INVALID_INCOMING_DEST_FREQ = 11132;
+    private static final int ERR_MSG_INVALID_OUTGOING_CLIENT_FREQ = 11133;
+    private static final int ERR_MSG_INVALID_OUTGOING_DEST_FREQ = 11134;
+    private static final int ERR_MSG_INVALID_NEGATIVE_VALUE = 11135;
+
+    private String destinationName;
+    private int inClientMessagesPerSec;
+    private int inDestinationMessagesPerSec;
+    private int outClientMessagesPerSec;
+    private int outDestinationMessagesPerSec;
+    private Policy inPolicy;
+    private Policy outPolicy;
+
+    /**
+     * Creates a <code>ThrottleSettings</code> instance with default settings.
+     */
+    public ThrottleSettings()
+    {
+        inPolicy = Policy.NONE;
+        outPolicy = Policy.NONE;
+    }
+
+    /**
+     * Parses the throttle policy out of the given string.
+     *
+     * @param policy The string policy to parse.
+     * @return The Policy.
+     */
+    public static Policy parsePolicy(String policy)
+    {
+        if (Policy.NONE.toString().equalsIgnoreCase(policy))
+            return Policy.NONE;
+        else if (Policy.IGNORE.toString().equalsIgnoreCase(policy))
+            return Policy.IGNORE;
+        else if (Policy.ERROR.toString().equalsIgnoreCase(policy))
+            return Policy.ERROR;
+        else if (Policy.BUFFER.toString().equalsIgnoreCase(policy))
+            return Policy.BUFFER;
+        else if (Policy.CONFLATE.toString().equalsIgnoreCase(policy))
+            return Policy.CONFLATE;
+
+        ConfigurationException ex = new ConfigurationException();
+        // Message will be set by the caller.
+        throw ex;
+    }
+
+    /**
+     * Returns true if inbound or outbound client throttling is enabled.
+     *
+     * @return True if the incoming client frequency or outgoing
+     * client frequency is enabled; otherwise false.
+     */
+    public boolean isClientThrottleEnabled()
+    {
+        return isInboundClientThrottleEnabled() || isOutboundClientThrottleEnabled();
+    }
+
+    /**
+     * Returns true if inbound client throttling is enabled.
+     *
+     * @return True if the inbound client throttling is enabled.
+     */
+    public boolean isInboundClientThrottleEnabled()
+    {
+        return inPolicy != Policy.NONE && getIncomingClientFrequency() > 0;
+    }
+
+    /**
+     * Returns true if outbound client throttling is enabled.
+     *
+     * @return True if the outbound client throttling is enabled.
+     */
+    public boolean isOutboundClientThrottleEnabled()
+    {
+        return outPolicy != Policy.NONE && getOutgoingClientFrequency() > 0;
+    }
+
+    /**
+     * Returns true if inbound or outbound destination throttling is enabled.
+     *
+     * @return true if incoming or outbound destination throttling is enabled;
+     * otherwise false.
+     */
+    public boolean isDestinationThrottleEnabled()
+    {
+        return isInboundDestinationThrottleEnabled() || isOutboundDestinationThrottleEnabled();
+    }
+
+    /**
+     * Returns true if inbound destination throttling is enabled.
+     *
+     * @return true if inbound destination throttling is enabled.
+     */
+    public boolean isInboundDestinationThrottleEnabled()
+    {
+        return inPolicy != Policy.NONE && getIncomingDestinationFrequency() > 0;
+    }
+
+    /**
+     * Returns true if outbound destination throttling is enabled.
+     *
+     * @return true if outbound destination throttling is enabled.
+     */
+    public boolean isOutboundDestinationThrottleEnabled()
+    {
+        return outPolicy != Policy.NONE && getOutgoingDestinationFrequency() > 0;
+    }
+
+    /**
+     * Returns the inbound throttle policy.
+     *
+     * @return the inbound throttle policy.
+     */
+    public Policy getInboundPolicy()
+    {
+        return inPolicy;
+    }
+
+    /**
+     * Sets inbound throttle policy. The inbound policy may be NONE, ERROR, or IGNORE.
+     *
+     * @param inPolicy The inbound policy.
+     */
+    public void setInboundPolicy(Policy inPolicy)
+    {
+        if (inPolicy != Policy.NONE && inPolicy != Policy.ERROR && inPolicy != Policy.IGNORE)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid inbound throttle policy ''{0}'' for destination ''{1}''. Valid values are 'NONE', 'ERROR', and 'IGNORE'.
+            ex.setMessage(ERR_MSG_INVALID_INBOUND_POLICY, new Object[]{inPolicy, destinationName});
+            throw ex;
+        }
+        this.inPolicy = inPolicy;
+    }
+
+    /**
+     * Returns the outbound throttle policy.
+     *
+     * @return the outbound throttle policy.
+     */
+    public Policy getOutboundPolicy()
+    {
+        return outPolicy;
+    }
+
+    /**
+     * Sets the outbound throttle policy. The outbound policy can be NONE, IGNORE,
+     * BUFFER, or CONFLATE.
+     *
+     * @param outPolicy The outbound policy.
+     */
+    public void setOutboundPolicy(Policy outPolicy)
+    {
+        // Policy is checked at throttle manager.
+        this.outPolicy = outPolicy;
+    }
+
+    /**
+     * Returns the destination name for <code>ThrottleSettings</code>.
+     *
+     * @return the destination name for <code>ThrottleSettings</code>.
+     */
+    public String getDestinationName()
+    {
+        return destinationName;
+    }
+
+    /**
+     * Sets the destination name for <code>ThrottleSettings</code>. This is set
+     * automatically when <code>NetworkSettings</code> is assigned to a destination.
+     *
+     * @param destinationName The destination name.
+     */
+    public void setDestinationName(String destinationName)
+    {
+        this.destinationName = destinationName;
+    }
+
+    /**
+     * Returns the incoming client frequency (max-client-frequency).
+     *
+     * @return The incoming client frequency (max-client-frequency).
+     */
+    public int getIncomingClientFrequency()
+    {
+        return inClientMessagesPerSec;
+    }
+
+    /**
+     * Sets the incoming client frequency (max-client-frequency). Optional and the
+     * default value is 0. Note that the incoming client frequency cannot be more
+     * than the incoming destination frequency.
+     *
+     * @param n The incoming client frequency.
+     */
+    public void setIncomingClientFrequency(int n)
+    {
+        String name = "incoming client frequency";
+        blockNegative(n, name);
+
+        if (inDestinationMessagesPerSec > 0 && n > inDestinationMessagesPerSec)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid {0} for destination ''{1}''. {0} ''{2}'' cannot be more than the incoming destination frequency ''{3}''.
+            ex.setMessage(ERR_MSG_INVALID_INCOMING_CLENT_FREQ, new Object[]{name, destinationName,
+                    Integer.valueOf(n), Integer.valueOf(inDestinationMessagesPerSec)});
+            throw ex;
+        }
+        this.inClientMessagesPerSec = n;
+    }
+
+    /**
+     * Returns the incoming destination frequency (max-frequency).
+     *
+     * @return The incoming destination frequency (max-frequency).
+     */
+    public int getIncomingDestinationFrequency()
+    {
+        return inDestinationMessagesPerSec;
+    }
+
+    /**
+     * Sets the incoming destination frequency (max-frequency). Optional and the
+     * default value is 0. Note that the incoming destination frequency cannot be
+     * less than the incoming client frequency.
+     *
+     * @param n The incoming destination frequency.
+     */
+    public void setIncomingDestinationFrequency(int n)
+    {
+        String name = "The incoming destination frequency";
+        blockNegative(n, name);
+
+        if (inClientMessagesPerSec > 0 && n < inClientMessagesPerSec)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid {0} for destination ''{1}''. {0} ''{2}'' cannot be less than the incoming client frequency ''{3}''.
+            ex.setMessage(ERR_MSG_INVALID_INCOMING_DEST_FREQ, new Object[]{name, destinationName,
+                    Integer.valueOf(n), Integer.valueOf(inClientMessagesPerSec)});
+            throw ex;
+        }
+        this.inDestinationMessagesPerSec = n;
+    }
+
+    /**
+     * Returns the outgoing client frequency (max-client-frequency).
+     *
+     * @return The outgoing client frequency (max-client-frequency).
+     */
+    public int getOutgoingClientFrequency()
+    {
+        return outClientMessagesPerSec;
+    }
+
+    /**
+     * Sets the outgoing client frequency (max-client-frequency). Optional and the
+     * default value is 0. Note that the outgoing client frequency cannot be
+     * more than the outgoing destination frequency.
+     *
+     * @param n The outgoing client frequency.
+     */
+    public void setOutgoingClientFrequency(int n)
+    {
+        String name = "The outgoing client frequency";
+        blockNegative(n, name);
+
+        if (outDestinationMessagesPerSec > 0 && n > outDestinationMessagesPerSec)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid {0} for destination ''{1}''. {0} ''{2}'' cannot be more than the outgoing destination frequency ''{3}''.
+            ex.setMessage(ERR_MSG_INVALID_OUTGOING_CLIENT_FREQ, new Object[]{name, destinationName,
+                    Integer.valueOf(n), Integer.valueOf(outDestinationMessagesPerSec)});
+            throw ex;
+        }
+        this.outClientMessagesPerSec = n;
+    }
+
+    /**
+     * Returns the outgoing destination frequency (max-frequency).
+     *
+     * @return The outgoing destination frequency (max-frequency).
+     */
+    public int getOutgoingDestinationFrequency()
+    {
+        return outDestinationMessagesPerSec;
+    }
+
+    /**
+     * Sets the outgoing destination frequency (max-frequency). Optional and the
+     * default value is 0. Note that the outgoing destination frequency cannot
+     * be less than the outgoing client frequency.
+     *
+     * @param n The outgoing destination frequency.
+     */
+    public void setOutgoingDestinationFrequency(int n)
+    {
+        String name = "The outgoing destination frequency";
+        blockNegative(n, name);
+
+        if (outClientMessagesPerSec > 0 && n < outClientMessagesPerSec)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid {0} for destination ''{1}''. {0} ''{2}'' cannot be less than the outgoing client frequency ''{3}''.
+            ex.setMessage(ERR_MSG_INVALID_OUTGOING_DEST_FREQ, new Object[]{name, destinationName, Integer.valueOf(n),
+                    Integer.valueOf(outClientMessagesPerSec)});
+            throw ex;
+        }
+        this.outDestinationMessagesPerSec = n;
+    }
+
+    protected void blockNegative(int n, String name)
+    {
+        if (n < 0)
+        {
+            ConfigurationException ex = new ConfigurationException();
+            // Invalid {0} for destination ''{1}''. {0} cannot be negative.
+            ex.setMessage(ERR_MSG_INVALID_NEGATIVE_VALUE, new Object[]{name, destinationName});
+            throw ex;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/ValidatorSettings.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/ValidatorSettings.java b/core/src/flex/messaging/config/ValidatorSettings.java
new file mode 100644
index 0000000..ed2ab75
--- /dev/null
+++ b/core/src/flex/messaging/config/ValidatorSettings.java
@@ -0,0 +1,68 @@
+/*
+ * 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.config;
+
+import flex.messaging.validators.DeserializationValidator;
+
+/**
+ * Settings class for validators.
+ */
+public class ValidatorSettings extends PropertiesSettings
+{
+    private String className;
+    private String type = DeserializationValidator.class.getName();
+
+    /**
+     * Returns the class name.
+     *
+     * @return The class name.
+     */
+    public String getClassName()
+    {
+        return className;
+    }
+
+    /**
+     * Sets the class name.
+     *
+     * @param className The class name.
+     */
+    public void setClassName(String className)
+    {
+        this.className = className;
+    }
+
+    /**
+     * Returns the type of the validator.
+     *
+     * @return The type of the validator.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+    /**
+     * Sets the type of the validator.
+     *
+     * @param type The type of the validator.
+     */
+    public void setType(String type)
+    {
+        this.type = type;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/XPathServerConfigurationParser.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/XPathServerConfigurationParser.java b/core/src/flex/messaging/config/XPathServerConfigurationParser.java
new file mode 100644
index 0000000..c567f21
--- /dev/null
+++ b/core/src/flex/messaging/config/XPathServerConfigurationParser.java
@@ -0,0 +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.config;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+/**
+ * Uses Sun's JDK 1.5 XPath implementation on a DOM
+ * representation of a messaging configuration file.
+ * <p>
+ * Note: Since reference ids are used between elements, certain
+ * sections of the document need to be parsed first.
+ * </p>
+ *
+ *
+ */
+public class XPathServerConfigurationParser extends ServerConfigurationParser
+{
+    private XPath xpath;
+
+    protected void initializeExpressionQuery()
+    {
+        this.xpath = XPathFactory.newInstance().newXPath();
+    }
+
+    protected Node selectSingleNode(Node source, String expression)
+    {
+        try
+        {
+            return (Node) xpath.evaluate
+                (expression, source, XPathConstants.NODE);
+        }
+        catch (XPathExpressionException expressionException)
+        {
+            throw wrapException(expressionException);
+        }
+    }
+
+    protected NodeList selectNodeList(Node source, String expression)
+    {
+        try
+        {
+            return (NodeList) xpath.evaluate
+                (expression, source, XPathConstants.NODESET);
+        }
+        catch (XPathExpressionException expressionException)
+        {
+            throw wrapException(expressionException);
+        }
+    }
+
+    protected Object evaluateExpression(Node source, String expression)
+    {
+        try
+        {
+            return xpath.evaluate(expression, source, XPathConstants.STRING);
+        }
+        catch (XPathExpressionException expressionException)
+        {
+            throw wrapException(expressionException);
+        }
+    }
+
+    private ConfigurationException wrapException
+        (XPathExpressionException exception)
+    {
+       ConfigurationException result = new ConfigurationException();
+       result.setDetails(PARSER_INTERNAL_ERROR);
+       result.setRootCause(exception);
+       return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/config/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/config/package-info.java b/core/src/flex/messaging/config/package-info.java
new file mode 100644
index 0000000..266fd52
--- /dev/null
+++ b/core/src/flex/messaging/config/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package flex.messaging.config;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/core/src/flex/messaging/endpoints/AMFEndpoint.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/endpoints/AMFEndpoint.java b/core/src/flex/messaging/endpoints/AMFEndpoint.java
new file mode 100644
index 0000000..1f94c4b
--- /dev/null
+++ b/core/src/flex/messaging/endpoints/AMFEndpoint.java
@@ -0,0 +1,152 @@
+/*
+ * 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.endpoints;
+
+import flex.management.runtime.messaging.endpoints.AMFEndpointControl;
+import flex.messaging.MessageBroker;
+import flex.messaging.io.MessageIOConstants;
+import flex.messaging.endpoints.amf.AMFFilter;
+import flex.messaging.endpoints.amf.BatchProcessFilter;
+import flex.messaging.endpoints.amf.LegacyFilter;
+import flex.messaging.endpoints.amf.MessageBrokerFilter;
+import flex.messaging.endpoints.amf.SerializationFilter;
+import flex.messaging.endpoints.amf.SessionFilter;
+import flex.messaging.log.LogCategories;
+
+/**
+ * AMF based endpoint for Flex Messaging. Based on the Flash Remoting gateway servlet.
+ */
+public class AMFEndpoint extends BasePollingHTTPEndpoint
+{
+    /**
+     * The log category for this endpoint.
+     */
+    public static final String LOG_CATEGORY = LogCategories.ENDPOINT_AMF;
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructors
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     * Constructs an unmanaged <code>AMFEndpoint</code>.
+     */
+    public AMFEndpoint()
+    {
+        this(false);
+    }
+
+    /**
+     * Constructs an <code>AMFEndpoint</code> with the indicated management.
+     *
+     * @param enableManagement <code>true</code> if the <code>AMFEndpoint</code>
+     * is manageable; <code>false</code> otherwise.
+     */
+    public AMFEndpoint(boolean enableManagement)
+    {
+        super(enableManagement);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Protected/Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     * Create the gateway filters that transform action requests
+     * and responses.
+     */
+    @Override protected AMFFilter createFilterChain()
+    {
+        AMFFilter serializationFilter = new SerializationFilter(getLogCategory());
+        AMFFilter batchFilter = new BatchProcessFilter();
+        AMFFilter sessionFilter = sessionRewritingEnabled? new SessionFilter() : null;
+        AMFFilter envelopeFilter = new LegacyFilter(this);
+        AMFFilter messageBrokerFilter = new MessageBrokerFilter(this);
+
+        serializationFilter.setNext(batchFilter);
+        if (sessionFilter != null)
+        {
+            batchFilter.setNext(sessionFilter);
+            sessionFilter.setNext(envelopeFilter);
+        }
+        else
+        {
+            batchFilter.setNext(envelopeFilter);
+        }
+        envelopeFilter.setNext(messageBrokerFilter);
+
+        return serializationFilter;
+    }
+
+    /**
+     * Returns MessageIOConstants.AMF_CONTENT_TYPE.
+     *
+     * @return MessageIOConstants.AMF_CONTENT_TYPE
+     */
+    @Override protected String getResponseContentType()
+    {
+        return MessageIOConstants.AMF_CONTENT_TYPE;
+    }
+
+    /**
+     * Returns the log category of the endpoint.
+     *
+     * @return The log category of the endpoint.
+     */
+    @Override protected String getLogCategory()
+    {
+        return LOG_CATEGORY;
+    }
+
+    /**
+     * Returns the deserializer class name used by the endpoint.
+     *
+     * @return The deserializer class name used by the endpoint.
+     */
+    @Override protected String getDeserializerClassName()
+    {
+        return "flex.messaging.io.amf.AmfMessageDeserializer";
+    }
+
+    /**
+     * Returns the serializer class name used by the endpoint.
+     *
+     * @return The serializer class name used by the endpoint.
+     */
+    @Override protected String getSerializerClassName()
+    {
+        return "flex.messaging.io.amf.AmfMessageSerializer";
+    }
+
+
+    /**
+     * Invoked automatically to allow the <code>AMFEndpoint</code> to setup its
+     * corresponding MBean control.
+     *
+     * @param broker The <code>MessageBroker</code> that manages this
+     * <code>AMFEndpoint</code>.
+     */
+    @Override protected void setupEndpointControl(MessageBroker broker)
+    {
+        controller = new AMFEndpointControl(this, broker.getControl());
+        controller.register();
+        setControl(controller);
+    }
+}