brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <>
Subject [GitHub] incubator-brooklyn pull request: SimpleCommand addition to brookly...
Date Mon, 16 Nov 2015 09:28:26 GMT
Github user geomacy commented on a diff in the pull request:
    --- Diff: usage/test-framework/src/main/java/org/apache/brooklyn/test/framework/
    @@ -0,0 +1,50 @@
    + * 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
    + *
    + *
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.brooklyn.test.framework;
    +import org.apache.brooklyn.api.entity.Entity;
    +import org.apache.brooklyn.api.entity.ImplementedBy;
    +import org.apache.brooklyn.config.ConfigKey;
    +import org.apache.brooklyn.core.config.ConfigKeys;
    +import org.apache.brooklyn.core.entity.trait.Startable;
    +import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
    +import org.apache.brooklyn.util.core.flags.SetFromFlag;
    +import org.apache.brooklyn.util.os.Os;
    +import static org.apache.brooklyn.core.config.ConfigKeys.newConfigKey;
    + * Entity to invoke on a node a simple command that will immediately succeed or fail.
    + *
    + * Invokes the command in the start operation, and declares itself RUNNING.
    + */
    +public interface SimpleCommand extends Entity, Startable {
    +    @SetFromFlag(nullable = false)
    +    ConfigKey<String> DEFAULT_COMMAND = ConfigKeys.newConfigKey(String.class, "defaultCommand",
    +            "Command to invoke if no script is provided via a downloadUrl");
    +    @SetFromFlag("downloadUrl")
    +    AttributeSensorAndConfigKey<String, String> DOWNLOAD_URL = SoftwareProcess.DOWNLOAD_URL;
    +    @SetFromFlag("scriptDir")
    +    ConfigKey<String> SCRIPT_DIR = newConfigKey("scriptDir", "directory where downloaded
scripts should be put", Os.tmp());
    --- End diff --
    Thanks for the detailed reviews.  Regarding the 'step back' comment on the amount of code,
I couldn't agree more!  I followed the VanillaSoftwareProcess model, and while that was probably
a valuable learning exercise, it leaves what does seem like an awful lot of code to do something
simple. If it's ok to do the work as tasks directly in the ```start()``` of the entity then
I'll rework it that way.  (I wasn't sure if there might be some non-obvious dependencies elsewhere
in the code that meant you had to have a driver or lifecycle classes?) 

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 or file a JIRA ticket
with INFRA.

View raw message