karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [37/50] git commit: [KARAF-2286] - Cellar-Cloud: If the configured store contains unknown Blob this causes unpleasant exceptions ---- reverted last changes, don't work no meta information is retrieved from blob, so improved logging instead ...
Date Wed, 18 Dec 2013 12:30:28 GMT
[KARAF-2286] - Cellar-Cloud: If the configured store contains unknown Blob this causes unpleasant
exceptions
----
reverted last changes, don't work no meta information is retrieved from blob, 
so improved logging instead ... 

git-svn-id: https://svn.apache.org/repos/asf/karaf/cellar/branches/cellar-2.2.x@1470442 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/ae925e8a
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/ae925e8a
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/ae925e8a

Branch: refs/heads/cellar-2.2.x
Commit: ae925e8ad4176e48401264dfeae9ca5d3ed1503c
Parents: 0104585
Author: anierbeck <anierbeck@13f79535-47bb-0310-9956-ffa450edef68>
Authored: Mon Apr 22 10:50:28 2013 +0000
Committer: anierbeck <anierbeck@13f79535-47bb-0310-9956-ffa450edef68>
Committed: Mon Apr 22 10:50:28 2013 +0000

----------------------------------------------------------------------
 .../cellar/cloud/BlobStoreDiscoveryService.java | 49 +++++++-------------
 1 file changed, 17 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/ae925e8a/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryService.java
----------------------------------------------------------------------
diff --git a/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryService.java
b/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryService.java
index 169364d..def0b6c 100644
--- a/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryService.java
+++ b/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryService.java
@@ -13,6 +13,17 @@
  */
 package org.apache.karaf.cellar.cloud;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.karaf.cellar.core.discovery.DiscoveryService;
 import org.jclouds.blobstore.BlobStore;
 import org.jclouds.blobstore.BlobStoreContext;
@@ -26,25 +37,9 @@ import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 public class BlobStoreDiscoveryService implements DiscoveryService {
 
     private static final String KARAF_CELLAR = "Karaf-Cellar";
-
-	private static final String APPLICATION_TYPE = "Application-Type";
-	private static final String X_AMZ_META_APPLICATION_TYPE = "x-amz-meta-application-type";
-
 	private static final transient Logger LOGGER = LoggerFactory.getLogger(BlobStoreDiscoveryService.class);
 
     private String provider;
@@ -107,16 +102,11 @@ public class BlobStoreDiscoveryService implements DiscoveryService {
 				continue;
 			}
             String ip = md.getName();
-            Map<String, String> userMetadata = md.getUserMetadata();
-            Object obj = null;
-            //x-amz-meta-application-type
-            if (userMetadata.containsKey(X_AMZ_META_APPLICATION_TYPE) && KARAF_CELLAR.equalsIgnoreCase(userMetadata.get(X_AMZ_META_APPLICATION_TYPE)))
{
-            	obj = readBlob(container, ip);
-            } else {
-            	LOGGER.debug("CELLAR CLOUD: found blob of unknown Application-Type, will be
skipped!");
-            }
-            if (obj == null) 
+            Object obj = readBlob(container, ip);
+            if (obj == null) {
+            	LOGGER.debug("CELLAR CLOUD: no valid object found skipping it");
             	continue;
+            }
             //Check if ip hasn't been updated recently.
             if (obj instanceof DateTime) {
             	LOGGER.debug("CELLAR CLOUD: retrieved a DateTime from blog store");
@@ -190,9 +180,9 @@ public class BlobStoreDiscoveryService implements DiscoveryService {
             ois = new ObjectInputStream(is);
             result = ois.readObject();
         } catch (IOException e) {
-            LOGGER.error("CELLAR CLOUD: failed to read blob", e);
+            LOGGER.warn("CELLAR CLOUD: failed to read blob", e);
         } catch (ClassNotFoundException e) {
-            LOGGER.error("CELLAR CLOUD: failed to read blob", e);
+            LOGGER.warn("CELLAR CLOUD: failed to read blob", e);
         } finally {
             if (ois != null) {
                 try {
@@ -231,11 +221,6 @@ public class BlobStoreDiscoveryService implements DiscoveryService {
                 oos = new ObjectOutputStream(baos);
                 oos.writeObject(data);
                 blob.setPayload(baos.toByteArray());
-                if (blob.getMetadata().getUserMetadata() == null) {
-                	blob.getMetadata().setUserMetadata(new HashMap<String, String>());
-                }
-                Map<String, String> userMetadata = blob.getMetadata().getUserMetadata();
-                userMetadata.put(APPLICATION_TYPE, KARAF_CELLAR);
                 blobStore.putBlob(container, blob);
             } catch (IOException e) {
                 LOGGER.error("CELLAR CLOUD: failed to write blob", e);


Mime
View raw message