brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [01/10] brooklyn-server git commit: Delete deprecated CatalogLoadMode
Date Mon, 02 Oct 2017 12:49:52 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 1ae9aaa66 -> 0adf3fdd9


Delete deprecated CatalogLoadMode

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

Branch: refs/heads/master
Commit: 036de3c1183beaedb6ca7ae71153100925222a8f
Parents: 1ae9aaa
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Sep 26 12:32:20 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Oct 2 06:08:29 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/core/catalog/CatalogLoadMode.java  | 73 --------------------
 .../catalog/internal/CatalogInitialization.java | 34 ---------
 .../core/mgmt/rebind/RebindIteration.java       |  1 -
 .../core/server/BrooklynServerConfig.java       |  8 ---
 .../core/mgmt/rebind/RebindCatalogItemTest.java |  2 -
 5 files changed, 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/036de3c1/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java b/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
deleted file mode 100644
index dd2e54b..0000000
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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;
-
-import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
-import org.apache.brooklyn.core.mgmt.persist.PersistMode;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.slf4j.LoggerFactory;
-
-/** @deprecated since 0.7.0 replaced by {@link CatalogInitialization} */
-@Deprecated
-public enum CatalogLoadMode {
-    /**
-     * The server will load its initial catalog from the URL configured in
-     * {@link BrooklynServerConfig#BROOKLYN_CATALOG_URL} and will
-     * disregard existing persisted state.
-     */
-    LOAD_BROOKLYN_CATALOG_URL,
-
-    /**
-     * The server will load its initial catalog from previously persisted state,
-     * and will behave as {@link #LOAD_BROOKLYN_CATALOG_URL} if no state exists.
-     */
-    LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE,
-
-    /**
-     * The server will load its initial catalog from previously persisted state.
-     * The catalog will be empty if no previous state exists.
-     */
-    LOAD_PERSISTED_STATE;
-
-    /**
-     * @return A catalog load mode suitable for the given persistence mode:
-     * <ul>
-     * <li>disabled: {@link #LOAD_BROOKLYN_CATALOG_URL}</li>
-     * <li>rebind: {@link #LOAD_PERSISTED_STATE}</li>
-     * <li>auto or clean: {@link #LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE}</li>
-     * </ul>
-     */
-    public static CatalogLoadMode forPersistMode(PersistMode m) {
-        // Clean case relies on the persistence directory being cleaned and rebind manager
-        // believing the store to be empty.
-        switch (m) {
-        case DISABLED:
-            return LOAD_BROOKLYN_CATALOG_URL;
-        case AUTO:
-        case CLEAN:
-            return LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE;
-        case REBIND:
-            return LOAD_PERSISTED_STATE;
-        default:
-            LoggerFactory.getLogger(CatalogLoadMode.class)
-                    .warn("Unhandled persistence mode {}. Catalog defaulting to {}", m.name(),
LOAD_BROOKLYN_CATALOG_URL.name());
-            return LOAD_BROOKLYN_CATALOG_URL;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/036de3c1/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
----------------------------------------------------------------------
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 ac5698d..0b01273 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
@@ -25,18 +25,15 @@ import java.util.List;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.core.catalog.CatalogLoadMode;
 import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 import org.apache.brooklyn.core.server.BrooklynServerConfig;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.exceptions.FatalRuntimeException;
 import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException;
 import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
-import org.apache.brooklyn.util.guava.Maybe;
 import org.apache.brooklyn.util.javalang.JavaClassNames;
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.text.Strings;
@@ -222,8 +219,6 @@ public class CatalogInitialization implements ManagementContextInjectable
{
     }
 
     private void populateCatalogImpl(BasicBrooklynCatalog catalog, boolean needsInitialItemsLoaded,
boolean needsAdditionsLoaded, Collection<CatalogItem<?, ?>> optionalItemsForResettingCatalog)
{
-        applyCatalogLoadMode();
-        
         if (optionalItemsForResettingCatalog!=null) {
             catalog.reset(optionalItemsForResettingCatalog);
         }
@@ -334,35 +329,6 @@ public class CatalogInitialization implements ManagementContextInjectable
{
             callback.apply(this);
     }
 
-    private Object setFromCLMMutex = new Object();
-    private boolean setFromCatalogLoadMode = false;
-
-    /** @deprecated since introduced in 0.7.0, only for legacy compatibility with 
-     * {@link CatalogLoadMode} {@link BrooklynServerConfig#CATALOG_LOAD_MODE},
-     * allowing control of catalog loading from a brooklyn property */
-    @Deprecated
-    public void applyCatalogLoadMode() {
-        synchronized (setFromCLMMutex) {
-            if (setFromCatalogLoadMode) return;
-            setFromCatalogLoadMode = true;
-            Maybe<Object> clmm = ((ManagementContextInternal)managementContext).getConfig().getConfigLocalRaw(BrooklynServerConfig.CATALOG_LOAD_MODE);
-            if (clmm.isAbsent()) return;
-            org.apache.brooklyn.core.catalog.CatalogLoadMode clm = TypeCoercions.coerce(clmm.get(),
org.apache.brooklyn.core.catalog.CatalogLoadMode.class);
-            log.warn("Legacy CatalogLoadMode "+clm+" set: applying, but this should be changed
to use new CLI --catalogXxx commands");
-            switch (clm) {
-            case LOAD_BROOKLYN_CATALOG_URL:
-                reset = true;
-                break;
-            case LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE:
-                // now the default
-                break;
-            case LOAD_PERSISTED_STATE:
-                disallowLocal = true;
-                break;
-            }
-        }
-    }
-
     /** Creates the catalog based on parameters set here, if not yet loaded,
      * but ignoring persisted state and warning if persistence is on and we are starting
up
      * (because the official persistence is preferred and the catalog will be subsequently
replaced);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/036de3c1/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java
index 36f4275..f9f9b1c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java
@@ -403,7 +403,6 @@ public abstract class RebindIteration {
         
         Collection<CatalogItem<?, ?>> catalogItems = rebindContext.getCatalogItems();
         CatalogInitialization catInit = managementContext.getCatalogInitialization();
-        catInit.applyCatalogLoadMode();
         Collection<CatalogItem<?,?>> itemsForResettingCatalog = null;
         boolean needsInitialItemsLoaded, needsAdditionalItemsLoaded;
         if (rebindManager.persistCatalogItemsEnabled) {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/036de3c1/core/src/main/java/org/apache/brooklyn/core/server/BrooklynServerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/server/BrooklynServerConfig.java
b/core/src/main/java/org/apache/brooklyn/core/server/BrooklynServerConfig.java
index 59cdf64..391d789 100644
--- a/core/src/main/java/org/apache/brooklyn/core/server/BrooklynServerConfig.java
+++ b/core/src/main/java/org/apache/brooklyn/core/server/BrooklynServerConfig.java
@@ -28,7 +28,6 @@ import java.util.Map;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.mgmt.usage.ManagementNodeStateListener;
 import org.apache.brooklyn.core.mgmt.usage.UsageListener;
@@ -120,13 +119,6 @@ public class BrooklynServerConfig {
     public static final ConfigKey<String> BROOKLYN_CATALOG_URL = ConfigKeys.newStringConfigKey("brooklyn.catalog.url",
         "The URL of a custom catalog.bom to load");
 
-    /** @deprecated since 0.7.0 replaced by {@link CatalogInitialization}; also note, default
removed 
-     * (it was overridden anyway, and in almost all cases the new behaviour is still the
default behaviour) */
-    @Deprecated
-    public static final ConfigKey<org.apache.brooklyn.core.catalog.CatalogLoadMode>
CATALOG_LOAD_MODE = ConfigKeys.newConfigKey(org.apache.brooklyn.core.catalog.CatalogLoadMode.class,
-            "brooklyn.catalog.mode",
-            "The mode the management context should use to load the catalog when first starting");
-
     /** string used in places where the management node ID is needed to resolve a path */
     public static final String MANAGEMENT_NODE_ID_PROPERTY = "brooklyn.mgmt.node.id";
     

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/036de3c1/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogItemTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogItemTest.java
b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogItemTest.java
index 77d8919..9ec87fe 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogItemTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogItemTest.java
@@ -47,7 +47,6 @@ import org.apache.brooklyn.core.entity.EntityFunctions;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
 import org.apache.brooklyn.core.policy.AbstractPolicy;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 import org.apache.brooklyn.util.time.Duration;
@@ -100,7 +99,6 @@ public class RebindCatalogItemTest extends RebindTestFixtureWithApp {
     @Override
     protected LocalManagementContext createOrigManagementContext() {
         BrooklynProperties properties = BrooklynProperties.Factory.newDefault();
-        properties.put(BrooklynServerConfig.CATALOG_LOAD_MODE, org.apache.brooklyn.core.catalog.CatalogLoadMode.LOAD_BROOKLYN_CATALOG_URL);
         return RebindTestUtils.managementContextBuilder(mementoDir, classLoader)
                 .properties(properties)
                 .persistPeriodMillis(getPersistPeriodMillis())


Mime
View raw message