brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [03/50] brooklyn-server git commit: Replace ServiceLoader with FrameworkLookup for LocationResolver.
Date Wed, 30 Mar 2016 13:59:40 GMT
Replace ServiceLoader with FrameworkLookup for LocationResolver.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b60db4c6
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b60db4c6
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b60db4c6

Branch: refs/heads/master
Commit: b60db4c6f4dd5f57e06a962d52e734f361dd7c88
Parents: 98d1b60
Author: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Authored: Tue Mar 8 14:56:22 2016 +0000
Committer: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Committed: Tue Mar 15 14:52:57 2016 +0000

----------------------------------------------------------------------
 .../core/location/BasicLocationRegistry.java    |  4 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 51 ++++++++++++++++++--
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 38 +++++++++++++++
 .../org/apache/brooklyn/cli/ItemLister.java     |  4 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 10 ++--
 5 files changed, 98 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b60db4c6/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
b/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
index 0dc88d0..51a036d 100644
--- a/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
+++ b/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
@@ -27,11 +27,11 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
-import java.util.ServiceLoader;
 import java.util.Set;
 
 import org.apache.brooklyn.api.catalog.BrooklynCatalog;
 import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.framework.FrameworkLookup;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.location.LocationDefinition;
 import org.apache.brooklyn.api.location.LocationRegistry;
@@ -152,7 +152,7 @@ public class BasicLocationRegistry implements LocationRegistry {
     }
 
     protected void findServices() {
-        ServiceLoader<LocationResolver> loader = ServiceLoader.load(LocationResolver.class,
mgmt.getCatalogClassLoader());
+        Iterable<LocationResolver> loader = FrameworkLookup.lookupAll(LocationResolver.class,
mgmt.getCatalogClassLoader());
         MutableList<LocationResolver> loadedResolvers;
         try {
             loadedResolvers = MutableList.copyOf(loader);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b60db4c6/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index c28c155..227aae2 100644
--- a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -46,13 +46,58 @@ limitations under the License.
 
     <bean id="javaEntitySpecResolver" scope="prototype"
              class="org.apache.brooklyn.core.resolve.entity.JavaEntitySpecResolver"/>
-    <bean id="catalogEntitySpecResolver" scope="prototype"
-             class="org.apache.brooklyn.core.resolve.entity.CatalogEntitySpecResolver"/>
-
     <service id="javaEntitySpecResolverService" ref="javaEntitySpecResolver"
              interface="org.apache.brooklyn.core.resolve.entity.EntitySpecResolver" />
+
+    <bean id="catalogEntitySpecResolver" scope="prototype"
+             class="org.apache.brooklyn.core.resolve.entity.CatalogEntitySpecResolver"/>
     <service id="catalogEntitySpecResolverService" ref="catalogEntitySpecResolver"
              interface="org.apache.brooklyn.core.resolve.entity.EntitySpecResolver" />
 
 
+    <bean id="definedLocationByIdResolver" scope="prototype"
+          class="org.apache.brooklyn.core.location.DefinedLocationByIdResolver"/>
+    <service id="definedLocationByIdResolverService" ref="definedLocationByIdResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="namedLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.core.location.NamedLocationResolver" />
+    <service id="namedLocationResolverService" ref="namedLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="catalogLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.core.location.CatalogLocationResolver"/>
+    <service id="catalogLocationResolverService" ref="catalogLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="portForwardManagerLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.core.location.access.PortForwardManagerLocationResolver"/>
+    <service id="portForwardManagerLocationResolverService" ref="portForwardManagerLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="byonLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.byon.ByonLocationResolver" />
+    <service id="byonLocationResolverService" ref="byonLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="singleMachineLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.byon.SingleMachineLocationResolver"/>
+    <service id="singleMachineLocationResolverService" ref="singleMachineLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="hostLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.byon.HostLocationResolver"/>
+    <service id="hostLocationResolverService" ref="hostLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="localhostLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.localhost.LocalhostLocationResolver"/>
+    <service id="localhostLocationResolverService" ref="localhostLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="multiLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.multi.MultiLocationResolver" />
+    <service id="multiLocationResolverService" ref="multiLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
 </blueprint>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b60db4c6/locations/jclouds/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/locations/jclouds/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..96d964f
--- /dev/null
+++ b/locations/jclouds/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2015 The Apache Software Foundation.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"
+           xsi:schemaLocation="
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+             http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             ">
+
+
+    <bean id="jcloudsLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.jclouds.JcloudsLocationResolver"/>
+    <service id="jcloudsLocationResolverService" ref="jcloudsLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+    <bean id="jcloudsByonLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.location.jclouds.JcloudsByonLocationResolver"/>
+    <service id="jcloudsByonLocationResolverService" ref="jcloudsByonLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver"/>
+
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b60db4c6/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java
----------------------------------------------------------------------
diff --git a/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java b/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java
index 7b18fa7..d7eddce 100644
--- a/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java
+++ b/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java
@@ -36,6 +36,7 @@ import org.apache.brooklyn.api.catalog.Catalog;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.api.framework.FrameworkLookup;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.location.LocationResolver;
 import org.apache.brooklyn.api.objs.BrooklynObject;
@@ -216,7 +217,8 @@ public class ItemLister {
                 policies.addAll(ItemDescriptors.toItemDescriptors(getTypes(urls, Policy.class),
headingsOnly, "name"));
                 enrichers.addAll(ItemDescriptors.toItemDescriptors(getTypes(urls, Enricher.class),
headingsOnly, "name"));
                 locations.addAll(ItemDescriptors.toItemDescriptors(getTypes(urls, Location.class,
false), headingsOnly, "type"));
-                locationResolvers.addAll(ItemDescriptors.toItemDescriptors(ImmutableList.copyOf(ServiceLoader.load(LocationResolver.class)),
true));
+                locationResolvers.addAll(ItemDescriptors.toItemDescriptors(
+                    ImmutableList.copyOf(FrameworkLookup.lookupAll(LocationResolver.class)),
true));
             }
             if (!yamlToScan.isEmpty()) {
                 List<URL> urls = getYamlUrls();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b60db4c6/software/base/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/software/base/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/software/base/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index f0d62e1..58c88a2 100644
--- a/software/base/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/software/base/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -25,13 +25,17 @@ limitations under the License.
 
     <bean id="chefEntitySpecResolver" scope="prototype"
              class="org.apache.brooklyn.entity.resolve.ChefEntitySpecResolver"/>
-    <bean id="hardcodedCatalogEntitySpecResolver" scope="prototype"
-             class="org.apache.brooklyn.entity.resolve.HardcodedCatalogEntitySpecResolver"/>
-
     <service id="chefEntitySpecResolverService" ref="chefEntitySpecResolver"
              interface="org.apache.brooklyn.core.resolve.entity.EntitySpecResolver" />
+
+    <bean id="hardcodedCatalogEntitySpecResolver" scope="prototype"
+             class="org.apache.brooklyn.entity.resolve.HardcodedCatalogEntitySpecResolver"/>
     <service id="hardcodedCatalogEntitySpecResolverService" ref="hardcodedCatalogEntitySpecResolver"
              interface="org.apache.brooklyn.core.resolve.entity.EntitySpecResolver" />
 
+    <bean id="serverPoolLocationResolver" scope="prototype"
+          class="org.apache.brooklyn.entity.machine.pool.ServerPoolLocationResolver"/>
+    <service id="serverPoolLocationResolverService" ref="serverPoolLocationResolver"
+             interface="org.apache.brooklyn.api.location.LocationResolver" />
 
 </blueprint>


Mime
View raw message