From 147144e64ff411dfac4b314f34b485bf91a0020a Mon Sep 17 00:00:00 2001 From: Tom Gurney Date: Wed, 27 Jan 2016 16:51:03 -0600 Subject: [PATCH] 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 --- .../filter/LightningGeoFilter.java | 38 ++++++------------ .../gfe/paraminfo/GridParamInfoLookup.java | 4 +- .../plugin/gfe/reference/ReferenceMgr.java | 9 ++--- .../edex/plugin/gfe/watch/TPCWatchSrv.java | 29 +++----------- .../radar/util/Import88DLocationsUtil.java | 4 +- .../plugin/cwat/common/LocationCache.java | 6 ++- .../uf/edex/plugin/ffmp/FFMPGenerator.java | 15 +++---- .../plugin/grid/netcdf/NetcdfGridDecoder.java | 40 ++++++++++--------- .../uf/edex/plugin/nwsauth/FileManager.java | 3 +- .../edex/plugin/nwsauth/NwsRoleStorage.java | 19 ++++----- 10 files changed, 69 insertions(+), 98 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/filter/LightningGeoFilter.java b/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/filter/LightningGeoFilter.java index 7178852501..9d8f46b6a5 100644 --- a/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/filter/LightningGeoFilter.java +++ b/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/filter/LightningGeoFilter.java @@ -31,6 +31,7 @@ import javax.xml.bind.JAXBException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; 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.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationFile; @@ -51,9 +52,11 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometry; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- * Jun 10, 2014 3226 bclement Initial creation + * Jan 27, 2016 5237 tgurney Replace LocalizationFile with + * ILocalizationFile * * * @@ -92,11 +95,11 @@ public class LightningGeoFilter { LOCALIZATION_FILTER_DIR, new String[] { ".xml" }, true, true); - for (LocalizationFile file : files) { + for (ILocalizationFile file : files) { Collection filters = getFilterGeometries(file); if (!filters.isEmpty()) { String bareName = getFileNameWithoutExtension(file - .getName()); + .getPath()); geometryMap.put(bareName.toLowerCase(), filters); } } @@ -112,11 +115,9 @@ public class LightningGeoFilter { * @return empty list on error */ private static Collection getFilterGeometries( - LocalizationFile file) { + ILocalizationFile file) { Collection rval; - InputStream in = null; - try { - in = file.openInputStream(); + try (InputStream in = file.openInputStream()) { GeoFilterResult result = GeoFilterParser.parse(in); if (result.hasErrors()) { for (GeoFilterException e : result.getErrors()) { @@ -125,25 +126,10 @@ public class LightningGeoFilter { log.warn("Filter parsing included errors, filters will be incomplete"); } return result.getFilters(); - } catch (JAXBException e) { - log.error("Unable to parse filter file: " + file.getName(), e); + } catch (IOException | JAXBException | LocalizationException + | SerializationException e) { + log.error("Unable to parse filter file: " + file.getPath(), e); 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; } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/paraminfo/GridParamInfoLookup.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/paraminfo/GridParamInfoLookup.java index 35314e444e..c4f048ae20 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/paraminfo/GridParamInfoLookup.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/paraminfo/GridParamInfoLookup.java @@ -61,6 +61,8 @@ import com.raytheon.uf.common.util.mapping.MultipleMappingException; * Oct 14, 2013 2473 bsteffen Remove lookup of deprecated grib files. * Jun 05, 2015 4495 njensen Improved error message * Jul 13, 2015 4537 randerso Removed unused function + * Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile + * method call * * * @@ -190,7 +192,7 @@ public class GridParamInfoLookup { } catch (JAXBException e) { statusHandler.handle(Priority.PROBLEM, "Error unmarshalling grid parameter information from file " - + file.getName(), e); + + file.getPath(), e); } } for (GridParamInfo gridParamInfo : modelParamMap.values()) { diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/ReferenceMgr.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/ReferenceMgr.java index eb69d259a5..55dc65acdb 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/ReferenceMgr.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/ReferenceMgr.java @@ -57,6 +57,8 @@ import com.raytheon.uf.common.util.FileUtil; * Feb 19, 2015 4125 rjpeter Fix jaxb performance issue * Apr 10, 2015 4383 dgilling Fix getData so it searches correct localization * directories for secondary sites. + * Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile + * method call * * * @@ -93,7 +95,7 @@ public class ReferenceMgr { new String[] { ".xml" }, false, true); if (contents != null) { for (LocalizationFile lf : contents) { - String s = LocalizationUtil.extractName(lf.getName()); + String s = LocalizationUtil.extractName(lf.getPath()); String area = s.replace(".xml", ""); refIDs.add(new ReferenceID(area, lf.isProtected(), lf .getContext().getLocalizationLevel())); @@ -163,11 +165,6 @@ public class ReferenceMgr { return sr; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { return "ReferenceMgr [" + dbGridLocation.getSiteId() + "]"; diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java index 7ccb41d014..209d72a3f8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java @@ -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.warning.AbstractWarningRecord; 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.LocalizationContext; 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 * VTEC partners * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException + * Jan 27, 2016 5237 tgurney Replace LocalizationFile with ILocalizationFile * * * @@ -129,11 +131,6 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { private static final ThreadLocal pythonScript = new ThreadLocal() { - /* - * (non-Javadoc) - * - * @see java.lang.ThreadLocal#initialValue() - */ @Override protected PythonScript initialValue() { IPathManager pathMgr = PathManagerFactory.getPathManager(); @@ -172,13 +169,6 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { super(TPC_WATCH_TYPE); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.edex.plugin.gfe.watch.AbstractWatchNotifierSrv#handleWatch - * (java.util.List) - */ @Override public void handleWatch(List warningRecs) { /* @@ -439,7 +429,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { return practiceMode ? PRACTICE_PATH : TCV_ADVISORY_PATH; } - private Map loadJSONDictionary(LocalizationFile lf) { + private Map loadJSONDictionary(ILocalizationFile lf) { if (lf != null) { PythonScript script = this.pythonScript.get(); if (script != null) { @@ -447,7 +437,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { args.put("localizationType", lf.getContext() .getLocalizationType()); args.put("siteID", lf.getContext().getContextName()); - args.put("fileName", lf.getName()); + args.put("fileName", lf.getPath()); try { @SuppressWarnings("unchecked") Map retVal = (Map) script @@ -463,7 +453,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { return null; } - private void saveJSONDictionary(LocalizationFile lf, + private void saveJSONDictionary(ILocalizationFile lf, Map dict) { if (lf != null) { PythonScript script = this.pythonScript.get(); @@ -472,7 +462,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv { args.put("localizationType", lf.getContext() .getLocalizationType()); args.put("siteID", lf.getContext().getContextName()); - args.put("fileName", lf.getName()); + args.put("fileName", lf.getPath()); args.put("javaObject", dict); try { 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 protected String buildNotification(List decodedVTEC, VTECPartners partnersConfig) { diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java index fa906442a9..19f6bad9c4 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java @@ -43,6 +43,8 @@ import com.vividsolutions.jts.io.WKTReader; * 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations. * Mar 06, 2014 2876 mpduff Moved NationalDatasetSubscriber. * Jul 09, 2015 4500 rjpeter Fix SQL Injection concern. + * Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile + * method call * */ public class Import88DLocationsUtil implements INationalDatasetSubscriber { @@ -166,7 +168,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber { statusHandler.handle( Priority.PROBLEM, "Could not create output file: " - + outFile.getName(), e); + + outFile.getPath(), e); } } finally { if (fis != null) { diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/LocationCache.java b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/LocationCache.java index d855f9d4b5..01490e874a 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/LocationCache.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/LocationCache.java @@ -61,6 +61,8 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * Nov 17, 2010 rjpeter Initial creation * Aug 26, 2014 3503 bclement removed warning + * Jan 27, 2016 5237 tgurney Remove deprecated LocalizationFile + * method call * * * @@ -214,7 +216,7 @@ public class LocationCache { handler.handle( Priority.WARN, "Error deleting cwat location file [" - + localizationFile.getName() + "], " + + localizationFile.getPath() + "], " + e2.getMessage()); } } finally { @@ -239,7 +241,7 @@ public class LocationCache { location.setLastModifiyTime(file.lastModified()); } catch (Exception e) { handler.handle(Priority.ERROR, "Error saving cwat location file [" - + locationFile.getName() + "], Error: " + e.getMessage()); + + locationFile.getPath() + "], Error: " + e.getMessage()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java index 63dcc2b6fd..63059358f4 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java @@ -142,6 +142,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff; * Sep 09, 2015 4756 dhladky Further generalization of FFG processing. * Sep 21, 2015 4756 dhladky Allow ARCHIVE types to not be purged out. * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException + * Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile method calls * * * @@ -998,13 +999,13 @@ public class FFMPGenerator extends CompositeProductGenerator implements FileUtil.file2bytes(f.getFile(), true)); } catch (FileNotFoundException fnfe) { statusHandler.handle(Priority.ERROR, - "Unable to locate file " + f.getName()); + "Unable to locate file " + f.getPath()); } catch (SerializationException se) { statusHandler.handle(Priority.ERROR, - "Unable to read file " + f.getName()); + "Unable to read file " + f.getPath()); } catch (IOException ioe) { statusHandler.handle(Priority.ERROR, - "General IO problem with file " + f.getName(), ioe); + "General IO problem with file " + f.getPath(), ioe); } return sbl; @@ -1747,16 +1748,16 @@ public class FFMPGenerator extends CompositeProductGenerator implements FileUtil.file2bytes(f.getFile(), true)); } catch (FileNotFoundException fnfe) { statusHandler.handle(Priority.ERROR, - "Unable to locate file " + f.getName(), fnfe); + "Unable to locate file " + f.getPath(), fnfe); } catch (SerializationException se) { statusHandler.handle(Priority.ERROR, "Unable to serialize file " - + f.getName(), se); + + f.getPath(), se); } catch (IOException ioe) { statusHandler.handle(Priority.ERROR, - "IO problem reading file " + f.getName(), ioe); + "IO problem reading file " + f.getPath(), ioe); } catch (Exception e) { statusHandler.handle(Priority.ERROR, - "General Exception reading file " + f.getName(), e); + "General Exception reading file " + f.getPath(), e); } return ffti; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grid.netcdf/src/com/raytheon/uf/edex/plugin/grid/netcdf/NetcdfGridDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.grid.netcdf/src/com/raytheon/uf/edex/plugin/grid/netcdf/NetcdfGridDecoder.java index 05e5908ca1..09b1affbcd 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grid.netcdf/src/com/raytheon/uf/edex/plugin/grid/netcdf/NetcdfGridDecoder.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.grid.netcdf/src/com/raytheon/uf/edex/plugin/grid/netcdf/NetcdfGridDecoder.java @@ -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.LevelFactory; 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.LocalizationFile; import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.parameter.Parameter; import com.raytheon.uf.common.serialization.SerializationException; @@ -61,18 +61,20 @@ import com.raytheon.uf.edex.plugin.grid.netcdf.description.product.NetcdfGridPro /** * Base class for decoding NetCDF Grid files. - * + * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 03, 2015 4696       nabowle     Initial creation
  * Sep 10, 2015 4696       nabowle     Refactored. Renamed. No longer abstract.
- *
+ * Jan 27, 2016 5237       tgurney     Replace LocalizationFile with
+ *                                     ILocalizationFile
+ * 
  * 
- * + * * @author nabowle * @version 1.0 */ @@ -96,10 +98,10 @@ public class NetcdfGridDecoder { * Decodes the provided file. Note: This will like be memory intensive. If * the files are expected to create many records, it's better to split the * file, and decode and store records individually. - * + * * This method will decode all the records together and return them for * batch storage. - * + * * @param f * The data file. * @return The decoded grid records, or an empty array if no records could @@ -150,8 +152,8 @@ public class NetcdfGridDecoder { Variable dataVar = file.findVariable(product.getData().getName()); if (dataVar == null) { logger.error("No {} {} data in file: {}", descriptions - .getDatasetId(), product.getData().getName(), - f.getName()); + .getDatasetId(), product.getData().getName(), f + .getName()); return EMPTY_RECORDS; } @@ -268,7 +270,7 @@ public class NetcdfGridDecoder { /** * Does some preliminary decoding of common values and combines those with * the level index and a product description to specify individual records. - * + * * @param f * The file to split. * @return An iterator over the record descriptions. @@ -299,8 +301,7 @@ public class NetcdfGridDecoder { DataTime dataTime = descriptions.getDataTime().getDataTime(file); if (dataTime == null) { - throw new NetcdfDecoderException( - "Cannot decode the data time."); + throw new NetcdfDecoderException("Cannot decode the data time."); } GridCoverage location = getCoverage(file, descriptions); @@ -323,7 +324,8 @@ public class NetcdfGridDecoder { } NetcdfGridRecordInfo info; - for (NetcdfGridProductDescription prod : descriptions.getDescriptions()) { + for (NetcdfGridProductDescription prod : descriptions + .getDescriptions()) { for (int i = 0; i < numLevels; i++) { info = new NetcdfGridRecordInfo(); info.setDataTime(dataTime); @@ -399,25 +401,25 @@ public class NetcdfGridDecoder { /** * The {@link IPathManager} is used to look up the configured description * file. - * + * * @throws JAXBException * @throws SerializationException */ public void setPathManager(IPathManager pathManager) { - LocalizationFile[] files = pathManager.listStaticFiles("grid/netcdf", + ILocalizationFile[] files = pathManager.listStaticFiles("grid/netcdf", new String[] { ".xml" }, true, true); NetcdfGridProductDescriptions descriptions; - for (LocalizationFile file : files) { + for (ILocalizationFile file : files) { logger.info("Loading Netcdf Grid description from " - + file.getName()); + + file.getPath()); try (InputStream inputStream = file.openInputStream()) { descriptions = JAXB.unmarshal(inputStream, NetcdfGridProductDescriptions.class); this.descriptionsList.add(descriptions); } catch (LocalizationException | IOException e) { logger.error("Unable to load product descriptions from {}", - file.getName(), e); + file.getPath(), e); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/FileManager.java b/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/FileManager.java index ea2fcfeacd..d91a94c491 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/FileManager.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/FileManager.java @@ -60,6 +60,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; * in case they were written by another member of the cluster. * Mar 12, 2013 1646 mpduff Format the output. * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException + * Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile method call * * * @@ -113,7 +114,7 @@ class FileManager { LocalizationContext context = pm.getContext( LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); LocalizationFile locFile = pm - .getLocalizationFile(context, lf.getName()); + .getLocalizationFile(context, lf.getPath()); try { JAXBManager jaxbManager = getJaxbManager(); Marshaller marshaller = jaxbManager.getJaxbContext() diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/NwsRoleStorage.java b/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/NwsRoleStorage.java index 567b498d41..c91377e226 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/NwsRoleStorage.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/src/com/raytheon/uf/edex/plugin/nwsauth/NwsRoleStorage.java @@ -28,6 +28,8 @@ import com.raytheon.uf.edex.auth.roles.IRoleStorage; * ------------ ---------- ----------- -------------------------- * May 25, 2010 rgeorge Initial creation * Oct 09, 2013 2361 njensen Use JAXBManager for XML + * Jan 27, 2016 5237 tgurney Replace deprecated LocalizationFile + * method calls * * * @@ -86,15 +88,15 @@ public class NwsRoleStorage implements IRoleStorage { if (locFile.exists()) { file = locFile.getFile(); - if (lastUsedFileMap.get(locFile.getName()) == null + if (lastUsedFileMap.get(locFile.getPath()) == null || (file != null && (file.equals(lastUsedFileMap - .get(locFile.getName())) == false || file + .get(locFile.getPath())) == false || file .lastModified() > lastModificationTimeMap - .get(locFile.getName())))) { + .get(locFile.getPath())))) { // First time we found a role file, or we have a different // file to // use or we were modified since our last check - lastUsedFileMap.put(locFile.getName(), file); + lastUsedFileMap.put(locFile.getPath(), file); try { roleData = jaxb.unmarshalFromXmlFile(file .getAbsolutePath()); @@ -105,7 +107,7 @@ public class NwsRoleStorage implements IRoleStorage { "Error loading file: " + file.getName(), e); } - lastModificationTimeMap.put(locFile.getName(), + lastModificationTimeMap.put(locFile.getPath(), file.lastModified()); } } @@ -132,13 +134,6 @@ public class NwsRoleStorage implements IRoleStorage { return roleData; } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.common.plugin.nwsauth.roles.IRoleStorage#isAuthorized - * (java.lang.String, java.lang.String, java.lang.String) - */ @Override public boolean isAuthorized(String permission, String user, String application) throws AuthorizationException {