| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Adobe BlazeDS
Revision: 3034
Author: shodgson@adobe.com
Date: 28 Aug 2008 18:36:01
Changes:Client network setting/compiler update for LCDS.
Files:| ... | ...@@ -31,7 +31,7 @@ | |
| 31 | 31 | import flex.messaging.LocalizedException; |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | * Flex 2 MXMLC compiler uses the result of the client configuration parser | |
| 34 | * Flex MXMLC compiler uses the result of the client configuration parser | |
| 35 | 35 | * to generate mixin initialization source code to be added to the SWF by |
| 36 | 36 | * PreLink. It also requires a list of channel classes to be added as |
| 37 | 37 | * dependencies. |
| ... | ...@@ -238,6 +238,7 @@ | |
| 238 | 238 | private String codegenXmlInit(ServicesConfiguration config, String contextRoot, Map serviceImportMap) |
| 239 | 239 | { |
| 240 | 240 | StringBuffer e4x = new StringBuffer(); |
| 241 | String channelSetImplToImport = null; | |
| 241 | 242 | |
| 242 | 243 | e4x.append("<services>\n"); |
| 243 | 244 | |
| ... | ...@@ -261,7 +262,7 @@ | |
| 261 | 262 | |
| 262 | 263 | for (Iterator servIter = config.getAllServiceSettings().iterator(); servIter.hasNext();) |
| 263 | 264 | { |
| 264 | ServiceSettings entry = (ServiceSettings)servIter.next(); | |
| 265 | ServiceSettings entry = (ServiceSettings)servIter.next(); | |
| 265 | 266 | |
| 266 | 267 | // FIXME: Need to find another way to skip BootstrapServices |
| 267 | 268 | // Skip services with no message types |
| ... | ...@@ -362,7 +363,7 @@ | |
| 362 | 363 | e4x.append("</item-class>\n"); |
| 363 | 364 | } |
| 364 | 365 | |
| 365 | // add in cluster properties | |
| 366 | // add in sub-set of network-related destination properties | |
| 366 | 367 | ConfigMap network = dest.getProperties().getPropertyAsMap("network", null); |
| 367 | 368 | ConfigMap clusterInfo = null; |
| 368 | 369 | ConfigMap pagingInfo = null; |
| ... | ...@@ -411,6 +412,19 @@ | |
| 411 | 412 | e4x.append(fetchOption.toUpperCase()); |
| 412 | 413 | e4x.append("\" />\n"); |
| 413 | 414 | } |
| 415 | ||
| 416 | if (network != null) | |
| 417 | { | |
| 418 | String reliable = network.getPropertyAsString("reliable", "false"); | |
| 419 | if (Boolean.parseBoolean(reliable)) // No need the default value for the setting. | |
| 420 | { | |
| 421 | channelSetImplToImport = "mx.messaging.AdvancedChannelSet"; | |
| 422 | ||
| 423 | e4x.append("\t\t\t\t\t<reliable>"); | |
| 424 | e4x.append(reliable); | |
| 425 | e4x.append("</reliable>\n"); | |
| 426 | } | |
| 427 | } | |
| 414 | 428 | |
| 415 | 429 | if (network != null) |
| 416 | 430 | clusterInfo = network.getPropertyAsMap("cluster", null); |
| ... | ...@@ -494,11 +508,18 @@ | |
| 494 | 508 | channelProperties(chan.getProperties(), e4x, "\t\t\t\t"); |
| 495 | 509 | e4x.append("\t\t\t</properties>\n"); |
| 496 | 510 | e4x.append("\t\t</channel>\n"); |
| 497 | } | |
| 511 | } | |
| 498 | 512 | e4x.append("\t</channels>\n"); |
| 499 | 513 | e4x.append("</services>"); |
| 500 | 514 | |
| 501 | return "\nServerConfig.xml =\n" + e4x.toString() + ";\n"; | |
| 515 | String generatedChunk = "\n ServerConfig.xml =\n" + e4x.toString() + ";\n"; | |
| 516 | if (channelSetImplToImport != null) | |
| 517 | { | |
| 518 | serviceImportMap.put("ChannelSetImpl", channelSetImplToImport); | |
| 519 | generatedChunk += " ServerConfig.channelSetFactory = AdvancedChannelSet;\n"; | |
| 520 | } | |
| 521 | ||
| 522 | return generatedChunk; | |
| 502 | 523 | } |
| 503 | 524 | |
| 504 | 525 | /** |
| ... | ...@@ -603,9 +624,10 @@ | |
| 603 | 624 | */ |
| 604 | 625 | public static void codegenServiceImportsAndReferences(Map map, StringBuffer imports, StringBuffer references) |
| 605 | 626 | { |
| 627 | String channelSetImplType = (String)map.remove("ChannelSetImpl"); | |
| 606 | 628 | String type; |
| 607 | 629 | imports.append("import mx.messaging.config.ServerConfig;\n"); |
| 608 | references.append(" // static references for configured channels\n"); | |
| 630 | references.append(" // static references for configured channels\n"); | |
| 609 | 631 | for (Iterator chanIter = map.values().iterator(); chanIter.hasNext();) |
| 610 | 632 | { |
| 611 | 633 | type = (String)chanIter.next(); |
| ... | ...@@ -617,5 +639,7 @@ | |
| 617 | 639 | references.append("_ref:"); |
| 618 | 640 | references.append(type.substring(type.lastIndexOf(".") +1) +";\n"); |
| 619 | 641 | } |
| 642 | if (channelSetImplType != null) | |
| 643 | imports.append("import mx.messaging.AdvancedChannelSet;\n"); | |
| 620 | 644 | } |
| 621 | 645 | } |
| ... | ...@@ -31,8 +31,10 @@ | |
| 31 | 31 | // This is the more common case so make it the default |
| 32 | 32 | protected boolean sharedBackend = true; |
| 33 | 33 | private boolean sharedBackendSet = false; |
| 34 | private boolean reliable; | |
| 34 | 35 | |
| 35 | 36 | public static final String NETWORK_ELEMENT = "network"; |
| 37 | public static final String RELIABLE_ELEMENT = "reliable"; | |
| 36 | 38 | public static final String SUBSCRIPTION_TIMEOUT_MINUTES = "subscription-timeout-minutes"; |
| 37 | 39 | public static final String SESSION_TIMEOUT = "session-timeout"; // Deprecated - renamed to subscription-timeout-minutes; retained for legacy config support. |
| 38 | 40 | public static final int DEFAULT_TIMEOUT = 0; // Defaults to being invalidated when the associated FlexSession shuts down. |
| ... | ...@@ -66,6 +68,26 @@ | |
| 66 | 68 | { |
| 67 | 69 | this.clusterId = id; |
| 68 | 70 | } |
| 71 | ||
| 72 | /** | |
| 73 | * Returns the <code>reliable</code> setting. | |
| 74 | * | |
| 75 | * @return The <code>reliable</code> setting. | |
| 76 | */ | |
| 77 | public boolean isReliable() | |
| 78 | { | |
| 79 | return reliable; | |
| 80 | } | |
| 81 | ||
| 82 | /** | |
| 83 | * Sets the <code>reliable</code> setting. | |
| 84 | * | |
| 85 | * @param value The value to set the <code>reliable</code> setting to. | |
| 86 | */ | |
| 87 | public void setReliable(boolean value) | |
| 88 | { | |
| 89 | reliable = value; | |
| 90 | } | |
| 69 | 91 | |
| 70 | 92 | /** |
| 71 | 93 | * Returns the <code>subscription-timeout-minutes</code> property. |
| ... | ...@@ -112,6 +112,8 @@ | |
| 112 | 112 | |
| 113 | 113 | if (network != null) |
| 114 | 114 | { |
| 115 | networkSettings.setReliable(network.getPropertyAsBoolean(NetworkSettings.RELIABLE_ELEMENT, false)); | |
| 116 | ||
| 115 | 117 | ConfigMap clusterInfo = network.getPropertyAsMap(ClusterSettings.CLUSTER_ELEMENT, null); |
| 116 | 118 | if (clusterInfo != null) |
| 117 | 119 | { |