1 16 package org.apache.cocoon.samples.jms; 17 18 import java.net.HttpURLConnection ; 19 import java.net.URL ; 20 21 import org.apache.cocoon.util.NetUtils; 22 import org.hsqldb.Trigger; 23 24 28 public class HTTPTrigger implements Trigger { 29 30 protected String protocol = "http"; 31 protected String hostname = "localhost"; 32 protected int port = 8888; 33 protected String path = "/samples/jms/database/jms-invalidate"; 34 35 38 public void fire(String triggerName, String tableName, Object [] row) { 39 try { 40 HttpURLConnection con = (HttpURLConnection ) new URL (this.protocol, this.hostname, this.port, this.path+"?trigger=" 41 + NetUtils.encode(triggerName.toLowerCase(), "utf-8") 42 + "&table=" 43 + NetUtils.encode(tableName.toLowerCase(), "utf-8")).openConnection(); 44 con.connect(); 45 con.getContent(); 46 con.disconnect(); 47 } catch (Exception e) { 48 throw new RuntimeException ("Cannot execute trigger: "+e.getMessage()); 50 } 51 } 52 53 56 public void fire(int arg0, String arg1, String arg2, Object [] arg3, Object [] arg4) { 57 59 } 60 61 } 62 | Popular Tags |