cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Barth" <christ...@buerobarth.de>
Subject How to make Generator cacheable?
Date Sun, 15 Jan 2006 11:18:19 GMT
Hi!

I want to cache a generator I just wrote. 
I thought I only have to implement the CacheableProcessingComponent.

Have a look at my code:


public class FBSGenerator extends ServiceableGenerator implements
CacheableProcessingComponent {
	
	private String bject;
	private String bject_ID;
	private String geb_ID;
	private String stock_ID;
	private String suchtyp;
	private String abweichungen;
	private BasicDocument ergebnis = new BasicDocument();
	protected Source inputSource;
	
	public void setup(SourceResolver resolver, Map objectModel, String
src, Parameters par)
	throws ProcessingException, SAXException, IOException 
	{
		super.setup(resolver, objectModel, src, par);
		try {
			bject = par.getParameter("bject");
			bject_ID = par.getParameter("bject_ID");
			suchtyp = par.getParameter("typ");
			geb_ID = par.getParameter("geb_ID");
			stock_ID = par.getParameter("stock_ID");
			abweichungen = par.getParameter("abweichungen");
			System.out.println("INPUTSOURCE");
			This.inputSource = super.resolver.resolveURI(src);
//This line throws an ERROR, see below
			System.out.println(inputSource.toString());
		
			
		} catch (ParameterException e) {
			e.printStackTrace();
		}
	}
	
	public void generate() throws IOException, SAXException,
ProcessingException
	{
		SAXParser parser = null;
		InputSource inputSource = new InputSource();
		System.out.println("Die ID: "+objekt_ID);
		System.out.println("Das Objekt: "+objekt);
		System.out.println("Der Typ: "+suchtyp);
		System.out.println("Die Geb_ID: "+geb_ID);
		System.out.println("Die Stock_ID: "+stock_ID);
		System.out.println("Abweichungen anzeigen: "+abweichungen);
		HashMap gewichte =
GewichtungsQuery.readGewichtung(DBConnection.COLLECTION, objekt, suchtyp);
		
		if (objekt.equals("gebTrennwand")) {
			ergebnis =
Gebaeudetrennwand.erzeugeErgebnisDoc(gewichte, geb_ID, objekt_ID, 
					suchtyp, abweichungen);
			System.out.println("BLUB: "+ergebnis.toString());
		}
		else if (objekt.equals("Trennwand")) {
			ergebnis =
Trennwand.erzeugeErgebnisDoc(gewichte, geb_ID, stock_ID, objekt_ID, 
					suchtyp, abweichungen);
			System.out.println("BLUB: "+ergebnis.toString());
		}
		else if (objekt.equals("Rettungsweg")) {
			ergebnis =
Rettungsweg.erzeugeErgebnisDoc(gewichte, geb_ID, stock_ID, objekt_ID, 
					suchtyp, abweichungen);
			System.out.println("BLUB: "+ergebnis.toString());
		}
	
		StringBufferInputStream anStream = new
StringBufferInputStream (ergebnis.toString()); 
		inputSource.setByteStream(anStream);
		try {
			parser =
(SAXParser)this.manager.lookup(SAXParser.ROLE);
		} catch (ServiceException e) {
			e.printStackTrace();
		}
		parser.parse(inputSource, super.xmlConsumer);
		
	}

	public Serializable getKey() {
		 return this.inputSource.getURI();
	}

	public SourceValidity getValidity() {
		
		return this.inputSource.getValidity();
	}

}


When I call this generator, I get the following error:

org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.cocoon.ProcessingException: Could not setup pipeline.:
java.net.MalformedURLException: Invalid System ID

What's wrong with my generator?

Barthi


Mime
View raw message