diff gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java @ 8203:238fc722f87a

sed 's/logger/log/g' src/**/*.java
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 13:19:22 +0200
parents 63975955ec61
children 5e38e2924c07
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java	Fri Sep 05 12:58:17 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java	Fri Sep 05 13:19:22 2014 +0200
@@ -69,7 +69,7 @@
  */
 public class CollectionHelper {
 
-    private static final Logger logger =
+    private static final Logger log =
         Logger.getLogger(CollectionHelper.class);
 
     public static final String ERROR_ADD_ARTIFACT = "error_add_artifact";
@@ -83,7 +83,7 @@
 
 
     public static Document createAttribute(Collection collection) {
-        logger.debug("CollectionHelper.createAttribute");
+        log.debug("CollectionHelper.createAttribute");
 
         Document doc = XMLUtils.newDocument();
 
@@ -127,14 +127,14 @@
         Collection              c,
         Map<String, OutputMode> mmodes)
     {
-        logger.debug("CollectionHelper.createOutputElements");
+        log.debug("CollectionHelper.createOutputElements");
 
         java.util.Collection<OutputMode> modes = mmodes != null
             ? mmodes.values()
             : null;
 
         if (modes == null || modes.size() == 0) {
-            logger.debug("Collection has no modes: " + c.identifier());
+            log.debug("Collection has no modes: " + c.identifier());
             return null;
         }
 
@@ -166,7 +166,7 @@
         Collection     collection,
         OutputMode     mode)
     {
-        logger.debug("CollectionHelper.createOutputElement");
+        log.debug("CollectionHelper.createOutputElement");
 
         Element out = cr.create("output");
         cr.addAttr(out, "name", mode.getName(), false);
@@ -175,7 +175,7 @@
         List<Theme> themes  = themeList != null ? themeList.getThemes() : null;
 
         if (themes == null || themes.size() == 0) {
-            logger.debug("No themes for output mode: " + mode.getName());
+            log.debug("No themes for output mode: " + mode.getName());
             return null;
         }
 
@@ -195,7 +195,7 @@
         if (settings == null ||
             settings.getCategories().size() == 0)
         {
-            logger.debug("No settings for output mode: " + mode.getName());
+            log.debug("No settings for output mode: " + mode.getName());
         }
         else {
             Element s = createSettingsElement(settingscr, collection, settings);
@@ -203,7 +203,7 @@
                 out.appendChild(s);
             }
         }
-        logger.info(XMLUtils.toString(out));
+        log.info(XMLUtils.toString(out));
         return out;
     }
 
@@ -262,12 +262,12 @@
         ElementCreator cr,
         Collection     c)
     {
-        logger.debug("CollectionHelper.createRecommendationsElements");
+        log.debug("CollectionHelper.createRecommendationsElements");
 
         List<Recommendation> rs = c.getRecommendations();
 
         if (rs == null || rs.size() == 0) {
-            logger.debug("Collection did not load recommendations: " +
+            log.debug("Collection did not load recommendations: " +
                 c.identifier());
             return null;
         }
@@ -300,7 +300,7 @@
         Collection     c,
         Recommendation r)
     {
-        logger.debug("CollectionHelper.createRecommendationElement");
+        log.debug("CollectionHelper.createRecommendationElement");
 
         Element recommendation = cr.create("recommendation");
         cr.addAttr(recommendation, "factory", r.getFactory(), true);
@@ -318,7 +318,7 @@
         Collection c,
         Settings s)
     {
-        logger.debug("CollectionHelper.createSettingsElement");
+        log.debug("CollectionHelper.createSettingsElement");
         Element settings = cr.create("settings");
 
         List<String> categories = s.getCategories();
@@ -401,14 +401,14 @@
      * @return a Collection with CollectionItems.
      */
     public static Collection parseCollection(Document description) {
-        logger.debug("CollectionHelper.parseCollection");
+        log.debug("CollectionHelper.parseCollection");
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(XMLUtils.toString(description));
+        if (log.isDebugEnabled()) {
+            log.debug(XMLUtils.toString(description));
         }
 
         if (description == null) {
-            logger.warn("The DESCRIBE of the Collection is null!");
+            log.warn("The DESCRIBE of the Collection is null!");
             return null;
         }
 
@@ -428,12 +428,12 @@
             ArtifactNamespaceContext.INSTANCE);
 
         if (uuid.length() == 0) {
-            logger.warn("Found an invalid (zero length uuid) Collection!");
+            log.warn("Found an invalid (zero length uuid) Collection!");
             return null;
         }
 
         if (ttlStr.length() == 0) {
-            logger.warn("Found an invalid Collection (zero length ttl)!");
+            log.warn("Found an invalid Collection (zero length ttl)!");
             return null;
         }
 
@@ -461,7 +461,7 @@
             ArtifactNamespaceContext.INSTANCE);
 
         if (items == null || items.getLength() == 0) {
-            logger.debug("No collection item found for this collection.");
+            log.debug("No collection item found for this collection.");
 
             return c;
         }
@@ -484,7 +484,7 @@
 
         Map<String, Settings> outSettings = parseSettings(description);
         c.setSettings(outSettings);
-        logger.debug(
+        log.debug(
             "Found " + c.getItemLength() + " collection items " +
             "for the Collection '" + c.identifier() + "'.");
 
@@ -499,7 +499,7 @@
     protected static Map<String, ThemeList> parseThemeLists(
         Document desc, Map<String, CollectionItem> collectionItems
     ) {
-        logger.debug("CollectionHelper.parseThemeLists");
+        log.debug("CollectionHelper.parseThemeLists");
 
         NodeList lists = (NodeList) XMLUtils.xpath(
             desc,
@@ -538,7 +538,7 @@
     protected static ThemeList parseThemeList(
         Element node, Map<String, CollectionItem> collectionItems
     ) {
-        logger.debug("CollectionHelper.parseThemeList");
+        log.debug("CollectionHelper.parseThemeList");
 
         NodeList themes = node.getElementsByTagNameNS(
             ArtifactNamespaceContext.NAMESPACE_URI,
@@ -562,7 +562,7 @@
 
 
     protected static Theme parseTheme(Element ele) {
-        logger.debug("CollectionHelper.parseTheme");
+        log.debug("CollectionHelper.parseTheme");
 
         String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
@@ -593,7 +593,7 @@
      * @return Map containing the settings.
      */
     protected static Map<String, Settings> parseSettings(Document description) {
-        logger.info("parseSettings");
+        log.info("parseSettings");
 
         NodeList lists = (NodeList) XMLUtils.xpath(
             description,
@@ -733,10 +733,10 @@
         Element node,
         boolean outs
     ) {
-        logger.debug("CollectionHelper.parseCollectionItem");
+        log.debug("CollectionHelper.parseCollectionItem");
 
         if (node == null) {
-            logger.debug("The node for parsing CollectionItem is null!");
+            log.debug("The node for parsing CollectionItem is null!");
             return null;
         }
 
@@ -746,7 +746,7 @@
         String hash = node.getAttributeNS(uri, "hash");
 
         if (uuid == null || uuid.length() == 0) {
-            logger.warn("Found an invalid CollectionItem!");
+            log.warn("Found an invalid CollectionItem!");
             return null;
         }
 
@@ -786,10 +786,10 @@
      * @return a list of OutputModes.
      */
     protected static List<OutputMode> parseOutputModes(Element node) {
-        logger.debug("CollectionHelper.parseOutputModes");
+        log.debug("CollectionHelper.parseOutputModes");
 
         if (node == null) {
-            logger.debug("The node for parsing OutputModes is null!");
+            log.debug("The node for parsing OutputModes is null!");
             return null;
         }
 
@@ -800,7 +800,7 @@
         int size = list.getLength();
 
         if (size == 0) {
-            logger.debug("No outputmode nodes found!");
+            log.debug("No outputmode nodes found!");
             return null;
         }
 
@@ -815,7 +815,7 @@
             String type = tmp.getAttributeNS(uri, "type");
 
             if (name.length() == 0) {
-                logger.warn("Found an invalid output mode.");
+                log.warn("Found an invalid output mode.");
                 continue;
             }
 
@@ -838,7 +838,7 @@
                 outmode = new OverviewMode(name, desc, mime, fs, type);
             }
             else {
-                logger.warn("Broken Output mode without type found.");
+                log.warn("Broken Output mode without type found.");
                 continue;
             }
 
@@ -853,10 +853,10 @@
      * Create a Key/Value map for data nodes of artifact/collectionitem.
      */
     protected static HashMap<String, String> parseDataItems(Element node) {
-        logger.debug("CollectionHelper.parseDataItems");
+        log.debug("CollectionHelper.parseDataItems");
 
         if (node == null) {
-            logger.debug("The node for parsing DataItems is null!");
+            log.debug("The node for parsing DataItems is null!");
             return null;
         }
 
@@ -867,7 +867,7 @@
         int size = list.getLength();
 
         if (size == 0) {
-            logger.debug("No static data-item nodes found!");
+            log.debug("No static data-item nodes found!");
         }
 
         HashMap<String, String> data = new HashMap<String, String>(size*2);
@@ -878,7 +878,7 @@
             String key = tmp.getAttributeNS(uri, "name");
 
             if (key.length() == 0) {
-                logger.warn("Found an invalid data item mode.");
+                log.warn("Found an invalid data item mode.");
                 continue;
             }
 
@@ -887,7 +887,7 @@
 
             Element item = (Element) valueNodes.item(0);
             String value = item.getAttributeNS(uri, "value");
-            logger.debug("Found a data item " + key + " : " + value);
+            log.debug("Found a data item " + key + " : " + value);
 
             data.put(key, value);
         }
@@ -899,7 +899,7 @@
         size = list.getLength();
 
         if (size == 0) {
-            logger.debug("No dynamic data-item nodes found!");
+            log.debug("No dynamic data-item nodes found!");
         }
 
         for (int i = 0; i < size; i++) {
@@ -908,18 +908,18 @@
             String key = tmp.getAttributeNS(uri, "name");
 
             if (key.length() == 0) {
-                logger.warn("Found an invalid data item node (missing key).");
+                log.warn("Found an invalid data item node (missing key).");
                 continue;
             }
 
             String value = tmp.getAttributeNS(uri, "defaultValue");
 
             if (value.length() == 0) {
-                logger.warn("Found an invalid data item node (missing value).");
+                log.warn("Found an invalid data item node (missing value).");
                 continue;
             }
 
-            logger.debug("Found a (dyn) data item " + key + " : " + value);
+            log.debug("Found a (dyn) data item " + key + " : " + value);
 
             data.put(key, value);
         }
@@ -928,7 +928,7 @@
     }
 
     protected static List<Facet> extractFacets(Element outmode) {
-        logger.debug("CollectionHelper - extractFacets()");
+        log.debug("CollectionHelper - extractFacets()");
 
         NodeList facetList = (NodeList) XMLUtils.xpath(
             outmode,
@@ -959,7 +959,7 @@
 
 
     public static List<Recommendation> parseRecommendations(Document doc) {
-        logger.debug("CollectionHelper.parseRecommendations");
+        log.debug("CollectionHelper.parseRecommendations");
 
         NodeList list = (NodeList) XMLUtils.xpath(
             doc,
@@ -1000,10 +1000,10 @@
         String     locale)
     throws ServerException
     {
-        logger.debug("CollectionHelper.addArtifact");
+        log.debug("CollectionHelper.addArtifact");
 
         if (collection == null) {
-            logger.warn("The given Collection is null!");
+            log.warn("The given Collection is null!");
             return null;
         }
 
@@ -1013,12 +1013,12 @@
         HttpClient client = new HttpClientImpl(url, locale);
 
         try {
-            logger.debug("Do HTTP request now.");
+            log.debug("Do HTTP request now.");
 
             Document response = (Document) client.doCollectionAction(
                 add, collection.identifier(), new DocumentResponseHandler());
 
-            logger.debug(
+            log.debug(
                 "Finished HTTP request successfully. Parse Collection now.");
 
             Collection c = CollectionHelper.parseCollection(response);
@@ -1030,10 +1030,10 @@
             return c;
         }
         catch (ConnectionException ce) {
-            logger.error(ce, ce);
+            log.error(ce, ce);
         }
         catch (Exception e) {
-            logger.error(e, e);
+            log.error(e, e);
         }
 
         throw new ServerException(ERROR_ADD_ARTIFACT);
@@ -1052,10 +1052,10 @@
         String     locale)
     throws ServerException
     {
-        logger.debug("CollectionHelper.removeArtifact");
+        log.debug("CollectionHelper.removeArtifact");
 
         if (collection == null) {
-            logger.warn("The given Collection is null!");
+            log.warn("The given Collection is null!");
             return null;
         }
 
@@ -1065,14 +1065,14 @@
         HttpClient client = new HttpClientImpl(url, locale);
 
         try {
-            logger.debug("Do HTTP request now.");
+            log.debug("Do HTTP request now.");
 
             Document response = (Document) client.doCollectionAction(
                 remove, collection.identifier(), new DocumentResponseHandler());
 
-            logger.debug(
+            log.debug(
                 "Finished HTTP request successfully. Parse Collection now.");
-            logger.debug(XMLUtils.toString(response));
+            log.debug(XMLUtils.toString(response));
 
             Collection c = CollectionHelper.parseCollection(response);
 
@@ -1083,10 +1083,10 @@
             return c;
         }
         catch (ConnectionException ce) {
-            logger.error(ce, ce);
+            log.error(ce, ce);
         }
         catch (Exception e) {
-            logger.error(e, e);
+            log.error(e, e);
         }
         throw new ServerException(ERROR_REMOVE_ARTIFACT);
     }

http://dive4elements.wald.intevation.org