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:27 UTC
[13/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/config/ServerSettings.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/ServerSettings.java b/modules/core/src/flex/messaging/config/ServerSettings.java
old mode 100755
new mode 100644
index d61229f..77f61e9
--- a/modules/core/src/flex/messaging/config/ServerSettings.java
+++ b/modules/core/src/flex/messaging/config/ServerSettings.java
@@ -1,231 +1,231 @@
-/*
- * 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.services.messaging.MessagingConstants;
-
-/**
- * Server settings for a message destination.
- */
-public class ServerSettings
-{
- // Errors
- private static final int INVALID_CLUSTER_MESSAGE_ROUTING = 11121;
-
- private boolean allowSubtopics;
- private boolean disallowWildcardSubtopics;
- private long messageTTL = -1; //We need to keep track of uninitialized value
- private boolean isDurable;
- private int priority = -1;
- private String subtopicSeparator;
- private RoutingMode routingMode = RoutingMode.SERVER_TO_SERVER;
-
- public static enum RoutingMode {NONE,BROADCAST,SERVER_TO_SERVER};
-
- /**
- * Creates a default <code>ServerSettings</code> instance.
- */
- public ServerSettings()
- {
- isDurable = false;
- subtopicSeparator = MessagingConstants.DEFAULT_SUBTOPIC_SEPARATOR;
- }
-
- /**
- * Returns <code>allow-subtopics</code> property.
- *
- * @return a boolean specifying whether or not the server has the <code>allow-subtopics</code> property.
- */
- public boolean getAllowSubtopics()
- {
- return allowSubtopics;
- }
-
- /**
- * Sets <code>allow-subtopics</code> property.
- *
- * @param value The value for <code>allow-subtopics</code> property.
- */
- public void setAllowSubtopics(boolean value)
- {
- allowSubtopics = value;
- }
-
- /**
- * Returns <code>cluster-message-routing</code> property.
- *
- * @return a boolean specifying whether or not the server has the <code>cluster-message-routing</code> property.
- */
- public boolean isBroadcastRoutingMode()
- {
- return routingMode == RoutingMode.BROADCAST;
- }
-
- /**
- * Returns the routing mode configured.
- *
- * @return The configured routing mode.
- */
- public RoutingMode getRoutingMode()
- {
- return routingMode;
- }
-
- /**
- * Sets the <code>cluster-message-routing</code> property.
- *
- * @param routingMode <code>server-to-server</code>(default)
- * or <code>broadcast</code>.
- */
- public void setBroadcastRoutingMode(String routingMode)
- {
- if (routingMode.equalsIgnoreCase("broadcast"))
- this.routingMode = RoutingMode.BROADCAST;
- else if (routingMode.equalsIgnoreCase("server-to-server"))
- this.routingMode = RoutingMode.SERVER_TO_SERVER;
- else if (routingMode.equalsIgnoreCase("none"))
- this.routingMode = RoutingMode.NONE;
- else
- {
- ConfigurationException ce = new ConfigurationException();
- ce.setMessage(INVALID_CLUSTER_MESSAGE_ROUTING, new Object[] {routingMode});
- throw ce;
- }
- }
-
- /**
- * @deprecated Not used anymore.
- */
- public int getMaxCacheSize()
- {
- return 0;
- }
-
- /**
- * @deprecated Not used anymore.
- */
- public void setMaxCacheSize(int size)
- {
- // No-op.
- }
-
- /**
- * Returns the <code>message-time-to-live</code> property.
- *
- * @return the <code>message-time-to-live</code> property.
- */
- public long getMessageTTL()
- {
- return messageTTL;
- }
-
- /**
- * Sets the <code>message-time-to-live</code> property. Default value is -1.
- *
- * @param ttl The value for <code>message-time-to-live</code> property.
- */
- public void setMessageTTL(long ttl)
- {
- messageTTL = ttl;
- }
-
- /**
- * Returns true if wildcard subtopics are disallowed.
- *
- * @return true if wilcard subtopics are disallowed.
- */
- public boolean isDisallowWildcardSubtopics()
- {
- return disallowWildcardSubtopics;
- }
-
- /**
- * Sets whether the wildcard subtopics are disallowed.
- *
- * @param value Whether the wildcard subtopics are disallowed.
- */
- public void setDisallowWildcardSubtopics(boolean value)
- {
- disallowWildcardSubtopics = value;
- }
-
- /**
- * Returns whether destination is durable.
- *
- * @return <code>true</code> if destination is durable; otherwise <code>false</code>.
- */
- public boolean isDurable()
- {
- return isDurable;
- }
-
- /**
- * Sets whether destination is durable. Default value is <code>false</code>.
- *
- * @param durable The value for <code>durable</code> property.
- */
- public void setDurable(boolean durable)
- {
- isDurable = durable;
- }
-
- /**
- * Returns the default message priority for the destination which is a numerical
- * value between 0 and 9 (and -1 means no default priority).
- *
- * @return The default message priority for the destination.
- */
- public int getPriority()
- {
- return priority;
- }
-
- /**
- * Sets the default message priority of the destination which should be
- * a numerical value between 0 and 9. Values less than 0 and greater than 9
- * are treated as 0 and 9 respectively.
- *
- * @param priority The new value for the priority.
- */
- public void setPriority(int priority)
- {
- priority = priority < 0? 0 : priority > 9? 9 : priority;
- this.priority = priority;
- }
-
-
- /**
- * Returns the <code>subtopic-separator</code> property.
- *
- * @return the <code>subtopic-separator</code> property.
- */
- public String getSubtopicSeparator()
- {
- return subtopicSeparator;
- }
-
- /**
- * Sets the <code>subtopic-separator</code> property.
- * Optional; the default value is period.
- *
- * @param value The value for <code>subtopic-separator</code> property.
- */
- public void setSubtopicSeparator(String value)
- {
- subtopicSeparator = value;
- }
-}
+/*
+ * 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.services.messaging.MessagingConstants;
+
+/**
+ * Server settings for a message destination.
+ */
+public class ServerSettings
+{
+ // Errors
+ private static final int INVALID_CLUSTER_MESSAGE_ROUTING = 11121;
+
+ private boolean allowSubtopics;
+ private boolean disallowWildcardSubtopics;
+ private long messageTTL = -1; //We need to keep track of uninitialized value
+ private boolean isDurable;
+ private int priority = -1;
+ private String subtopicSeparator;
+ private RoutingMode routingMode = RoutingMode.SERVER_TO_SERVER;
+
+ public static enum RoutingMode {NONE,BROADCAST,SERVER_TO_SERVER};
+
+ /**
+ * Creates a default <code>ServerSettings</code> instance.
+ */
+ public ServerSettings()
+ {
+ isDurable = false;
+ subtopicSeparator = MessagingConstants.DEFAULT_SUBTOPIC_SEPARATOR;
+ }
+
+ /**
+ * Returns <code>allow-subtopics</code> property.
+ *
+ * @return a boolean specifying whether or not the server has the <code>allow-subtopics</code> property.
+ */
+ public boolean getAllowSubtopics()
+ {
+ return allowSubtopics;
+ }
+
+ /**
+ * Sets <code>allow-subtopics</code> property.
+ *
+ * @param value The value for <code>allow-subtopics</code> property.
+ */
+ public void setAllowSubtopics(boolean value)
+ {
+ allowSubtopics = value;
+ }
+
+ /**
+ * Returns <code>cluster-message-routing</code> property.
+ *
+ * @return a boolean specifying whether or not the server has the <code>cluster-message-routing</code> property.
+ */
+ public boolean isBroadcastRoutingMode()
+ {
+ return routingMode == RoutingMode.BROADCAST;
+ }
+
+ /**
+ * Returns the routing mode configured.
+ *
+ * @return The configured routing mode.
+ */
+ public RoutingMode getRoutingMode()
+ {
+ return routingMode;
+ }
+
+ /**
+ * Sets the <code>cluster-message-routing</code> property.
+ *
+ * @param routingMode <code>server-to-server</code>(default)
+ * or <code>broadcast</code>.
+ */
+ public void setBroadcastRoutingMode(String routingMode)
+ {
+ if (routingMode.equalsIgnoreCase("broadcast"))
+ this.routingMode = RoutingMode.BROADCAST;
+ else if (routingMode.equalsIgnoreCase("server-to-server"))
+ this.routingMode = RoutingMode.SERVER_TO_SERVER;
+ else if (routingMode.equalsIgnoreCase("none"))
+ this.routingMode = RoutingMode.NONE;
+ else
+ {
+ ConfigurationException ce = new ConfigurationException();
+ ce.setMessage(INVALID_CLUSTER_MESSAGE_ROUTING, new Object[] {routingMode});
+ throw ce;
+ }
+ }
+
+ /**
+ * @deprecated Not used anymore.
+ */
+ public int getMaxCacheSize()
+ {
+ return 0;
+ }
+
+ /**
+ * @deprecated Not used anymore.
+ */
+ public void setMaxCacheSize(int size)
+ {
+ // No-op.
+ }
+
+ /**
+ * Returns the <code>message-time-to-live</code> property.
+ *
+ * @return the <code>message-time-to-live</code> property.
+ */
+ public long getMessageTTL()
+ {
+ return messageTTL;
+ }
+
+ /**
+ * Sets the <code>message-time-to-live</code> property. Default value is -1.
+ *
+ * @param ttl The value for <code>message-time-to-live</code> property.
+ */
+ public void setMessageTTL(long ttl)
+ {
+ messageTTL = ttl;
+ }
+
+ /**
+ * Returns true if wildcard subtopics are disallowed.
+ *
+ * @return true if wilcard subtopics are disallowed.
+ */
+ public boolean isDisallowWildcardSubtopics()
+ {
+ return disallowWildcardSubtopics;
+ }
+
+ /**
+ * Sets whether the wildcard subtopics are disallowed.
+ *
+ * @param value Whether the wildcard subtopics are disallowed.
+ */
+ public void setDisallowWildcardSubtopics(boolean value)
+ {
+ disallowWildcardSubtopics = value;
+ }
+
+ /**
+ * Returns whether destination is durable.
+ *
+ * @return <code>true</code> if destination is durable; otherwise <code>false</code>.
+ */
+ public boolean isDurable()
+ {
+ return isDurable;
+ }
+
+ /**
+ * Sets whether destination is durable. Default value is <code>false</code>.
+ *
+ * @param durable The value for <code>durable</code> property.
+ */
+ public void setDurable(boolean durable)
+ {
+ isDurable = durable;
+ }
+
+ /**
+ * Returns the default message priority for the destination which is a numerical
+ * value between 0 and 9 (and -1 means no default priority).
+ *
+ * @return The default message priority for the destination.
+ */
+ public int getPriority()
+ {
+ return priority;
+ }
+
+ /**
+ * Sets the default message priority of the destination which should be
+ * a numerical value between 0 and 9. Values less than 0 and greater than 9
+ * are treated as 0 and 9 respectively.
+ *
+ * @param priority The new value for the priority.
+ */
+ public void setPriority(int priority)
+ {
+ priority = priority < 0? 0 : priority > 9? 9 : priority;
+ this.priority = priority;
+ }
+
+
+ /**
+ * Returns the <code>subtopic-separator</code> property.
+ *
+ * @return the <code>subtopic-separator</code> property.
+ */
+ public String getSubtopicSeparator()
+ {
+ return subtopicSeparator;
+ }
+
+ /**
+ * Sets the <code>subtopic-separator</code> property.
+ * Optional; the default value is period.
+ *
+ * @param value The value for <code>subtopic-separator</code> property.
+ */
+ public void setSubtopicSeparator(String value)
+ {
+ subtopicSeparator = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/4f6a3052/modules/core/src/flex/messaging/config/ServletResourceResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/ServletResourceResolver.java b/modules/core/src/flex/messaging/config/ServletResourceResolver.java
old mode 100755
new mode 100644
index d28f373..d08cfd8
--- a/modules/core/src/flex/messaging/config/ServletResourceResolver.java
+++ b/modules/core/src/flex/messaging/config/ServletResourceResolver.java
@@ -1,156 +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;
-
-/**
- * @exclude
- */
-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);
- }
-}
+/*
+ * 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;
+
+/**
+ * @exclude
+ */
+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/4f6a3052/modules/core/src/flex/messaging/config/SharedServerSettings.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/SharedServerSettings.java b/modules/core/src/flex/messaging/config/SharedServerSettings.java
old mode 100755
new mode 100644
index a8fbadd..82cac64
--- a/modules/core/src/flex/messaging/config/SharedServerSettings.java
+++ b/modules/core/src/flex/messaging/config/SharedServerSettings.java
@@ -1,65 +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.
- *
- * @exclude
- */
-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;
- }
-}
+/*
+ * 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.
+ *
+ * @exclude
+ */
+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/4f6a3052/modules/core/src/flex/messaging/config/SystemSettings.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/SystemSettings.java b/modules/core/src/flex/messaging/config/SystemSettings.java
old mode 100755
new mode 100644
index d413f5f..86619e7
--- a/modules/core/src/flex/messaging/config/SystemSettings.java
+++ b/modules/core/src/flex/messaging/config/SystemSettings.java
@@ -1,300 +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;
-
-/**
- * @exclude
- */
-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;
- }
-
-}
+/*
+ * 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;
+
+/**
+ * @exclude
+ */
+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/4f6a3052/modules/core/src/flex/messaging/config/ThrottleSettings.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/ThrottleSettings.java b/modules/core/src/flex/messaging/config/ThrottleSettings.java
old mode 100755
new mode 100644
index b3a7f4b..6457d1b
--- a/modules/core/src/flex/messaging/config/ThrottleSettings.java
+++ b/modules/core/src/flex/messaging/config/ThrottleSettings.java
@@ -1,373 +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 <properties> 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
- };
-
- /** @exclude **/
- public static final String ELEMENT_INBOUND = "throttle-inbound";
- /** @exclude **/
- public static final String ELEMENT_OUTBOUND = "throttle-outbound";
- /** @exclude **/
- public static final String ELEMENT_POLICY = "policy";
- /** @exclude **/
- public static final String ELEMENT_DEST_FREQ = "max-frequency";
- /** @exclude **/
- 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;
- }
- }
-}
+/*
+ * 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 <properties> 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
+ };
+
+ /** @exclude **/
+ public static final String ELEMENT_INBOUND = "throttle-inbound";
+ /** @exclude **/
+ public static final String ELEMENT_OUTBOUND = "throttle-outbound";
+ /** @exclude **/
+ public static final String ELEMENT_POLICY = "policy";
+ /** @exclude **/
+ public static final String ELEMENT_DEST_FREQ = "max-frequency";
+ /** @exclude **/
+ 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/4f6a3052/modules/core/src/flex/messaging/config/ValidatorSettings.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/ValidatorSettings.java b/modules/core/src/flex/messaging/config/ValidatorSettings.java
old mode 100755
new mode 100644
index d752cf1..ed2ab75
--- a/modules/core/src/flex/messaging/config/ValidatorSettings.java
+++ b/modules/core/src/flex/messaging/config/ValidatorSettings.java
@@ -1,68 +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;
- }
+/*
+ * 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/4f6a3052/modules/core/src/flex/messaging/config/XPathServerConfigurationParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/XPathServerConfigurationParser.java b/modules/core/src/flex/messaging/config/XPathServerConfigurationParser.java
old mode 100755
new mode 100644
index 2cf0c67..2e0a04d
--- a/modules/core/src/flex/messaging/config/XPathServerConfigurationParser.java
+++ b/modules/core/src/flex/messaging/config/XPathServerConfigurationParser.java
@@ -1,94 +1,94 @@
-/*
- * 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>
- *
- * @author Peter Farland
- * @exclude
- */
-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;
- }
-
-}
+/*
+ * 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>
+ *
+ * @author Peter Farland
+ * @exclude
+ */
+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/4f6a3052/modules/core/src/flex/messaging/config/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/flex/messaging/config/package-info.java b/modules/core/src/flex/messaging/config/package-info.java
old mode 100755
new mode 100644
index 2a2fcd7..266fd52
--- a/modules/core/src/flex/messaging/config/package-info.java
+++ b/modules/core/src/flex/messaging/config/package-info.java
@@ -1,18 +1,18 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package flex.messaging.config;
\ No newline at end of file