provisionr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject [18/21] PROVISIONR-20. Change groupId from com.axemblr.provisionr to org.apache.provisionr
Date Mon, 01 Apr 2013 08:52:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/network/Rule.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/network/Rule.java b/api/src/main/java/com/axemblr/provisionr/api/network/Rule.java
deleted file mode 100644
index 2f02616..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/network/Rule.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.network;
-
-import com.google.common.base.Objects;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.Range;
-import com.google.common.collect.Ranges;
-import java.io.Serializable;
-
-public class Rule implements Serializable {
-
-    public static final String CIDR_ALL = "0.0.0.0/0";
-    public static final Range<Integer> EMPTY_RANGE = Ranges.openClosed(-1, -1);
-
-    public static RuleBuilder builder() {
-        return new RuleBuilder();
-    }
-
-    private final String cidr;
-    private final Range<Integer> ports;
-    private final Protocol protocol;
-
-    Rule(String cidr, Range<Integer> ports, Protocol protocol) {
-        this.ports = checkNotNull(ports, "ports is null");
-        this.cidr = checkNotNull(cidr, "cidr is null");
-        this.protocol = checkNotNull(protocol, "protocol is null");
-    }
-
-    public String getCidr() {
-        return cidr;
-    }
-
-    public Range<Integer> getPorts() {
-        return ports;
-    }
-
-    public Protocol getProtocol() {
-        return protocol;
-    }
-
-    public RuleBuilder toBuilder() {
-        return builder().cidr(cidr).ports(ports).protocol(protocol);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(cidr, ports, protocol);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final Rule other = (Rule) obj;
-        return Objects.equal(this.cidr, other.cidr)
-            && Objects.equal(this.ports, other.ports)
-            && Objects.equal(this.protocol, other.protocol);
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).omitNullValues()
-            .add("cidr", cidr).add("ports", ports).add("protocol", protocol).toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/network/RuleBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/network/RuleBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/network/RuleBuilder.java
deleted file mode 100644
index bc6af7e..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/network/RuleBuilder.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.network;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.BoundType;
-import com.google.common.collect.Range;
-import com.google.common.collect.Ranges;
-
-public class RuleBuilder {
-
-    private String cidr = Rule.CIDR_ALL;
-    private Range<Integer> ports = Rule.EMPTY_RANGE;
-    private Protocol protocol;
-
-    public RuleBuilder cidr(String cidr) {
-        this.cidr = checkNotNull(cidr, "cidr is null");
-        return this;
-    }
-
-    public RuleBuilder anySource() {
-        this.cidr = Rule.CIDR_ALL;
-        return this;
-    }
-
-    public RuleBuilder ports(Range<Integer> ports) {
-        checkArgument(ports.hasUpperBound(), "ports should have a closed upper bound");
-        checkArgument(ports.hasLowerBound(), "ports should have a closed lower bound ");
-
-        checkArgument(ports.lowerEndpoint() > 0, "ports should be a positive range");
-        checkArgument(ports.upperEndpoint() < 65535, "ports upper bound should less than 65535");
-
-        this.ports = checkNotNull(ports, "ports is null");
-        return this;
-    }
-
-    public RuleBuilder ports(int lowerPort, int upperPort) {
-        return ports(Ranges.closed(lowerPort, upperPort));
-    }
-
-    public RuleBuilder port(int port) {
-        return ports(Ranges.singleton(port));
-    }
-
-    public RuleBuilder protocol(Protocol protocol) {
-        this.protocol = checkNotNull(protocol, "protocol is null");
-        return this;
-    }
-
-    public RuleBuilder tcp() {
-        return protocol(Protocol.TCP);
-    }
-
-    public RuleBuilder udp() {
-        return protocol(Protocol.UDP);
-    }
-
-    public RuleBuilder icmp() {
-        return protocol(Protocol.ICMP);
-    }
-
-    public Rule createRule() {
-        return new Rule(cidr, ports, protocol);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/pool/Machine.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/pool/Machine.java b/api/src/main/java/com/axemblr/provisionr/api/pool/Machine.java
deleted file mode 100644
index 9eaee8b..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/pool/Machine.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.pool;
-
-import com.axemblr.provisionr.api.util.WithOptions;
-import com.google.common.base.Objects;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import java.util.Map;
-
-/**
- * Details about a running machine from a pool
- * <p/>
- * Used to connect to that machine for configuration.
- */
-public class Machine extends WithOptions {
-
-    public static MachineBuilder builder() {
-        return new MachineBuilder();
-    }
-
-    /**
-     * External, provider specific, unique ID
-     */
-    private final String externalId;
-
-    /**
-     * Public DNS reachable over the internet
-     */
-    private final String publicDnsName;
-
-    /**
-     * Public IP address reachable over the internet
-     */
-    private final String publicIp;
-
-
-    /**
-     * Private DNS name (inside the cloud provider network)
-     */
-    private final String privateDnsName;
-
-    /**
-     * Private IP address (inside the cloud provider network)
-     */
-    private final String privateIp;
-
-    /**
-     * Port number for SSH
-     */
-    private final int sshPort;
-
-    Machine(String externalId, String publicDnsName, String publicIp,
-            String privateDnsName, String privateIp, int sshPort, Map<String, String> options) {
-        super(options);
-
-        this.externalId = checkNotNull(externalId, "externalId is null");
-        this.publicDnsName = checkNotNull(publicDnsName, "publicDnsName is null");
-        this.publicIp = checkNotNull(publicIp, "publicIp is null");
-        this.privateDnsName = checkNotNull(privateDnsName, "privateDnsName is null");
-        this.privateIp = checkNotNull(privateIp, "privateIp is null");
-
-        checkArgument(sshPort > 0 && sshPort < 65535, "invalid port number for ssh");
-        this.sshPort = sshPort;
-    }
-
-    /**
-     * External provider specific unique ID
-     */
-    public String getExternalId() {
-        return externalId;
-    }
-
-    /**
-     * Public DNS reachable over the internet
-     */
-    public String getPublicDnsName() {
-        return publicDnsName;
-    }
-
-    /**
-     * Public IP address reachable over the internet
-     */
-    public String getPublicIp() {
-        return publicIp;
-    }
-
-    /**
-     * Private DNS name (inside the cloud provider network)
-     */
-    public String getPrivateDnsName() {
-        return privateDnsName;
-    }
-
-    /**
-     * Private IP address (inside the cloud provider network)
-     */
-    public String getPrivateIp() {
-        return privateIp;
-    }
-
-    /**
-     * Port number for SSH
-     */
-    public int getSshPort() {
-        return sshPort;
-    }
-
-    public MachineBuilder toBuilder() {
-        return builder().externalId(externalId).publicDnsName(publicDnsName).publicIp(publicIp)
-            .privateDnsName(privateDnsName).privateIp(privateIp).options(getOptions());
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(externalId, publicDnsName, publicIp,
-            privateDnsName, privateIp, sshPort, getOptions());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || getClass() != obj.getClass()) {
-            return false;
-        }
-        final Machine other = (Machine) obj;
-        return Objects.equal(this.externalId, other.externalId)
-            && Objects.equal(this.publicDnsName, other.publicDnsName)
-            && Objects.equal(this.publicIp, other.publicIp)
-            && Objects.equal(this.privateDnsName, other.privateDnsName)
-            && Objects.equal(this.privateIp, other.privateIp)
-            && this.sshPort == other.sshPort
-            && Objects.equal(this.getOptions(), other.getOptions());
-    }
-
-    @Override
-    public String toString() {
-        return "Machine{" +
-            "externalId='" + externalId + '\'' +
-            ", publicDnsName='" + publicDnsName + '\'' +
-            ", publicIp='" + publicIp + '\'' +
-            ", privateDnsName='" + privateDnsName + '\'' +
-            ", privateIp='" + privateIp + '\'' +
-            ", sshPort=" + sshPort +
-            ", options=" + getOptions() +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/pool/MachineBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/pool/MachineBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/pool/MachineBuilder.java
deleted file mode 100644
index 38d8191..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/pool/MachineBuilder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.pool;
-
-import com.axemblr.provisionr.api.util.BuilderWithOptions;
-import static com.google.common.base.Preconditions.checkArgument;
-
-public class MachineBuilder extends BuilderWithOptions<MachineBuilder> {
-
-    private String externalId;
-    private String publicDnsName;
-    private String publicIp;
-    private String privateDnsName;
-    private String privateIp;
-    private int sshPort = 22;
-
-    @Override
-    protected MachineBuilder getThis() {
-        return this;
-    }
-
-    public MachineBuilder localhost() {
-        return externalId("local-1").publicDnsName("localhost").publicIp("127.0.0.1")
-            .privateDnsName("localhost").privateIp("127.0.0.1").sshPort(22);
-    }
-
-    public MachineBuilder externalId(String externalId) {
-        this.externalId = externalId;
-        return this;
-    }
-
-    public MachineBuilder publicDnsName(String publicDnsName) {
-        this.publicDnsName = publicDnsName;
-        return this;
-    }
-
-    public MachineBuilder publicIp(String publicIp) {
-        this.publicIp = publicIp;
-        return this;
-    }
-
-    public MachineBuilder privateDnsName(String privateDnsName) {
-        this.privateDnsName = privateDnsName;
-        return this;
-    }
-
-    public MachineBuilder privateIp(String privateIp) {
-        this.privateIp = privateIp;
-        return this;
-    }
-
-    public MachineBuilder sshPort(int sshPort) {
-        checkArgument(sshPort > 0 && sshPort < 65535, "invalid port number for ssh");
-        this.sshPort = sshPort;
-        return this;
-    }
-
-    public Machine createMachine() {
-        return new Machine(externalId, publicDnsName, publicIp,
-            privateDnsName, privateIp, sshPort, buildOptions());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/pool/Pool.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/pool/Pool.java b/api/src/main/java/com/axemblr/provisionr/api/pool/Pool.java
deleted file mode 100644
index 43a0831..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/pool/Pool.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.pool;
-
-import com.axemblr.provisionr.api.access.AdminAccess;
-import com.axemblr.provisionr.api.hardware.Hardware;
-import com.axemblr.provisionr.api.network.Network;
-import com.axemblr.provisionr.api.provider.Provider;
-import com.axemblr.provisionr.api.software.Software;
-import com.axemblr.provisionr.api.util.WithOptions;
-import com.google.common.base.Objects;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import java.util.Map;
-
-public class Pool extends WithOptions {
-
-    public static PoolBuilder builder() {
-        return new PoolBuilder();
-    }
-
-    private final Provider provider;
-    private final Network network;
-
-    private final AdminAccess adminAccess;
-    private final Software software;
-    private final Hardware hardware;
-
-    private final int minSize;
-    private final int expectedSize;
-
-    private final int bootstrapTimeInSeconds;
-
-    Pool(Provider provider, Network network, AdminAccess adminAccess, Software software, Hardware hardware,
-         int minSize, int expectedSize, int bootstrapTimeInSeconds,
-         Map<String, String> options
-    ) {
-        super(options);
-
-        checkArgument(minSize > 0, "minSize should be positive");
-        checkArgument(minSize <= expectedSize, "minSize should be smaller or equal to expectedSize");
-        checkArgument(bootstrapTimeInSeconds > 0, "bootstrapTimeInSeconds should be positive");
-
-        this.provider = checkNotNull(provider, "provider is null");
-        this.network = checkNotNull(network, "network is null");
-        this.adminAccess = checkNotNull(adminAccess, "adminAccess is null");
-        this.software = checkNotNull(software, "software is null");
-        this.hardware = checkNotNull(hardware, "hardware is null");
-        this.minSize = minSize;
-        this.expectedSize = expectedSize;
-        this.bootstrapTimeInSeconds = bootstrapTimeInSeconds;
-    }
-
-    public Provider getProvider() {
-        return provider;
-    }
-
-    public Network getNetwork() {
-        return network;
-    }
-
-    public AdminAccess getAdminAccess() {
-        return adminAccess;
-    }
-
-    public Software getSoftware() {
-        return software;
-    }
-
-    public Hardware getHardware() {
-        return hardware;
-    }
-
-    public int getMinSize() {
-        return minSize;
-    }
-
-    public int getExpectedSize() {
-        return expectedSize;
-    }
-
-    /**
-     * The maximum amount of time to go from 0 to minSize
-     */
-    public int getBootstrapTimeInSeconds() {
-        return bootstrapTimeInSeconds;
-    }
-
-    public PoolBuilder toBuilder() {
-        return builder().provider(provider).network(network).adminAccess(adminAccess).software(software)
-            .hardware(hardware).minSize(minSize).expectedSize(expectedSize)
-            .bootstrapTimeInSeconds(bootstrapTimeInSeconds).options(getOptions());
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(provider, network, adminAccess, software, hardware,
-            minSize, expectedSize, bootstrapTimeInSeconds, getOptions());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final Pool other = (Pool) obj;
-        return Objects.equal(this.provider, other.provider) && Objects.equal(this.network, other.network)
-            && Objects.equal(this.adminAccess, other.adminAccess) && Objects.equal(this.software, other.software)
-            && Objects.equal(this.hardware, other.hardware) && Objects.equal(this.minSize, other.minSize)
-            && Objects.equal(this.expectedSize, other.expectedSize)
-            && Objects.equal(this.bootstrapTimeInSeconds, other.bootstrapTimeInSeconds)
-            && Objects.equal(this.getOptions(), other.getOptions());
-    }
-
-    @Override
-    public String toString() {
-        return "Pool{" +
-            "provider=" + provider +
-            ", network=" + network +
-            ", adminAccess=" + adminAccess +
-            ", software=" + software +
-            ", hardware=" + hardware +
-            ", minSize=" + minSize +
-            ", expectedSize=" + expectedSize +
-            ", bootstrapTimeInSeconds=" + bootstrapTimeInSeconds +
-            ", options=" + getOptions() +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/pool/PoolBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/pool/PoolBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/pool/PoolBuilder.java
deleted file mode 100644
index 3a943bf..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/pool/PoolBuilder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.pool;
-
-import com.axemblr.provisionr.api.access.AdminAccess;
-import com.axemblr.provisionr.api.hardware.Hardware;
-import com.axemblr.provisionr.api.network.Network;
-import com.axemblr.provisionr.api.software.Software;
-import com.axemblr.provisionr.api.provider.Provider;
-import com.axemblr.provisionr.api.util.BuilderWithOptions;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class PoolBuilder extends BuilderWithOptions<PoolBuilder> {
-
-    private Provider provider;
-    private Network network;
-
-    private AdminAccess adminAccess;
-    private Software software;
-    private Hardware hardware;
-
-    private int minSize = -1;
-    private int expectedSize = -1;
-
-    private int bootstrapTimeInSeconds = 15 * 60;
-
-    @Override
-    protected PoolBuilder getThis() {
-        return this;
-    }
-
-    public PoolBuilder provider(Provider provider) {
-        this.provider = checkNotNull(provider, "provider is null");
-        return this;
-    }
-
-    public PoolBuilder network(Network network) {
-        this.network = checkNotNull(network, "network is null");
-        return this;
-    }
-
-    public PoolBuilder adminAccess(AdminAccess adminAccess) {
-        this.adminAccess = checkNotNull(adminAccess, "adminAccess is null");
-        return this;
-    }
-
-    public PoolBuilder software(Software software) {
-        this.software = checkNotNull(software, "software is null");
-        return this;
-    }
-
-    public PoolBuilder hardware(Hardware hardware) {
-        this.hardware = checkNotNull(hardware, "hardware is null");
-        return this;
-    }
-
-    public PoolBuilder minSize(int minSize) {
-        checkArgument(minSize > 0, "minSize should be positive");
-        this.minSize = minSize;
-        return this;
-    }
-
-    public PoolBuilder expectedSize(int expectedSize) {
-        checkArgument(expectedSize > 0, "expectedSize should be positive");
-        this.expectedSize = expectedSize;
-        return this;
-    }
-
-    public PoolBuilder bootstrapTimeInSeconds(int bootstrapTimeInSeconds) {
-        checkArgument(bootstrapTimeInSeconds > 0, "bootstrapTimeInSeconds should be positive");
-        this.bootstrapTimeInSeconds = bootstrapTimeInSeconds;
-        return this;
-    }
-
-    public Pool createPool() {
-        return new Pool(provider, network, adminAccess, software, hardware, minSize,
-            expectedSize, bootstrapTimeInSeconds, buildOptions());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/provider/Provider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/provider/Provider.java b/api/src/main/java/com/axemblr/provisionr/api/provider/Provider.java
deleted file mode 100644
index df93690..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/provider/Provider.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.provider;
-
-import com.axemblr.provisionr.api.util.WithOptions;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableMap;
-import java.io.Serializable;
-import java.util.Map;
-
-public class Provider extends WithOptions {
-
-    public static ProviderBuilder builder() {
-        return new ProviderBuilder();
-    }
-
-    private final String id;
-    private final Optional<String> endpoint;
-
-    private final String accessKey;
-    private final String secretKey;
-
-    Provider(String id, Optional<String> endpoint, String accessKey,
-             String secretKey, Map<String, String> options) {
-        super(options);
-        this.id = checkNotNull(id, "id is null");
-        this.endpoint = checkNotNull(endpoint, "endpoint is null");
-        this.accessKey = checkNotNull(accessKey, "accessKey is null");
-        this.secretKey = checkNotNull(secretKey, "secretKey is null");
-    }
-
-    /**
-     * Unique provider ID
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * API endpoint for this provider
-     */
-    public Optional<String> getEndpoint() {
-        return endpoint;
-    }
-
-    /**
-     * API access key
-     */
-    public String getAccessKey() {
-        return accessKey;
-    }
-
-    /**
-     * API secret key
-     */
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    public ProviderBuilder toBuilder() {
-        return builder().id(id).endpoint(endpoint).accessKey(accessKey)
-            .secretKey(secretKey).options(getOptions());
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(id, endpoint, accessKey, secretKey, getOptions());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final Provider other = (Provider) obj;
-        return Objects.equal(this.id, other.id)
-            && Objects.equal(this.endpoint, other.endpoint)
-            && Objects.equal(this.accessKey, other.accessKey)
-            && Objects.equal(this.secretKey, other.secretKey)
-            && Objects.equal(this.getOptions(), other.getOptions());
-    }
-
-    @Override
-    public String toString() {
-        return "Provider{" +
-            "id='" + id + '\'' +
-            ", endpoint='" + endpoint.or("") + '\'' +
-            ", accessKey='" + accessKey + '\'' +
-            ", options='" + getOptions() + '\'' +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/provider/ProviderBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/provider/ProviderBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/provider/ProviderBuilder.java
deleted file mode 100644
index b372ff4..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/provider/ProviderBuilder.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.provider;
-
-import com.axemblr.provisionr.api.util.BuilderWithOptions;
-import com.google.common.base.Optional;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class ProviderBuilder extends BuilderWithOptions<ProviderBuilder> {
-
-    private String id;
-    private Optional<String> endpoint = Optional.absent();
-    private String accessKey;
-    private String secretKey;
-
-    @Override
-    protected ProviderBuilder getThis() {
-        return this;
-    }
-
-    public ProviderBuilder id(String id) {
-        this.id = checkNotNull(id, "id is null");
-        return this;
-    }
-
-    public ProviderBuilder endpoint(Optional<String> endpoint) {
-        this.endpoint = checkNotNull(endpoint, "endpoint is null");
-        return this;
-    }
-
-    public ProviderBuilder endpoint(String endpoint) {
-        this.endpoint = Optional.of(endpoint);
-        return this;
-    }
-
-    public ProviderBuilder accessKey(String accessKey) {
-        this.accessKey = checkNotNull(accessKey, "accessKey is null");
-        return this;
-    }
-
-    public ProviderBuilder secretKey(String secretKey) {
-        this.secretKey = checkNotNull(secretKey, "secretKey is null");
-        return this;
-    }
-
-    public Provider createProvider() {
-        return new Provider(id, endpoint, accessKey, secretKey, buildOptions());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/software/Repository.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/software/Repository.java b/api/src/main/java/com/axemblr/provisionr/api/software/Repository.java
deleted file mode 100644
index 1ae1a01..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/software/Repository.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.software;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableList;
-import java.io.Serializable;
-import java.util.List;
-
-public class Repository implements Serializable {
-
-    public static RepositoryBuilder builder() {
-        return new RepositoryBuilder();
-    }
-
-    private final String name;
-    private final List<String> entries;
-
-    private final Optional<String> key;
-
-    Repository(String name, List<String> entries, Optional<String> key) {
-        this.name = checkNotNull(name, "name is null");
-        this.entries = ImmutableList.copyOf(entries);
-        this.key = checkNotNull(key, "key is null");
-    }
-
-    /**
-     * The name of the repository
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * List of entries (text lines) used to describe this repository
-     */
-    public List<String> getEntries() {
-        return entries;
-    }
-
-    /**
-     * PGP key used for package signing. This should be the actual key
-     * and not a link to an external resource
-     */
-    public Optional<String> getKey() {
-        return key;
-    }
-
-    public RepositoryBuilder toBuilder() {
-        return builder().name(name).entries(entries).key(key);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(name, entries, key);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || getClass() != obj.getClass()) {
-            return false;
-        }
-        final Repository other = (Repository) obj;
-        return Objects.equal(this.name, other.name) && Objects.equal(this.entries, other.entries)
-            && Objects.equal(this.key, other.key);
-    }
-
-    @Override
-    public String toString() {
-        return "Repository{" +
-            "name='" + name + '\'' +
-            ", entries=" + entries +
-            ", key='" + key + '\'' +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/software/RepositoryBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/software/RepositoryBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/software/RepositoryBuilder.java
deleted file mode 100644
index cdd2ab8..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/software/RepositoryBuilder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.software;
-
-import com.google.common.base.Optional;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-
-public class RepositoryBuilder {
-
-    private String name;
-    private ImmutableList.Builder<String> entries = ImmutableList.builder();
-
-    private Optional<String> key = Optional.absent();
-
-    public RepositoryBuilder name(String name) {
-        this.name = checkNotNull(name, "name is null");
-        return this;
-    }
-
-    public RepositoryBuilder entries(List<String> entries) {
-        this.entries = ImmutableList.<String>builder().addAll(entries);
-        return this;
-    }
-
-    public RepositoryBuilder addEntry(String entry) {
-        this.entries.add(entry);
-        return this;
-    }
-
-    public RepositoryBuilder key(Optional<String> key) {
-        this.key = checkNotNull(key, "key is null");
-        return this;
-    }
-
-    public RepositoryBuilder key(String key) {
-        this.key = Optional.of(key);
-        return this;
-    }
-
-    public Repository createRepository() {
-        return new Repository(name, entries.build(), key);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/software/Software.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/software/Software.java b/api/src/main/java/com/axemblr/provisionr/api/software/Software.java
deleted file mode 100644
index 93a15da..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/software/Software.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.software;
-
-import com.axemblr.provisionr.api.util.WithOptions;
-import com.google.common.base.Objects;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Define the software environment for all the machines in the pool
- */
-public class Software extends WithOptions {
-
-    public static SoftwareBuilder builder() {
-        return new SoftwareBuilder();
-    }
-
-    private final String imageId;
-    private final boolean cachedImage;
-
-    private final Map<String, String> files;
-    private final List<String> packages;
-    private final List<Repository> repositories;
-
-    Software(String imageId, boolean cachedImage, Map<String, String> files, List<String> packages,
-             List<Repository> repositories, Map<String, String> options) {
-        super(options);
-        this.imageId = checkNotNull(imageId, "The supplied imageId was null");
-        this.cachedImage = cachedImage;
-        this.files = ImmutableMap.copyOf(files);
-        this.packages = ImmutableList.copyOf(packages);
-        this.repositories = ImmutableList.copyOf(repositories);
-    }
-
-    public String getImageId() {
-        return imageId;
-    }
-
-    public boolean isCachedImage() {
-        return cachedImage;
-    }
-
-    /**
-     * Map of remote files that need to be available on the local filesystem
-     */
-    public Map<String, String> getFiles() {
-        return files;
-    }
-
-    /**
-     * List of packages that should be installed
-     * <p/>
-     * This list can also include paths to local files
-     */
-    public List<String> getPackages() {
-        return packages;
-    }
-
-    /**
-     * List of custom repositories to add to the system before
-     * installing any packages
-     */
-    public List<Repository> getRepositories() {
-        return repositories;
-    }
-
-    public SoftwareBuilder toBuilder() {
-        return builder().imageId(imageId).files(files)
-            .packages(packages).repositories(repositories).options(getOptions());
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(imageId, cachedImage, files, packages, repositories, getOptions());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-
-        final Software other = (Software) obj;
-        return Objects.equal(this.imageId, other.imageId)
-            && Objects.equal(this.cachedImage, other.cachedImage)
-            && Objects.equal(this.files, other.files)
-            && Objects.equal(this.packages, other.packages)
-            && Objects.equal(this.repositories, other.repositories)
-            && Objects.equal(this.getOptions(), other.getOptions());
-    }
-
-    @Override
-    public String toString() {
-        return "Software{" +
-            "imageId='" + imageId + '\'' +
-            ", cachedImage=" + cachedImage +
-            ", files=" + files +
-            ", packages=" + packages +
-            ", repositories=" + repositories +
-            ", options=" + getOptions() +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/software/SoftwareBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/software/SoftwareBuilder.java b/api/src/main/java/com/axemblr/provisionr/api/software/SoftwareBuilder.java
deleted file mode 100644
index 358f273..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/software/SoftwareBuilder.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.software;
-
-import com.axemblr.provisionr.api.util.BuilderWithOptions;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import java.util.Map;
-
-public class SoftwareBuilder extends BuilderWithOptions<SoftwareBuilder> {
-
-    private String imageId = "default";
-    private boolean cachedImage = false;
-
-    private ImmutableMap.Builder<String, String> files = ImmutableMap.builder();
-    private ImmutableList.Builder<String> packages = ImmutableList.builder();
-    private ImmutableList.Builder<Repository> repositories = ImmutableList.builder();
-
-    @Override
-    protected SoftwareBuilder getThis() {
-        return this;
-    }
-
-    public SoftwareBuilder imageId(String imageId) {
-        this.imageId = checkNotNull(imageId, "The imageId was null");
-        return this;
-    }
-
-    public SoftwareBuilder cachedImage(boolean cachedImage) {
-        this.cachedImage = cachedImage;
-        return this;
-    }
-
-    public SoftwareBuilder files(Map<String, String> files) {
-        this.files = ImmutableMap.<String, String>builder().putAll(files);
-        return this;
-    }
-
-    public SoftwareBuilder file(String sourceUrl, String destinationPath) {
-        this.files.put(sourceUrl, destinationPath);
-        return this;
-    }
-
-    public SoftwareBuilder packages(Iterable<String> packages) {
-        this.packages = ImmutableList.<String>builder().addAll(packages);
-        return this;
-    }
-
-    public SoftwareBuilder packages(String... packages) {
-        this.packages = ImmutableList.<String>builder().addAll(Lists.newArrayList(packages));
-        return this;
-    }
-
-    public SoftwareBuilder addPackage(String pkg) {
-        this.packages.add(pkg);
-        return this;
-    }
-
-    public SoftwareBuilder repositories(Iterable<Repository> repositories) {
-        this.repositories = ImmutableList.<Repository>builder().addAll(repositories);
-        return this;
-    }
-
-    public SoftwareBuilder repository(Repository repository) {
-        this.repositories.add(repository);
-        return this;
-    }
-
-    public Software createSoftware() {
-        return new Software(imageId, cachedImage, files.build(), packages.build(),
-            repositories.build(), buildOptions());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/util/BuilderWithOptions.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/util/BuilderWithOptions.java b/api/src/main/java/com/axemblr/provisionr/api/util/BuilderWithOptions.java
deleted file mode 100644
index ff7e965..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/util/BuilderWithOptions.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.util;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.io.Closeables;
-import com.google.common.io.Resources;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Base class useful for creating builders for objects that accept
- * an arbitrary map of options (key, value string pairs)
- */
-public abstract class BuilderWithOptions<P extends BuilderWithOptions<P>> {
-
-    private ImmutableMap.Builder<String, String> options = ImmutableMap.builder();
-
-    /**
-     * Override this method to return 'this' to allow builder method chaining
-     */
-    protected abstract P getThis();
-
-    /**
-     * Replace options with the ones supplied as argument
-     */
-    public P options(Map<String, String> options) {
-        this.options = ImmutableMap.<String, String>builder().putAll(options);
-        return getThis();
-    }
-
-    /**
-     * Replace options with the ones extracted from the Properties object
-     */
-    public P options(Properties properties) {
-        this.options = ImmutableMap.builder();
-        for (String key : properties.stringPropertyNames()) {
-            options.put(key, properties.getProperty(key));
-        }
-        return getThis();
-    }
-
-    /**
-     * Load options from a properties file available as a resource on the classpath
-     */
-    public P optionsFromResource(String resource) {
-        Properties properties = new Properties();
-        ByteArrayInputStream in = null;
-        try {
-            in = new ByteArrayInputStream(Resources.toByteArray(Resources.getResource(resource)));
-            properties.load(in);
-            return options(properties);
-
-        } catch (IOException e) {
-            throw Throwables.propagate(e);
-        } finally {
-            Closeables.closeQuietly(in);
-        }
-    }
-
-    /**
-     * Add a new option
-     */
-    public P option(String key, String value) {
-        this.options.put(key, value);
-        return getThis();
-    }
-
-    protected Map<String, String> buildOptions() {
-        return options.build();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/com/axemblr/provisionr/api/util/WithOptions.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/axemblr/provisionr/api/util/WithOptions.java b/api/src/main/java/com/axemblr/provisionr/api/util/WithOptions.java
deleted file mode 100644
index 0ae9321..0000000
--- a/api/src/main/java/com/axemblr/provisionr/api/util/WithOptions.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed 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 com.axemblr.provisionr.api.util;
-
-import com.google.common.base.Optional;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.ImmutableMap;
-import java.io.Serializable;
-import java.util.Map;
-
-public abstract class WithOptions implements Serializable {
-
-    private final Map<String, String> options;
-
-    public WithOptions(Map<String, String> options) {
-        this.options = ImmutableMap.copyOf(options);
-    }
-
-    public Map<String, String> getOptions() {
-        return options;
-    }
-
-    public String getOption(String key) {
-        return options.get(checkNotNull(key, "key is null"));
-    }
-
-    public String getOptionOr(String key, String value) {
-        return Optional.fromNullable(getOption(key)).or(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/Provisionr.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/Provisionr.java b/api/src/main/java/org/apache/provisionr/api/Provisionr.java
new file mode 100644
index 0000000..0eabb57
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/Provisionr.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api;
+
+import org.apache.provisionr.api.pool.Machine;
+import org.apache.provisionr.api.pool.Pool;
+import org.apache.provisionr.api.provider.Provider;
+import com.google.common.base.Optional;
+import java.util.List;
+
+public interface Provisionr {
+
+    /**
+     * Get unique ID for this provisionr
+     */
+    public String getId();
+
+
+    /**
+     * Return the default provider configured for this bundle using the
+     * Blueprint configuration mechanism or something else
+     *
+     * @see Provider
+     */
+    public Optional<Provider> getDefaultProvider();
+
+    /**
+     * Start a provisioning process based on the pool description
+     * <p/>
+     * This process will run until the pool is destroyed
+     *
+     * @param businessKey external process ID (e.g. job ID, business key)
+     * @param pool        pool description
+     * @return internal process ID
+     */
+    String startPoolManagementProcess(String businessKey, Pool pool);
+
+
+    /**
+     * Retrieve the list of machines for a pool or an empty list
+     *
+     * @param businessKey external pool ID (e.g. job ID)
+     * @return list of running machines or empty
+     */
+    List<Machine> getMachines(String businessKey);
+
+    /**
+     * Get current pool status
+     *
+     * @param businessKey external process ID (e.g. job ID)
+     * @return internal status information
+     */
+    String getStatus(String businessKey);
+
+    /**
+     * Destroy all the machines from the pool with that id
+     *
+     * @param businessKey external pool ID (e.g. job ID, business key)
+     */
+    void destroyPool(String businessKey);
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/access/AdminAccess.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/access/AdminAccess.java b/api/src/main/java/org/apache/provisionr/api/access/AdminAccess.java
new file mode 100644
index 0000000..4f1dc54
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/access/AdminAccess.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.access;
+
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.io.Serializable;
+
+/**
+ * Describe the only user allowed to access machine from the pool over SSH
+ * <p/>
+ * This user will support only key-based SSH authentication have
+ * password-less sudo access
+ */
+public class AdminAccess implements Serializable {
+
+    public static AdminAccessBuilder builder() {
+        return new AdminAccessBuilder();
+    }
+
+    private final String username;
+    private final String publicKey;
+    private final String privateKey;
+
+    AdminAccess(String username, String publicKey, String privateKey) {
+        this.username = checkNotNull(username, "username is null");
+        this.publicKey = checkNotNull(publicKey, "publicKey is null");
+        this.privateKey = checkNotNull(privateKey, "privateKey is null");
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public String getPublicKey() {
+        return publicKey;
+    }
+
+    public String getPrivateKey() {
+        return privateKey;
+    }
+
+    public AdminAccessBuilder toBuilder() {
+        return builder().username(username)
+            .publicKey(publicKey).privateKey(privateKey);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(username, publicKey, privateKey);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final AdminAccess other = (AdminAccess) obj;
+        return Objects.equal(this.username, other.username)
+            && Objects.equal(this.publicKey, other.publicKey)
+            && Objects.equal(this.privateKey, other.privateKey);
+    }
+
+    @Override
+    public String toString() {
+        return "AdminAccess{" +
+            "username='" + username + '\'' +
+            ", publicKey='" + publicKey + '\'' +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/access/AdminAccessBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/access/AdminAccessBuilder.java b/api/src/main/java/org/apache/provisionr/api/access/AdminAccessBuilder.java
new file mode 100644
index 0000000..9d8fa75
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/access/AdminAccessBuilder.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.access;
+
+import com.google.common.base.Charsets;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Throwables;
+import com.google.common.io.Files;
+import java.io.File;
+
+public class AdminAccessBuilder {
+
+    private String username;
+    private String publicKey;
+    private String privateKey;
+
+    public AdminAccessBuilder username(String username) {
+        this.username = checkNotNull(username, "username is null");
+        return this;
+    }
+
+    public AdminAccessBuilder publicKey(String publicKey) {
+        checkArgument(publicKey.startsWith("ssh-rsa "), "The key does not start with ssh-rsa as expected");
+        this.publicKey = checkNotNull(publicKey, "publicKey is null");
+        return this;
+    }
+
+    public AdminAccessBuilder privateKey(String privateKey) {
+        checkArgument(privateKey.startsWith("-----BEGIN RSA PRIVATE KEY-----"),
+            "The key does not start with -----BEGIN RSA PRIVATE KEY----- as expected");
+        this.privateKey = checkNotNull(privateKey, "privateKey is null");
+        return this;
+    }
+
+    public AdminAccessBuilder asCurrentUser() {
+        String userHome = System.getProperty("user.home");
+
+        try {
+            String publicKey = Files.toString(new File(userHome, ".ssh/id_rsa.pub"), Charsets.UTF_8);
+            String privateKey = Files.toString(new File(userHome, ".ssh/id_rsa"), Charsets.UTF_8);
+
+            return username(System.getProperty("user.name")).publicKey(publicKey).privateKey(privateKey);
+
+        } catch (Exception e) {
+            throw Throwables.propagate(e);
+        }
+    }
+
+    public AdminAccess createAdminAccess() {
+        return new AdminAccess(username, publicKey, privateKey);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDevice.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/hardware/BlockDevice.java b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDevice.java
new file mode 100644
index 0000000..c006f22
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDevice.java
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+*
+* Licensed 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.provisionr.api.hardware;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+
+import java.util.Map;
+
+public class BlockDevice extends WithOptions {
+
+    private int size;
+    private String name;
+
+    public static BlockDeviceBuilder builder() {
+        return new BlockDeviceBuilder();
+    }
+
+    BlockDevice(int size, String name, Map<String, String> options) {
+        super(options);
+        checkArgument(size > 0, "the block device size should be a positive integer");
+        this.size = size;
+        this.name = name;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(size, name, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final BlockDevice other = (BlockDevice) obj;
+        return Objects.equal(this.size, other.size)
+            && Objects.equal(this.name, this.name)
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return "BlockDevice {" +
+            "size=" + size +
+            "name=" + name +
+            ", options=" + getOptions() + "}";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDeviceBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/hardware/BlockDeviceBuilder.java b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDeviceBuilder.java
new file mode 100644
index 0000000..17fb5c3
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/hardware/BlockDeviceBuilder.java
@@ -0,0 +1,33 @@
+package org.apache.provisionr.api.hardware;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+
+public class BlockDeviceBuilder extends BuilderWithOptions<BlockDeviceBuilder> {
+
+    private Integer size;
+    private String name;
+
+    @Override
+    protected BlockDeviceBuilder getThis() {
+        return this;
+    }
+
+    public BlockDeviceBuilder size(int size) {
+        checkArgument(size > 0, "The block device size must be a positive integer");
+        this.size = size;
+        return this;
+    }
+
+    public BlockDeviceBuilder name(String mapping) {
+        this.name = checkNotNull(mapping, "The block device must have a name - the OS path on which it is mapped");
+        return this;
+    }
+
+    public BlockDevice createBlockDevice() {
+        checkNotNull(size, "The size was not specified");
+        return new BlockDevice(size, name, buildOptions());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/hardware/Hardware.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/hardware/Hardware.java b/api/src/main/java/org/apache/provisionr/api/hardware/Hardware.java
new file mode 100644
index 0000000..b6f67f3
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/hardware/Hardware.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.hardware;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+import java.util.Map;
+
+public class Hardware extends WithOptions {
+
+    public static HardwareBuilder builder() {
+        return new HardwareBuilder();
+    }
+
+    private final String type;
+    private List<BlockDevice> blockDevices;
+
+    Hardware(String type, List<BlockDevice> blockDevices, Map<String, String> options) {
+        super(options);
+        this.type = checkNotNull(type, "type is null");
+        this.blockDevices = ImmutableList.copyOf(blockDevices);
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public List<BlockDevice> getBlockDevices() {
+        return blockDevices;
+    }
+
+    public HardwareBuilder toBuilder() {
+        return builder().type(type).blockDevices(blockDevices).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(type, getOptions(), getBlockDevices());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Hardware other = (Hardware) obj;
+        return Objects.equal(this.type, other.type)
+            && Objects.equal(this.getOptions(), other.getOptions())
+            && Objects.equal(this.getBlockDevices(), other.getBlockDevices());
+    }
+
+    @Override
+    public String toString() {
+        return "Hardware{" +
+            "type='" + type + '\'' +
+            ", blockDevices=" + getBlockDevices() + 
+            ", options=" + getOptions() +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/hardware/HardwareBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/hardware/HardwareBuilder.java b/api/src/main/java/org/apache/provisionr/api/hardware/HardwareBuilder.java
new file mode 100644
index 0000000..c8c2d95
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/hardware/HardwareBuilder.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.hardware;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+public class HardwareBuilder extends BuilderWithOptions<HardwareBuilder> {
+
+    private String type = "default";
+    private List<BlockDevice> blockDevices = Lists.newArrayList();
+
+    @Override
+    protected HardwareBuilder getThis() {
+        return this;
+    }
+
+    /**
+     * This is similar to <a href="http://aws.amazon.com/ec2/instance-types/">'instance type'</a> on Amazon
+     * or <a href="http://docs.cloudstack.org/Glossary">'service offering'</a> on CloudStack
+     *
+     * @param type
+     * @return
+     */
+    public HardwareBuilder type(String type) {
+        this.type = checkNotNull(type, "type is null");
+        return this;
+    }
+
+    public HardwareBuilder blockDevices(List<BlockDevice> blockDevices) {
+        this.blockDevices = checkNotNull(blockDevices, "the list of block devices is null");
+        return this;
+    }
+
+    public Hardware createHardware() {
+        return new Hardware(type, blockDevices, buildOptions());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/network/Network.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/network/Network.java b/api/src/main/java/org/apache/provisionr/api/network/Network.java
new file mode 100644
index 0000000..1a1a262
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/network/Network.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.network;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableSet;
+import java.util.Map;
+import java.util.Set;
+
+public class Network extends WithOptions {
+
+    public static NetworkBuilder builder() {
+        return new NetworkBuilder();
+    }
+
+    private final String type;
+    private final Set<Rule> ingress;
+
+    Network(String type, Set<Rule> ingress, Map<String, String> options) {
+        super(options);
+        this.type = checkNotNull(type, "type is null");
+        this.ingress = ImmutableSet.copyOf(ingress);
+    }
+
+    /**
+     * Implementation specific network type information
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Set of rules for incoming packages
+     */
+    public Set<Rule> getIngress() {
+        return ingress;
+    }
+
+    public NetworkBuilder toBuilder() {
+        return builder().type(type).ingress(ingress).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(type, ingress, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Network other = (Network) obj;
+        return Objects.equal(this.type, other.type)
+            && Objects.equal(this.ingress, other.ingress)
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this).omitNullValues()
+            .add("type", type).add("ingress", ingress)
+            .add("options", getOptions()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/network/NetworkBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/network/NetworkBuilder.java b/api/src/main/java/org/apache/provisionr/api/network/NetworkBuilder.java
new file mode 100644
index 0000000..f49e10d
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/network/NetworkBuilder.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.network;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import java.util.Set;
+
+public class NetworkBuilder extends BuilderWithOptions<NetworkBuilder> {
+
+    private String type = "default";
+    private ImmutableSet.Builder<Rule> ingress = ImmutableSet.builder();
+
+    @Override
+    protected NetworkBuilder getThis() {
+        return this;
+    }
+
+    public NetworkBuilder type(String type) {
+        this.type = checkNotNull(type, "type is null");
+        return this;
+    }
+
+    public NetworkBuilder ingress(Set<Rule> incoming) {
+        this.ingress = ImmutableSet.<Rule>builder().addAll(incoming);
+        return this;
+    }
+
+    public NetworkBuilder addRules(Rule... rules) {
+        return addRules(Lists.newArrayList(rules));
+    }
+
+    public NetworkBuilder addRules(Iterable<Rule> rules) {
+        this.ingress.addAll(rules);
+        return this;
+    }
+
+    public Network createNetwork() {
+        return new Network(type, ingress.build(), buildOptions());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/network/Protocol.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/network/Protocol.java b/api/src/main/java/org/apache/provisionr/api/network/Protocol.java
new file mode 100644
index 0000000..403b71f
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/network/Protocol.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.network;
+
+public enum Protocol {
+    TCP,
+    UDP,
+    ICMP
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/network/Rule.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/network/Rule.java b/api/src/main/java/org/apache/provisionr/api/network/Rule.java
new file mode 100644
index 0000000..ddb12d8
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/network/Rule.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.network;
+
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.Range;
+import com.google.common.collect.Ranges;
+import java.io.Serializable;
+
+public class Rule implements Serializable {
+
+    public static final String CIDR_ALL = "0.0.0.0/0";
+    public static final Range<Integer> EMPTY_RANGE = Ranges.openClosed(-1, -1);
+
+    public static RuleBuilder builder() {
+        return new RuleBuilder();
+    }
+
+    private final String cidr;
+    private final Range<Integer> ports;
+    private final Protocol protocol;
+
+    Rule(String cidr, Range<Integer> ports, Protocol protocol) {
+        this.ports = checkNotNull(ports, "ports is null");
+        this.cidr = checkNotNull(cidr, "cidr is null");
+        this.protocol = checkNotNull(protocol, "protocol is null");
+    }
+
+    public String getCidr() {
+        return cidr;
+    }
+
+    public Range<Integer> getPorts() {
+        return ports;
+    }
+
+    public Protocol getProtocol() {
+        return protocol;
+    }
+
+    public RuleBuilder toBuilder() {
+        return builder().cidr(cidr).ports(ports).protocol(protocol);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(cidr, ports, protocol);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Rule other = (Rule) obj;
+        return Objects.equal(this.cidr, other.cidr)
+            && Objects.equal(this.ports, other.ports)
+            && Objects.equal(this.protocol, other.protocol);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this).omitNullValues()
+            .add("cidr", cidr).add("ports", ports).add("protocol", protocol).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/network/RuleBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/network/RuleBuilder.java b/api/src/main/java/org/apache/provisionr/api/network/RuleBuilder.java
new file mode 100644
index 0000000..e14306b
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/network/RuleBuilder.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.network;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.Range;
+import com.google.common.collect.Ranges;
+
+public class RuleBuilder {
+
+    private String cidr = Rule.CIDR_ALL;
+    private Range<Integer> ports = Rule.EMPTY_RANGE;
+    private Protocol protocol;
+
+    public RuleBuilder cidr(String cidr) {
+        this.cidr = checkNotNull(cidr, "cidr is null");
+        return this;
+    }
+
+    public RuleBuilder anySource() {
+        this.cidr = Rule.CIDR_ALL;
+        return this;
+    }
+
+    public RuleBuilder ports(Range<Integer> ports) {
+        checkArgument(ports.hasUpperBound(), "ports should have a closed upper bound");
+        checkArgument(ports.hasLowerBound(), "ports should have a closed lower bound ");
+
+        checkArgument(ports.lowerEndpoint() > 0, "ports should be a positive range");
+        checkArgument(ports.upperEndpoint() < 65535, "ports upper bound should less than 65535");
+
+        this.ports = checkNotNull(ports, "ports is null");
+        return this;
+    }
+
+    public RuleBuilder ports(int lowerPort, int upperPort) {
+        return ports(Ranges.closed(lowerPort, upperPort));
+    }
+
+    public RuleBuilder port(int port) {
+        return ports(Ranges.singleton(port));
+    }
+
+    public RuleBuilder protocol(Protocol protocol) {
+        this.protocol = checkNotNull(protocol, "protocol is null");
+        return this;
+    }
+
+    public RuleBuilder tcp() {
+        return protocol(Protocol.TCP);
+    }
+
+    public RuleBuilder udp() {
+        return protocol(Protocol.UDP);
+    }
+
+    public RuleBuilder icmp() {
+        return protocol(Protocol.ICMP);
+    }
+
+    public Rule createRule() {
+        return new Rule(cidr, ports, protocol);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/pool/Machine.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/pool/Machine.java b/api/src/main/java/org/apache/provisionr/api/pool/Machine.java
new file mode 100644
index 0000000..5806a7c
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/pool/Machine.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed 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.provisionr.api.pool;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Map;
+
+/**
+ * Details about a running machine from a pool
+ * <p/>
+ * Used to connect to that machine for configuration.
+ */
+public class Machine extends WithOptions {
+
+    public static MachineBuilder builder() {
+        return new MachineBuilder();
+    }
+
+    /**
+     * External, provider specific, unique ID
+     */
+    private final String externalId;
+
+    /**
+     * Public DNS reachable over the internet
+     */
+    private final String publicDnsName;
+
+    /**
+     * Public IP address reachable over the internet
+     */
+    private final String publicIp;
+
+
+    /**
+     * Private DNS name (inside the cloud provider network)
+     */
+    private final String privateDnsName;
+
+    /**
+     * Private IP address (inside the cloud provider network)
+     */
+    private final String privateIp;
+
+    /**
+     * Port number for SSH
+     */
+    private final int sshPort;
+
+    Machine(String externalId, String publicDnsName, String publicIp,
+            String privateDnsName, String privateIp, int sshPort, Map<String, String> options) {
+        super(options);
+
+        this.externalId = checkNotNull(externalId, "externalId is null");
+        this.publicDnsName = checkNotNull(publicDnsName, "publicDnsName is null");
+        this.publicIp = checkNotNull(publicIp, "publicIp is null");
+        this.privateDnsName = checkNotNull(privateDnsName, "privateDnsName is null");
+        this.privateIp = checkNotNull(privateIp, "privateIp is null");
+
+        checkArgument(sshPort > 0 && sshPort < 65535, "invalid port number for ssh");
+        this.sshPort = sshPort;
+    }
+
+    /**
+     * External provider specific unique ID
+     */
+    public String getExternalId() {
+        return externalId;
+    }
+
+    /**
+     * Public DNS reachable over the internet
+     */
+    public String getPublicDnsName() {
+        return publicDnsName;
+    }
+
+    /**
+     * Public IP address reachable over the internet
+     */
+    public String getPublicIp() {
+        return publicIp;
+    }
+
+    /**
+     * Private DNS name (inside the cloud provider network)
+     */
+    public String getPrivateDnsName() {
+        return privateDnsName;
+    }
+
+    /**
+     * Private IP address (inside the cloud provider network)
+     */
+    public String getPrivateIp() {
+        return privateIp;
+    }
+
+    /**
+     * Port number for SSH
+     */
+    public int getSshPort() {
+        return sshPort;
+    }
+
+    public MachineBuilder toBuilder() {
+        return builder().externalId(externalId).publicDnsName(publicDnsName).publicIp(publicIp)
+            .privateDnsName(privateDnsName).privateIp(privateIp).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(externalId, publicDnsName, publicIp,
+            privateDnsName, privateIp, sshPort, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final Machine other = (Machine) obj;
+        return Objects.equal(this.externalId, other.externalId)
+            && Objects.equal(this.publicDnsName, other.publicDnsName)
+            && Objects.equal(this.publicIp, other.publicIp)
+            && Objects.equal(this.privateDnsName, other.privateDnsName)
+            && Objects.equal(this.privateIp, other.privateIp)
+            && this.sshPort == other.sshPort
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return "Machine{" +
+            "externalId='" + externalId + '\'' +
+            ", publicDnsName='" + publicDnsName + '\'' +
+            ", publicIp='" + publicIp + '\'' +
+            ", privateDnsName='" + privateDnsName + '\'' +
+            ", privateIp='" + privateIp + '\'' +
+            ", sshPort=" + sshPort +
+            ", options=" + getOptions() +
+            '}';
+    }
+}


Mime
View raw message