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
public static Subsurvey[] loadSubsurveys(String csvFilename)
{
LOGGER.info("loadSubsurvey from: " + csvFilename);
LOGGER.info("trace");
/* avoid access files-system if csv-filename not configured */
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;
}
LOGGER.info("load from: " + csvFilename);
try
{
......
......@@ -180,7 +180,7 @@ class VlkbCli implements Vlkb
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
{
LOGGER.info("trace");
......@@ -194,7 +194,7 @@ class VlkbCli implements Vlkb
if(subsurveyId != null)
{
extraCards = Subsurvey.subsurveysFindCards(subsurveys, subsurveyId);
extraCards = Subsurvey.subsurveysFindCards(this.subsurveys, subsurveyId);
}
else
{
......@@ -262,7 +262,7 @@ class VlkbCli implements Vlkb
{
MCutResult.Cut cut = doFileByIdWithErr(cutArgs.id,
cutArgs.pos, cutArgs.band, cutArgs.time, cutArgs.pol, cutArgs.pixels,
cutArgs.countNullValues, null);//cutArgs.extraCards);
cutArgs.countNullValues);//, null);//cutArgs.extraCards);
cut.index = ix++;
......@@ -334,7 +334,7 @@ class VlkbCli implements Vlkb
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");
......@@ -345,7 +345,7 @@ class VlkbCli implements Vlkb
{
CutResult cutResult = doFileById(id,
pos, band, time, pol, pixels,
countNullValues, subsurveys);
countNullValues/*, subsurveys*/);
cut.content = cutResult.fileName;
cut.contentType = MCutResult.Cut.ContentType.FILENAME;
......
......@@ -142,8 +142,12 @@ public class ServletCutout extends HttpServlet
FitsCard[] extraCards = null;
final Resolver resolver = (resolveFromId ? new ResolverFromId(subsurveys): new ResolverByObsCore(settings.dbConn, subsurveys));
final Vlkb vlkb = (useEngineOverCli ? new VlkbCli(settings) : new VlkbAmqp(settings));
final Resolver resolver = (resolveFromId ?
new ResolverFromId(subsurveys)
: new ResolverByObsCore(settings.dbConn, subsurveys));
final Vlkb vlkb = (useEngineOverCli ?
new VlkbCli(settings, subsurveys)
: new VlkbAmqp(settings, subsurveys));
resolver.resolve(id);
......
......@@ -20,7 +20,9 @@ import uws.service.UWSUrl;
public class UWSMCutout extends UWSServlet {
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
* Initialize your UWS. At least, you should create one jobs list. */
......
......@@ -37,17 +37,21 @@ public class UWSMCutoutWork extends JobThread
{
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 */
private String webappRootRequestUrl = null;
public UWSMCutoutWork(UWSJob j) throws UWSException{
public UWSMCutoutWork(UWSJob j) throws UWSException
{
super(j);
UWSUrl url = j.getUrl();
webappRootRequestUrl = url.getUrlHeader();
UWSUrl url = j.getUrl();
webappRootRequestUrl = url.getUrlHeader();
}
......@@ -117,7 +121,7 @@ public class UWSMCutoutWork extends JobThread
}
}
private String convertLocalPathnameToRemoteUrl(String localPathname,
private String convertLocalPathnameToRemoteUrl(String localPathname,
String FITScutpath, String FITSRemoteUrlCutouts)
{
//LOGGER.info("trace " + localPathname);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment