Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7E8E9200C79 for ; Fri, 19 May 2017 12:27:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7D24B160BD1; Fri, 19 May 2017 10:27:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7E3E5160BBE for ; Fri, 19 May 2017 12:27:41 +0200 (CEST) Received: (qmail 67123 invoked by uid 500); 19 May 2017 10:27:40 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 67113 invoked by uid 99); 19 May 2017 10:27:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 May 2017 10:27:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 98605DFEF3; Fri, 19 May 2017 10:27:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: drigodwin@apache.org To: commits@brooklyn.apache.org Date: Fri, 19 May 2017 10:27:40 -0000 Message-Id: <3e98ac13c0b9416a9402a6468f5b7842@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] brooklyn-server git commit: Delete `MutableBrooklynMemento` archived-at: Fri, 19 May 2017 10:27:42 -0000 Repository: brooklyn-server Updated Branches: refs/heads/master 6597908a2 -> 8a7d243c3 Delete `MutableBrooklynMemento` Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3b41560c Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3b41560c Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3b41560c Branch: refs/heads/master Commit: 3b41560c64705b0f06d16254927b03f07a9f0d4f Parents: 4dac225 Author: Aled Sage Authored: Thu May 18 16:16:15 2017 +0100 Committer: Aled Sage Committed: Fri May 19 10:47:26 2017 +0100 ---------------------------------------------------------------------- .../core/mgmt/persist/XmlMementoSerializer.java | 1 - .../mgmt/rebind/dto/MutableBrooklynMemento.java | 331 ------------------- 2 files changed, 332 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3b41560c/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java index 7f38611..2218c56 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java @@ -59,7 +59,6 @@ import org.apache.brooklyn.core.mgmt.rebind.dto.BasicFeedMemento; import org.apache.brooklyn.core.mgmt.rebind.dto.BasicLocationMemento; import org.apache.brooklyn.core.mgmt.rebind.dto.BasicManagedBundleMemento; import org.apache.brooklyn.core.mgmt.rebind.dto.BasicPolicyMemento; -import org.apache.brooklyn.core.mgmt.rebind.dto.MutableBrooklynMemento; import org.apache.brooklyn.core.sensor.BasicAttributeSensor; import org.apache.brooklyn.util.core.ClassLoaderUtils; import org.apache.brooklyn.util.core.xstream.XmlSerializer; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3b41560c/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java deleted file mode 100644 index a7dcbe9..0000000 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java +++ /dev/null @@ -1,331 +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.mgmt.rebind.dto; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.EnricherMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.ManagedBundleMemento; -import org.apache.brooklyn.api.mgmt.rebind.mementos.PolicyMemento; -import org.apache.brooklyn.util.collections.MutableList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - - -/** - * @deprecated since 0.7.0; this code will move to src/tests/java - */ -@Deprecated -@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) -public class MutableBrooklynMemento implements BrooklynMemento { - - // TODO Is this class pulling its weight? Do we really need it? - // (shouldn't be used anymore -- have added logging April 2017 to ensure not used) - - private static final Logger log = LoggerFactory.getLogger(MutableBrooklynMemento.class); - - private static final long serialVersionUID = -442895028005849060L; - - private String planeId; - private final Collection applicationIds = Sets.newLinkedHashSet(); - private final Collection topLevelLocationIds = Sets.newLinkedHashSet(); - private final Map entities = Maps.newLinkedHashMap(); - private final Map locations = Maps.newLinkedHashMap(); - private final Map policies = Maps.newLinkedHashMap(); - private final Map enrichers = Maps.newLinkedHashMap(); - private final Map feeds = Maps.newLinkedHashMap(); - private final Map catalogItems = Maps.newLinkedHashMap(); - private final Map bundles = Maps.newLinkedHashMap(); - - { - log.warn("Using legacy "+this, new Exception("location of use of legacy "+this)); - } - - public MutableBrooklynMemento() { - } - - public MutableBrooklynMemento(BrooklynMemento memento) { - reset(memento); - } - - public void reset(BrooklynMemento memento) { - planeId = memento.getPlaneId(); - applicationIds.addAll(memento.getApplicationIds()); - topLevelLocationIds.addAll(memento.getTopLevelLocationIds()); - for (String entityId : memento.getEntityIds()) { - entities.put(entityId, checkNotNull(memento.getEntityMemento(entityId), entityId)); - } - for (String locationId : memento.getLocationIds()) { - locations.put(locationId, checkNotNull(memento.getLocationMemento(locationId), locationId)); - } - } - - public void setPlaneId(String planeId) { - this.planeId = planeId; - } - - public void updateEntityMemento(EntityMemento memento) { - updateEntityMementos(ImmutableSet.of(memento)); - } - - public void updateLocationMemento(LocationMemento memento) { - updateLocationMementos(ImmutableSet.of(memento)); - } - - public void updatePolicyMemento(PolicyMemento memento) { - updatePolicyMementos(ImmutableSet.of(memento)); - } - - public void updateEnricherMemento(EnricherMemento memento) { - updateEnricherMementos(ImmutableSet.of(memento)); - } - - public void updateFeedMemento(FeedMemento memento) { - updateFeedMementos(ImmutableSet.of(memento)); - } - - public void updateCatalogItemMemento(CatalogItemMemento memento) { - updateCatalogItemMementos(ImmutableSet.of(memento)); - } - - public void updateEntityMementos(Collection mementos) { - for (EntityMemento memento : mementos) { - entities.put(memento.getId(), memento); - - if (memento.isTopLevelApp()) { - applicationIds.add(memento.getId()); - } - } - } - - public void updateLocationMementos(Collection mementos) { - for (LocationMemento locationMemento : mementos) { - locations.put(locationMemento.getId(), locationMemento); - - if (locationMemento.getParent() == null) { - topLevelLocationIds.add(locationMemento.getId()); - } - } - } - - public void updatePolicyMementos(Collection mementos) { - for (PolicyMemento memento : mementos) { - policies.put(memento.getId(), memento); - } - } - - public void updateEnricherMementos(Collection mementos) { - for (EnricherMemento memento : mementos) { - enrichers.put(memento.getId(), memento); - } - } - - public void updateFeedMementos(Collection mementos) { - for (FeedMemento memento : mementos) { - feeds.put(memento.getId(), memento); - } - } - - public void updateCatalogItemMementos(Collection mementos) { - for (CatalogItemMemento memento : mementos) { - catalogItems.put(memento.getId(), memento); - } - } - - /** - * Removes the entities with the given ids. - */ - public void removeEntities(Collection ids) { - entities.keySet().removeAll(ids); - applicationIds.removeAll(ids); - } - - /** - * Removes the locations with the given ids. - */ - public void removeLocations(Collection ids) { - locations.keySet().removeAll(ids); - topLevelLocationIds.removeAll(ids); - } - - /** - * Removes the policies with the given ids. - */ - public void removePolicies(Collection ids) { - policies.keySet().removeAll(ids); - } - - /** - * Removes the enrichers with the given ids. - */ - public void removeEnrichers(Collection ids) { - enrichers.keySet().removeAll(ids); - } - - /** - * Removes the feeds with the given ids. - */ - public void removeFeeds(Collection ids) { - feeds.keySet().removeAll(ids); - } - - /** - * Removes the catalog items with the given ids. - */ - public void removeCatalogItems(Collection ids) { - catalogItems.keySet().removeAll(ids); - } - - @Override - public String getPlaneId() { - return planeId; - } - - @Override - public EntityMemento getEntityMemento(String id) { - return entities.get(id); - } - - @Override - public LocationMemento getLocationMemento(String id) { - return locations.get(id); - } - - @Override - public PolicyMemento getPolicyMemento(String id) { - return policies.get(id); - } - - @Override - public EnricherMemento getEnricherMemento(String id) { - return enrichers.get(id); - } - - @Override - public FeedMemento getFeedMemento(String id) { - return feeds.get(id); - } - - @Override - public CatalogItemMemento getCatalogItemMemento(String id) { - return catalogItems.get(id); - } - - @Override - public Collection getApplicationIds() { - return ImmutableList.copyOf(applicationIds); - } - - @Override - public Collection getEntityIds() { - // TODO Return immutable copy? Synchronize while making copy? - return Collections.unmodifiableSet(entities.keySet()); - } - - @Override - public Collection getLocationIds() { - return Collections.unmodifiableSet(locations.keySet()); - } - - @Override - public Collection getPolicyIds() { - return Collections.unmodifiableSet(policies.keySet()); - } - - @Override - public Collection getEnricherIds() { - return Collections.unmodifiableSet(enrichers.keySet()); - } - - @Override - public Collection getFeedIds() { - return Collections.unmodifiableSet(feeds.keySet()); - } - - @Override - public Collection getCatalogItemIds() { - return Collections.unmodifiableSet(catalogItems.keySet()); - } - - @Override - public Collection getTopLevelLocationIds() { - return Collections.unmodifiableCollection(topLevelLocationIds); - } - - @Override - public Map getEntityMementos() { - return ImmutableMap.copyOf(entities); - } - - @Override - public Map getLocationMementos() { - return ImmutableMap.copyOf(locations); - } - - @Override - public Map getPolicyMementos() { - return ImmutableMap.copyOf(policies); - } - - @Override - public Map getEnricherMementos() { - return ImmutableMap.copyOf(enrichers); - } - - @Override - public Map getFeedMementos() { - return ImmutableMap.copyOf(feeds); - } - - @Override - public Map getCatalogItemMementos() { - return ImmutableMap.copyOf(catalogItems); - } - - @Override - public ManagedBundleMemento getManagedBundleMemento(String id) { - return null; - } - - @Override - public Collection getManagedBundleIds() { - return MutableList.of(); - } - - @Override - public Map getManagedBundleMementos() { - return bundles; - } -}