Omaha #5237 Replace deprecated LocalizationFile method calls

Changed LocalizationFile.getName() to getPath() in all Raytheon edex plugins.
Also changed LocalizationFile to ILocalizationFile when it was possible to do
so without further code changes.

Change-Id: Ic066dd09a7929606f6987088b6d182a60caea1c1

Former-commit-id: 1864ce834c0c27647c4da46868d9a65e01addd9f
This commit is contained in:
Tom Gurney 2016-01-27 16:51:03 -06:00
parent 2ad363ebca
commit 147144e64f
10 changed files with 69 additions and 98 deletions

View file

@ -31,6 +31,7 @@ import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint; import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
@ -54,6 +55,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometry;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 10, 2014 3226 bclement Initial creation * Jun 10, 2014 3226 bclement Initial creation
* Jan 27, 2016 5237 tgurney Replace LocalizationFile with
* ILocalizationFile
* *
* </pre> * </pre>
* *
@ -92,11 +95,11 @@ public class LightningGeoFilter {
LOCALIZATION_FILTER_DIR, new String[] { ".xml" }, true, LOCALIZATION_FILTER_DIR, new String[] { ".xml" }, true,
true); true);
for (LocalizationFile file : files) { for (ILocalizationFile file : files) {
Collection<PreparedGeometry> filters = getFilterGeometries(file); Collection<PreparedGeometry> filters = getFilterGeometries(file);
if (!filters.isEmpty()) { if (!filters.isEmpty()) {
String bareName = getFileNameWithoutExtension(file String bareName = getFileNameWithoutExtension(file
.getName()); .getPath());
geometryMap.put(bareName.toLowerCase(), filters); geometryMap.put(bareName.toLowerCase(), filters);
} }
} }
@ -112,11 +115,9 @@ public class LightningGeoFilter {
* @return empty list on error * @return empty list on error
*/ */
private static Collection<PreparedGeometry> getFilterGeometries( private static Collection<PreparedGeometry> getFilterGeometries(
LocalizationFile file) { ILocalizationFile file) {
Collection<PreparedGeometry> rval; Collection<PreparedGeometry> rval;
InputStream in = null; try (InputStream in = file.openInputStream()) {
try {
in = file.openInputStream();
GeoFilterResult result = GeoFilterParser.parse(in); GeoFilterResult result = GeoFilterParser.parse(in);
if (result.hasErrors()) { if (result.hasErrors()) {
for (GeoFilterException e : result.getErrors()) { for (GeoFilterException e : result.getErrors()) {
@ -125,25 +126,10 @@ public class LightningGeoFilter {
log.warn("Filter parsing included errors, filters will be incomplete"); log.warn("Filter parsing included errors, filters will be incomplete");
} }
return result.getFilters(); return result.getFilters();
} catch (JAXBException e) { } catch (IOException | JAXBException | LocalizationException
log.error("Unable to parse filter file: " + file.getName(), e); | SerializationException e) {
log.error("Unable to parse filter file: " + file.getPath(), e);
rval = Collections.emptyList(); rval = Collections.emptyList();
} catch (LocalizationException e) {
log.error("Unable to open filter file: " + file.getName(), e);
rval = Collections.emptyList();
} catch (SerializationException e) {
log.error("Unable to parse filter file: " + file.getName(), e);
rval = Collections.emptyList();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
log.error(
"Problem closing localization file: "
+ file.getName(), e);
}
}
} }
return rval; return rval;
} }

View file

@ -61,6 +61,8 @@ import com.raytheon.uf.common.util.mapping.MultipleMappingException;
* Oct 14, 2013 2473 bsteffen Remove lookup of deprecated grib files. * Oct 14, 2013 2473 bsteffen Remove lookup of deprecated grib files.
* Jun 05, 2015 4495 njensen Improved error message * Jun 05, 2015 4495 njensen Improved error message
* Jul 13, 2015 4537 randerso Removed unused function * Jul 13, 2015 4537 randerso Removed unused function
* Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile
* method call
* *
* </pre> * </pre>
* *
@ -190,7 +192,7 @@ public class GridParamInfoLookup {
} catch (JAXBException e) { } catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error unmarshalling grid parameter information from file " "Error unmarshalling grid parameter information from file "
+ file.getName(), e); + file.getPath(), e);
} }
} }
for (GridParamInfo gridParamInfo : modelParamMap.values()) { for (GridParamInfo gridParamInfo : modelParamMap.values()) {

View file

@ -57,6 +57,8 @@ import com.raytheon.uf.common.util.FileUtil;
* Feb 19, 2015 4125 rjpeter Fix jaxb performance issue * Feb 19, 2015 4125 rjpeter Fix jaxb performance issue
* Apr 10, 2015 4383 dgilling Fix getData so it searches correct localization * Apr 10, 2015 4383 dgilling Fix getData so it searches correct localization
* directories for secondary sites. * directories for secondary sites.
* Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile
* method call
* *
* </pre> * </pre>
* *
@ -93,7 +95,7 @@ public class ReferenceMgr {
new String[] { ".xml" }, false, true); new String[] { ".xml" }, false, true);
if (contents != null) { if (contents != null) {
for (LocalizationFile lf : contents) { for (LocalizationFile lf : contents) {
String s = LocalizationUtil.extractName(lf.getName()); String s = LocalizationUtil.extractName(lf.getPath());
String area = s.replace(".xml", ""); String area = s.replace(".xml", "");
refIDs.add(new ReferenceID(area, lf.isProtected(), lf refIDs.add(new ReferenceID(area, lf.isProtected(), lf
.getContext().getLocalizationLevel())); .getContext().getLocalizationLevel()));
@ -163,11 +165,6 @@ public class ReferenceMgr {
return sr; return sr;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
return "ReferenceMgr [" + dbGridLocation.getSiteId() + "]"; return "ReferenceMgr [" + dbGridLocation.getSiteId() + "]";

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.activetable.VTECPartners;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil; import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord; import com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -82,6 +83,7 @@ import com.raytheon.uf.edex.activetable.ActiveTablePyIncludeUtil;
* Added support for sending TCVAdvisory files to * Added support for sending TCVAdvisory files to
* VTEC partners * VTEC partners
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 27, 2016 5237 tgurney Replace LocalizationFile with ILocalizationFile
* *
* </pre> * </pre>
* *
@ -129,11 +131,6 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
private static final ThreadLocal<PythonScript> pythonScript = new ThreadLocal<PythonScript>() { private static final ThreadLocal<PythonScript> pythonScript = new ThreadLocal<PythonScript>() {
/*
* (non-Javadoc)
*
* @see java.lang.ThreadLocal#initialValue()
*/
@Override @Override
protected PythonScript initialValue() { protected PythonScript initialValue() {
IPathManager pathMgr = PathManagerFactory.getPathManager(); IPathManager pathMgr = PathManagerFactory.getPathManager();
@ -172,13 +169,6 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
super(TPC_WATCH_TYPE); super(TPC_WATCH_TYPE);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.edex.plugin.gfe.watch.AbstractWatchNotifierSrv#handleWatch
* (java.util.List)
*/
@Override @Override
public void handleWatch(List<AbstractWarningRecord> warningRecs) { public void handleWatch(List<AbstractWarningRecord> warningRecs) {
/* /*
@ -439,7 +429,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
return practiceMode ? PRACTICE_PATH : TCV_ADVISORY_PATH; return practiceMode ? PRACTICE_PATH : TCV_ADVISORY_PATH;
} }
private Map<String, Object> loadJSONDictionary(LocalizationFile lf) { private Map<String, Object> loadJSONDictionary(ILocalizationFile lf) {
if (lf != null) { if (lf != null) {
PythonScript script = this.pythonScript.get(); PythonScript script = this.pythonScript.get();
if (script != null) { if (script != null) {
@ -447,7 +437,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
args.put("localizationType", lf.getContext() args.put("localizationType", lf.getContext()
.getLocalizationType()); .getLocalizationType());
args.put("siteID", lf.getContext().getContextName()); args.put("siteID", lf.getContext().getContextName());
args.put("fileName", lf.getName()); args.put("fileName", lf.getPath());
try { try {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> retVal = (Map<String, Object>) script Map<String, Object> retVal = (Map<String, Object>) script
@ -463,7 +453,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
return null; return null;
} }
private void saveJSONDictionary(LocalizationFile lf, private void saveJSONDictionary(ILocalizationFile lf,
Map<String, Object> dict) { Map<String, Object> dict) {
if (lf != null) { if (lf != null) {
PythonScript script = this.pythonScript.get(); PythonScript script = this.pythonScript.get();
@ -472,7 +462,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
args.put("localizationType", lf.getContext() args.put("localizationType", lf.getContext()
.getLocalizationType()); .getLocalizationType());
args.put("siteID", lf.getContext().getContextName()); args.put("siteID", lf.getContext().getContextName());
args.put("fileName", lf.getName()); args.put("fileName", lf.getPath());
args.put("javaObject", dict); args.put("javaObject", dict);
try { try {
script.execute("saveJsonFromJava", args); script.execute("saveJsonFromJava", args);
@ -484,13 +474,6 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.plugin.gfe.warning.AbstractWarningNotifierSrv#
* buildNotification(java.util.List,
* com.raytheon.uf.common.activetable.VTECPartners)
*/
@Override @Override
protected String buildNotification(List<AbstractWarningRecord> decodedVTEC, protected String buildNotification(List<AbstractWarningRecord> decodedVTEC,
VTECPartners partnersConfig) { VTECPartners partnersConfig) {

View file

@ -43,6 +43,8 @@ import com.vividsolutions.jts.io.WKTReader;
* 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations. * 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations.
* Mar 06, 2014 2876 mpduff Moved NationalDatasetSubscriber. * Mar 06, 2014 2876 mpduff Moved NationalDatasetSubscriber.
* Jul 09, 2015 4500 rjpeter Fix SQL Injection concern. * Jul 09, 2015 4500 rjpeter Fix SQL Injection concern.
* Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile
* method call
* </pre> * </pre>
*/ */
public class Import88DLocationsUtil implements INationalDatasetSubscriber { public class Import88DLocationsUtil implements INationalDatasetSubscriber {
@ -166,7 +168,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
statusHandler.handle( statusHandler.handle(
Priority.PROBLEM, Priority.PROBLEM,
"Could not create output file: " "Could not create output file: "
+ outFile.getName(), e); + outFile.getPath(), e);
} }
} finally { } finally {
if (fis != null) { if (fis != null) {

View file

@ -61,6 +61,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 17, 2010 rjpeter Initial creation * Nov 17, 2010 rjpeter Initial creation
* Aug 26, 2014 3503 bclement removed warning * Aug 26, 2014 3503 bclement removed warning
* Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile
* method call
* *
* </pre> * </pre>
* *
@ -214,7 +216,7 @@ public class LocationCache {
handler.handle( handler.handle(
Priority.WARN, Priority.WARN,
"Error deleting cwat location file [" "Error deleting cwat location file ["
+ localizationFile.getName() + "], " + localizationFile.getPath() + "], "
+ e2.getMessage()); + e2.getMessage());
} }
} finally { } finally {
@ -239,7 +241,7 @@ public class LocationCache {
location.setLastModifiyTime(file.lastModified()); location.setLastModifiyTime(file.lastModified());
} catch (Exception e) { } catch (Exception e) {
handler.handle(Priority.ERROR, "Error saving cwat location file [" handler.handle(Priority.ERROR, "Error saving cwat location file ["
+ locationFile.getName() + "], Error: " + e.getMessage()); + locationFile.getPath() + "], Error: " + e.getMessage());
} }
} }

View file

@ -142,6 +142,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff;
* Sep 09, 2015 4756 dhladky Further generalization of FFG processing. * Sep 09, 2015 4756 dhladky Further generalization of FFG processing.
* Sep 21, 2015 4756 dhladky Allow ARCHIVE types to not be purged out. * Sep 21, 2015 4756 dhladky Allow ARCHIVE types to not be purged out.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile method calls
* *
* </pre> * </pre>
* *
@ -998,13 +999,13 @@ public class FFMPGenerator extends CompositeProductGenerator implements
FileUtil.file2bytes(f.getFile(), true)); FileUtil.file2bytes(f.getFile(), true));
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Unable to locate file " + f.getName()); "Unable to locate file " + f.getPath());
} catch (SerializationException se) { } catch (SerializationException se) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Unable to read file " + f.getName()); "Unable to read file " + f.getPath());
} catch (IOException ioe) { } catch (IOException ioe) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"General IO problem with file " + f.getName(), ioe); "General IO problem with file " + f.getPath(), ioe);
} }
return sbl; return sbl;
@ -1747,16 +1748,16 @@ public class FFMPGenerator extends CompositeProductGenerator implements
FileUtil.file2bytes(f.getFile(), true)); FileUtil.file2bytes(f.getFile(), true));
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Unable to locate file " + f.getName(), fnfe); "Unable to locate file " + f.getPath(), fnfe);
} catch (SerializationException se) { } catch (SerializationException se) {
statusHandler.handle(Priority.ERROR, "Unable to serialize file " statusHandler.handle(Priority.ERROR, "Unable to serialize file "
+ f.getName(), se); + f.getPath(), se);
} catch (IOException ioe) { } catch (IOException ioe) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"IO problem reading file " + f.getName(), ioe); "IO problem reading file " + f.getPath(), ioe);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"General Exception reading file " + f.getName(), e); "General Exception reading file " + f.getPath(), e);
} }
return ffti; return ffti;

View file

@ -44,8 +44,8 @@ import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.dataplugin.level.LevelFactory;
import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.parameter.Parameter; import com.raytheon.uf.common.parameter.Parameter;
import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationException;
@ -70,6 +70,8 @@ import com.raytheon.uf.edex.plugin.grid.netcdf.description.product.NetcdfGridPro
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 03, 2015 4696 nabowle Initial creation * Sep 03, 2015 4696 nabowle Initial creation
* Sep 10, 2015 4696 nabowle Refactored. Renamed. No longer abstract. * Sep 10, 2015 4696 nabowle Refactored. Renamed. No longer abstract.
* Jan 27, 2016 5237 tgurney Replace LocalizationFile with
* ILocalizationFile
* *
* </pre> * </pre>
* *
@ -150,8 +152,8 @@ public class NetcdfGridDecoder {
Variable dataVar = file.findVariable(product.getData().getName()); Variable dataVar = file.findVariable(product.getData().getName());
if (dataVar == null) { if (dataVar == null) {
logger.error("No {} {} data in file: {}", descriptions logger.error("No {} {} data in file: {}", descriptions
.getDatasetId(), product.getData().getName(), .getDatasetId(), product.getData().getName(), f
f.getName()); .getName());
return EMPTY_RECORDS; return EMPTY_RECORDS;
} }
@ -299,8 +301,7 @@ public class NetcdfGridDecoder {
DataTime dataTime = descriptions.getDataTime().getDataTime(file); DataTime dataTime = descriptions.getDataTime().getDataTime(file);
if (dataTime == null) { if (dataTime == null) {
throw new NetcdfDecoderException( throw new NetcdfDecoderException("Cannot decode the data time.");
"Cannot decode the data time.");
} }
GridCoverage location = getCoverage(file, descriptions); GridCoverage location = getCoverage(file, descriptions);
@ -323,7 +324,8 @@ public class NetcdfGridDecoder {
} }
NetcdfGridRecordInfo info; NetcdfGridRecordInfo info;
for (NetcdfGridProductDescription prod : descriptions.getDescriptions()) { for (NetcdfGridProductDescription prod : descriptions
.getDescriptions()) {
for (int i = 0; i < numLevels; i++) { for (int i = 0; i < numLevels; i++) {
info = new NetcdfGridRecordInfo(); info = new NetcdfGridRecordInfo();
info.setDataTime(dataTime); info.setDataTime(dataTime);
@ -404,20 +406,20 @@ public class NetcdfGridDecoder {
* @throws SerializationException * @throws SerializationException
*/ */
public void setPathManager(IPathManager pathManager) { public void setPathManager(IPathManager pathManager) {
LocalizationFile[] files = pathManager.listStaticFiles("grid/netcdf", ILocalizationFile[] files = pathManager.listStaticFiles("grid/netcdf",
new String[] { ".xml" }, true, true); new String[] { ".xml" }, true, true);
NetcdfGridProductDescriptions descriptions; NetcdfGridProductDescriptions descriptions;
for (LocalizationFile file : files) { for (ILocalizationFile file : files) {
logger.info("Loading Netcdf Grid description from " logger.info("Loading Netcdf Grid description from "
+ file.getName()); + file.getPath());
try (InputStream inputStream = file.openInputStream()) { try (InputStream inputStream = file.openInputStream()) {
descriptions = JAXB.unmarshal(inputStream, descriptions = JAXB.unmarshal(inputStream,
NetcdfGridProductDescriptions.class); NetcdfGridProductDescriptions.class);
this.descriptionsList.add(descriptions); this.descriptionsList.add(descriptions);
} catch (LocalizationException | IOException e) { } catch (LocalizationException | IOException e) {
logger.error("Unable to load product descriptions from {}", logger.error("Unable to load product descriptions from {}",
file.getName(), e); file.getPath(), e);
} }
} }

View file

@ -60,6 +60,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* in case they were written by another member of the cluster. * in case they were written by another member of the cluster.
* Mar 12, 2013 1646 mpduff Format the output. * Mar 12, 2013 1646 mpduff Format the output.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile method call
* *
* </pre> * </pre>
* *
@ -113,7 +114,7 @@ class FileManager {
LocalizationContext context = pm.getContext( LocalizationContext context = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile locFile = pm LocalizationFile locFile = pm
.getLocalizationFile(context, lf.getName()); .getLocalizationFile(context, lf.getPath());
try { try {
JAXBManager jaxbManager = getJaxbManager(); JAXBManager jaxbManager = getJaxbManager();
Marshaller marshaller = jaxbManager.getJaxbContext() Marshaller marshaller = jaxbManager.getJaxbContext()

View file

@ -28,6 +28,8 @@ import com.raytheon.uf.edex.auth.roles.IRoleStorage;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 25, 2010 rgeorge Initial creation * May 25, 2010 rgeorge Initial creation
* Oct 09, 2013 2361 njensen Use JAXBManager for XML * Oct 09, 2013 2361 njensen Use JAXBManager for XML
* Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile
* method calls
* *
* </pre> * </pre>
* *
@ -86,15 +88,15 @@ public class NwsRoleStorage implements IRoleStorage {
if (locFile.exists()) { if (locFile.exists()) {
file = locFile.getFile(); file = locFile.getFile();
if (lastUsedFileMap.get(locFile.getName()) == null if (lastUsedFileMap.get(locFile.getPath()) == null
|| (file != null && (file.equals(lastUsedFileMap || (file != null && (file.equals(lastUsedFileMap
.get(locFile.getName())) == false || file .get(locFile.getPath())) == false || file
.lastModified() > lastModificationTimeMap .lastModified() > lastModificationTimeMap
.get(locFile.getName())))) { .get(locFile.getPath())))) {
// First time we found a role file, or we have a different // First time we found a role file, or we have a different
// file to // file to
// use or we were modified since our last check // use or we were modified since our last check
lastUsedFileMap.put(locFile.getName(), file); lastUsedFileMap.put(locFile.getPath(), file);
try { try {
roleData = jaxb.unmarshalFromXmlFile(file roleData = jaxb.unmarshalFromXmlFile(file
.getAbsolutePath()); .getAbsolutePath());
@ -105,7 +107,7 @@ public class NwsRoleStorage implements IRoleStorage {
"Error loading file: " + file.getName(), e); "Error loading file: " + file.getName(), e);
} }
lastModificationTimeMap.put(locFile.getName(), lastModificationTimeMap.put(locFile.getPath(),
file.lastModified()); file.lastModified());
} }
} }
@ -132,13 +134,6 @@ public class NwsRoleStorage implements IRoleStorage {
return roleData; return roleData;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.plugin.nwsauth.roles.IRoleStorage#isAuthorized
* (java.lang.String, java.lang.String, java.lang.String)
*/
@Override @Override
public boolean isAuthorized(String permission, String user, public boolean isAuthorized(String permission, String user,
String application) throws AuthorizationException { String application) throws AuthorizationException {