http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java new file mode 100644 index 0000000..bf4b042 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java @@ -0,0 +1,24 @@ +/* + * 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.api.objs; + +public interface Identifiable { + + String getId(); +}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java new file mode 100644 index 0000000..fd7047e --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java @@ -0,0 +1,42 @@ +/* + * 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.api.objs; + +import java.io.Serializable; + +import javax.annotation.Nullable; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.config.ConfigKey; + +/** A wrapper around a {@link ConfigKey} which will be added to an {@link Entity}, + * providing additional information for rendering in a UI */ +public interface SpecParameter<T> extends Serializable { + /** Short name, to be used in UI */ + String getLabel(); + /** Whether visible by default in UI, not all inputs may be visible at once */ + boolean isPinned(); + /** All config key info for this spec parameter; + * this is the config key which is added to the defined type */ + ConfigKey<T> getConfigKey(); + /** An optional sensor which may also be added to the defined type */ + @Nullable AttributeSensor<?> getSensor(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java new file mode 100644 index 0000000..5b1e2fa --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java @@ -0,0 +1,80 @@ +/* + * 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.api.policy; + +import org.apache.brooklyn.api.mgmt.rebind.RebindSupport; +import org.apache.brooklyn.api.mgmt.rebind.Rebindable; +import org.apache.brooklyn.api.mgmt.rebind.mementos.PolicyMemento; +import org.apache.brooklyn.api.objs.Configurable; +import org.apache.brooklyn.api.objs.EntityAdjunct; +import org.apache.brooklyn.config.ConfigKey; + +import com.google.common.annotations.Beta; + +/** + * Policies implement actions and thus must be suspendable; policies should continue to evaluate their sensors + * and indicate their desired planned action even if they aren't invoking them + */ +public interface Policy extends EntityAdjunct, Rebindable, Configurable { + /** + * A unique id for this policy. + */ + @Override + String getId(); + + /** + * Information about the type of this entity; analogous to Java's object.getClass. + */ + @Beta + PolicyType getPolicyType(); + + /** + * Resume the policy + */ + void resume(); + + /** + * Suspend the policy + */ + void suspend(); + + /** + * Whether the policy is suspended + */ + boolean isSuspended(); + + /** + * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().set(key, val)} + */ + @Deprecated + <T> T setConfig(ConfigKey<T> key, T val); + + /** + * Users are strongly discouraged from calling or overriding this method. + * It is for internal calls only, relating to persisting/rebinding entities. + * This method may change (or be removed) in a future release without notice. + */ + @Override + @Beta + RebindSupport<PolicyMemento> getRebindSupport(); + + @Override + RelationSupport<Policy> relations(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java new file mode 100644 index 0000000..a139d5d --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java @@ -0,0 +1,76 @@ +/* + * 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.api.policy; + +import java.util.Map; + +import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; + +/** + * Gives details of a policy to be created. It describes the policy's configuration, and is + * reusable to create multiple policies with the same configuration. + * + * To create a PolicySpec, it is strongly encouraged to use {@code create(...)} methods. + * + * @param <T> The type of policy to be created + * + * @author aled + */ +public class PolicySpec<T extends Policy> extends AbstractBrooklynObjectSpec<T,PolicySpec<T>> { + + private final static long serialVersionUID = 1L; + + + /** + * Creates a new {@link PolicySpec} instance for a policy of the given type. The returned + * {@link PolicySpec} can then be customized. + * + * @param type A {@link Policy} class + */ + public static <T extends Policy> PolicySpec<T> create(Class<T> type) { + return new PolicySpec<T>(type); + } + + /** + * Creates a new {@link PolicySpec} instance with the given config, for a policy of the given type. + * + * This is primarily for groovy code; equivalent to {@code PolicySpec.create(type).configure(config)}. + * + * @param config The spec's configuration (see {@link PolicySpec#configure(Map)}). + * @param type A {@link Policy} class + */ + public static <T extends Policy> PolicySpec<T> create(Map<?,?> config, Class<T> type) { + return PolicySpec.create(type).configure(config); + } + + protected PolicySpec(Class<T> type) { + super(type); + } + + protected void checkValidType(Class<? extends T> type) { + checkIsImplementation(type, Policy.class); + checkIsNewStyleImplementation(type); + } + + public PolicySpec<T> uniqueTag(String uniqueTag) { + flags.put("uniqueTag", uniqueTag); + return this; + } + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java new file mode 100644 index 0000000..2ba99c6 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java @@ -0,0 +1,36 @@ +/* + * 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.api.policy; + +import org.apache.brooklyn.api.objs.BrooklynType; + +import com.google.common.annotations.Beta; + +/** + * Gives type information for a {@link Policy}. It is immutable. + * + * For policies that can support config keys etc being added on-the-fly, + * then this PolicyType will be a snapshot and subsequent snapshots will + * include the changes. + * + * @since 0.5 + */ +@Beta +public interface PolicyType extends BrooklynType { +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java new file mode 100644 index 0000000..54162f2 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.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.api.relations; + +import org.apache.brooklyn.api.relations.RelationshipType; + + +public interface RelationshipType<SourceType,TargetType> { + + public String getRelationshipTypeName(); + public Class<SourceType> getSourceType(); + public Class<TargetType> getTargetType(); + + public String getSourceName(); + public String getSourceNamePlural(); + + public String getTargetName(); + public String getTargetNamePlural(); + + public RelationshipType<TargetType,SourceType> getInverseRelationshipType(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java new file mode 100644 index 0000000..e200920 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java @@ -0,0 +1,52 @@ +/* + * 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.api.sensor; + +import com.google.common.annotations.Beta; + +/** + * The interface implemented by attribute sensors. + */ +public interface AttributeSensor<T> extends Sensor<T> { + + /** + * @since 0.7.0 + */ + @Beta + public enum SensorPersistenceMode { + /** + * Indicates that this sensor should be persisted, and its value should be read from + * persisted state on rebind. + */ + REQUIRED, + + /** + * Indicates that this sensor should not be persisted; therefore its value for any entity + * will be null immediately after rebind. + */ + NONE; + } + + /** + * The persistence mode of this sensor, to determine its behaviour for rebind. + * + * @since 0.7.0 + */ + SensorPersistenceMode getPersistenceMode(); +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java new file mode 100644 index 0000000..3fde2a5 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java @@ -0,0 +1,61 @@ +/* + * 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.api.sensor; + +import org.apache.brooklyn.api.mgmt.rebind.RebindSupport; +import org.apache.brooklyn.api.mgmt.rebind.Rebindable; +import org.apache.brooklyn.api.mgmt.rebind.mementos.EnricherMemento; +import org.apache.brooklyn.api.objs.Configurable; +import org.apache.brooklyn.api.objs.EntityAdjunct; +import org.apache.brooklyn.api.policy.Policy; + +import com.google.common.annotations.Beta; + +/** + * Publishes metrics for an entity, e.g. aggregating information from other sensors/entities. + * + * Has some similarities to {@link Policy}. However, enrichers specifically do not invoke + * effectors and should only function to publish new metrics. + */ +public interface Enricher extends EntityAdjunct, Rebindable, Configurable { + /** + * A unique id for this enricher. + */ + @Override + String getId(); + + /** + * Information about the type of this entity; analogous to Java's object.getClass. + */ + @Beta + EnricherType getEnricherType(); + + /** + * Users are strongly discouraged from calling or overriding this method. + * It is for internal calls only, relating to persisting/rebinding entities. + * This method may change (or be removed) in a future release without notice. + */ + @Override + @Beta + RebindSupport<EnricherMemento> getRebindSupport(); + + @Override + RelationSupport<Enricher> relations(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java new file mode 100644 index 0000000..ae50e2d --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java @@ -0,0 +1,140 @@ +/* + * 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.api.sensor; + +import java.util.Map; + +import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; +import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.config.ConfigKey.HasConfigKey; + +/** + * Gives details of an enricher to be created. It describes the enricher's configuration, and is + * reusable to create multiple enrichers with the same configuration. + * + * To create an EnricherSpec, it is strongly encouraged to use {@code create(...)} methods. + * + * @param <T> The type of enricher to be created + * + * @author aled + */ +public class EnricherSpec<T extends Enricher> extends AbstractBrooklynObjectSpec<T,EnricherSpec<T>> { + + private static final long serialVersionUID = -6012873926010992062L; + + /** + * Creates a new {@link EnricherSpec} instance for an enricher of the given type. The returned + * {@link EnricherSpec} can then be customized. + * + * @param type A {@link Enricher} class + */ + public static <T extends Enricher> EnricherSpec<T> create(Class<? extends T> type) { + return new EnricherSpec<T>(type); + } + + /** + * Creates a new {@link EnricherSpec} instance with the given config, for an enricher of the given type. + * + * This is primarily for groovy code; equivalent to {@code EnricherSpec.create(type).configure(config)}. + * + * @param config The spec's configuration (see {@link EnricherSpec#configure(Map)}). + * @param type An {@link Enricher} class + */ + public static <T extends Enricher> EnricherSpec<T> create(Map<?,?> config, Class<? extends T> type) { + return EnricherSpec.create(type).configure(config); + } + + protected EnricherSpec(Class<? extends T> type) { + super(type); + } + + protected void checkValidType(Class<? extends T> type) { + checkIsImplementation(type, Enricher.class); + checkIsNewStyleImplementation(type); + } + + public EnricherSpec<T> uniqueTag(String uniqueTag) { + flags.put("uniqueTag", uniqueTag); + return this; + } + + public abstract static class ExtensibleEnricherSpec<T extends Enricher,K extends ExtensibleEnricherSpec<T,K>> extends EnricherSpec<T> { + private static final long serialVersionUID = -3649347642882809739L; + + protected ExtensibleEnricherSpec(Class<? extends T> type) { + super(type); + } + + @SuppressWarnings("unchecked") + protected K self() { + // we override the AbstractBrooklynObjectSpec method -- it's a different K here because + // EnricherSpec does not contain a parametrisable generic return type (Self) + return (K) this; + } + + @Override + public K uniqueTag(String uniqueTag) { + super.uniqueTag(uniqueTag); + return self(); + } + + @Override + public K configure(Map<?, ?> val) { + super.configure(val); + return self(); + } + + @Override + public K configure(CharSequence key, Object val) { + super.configure(key, val); + return self(); + } + + @Override + public <V> K configure(ConfigKey<V> key, V val) { + super.configure(key, val); + return self(); + } + + @Override + public <V> K configureIfNotNull(ConfigKey<V> key, V val) { + super.configureIfNotNull(key, val); + return self(); + } + + @Override + public <V> K configure(ConfigKey<V> key, Task<? extends V> val) { + super.configure(key, val); + return self(); + } + + @Override + public <V> K configure(HasConfigKey<V> key, V val) { + super.configure(key, val); + return self(); + } + + @Override + public <V> K configure(HasConfigKey<V> key, Task<? extends V> val) { + super.configure(key, val); + return self(); + } + } +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java new file mode 100644 index 0000000..e8aff97 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java @@ -0,0 +1,36 @@ +/* + * 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.api.sensor; + +import org.apache.brooklyn.api.objs.BrooklynType; + +import com.google.common.annotations.Beta; + +/** + * Gives type information for an {@link Enricher}. It is immutable. + * + * For enrichers that can support config keys etc being added on-the-fly, + * then this EnricherType will be a snapshot and subsequent snapshots will + * include the changes. + * + * @since 0.6 + */ +@Beta +public interface EnricherType extends BrooklynType { +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java new file mode 100644 index 0000000..d50e092 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java @@ -0,0 +1,74 @@ +/* + * 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.api.sensor; + +import org.apache.brooklyn.api.mgmt.rebind.RebindSupport; +import org.apache.brooklyn.api.mgmt.rebind.Rebindable; +import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento; +import org.apache.brooklyn.api.objs.EntityAdjunct; + +import com.google.common.annotations.Beta; + +/** + * A sensor feed. + * These generally poll or subscribe to get sensor values for an entity. + * They make it easy to poll over http, jmx, etc. + * + * Assumes: + * <ul> + * <li>There will not be concurrent calls to start and stop. + * <li>There will only be one call to start and that will be done immediately after construction, + * in the same thread. + * <li>Once stopped, the feed will not be re-started. + * </ul> + */ +@Beta +public interface Feed extends EntityAdjunct, Rebindable { + + /** + * True if everything has been _started_ (or it is starting) but not stopped, + * even if it is suspended; see also {@link #isActive()} + */ + boolean isActivated(); + + void start(); + + /** suspends this feed (stops the poller, or indicates that the feed should start in a state where the poller is stopped) */ + void suspend(); + + boolean isSuspended(); + + /** resumes this feed if it has been suspended and not stopped */ + void resume(); + + void stop(); + + /** + * Users are strongly discouraged from calling or overriding this method. + * It is for internal calls only, relating to persisting/rebinding entities. + * This method may change (or be removed) in a future release without notice. + */ + @Override + @Beta + RebindSupport<FeedMemento> getRebindSupport(); + + @Override + RelationSupport<Feed> relations(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java new file mode 100644 index 0000000..e658028 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java @@ -0,0 +1,77 @@ +/* + * 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.api.sensor; + +import java.io.Serializable; +import java.util.List; + +import org.apache.brooklyn.api.entity.Entity; + +import com.google.common.reflect.TypeToken; + +/** + * The interface implemented by concrete sensors. + * + * A sensor is a container for a piece of data of a particular type, and exists in a hierarchical namespace. + * The name of the sensor is described as a set of tokens separated by dots. + * + * @see SensorEvent + */ +public interface Sensor<T> extends Serializable { + /** + * Returns the Java {@link Class} for the sensor data. + * <p> + * This returns a "super" of T only in the case where T is generified, + * and in such cases it returns the Class instance for the unadorned T --- + * i.e. for List<String> this returns Class<List> --- + * this is of course because there is no actual Class<List<String>> instance. + */ + Class<? super T> getType(); + + /** + * Returns the Guava TypeToken (including generics info) + */ + TypeToken<T> getTypeToken(); + + /** + * Returns the type of the sensor data, as a {@link String} representation of the class name. + * (Useful for contexts where Type is not accessible.) + */ + String getTypeName(); + + /** + * Returns the name of the sensor, in a dot-separated namespace. + */ + String getName(); + + /** + * Returns the constituent parts of the sensor name as a {@link List}. + */ + List<String> getNameParts(); + + /** + * Returns the description of the sensor, for display. + */ + String getDescription(); + + /** + * Create a new {@link SensorEvent} object for a specific {@link Entity} and data point. + */ + SensorEvent<T> newEvent(Entity entity, T value); +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java new file mode 100644 index 0000000..02a7fef --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java @@ -0,0 +1,47 @@ +/* + * 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.api.sensor; + +import org.apache.brooklyn.api.entity.Entity; + +/** + * A tuple representing a piece of data from a {@link Sensor} on an {@link Entity}. + */ +public interface SensorEvent<T> { + /** + * The {@link Entity} where the data originated. + */ + Entity getSource(); + + /** + * The {@link Sensor} describing the data. + */ + Sensor<T> getSensor(); + + /** + * The value for the {@link Sensor} data. + */ + T getValue(); + + /** + * The time this data was published, as a UTC time in milliseconds (e.g. as returned + * by {@link System#currentTimeMillis()}. + */ + long getTimestamp(); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java new file mode 100644 index 0000000..65fe81c --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java @@ -0,0 +1,37 @@ +/* + * 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.api.sensor; + +import org.apache.brooklyn.api.entity.Entity; + +/** + * A listener for {@link SensorEvent}s on an {@link Entity}. + */ +public interface SensorEventListener<T> { + + public static final SensorEventListener<Object> NOOP = new SensorEventListener<Object>() { + @Override public void onEvent(SensorEvent<Object> event) { + } + }; + + /** + * The {@link SensorEvent} handler method. + */ + void onEvent(SensorEvent<T> event); +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java new file mode 100644 index 0000000..17a7fb3 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java @@ -0,0 +1,78 @@ +/* + * 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.api.typereg; + +import javax.annotation.Nullable; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; +import org.apache.brooklyn.util.guava.Maybe; + +import com.google.common.annotations.Beta; +import com.google.common.base.Predicate; + + +public interface BrooklynTypeRegistry { + + public enum RegisteredTypeKind { + /** a registered type which will create an {@link AbstractBrooklynObjectSpec} (e.g. {@link EntitySpec}) + * for the type registered (e.g. the {@link Entity} instance) */ + SPEC, + /** a registered type which will create the java type described */ + BEAN + // note: additional kinds should have the visitor in core/RegisteredTypeKindVisitor updated + // to flush out all places which want to implement support for all kinds + } + + Iterable<RegisteredType> getAll(); + Iterable<RegisteredType> getMatching(Predicate<? super RegisteredType> filter); + + /** @return The item matching the given given + * {@link RegisteredType#getSymbolicName() symbolicName} + * and optionally {@link RegisteredType#getVersion()}, + * taking the best version if the version is null or a default marker, + * returning null if no matches are found. */ + RegisteredType get(String symbolicName, String version); + /** as {@link #get(String, String)} but the given string here + * is allowed to match any of: + * <li>the given string as an ID including version (<code>"name:version"</code>) + * <li>the symbolic name unversioned, or + * <li>an alias */ + RegisteredType get(String symbolicNameWithOptionalVersion); + + /** as {@link #get(String)} but further filtering for the additional context */ + public RegisteredType get(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context); + /** returns a wrapper of the result of {@link #get(String, RegisteredTypeLoadingContext)} + * including a detailed message if absent */ + public Maybe<RegisteredType> getMaybe(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context); + + // NB the seemingly more correct generics <T,SpecT extends AbstractBrooklynObjectSpec<T,SpecT>> + // cause compile errors, not in Eclipse, but in maven (?) + // TODO do these belong here, or in a separate master TypePlanTransformer ? see also BrooklynTypePlanTransformer + @Beta + <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpec(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType); + @Beta + <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpecFromPlan(@Nullable String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType); + @Beta + <T> T createBean(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<T> optionalResultSuperType); + @Beta + <T> T createBeanFromPlan(String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalConstraint, @Nullable Class<T> optionalBeanSuperType); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java new file mode 100644 index 0000000..e8b278b --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java @@ -0,0 +1,36 @@ +/* + * 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.api.typereg; + +import com.google.common.annotations.Beta; + +@Beta +public interface OsgiBundleWithUrl { + + public String getSymbolicName(); + public String getVersion(); + + /** where this bundle can be downloaded; typically required unless we are guaranteed the bundle will be manually installed */ + public String getUrl(); + + /** @return true if we have a name and version for this bundle; + * false if not, e.g. if we only know the URL and we haven't loaded it yet */ + public boolean isNameResolved(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java new file mode 100644 index 0000000..29b64d3 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java @@ -0,0 +1,96 @@ +/* + * 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.api.typereg; + +import java.util.Collection; +import java.util.Set; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.objs.BrooklynObject; +import org.apache.brooklyn.api.objs.Identifiable; +import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind; + +import com.google.common.annotations.Beta; + +public interface RegisteredType extends Identifiable { + + @Override String getId(); + + RegisteredTypeKind getKind(); + + String getSymbolicName(); + String getVersion(); + + Collection<OsgiBundleWithUrl> getLibraries(); + + String getDisplayName(); + String getDescription(); + String getIconUrl(); + + /** @return all declared supertypes or super-interfaces of this registered type, + * consisting of a collection of {@link Class} or {@link RegisteredType} + * <p> + * This should normally include at least one {@link Class} object: + * For beans, this should include the java type that the {@link BrooklynTypeRegistry} will create. + * For specs, this should refer to the {@link BrooklynObject} type that the created spec will point at + * (e.g. the concrete {@link Entity}, not the {@link EntitySpec}). + * <p> + * This may not necessarily return the most specific java class or classes; + * such as if the concrete type is private and callers should know only about a particular public interface, + * or if precise type details are unavailable and all that is known at creation is some higher level interface/supertype + * (e.g. this may return {@link Entity} even though the spec points at a specific subclass, + * for instance because the YAML has not yet been parsed or OSGi bundles downloaded). + * <p> + * This may include other registered types such as marker interfaces. + */ + @Beta + Set<Object> getSuperTypes(); + + /** + * @return True if the item has been deprecated (i.e. its use is discouraged) + */ + boolean isDeprecated(); + + /** + * @return True if the item has been disabled (i.e. its use is forbidden, except for pre-existing apps) + */ + boolean isDisabled(); + + /** Alias words defined for this type */ + Set<String> getAliases(); + + /** Tags attached to this item */ + Set<Object> getTags(); + + /** @return implementation details, so that the framework can find a suitable {@link BrooklynTypePlanTransformer} + * which can then use this object to instantiate this type */ + TypeImplementationPlan getPlan(); + + public interface TypeImplementationPlan { + /** hint which {@link BrooklynTypePlanTransformer} instance(s) can be used, if known; + * this may be null if the relevant transformer was not declared when created, + * but in general we should look to determine the kind as early as possible + * and use that to retrieve the appropriate such transformer */ + String getPlanFormat(); + /** data for the implementation; may be more specific */ + Object getPlanData(); + } + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java new file mode 100644 index 0000000..d37666e --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java @@ -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 + * + * 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.api.typereg; + +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext; +import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind; + +public interface RegisteredTypeLoadingContext { + + /** The kind required, if specified. */ + @Nullable public RegisteredTypeKind getExpectedKind(); + + /** A java super-type or interface that should be filtered for; + * for specs, this refers to the target type, not the spec + * (eg {@link Entity} not {@link EntitySpec}). + * If nothing is specified, this returns {@link Object}'s class. */ + @Nonnull public Class<?> getExpectedJavaSuperType(); + + /** encountered types, so that during resolution, + * if we have already attempted to resolve a given type, + * the instantiator can avoid recursive cycles */ + @Nonnull public Set<String> getAlreadyEncounteredTypes(); + + /** A loader to use, supplying additional search paths */ + @Nullable public BrooklynClassLoadingContext getLoader(); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/.gitattributes ---------------------------------------------------------------------- diff --git a/brooklyn-server/.gitattributes b/brooklyn-server/.gitattributes deleted file mode 100644 index 7920d0e..0000000 --- a/brooklyn-server/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -#Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) -* text=auto -*.sh text eol=lf -*.bat text eol=crlf -*.ps1 text eol=crlf -*.ini text eol=crlf http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/.gitignore ---------------------------------------------------------------------- diff --git a/brooklyn-server/.gitignore b/brooklyn-server/.gitignore deleted file mode 100644 index ed439f2..0000000 --- a/brooklyn-server/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -\#*\# -*~ -*.bak -*.swp -*.swo -.DS_Store - -atlassian-ide-plugin.xml -*.class - -target/ -test-output/ - -.project -.classpath -.settings/ -.metadata/ - -.idea/ -*.iml - -nbactions.xml -nb-configuration.xml - -prodDb.* - -*.log -brooklyn*.log.* - -*brooklyn-persisted-state/ - -ignored http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/LICENSE ---------------------------------------------------------------------- diff --git a/brooklyn-server/LICENSE b/brooklyn-server/LICENSE deleted file mode 100644 index 3d8f4e7..0000000 --- a/brooklyn-server/LICENSE +++ /dev/null @@ -1,455 +0,0 @@ - -This software is distributed under the Apache License, version 2.0. See (1) below. -This software is copyright (c) The Apache Software Foundation and contributors. - -Contents: - - (1) This software license: Apache License, version 2.0 - (2) Notices for bundled software - (3) Licenses for bundled software - - ---------------------------------------------------- - -(1) This software license: Apache License, version 2.0 - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - ---------------------------------------------------- - -(2) Notices for bundled software - -This project includes the software: async.js - Available at: https://github.com/p15martin/google-maps-hello-world/blob/master/js/libs/async.js - Developed by: Miller Medeiros (https://github.com/millermedeiros/) - Version used: 0.1.1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Miller Medeiros (2011) - -This project includes the software: backbone.js - Available at: http://backbonejs.org - Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) - Version used: 1.0.0 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2013) - -This project includes the software: bootstrap.js - Available at: http://twitter.github.com/bootstrap/javascript.html#transitions - Version used: 2.0.4 - Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Copyright (c) Twitter, Inc. (2012) - -This project includes the software: handlebars.js - Available at: https://github.com/wycats/handlebars.js - Developed by: Yehuda Katz (https://github.com/wycats/) - Inclusive of: handlebars*.js - Version used: 1.0-rc1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Yehuda Katz (2012) - -This project includes the software: jQuery JavaScript Library - Available at: http://jquery.com/ - Developed by: The jQuery Foundation (http://jquery.org/) - Inclusive of: jquery.js - Version used: 1.7.2 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) John Resig (2005-2011) - Includes code fragments from sizzle.js: - Copyright (c) The Dojo Foundation - Available at http://sizzlejs.com - Used under the MIT license - -This project includes the software: jQuery BBQ: Back Button & Query Library - Available at: http://benalman.com/projects/jquery-bbq-plugin/ - Developed by: "Cowboy" Ben Alman (http://benalman.com/) - Inclusive of: jquery.ba-bbq*.js - Version used: 1.2.1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) "Cowboy" Ben Alman (2010)" - -This project includes the software: DataTables Table plug-in for jQuery - Available at: http://www.datatables.net/ - Developed by: SpryMedia Ltd (http://sprymedia.co.uk/) - Inclusive of: jquery.dataTables.{js,css} - Version used: 1.9.4 - Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause) - Copyright (c) Allan Jardine (2008-2012) - -This project includes the software: jQuery Form Plugin - Available at: https://github.com/malsup/form - Developed by: Mike Alsup (http://malsup.com/) - Inclusive of: jquery.form.js - Version used: 3.09 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) M. Alsup (2006-2013) - -This project includes the software: jQuery Wiggle - Available at: https://github.com/jordanthomas/jquery-wiggle - Inclusive of: jquery.wiggle.min.js - Version used: swagger-ui:1.0.1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) WonderGroup and Jordan Thomas (2010) - Previously online at http://labs.wondergroup.com/demos/mini-ui/index.html. - The version included here is from the Swagger UI distribution. - -This project includes the software: js-uri - Available at: http://code.google.com/p/js-uri/ - Developed by: js-uri contributors (https://code.google.com/js-uri) - Inclusive of: URI.js - Version used: 0.1 - Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause) - Copyright (c) js-uri contributors (2013) - -This project includes the software: js-yaml.js - Available at: https://github.com/nodeca/ - Developed by: Vitaly Puzrin (https://github.com/nodeca/) - Version used: 3.2.7 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Vitaly Puzrin (2011-2015) - -This project includes the software: marked.js - Available at: https://github.com/chjj/marked - Developed by: Christopher Jeffrey (https://github.com/chjj) - Version used: 0.3.1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Christopher Jeffrey (2011-2014) - -This project includes the software: moment.js - Available at: http://momentjs.com - Developed by: Tim Wood (http://momentjs.com) - Version used: 2.1.0 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Tim Wood, Iskren Chernev, Moment.js contributors (2011-2014) - -This project includes the software: RequireJS - Available at: http://requirejs.org/ - Developed by: The Dojo Foundation (http://dojofoundation.org/) - Inclusive of: require.js, text.js - Version used: 2.0.6 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) The Dojo Foundation (2010-2012) - -This project includes the software: RequireJS (r.js maven plugin) - Available at: http://github.com/jrburke/requirejs - Developed by: The Dojo Foundation (http://dojofoundation.org/) - Inclusive of: r.js - Version used: 2.1.6 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) The Dojo Foundation (2009-2013) - Includes code fragments for source-map and other functionality: - Copyright (c) The Mozilla Foundation and contributors (2011) - Used under the BSD 2-Clause license. - Includes code fragments for parse-js and other functionality: - Copyright (c) Mihai Bazon (2010, 2012) - Used under the BSD 2-Clause license. - Includes code fragments for uglifyjs/consolidator: - Copyright (c) Robert Gust-Bardon (2012) - Used under the BSD 2-Clause license. - Includes code fragments for the esprima parser: - Copyright (c): - Ariya Hidayat (2011, 2012) - Mathias Bynens (2012) - Joost-Wim Boekesteijn (2012) - Kris Kowal (2012) - Yusuke Suzuki (2012) - Arpad Borsos (2012) - Used under the BSD 2-Clause license. - -This project includes the software: Swagger UI - Available at: https://github.com/swagger-api/swagger-ui - Inclusive of: swagger*.{js,css,html} - Version used: 2.1.4 - Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Copyright (c) SmartBear Software (2011-2015) - -This project includes the software: typeahead.js - Available at: https://github.com/twitter/typeahead.js - Developed by: Twitter, Inc (http://twitter.com) - Version used: 0.10.5 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Twitter, Inc. and other contributors (2013-2014) - -This project includes the software: underscore.js - Available at: http://underscorejs.org - Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) - Inclusive of: underscore*.{js,map} - Version used: 1.4.4 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2009-2013) - -This project includes the software: underscore.js:1.7.0 - Available at: http://underscorejs.org - Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) - Inclusive of: underscore*.{js,map} - Version used: 1.7.0 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (2009-2014) - -This project includes the software: ZeroClipboard - Available at: http://zeroclipboard.org/ - Developed by: ZeroClipboard contributors (https://github.com/zeroclipboard) - Inclusive of: ZeroClipboard.* - Version used: 1.3.1 - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (c) Jon Rohan, James M. Greene (2014) - - ---------------------------------------------------- - -(3) Licenses for bundled software - -Contents: - - The BSD 2-Clause License - The BSD 3-Clause License ("New BSD") - The MIT License ("MIT") - - -The BSD 2-Clause License - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -The BSD 3-Clause License ("New BSD") - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - -The MIT License ("MIT") - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/NOTICE ---------------------------------------------------------------------- diff --git a/brooklyn-server/NOTICE b/brooklyn-server/NOTICE deleted file mode 100644 index f790f13..0000000 --- a/brooklyn-server/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Brooklyn -Copyright 2014-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/README.md ---------------------------------------------------------------------- diff --git a/brooklyn-server/README.md b/brooklyn-server/README.md deleted file mode 100644 index 07f69e6..0000000 --- a/brooklyn-server/README.md +++ /dev/null @@ -1,7 +0,0 @@ - -# [](http://brooklyn.apache.org/) - -### Apache Brooklyn Server Sub-Project - -This repo contains the core elements to run a Brooklyn server, -from the API and utils through to the core implementation and the REST server. http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/pom.xml ---------------------------------------------------------------------- diff --git a/brooklyn-server/api/pom.xml b/brooklyn-server/api/pom.xml deleted file mode 100644 index f1994f4..0000000 --- a/brooklyn-server/api/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - - <artifactId>brooklyn-api</artifactId> - <name>Brooklyn API</name> - - <description> - API classes for Brooklyn - </description> - - <parent> - <groupId>org.apache.brooklyn</groupId> - <artifactId>brooklyn-parent</artifactId> - <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> - <relativePath>../parent/pom.xml</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.apache.brooklyn</groupId> - <artifactId>brooklyn-utils-common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.brooklyn</groupId> - <artifactId>brooklyn-utils-test-support</artifactId> - <scope>test</scope> - <version>${project.version}</version> - </dependency> - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java ---------------------------------------------------------------------- diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java deleted file mode 100644 index b47d4b1..0000000 --- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java +++ /dev/null @@ -1,141 +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.api.catalog; - -import java.util.Collection; -import java.util.NoSuchElementException; - -import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Predicate; - -public interface BrooklynCatalog { - /** - * Version set in catalog when creator does not supply a version, to mean a low priority item; - * and used when requesting to indicate the best version. - * (See {@link #getCatalogItem(String, String)} for discussion of the best version.) - */ - static String DEFAULT_VERSION = "0.0.0_DEFAULT_VERSION"; - - /** @return The item matching the given given - * {@link CatalogItem#getSymbolicName() symbolicName} - * and optionally {@link CatalogItem#getVersion()}, - * taking the best version if the version is {@link #DEFAULT_VERSION} or null, - * returning null if no matches are found. */ - CatalogItem<?,?> getCatalogItem(String symbolicName, String version); - - /** @return Deletes the item with the given {@link CatalogItem#getSymbolicName() - * symbolicName} and version - * @throws NoSuchElementException if not found */ - void deleteCatalogItem(String symbolicName, String version); - - /** variant of {@link #getCatalogItem(String, String)} which checks (and casts) type for convenience - * (returns null if type does not match) */ - <T,SpecT> CatalogItem<T,SpecT> getCatalogItem(Class<T> type, String symbolicName, String version); - - /** @return All items in the catalog */ - <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems(); - - /** convenience for filtering items in the catalog; see CatalogPredicates for useful filters */ - <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems(Predicate<? super CatalogItem<T,SpecT>> filter); - - /** persists the catalog item to the object store, if persistence is enabled */ - public void persist(CatalogItem<?, ?> catalogItem); - - /** @return The classloader which should be used to load classes and entities; - * this includes all the catalog's classloaders in the right order. - * This is a wrapper which will update as the underlying catalog items change, - * so it is safe for callers to keep a handle on this. */ - public ClassLoader getRootClassLoader(); - - /** creates a spec for the given catalog item, throwing exceptions if any problems */ - // TODO this should be cached on the item and renamed getSpec(...), else we re-create it too often (every time catalog is listed) - <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createSpec(CatalogItem<T, SpecT> item); - - /** - * Adds an item (represented in yaml) to the catalog. - * Fails if the same version exists in catalog. - * - * @throws IllegalArgumentException if the yaml was invalid - * @deprecated since 0.7.0 use {@link #addItems(String, boolean)} - */ - @Deprecated - CatalogItem<?,?> addItem(String yaml); - - /** - * Adds an item (represented in yaml) to the catalog. - * - * @param forceUpdate If true allows catalog update even when an - * item exists with the same symbolicName and version - * - * @throws IllegalArgumentException if the yaml was invalid - * @deprecated since 0.7.0 use {@link #addItems(String, boolean)} - */ - @Deprecated - CatalogItem<?,?> addItem(String yaml, boolean forceUpdate); - - /** - * Adds items (represented in yaml) to the catalog. - * Fails if the same version exists in catalog. - * - * @throws IllegalArgumentException if the yaml was invalid - */ - Iterable<? extends CatalogItem<?,?>> addItems(String yaml); - - /** - * Adds items (represented in yaml) to the catalog. - * - * @param forceUpdate If true allows catalog update even when an - * item exists with the same symbolicName and version - * - * @throws IllegalArgumentException if the yaml was invalid - */ - Iterable<? extends CatalogItem<?,?>> addItems(String yaml, boolean forceUpdate); - - /** - * adds an item to the 'manual' catalog; - * this does not update the classpath or have a record to the java Class - * - * @deprecated since 0.7.0 Construct catalogs with yaml (referencing OSGi bundles) instead - */ - // TODO maybe this should stay on the API? -AH Apr 2015 - @Deprecated - void addItem(CatalogItem<?,?> item); - - /** - * Creates a catalog item and adds it to the 'manual' catalog, - * with the corresponding Class definition (loaded by a classloader) - * registered and available in the classloader. - * <p> - * Note that the class will be available for this session only, - * although the record of the item will appear in the catalog DTO if exported, - * so it is recommended to edit the 'manual' catalog DTO if using it to - * generate a catalog, either adding the appropriate classpath URL or removing this entry. - * - * @deprecated since 0.7.0 Construct catalogs with OSGi bundles instead. - * This is used in a handful of tests which should be rewritten to refer to OSGi bundles. - */ - @Deprecated - @VisibleForTesting - CatalogItem<?,?> addItem(Class<?> clazz); - - void reset(Collection<CatalogItem<?, ?>> entries); - -} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java ---------------------------------------------------------------------- diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java deleted file mode 100644 index 1c6b680..0000000 --- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java +++ /dev/null @@ -1,42 +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.api.catalog; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * annotation that can be placed on an Application (template), entity or policy - * to give metadata for when used in a catalog and to indicate inclusion in annotation-scanned catalogs - * <p> - * the "id" field used in the catalog is not exposed here but is always taken as the Class.getName() of the annotated item - * if loaded from an annotation. (the "type" field unsurprisingly is given the same value). - * {@link #name()}, if not supplied, is the SimpleName of the class. - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.TYPE }) -public @interface Catalog { - - String name() default ""; - String description() default ""; - String iconUrl() default ""; - -}
