Upgrade rop-tutorial doc
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/d7eb7a98 Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/d7eb7a98 Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/d7eb7a98 Branch: refs/heads/master Commit: d7eb7a98dc129ebf03142333ce6e2640a61c906f Parents: 750d3d5 Author: Arseni Bulatski <ancars...@gmail.com> Authored: Tue Feb 13 14:02:38 2018 +0300 Committer: Arseni Bulatski <ancars...@gmail.com> Committed: Tue Feb 13 14:02:38 2018 +0300 ---------------------------------------------------------------------- .../_getting-started-rop/part2/adding.adoc | 20 ++++++++++++-------- .../_getting-started-rop/part2/connect.adoc | 13 +++++++++---- .../_getting-started-rop/part2/starting.adoc | 4 ++-- 3 files changed, 23 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/d7eb7a98/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc ---------------------------------------------------------------------- diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc index ae1d04b..b08a1f1 100644 --- a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc +++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc @@ -56,13 +56,13 @@ Open pom.xml in the server project and configure a "userRealm" for the Jetty plu [source, XML] ---- <plugin> - <groupId>org.mortbay.jetty</groupId> + <groupId>org.eclipse.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> - <version>6.1.22</version> + <version>9.4.8.v20171121</version> <!-- adding configuration below: --> <configuration> <userRealms> - <userRealm implementation="org.mortbay.jetty.security.HashUserRealm"> + <userRealm implementation="org.eclipse.jetty.security.HashLoginService"> <!-- this name must match the realm-name in web.xml --> <name>Cayenne Realm</name> <config>realm.properties</config> @@ -121,11 +121,15 @@ So change the line in Main.java where we obtained an ROP connection to this: [source, java] ---- Map<String,String> properties = new HashMap<>(); -properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial/cayenne-service"); -properties.put(Constants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user"); -properties.put(Constants.ROP_SERVICE_PASSWORD_PROPERTY, "secret"); - -ClientRuntime runtime = new ClientRuntime(properties); +properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/cayenne-service"); +properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user"); +properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret"); +properties.put(ClientConstants.ROP_SERVICE_REALM_PROPERTY, "Cayenne Realm"); + +ClientRuntime runtime = ClientRuntime.builder() + .properties(properties) + .addModule(new ClientJettyHttpModule()) + .build(); ---- Try running again, and everything should work as before. Obviously in production environment, http://git-wip-us.apache.org/repos/asf/cayenne/blob/d7eb7a98/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc ---------------------------------------------------------------------- diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc index da6ef00..590ac65 100644 --- a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc +++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc @@ -41,11 +41,16 @@ obtaining the ObjectContext: [source, java] ---- Map<String, String> properties = new HashMap<>(); -properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial/cayenne-service"); -properties.put(Constants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user"); -properties.put(Constants.ROP_SERVICE_PASSWORD_PROPERTY, "secret"); +properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/cayenne-service"); +properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user"); +properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret"); +properties.put(ClientConstants.ROP_SERVICE_REALM_PROPERTY, "Cayenne Realm"); -ClientRuntime runtime = new ClientRuntime(properties); + +ClientRuntime runtime = ClientRuntime.builder() + .properties(properties) + .addModule(new ClientJettyHttpModule()) + .build(); ObjectContext context = runtime.newContext(); ---- http://git-wip-us.apache.org/repos/asf/cayenne/blob/d7eb7a98/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc ---------------------------------------------------------------------- diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc index d0e905a..42af594 100644 --- a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc +++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc @@ -58,7 +58,7 @@ image::../images/datamap-enableclient.png[align="center"] Now go back to Eclipse, right click on "tutorial-rop-client" project and select "Refresh" - you should see pairs of classes generated for each mapped entity, same as on the server. And again, we see a bunch of errors in those classes. -Let's fix it now by adding two dependencies, "cayenne-client" and "resin-hessian", in the bottom of the pom.xml file. +Let's fix it now by adding two dependencies, "cayenne-client" and "hessian", in the bottom of the pom.xml file. We also need to add Caucho M2 repository to pull Hessian jar files. The resulting POM should look like this: [source, XML,subs="verbatim,attributes"] @@ -73,7 +73,7 @@ We also need to add Caucho M2 repository to pull Hessian jar files. The resultin <dependencies> <dependency> <groupId>org.apache.cayenne</groupId> - <artifactId>cayenne-client</artifactId> + <artifactId>cayenne-client-jetty</artifactId> <!-- Here specify the version of Cayenne you are actually using --> <version>{version}</version> </dependency>