You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2019/01/16 16:40:31 UTC
[brooklyn-server] 19/31: Extract RegisteredTypesSupplier to outer
class
This is an automated email from the ASF dual-hosted git repository.
aledsage pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 7328d9f7005be178170721d566e6073858939972
Author: Paul Campbell <pc...@kemitix.net>
AuthorDate: Wed Oct 24 10:38:03 2018 +0100
Extract RegisteredTypesSupplier to outer class
Will be required in the CatalogUpgradeScanner that is about to be extracted.
---
.../catalog/internal/CatalogInitialization.java | 16 ---------
.../catalog/internal/RegisteredTypesSupplier.java | 38 ++++++++++++++++++++++
2 files changed, 38 insertions(+), 16 deletions(-)
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
index da7f1f6..4588119 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
@@ -75,9 +75,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Predicate;
import com.google.common.base.Stopwatch;
-import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -647,20 +645,6 @@ public class CatalogInitialization implements ManagementContextInjectable {
}
}
- private static class RegisteredTypesSupplier implements Supplier<Iterable<RegisteredType>> {
- private final ManagementContext mgmt;
- private final Predicate<? super RegisteredType> filter;
-
- RegisteredTypesSupplier(ManagementContext mgmt, Predicate<? super RegisteredType> predicate) {
- this.mgmt = mgmt;
- this.filter = predicate;
- }
- @Override
- public Iterable<RegisteredType> get() {
- return mgmt.getTypeRegistry().getMatching(filter);
- }
- }
-
public interface RebindLogger {
void debug(String message, Object... args);
void info(String message, Object... args);
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/RegisteredTypesSupplier.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/RegisteredTypesSupplier.java
new file mode 100644
index 0000000..5c32164
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/RegisteredTypesSupplier.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.catalog.internal;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.api.typereg.RegisteredType;
+
+class RegisteredTypesSupplier implements Supplier<Iterable<RegisteredType>> {
+ private final ManagementContext mgmt;
+ private final Predicate<? super RegisteredType> filter;
+
+ RegisteredTypesSupplier(ManagementContext mgmt, Predicate<? super RegisteredType> predicate) {
+ this.mgmt = mgmt;
+ this.filter = predicate;
+ }
+ @Override
+ public Iterable<RegisteredType> get() {
+ return mgmt.getTypeRegistry().getMatching(filter);
+ }
+}