[Pljava-dev] problem implementing with ResultSetProvider

From: JDW at Fodoze(dot)com (John D(dot) West)
To:
Subject: [Pljava-dev] problem implementing with ResultSetProvider
Date: 2010-08-04 02:05:05
Message-ID: AANLkTim79vppDSncs9Rju0DKSue_wygqRg+MZiE=qHRP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Luca Ferrari 2010-08-04 06:59:16 [Pljava-dev] problem implementing with ResultSetProvider
Previous Message Caleb Welton 2010-07-27 17:57:15 [Pljava-dev] pljava error logging levels