http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java b/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java new file mode 100644 index 0000000..f13c1ff --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java @@ -0,0 +1,35 @@ +/* + * 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.location; + + +/** + * Indicates no machines are available in a given location. + */ +public class NoMachinesAvailableException extends LocationNotAvailableException { + private static final long serialVersionUID = 1079817235289265761L; + + public NoMachinesAvailableException(String s) { + super(s); + } + + public NoMachinesAvailableException(String s, Throwable throwable) { + super(s, throwable); + } +}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java new file mode 100644 index 0000000..9baac9e --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java @@ -0,0 +1,46 @@ +/* + * 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.location; + +import javax.annotation.Nullable; + +public interface OsDetails { + + /** The name of the operating system, e.g. "Debian" or "Red Hat Enterprise Linux Server" */ + @Nullable + String getName(); + + /** + * The version of the operating system. Generally numeric (e.g. "6.3") but occasionally + * alphabetic (e.g. Debian's "Squeeze"). + */ + @Nullable + String getVersion(); + + /** The operating system's architecture, e.g. "x86" or "x86_64" */ + @Nullable + String getArch(); + + boolean is64bit(); + + boolean isWindows(); + boolean isLinux(); + boolean isMac(); + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java b/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java new file mode 100644 index 0000000..108f0dd --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java @@ -0,0 +1,48 @@ +/* + * 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.location; + +/** + * A range of ports (indicator for Location and other APIs). + * Using methods {@code PortRanges.fromXxx(...)} this is adaptable from a number, a string, or a collection of numbers or a strings. + * String may be of the form: + * <li> "80": just 80 + * <li> "8080-8090": limited range sequentially; ie try 8080, then 8081, ..., then 8090, then give up + * <li> "8080-8000": as above, but descending; ie try 8080, then 8079, ..., then 8000, then give up + * <li> "8000+": unlimited range sequentially; ie try 8000, then 8001, then 8002, etc + * <li> "80,8080,8000,8080-8099": different ranges, in order; ie try 80, then 8080, then 8000, then 8080 (again), then 8081, ..., then 8099, then give up + * Ranges (but not lists) may be preceeded by "!" to indicate a randomly selected port: + * + * @see brooklyn.location.basic.PortRanges + */ +//MAYDO could have: <li> "~32168-65535" (or "~32168-"): try randomly selected numbers in range 32168-65535 (MAX_PORT) until all have been tried +public interface PortRange extends Iterable<Integer> { + /** + * Whether there are any ports in the range. + */ + boolean isEmpty(); + + /** + * Note: this method is only here for use with "groovy truth". Users are strongly discouraged + * from calling it directly. + * + * @return {@code !isEmpty()}; i.e. true if there is at least one port in the range; false otherwise + */ + boolean asBoolean(); +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java b/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java new file mode 100644 index 0000000..02c4398 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.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.location; + +/** Mixin interface for location which allows it to supply ports from a given range */ +public interface PortSupplier { + + /** + * Reserve a specific port for an application. If your application requires a specific port - for example, port 80 for a web + * server - you should reserve this port before starting your application. Using this method, you will be able to detect if + * another application has already claimed this port number. + * + * @param portNumber the required port number. + * @return {@code true} if the port was successfully reserved; {@code false} if it has been previously reserved. + */ + boolean obtainSpecificPort(int portNumber); + + /** + * Reserve a port for your application, with a port number in a specific range. If your application requires a port, but it does + * not mind exactly which port number - for example, a port for internal JMX monitoring - call this method. + * + * @param range the range of acceptable port numbers. + * @return the port number that has been reserved, or -1 if there was no available port in the acceptable range. + */ + int obtainPort(PortRange range); + + /** + * Release a previously reserved port. + * + * @param portNumber the port number from a call to {@link #obtainPort(PortRange)} or {@link #obtainSpecificPort(int)} + */ + void releasePort(int portNumber); + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java new file mode 100644 index 0000000..25bd209 --- /dev/null +++ b/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java @@ -0,0 +1,44 @@ +/* + * 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.location; + +import java.util.Map; + +/** + * A location that is able to provision new locations within it. + */ +public interface ProvisioningLocation<T extends Location> extends Location { + /** + * Obtain a new (sub)-location in the location represented by this class. + * + * @param flags Constraints and details of the location to be provisioned + * @return the location provisioned + * @throws LocationNotAvailableException if could not provision such a location + */ + T obtain(Map<?,?> flags) throws LocationNotAvailableException; + + /** + * Release a previously-obtained location. + * + * @param location a location previously obtained + * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released. + */ + void release(T machine); + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/management/AccessController.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/management/AccessController.java b/api/src/main/java/org/apache/brooklyn/api/management/AccessController.java index a8b6939..d326045 100644 --- a/api/src/main/java/org/apache/brooklyn/api/management/AccessController.java +++ b/api/src/main/java/org/apache/brooklyn/api/management/AccessController.java @@ -19,8 +19,7 @@ package org.apache.brooklyn.api.management; import org.apache.brooklyn.api.entity.Entity; - -import org.apache.brooklyn.location.Location; +import org.apache.brooklyn.api.location.Location; import com.google.common.annotations.Beta; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/management/LocationManager.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/management/LocationManager.java b/api/src/main/java/org/apache/brooklyn/api/management/LocationManager.java index 9e4377c..379ab62 100644 --- a/api/src/main/java/org/apache/brooklyn/api/management/LocationManager.java +++ b/api/src/main/java/org/apache/brooklyn/api/management/LocationManager.java @@ -21,8 +21,8 @@ package org.apache.brooklyn.api.management; import java.util.Collection; import java.util.Map; -import org.apache.brooklyn.location.Location; -import org.apache.brooklyn.location.LocationSpec; +import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.location.LocationSpec; /** * For managing and querying entities. http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/management/ManagementContext.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/management/ManagementContext.java b/api/src/main/java/org/apache/brooklyn/api/management/ManagementContext.java index 615982b..84085fc 100644 --- a/api/src/main/java/org/apache/brooklyn/api/management/ManagementContext.java +++ b/api/src/main/java/org/apache/brooklyn/api/management/ManagementContext.java @@ -30,11 +30,11 @@ import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity; import org.apache.brooklyn.api.entity.drivers.EntityDriverManager; import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager; import org.apache.brooklyn.api.entity.rebind.RebindManager; +import org.apache.brooklyn.api.location.LocationRegistry; import org.apache.brooklyn.api.management.entitlement.EntitlementManager; import org.apache.brooklyn.api.management.ha.HighAvailabilityManager; import brooklyn.config.StringConfigMap; -import org.apache.brooklyn.location.LocationRegistry; import brooklyn.util.guava.Maybe; import com.google.common.annotations.Beta; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/AddressableLocation.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/AddressableLocation.java b/api/src/main/java/org/apache/brooklyn/location/AddressableLocation.java deleted file mode 100644 index ba44467..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/AddressableLocation.java +++ /dev/null @@ -1,43 +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.location; - -import java.net.InetAddress; - -/** A location that has an IP address. - * <p> - * This IP address may be a machine (usually the MachineLocation sub-interface), - * or often an entry point for a service. - */ -public interface AddressableLocation extends Location { - - /** - * Return the single most appropriate address for this location. - * (An implementation or sub-interface definition may supply more information - * on the precise semantics of the address.) - * - * Should not return null, but in some "special cases" (e.g. CloudFoundryLocation it - * may return null if the location is not configured correctly). Users should expect - * a non-null result and treat null as a programming error or misconfiguration. - * Implementors of this interface should strive to not return null (and then we'll - * remove this caveat from the javadoc!). - */ - InetAddress getAddress(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/BasicMachineLocationCustomizer.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/BasicMachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/location/BasicMachineLocationCustomizer.java deleted file mode 100644 index bbf53d3..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/BasicMachineLocationCustomizer.java +++ /dev/null @@ -1,41 +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.location; - -import com.google.common.annotations.Beta; - -/** - * A default no-op implementation, which can be extended to override the appropriate methods. - * - * Sub-classing will give the user some protection against future API changes - note that - * {@link MachineLocationCustomizer} is marked {@link Beta}. - */ -@Beta -public class BasicMachineLocationCustomizer implements MachineLocationCustomizer { - - @Override - public void customize(MachineLocation machine) { - // no-op - } - - @Override - public void preRelease(MachineLocation machine) { - // no-op - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/HardwareDetails.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/HardwareDetails.java b/api/src/main/java/org/apache/brooklyn/location/HardwareDetails.java deleted file mode 100644 index 58acb0b..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/HardwareDetails.java +++ /dev/null @@ -1,40 +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.location; - -import javax.annotation.Nullable; - -/** - * @since 0.7.0 - */ -public interface HardwareDetails { - - /** - * The number of CPUs on the machine - */ - @Nullable - Integer getCpuCount(); - - /** - * Amount of RAM in megabytes - */ - @Nullable - Integer getRam(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/Location.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/Location.java b/api/src/main/java/org/apache/brooklyn/location/Location.java deleted file mode 100644 index 88a5bfb..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/Location.java +++ /dev/null @@ -1,146 +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.location; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Map; - -import org.apache.brooklyn.api.basic.BrooklynObject; - -import brooklyn.config.ConfigKey; -import brooklyn.config.ConfigKey.HasConfigKey; - -/** - * A location that an entity can be in. Examples of locations include a single machine - * or a pool of machines, or a region within a given cloud. - * - * See {@link brooklyn.entity.trait.Startable#start(Collection)}. - * - * Locations may not be {@link Serializable} in subsequent releases! - */ -public interface Location extends Serializable, BrooklynObject { - - /** - * A unique id for this location. - */ - @Override - String getId(); - - /** - * Get the name assigned to this location. - * - * @return the name assigned to the location. - * @since 0.6 (previously getName()) - */ - @Override - String getDisplayName(); - - /** - * Get the 'parent' of this location. Locations are organized into a tree hierarchy, and this method will return a reference - * to the parent of this location, or {@code null} if this location is the tree root. - * - * @return a reference to the parent of this location, or {@code null} if this location is the tree root. - * @since 0.6 (previously getParentLocation()) - */ - Location getParent(); - - /** - * Get the 'children' of this location. Locations are organized into a tree hierarchy, and this method will return a - * collection containing the children of this location. This collection is an unmodifiable view of the data. - * - * @return a collection containing the children of this location. - * @since 0.6 (previously getChildLocations()) - */ - Collection<Location> getChildren(); - - /** - * Set the 'parent' of this location. If this location was previously a child of a different location, it is removed from - * the other location first. It is valid to pass in {@code null} to indicate that the location should be disconnected - * from its parent. - * - * Adds this location as a child of the new parent (see {@code getChildLocations()}). - * - * @param newParent the new parent location object, or {@code null} to clear the parent reference. - * @since 0.6 (previously setParentLocation(Location)) - */ - void setParent(Location newParent); - - /** - * @return meta-data about the location (usually a long line, or a small number of lines). - * - * @since 0.6 - */ - String toVerboseString(); - - /** - * Answers true if this location equals or is an ancestor of the given location. - */ - boolean containsLocation(Location potentialDescendent); - - /** - * Returns configuration set at this location or inherited or default. - * - * Convenience method for {@code config().get(key)} - */ - <T> T getConfig(ConfigKey<T> key); - - /** - * Convenience method for {@code config().get(key)} - * - * @see {@link #getConfig(ConfigKey)} - */ - <T> T getConfig(HasConfigKey<T> key); - - /** - * True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false). - * - * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getRaw(key).isPresent()} - */ - @Deprecated - boolean hasConfig(ConfigKey<?> key, boolean includeInherited); - - /** - * Returns all config set, either inherited (argument true) or locally-only (argument false). - * - * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().getBag()} - */ - @Deprecated - public Map<String,Object> getAllConfig(boolean includeInherited); - - /** - * Whether this location has support for the given extension type. - * See additional comments in {@link #getExtension(Class)}. - * - * @throws NullPointerException if extensionType is null - */ - boolean hasExtension(Class<?> extensionType); - - /** - * Returns an extension of the given type. Note that the type must be an exact match for - * how the extension was registered (e.g. {@code getExtension(Object.class)} will not match - * anything, even though registered extension extend {@link Object}. - * <p> - * This will not look at extensions of {@link #getParent()}. - * - * @throws IllegalArgumentException if this location does not support the given extension type - * @throws NullPointerException if extensionType is null - */ - <T> T getExtension(Class<T> extensionType); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationDefinition.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationDefinition.java b/api/src/main/java/org/apache/brooklyn/location/LocationDefinition.java deleted file mode 100644 index 3dd58f6..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationDefinition.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.location; - -import java.util.Map; - -import org.apache.brooklyn.api.management.ManagementContext; - -/** - * Defines a location, where the {@link #getSpec()} is like a serialized representation - * of the location so that Brooklyn can create a corresponding location. - * - * Examples include a complete description (e.g. giving a list of machines in a pool), or - * a name that matches a named location defined in the brooklyn poperties. - * - * Users are not expected to implement this, or to use the interface directly. See - * {@link LocationRegistry#resolve(String)} and {@link ManagementContext#getLocationRegistry()}. - */ -public interface LocationDefinition { - - public String getId(); - public String getName(); - public String getSpec(); - public Map<String,Object> getConfig(); - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationNotAvailableException.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationNotAvailableException.java b/api/src/main/java/org/apache/brooklyn/location/LocationNotAvailableException.java deleted file mode 100644 index 543fb36..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationNotAvailableException.java +++ /dev/null @@ -1,35 +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.location; - - -/** - * Indicates that a {@link ProvisioningLocation} is not able to provision a requested location - */ -public class LocationNotAvailableException extends Exception { - private static final long serialVersionUID = 1079817235289265761L; - - public LocationNotAvailableException(String s) { - super(s); - } - - public LocationNotAvailableException(String s, Throwable throwable) { - super(s, throwable); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationRegistry.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationRegistry.java b/api/src/main/java/org/apache/brooklyn/location/LocationRegistry.java deleted file mode 100644 index 83096d1..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationRegistry.java +++ /dev/null @@ -1,128 +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.location; - -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; - -import javax.annotation.Nullable; - -import brooklyn.util.guava.Maybe; - -import com.google.common.annotations.Beta; - -/** - * The registry of the sorts of locations that brooklyn knows about. Given a - * {@LocationDefinition} or a {@link String} representation of a spec, this can - * be used to create a {@link Location} instance. - */ -@SuppressWarnings("rawtypes") -public interface LocationRegistry { - - /** map of ID (possibly randomly generated) to the definition (spec, name, id, and props; - * where spec is the spec as defined, for instance possibly another named:xxx location) */ - public Map<String,LocationDefinition> getDefinedLocations(); - - /** returns a LocationDefinition given its ID (usually a random string), or null if none */ - public LocationDefinition getDefinedLocationById(String id); - - /** returns a LocationDefinition given its name (e.g. for named locations, supply the bit after the "named:" prefix), - * or null if none */ - public LocationDefinition getDefinedLocationByName(String name); - - /** adds or updates the given defined location */ - public void updateDefinedLocation(LocationDefinition l); - - /** removes the defined location from the registry (applications running there are unaffected) */ - public void removeDefinedLocation(String id); - - /** Returns a fully populated (config etc) location from the given definition, with optional add'l flags. - * the location will be managed by default, unless the manage parameter is false, - * or the manage parameter is null and the CREATE_UNMANAGED flag is set. - * <p> - * The manage parameter is {@link Boolean} so that null can be used to say rely on anything in the flags. - * - * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */ - @Beta - public Maybe<Location> resolve(LocationDefinition ld, Boolean manage, Map locationFlags); - - /** As {@link #resolve(LocationDefinition, Boolean, Map), with the location managed, and no additional flags, - * unwrapping the result (throwing if not resolvable) */ - public Location resolve(LocationDefinition l); - - /** Returns a location created from the given spec, which might correspond to a definition, or created on-the-fly. - * Optional flags can be passed through to underlying the location. - * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */ - @Beta - public Maybe<Location> resolve(String spec, Boolean manage, Map locationFlags); - - /** efficiently returns for inspection only a fully populated (config etc) location from the given definition; - * the value might be unmanaged so it is not meant for any use other than inspection, - * but callers should prefer this when they don't wish to create a new location which will be managed in perpetuity! - * - * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */ - @Deprecated - public Location resolveForPeeking(LocationDefinition l); - - /** returns fully populated (config etc) location from the given definition, with overrides; - * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */ - @Deprecated - public Location resolve(LocationDefinition l, Map<?,?> locationFlags); - - /** See {@link #resolve(String, Boolean, Map)}; asks for the location to be managed, and supplies no additional flags, - * and unwraps the result (throwing if the spec cannot be resolve) */ - public Location resolve(String spec); - - /** Returns true/false depending whether spec seems like a valid location, - * that is it has a chance of being resolved (depending on the spec) but NOT guaranteed, - * as it is not passed to the spec; - * see {@link #resolve(String, Boolean, Map)} which has stronger guarantees - * @deprecated since 0.7.0, not really needed, and semantics are weak; use {@link #resolve(String, Boolean, Map)} */ - @Deprecated - public boolean canMaybeResolve(String spec); - - /** As {@link #resolve(String, Boolean, Map)}, but unwrapped - * @throws NoSuchElementException if the spec cannot be resolved */ - public Location resolve(String spec, @Nullable Map locationFlags); - - /** as {@link #resolve(String)} but returning null (never throwing) - * @deprecated since 0.7.0 use {@link #resolve(String, Boolean, Map)} */ - @Deprecated - public Location resolveIfPossible(String spec); - - /** - * As {@link #resolve(String)} but takes collections (of strings or locations) - * <p> - * Expects a collection of elements being individual location spec strings or locations, - * and returns a list of resolved (newly created and managed) locations. - * <p> - * From 0.7.0 this no longer flattens lists (nested lists are disallowed) - * or parses comma-separated elements (they are resolved as-is) - */ - public List<Location> resolve(Iterable<?> spec); - - /** Takes a string, interpreted as a comma-separated (or JSON style, when you need internal double quotes or commas) list; - * or a list, passed to {@link #resolve(Iterable)}; or null/empty (empty list), - * and returns a list of resolved (created and managed) locations */ - public List<Location> resolveList(Object specList); - - public Map getProperties(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationResolver.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationResolver.java b/api/src/main/java/org/apache/brooklyn/location/LocationResolver.java deleted file mode 100644 index 1b9bd18..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationResolver.java +++ /dev/null @@ -1,57 +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.location; - -import java.util.Map; - -import org.apache.brooklyn.api.management.ManagementContext; - -import com.google.common.annotations.Beta; - -/** - * Provides a way of creating location instances of a particular type. - */ -public interface LocationResolver { - - void init(ManagementContext managementContext); - - /** the prefix that this resolver will attend to */ - String getPrefix(); - - /** whether the spec is something which should be passed to this resolver */ - boolean accepts(String spec, LocationRegistry registry); - - /** - * Similar to {@link #newLocationFromString(Map, String)} - * but passing in a reference to the registry itself (from which the base properties are discovered) - * and including flags (e.g. user, key, cloud credential) which are known to be for this location. - * <p> - * introduced to support locations which refer to other locations, e.g. NamedLocationResolver - **/ - @SuppressWarnings("rawtypes") - Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry); - - /** @since 0.7.0 exploring this as a mechanism to disable locations */ - @Beta - public interface EnableableLocationResolver extends LocationResolver { - /** whether the location is enabled */ - boolean isEnabled(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationSpec.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationSpec.java b/api/src/main/java/org/apache/brooklyn/location/LocationSpec.java deleted file mode 100644 index 6713cb7..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationSpec.java +++ /dev/null @@ -1,229 +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.location; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collections; -import java.util.Map; - -import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec; -import org.apache.brooklyn.api.management.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.config.ConfigKey; -import brooklyn.config.ConfigKey.HasConfigKey; - -import com.google.common.collect.Maps; - -/** - * Gives details of a location to be created. It describes the location's configuration, and is - * reusable to create multiple locations with the same configuration. - * - * To create a LocationSpec, it is strongly encouraged to use {@code create(...)} methods. - * - * @param <T> The type of location to be created - * - * @author aled - */ -public class LocationSpec<T extends Location> extends AbstractBrooklynObjectSpec<T,LocationSpec<T>> { - - // TODO Would like to add `configure(ConfigBag)`, but `ConfigBag` is in core rather than api - - private static final Logger log = LoggerFactory.getLogger(LocationSpec.class); - - private final static long serialVersionUID = 1L; - - /** - * Creates a new {@link LocationSpec} instance for a location of the given type. The returned - * {@link LocationSpec} can then be customized. - * - * @param type A {@link Location} class - */ - public static <T extends Location> LocationSpec<T> create(Class<T> type) { - return new LocationSpec<T>(type); - } - - /** - * Creates a new {@link LocationSpec} instance with the given config, for a location of the given type. - * - * This is primarily for groovy code; equivalent to {@code LocationSpec.create(type).configure(config)}. - * - * @param config The spec's configuration (see {@link LocationSpec#configure(Map)}). - * @param type A {@link Location} class - */ - public static <T extends Location> LocationSpec<T> create(Map<?,?> config, Class<T> type) { - return LocationSpec.create(type).configure(config); - } - - /** - * Copies entity spec so its configuration can be overridden without modifying the - * original entity spec. - */ - public static <T extends Location> LocationSpec<T> create(LocationSpec<T> spec) { - // need this to get LocationSpec<T> rather than LocationSpec<? extends T> - @SuppressWarnings("unchecked") - Class<T> exactType = (Class<T>)spec.getType(); - - LocationSpec<T> result = create(exactType) - .displayName(spec.getDisplayName()) - .tags(spec.getTags()) - .configure(spec.getConfig()) - .configure(spec.getFlags()) - .catalogItemId(spec.getCatalogItemId()) - .extensions(spec.getExtensions()); - - if (spec.getParent() != null) result.parent(spec.getParent()); - - return (LocationSpec<T>) result; - } - - private String id; - private Location parent; - private final Map<String, Object> flags = Maps.newLinkedHashMap(); - private final Map<ConfigKey<?>, Object> config = Maps.newLinkedHashMap(); - private final Map<Class<?>, Object> extensions = Maps.newLinkedHashMap(); - - protected LocationSpec(Class<T> type) { - super(type); - } - - protected void checkValidType(Class<? extends T> type) { - checkIsImplementation(type, Location.class); - checkIsNewStyleImplementation(type); - } - - /** - * @deprecated since 0.7.0; instead let the management context pick a random+unique id - */ - @Deprecated - public LocationSpec<T> id(String val) { - id = val; - return this; - } - - public LocationSpec<T> parent(Location val) { - parent = checkNotNull(val, "parent"); - return this; - } - - public LocationSpec<T> configure(Map<?,?> val) { - for (Map.Entry<?, ?> entry: val.entrySet()) { - if (entry.getKey()==null) throw new NullPointerException("Null key not permitted"); - if (entry.getKey() instanceof CharSequence) - flags.put(entry.getKey().toString(), entry.getValue()); - else if (entry.getKey() instanceof ConfigKey<?>) - config.put((ConfigKey<?>)entry.getKey(), entry.getValue()); - else if (entry.getKey() instanceof HasConfigKey<?>) - config.put(((HasConfigKey<?>)entry.getKey()).getConfigKey(), entry.getValue()); - else { - log.warn("Spec "+this+" ignoring unknown config key "+entry.getKey()); - } - } - return this; - } - - public LocationSpec<T> configure(CharSequence key, Object val) { - flags.put(checkNotNull(key, "key").toString(), val); - return this; - } - - public <V> LocationSpec<T> configure(ConfigKey<V> key, V val) { - config.put(checkNotNull(key, "key"), val); - return this; - } - - public <V> LocationSpec<T> configureIfNotNull(ConfigKey<V> key, V val) { - return (val != null) ? configure(key, val) : this; - } - - public <V> LocationSpec<T> configure(ConfigKey<V> key, Task<? extends V> val) { - config.put(checkNotNull(key, "key"), val); - return this; - } - - public <V> LocationSpec<T> configure(HasConfigKey<V> key, V val) { - config.put(checkNotNull(key, "key").getConfigKey(), val); - return this; - } - - public <V> LocationSpec<T> configure(HasConfigKey<V> key, Task<? extends V> val) { - config.put(checkNotNull(key, "key").getConfigKey(), val); - return this; - } - - public <V> LocationSpec<T> removeConfig(ConfigKey<V> key) { - config.remove( checkNotNull(key, "key") ); - return this; - } - - public <E> LocationSpec<T> extension(Class<E> extensionType, E extension) { - extensions.put(checkNotNull(extensionType, "extensionType"), checkNotNull(extension, "extension")); - return this; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public <E> LocationSpec<T> extensions(Map<Class<?>, ?> extensions) { - for (Map.Entry<Class<?>, ?> entry : extensions.entrySet()) { - extension((Class)entry.getKey(), entry.getValue()); - } - return this; - } - - /** - * @return The id of the location to be created, or null if brooklyn can auto-generate an id - * - * @deprecated since 0.7.0; instead let the management context pick a random+unique id - */ - @Deprecated - public String getId() { - return id; - } - - /** - * @return The location's parent - */ - public Location getParent() { - return parent; - } - - /** - * @return Read-only construction flags - * @see SetFromFlag declarations on the location type - */ - public Map<String, ?> getFlags() { - return Collections.unmodifiableMap(flags); - } - - /** - * @return Read-only configuration values - */ - public Map<ConfigKey<?>, Object> getConfig() { - return Collections.unmodifiableMap(config); - } - - /** - * @return Read-only extension values - */ - public Map<Class<?>, Object> getExtensions() { - return Collections.unmodifiableMap(extensions); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/LocationType.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/LocationType.java b/api/src/main/java/org/apache/brooklyn/location/LocationType.java deleted file mode 100644 index d7b52ed..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/LocationType.java +++ /dev/null @@ -1,32 +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.location; - -import org.apache.brooklyn.api.basic.BrooklynType; - -import com.google.common.annotations.Beta; - -/** - * Gives type information for a {@link Location}. It is immutable. - - * @since 0.7.0 - */ -@Beta -public interface LocationType extends BrooklynType { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/MachineDetails.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/MachineDetails.java b/api/src/main/java/org/apache/brooklyn/location/MachineDetails.java deleted file mode 100644 index c72d6d9..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/MachineDetails.java +++ /dev/null @@ -1,34 +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.location; - -import javax.annotation.Nonnull; - -/** - * @since 0.7.0 - */ -public interface MachineDetails { - - @Nonnull - HardwareDetails getHardwareDetails(); - - @Nonnull - OsDetails getOsDetails(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/MachineLocation.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/MachineLocation.java b/api/src/main/java/org/apache/brooklyn/location/MachineLocation.java deleted file mode 100644 index aef8d04..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/MachineLocation.java +++ /dev/null @@ -1,46 +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.location; - -import java.net.InetAddress; - -import brooklyn.util.net.HasNetworkAddresses; - -/** - * A location that is a machine. - * - * This interface marks a {@link Location} being a network node with an IP address, - * and supports appropriate operations on the node. - */ -public interface MachineLocation extends AddressableLocation, HasNetworkAddresses { - /** - * @return the machine's network address. - */ - InetAddress getAddress(); - - /** @deprecated since 0.7.0. Use getMachineDetails().getOsDetails() instead. */ - @Deprecated - OsDetails getOsDetails(); - - /* - * @return hardware and operating system-specific details for the machine. - */ - MachineDetails getMachineDetails(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/MachineLocationCustomizer.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/MachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/location/MachineLocationCustomizer.java deleted file mode 100644 index 1c81896..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/MachineLocationCustomizer.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.location; - -import com.google.common.annotations.Beta; - -/** - * Customization hooks to allow apps to perform specific customisation of obtained machines. - * <p> - * Users are strongly encouraged to sub-class {@link BasicMachineLocationCustomizer}, to give - * some protection against this {@link Beta} API changing in future releases. - */ -@Beta -public interface MachineLocationCustomizer { - - /** - * Override to configure the given machine once it has been created (prior to any use). - */ - void customize(MachineLocation machine); - - /** - * Override to handle machine-related cleanup prior to {@link MachineProvisioningLocation} - * releasing the machine. - */ - void preRelease(MachineLocation machine); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/MachineManagementMixins.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/MachineManagementMixins.java b/api/src/main/java/org/apache/brooklyn/location/MachineManagementMixins.java deleted file mode 100644 index 7e0de8a..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/MachineManagementMixins.java +++ /dev/null @@ -1,92 +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.location; - -import java.util.Map; - -import com.google.common.annotations.Beta; - -/** - * Defines mixins for interesting locations. - */ -public class MachineManagementMixins { - - public interface RichMachineProvisioningLocation<T extends MachineLocation> extends - MachineProvisioningLocation<T>, ListsMachines, GivesMachineMetadata, KillsMachines {} - - public interface ListsMachines { - /** - * @return A map of machine ID to metadata record for all machines known in a given cloud location. - */ - Map<String,MachineMetadata> listMachines(); - } - - public interface GivesMachineMetadata { - /** - * @return the {@link MachineMetadata} for a given (brooklyn) machine location instance, - * or null if not matched. - */ - MachineMetadata getMachineMetadata(MachineLocation location); - } - - public interface KillsMachines { - /** Kills the indicated machine; throws if not recognised or possible */ - void killMachine(MachineLocation machine); - - /** Kills the machine indicated by the given (server-side) machine id; - * note, the ID is the _cloud-service_ ID, - * that is, pass in getMetadata(machineLocation).getId() not the machineLocation.getId() */ - void killMachine(String cloudServiceId); - } - - /** very lightweight machine record */ - public interface MachineMetadata { - /** The cloud service ID -- distinct from any Brooklyn {@link Location#getId()} */ - String getId(); - String getName(); - String getPrimaryIp(); - Boolean isRunning(); - /** original metadata object, if available; e.g. ComputeMetadata when using jclouds */ - Object getOriginalMetadata(); - } - - /** - * Implement to indicate that a location can suspend and resume machines. - */ - @Beta - public interface SuspendResumeLocation extends SuspendsMachines, ResumesMachines {}; - - - @Beta - public interface SuspendsMachines { - /** - * Suspend the indicated machine. - */ - void suspendMachine(MachineLocation location); - } - - @Beta - public interface ResumesMachines { - /** - * Resume the indicated machine. - */ - void resumeMachine(MachineLocation location); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/MachineProvisioningLocation.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/MachineProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/location/MachineProvisioningLocation.java deleted file mode 100644 index c3bc346..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/MachineProvisioningLocation.java +++ /dev/null @@ -1,72 +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.location; - -import java.util.Collection; -import java.util.Map; - -/** - * A location that is able to provision new machines within its location. - * - * This interface extends {@link Location} to add the ability to provision {@link MachineLocation}s in this location. - */ -public interface MachineProvisioningLocation<T extends MachineLocation> extends ProvisioningLocation<T> { - /** - * Obtain a machine in this location. - * - * @param flags Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers). - * "callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel) - * @return a machine that is a child of this location. - * @throws NoMachinesAvailableException if there are no machines available in this location (or impls may return null, but that is discouraged) - */ - @Override - T obtain(Map<?,?> flags) throws NoMachinesAvailableException; - - /** - * Creates a new location of the same type, but with additional creation instructions in the form of flags, - * e.g. for specifying subnets, security groups, etc - * <p> - * Implementers who wish to subclass this provisioning location for additional functionality - * in a specific cloud can use the relevant implementation of this method as a guide. - */ - MachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags); - - /** - * Release a previously-obtained machine. - * - * @param machine a {@link MachineLocation} previously obtained from a call to {@link #obtain()} - * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released. - */ - @Override - void release(T machine); - - /** - * Gets flags, suitable as an argument to {@link #obtain(Map)}. The tags provided give - * hints about the machine required. The provisioning-location could be configured to - * understand those tags. - * - * For example, an AWS-location could be configured to understand that a particular entity - * type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the - * required image id. - * - * @param tags - * @return - */ - Map<String,Object> getProvisioningFlags(Collection<String> tags); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/NoMachinesAvailableException.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/NoMachinesAvailableException.java b/api/src/main/java/org/apache/brooklyn/location/NoMachinesAvailableException.java deleted file mode 100644 index d8f16ce..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/NoMachinesAvailableException.java +++ /dev/null @@ -1,35 +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.location; - - -/** - * Indicates no machines are available in a given location. - */ -public class NoMachinesAvailableException extends LocationNotAvailableException { - private static final long serialVersionUID = 1079817235289265761L; - - public NoMachinesAvailableException(String s) { - super(s); - } - - public NoMachinesAvailableException(String s, Throwable throwable) { - super(s, throwable); - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/OsDetails.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/OsDetails.java b/api/src/main/java/org/apache/brooklyn/location/OsDetails.java deleted file mode 100644 index c5aea67..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/OsDetails.java +++ /dev/null @@ -1,46 +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.location; - -import javax.annotation.Nullable; - -public interface OsDetails { - - /** The name of the operating system, e.g. "Debian" or "Red Hat Enterprise Linux Server" */ - @Nullable - String getName(); - - /** - * The version of the operating system. Generally numeric (e.g. "6.3") but occasionally - * alphabetic (e.g. Debian's "Squeeze"). - */ - @Nullable - String getVersion(); - - /** The operating system's architecture, e.g. "x86" or "x86_64" */ - @Nullable - String getArch(); - - boolean is64bit(); - - boolean isWindows(); - boolean isLinux(); - boolean isMac(); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/PortRange.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/PortRange.java b/api/src/main/java/org/apache/brooklyn/location/PortRange.java deleted file mode 100644 index 25dd621..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/PortRange.java +++ /dev/null @@ -1,48 +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.location; - -/** - * A range of ports (indicator for Location and other APIs). - * Using methods {@code PortRanges.fromXxx(...)} this is adaptable from a number, a string, or a collection of numbers or a strings. - * String may be of the form: - * <li> "80": just 80 - * <li> "8080-8090": limited range sequentially; ie try 8080, then 8081, ..., then 8090, then give up - * <li> "8080-8000": as above, but descending; ie try 8080, then 8079, ..., then 8000, then give up - * <li> "8000+": unlimited range sequentially; ie try 8000, then 8001, then 8002, etc - * <li> "80,8080,8000,8080-8099": different ranges, in order; ie try 80, then 8080, then 8000, then 8080 (again), then 8081, ..., then 8099, then give up - * Ranges (but not lists) may be preceeded by "!" to indicate a randomly selected port: - * - * @see brooklyn.location.basic.PortRanges - */ -//MAYDO could have: <li> "~32168-65535" (or "~32168-"): try randomly selected numbers in range 32168-65535 (MAX_PORT) until all have been tried -public interface PortRange extends Iterable<Integer> { - /** - * Whether there are any ports in the range. - */ - boolean isEmpty(); - - /** - * Note: this method is only here for use with "groovy truth". Users are strongly discouraged - * from calling it directly. - * - * @return {@code !isEmpty()}; i.e. true if there is at least one port in the range; false otherwise - */ - boolean asBoolean(); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/PortSupplier.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/PortSupplier.java b/api/src/main/java/org/apache/brooklyn/location/PortSupplier.java deleted file mode 100644 index 24572a0..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/PortSupplier.java +++ /dev/null @@ -1,50 +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.location; - -/** Mixin interface for location which allows it to supply ports from a given range */ -public interface PortSupplier { - - /** - * Reserve a specific port for an application. If your application requires a specific port - for example, port 80 for a web - * server - you should reserve this port before starting your application. Using this method, you will be able to detect if - * another application has already claimed this port number. - * - * @param portNumber the required port number. - * @return {@code true} if the port was successfully reserved; {@code false} if it has been previously reserved. - */ - boolean obtainSpecificPort(int portNumber); - - /** - * Reserve a port for your application, with a port number in a specific range. If your application requires a port, but it does - * not mind exactly which port number - for example, a port for internal JMX monitoring - call this method. - * - * @param range the range of acceptable port numbers. - * @return the port number that has been reserved, or -1 if there was no available port in the acceptable range. - */ - int obtainPort(PortRange range); - - /** - * Release a previously reserved port. - * - * @param portNumber the port number from a call to {@link #obtainPort(PortRange)} or {@link #obtainSpecificPort(int)} - */ - void releasePort(int portNumber); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/location/ProvisioningLocation.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/location/ProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/location/ProvisioningLocation.java deleted file mode 100644 index 3cc3f92..0000000 --- a/api/src/main/java/org/apache/brooklyn/location/ProvisioningLocation.java +++ /dev/null @@ -1,44 +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.location; - -import java.util.Map; - -/** - * A location that is able to provision new locations within it. - */ -public interface ProvisioningLocation<T extends Location> extends Location { - /** - * Obtain a new (sub)-location in the location represented by this class. - * - * @param flags Constraints and details of the location to be provisioned - * @return the location provisioned - * @throws LocationNotAvailableException if could not provision such a location - */ - T obtain(Map<?,?> flags) throws LocationNotAvailableException; - - /** - * Release a previously-obtained location. - * - * @param location a location previously obtained - * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released. - */ - void release(T machine); - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/mementos/BrooklynMementoPersister.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/mementos/BrooklynMementoPersister.java b/api/src/main/java/org/apache/brooklyn/mementos/BrooklynMementoPersister.java index 8c6f7e1..4727f50 100644 --- a/api/src/main/java/org/apache/brooklyn/mementos/BrooklynMementoPersister.java +++ b/api/src/main/java/org/apache/brooklyn/mementos/BrooklynMementoPersister.java @@ -33,11 +33,11 @@ import org.apache.brooklyn.api.entity.rebind.BrooklynObjectType; import org.apache.brooklyn.api.entity.rebind.PersistenceExceptionHandler; import org.apache.brooklyn.api.entity.rebind.RebindExceptionHandler; import org.apache.brooklyn.api.entity.rebind.RebindManager; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.management.ManagementContext; import org.apache.brooklyn.policy.Enricher; import org.apache.brooklyn.policy.Policy; -import org.apache.brooklyn.location.Location; import brooklyn.util.time.Duration; import com.google.common.annotations.Beta; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/basic/BrooklynTypes.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/basic/BrooklynTypes.java b/core/src/main/java/brooklyn/basic/BrooklynTypes.java index 4ccbfd0..4423bed 100644 --- a/core/src/main/java/brooklyn/basic/BrooklynTypes.java +++ b/core/src/main/java/brooklyn/basic/BrooklynTypes.java @@ -23,13 +23,13 @@ import java.util.Map; import org.apache.brooklyn.api.basic.BrooklynObject; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.event.Sensor; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.policy.Enricher; import org.apache.brooklyn.policy.Policy; import brooklyn.config.ConfigKey; import brooklyn.enricher.basic.EnricherDynamicType; import brooklyn.entity.basic.EntityDynamicType; -import org.apache.brooklyn.location.Location; import brooklyn.policy.basic.PolicyDynamicType; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/catalog/CatalogPredicates.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/catalog/CatalogPredicates.java b/core/src/main/java/brooklyn/catalog/CatalogPredicates.java index e9778ab..e8e0e7e 100644 --- a/core/src/main/java/brooklyn/catalog/CatalogPredicates.java +++ b/core/src/main/java/brooklyn/catalog/CatalogPredicates.java @@ -25,13 +25,13 @@ import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType; import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.proxying.EntitySpec; +import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.management.ManagementContext; import org.apache.brooklyn.policy.Policy; import org.apache.brooklyn.policy.PolicySpec; import brooklyn.catalog.internal.CatalogUtils; -import org.apache.brooklyn.location.Location; -import org.apache.brooklyn.location.LocationSpec; import brooklyn.management.entitlement.Entitlements; import com.google.common.base.Function; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java index a3bb808..5dec71b 100644 --- a/core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java @@ -46,6 +46,8 @@ import org.apache.brooklyn.api.catalog.BrooklynCatalog; import org.apache.brooklyn.api.catalog.CatalogItem; import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle; import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType; +import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.management.ManagementContext; import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext; import org.apache.brooklyn.policy.Policy; @@ -54,9 +56,9 @@ import org.apache.brooklyn.policy.PolicySpec; import brooklyn.catalog.CatalogPredicates; import brooklyn.catalog.internal.CatalogClasspathDo.CatalogScanningModes; import brooklyn.config.BrooklynServerConfig; -import org.apache.brooklyn.location.Location; -import org.apache.brooklyn.location.LocationSpec; + import org.apache.brooklyn.location.basic.BasicLocationRegistry; + import brooklyn.management.internal.ManagementContextInternal; import brooklyn.util.collections.MutableList; import brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/catalog/internal/CatalogClasspathDo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/catalog/internal/CatalogClasspathDo.java b/core/src/main/java/brooklyn/catalog/internal/CatalogClasspathDo.java index af0e53d..af0713a 100644 --- a/core/src/main/java/brooklyn/catalog/internal/CatalogClasspathDo.java +++ b/core/src/main/java/brooklyn/catalog/internal/CatalogClasspathDo.java @@ -36,10 +36,10 @@ import org.apache.brooklyn.api.catalog.CatalogItem; import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.proxying.ImplementedBy; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.policy.Policy; import brooklyn.entity.basic.ApplicationBuilder; -import org.apache.brooklyn.location.Location; import brooklyn.management.internal.ManagementContextInternal; import brooklyn.util.ResourceUtils; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/catalog/internal/CatalogLocationItemDto.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/catalog/internal/CatalogLocationItemDto.java b/core/src/main/java/brooklyn/catalog/internal/CatalogLocationItemDto.java index 8d12b1a..da185f2 100644 --- a/core/src/main/java/brooklyn/catalog/internal/CatalogLocationItemDto.java +++ b/core/src/main/java/brooklyn/catalog/internal/CatalogLocationItemDto.java @@ -18,8 +18,8 @@ */ package brooklyn.catalog.internal; -import org.apache.brooklyn.location.Location; -import org.apache.brooklyn.location.LocationSpec; +import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.location.LocationSpec; public class CatalogLocationItemDto extends CatalogItemDtoAbstract<Location,LocationSpec<?>> { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java b/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java index 0e570b7..65ef309 100644 --- a/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java +++ b/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java @@ -23,13 +23,13 @@ import java.util.Map; import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.location.Location; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import brooklyn.config.ConfigKey; import brooklyn.entity.basic.ServiceStateLogic.ServiceProblemsLogic; import brooklyn.entity.trait.StartableMethods; -import org.apache.brooklyn.location.Location; import brooklyn.management.internal.ManagementContextInternal; import brooklyn.util.exceptions.Exceptions; import brooklyn.util.exceptions.RuntimeInterruptedException; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java b/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java index db1c26f..09d41c6 100644 --- a/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java +++ b/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java @@ -40,6 +40,7 @@ import org.apache.brooklyn.api.event.AttributeSensor; import org.apache.brooklyn.api.event.Sensor; import org.apache.brooklyn.api.event.SensorEvent; import org.apache.brooklyn.api.event.SensorEventListener; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.management.EntityManager; import org.apache.brooklyn.api.management.ExecutionContext; import org.apache.brooklyn.api.management.ManagementContext; @@ -76,8 +77,9 @@ import brooklyn.internal.BrooklynInitialization; import brooklyn.internal.storage.BrooklynStorage; import brooklyn.internal.storage.Reference; import brooklyn.internal.storage.impl.BasicReference; -import org.apache.brooklyn.location.Location; + import org.apache.brooklyn.location.basic.Locations; + import brooklyn.management.internal.EffectorUtils; import brooklyn.management.internal.EntityManagementSupport; import brooklyn.management.internal.ManagementContextInternal; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/entity/basic/BasicStartable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/BasicStartable.java b/core/src/main/java/brooklyn/entity/basic/BasicStartable.java index 00d87c3..7f8722f 100644 --- a/core/src/main/java/brooklyn/entity/basic/BasicStartable.java +++ b/core/src/main/java/brooklyn/entity/basic/BasicStartable.java @@ -22,10 +22,11 @@ import java.util.List; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.proxying.ImplementedBy; +import org.apache.brooklyn.api.location.Location; import brooklyn.config.ConfigKey; import brooklyn.entity.trait.Startable; -import org.apache.brooklyn.location.Location; + import org.apache.brooklyn.location.basic.Locations; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/entity/basic/BasicStartableImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/BasicStartableImpl.java b/core/src/main/java/brooklyn/entity/basic/BasicStartableImpl.java index 630bdd8..e4a59f9 100644 --- a/core/src/main/java/brooklyn/entity/basic/BasicStartableImpl.java +++ b/core/src/main/java/brooklyn/entity/basic/BasicStartableImpl.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.List; import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.management.Task; import org.apache.brooklyn.location.basic.Locations; import org.slf4j.Logger; @@ -30,7 +31,6 @@ import org.slf4j.LoggerFactory; import brooklyn.entity.trait.Startable; import brooklyn.entity.trait.StartableMethods; -import org.apache.brooklyn.location.Location; import brooklyn.util.exceptions.Exceptions; import com.google.common.base.Predicates; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java index ac3de30..7910267 100644 --- a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java +++ b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java @@ -24,7 +24,9 @@ import brooklyn.config.ConfigKey; import brooklyn.entity.trait.Startable; import brooklyn.event.basic.AttributeSensorAndConfigKey; import brooklyn.event.basic.TemplatedStringAttributeSensorAndConfigKey; -import org.apache.brooklyn.location.Location; + +import org.apache.brooklyn.api.location.Location; + import brooklyn.util.internal.ssh.ShellTool; import brooklyn.util.internal.ssh.SshTool; import brooklyn.util.time.Duration;
