Return-Path: X-Original-To: apmail-brooklyn-dev-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B98FC17F1C for ; Mon, 18 May 2015 20:25:34 +0000 (UTC) Received: (qmail 65054 invoked by uid 500); 18 May 2015 20:25:34 -0000 Delivered-To: apmail-brooklyn-dev-archive@brooklyn.apache.org Received: (qmail 65018 invoked by uid 500); 18 May 2015 20:25:34 -0000 Mailing-List: contact dev-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list dev@brooklyn.incubator.apache.org Received: (qmail 65002 invoked by uid 99); 18 May 2015 20:25:34 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2015 20:25:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A2CA11A2ED8 for ; Mon, 18 May 2015 20:25:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.971 X-Spam-Level: X-Spam-Status: No, score=0.971 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id aBx5ik2CgqQH for ; Mon, 18 May 2015 20:25:24 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id D44A443DAB for ; Mon, 18 May 2015 20:25:23 +0000 (UTC) Received: (qmail 64863 invoked by uid 99); 18 May 2015 20:25:23 -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; Mon, 18 May 2015 20:25:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4AA21E0984; Mon, 18 May 2015 20:25:23 +0000 (UTC) From: aledsage To: dev@brooklyn.incubator.apache.org Reply-To: dev@brooklyn.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-brooklyn pull request: CLI commands for manipulating cat... Content-Type: text/plain Message-Id: <20150518202523.4AA21E0984@git1-us-west.apache.org> Date: Mon, 18 May 2015 20:25:23 +0000 (UTC) Github user aledsage commented on a diff in the pull request: https://github.com/apache/incubator-brooklyn/pull/617#discussion_r30543880 --- Diff: core/src/main/java/brooklyn/catalog/internal/CatalogInitialization.java --- @@ -0,0 +1,377 @@ +/* + * 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 brooklyn.catalog.internal; + +import java.io.File; +import java.util.Collection; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import brooklyn.catalog.CatalogItem; +import brooklyn.config.BrooklynServerConfig; +import brooklyn.management.ManagementContext; +import brooklyn.management.ManagementContextInjectable; +import brooklyn.management.internal.ManagementContextInternal; +import brooklyn.util.ResourceUtils; +import brooklyn.util.collections.MutableList; +import brooklyn.util.exceptions.Exceptions; +import brooklyn.util.exceptions.FatalRuntimeException; +import brooklyn.util.exceptions.RuntimeInterruptedException; +import brooklyn.util.flags.TypeCoercions; +import brooklyn.util.guava.Maybe; +import brooklyn.util.net.Urls; +import brooklyn.util.text.Strings; + +import com.google.common.annotations.Beta; +import com.google.common.base.Function; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; + +@Beta +public class CatalogInitialization implements ManagementContextInjectable { + + /* + + A1) if not persisting, go to B1 + A2) if --catalog-reset, delete persisted catalog items + A3) read persisted catalog items (possibly deleted in A2), go to C1 + A4) go to B1 + + B1) look for --catalog-initial, if so read it, then go to C1 + B2) look for BrooklynServerConfig.BROOKLYN_CATALOG_URL, if so, read it, supporting YAML or XML (warning if XML), then go to C1 + B3) look for ~/.brooklyn/catalog.bom, if exists, read it then go to C1 + B4) look for ~/.brooklyn/brooklyn.xml, if exists, warn, read it then go to C1 + B5) read all classpath://brooklyn/default.catalog.bom items, if they exist (and for now they will) + B6) go to C1 + + C1) if --catalog-add, read and add those items + + D1) if persisting, read the rest of the persisted items (entities etc) + + */ + + private static final Logger log = LoggerFactory.getLogger(CatalogInitialization.class); + + String initialUri; + boolean reset; + String additionsUri; + boolean force; + + boolean disallowLocal = false; + List> callbacks = MutableList.of(); + boolean hasRunBestEffort = false, hasRunOfficial = false, isPopulating = false; + + ManagementContext managementContext; + boolean isStartingUp = false; + boolean failOnStartupErrors = false; + + Object mutex = new Object(); + + public CatalogInitialization(String initialUri, boolean reset, String additionUri, boolean force) { --- End diff -- Worth javadoc to say what `initialUri` and `additionUri` are - not clear without digging through the code. Rename to `additionsUri` to match the field. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---