comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1988:158b3aabda2c

Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object. flys-artifacts/trunk@3422 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Dec 2011 10:09:02 +0000
parents a7c437c9547e
children 85132c9edd64
comparison
equal deleted inserted replaced
1987:382e38164200 1988:158b3aabda2c
243 * <i>out</i> to create an initial Settings object. 243 * <i>out</i> to create an initial Settings object.
244 */ 244 */
245 protected Settings createInitialOutputSettings(CallContext cc, String out) { 245 protected Settings createInitialOutputSettings(CallContext cc, String out) {
246 OutGenerator outGen = getOutGenerator(cc, out, null); 246 OutGenerator outGen = getOutGenerator(cc, out, null);
247 247
248 // TODO simulate a real out() process and return finally the Settings 248 // XXX NOTE: the outGen is not able to process its generate() operation,
249 // object retrieved by the OutGenerator. 249 // because it has no OutputStream set!
250 outGen.init(XMLUtils.newDocument(), null, cc);
251 prepareMasterArtifact(outGen, cc);
252
253 try {
254 Document attr = getAttribute(cc, out);
255 doOut(outGen, out, out, attr, cc);
256 }
257 catch (ArtifactDatabaseException adbe) {
258 log.error(adbe, adbe);
259 }
260 catch (IOException ioe) {
261 log.error(ioe, ioe);
262 }
250 263
251 return outGen.getSettings(); 264 return outGen.getSettings();
252 } 265 }
253 266
254 267
289 302
290 return; 303 return;
291 } 304 }
292 305
293 generator.init(format, out, context); 306 generator.init(format, out, context);
294 307 prepareMasterArtifact(generator, context);
295 // Get master artifact.
296 FLYSArtifact master = getMasterArtifact(context);
297 if (master != null) {
298 log.debug("Will set master Artifact to uuid: " + master.identifier());
299 generator.setMasterArtifact(master);
300 }
301 else {
302 log.warn("Could not set master artifact.");
303 }
304 308
305 try { 309 try {
306 Document attr = getAttribute(context, name); 310 Document attr = getAttribute(context, name);
307 doOut(generator, name, subtype, attr, context); 311 doOut(generator, name, subtype, attr, context);
312 generator.generate();
308 } 313 }
309 catch (ArtifactDatabaseException adbe) { 314 catch (ArtifactDatabaseException adbe) {
310 log.error(adbe, adbe); 315 log.error(adbe, adbe);
316 }
317 }
318
319
320 /**
321 * Sets the master Artifact at the given <i>generator</i>.
322 *
323 * @param generator The generator that gets a master Artifact.
324 * @param cc The CallContext.
325 */
326 protected void prepareMasterArtifact(OutGenerator generator, CallContext cc
327 ) {
328 // Get master artifact.
329 FLYSArtifact master = getMasterArtifact(cc);
330 if (master != null) {
331 log.debug("Set master Artifact to uuid: " + master.identifier());
332 generator.setMasterArtifact(master);
333 }
334 else {
335 log.warn("Could not set master artifact.");
311 } 336 }
312 } 337 }
313 338
314 339
315 /** 340 /**
374 } 399 }
375 } 400 }
376 catch (ArtifactDatabaseException ade) { 401 catch (ArtifactDatabaseException ade) {
377 log.error(ade, ade); 402 log.error(ade, ade);
378 } 403 }
379
380 generator.generate();
381 } 404 }
382 405
383 406
384 /** 407 /**
385 * Show blackboard (context) to each facet and create a list of 408 * Show blackboard (context) to each facet and create a list of

http://dive4elements.wald.intevation.org