Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java @ 229:924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
flys-client/trunk@1681 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 14 Apr 2011 07:53:01 +0000 |
parents | e02f50a3ad59 |
children | 6de435235927 |
comparison
equal
deleted
inserted
replaced
228:bbe32496dc84 | 229:924da6695800 |
---|---|
42 | 42 |
43 /** | 43 /** |
44 * This method wraps the artifact operations FEED and ADVANCE. FEED is | 44 * This method wraps the artifact operations FEED and ADVANCE. FEED is |
45 * always triggerd, ADVANCE only, if there is at least one reachable state. | 45 * always triggerd, ADVANCE only, if there is at least one reachable state. |
46 * | 46 * |
47 * @param serverUrl The url of the artifact server. | 47 * @param url The url of the artifact server. |
48 * @param locale The locale used for the request. | |
48 * @param artifact The artifact that needs to be fed. | 49 * @param artifact The artifact that needs to be fed. |
49 * @param data An array of Data objects that contain the information that | 50 * @param data An array of Data objects that contain the information that |
50 * | 51 * |
51 * @return the modified artifact. | 52 * @return the modified artifact. |
52 */ | 53 */ |
53 public Artifact go(String serverUrl, Artifact artifact, Data[] data) | 54 public Artifact go(String url, String locale, Artifact artifact, Data[] data) |
54 throws ServerException | 55 throws ServerException |
55 { | 56 { |
56 Artifact afterFeed = feed(serverUrl, artifact, data); | 57 System.out.println("StepForwardServiceImpl.go"); |
58 | |
59 Artifact afterFeed = feed(url, locale, artifact, data); | |
57 | 60 |
58 if (afterFeed == null) { | 61 if (afterFeed == null) { |
59 System.err.println("StepForwardService.feed() - FAILED"); | 62 System.err.println("StepForwardService.feed() - FAILED"); |
60 throw new ServerException(ERROR_FEED_DATA); | 63 throw new ServerException(ERROR_FEED_DATA); |
61 } | 64 } |
68 return afterFeed; | 71 return afterFeed; |
69 } | 72 } |
70 | 73 |
71 // We use the first reachable state as default target, maybe we need to | 74 // We use the first reachable state as default target, maybe we need to |
72 // change this later. | 75 // change this later. |
73 return advance(serverUrl, afterFeed, reachable[0]); | 76 return advance(url, locale, afterFeed, reachable[0]); |
74 } | 77 } |
75 | 78 |
76 | 79 |
77 /** | 80 /** |
78 * This method triggers the FEED operation. | 81 * This method triggers the FEED operation. |
79 * | 82 * |
80 * @param serverUrl The url of the artifact server. | 83 * @param url The url of the artifact server. |
81 * @param artifact The artifact that needs to be fed. | 84 * @param artifact The artifact that needs to be fed. |
82 * @param data An array of Data objects that contain the information that | 85 * @param data An array of Data objects that contain the information that |
83 * are used for the FEED operation. | 86 * are used for the FEED operation. |
84 * | 87 * |
85 * @return a new artifact parsed from the description of FEED. | 88 * @return a new artifact parsed from the description of FEED. |
86 */ | 89 */ |
87 protected Artifact feed(String serverUrl, Artifact artifact, Data[] data) | 90 protected Artifact feed( |
91 String url, | |
92 String locale, | |
93 Artifact artifact, | |
94 Data[] data) | |
88 throws ServerException | 95 throws ServerException |
89 { | 96 { |
97 System.out.println("StepForwardServiceImpl.feed"); | |
98 | |
90 Document feed = ClientProtocolUtils.newFeedDocument( | 99 Document feed = ClientProtocolUtils.newFeedDocument( |
91 artifact.getUuid(), | 100 artifact.getUuid(), |
92 artifact.getHash(), | 101 artifact.getHash(), |
93 createKVP(data)); | 102 createKVP(data)); |
94 | 103 |
95 HttpClient client = new HttpClientImpl(serverUrl); | 104 XMLDebug.out(feed); |
105 | |
106 HttpClient client = new HttpClientImpl(url, locale); | |
96 | 107 |
97 try { | 108 try { |
98 Document description = (Document) client.feed( | 109 Document description = (Document) client.feed( |
99 new de.intevation.artifacts.httpclient.objects.Artifact( | 110 new de.intevation.artifacts.httpclient.objects.Artifact( |
100 artifact.getUuid(), | 111 artifact.getUuid(), |