public inbox for [email protected]
help / color / mirror / Atom feedSubject: [Pljava-dev] problem implementing with ResultSetProvider
Date: Tue, 3 Aug 2010 19:05:05 -0700
Message-ID: <[email protected]> (raw)
Hi, All.
When I create and try to run a function implementing
ResultSetProvider, I get a "Unable to find static method with
signature..." error.
Java code:
import edu.sc.seis.TauP.Arrival;
import edu.sc.seis.TauP.TauModelException;
import edu.sc.seis.TauP.TauP_Time;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.postgresql.pljava.ResultSetProvider;
public class emTauP implements ResultSetProvider {
private ResultSet rs;
private static TauP_Time tt;
private static Arrival[] arr;
public emTauP(String model, String phaselist, double depth,
double gcarc) throws SQLException {
// instantiate TauP_Time object, passing it the model name
tt = new TauP_Time(model);
// add the list of phases
tt.parsePhaseList(phaselist);
// correct for the source depth
tt.depthCorrect(depth);
// calculate for the distance in degrees
tt.calculate(gcarc);
// get the array of Arrival objects
arr = tt.getArrivals();
}
public static ResultSetProvider TTimes(String model, String
phaselist, double depth, double gcarc) throws SQLException {
// instantiate a new TauP class object
return new emTauP(model, phaselist, depth, gcarc);
}
public boolean assignRowValues(ResultSet trs, int RowNum) throws
SQLException {
if (rs.next()) {
trs.updateString(1, arr[RowNum].getName());
trs.updateDouble(2, arr[RowNum].getTime());
trs.updateDouble(3, arr[RowNum].getRayParam());
return(true);
} else {
return(false);
}
}
public void close() throws SQLException {
// does nothing, but required to implement ResultSetProvider
}
}
I install the class in postgres (8.4), using: SELECT sqlj.install_jar(
'file:///EMERALD/Java/emTauP/emTauP.jar', 'emTauP', true )
I create the function:
CREATE OR REPLACE FUNCTION em_ttimes(em_model text, em_phaselist text,
em_depth double precision, em_gcarc double precision) RETURNS SETOF
public.em_ttime AS
'emTauP.TTimes(java.lang.String, java.lang.String, double, double)'
LANGUAGE java;
Then when I run it, I get the following error:
ERROR: Unable to find static method emTauP.TTimes with signature
(Ljava/lang/String;Ljava/lang/String;DD)Lorg/postgresql/pljava/ResultSetProvider;
I can create and run functions which do not implement
ResultSetProvider, no problem. Can anyone see something I'm doing
wrong, or is this a bug?
Thanks very much!
? ?? -- John
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Subject: Re: [Pljava-dev] problem implementing with ResultSetProvider
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox