comparison artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java @ 7077:0a337f0005c2 generator-refactoring

Extended init() of OutGenerator to take name of the out to serve.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 20 Sep 2013 16:34:09 +0200
parents c47f1a1d0f0f
children e4606eae8ea5
comparison
equal deleted inserted replaced
7074:a2abd87c0d3b 7077:0a337f0005c2
328 return null; 328 return null;
329 } 329 }
330 330
331 // XXX NOTE: the outGen is not able to process its generate() operation, 331 // XXX NOTE: the outGen is not able to process its generate() operation,
332 // because it has no OutputStream set! 332 // because it has no OutputStream set!
333 outGen.init(XMLUtils.newDocument(), null, getContext()); 333 outGen.init(out, XMLUtils.newDocument(), null, getContext());
334 prepareMasterArtifact(outGen); 334 prepareMasterArtifact(outGen);
335 335
336 try { 336 try {
337 Document outAttr = getAttribute(attr, out); 337 Document outAttr = getAttribute(attr, out);
338 OutputHelper helper = new OutputHelper(identifier()); 338 OutputHelper helper = new OutputHelper(identifier());
380 log.debug("-> Output subtype = " + subtype); 380 log.debug("-> Output subtype = " + subtype);
381 } 381 }
382 382
383 // If type contains 'chartinfo' use a generator that 383 // If type contains 'chartinfo' use a generator that
384 // just allow access to width, height etc. 384 // just allow access to width, height etc.
385 OutGenerator generator = null; 385
386 if (type != null 386 String key = type != null && !type.isEmpty() && type.indexOf("chartinfo") > 0
387 && type.length() > 0 387 ? type
388 && type.indexOf("chartinfo") > 0) 388 : name;
389 { 389
390 generator = RiverContext.getOutGenerator(context, type, subtype); 390 OutGenerator generator = RiverContext.getOutGenerator(context, key, subtype);
391 }
392 else {
393 generator = RiverContext.getOutGenerator(context, name, subtype);
394 }
395 391
396 if (generator == null) { 392 if (generator == null) {
397 log.error("There is no generator specified for output: " + name); 393 log.error("There is no generator specified for output: " + name);
398 // TODO Throw an exception. 394 // TODO Throw an exception.
399 395
415 log.debug(" -- Facet " + facet.getName()); 411 log.debug(" -- Facet " + facet.getName());
416 } 412 }
417 } 413 }
418 } 414 }
419 415
420 generator.init(format, out, context); 416 generator.init(key, format, out, context);
421 generator.setSettings(settings); 417 generator.setSettings(settings);
422 generator.setCollection(this); 418 generator.setCollection(this);
423 prepareMasterArtifact(generator); 419 prepareMasterArtifact(generator);
424 420
425 try { 421 try {

http://dive4elements.wald.intevation.org