Repository: brooklyn-server Updated Branches: refs/heads/master b539b110e -> 955754019
Fixed BlobStoreContextFactoryImpl. It can now have dsl in its config Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5d0d9925 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5d0d9925 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5d0d9925 Branch: refs/heads/master Commit: 5d0d9925cc338391e528304710467de467f6a642 Parents: 1599d7a Author: graeme.miller <[email protected]> Authored: Fri Mar 31 16:12:53 2017 +0100 Committer: graeme.miller <[email protected]> Committed: Fri Mar 31 16:12:53 2017 +0100 ---------------------------------------------------------------------- .../command/support/CloudExplorerSupport.java | 2 +- .../JcloudsBlobStoreBasedObjectStore.java | 2 +- .../jclouds/BlobStoreContextFactory.java | 3 ++- .../jclouds/BlobStoreContextFactoryImpl.java | 13 ++++++----- .../brooklyn/location/jclouds/JcloudsUtil.java | 24 -------------------- .../persist/jclouds/BlobStoreExpiryTest.java | 4 ++-- .../mgmt/persist/jclouds/BlobStoreTest.java | 2 +- .../jclouds/JcloudsExpect100ContinueTest.java | 2 +- 8 files changed, 15 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/launcher-common/src/main/java/org/apache/brooklyn/launcher/command/support/CloudExplorerSupport.java ---------------------------------------------------------------------- diff --git a/launcher-common/src/main/java/org/apache/brooklyn/launcher/command/support/CloudExplorerSupport.java b/launcher-common/src/main/java/org/apache/brooklyn/launcher/command/support/CloudExplorerSupport.java index 544ad92..fc19814 100644 --- a/launcher-common/src/main/java/org/apache/brooklyn/launcher/command/support/CloudExplorerSupport.java +++ b/launcher-common/src/main/java/org/apache/brooklyn/launcher/command/support/CloudExplorerSupport.java @@ -329,7 +329,7 @@ public abstract class CloudExplorerSupport implements Callable<Void> { @Override protected void doCall(JcloudsLocation loc, String indent) throws Exception { - BlobStoreContext context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(loc.config().getBag()); + BlobStoreContext context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(loc); try { org.jclouds.blobstore.BlobStore blobStore = context.getBlobStore(); doCall(blobStore, indent); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/main/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsBlobStoreBasedObjectStore.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsBlobStoreBasedObjectStore.java b/locations/jclouds/src/main/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsBlobStoreBasedObjectStore.java index c679dc5..a6ba3ea 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsBlobStoreBasedObjectStore.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsBlobStoreBasedObjectStore.java @@ -93,7 +93,7 @@ public class JcloudsBlobStoreBasedObjectStore implements PersistenceObjectStore location = (JcloudsLocation) mgmt.getLocationRegistry().getLocationManaged(locationSpec); } - context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location.config().getBag()); + context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location); // TODO do we need to get location from region? can't see the jclouds API. // doesn't matter in some places because it's already in the endpoint http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactory.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactory.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactory.java index 0a2dd26..91b9949 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactory.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactory.java @@ -18,6 +18,7 @@ */ package org.apache.brooklyn.location.jclouds; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.util.core.config.ConfigBag; import org.jclouds.blobstore.BlobStoreContext; @@ -33,5 +34,5 @@ public interface BlobStoreContextFactory { // // However, for now we have just kept the separation of interface and implementation. - public BlobStoreContext newBlobStoreContext(ConfigBag conf); + BlobStoreContext newBlobStoreContext(Location location); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactoryImpl.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactoryImpl.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactoryImpl.java index 94f6110..4885935 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactoryImpl.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BlobStoreContextFactoryImpl.java @@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.util.Map; import java.util.Properties; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.core.config.Sanitizer; import org.apache.brooklyn.core.location.LocationConfigKeys; import org.apache.brooklyn.core.location.cloud.CloudLocationConfig; @@ -68,12 +69,12 @@ public class BlobStoreContextFactoryImpl implements BlobStoreContextFactory { } @Override - public BlobStoreContext newBlobStoreContext(ConfigBag conf) { - String rawProvider = checkNotNull(conf.get(LocationConfigKeys.CLOUD_PROVIDER), "provider must not be null"); + public BlobStoreContext newBlobStoreContext(Location location) { + String rawProvider = checkNotNull(location.getConfig(LocationConfigKeys.CLOUD_PROVIDER), "provider must not be null"); String provider = DeserializingJcloudsRenamesProvider.INSTANCE.applyJcloudsRenames(rawProvider); - String identity = checkNotNull(conf.get(LocationConfigKeys.ACCESS_IDENTITY), "identity must not be null"); - String credential = checkNotNull(conf.get(LocationConfigKeys.ACCESS_CREDENTIAL), "credential must not be null"); - String endpoint = conf.get(CloudLocationConfig.CLOUD_ENDPOINT); + String identity = checkNotNull(location.getConfig(LocationConfigKeys.ACCESS_IDENTITY), "identity must not be null"); + String credential = checkNotNull(location.getConfig(LocationConfigKeys.ACCESS_CREDENTIAL), "credential must not be null"); + String endpoint = location.getConfig(CloudLocationConfig.CLOUD_ENDPOINT); Properties overrides = new Properties(); // * Java 7,8 bug workaround - sockets closed by GC break the internal bookkeeping @@ -87,7 +88,7 @@ public class BlobStoreContextFactoryImpl implements BlobStoreContextFactory { overrides.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true"); // Add extra jclouds-specific configuration - Map<String, Object> extra = Maps.filterKeys(conf.getAllConfig(), Predicates.containsPattern("^jclouds\\.")); + Map<String, Object> extra = Maps.filterKeys(location.getAllConfig(true), Predicates.containsPattern("^jclouds\\.")); if (extra.size() > 0) { LOG.debug("Configuring custom jclouds property overrides for {}: {}", provider, Sanitizer.sanitize(extra)); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsUtil.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsUtil.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsUtil.java index 480d0d6..f43dd87 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsUtil.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsUtil.java @@ -261,30 +261,6 @@ public class JcloudsUtil { } /** - * Temporary constructor to address https://issues.apache.org/jira/browse/JCLOUDS-615. - * <p> - * See https://issues.apache.org/jira/browse/BROOKLYN-6 . - * When https://issues.apache.org/jira/browse/JCLOUDS-615 is fixed in the jclouds we use, - * we can remove the useSoftlayerFix argument. - * <p> - * (Marked Beta as that argument will likely be removed.) - * - * @since 0.7.0 - * @deprecated since 0.11.0; instead use BlobStoreContextFactoryImpl.INSTANCE - */ - @Beta - @Deprecated - public static BlobStoreContext newBlobstoreContext(String provider, @Nullable String endpoint, String identity, String credential) { - ConfigBag conf = ConfigBag.newInstance(); - conf.put(LocationConfigKeys.CLOUD_PROVIDER, provider); - conf.put(LocationConfigKeys.ACCESS_IDENTITY, identity); - conf.put(LocationConfigKeys.ACCESS_CREDENTIAL, credential); - conf.put(CloudLocationConfig.CLOUD_ENDPOINT, endpoint); - - return BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(conf); - } - - /** * @deprecated since 0.7 */ @Deprecated http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreExpiryTest.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreExpiryTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreExpiryTest.java index 1ff6930..84ddabe 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreExpiryTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreExpiryTest.java @@ -142,7 +142,7 @@ public class BlobStoreExpiryTest { identity = checkNotNull(location.getConfig(LocationConfigKeys.ACCESS_IDENTITY), "identity must not be null"); credential = checkNotNull(location.getConfig(LocationConfigKeys.ACCESS_CREDENTIAL), "credential must not be null"); endpoint = location.getConfig(CloudLocationConfig.CLOUD_ENDPOINT); - context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location.config().getBag()); + context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location); } @AfterMethod(alwaysRun=true) @@ -207,7 +207,7 @@ public class BlobStoreExpiryTest { } private Set<Service> getServices(Credentials creds) throws Exception { - BlobStoreContext tmpContext = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location.config().getBag()); + BlobStoreContext tmpContext = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location); try { tmpContext.getBlobStore().list(); LoadingCache<Credentials, Access> authCache = getAuthCache(tmpContext); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreTest.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreTest.java index cd9ef0c..6fb2f37 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStoreTest.java @@ -68,7 +68,7 @@ public class BlobStoreTest { testContainerName = CONTAINER_PREFIX+"-"+Identifiers.makeRandomId(8); mgmt = new LocalManagementContextForTests(BrooklynProperties.Factory.newDefault()); location = (JcloudsLocation) mgmt.getLocationRegistry().getLocationManaged(locationSpec); - context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location.config().getBag()); + context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(location); } @AfterMethod(alwaysRun=true) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5d0d9925/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsExpect100ContinueTest.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsExpect100ContinueTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsExpect100ContinueTest.java index ebc3d24..5585254 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsExpect100ContinueTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/JcloudsExpect100ContinueTest.java @@ -61,7 +61,7 @@ public class JcloudsExpect100ContinueTest { mgmt = new LocalManagementContextForTests(BrooklynProperties.Factory.newDefault()); JcloudsLocation jcloudsLocation = (JcloudsLocation) mgmt.getLocationRegistry().getLocationManaged(LOCATION_SPEC); - context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(jcloudsLocation.config().getBag()); + context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(jcloudsLocation); containerName = BlobStoreTest.CONTAINER_PREFIX+"-"+Identifiers.makeRandomId(8); context.getBlobStore().createContainerInLocation(null, containerName);
