Skip to content
Snippets Groups Projects
Commit 244ca8f2 authored by Robert Butora's avatar Robert Butora
Browse files

mcutout: fixes bug in VlkbCli (subsurveys was not initilized)

parent 69b91ce4
No related branches found
No related tags found
No related merge requests found
...@@ -109,14 +109,15 @@ class Subsurvey ...@@ -109,14 +109,15 @@ class Subsurvey
public static Subsurvey[] loadSubsurveys(String csvFilename) public static Subsurvey[] loadSubsurveys(String csvFilename)
{ {
LOGGER.info("loadSubsurvey from: " + csvFilename); LOGGER.info("trace");
/* avoid access files-system if csv-filename not configured */ /* avoid access files-system if csv-filename not configured */
if( (csvFilename == null) || ( (csvFilename != null) && (csvFilename.length() < 1) ) ) if( (csvFilename == null) || ( (csvFilename != null) && (csvFilename.length() < 1) ) )
{ {
LOGGER.warning("csvFilename is null, metadata not loaded"); LOGGER.warning("csvFilename is empty, metadata not loaded");
return null; return null;
} }
LOGGER.info("load from: " + csvFilename);
try try
{ {
......
...@@ -180,7 +180,7 @@ class VlkbCli implements Vlkb ...@@ -180,7 +180,7 @@ class VlkbCli implements Vlkb
private CutResult doFileById(String id, Pos pos, Band band, Time time, Pol pol, String pixels, private CutResult doFileById(String id, Pos pos, Band band, Time time, Pol pol, String pixels,
boolean countNullValues, Subsurvey[] subsurveys) boolean countNullValues/*, Subsurvey[] subsurveys*/)
throws IOException, InterruptedException throws IOException, InterruptedException
{ {
LOGGER.info("trace"); LOGGER.info("trace");
...@@ -194,7 +194,7 @@ class VlkbCli implements Vlkb ...@@ -194,7 +194,7 @@ class VlkbCli implements Vlkb
if(subsurveyId != null) if(subsurveyId != null)
{ {
extraCards = Subsurvey.subsurveysFindCards(subsurveys, subsurveyId); extraCards = Subsurvey.subsurveysFindCards(this.subsurveys, subsurveyId);
} }
else else
{ {
...@@ -262,7 +262,7 @@ class VlkbCli implements Vlkb ...@@ -262,7 +262,7 @@ class VlkbCli implements Vlkb
{ {
MCutResult.Cut cut = doFileByIdWithErr(cutArgs.id, MCutResult.Cut cut = doFileByIdWithErr(cutArgs.id,
cutArgs.pos, cutArgs.band, cutArgs.time, cutArgs.pol, cutArgs.pixels, cutArgs.pos, cutArgs.band, cutArgs.time, cutArgs.pol, cutArgs.pixels,
cutArgs.countNullValues, null);//cutArgs.extraCards); cutArgs.countNullValues);//, null);//cutArgs.extraCards);
cut.index = ix++; cut.index = ix++;
...@@ -334,7 +334,7 @@ class VlkbCli implements Vlkb ...@@ -334,7 +334,7 @@ class VlkbCli implements Vlkb
private MCutResult.Cut doFileByIdWithErr(String id, Pos pos, Band band, Time time, Pol pol, String pixels, private MCutResult.Cut doFileByIdWithErr(String id, Pos pos, Band band, Time time, Pol pol, String pixels,
boolean countNullValues, Subsurvey[] subsurveys) boolean countNullValues/*, Subsurvey[] subsurveys*/)
{ {
LOGGER.info("trace"); LOGGER.info("trace");
...@@ -345,7 +345,7 @@ class VlkbCli implements Vlkb ...@@ -345,7 +345,7 @@ class VlkbCli implements Vlkb
{ {
CutResult cutResult = doFileById(id, CutResult cutResult = doFileById(id,
pos, band, time, pol, pixels, pos, band, time, pol, pixels,
countNullValues, subsurveys); countNullValues/*, subsurveys*/);
cut.content = cutResult.fileName; cut.content = cutResult.fileName;
cut.contentType = MCutResult.Cut.ContentType.FILENAME; cut.contentType = MCutResult.Cut.ContentType.FILENAME;
......
...@@ -142,8 +142,12 @@ public class ServletCutout extends HttpServlet ...@@ -142,8 +142,12 @@ public class ServletCutout extends HttpServlet
FitsCard[] extraCards = null; FitsCard[] extraCards = null;
final Resolver resolver = (resolveFromId ? new ResolverFromId(subsurveys): new ResolverByObsCore(settings.dbConn, subsurveys)); final Resolver resolver = (resolveFromId ?
final Vlkb vlkb = (useEngineOverCli ? new VlkbCli(settings) : new VlkbAmqp(settings)); new ResolverFromId(subsurveys)
: new ResolverByObsCore(settings.dbConn, subsurveys));
final Vlkb vlkb = (useEngineOverCli ?
new VlkbCli(settings, subsurveys)
: new VlkbAmqp(settings, subsurveys));
resolver.resolve(id); resolver.resolve(id);
......
...@@ -20,7 +20,9 @@ import uws.service.UWSUrl; ...@@ -20,7 +20,9 @@ import uws.service.UWSUrl;
public class UWSMCutout extends UWSServlet { public class UWSMCutout extends UWSServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final Settings settings = Settings.getInstance(); protected static final Settings settings = Settings.getInstance();
protected static final Subsurvey[] subsurveys = Subsurvey.loadSubsurveys(
settings.fitsPaths.surveysMetadataAbsPathname());
/* REQUIRED /* REQUIRED
* Initialize your UWS. At least, you should create one jobs list. */ * Initialize your UWS. At least, you should create one jobs list. */
......
...@@ -38,13 +38,17 @@ public class UWSMCutoutWork extends JobThread ...@@ -38,13 +38,17 @@ public class UWSMCutoutWork extends JobThread
final String RESPONSE_ENCODING = "utf-8"; final String RESPONSE_ENCODING = "utf-8";
private Settings settings = UWSMCutout.settings; private Settings settings = UWSMCutout.settings;
private Subsurvey[] subsurveys = UWSMCutout.subsurveys;
protected Vlkb vlkb = ( settings.amqpConn.isHostnameEmpty() ? new VlkbCli(settings): new VlkbAmqp(settings) ); protected Vlkb vlkb = (settings.amqpConn.isHostnameEmpty() ?
new VlkbCli(settings, subsurveys)
: new VlkbAmqp(settings, subsurveys));
/* NOTE needed if cutouts dir served by vlkb-datasets */ /* NOTE needed if cutouts dir served by vlkb-datasets */
private String webappRootRequestUrl = null; private String webappRootRequestUrl = null;
public UWSMCutoutWork(UWSJob j) throws UWSException{ public UWSMCutoutWork(UWSJob j) throws UWSException
{
super(j); super(j);
UWSUrl url = j.getUrl(); UWSUrl url = j.getUrl();
webappRootRequestUrl = url.getUrlHeader(); webappRootRequestUrl = url.getUrlHeader();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment