rhoconnect 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/CHANGELOG.md +7 -0
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +26 -45
  4. data/Rakefile +2 -3
  5. data/bench/bench_runner.rb +37 -37
  6. data/bench/benchapp/Gemfile.lock +4 -5
  7. data/bench/benchapp/config.ru +1 -5
  8. data/bench/benchapp/spec/spec_helper.rb +0 -13
  9. data/bench/blobapp/Gemfile.lock +8 -9
  10. data/bench/blobapp/config.ru +1 -2
  11. data/bench/blobapp/spec/spec_helper.rb +0 -13
  12. data/bench/lib/bench/aws_utils.rb +0 -1
  13. data/bench/spec/bench_spec_helper.rb +1 -1
  14. data/doc/java-plugin.txt +176 -49
  15. data/doc/net-plugin.txt +150 -70
  16. data/doc/plugin-intro.txt +2 -2
  17. data/doc/supported-platforms.txt +12 -11
  18. data/generators/templates/application/config.ru +1 -2
  19. data/generators/templates/application/spec/spec_helper.rb +0 -15
  20. data/install.sh +3 -3
  21. data/installer/unix-like/create_texts.rb +2 -2
  22. data/installer/unix-like/rho_connect_install_constants.rb +3 -3
  23. data/installer/unix-like/rho_connect_install_utilities.rb +0 -1
  24. data/installer/utils/constants.rb +5 -5
  25. data/installer/utils/create_sha1.rb +26 -0
  26. data/installer/utils/delete_from_s3.rb +32 -0
  27. data/installer/utils/download_from_s3.rb +55 -0
  28. data/installer/utils/nix_install_test.rb +29 -19
  29. data/installer/utils/package_upload/repos.rake +52 -40
  30. data/installer/utils/package_upload/s3_upload.rb +7 -28
  31. data/installer/utils/verify_checksum.rb +33 -0
  32. data/installer/windows/rhosync.nsi +5 -5
  33. data/lib/rhoconnect.rb +1 -1
  34. data/lib/rhoconnect/app.rb +0 -3
  35. data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +6 -0
  36. data/lib/rhoconnect/server.rb +27 -24
  37. data/lib/rhoconnect/stats/middleware.rb +13 -8
  38. data/lib/rhoconnect/store.rb +12 -10
  39. data/lib/rhoconnect/version.rb +1 -1
  40. data/rhoconnect.gemspec +2 -2
  41. data/spec/api/admin/api_token_spec.rb +0 -1
  42. data/spec/api/admin/stats_spec.rb +3 -0
  43. data/spec/api/api_helper.rb +2 -2
  44. data/spec/api/user/list_users_spec.rb +2 -2
  45. data/spec/api_token_spec.rb +0 -1
  46. data/spec/app_spec.rb +0 -1
  47. data/spec/bulk_data/bulk_data_spec.rb +0 -1
  48. data/spec/client_spec.rb +0 -1
  49. data/spec/client_sync_spec.rb +0 -2
  50. data/spec/document_spec.rb +0 -1
  51. data/spec/dynamic_adapter_spec.rb +0 -2
  52. data/spec/jobs/bulk_data_job_spec.rb +0 -1
  53. data/spec/jobs/ping_job_spec.rb +0 -1
  54. data/spec/jobs/source_job_spec.rb +0 -1
  55. data/spec/license_spec.rb +0 -1
  56. data/spec/perf/perf_spec_helper.rb +0 -1
  57. data/spec/ping/android_spec.rb +0 -1
  58. data/spec/ping/apple_spec.rb +0 -1
  59. data/spec/ping/blackberry_spec.rb +0 -1
  60. data/spec/read_state_spec.rb +0 -1
  61. data/spec/rhoconnect_spec.rb +0 -1
  62. data/spec/server/server_spec.rb +1 -12
  63. data/spec/source_adapter_spec.rb +0 -1
  64. data/spec/source_spec.rb +0 -1
  65. data/spec/source_sync_spec.rb +0 -1
  66. data/spec/spec_helper.rb +8 -19
  67. data/spec/stats/middleware_spec.rb +9 -0
  68. data/spec/stats/record_spec.rb +1 -0
  69. data/spec/store_spec.rb +6 -1
  70. data/spec/sync_states_spec.rb +0 -1
  71. data/spec/test_methods_spec.rb +0 -1
  72. data/spec/user_spec.rb +0 -1
  73. data/tasks/redis.rake +4 -2
  74. metadata +421 -436
  75. data/bin/thorhoconnect +0 -79
  76. data/installer/utils/package_upload/auto-repo.rb +0 -136
@@ -26,8 +26,7 @@ Rhoconnect::Server.set :root, ROOT_PATH
26
26
  Rhoconnect::Server.use Rack::Static, :urls => ["/data"], :root => Rhoconnect::Server.root
27
27
 
28
28
  # Load our rhoconnect application
29
- $:.unshift ROOT_PATH if RUBY_VERSION =~ /1.9/ # FIXME: see PT story #16682771
30
- require 'application'
29
+ require "#{ROOT_PATH}/application"
31
30
 
32
31
  # Setup the url map
33
32
  run Rack::URLMap.new \
@@ -19,19 +19,6 @@ include Rhoconnect
19
19
 
20
20
  require 'rhoconnect/test_methods'
21
21
 
22
- # Monkey patch to fix the following issue:
23
- # /Library/Ruby/Gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/shared_example_group.rb:45:
24
- # in `ensure_shared_example_group_name_not_taken': Shared example group '...' already exists (ArgumentError)
25
- module RSpec
26
- module Core
27
- module SharedExampleGroup
28
- private
29
- def ensure_shared_example_group_name_not_taken(name)
30
- end
31
- end
32
- end
33
- end
34
-
35
22
  shared_examples_for "SpecHelper" do
36
23
  include Rhoconnect::TestMethods
37
24
 
@@ -3,7 +3,6 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..','..','lib')
3
3
  require 'rubygems'
4
4
  require 'yaml'
5
5
 
6
- require 'readline'
7
6
  require 'xmlsimple'
8
7
 
9
8
  module Bench
@@ -12,7 +12,7 @@ require 'bench/logging'
12
12
  require 'bench/mock_client'
13
13
  require 'bench/utils'
14
14
  require 'bench/result'
15
- require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'shared_examples')
15
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'spec_helper')
16
16
 
17
17
  include Bench
18
18
 
@@ -1,41 +1,88 @@
1
1
  RhoConnect-Java
2
2
  ===
3
3
 
4
- RhoConnect-Java library is designed for the [RhoConnect](http://rhomobile.com/products/rhoconnect/) Application Integration Server.
4
+ The RhoConnect-Java library is designed for the [RhoConnect](http://rhomobile.com/products/rhoconnect/) Application Integration Server.
5
5
 
6
- Using the RhoConnect-Java plugin, your [Spring 3 MVC](http://www.springsource.org/) application's data will transparently synchronize with a mobile application built on the [Rhodes framework](http://rhomobile.com/products/rhodes), or any of the available [RhoConnect clients](http://rhomobile.com/products/rhoconnect/).
6
+ Using the RhoConnect-Java plugin jar file, your [Spring 3 MVC](http://www.springsource.org/) application's data will transparently synchronize with a mobile application built on the [Rhodes framework](http://rhomobile.com/products/rhodes), or any of the available [RhoConnect clients](http://rhomobile.com/products/rhoconnect/).
7
+
8
+ <img src='https://s3.amazonaws.com/rhodocs/rhoconnect-service/rhoconnect-plugin-java.jpg' alt='image' />
7
9
 
8
10
  ## Prerequisites
9
11
 
10
12
  * Java (1.6)
11
13
  * Maven2 (2.2.1)
12
14
  * Git
13
- * [Rhoconncect-java](https://github.com/downloads/rhomobile/rhoconnect-java/rhoconnect-java-1.0.1.jar) plugin jar file
15
+ * [Rhoconnect-java](https://github.com/downloads/rhomobile/rhoconnect-java/rhoconnect-java-1.0.1.jar) plugin jar file
14
16
 
15
- ## Getting started
17
+ ## Getting Started
16
18
 
17
- We assume that you have a complete java end-to-end application using Spring 3.0 MVC as the front end technology and Hibernate as backend ORM. For this application we will also use Maven2 for build and dependency management and some database to persist the data. The database is accessed by a Data Access (DAO) layer.
19
+ We assume that you have a complete java end-to-end application using Spring 3.0 MVC as the front end technology and Hibernate as the backend ORM. For this application, we will also use Maven2 for build and dependency management and a database to persist the data. The database is accessed by a Data Access (DAO) layer.
18
20
 
19
- Copy [Rhoconncect-java](https://github.com/downloads/rhomobile/rhoconnect-java/rhoconnect-java-1.0.1.jar) plugin jar file to your PC.
20
- You can also create target rhoconnect-java plugin jar from sources by cloning rhoconnect-java repository
21
+ ## A Sample Java Spring 3.0 MVC Backend Application
21
22
 
22
- :::term
23
- $ git clone https://github.com/rhomobile/rhoconnect-java.git
23
+ The instructions in the following steps show how to install the `rhoconnect-java` plugin jar file into an existing Java end-to-end application using Sprint 3.0 MVC as the front end technology, and Hibernate as the backend ORM. For an example, you can download and install the [RhoconnectJavaSample](https://github.com/shurab/RhoconnectJavaSample) application.
24
24
 
25
- and executing in cloned project directory the following commands:
25
+ This sample Java application was created using Sprint 3.0 MVC, using [this tutorial to Create Spring 3 MVC Hibernate 3 Example using Maven in Eclipse](http://viralpatel.net/blogs/2010/11/spring3-mvc-hibernate-maven-tutorial-eclipse-example.html).
26
26
 
27
- :::term
28
- $ mvn clean
29
- $ mvn compile
30
- $ mvn jar:jar
27
+ To install this sample application, navigate in your web browser to [https://github.com/shurab/RhoconnectJavaSample](https://github.com/shurab/RhoconnectJavaSample) and download it as a zip file. Unzip it and rename the unzipped folder to RhoconnectJavaSample.
28
+
29
+ Navigate into the `RhoconnectJavaSample` folder and run these commands to run the sample Java application.
30
+
31
+ :::term
32
+ $ mvn clean
33
+ $ mvn jetty:run
34
+
35
+ When you see `[INFO] Started Jetty Server`, open a web browser and navigate to `http://localhost:8080/contacts/index` to see this application running.
36
+
37
+ <img src="http://rhodocs.s3.amazonaws.com/rhoconnect-plugin/java-backend-running.png">
38
+
39
+ ## Settings for the Client App
40
+
41
+ Your client application needs to have its model match the model used in your Java Sprint 3.0 MVC backend application. For example, you can generate a Rhodes application for a Contact model to match the RhoconnectJavaSample application:
42
+
43
+ :::term
44
+ $ rhodes app contact-app
45
+ $ cd contact-app
46
+ $ rhodes model contact lastname,firstname,email,telephone
31
47
 
32
- The archived rhoconnect-java-x.y.z.jar file will be created in the project target/ directory.
33
48
 
34
- For testing and evaluation purposes you can use [RhoconnectJavaSample](https://github.com/shurab/RhoconnectJavaSample) application as a starting point before continuing with the following steps.
49
+ Edit the `rhoconfig.txt` configuration file to point to your RhoConnect server, where <your_rhoconnect_server_url> is the url for your RhoConnect server.
35
50
 
36
- ### Adding Dependencies to Your Maven 2 Project
51
+ :::term
52
+ syncserver = 'http://<your_rhoconnect_server_url>/application'
37
53
 
38
- Add dependencies to your Apache Maven 2 project object model (POM): log4j, Apache common beanutils, and Jackson JSON mapper. In the RhoconnectJavaSample application, this code is in the pom.xml file.
54
+ And edit the `app/index.erb` view file to say Contacts:
55
+
56
+ :::html
57
+ ...
58
+ <li><a href="Contact">Contacts</a></li>
59
+ ...
60
+
61
+ And edit `app/Contact/contact.rb` file to enable sync.
62
+
63
+ :::ruby
64
+ ...
65
+ enable :sync
66
+ ...
67
+
68
+ ## Settings for the RhoConnect Server App
69
+
70
+ You must generate a RhoConnect server application and edit its settings for the RhoConnect Java plugin.
71
+
72
+ :::term
73
+ $ rhoconnect app syncserver
74
+ $ cd syncserver; bundle install
75
+
76
+ Edit the `settings/settings.yml` development section to add an api\_token key/value pair. This value is the same as the api\_token that you will set in the `WEB-INF/spring-servlet.xml` file for your Java backend application.
77
+
78
+ :::term
79
+ :development:
80
+ ...
81
+ :api_token: rhoconnect_api_token
82
+
83
+ ## Adding Dependencies to Your Java Application Maven 2 POM
84
+
85
+ Add dependencies to the Apache Maven 2 project object model (POM) in your Java application by plugging the code below into the `pom.xml` file. This adds dependencies for log4j, Apache common beanutils, and Jackson JSON mapper.
39
86
 
40
87
  :::xml
41
88
  <!-- Log4j -->
@@ -60,14 +107,18 @@ Add dependencies to your Apache Maven 2 project object model (POM): log4j, Apach
60
107
  <optional>false</optional>
61
108
  </dependency>
62
109
 
63
- You must also add the rhoconnect-java jar to your Maven 2 project. At this moment rhoconnect-plugin jar is not available in Maven public repositories and you need install the jar manually into your Maven's local repository.
64
- Download the `rhoconnect-java-1.0-SNAPSHOT.jar` jar file and put it into your hard drive, and issue the following Maven's command:
110
+ ## Adding the rhoconnect-java Plugin Jar File to Your Java Backend Application
111
+
112
+ At this time, the rhoconnect-java plugin jar file is not available in Maven public repositories, so you need to manually install this jar into your Maven's local repository.
113
+
114
+ Download the [Rhoconnect-java](https://github.com/downloads/rhomobile/rhoconnect-java/rhoconnect-java-1.0.1.jar) plugin jar file to your PC.
115
+
116
+ Use the following Maven command to add the rhoconnect-java plugin jar file to your Java backend application. Replace `path-to-jar` with the path to where you have the rhoconnect-java plugin jar file.
65
117
 
66
118
  :::term
67
119
  $ mvn install:install-file -Dfile=/path-to-jar/rhoconnect-java-1.0.1.jar -DgroupId=com.rhomobile.rhoconnect -DartifactId=rhoconnect-java -Dversion=1.0.1 -Dpackaging=jar
68
120
 
69
- Now, the `rhoconnect-java` jar library is included into your Maven local repository.
70
- In the RhoconnectJavaSample application, you would add this code to the pom.xml file.
121
+ Now that the rhoconnect-java jar library is included in your Maven local repository, you must add it as a dependency by adding the following code to the `pom.xml` file. Make sure the version number matches the version number in the jar file name.
71
122
 
72
123
  :::xml
73
124
  <!-- Rhoconnect-java plugin -->
@@ -78,9 +129,25 @@ In the RhoconnectJavaSample application, you would add this code to the pom.xml
78
129
  <type>jar</type>
79
130
  </dependency>
80
131
 
81
- ### Updating Your Servlet XML Configuration File
132
+ ### Creating the rhoconnect-java Pluigin Jar File from the rhoconnect-java Repository
82
133
 
83
- Update your servlet xml configuration file to include rhoconnect-java metadata: the packages, converters, and beans. In the RhoconnectJavaSample, the following code is added to src/main/webapp/WEB-INF/spring-servlet.xml file.
134
+ Instead of downloading the rhoconnect-java plugin jar file, you can generate it from sources by cloning the `rhoconnect-java` repository:
135
+
136
+ :::term
137
+ $ git clone https://github.com/rhomobile/rhoconnect-java.git
138
+
139
+ and executing the following commands in your cloned rhoconnect-java project directory:
140
+
141
+ :::term
142
+ $ mvn clean
143
+ $ mvn compile
144
+ $ mvn jar:jar
145
+
146
+ The archived `rhoconnect-java-x.y.z.jar` file will be created in the project's `target` directory.
147
+
148
+ ## Updating Your Servlet XML Configuration File
149
+
150
+ Update your servlet xml configuration file in your Java backend application folder to include rhoconnect-java metadata: the packages, converters, and beans. In your Java application folder (such as the RhoconnectJavaSample folder), add the following code to `src/main/webapp/WEB-INF/spring-servlet.xml`.
84
151
 
85
152
  :::xml
86
153
  <!-- rhoconnect-java plugin packages -->
@@ -114,33 +181,35 @@ Update your servlet xml configuration file to include rhoconnect-java metadata:
114
181
  <bean id="dispatcher" class = "com.rhomobile.rhoconnect.RhoconnectDispatcher"></bean>
115
182
  <bean id="rhoconnectClient" class = "com.rhomobile.rhoconnect.RhoconnectClient" init-method="setAppEndpoint" >
116
183
  <property name="restTemplate"><ref bean="restTemplate"/></property>
117
- <property name="endpointUrl" value="your_rhoconnect_server_url" />
118
- <property name="appEndpoint" value="your_spring_app_url" />
119
- <property name="apiToken" value="rhoconnect_api_token" />
184
+ <property name="endpointUrl" value="<your_rhoconnect_server_url>" />
185
+ <property name="appEndpoint" value=app_endpoint_url" />
186
+ <property name="apiToken" value="api_token" />
120
187
  </bean>
121
188
 
122
189
  <!--The following bean handles the application's authentication routine and should be implemented by you -->
123
190
  <bean id="authenticate" class = "com.rhomobile.contact.ContactAuthenticate" />
124
191
 
192
+ ### Configuring Properties in the setAppEndpoint Method
193
+
125
194
  The `setAppEndpoint` method in the `rhoconnectClient` bean in the above code sample is a main point in establishing the communication
126
- link between the `Rhoconnect` server and the Spring 3 MVC application. It has the following properties that you need to configure.
195
+ link between the `Rhoconnect` server and your Java Spring 3 MVC backend application. It has the following properties that you need to configure.
127
196
 
128
197
  <table border="1">
129
198
  <tr>
130
- <td><code>endpointUrl</code></td>
199
+ <td><code>your_rhoconnect_server_url</code></td>
131
200
  <td>rhoconnect server's url, for example <code>http://localhost:9292</code></td>
132
201
  </tr>
133
202
  <tr>
134
- <td><code>appEndpoint</code></td>
203
+ <td><code>app_endpoint_url</code></td>
135
204
  <td>your Spring 3 MVC app url, for example <code>http://localhost:8080/contacts</code></td>
136
205
  </tr>
137
206
  <tr>
138
207
  <td><code>apiToken</code></td>
139
- <td>rhoconnect server's api_token, for example <code>sometokenforme</code></td>
208
+ <td>rhoconnect server's api_token, for example <code>rhoconnect_api_token</code></td>
140
209
  </tr>
141
210
  </table>
142
211
 
143
- The `authenticate` bean will be called by rhoconnect server to authenticate users, and has to implement `Rhoconnect` interface provided by rhoconnect-java plugin:
212
+ The `authenticate` bean will be called by the RhoConnect server to authenticate users, so it has to implement the `Rhoconnect` interface provided by the rhoconnect-java plugin:
144
213
 
145
214
  :::java
146
215
  package com.rhomobile.rhoconnect;
@@ -150,7 +219,7 @@ The `authenticate` bean will be called by rhoconnect server to authenticate user
150
219
  String authenticate(String userName, String password, Map<String, Object> attributes);
151
220
  }
152
221
 
153
- For example:
222
+ For example, in the RhoConnectJavaSample example, in `src/main/java/com/rhomobile/contact/ContactAuthenticate.java`, you can code the ContactAuthentication class as follows, replacing the TODO comment with authentication code (this example just returns "app").
154
223
 
155
224
  :::java
156
225
  package com.rhomobile.contact;
@@ -177,9 +246,9 @@ For example:
177
246
  }
178
247
  }
179
248
 
180
- ### Establishing communication from the RhoConnect server to java back-end application
249
+ ## Establishing communication from the RhoConnect server to the java backend application
181
250
 
182
- You need to establish communication from the RhoConnect instance to your java back-end application by mixing RhoconnectResource interface in your data access (DAO) service class:
251
+ You need to establish communication from the RhoConnect instance to your java backend application by mixing the RhoconnectResource interface in your data access (DAO) service class. This interface is in the Java plugin, `rhoconnect-java/src/main/java/com/rhomobile/rhoconnect/RhoconnectResource.java`. (Note that you do not change the code in `RhoconnectResource.java`.)
183
252
 
184
253
  :::java
185
254
  package com.rhomobile.rhoconnect;
@@ -190,37 +259,84 @@ You need to establish communication from the RhoConnect instance to your java ba
190
259
  Map<String, Object> rhoconnectQuery(String partition);
191
260
  Integer rhoconnectCreate(String partition, Map<String, Object> attributes);
192
261
  Integer rhoconnectUpdate(String partition, Map<String, Object> attributes);
193
- Integer rhoconnetDelete(String partition, Map<String, Object> attributes);
262
+ Integer rhoconnectDelete(String partition, Map<String, Object> attributes);
194
263
  }
195
264
 
196
- To help rhoconnect-java plugin correctly do mapping of model name to service bean you should take into account the following conventions:
265
+ To help the rhoconnect-java plugin correctly map the model name to the service bean, you should take into account the following conventions when you write the code in your Java backend application to establish communication to the RhoConnect server:
197
266
 
198
- * Name of the DAO service bean (class) should be model name followed by `ServiceImpl` suffix (i. e. `ContactServiceImpl` for model `Contact`)
199
- * Service bean should be auto-wired into corresponding controller via @Autowired annotation
267
+ * The name of the DAO service bean (class) in your java backend application should be the model name followed by `ServiceImpl` suffix (i. e. `ContactServiceImpl` for model `Contact`)
268
+ * The service bean should be auto-wired into the corresponding controller via @Autowired annotation
200
269
 
201
270
  Data partitioning in your code should be based on filtering data for unique user (i.e. your user name) or per application (shared dataset for all users).
202
271
  For more information about RhoConnect partitions, please refer to the [RhoConnect docs](http://docs.rhomobile.com/rhosync/source-adapters#data-partitioning).
203
272
 
204
- ### Establishing communication from java back-end application to the RhoConnect server
273
+ ## Establishing communication from java backend application to the RhoConnect server
274
+
275
+ You must establish the communication from your java backend application to the RhoConnect server by auto-wiring the `RhoconnectClient` bean into your DAO service class and inserting notifications hooks into the data access (create/update/delete) methods.
276
+
277
+ After you generate a Sprint 3.0 MVC application, you have a DAO service class similar to the RhoconnectJavaSample file of `ContactServiceImpl.java`, located in `src/main/java/com/rhomobile/contact/service`.
278
+
279
+ :::java
280
+ package com.rhomobile.contact.service;
281
+
282
+ import java.util.List;
283
+
284
+ import org.springframework.beans.factory.annotation.Autowired;
285
+ import org.springframework.stereotype.Service;
286
+ import org.springframework.transaction.annotation.Transactional;
287
+
288
+ import com.rhomobile.contact.dao.ContactDAO;
289
+ import com.rhomobile.contact.form.Contact;
290
+
291
+ @Service
292
+ public class ContactServiceImpl implements ContactService {
293
+
294
+ @Autowired
295
+ private ContactDAO contactDAO;
296
+
297
+ @Transactional
298
+ public int addContact(Contact contact) {
299
+ return contactDAO.addContact(contact);
300
+ }
301
+
302
+ @Transactional
303
+ public List<Contact> listContact() {
304
+ return contactDAO.listContact();
305
+ }
306
+
307
+ @Transactional
308
+ public void removeContact(Integer id) {
309
+ contactDAO.removeContact(id);
310
+ }
311
+
312
+ @Transactional
313
+ public Contact getContact(Integer id) {
314
+ return contactDAO.getContact(id);
315
+ }
316
+
317
+ @Transactional
318
+ public void updateContact(Contact contact) {
319
+ contactDAO.updateContact(contact);
320
+ }
321
+ }
205
322
 
206
- You also must to establish the communication from your java back-end application to the RhoConnect instance by auto-wiring `RhoconnectClient` bean into your DAO service class and inserting notifications hooks into data access (create/update/delete) methods.
207
323
  `RhoconnectClient` bean is provided by rhoconnect-java plugin and responds to the following methods you have to call:
208
324
 
209
325
  * boolean notifyOnCreate(String sourceName, Object objId, Object object)
210
326
  * boolean notifyOnUpdate(String sourceName, Object objId, Object object)
211
327
  * boolean notifyOnDelete(String sourceName, Object objId)
212
328
 
213
- Example for `RhoconnectJavaSample` application:
329
+ Here is an example of how you would recode the ContactServiceImpl.java for the `RhoconnectJavaSample` application. Comments are added to show where you add new code to import libraries such as `RhoconnectClient` and `RhoconnectResource`, and where you call the notifyOnCreate, notifyOnDelete, and notifyOnUpdate methods to tell the backend about changes from the RhoConnect server, and where you implement the rhoconnectQuery, rhoconnectCreate, rhoconnectUpdate, and rhoconnectDelete methods to communicate changes in the backend to the RhoConnect server.
214
330
 
215
- :::java
331
+ :::java
216
332
  package com.rhomobile.contact.service;
217
333
 
218
- import java.util.HashMap;
219
- import java.util.Iterator;
334
+ import java.util.HashMap; /* import HashMap */
335
+ import java.util.Iterator; /* import Iterator */
220
336
  import java.util.List;
221
- import java.util.Map;
337
+ import java.util.Map; /* import Map */
222
338
 
223
- import org.apache.commons.beanutils.BeanUtils;
339
+ import org.apache.commons.beanutils.BeanUtils; /* import BeanUtils */
224
340
  import org.springframework.beans.factory.annotation.Autowired;
225
341
  import org.springframework.stereotype.Service;
226
342
  import org.springframework.transaction.annotation.Transactional;
@@ -228,19 +344,24 @@ Example for `RhoconnectJavaSample` application:
228
344
  import com.rhomobile.contact.dao.ContactDAO;
229
345
  import com.rhomobile.contact.form.Contact;
230
346
 
347
+ /* import RhoconnectClient bean and RhoconnectResource bean */
231
348
  import com.rhomobile.rhoconnect.RhoconnectClient;
232
349
  import com.rhomobile.rhoconnect.RhoconnectResource;
233
350
 
351
+ /* add RhoConnectResource to class implementation */
234
352
  @Service
235
353
  public class ContactServiceImpl implements ContactService, RhoconnectResource {
236
354
  //private static final Logger logger = Logger.getLogger(ContactServiceImpl.class);
237
355
 
238
356
  @Autowired
239
357
  private ContactDAO contactDAO;
358
+
359
+ /* Add the RhoconnectClient bean via autowire */
240
360
  @Autowired
241
361
  private RhoconnectClient client;
242
362
  private static final String sourceName = "Contact"; // name of DAO model
243
363
 
364
+ /* Call the notifyOnCreate method from RhoconnectClient bean to tell the backend of changes from RhoConnect server */
244
365
  @Transactional
245
366
  public int addContact(Contact contact) {
246
367
  int id = contactDAO.addContact(contact);
@@ -248,12 +369,14 @@ Example for `RhoconnectJavaSample` application:
248
369
  return id;
249
370
  }
250
371
 
372
+ /* Call the notifyOnUpdate method from RhoconnectClient bean to tell the backend of changes from RhoConnect server */
251
373
  @Transactional
252
374
  public void updateContact(Contact contact) {
253
375
  contactDAO.updateContact(contact);
254
376
  client.notifyOnUpdate(sourceName, Integer.toString(contact.getId()), contact);
255
377
  }
256
378
 
379
+ /* Call the notifyOnDelete method from RhoconnectClient bean to tell the backend of changes from RhoConnect server */
257
380
  @Transactional
258
381
  public void removeContact(Integer id) {
259
382
  contactDAO.removeContact(id);
@@ -270,6 +393,7 @@ Example for `RhoconnectJavaSample` application:
270
393
  return contactDAO.getContact(id);
271
394
  }
272
395
 
396
+ /* Implement the rhoconnectQuery method to communicate query in backend to the RhoConnect server */
273
397
  @Override
274
398
  @Transactional
275
399
  public Map<String, Object> rhoconnectQuery(String partition) {
@@ -284,6 +408,7 @@ Example for `RhoconnectJavaSample` application:
284
408
  return h;
285
409
  }
286
410
 
411
+ /* Implement the rhoconnectCreate method to communicate create in backend to the RhoConnect server */
287
412
  @Override
288
413
  @Transactional
289
414
  public Integer rhoconnectCreate(String partition, Map<String, Object> attributes) {
@@ -298,6 +423,7 @@ Example for `RhoconnectJavaSample` application:
298
423
  return null;
299
424
  }
300
425
 
426
+ /* Implement the rhoconnectUpdate method to communicate updates in backend to the RhoConnect server */
301
427
  @Override
302
428
  @Transactional
303
429
  public Integer rhoconnectUpdate(String partition, Map<String, Object> attributes) {
@@ -313,9 +439,10 @@ Example for `RhoconnectJavaSample` application:
313
439
  return null;
314
440
  }
315
441
 
442
+ /* Implement the rhoconnectDelete method to communicate delete in backend to the RhoConnect server */
316
443
  @Override
317
444
  @Transactional
318
- public Integer rhoconnetDelete(String partition, Map<String, Object> attributes) {
445
+ public Integer rhoconnectDelete(String partition, Map<String, Object> attributes) {
319
446
  String objId = (String)attributes.get("id");
320
447
  Integer id = Integer.parseInt(objId);
321
448
  removeContact(id);
@@ -323,7 +450,7 @@ Example for `RhoconnectJavaSample` application:
323
450
  }
324
451
  }
325
452
 
326
- Click [here](https://github.com/shurab/RhoconnectJavaPluginDemo) to download full source code of Contact manager application with rhoconnect-java plugin.
453
+ Click [here](https://github.com/shurab/RhoconnectJavaPluginDemo) to download the full source code of a Contact manager application with rhoconnect-java plugin.
327
454
 
328
455
  ## Meta
329
456
  Created and maintained by Alexander Babichev.
@@ -1,11 +1,24 @@
1
1
  rhoconnect.NET
2
2
  ===
3
3
 
4
- A .NET 4 framework library for the [Rhoconnect](http://rhomobile.com/products/rhoconnect) App Integration Server.
4
+ The RhoConnect-Java library is designed for the [RhoConnect](http://rhomobile.com/products/rhoconnect/) Application Integration Server.
5
5
 
6
- Using rhoconnect.NET, your [ASP.NET MVC](http://www.asp.net/mvc/mvc4) application's data will transparently synchronize with a mobile application built on the [Rhodes framework](http://rhomobile.com/products/rhodes), or any of the available [Rhoconnect clients](http://rhomobile.com/products/rhoconnect/).
6
+ The .NET 4 framework library is designed for the [Rhoconnect](http://rhomobile.com/products/rhoconnect) Application Integration Server.
7
7
 
8
- ## Getting started
8
+ Using the rhoconnect.NET plugin, your [ASP.NET MVC](http://www.asp.net/mvc/mvc4) application's data will transparently synchronize with a mobile application built on the [Rhodes framework](http://rhomobile.com/products/rhodes), or any of the available [Rhoconnect clients](http://rhomobile.com/products/rhoconnect/).
9
+
10
+ <img src='https://s3.amazonaws.com/rhodocs/rhoconnect-service/rhoconnect-plugin-net.jpg' alt='image' />
11
+
12
+ ## Prerequisites
13
+
14
+ * Windows OS
15
+ * .NET 4 framework
16
+ * Git
17
+ * [ASP.NET MVC4](http://www.asp.net/mvc/mvc4) framework
18
+ * Visual Studio 2010
19
+ * [`rhoconnect.NET`](https://github.com/rhomobile/rhoconnect.NET) github repository
20
+
21
+ ## Getting Started
9
22
 
10
23
  Copy the [`rhoconnect.NET`](https://github.com/rhomobile/rhoconnect.NET) github repository to your PC:
11
24
 
@@ -14,22 +27,74 @@ Copy the [`rhoconnect.NET`](https://github.com/rhomobile/rhoconnect.NET) github
14
27
  By default, the `rhoconnect.NET` repository contains the pre-built `RhoconnectNET.dll` library in the `bin/Release` subdirectory.
15
28
  However, you can build your own library using the provided Microsoft Visual Studio .NET solution file and the source code files.
16
29
 
17
- You can download and use the sample [`ASP.NET MVC4`](https://github.com/rhomobile/RhoconnectNET_MVC4_App) application to repeat the steps described below. In addition, the above sample also contains the final code in `ContactsApp_final` subdirrectory. You can just use it (you will still need to modify the `set_app_point` with your app endpoints and add the RhoconnectNET library reference to your project.)
30
+ ## A Sample ASP.NET MVC4 Backend Application
31
+
32
+ You can download and use the sample [`ASP.NET MVC4`](https://github.com/rhomobile/RhoconnectNET_MVC4_App) application to repeat the steps described below.
33
+
34
+ In addition, the sample application also contains the final code (the .NET plugin is applied to it) in its `ContactsApp_final` subdirectory. You can use this final code, but you will still need to modify the `set_app_point` with your app endpoints and add the RhoconnectNET library reference to your project.
35
+
36
+ To run this application, build it in Visual Studio, create a deployment package (using Project --> Build Deployment Package), then deploy it on Microsoft's IIS server to run.
37
+
38
+ <img src="http://rhodocs.s3.amazonaws.com/rhoconnect-plugin/net-backend-running.png">
39
+
40
+ This sample ASP.NET MVC4 application was created using similar steps to [this tutorial to create a C# application and add support for basic database operations](http://www.asp.net/mvc/tutorials/contact-manager/iteration-1-create-the-application-cs).
41
+
42
+ ## Settings for the Client App
43
+
44
+ Your client application needs to have its model match the model used in your Java Sprint 3.0 MVC backend application. For example, you can generate a Rhodes application for a Contact model to match the sample ASP.NET MVC4 backend application:
45
+
46
+ :::term
47
+ $ rhodes app contact-app
48
+ $ cd contact-app
49
+ $ rhodes model contact lastname,firstname,email,phone
50
+
51
+ Edit the `rhoconfig.txt` configuration file to point to your RhoConnect server, where <your_rhoconnect_server_url> is the url for your RhoConnect server.
52
+
53
+ :::term
54
+ syncserver = 'http://<your_rhoconnect_server_url>/application'
55
+
56
+ And edit the `app/index.erb` view file to say Contacts.
57
+
58
+ :::html
59
+ ...
60
+ <li><a href="Contact">Contacts</a></li>
61
+ ...
62
+
63
+ And edit `app/Contact/contact.rb` file to enable sync.
64
+
65
+ :::ruby
66
+ ...
67
+ enable :sync
68
+ ...
69
+
70
+ ## Settings for the RhoConnect Server App
71
+
72
+ You must generate a RhoConnect server application and edit its settings for the RhoConnect .NET plugin.
73
+
74
+ :::term
75
+ $ rhoconnect app syncserver
76
+ $ cd syncserver; bundle install
77
+
78
+ Edit the `settings/settings.yml` development section to add an api\_token key/value pair. This value is the same as the api\_token that you will set in the `WEB-INF/spring-servlet.xml` file for your ASP.NET MVC4 backend application.
79
+
80
+ :::term
81
+ :development:
82
+ ...
83
+ :api_token: rhoconnect_api_token
84
+
85
+ ## Including the RhoConnect.NET Library in the Backend Application
18
86
 
19
87
  In order to use `Rhoconnect.NET` functionality in your `ASP.NET MVC` application, first you need to include the `Rhoconnect.NET` library
20
- as a dependency to your application. Click `Project => Add Reference` menu item in the Visual Studio and navigate to the `RhoconnectNET.dll` library.
21
- After this step is completed, you can add references to the `Rhoconnect.NET` namespace into the application's and Controller's files:
88
+ as a dependency to your application. In Visual Studio, click the `Project => Add Reference` menu item and navigate to and select the `RhoconnectNET.dll` library.
89
+
90
+ After this step is completed, you can add references to the `Rhoconnect.NET` namespace into the application's and Controller's files: in the case of the ASP.NET MVC4 sample application, the files are ContactsApp/Global.asax.cs and ContactsApp/Controllers/ContactController.cs.
22
91
 
23
92
  using RhoconnectNET;
24
93
  using RhoconnectNET.Controllers;
25
-
26
-
27
94
 
28
- ## Registering Rhoconnect.NET routes for your application
95
+ ## Registering Rhoconnect.NET Routes in the Backend Application
29
96
 
30
- To establish the communication channel between ASP.NET MVC application and Rhoconnect server,
31
- you need to implement the following `init_rhoconnect` and `rhoconnect_authenticate` methods in the `Global.asax.cs` file
32
- and call them from the `Application_Start` method:
97
+ To establish the communication channel between the ASP.NET MVC application and the Rhoconnect server, you need to implement the following `init_rhoconnect` and `rhoconnect_authenticate` methods in the ASP.NET MVC application's `Global.asax.cs` file and call them from its `Application_Start` method:
33
98
 
34
99
  protected void Application_Start()
35
100
  {
@@ -52,10 +117,13 @@ and call them from the `Application_Start` method:
52
117
  // this call establishes communication between Rhoconnect and ASP.NET application
53
118
  // as a last parameter we supply authentication routine that will called
54
119
  // by rhoconnect server to authenticate users.
55
- RhoconnectNET.Client.set_app_endpoint("my_rhoconnect_server_url",
56
- "my_mvc_app_root_url",
57
- "rhoconnect_api_token",
58
- rhoconnect_authenticate);
120
+ // Its parameters are the rhoconnect url, the MVC app url,
121
+ // the api_token, and the authenticate method, shown here by
122
+ // <parameter_name> placeholders.
123
+ RhoconnectNET.Client.set_app_endpoint("<your_rhoconnect_server_url>",
124
+ "<app_endpoint_url>",
125
+ "<api_token>",
126
+ <Authenticating_Routine>);
59
127
  }
60
128
 
61
129
  private bool rhoconnect_authenticate(ref String username, String password, Hashtable auth_attrs)
@@ -65,26 +133,25 @@ and call them from the `Application_Start` method:
65
133
  // perform your authentication here
66
134
  return true;
67
135
  }
68
-
69
- `RhoconnectNET.Client.set_app_point` method is a main point
70
- in establishing the communication link between `Rhoconnect` server and the ASP.NET MVC application
71
- and it has the following parameters:
136
+
137
+ The `RhoconnectNET.Client.set_app_endpoint` method is a main point
138
+ in establishing the communication link between the `Rhoconnect` server and the ASP.NET MVC application. It has the following parameters that you need to set.
72
139
 
73
140
  <table border="1">
74
141
  <tr>
75
142
  <td>String</td>
76
- <td><code>rhoconnect_url</code></td>
77
- <td>rhoconnect server's url, for example <code>http://localhost:9292</code>.</td>
143
+ <td><code>your_rhoconnect_server_url</code></td>
144
+ <td>The RhoConnect server's url, for example <code>http://localhost:9292</code>.</td>
78
145
  </tr>
79
146
  <tr>
80
147
  <td>String</td>
81
- <td><code>app_endpoint</code></td>
148
+ <td><code>app_endpoint_url</code></td>
82
149
  <td>your MVC app url, for example <code>http://my_pc_host/MyApp</code>.</td>
83
150
  </tr>
84
151
  <tr>
85
152
  <td>String</td>
86
153
  <td><code>api_token</code></td>
87
- <td>rhoconnect server's api_token, for example <code>secrettoken</code>.</td>
154
+ <td>rhoconnect server's api_token, for example <code>rhoconnect_api_token</code>.</td>
88
155
  </tr>
89
156
  <tr>
90
157
  <td>delegate rhoAuthHandler(ref String, String, Hashtable, bool)</td>
@@ -93,9 +160,10 @@ and it has the following parameters:
93
160
  </tr>
94
161
  </table>
95
162
 
96
- `Rhoconnect.NET` installs a `/rhoconnect/authenticate` route into your application which will receive credentials from the client.
97
- By providing the `rhoconnect_authenticate` method and registering it with the `Rhoconnect.NET` in the `set_app_endpoint`
98
- method, you map your application specific authentication to the Rhoconnect `authenticate` requests:
163
+ ## Implementing the Backend Application's Authenticate Method
164
+
165
+ `Rhoconnect.NET` installs a `/rhoconnect/authenticate` route into your application which will receive credentials from the client. In the ASP.NET MVC application's `Global.asax.cs` file, you can provide the `rhoconnect_authenticate` method and register it with the `Rhoconnect.NET` in the `set_app_endpoint`
166
+ method; this maps your application specific authentication to the Rhoconnect `authenticate` requests:
99
167
 
100
168
  private bool rhoconnect_authenticate(ref String username, String password, Hashtable auth_attrs)
101
169
  {
@@ -106,45 +174,49 @@ method, you map your application specific authentication to the Rhoconnect `auth
106
174
  }
107
175
 
108
176
  If you want your data to be partitioned by 'app' (i.e. the data will be shared among all users), you can replace
109
- the provided `username` parameter (which is passed by reference) to `app` - which will instruct Rhoconnect to partition
110
- the data accordingly.
177
+ the provided `username` parameter (which is passed by reference) to `app` - which will instruct Rhoconnect to partition the data accordingly.
178
+
179
+ ## Establishing Communication from the RhoConnect Server to the Backend Application
111
180
 
112
- ## Implementing CRUD functionality
113
- `Rhoconnect.NET` lib installs `/rhoconnect/<CRUD>` routes in your application which the Rhoconnect instance
114
- invokes to perform CRUD operations on the data for the dataset you want to synchronize.
181
+ The `Rhoconnect.NET` lib installs `/rhoconnect/<CRUD>` routes in your application which the Rhoconnect server instance invokes to perform CRUD operations on the data for the dataset you want to synchronize.
115
182
  Each of the routes is mapped to a corresponding `rhoconnect_<operation>` method in the **IRhoconnectCRUD** interface
116
183
  which you must implement in the dataset's Controller class.
117
184
 
185
+ In the case of the sample ASP.NET MVC application, you implement these methods in `ContactsApp/Controllers/ContactController.cs`. You could start with code like this:
186
+
118
187
  public class ContactController : Controller, IRhoconnectCRUD
119
188
  {
120
189
  ... implementation of Controller routes
121
190
 
122
- // next four methods must be implemented
123
- // and will be called by Rhoconnect server
191
+ // You must implement the next four methods
192
+ // These methods will be called by the Rhoconnect server
124
193
  JsonResult rhoconnect_query_objects(String partition);
125
194
  ActionResult rhoconnect_create(String objJson, String partition);
126
195
  ActionResult rhoconnect_update(Dictionary<string, object> changes, String partition);
127
196
  ActionResult rhoconnect_delete(Object objId, String partition);
128
- }
197
+ }
198
+
199
+ And you will implement the rhoconnect_query_objects, rhoconnect_create, rhoconnect_update, and rhoconnect_delete methods.
200
+
201
+ ### Implement rhoconnect_query_objects to Query the Datasets
129
202
 
130
- ## Query the datasets
131
- The route `/rhoconnect/query` is mapped to the `rhoconnect_query_objects` method of the **IRhoconnectCRUD**
132
- interface that you must implement in the corresponding dataset's Controller class. It must
133
- return a collection of source objects in the form of a JsonResult:
203
+ The route `/rhoconnect/query` is mapped to the `rhoconnect_query_objects` method of the **IRhoconnectCRUD** interface. You must implement this method in the corresponding dataset's Controller class. It must return a collection of source objects in the form of a JsonResult.
204
+
205
+ In the case of the sample ASP.NET MVC application, you could implement this method in the `ContactsApp/Controllers/ContactController.cs` file as follows:
134
206
 
135
207
  public JsonResult rhoconnect_query_objects(String partition)
136
208
  {
137
209
  return Json(db.Contacts.ToDictionary(c => c.ID.ToString()));
138
210
  }
139
211
 
140
- In the above example, the Contacts Db set is converted to `Dictionary<String, Object>`
141
- where the dictionary's key must correspond to an unique object's `ID` field.
142
- After dictionary is created , it is converted to JsonResult and sent to the Rhoconnect server.
212
+ In the above example, the Contacts Db set is converted to `Dictionary<String, Object>` where the dictionary's key must correspond to an unique object's `ID` field.
213
+ After the dictionary is created, it is converted to a JsonResult and sent to the Rhoconnect server.
214
+
215
+ ### Implement rhoconnect_create to Create New Objects
216
+
217
+ The route `/rhoconnect/create` is mapped to the `rhoconnect_create` method of the IRhoconnectCRUD interface that you must implement in the corresponding dataset's Controller class. It should return a newly created object's id in case of success.
143
218
 
144
- ## Create new objects
145
- The route `/rhoconnect/create` is mapped to the `rhoconnect_create` method of the IRhoconnectCRUD
146
- interface that you must implement in the corresponding dataset's Controller class. It should
147
- return a newly created object's id in case of success:
219
+ In the case of the sample ASP.NET MVC application, you could implement this method in the `ContactsApp/Controllers/ContactController.cs` file as follows:
148
220
 
149
221
  public ActionResult rhoconnect_create(String objJson, String partition)
150
222
  {
@@ -154,10 +226,12 @@ return a newly created object's id in case of success:
154
226
  return RhoconnectNET.Helpers.serialize_result(new_contact.ID);
155
227
  }
156
228
 
157
- ## Update existing objects
229
+ ### Implement rhoconnect_update to Update Existing Objects
230
+
158
231
  In the similar fashion, the route `/rhoconnect/update` is mapped to the `rhoconnect_update` method of the IRhoconnectCRUD
159
- interface that you must implement in the corresponding dataset's Controller class. It should
160
- return an updated object's id in case of success:
232
+ interface that you must implement in the corresponding dataset's Controller class. It should return an updated object's id in case of success.
233
+
234
+ In the case of the sample ASP.NET MVC application, you could implement this method in the `ContactsApp/Controllers/ContactController.cs` file as follows:
161
235
 
162
236
  public ActionResult rhoconnect_update(Dictionary<string, object> changes, String partition)
163
237
  {
@@ -170,10 +244,11 @@ return an updated object's id in case of success:
170
244
  return RhoconnectNET.Helpers.serialize_result(contact_to_update.ID);
171
245
  }
172
246
 
173
- ## Delete objects from the dataset
174
- The route `/rhoconnect/delete` is mapped to the `rhoconnect_delete` method of the IRhoconnectCRUD
175
- interface that you must implement in the corresponding dataset's Controller class. It should
176
- return a deleted object's id in case of success:
247
+ ### Implement rhoconnect_delete to Delete Objects from the Dataset
248
+
249
+ The route `/rhoconnect/delete` is mapped to the `rhoconnect_delete` method of the IRhoconnectCRUD interface that you must implement in the corresponding dataset's Controller class. It should return a deleted object's id in case of success.
250
+
251
+ In the case of the sample ASP.NET MVC application, you could implement this method in the `ContactsApp/Controllers/ContactController.cs` file as follows:
177
252
 
178
253
  public ActionResult rhoconnect_delete(Object objId, String partition)
179
254
  {
@@ -185,21 +260,21 @@ return a deleted object's id in case of success:
185
260
  return RhoconnectNET.Helpers.serialize_result(key);
186
261
  }
187
262
 
188
- ## Partitioning Datasets
263
+ ### Partitioning Datasets
264
+
189
265
  Each of the above methods have a partition key supplied with the CRUD request. This partition key is used by `Rhoconnect` to uniquely identify the model dataset when it is stored in a rhoconnect instance. It is typically an attribute on the model or related model. `Rhoconnect` supports two types of partitions:
190
266
 
191
267
  * app - No unique key will be used, a shared dataset is synchronized for all users.
192
268
  * String partition key - unique key string identifying the partition (typically, user name).
193
269
 
194
- For example, the `Contact` model above might have a relationship to the User model. This provides us a simple way to organize the `Contact` dataset for rhoconnect by reusing this relationship.
270
+ For example, the `Contact` model above might have a relationship to the User model. This provides us a simple way to organize the `Contact` dataset for rhoconnect by reusing this relationship.
195
271
  In this case, your implementation might filter out data on a per user basis.
196
272
 
197
273
  For more information about Rhoconnect partitions, please refer to the [Rhoconnect docs](http://docs.rhomobile.com/rhoconnect/source-adapters#data-partitioning).
198
274
 
199
- ## Implementing MVC callbacks
200
- All of the above methods are necessary to establish the communication from the Rhoconnect instance to your ASP.NET MVC application.
201
- However, to complete the implementation, it is necessary to implement a reverse way to notify the Rhoconnect instance about the changes made in your MVC app.
202
- Typically, your MVC Controller class reacts to the actions by implementing the CRUD POST routes, for example:
275
+ ## Notifying the RhoConnect Server of Changes Made by the Backend Application
276
+
277
+ You must implement methods to notify the Rhoconnect server instance about the changes made in your MVC backend application. Typically, your MVC Controller class reacts to the actions by implementing the CRUD POST routes, for example:
203
278
 
204
279
  [HttpPost]
205
280
  public ActionResult Create(Contact new_contact)
@@ -214,9 +289,13 @@ Typically, your MVC Controller class reacts to the actions by implementing the C
214
289
  return View(new_contact);
215
290
  }
216
291
 
217
- Here, you need to insert a call which will notify the Rhoconnect instance that a new object has been created.
218
- For this reason, `RhoconnectNET` library provides three callback routines for CUD notifications.
219
- The above example will look like this after inserting the corresponding callback routine:
292
+ You need to insert calls in your ASP.NET MVC application which will notify the Rhoconnect server instance that the backend created, updated, or deleted an object. For this reason, the `RhoconnectNET` library provides three callback routines for CUD notifications: `notify_on_create`, `notify_on_update`, and `notify_on_delete`.
293
+
294
+ ### Notifying the RhoConnect Server that the Backend Created a New Object
295
+
296
+ You need to insert a call to `notify_on_create` to notify the Rhoconnect server instance that a new object has been created.
297
+
298
+ The previous example for ActionResult Create will look like this after inserting the corresponding callback routine:
220
299
 
221
300
  // This method is used to access current partition
222
301
  // in Rhoconnect notification callback
@@ -246,8 +325,7 @@ The above example will look like this after inserting the corresponding callback
246
325
  return View(contact);
247
326
  }
248
327
 
249
- In the example above, user need to call `RhoconnectNET.Client.notify_on_create` method
250
- with the following parameters:
328
+ In the example above, you need to call the `RhoconnectNET.Client.notify_on_create` method with the following parameters:
251
329
 
252
330
  <table border="1">
253
331
  <tr>
@@ -263,25 +341,27 @@ with the following parameters:
263
341
  </tr>
264
342
  </table>
265
343
 
266
- NOTE: The above notification callback has several overloads. In its simplest form,
344
+ ### Overriding To Pass Information Into the notify_on_create Callback Method
345
+
346
+ The above notification callback has several overloads. In its simplest form, the
267
347
  `notify_on_create` callback will obtain information about the source name from the `Contact` object
268
348
  class name (since it is equal) and will get the `id` field from the object itself. If your model
269
- stores `id` field under the custom name, then, you can use the following override to pass its name into
349
+ stores `id` field under the custom name, then you can use the following override to pass its name into
270
350
  the callback, where its value will be accessed through the Reflection mechanism:
271
351
 
272
352
  // insert these lines to provide
273
353
  // notifications to Rhoconnect server
274
354
  RhoconnectNET.Client.notify_on_create(partition(), "MyContactCustomID", contact);
275
355
 
276
- In addition to that, if your model's class is not equal to the Rhoconnect's Source Adapter name, you can
277
- use the following override to pass it along:
356
+ In addition, if your model's class is not equal to the Rhoconnect's Source Adapter name, you can use the following override to pass it along:
278
357
 
279
358
  // insert these lines to provide
280
359
  // notifications to Rhoconnect server
281
360
  RhoconnectNET.Client.notify_on_create("MyCustomContactSourceName", partition(), "MyContactCustomID", contact);
282
-
283
361
 
284
- In the same fashion , your dataset's Controller need to implement `Edit` and `Delete` callback notifications:
362
+ ### Notifying the RhoConnect Server that the Backend Application Edited or Deleted
363
+
364
+ In the same fashion, your dataset's Controller need to implement `Edit` and `Delete` callback notifications.
285
365
 
286
366
  [HttpPost]
287
367
  public ActionResult Edit(Contact contact)