Permalink
Browse files

rtm2.2 release

  • Loading branch information...
qingbiao committed Oct 20, 2011
1 parent df2b7b4 commit 4ac8465f44b321fe4bed92dcc16a489696b8f214
Showing with 18,091 additions and 1,989 deletions.
  1. +29 −0 api-docs/blackberry/bbm/library.xml
  2. +34 −0 api-docs/blackberry/payment/library.xml
  3. +24 −0 api-docs/blackberry/system.event/library.xml
  4. +6 −9 api-docs/blackberry/system/library.xml
  5. +86 −0 api-docs/resources/library_concat/library_concat_manifest.xml
  6. +61 −0 api/CommonAPI/pom.xml
  7. +16 −0 api/CommonAPI/sharedglobal/1_constants.js
  8. +83 −0 api/CommonAPI/sharedglobal/2_blackberry_ns.js
  9. +186 −0 api/CommonAPI/sharedglobal/3_xhr.js
  10. +56 −0 api/CommonAPI/sharedglobal/4_events_ns.js
  11. +38 −0 api/CommonAPI/sharedglobal/5_blob.js
  12. +482 −0 api/CommonAPI/sharedglobal/json2.js
  13. +134 −0 api/CommonAPI/src/blackberry/common/push/PushPersistentStore.java
  14. +104 −0 api/CommonAPI/src/blackberry/common/util/JSUtilities.java
  15. +283 −0 api/CommonAPI/src/blackberry/common/util/URLDecoder.java
  16. +196 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSON.java
  17. +1,112 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONArray.java
  18. +107 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONArtifact.java
  19. +44 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONException.java
  20. +1,356 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONObject.java
  21. +21 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONString.java
  22. +47 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONStringer.java
  23. +575 −0 api/CommonAPI/src/blackberry/common/util/json4j/JSONWriter.java
  24. +11 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/JSON4JNumber.java
  25. +36 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/JSON4JPBackReader.java
  26. +43 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/JSON4JStringReader.java
  27. +45 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/JSON4JStringWriter.java
  28. +98 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/NumberUtil.java
  29. +332 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/Parser.java
  30. +342 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/Serializer.java
  31. +91 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/SerializerVerbose.java
  32. +104 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/Token.java
  33. +608 −0 api/CommonAPI/src/blackberry/common/util/json4j/internal/Tokenizer.java
  34. +84 −0 api/CommonAPI/src/blackberry/core/IJSExtension.java
  35. +197 −0 api/CommonAPI/src/blackberry/core/JSExtensionRequest.java
  36. +110 −0 api/CommonAPI/src/blackberry/core/JSExtensionResponse.java
  37. +63 −0 api/CommonAPI/src/blackberry/core/JSExtensionReturnValue.java
  38. +174 −0 api/CommonAPI/src/blackberry/core/ObjectBase.java
  39. +118 −0 api/CommonAPI/src/blackberry/core/ScriptableFunctionWrapper.java
  40. +99 −0 api/CommonAPI/src/blackberry/core/ScriptableWrapper.java
  41. +37 −3 api/CommonAPI/src/blackberry/core/WidgetBlob.java
  42. +34 −0 api/CommonAPI/src/blackberry/core/threading/GenericDispatcherEvent.java
  43. +110 −0 api/app/pom.xml
  44. +2 −1 api/app/src/main/java/blackberry/app/AppExtension.java
  45. +4 −1 api/app/src/main/java/blackberry/app/ShowBannerIndicatorFunction.java
  46. +110 −0 api/audio/pom.xml
  47. +8 −0 api/bbm/.classpath
  48. +24 −0 api/bbm/.project
  49. +31 −0 api/bbm/build.xml
  50. BIN api/bbm/lib/net_rim_bb_qm_platform.jar
  51. +116 −0 api/bbm/pom.xml
  52. +82 −0 api/bbm/src/main/java/blackberry/bbm/platform/BBMPlatformContextListenerImpl.java
  53. +53 −0 api/bbm/src/main/java/blackberry/bbm/platform/BBMPlatformExtension.java
  54. +199 −0 api/bbm/src/main/java/blackberry/bbm/platform/BBMPlatformNamespace.java
  55. +60 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ChannelListener.java
  56. +50 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ChannelObject.java
  57. +146 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ConnectionListenerImpl.java
  58. +302 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ConnectionObject.java
  59. +345 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/IONamespace.java
  60. +233 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/MessagingServiceListenerImpl.java
  61. +89 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ScriptableIncomingJoinRequest.java
  62. +42 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ScriptableJoinRequest.java
  63. +69 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/ScriptableOutgoingJoinRequest.java
  64. +105 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/SessionListener.java
  65. +99 −0 api/bbm/src/main/java/blackberry/bbm/platform/io/SessionObject.java
  66. +201 −0 api/bbm/src/main/java/blackberry/bbm/platform/self/SelfNamespace.java
  67. +46 −0 api/bbm/src/main/java/blackberry/bbm/platform/self/location/LocationNamespace.java
  68. +171 −0 api/bbm/src/main/java/blackberry/bbm/platform/self/profilebox/ProfileBoxNamespace.java
  69. +75 −0 api/bbm/src/main/java/blackberry/bbm/platform/self/profilebox/ScriptableProfileBoxItem.java
  70. +42 −0 api/bbm/src/main/java/blackberry/bbm/platform/ui/UINamespace.java
  71. +139 −0 api/bbm/src/main/java/blackberry/bbm/platform/ui/menu/MenuNamespace.java
  72. +136 −0 api/bbm/src/main/java/blackberry/bbm/platform/users/BBMPlatformUser.java
  73. +507 −0 api/bbm/src/main/java/blackberry/bbm/platform/users/UsersNamespace.java
  74. +92 −0 api/bbm/src/main/java/blackberry/bbm/platform/util/ConstantsUtil.java
  75. +71 −0 api/bbm/src/main/java/blackberry/bbm/platform/util/ScriptableFieldManager.java
  76. +265 −0 api/bbm/src/main/java/blackberry/bbm/platform/util/Util.java
  77. +110 −0 api/dialog/pom.xml
  78. +110 −0 api/find/pom.xml
  79. +110 −0 api/identity/pom.xml
  80. +7 −10 api/identity/src/main/java/blackberry/identity/IdentityExtension.java
  81. +24 −0 api/invoke/.project
  82. +130 −0 api/invoke/pom.xml
  83. +2 −0 api/invoke/src/main/java/blackberry/invoke/InvokeExtension.java
  84. +110 −0 api/io/pom.xml
  85. +1 −1 api/io/src/main/java/blackberry/io/file/OpenFunction.java
  86. +110 −0 api/media.camera/pom.xml
  87. +4 −1 api/media.camera/src/main/java/blackberry/media/camera/TakeVideoFunction.java
  88. +110 −0 api/menu/pom.xml
  89. +110 −0 api/message/pom.xml
  90. +118 −0 api/messaging/pom.xml
  91. +2 −11 api/messaging/src/main/java/blackberry/messaging/MessagingExtension.java
  92. +8 −0 api/payment/.classpath
  93. +24 −0 api/payment/.project
  94. +27 −0 api/payment/build.xml
  95. +207 −0 api/payment/js/common/payment_dispatcher.js
  96. +36 −0 api/payment/js/common/payment_ns.js
  97. BIN api/payment/lib/paymentapi.jar
  98. +117 −0 api/payment/pom.xml
  99. +212 −0 api/payment/src/main/java/blackberry/payment/PaymentExtension.java
  100. +53 −0 api/payment/src/main/java/blackberry/payment/PaymentSystem.java
  101. +110 −0 api/phone/pom.xml
  102. +120 −0 api/pim/pom.xml
  103. +76 −0 api/pom.xml
  104. +129 −0 api/push/pom.xml
  105. +2 −10 api/push/src/main/java/blackberry/push/PushExtension.java
  106. +2 −2 api/push/src/main/java/blackberry/push/data/PushDataObject.java
  107. +90 −0 api/system.event/js/common/system_event_dispatcher.js
  108. +34 −0 api/system.event/js/common/system_event_ns.js
  109. +110 −0 api/system.event/pom.xml
  110. +50 −0 api/system.event/src/main/java/blackberry/system/event/ISystemEventExtensionConstants.java
  111. +316 −0 api/system.event/src/main/java/blackberry/system/event/SystemEventExtension.java
  112. +109 −0 api/system/js/common/system_dispatcher.js
  113. +72 −0 api/system/js/common/system_ns.js
  114. +110 −0 api/system/pom.xml
  115. +131 −0 api/system/src/main/java/blackberry/system/ISystemExtensionConstants.java
  116. +281 −125 api/system/src/main/java/blackberry/system/SystemExtension.java
  117. +110 −0 api/utils/pom.xml
  118. +8 −14 api/utils/src/main/java/blackberry/utils/BlobToStringFunction.java
  119. +2 −2 api/utils/src/main/java/blackberry/utils/StringToBlobFunction.java
  120. +113 −0 framework/src/blackberry/web/widget/MemoryMaid.java
  121. +42 −48 framework/src/blackberry/web/widget/Widget.java
  122. +5 −2 framework/src/blackberry/web/widget/bf/BrowserFieldScreen.java
  123. +107 −0 framework/src/blackberry/web/widget/bf/HTTPResponseStatus.java
  124. +416 −183 framework/src/blackberry/web/widget/bf/WidgetBrowserFieldListener.java
  125. +115 −32 framework/src/blackberry/web/widget/bf/WidgetRequestController.java
  126. +17 −5 framework/src/blackberry/web/widget/bf/navigationcontroller/NavigationController.java
  127. +493 −454 framework/src/blackberry/web/widget/impl/WidgetConfigImpl.java
  128. +1 −1 framework/src/blackberry/web/widget/listener/HardwareKeyListener.java
  129. BIN packager/src/MacTumblerLauncher/javaloader
  130. BIN packager/src/MacTumblerLauncher/preverify
  131. BIN packager/src/TumblerLauncher/bbwp
  132. +120 −112 packager/src/net/rim/tumbler/CmdLineHandler.java
  133. +114 −0 packager/src/net/rim/tumbler/ExecUtil.java
  134. +70 −0 packager/src/net/rim/tumbler/OSUtils.java
  135. +228 −223 packager/src/net/rim/tumbler/WidgetPackager.java
  136. +121 −23 packager/src/net/rim/tumbler/config/FeatureManager.java
  137. +18 −0 packager/src/net/rim/tumbler/config/WidgetConfig.java
  138. +12 −0 packager/src/net/rim/tumbler/file/FileManager.java
  139. +1 −1 packager/src/net/rim/tumbler/log/resources/MessageBundle_en_CA.properties
  140. +471 −458 packager/src/net/rim/tumbler/rapc/Rapc.java
  141. +12 −0 packager/src/net/rim/tumbler/serialize/WidgetConfig_v1Serializer.java
  142. +171 −150 packager/src/net/rim/tumbler/session/BBWPProperties.java
  143. +110 −107 packager/src/net/rim/tumbler/session/SessionManager.java
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<library>
+ <extension id="blackberry.bbm.platform">
+ <entryClass>blackberry.bbm.platform.BBMPlatformExtension</entryClass>
+ <dependencies>
+ <jar path="net_rim_bb_qm_platform.jar" />
+ </dependencies>
+ </extension>
+
+ <platforms>
+ <platform value="JAVA">
+ <target version="default" config="JAVA_XHR" />
+ <target version="5.0" config="JAVA_XHR_BlackBerry" />
+ </platform>
+ </platforms>
+
+ <configurations>
+ <configuration name="JAVA_XHR" version="1.0" comment="For XHR architecture for Java implementation">
+ <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ </configuration>
+ <configuration name="JAVA_XHR_BlackBerry" version="1.0" comment="For XHR architecture for Java implementation for OS 5.0">
+ <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ </configuration>
+ </configurations>
+
+ <features>
+ <feature id="blackberry.bbm.platform" version="0.1" >Provides access to the BBM Social Platform.</feature>
+ </features>
+</library>
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<library isWhitelist="true">
+ <extension id="blackberry.payment">
+ <entryClass>blackberry.payment.PaymentExtension</entryClass>
+ </extension>
+
+ <dependencies>
+ <jar path="paymentapi.jar"/>
+ </dependencies>
+
+ <platforms>
+ <platform value="JAVA">
+ <target version="default" config="JAVA_XHR" />
+ <target version="5.0" config="JAVA_XHR_BlackBerry" />
+ </platform>
+ </platforms>
+
+ <configurations>
+ <configuration name="JAVA_XHR" version="1.0" comment="For XHR architecture for Java implementation">
+ <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ <src type="text/javascript" path="js/common/payment_dispatcher.js" comment="Payment JS XHR dispatcher" />
+ <src type="text/javascript" path="js/common/payment_ns.js" comment="Payment JS interface" />
+ </configuration>
+ <configuration name="JAVA_XHR_BlackBerry" version="1.0" comment="For XHR architecture for Java implementation for OS 5.0">
+ <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ <src type="text/javascript" path="js/common/payment_dispatcher.js" comment="Payment JS XHR dispatcher" />
+ <src type="text/javascript" path="js/common/payment_ns.js" comment="Payment JS interface" />
+ </configuration>
+ </configurations>
+
+ <features>
+ <feature id="blackberry.payment" version="1.0.0"></feature>
+ </features>
+</library>
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<library isWhitelist="true">
+ <extension id="blackberry.system.event">
+ <entryClass>blackberry.system.event.SystemEventExtension</entryClass>
+ </extension>
+
+ <platforms>
+ <platform value="JAVA">
+ <target version="default" config="JAVA_XHR" />
+ </platform>
+ </platforms>
+
+ <configurations>
+ <configuration name="JAVA_XHR" version="1.0" comment="For XHR architecture for Java implementation">
+ <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ <src type="text/javascript" path="js/common/system_event_dispatcher.js" comment="System event JS XHR dispatcher" />
+ <src type="text/javascript" path="js/common/system_event_ns.js" comment="System event JS interface" />
+ </configuration>
+ </configurations>
+
+ <features>
+ <feature id="blackberry.system.event" version="1.0.0"/>
+ </features>
+</library>
@@ -7,24 +7,21 @@
<platforms>
<platform value="JAVA">
<target version="default" config="JAVA_XHR" />
- <target version="5.0" config="JAVA_XHR_BlackBerry" />
</platform>
</platforms>
-
+
<configurations>
<configuration name="JAVA_XHR" version="1.0" comment="For XHR architecture for Java implementation">
<src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
+ <src type="text/javascript" path="js/common/system_dispatcher.js" comment="System JS XHR dispatcher" />
+ <src type="text/javascript" path="js/common/system_ns.js" comment="System JS interface" />
</configuration>
- <configuration name="JAVA_XHR_BlackBerry" version="1.0" comment="For XHR architecture for Java implementation for OS 5.0">
- <src type="text/java" path="blackberry" comment="API implementation in JavaScript" />
- </configuration>
- </configurations>
-
+ </configurations>
+
<features>
<feature id="blackberry.system" version="1.0.0"/>
- <feature id="blackberry.system.event" version="1.0.0"/>
</features>
-
+
<object name="blackberry.system" shortName="System" introduced="1.0.0" comment="The System object allows you to get access to system level functions and attributes of the BlackBerry device.">
<features>
<feature id="blackberry.system" version="1.0.0"/>
@@ -0,0 +1,86 @@
+<manifest>
+ <libraries basePath="../../blackberry">
+ <!-- Original API -->
+ <libraryPath></libraryPath>
+ <libraryPath>/app</libraryPath>
+ <libraryPath>/app/event</libraryPath>
+ <libraryPath>/find/FilterExpression</libraryPath>
+ <libraryPath>/focus</libraryPath>
+ <libraryPath>/identity</libraryPath>
+ <libraryPath>/identity/phone</libraryPath>
+ <libraryPath>/identity/Service</libraryPath>
+ <libraryPath>/identity/Transport</libraryPath>
+ <libraryPath>/invoke</libraryPath>
+ <libraryPath>/invoke/AddressBookArguments</libraryPath>
+ <libraryPath>/invoke/BrowserArguments</libraryPath>
+ <libraryPath>/invoke/CalendarArguments</libraryPath>
+ <libraryPath>/invoke/CameraArguments</libraryPath>
+ <libraryPath>/invoke/JavaArguments</libraryPath>
+ <libraryPath>/invoke/MapsArguments</libraryPath>
+ <libraryPath>/invoke/MessageArguments</libraryPath>
+ <libraryPath>/invoke/MemoArguments</libraryPath>
+ <libraryPath>/invoke/PhoneArguments</libraryPath>
+ <libraryPath>/invoke/SearchArguments</libraryPath>
+ <libraryPath>/invoke/TaskArguments</libraryPath>
+ <libraryPath>/io/dir</libraryPath>
+ <libraryPath>/io/file</libraryPath>
+ <libraryPath>/io/file/FileProperties</libraryPath>
+ <libraryPath>/location</libraryPath>
+ <libraryPath>/media.camera</libraryPath>
+ <libraryPath>/media.microphone</libraryPath>
+ <libraryPath>/pim/Address</libraryPath>
+ <libraryPath>/pim/Appointment</libraryPath>
+ <libraryPath>/pim/Attendee</libraryPath>
+ <libraryPath>/pim/category</libraryPath>
+ <libraryPath>/pim/Contact</libraryPath>
+ <libraryPath>/pim/Memo</libraryPath>
+ <libraryPath>/pim/Recurrence</libraryPath>
+ <libraryPath>/pim/Reminder</libraryPath>
+ <libraryPath>/pim/Task</libraryPath>
+ <libraryPath>/push</libraryPath>
+ <libraryPath>/push/Data</libraryPath>
+ <libraryPath>/system</libraryPath>
+ <libraryPath>/system/event</libraryPath>
+ <libraryPath>/dialog</libraryPath>
+ <libraryPath>/menu</libraryPath>
+ <libraryPath>/menu/item</libraryPath>
+ <libraryPath>/utils</libraryPath>
+ <libraryPath>/utils/URL</libraryPath>
+ <libraryPath>/widgetcache</libraryPath>
+ <libraryPath>/widgetcache/CacheInformation</libraryPath>
+ <libraryPath>/messaging/Message</libraryPath>
+ <libraryPath>/payment</libraryPath>
+ <libraryPath>/bbm</libraryPath>
+
+ <!-- Extensions -->
+ <libraryPath>/audio</libraryPath>
+ <libraryPath>/audio/Player</libraryPath>
+ <libraryPath>/phone/Phone</libraryPath>
+ <libraryPath>/phone/Phone/Call</libraryPath>
+ <libraryPath>/phone/PhoneLogs</libraryPath>
+ <libraryPath>/phone/PhoneLogs/CallLog</libraryPath>
+ <libraryPath>/phone/Find/FilterExpression</libraryPath>
+ <!--
+ <libraryPath>../../../../api/notification/doc</libraryPath>
+ <libraryPath>../../../../api/accelerometer/doc/accelerometer</libraryPath>
+ <libraryPath>../../../../api/accelerometer/doc/accelerometer/Orientation</libraryPath>
+ <libraryPath>../../../../api/accelerometer/doc/accelerometer/XYZSample</libraryPath>
+ <libraryPath>../../../../api/message/doc/MMS</libraryPath>
+ <libraryPath>../../../../api/message/doc/MMS/MmsAttachment</libraryPath>
+ <libraryPath>../../../../api/message/doc/MMS/MmsMessage</libraryPath>
+ <libraryPath>../../../../api/message/doc/SMS</libraryPath>
+ <libraryPath>../../../../api/message/doc/SMS/SmsMessage</libraryPath>
+ <libraryPath>../../../../api/status/doc</libraryPath>
+ <libraryPath>../../../../api/status/doc/battery</libraryPath>
+ -->
+ <libraryPath>/message/sms</libraryPath>
+ </libraries>
+ <scrubList>
+ <scrub>unitTests</scrub>
+ <scrub>test</scrub>
+ <scrub>testConstructors</scrub>
+ </scrubList>
+ <settings>
+ <libraryName>library.xml</libraryName>
+ </settings>
+</manifest>
View
@@ -0,0 +1,61 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- The Basics -->
+ <parent>
+ <groupId>net.rim.webworks</groupId>
+ <artifactId>api</artifactId>
+ <version>${PRODUCT_VERSION}</version>
+ </parent>
+
+ <artifactId>CommonAPI</artifactId>
+ <packaging>pom</packaging>
+
+ <properties>
+ <api.source>${basedir}/sharedglobal</api.source>
+ <api.docs>${basedir}/../../api-docs/blackberry/app</api.docs>
+ <api.output.folder>${basedir}/../output/common/sharedglobal</api.output.folder>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <echo>Copying sharedglobal file to api output folder</echo>
+ <copy todir="${api.output.folder}">
+ <fileset dir="${api.source}" includes="*/**" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.3.2-SNAPSHOT</version>
+ <configuration>
+ <threshold>Normal</threshold>
+ <xmlOutput>true</xmlOutput>
+ <findbugsXmlOutput>true</findbugsXmlOutput>
+ <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
@@ -0,0 +1,16 @@
+/*
+* Copyright 2010-2011 Research In Motion Limited.
+*
+* Licensed 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.
+*/
+var SERVER_URL = "http://localhost:8472/";
@@ -0,0 +1,83 @@
+/*
+* Copyright 2010-2011 Research In Motion Limited.
+*
+* Licensed 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.
+*/
+(function () {
+ this.blackberry = {};
+
+ var WebWorksLoader = function() {
+ this.loadedJs = {}; //hash of literal namespace - javascript constructor (can be either API or dispatcher, whichever is loaded first)
+ }
+
+ var isDispatcher = function(func) {
+ return (typeof(func) == 'function' && func.name.search(/dispatcher/i) > -1);
+ }
+
+ /*
+ Called by each API/dispatcher when it has finished loading. If its pair has already been loaded, it instantiates the API. Otherwise
+ stores the current half of the API and waits for the other one to load before instantiating.
+ */
+ WebWorksLoader.prototype.javascriptLoaded = function(ns, js) {
+ //Check if the other half of the API has loaded
+ if(typeof this.loadedJs[ns] == 'function') {
+ var api, dispatcher;
+ //If the function just loaded is the dispatcher, the one we have is the API, and vice-versa
+ if(isDispatcher(js)) {
+ api = this.loadedJs[ns];
+ dispatcher = js;
+ } else {
+ api = js;
+ dispatcher = this.loadedJs[ns];
+ }
+
+ this.loadApi(ns, api, dispatcher);
+ delete this.loadedJs[ns]; //remove namespace entry to prevent double loading
+ } else {
+ //Otherwise queue up and wait for API to load
+ this.loadedJs[ns] = js;
+ }
+ }
+
+ /*
+ Instantiates the provided API constructor with the provided dispatcher and attaches
+ the result to the requested namespace.
+ */
+ WebWorksLoader.prototype.loadApi = function(namespace, apiConstructor, dispatcher) {
+ //Instantiate the API
+ var d = (typeof dispatcher != 'undefined') ? new dispatcher() : {};
+ var api = new apiConstructor(d);
+
+ //Break namespace into array of parts around the '.'
+ var nsParts = namespace.split('.');
+ //Must start with 'blackberry'
+ if(nsParts[0] != 'blackberry') {
+ throw new Error('Namespace does not start with blackberry:' + namespace);
+ }
+
+ //Iterate over remaining namespace parts and create the empty namespace if it does not exist.
+ //If it exists, just ignore it.
+ var ns = blackberry;
+ for(var i = 1; i < nsParts.length - 1; i++) {
+ if(typeof ns[nsParts[i]] == 'undefined') {
+ ns[nsParts[i]] = {};
+ }
+ ns = ns[nsParts[i]];
+ }
+
+ //Once namespace is built, attach the object to it
+ ns[nsParts[nsParts.length - 1]] = api;
+ }
+
+ this.blackberry.Loader = new WebWorksLoader();
+})();
Oops, something went wrong.

0 comments on commit 4ac8465

Please sign in to comment.