You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2013/12/31 22:20:40 UTC

[47/51] [partial] Rename twitter* and com.twitter to apache and org.apache directories to preserve all file history before the refactor.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/configuration/Resources.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/configuration/Resources.java b/src/main/java/com/twitter/aurora/scheduler/configuration/Resources.java
deleted file mode 100644
index 51e9973..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/configuration/Resources.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.configuration;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ContiguousSet;
-import com.google.common.collect.DiscreteDomain;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Ordering;
-import com.google.common.collect.Sets;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.mesos.Protos.Offer;
-import org.apache.mesos.Protos.Resource;
-import org.apache.mesos.Protos.Value.Range;
-import org.apache.mesos.Protos.Value.Ranges;
-import org.apache.mesos.Protos.Value.Scalar;
-import org.apache.mesos.Protos.Value.Type;
-
-import com.twitter.aurora.scheduler.base.Numbers;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConfig;
-import com.twitter.common.quantity.Amount;
-import com.twitter.common.quantity.Data;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A container for multiple resource vectors.
- * TODO(wfarner): Collapse this in with Quotas.
- */
-public class Resources {
-
-  public static final String CPUS = "cpus";
-  public static final String RAM_MB = "mem";
-  public static final String DISK_MB = "disk";
-  public static final String PORTS = "ports";
-
-  private static final Function<Range, Set<Integer>> RANGE_TO_MEMBERS =
-      new Function<Range, Set<Integer>>() {
-        @Override public Set<Integer> apply(Range range) {
-          return ContiguousSet.create(
-              com.google.common.collect.Range.closed((int) range.getBegin(), (int) range.getEnd()),
-              DiscreteDomain.integers());
-        }
-      };
-
-  private final double numCpus;
-  private final Amount<Long, Data> disk;
-  private final Amount<Long, Data> ram;
-  private final int numPorts;
-
-  /**
-   * Creates a new resources object.
-   *
-   * @param numCpus Number of CPUs.
-   * @param ram Amount of RAM.
-   * @param disk Amount of disk.
-   * @param numPorts Number of ports.
-   */
-  public Resources(double numCpus, Amount<Long, Data> ram, Amount<Long, Data> disk, int numPorts) {
-    this.numCpus = numCpus;
-    this.ram = checkNotNull(ram);
-    this.disk = checkNotNull(disk);
-    this.numPorts = numPorts;
-  }
-
-  /**
-   * Tests whether this bundle of resources is greater than or equal to another bundle of resources.
-   *
-   * @param other Resources being compared to.
-   * @return {@code true} if all resources in this bundle are greater than or equal to the
-   *    equivalents from {@code other}, otherwise {@code false}.
-   */
-  public boolean greaterThanOrEqual(Resources other) {
-    return (numCpus >= other.numCpus)
-        && (disk.as(Data.MB) >= other.disk.as(Data.MB))
-        && (ram.as(Data.MB) >= other.ram.as(Data.MB))
-        && (numPorts >= other.numPorts);
-  }
-
-  /**
-   * Adapts this resources object to a list of mesos resources.
-   *
-   * @param selectedPorts The ports selected, to be applied as concrete task ranges.
-   * @return Mesos resources.
-   */
-  public List<Resource> toResourceList(Set<Integer> selectedPorts) {
-    ImmutableList.Builder<Resource> resourceBuilder =
-      ImmutableList.<Resource>builder()
-          .add(Resources.makeMesosResource(CPUS, numCpus))
-          .add(Resources.makeMesosResource(DISK_MB, disk.as(Data.MB)))
-          .add(Resources.makeMesosResource(RAM_MB, ram.as(Data.MB)));
-    if (selectedPorts.size() > 0) {
-        resourceBuilder.add(Resources.makeMesosRangeResource(Resources.PORTS, selectedPorts));
-    }
-
-    return resourceBuilder.build();
-  }
-
-  /**
-   * Convenience method for adapting to mesos resources without applying a port range.
-   *
-   * @see {@link #toResourceList(java.util.Set)}
-   * @return Mesos resources.
-   */
-  public List<Resource> toResourceList() {
-    return toResourceList(ImmutableSet.<Integer>of());
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!(o instanceof Resources)) {
-      return false;
-    }
-
-    Resources other = (Resources) o;
-    return new EqualsBuilder()
-        .append(numCpus, other.numCpus)
-        .append(ram, other.ram)
-        .append(disk, other.disk)
-        .append(numPorts, other.numPorts)
-        .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(numCpus, ram, disk, numPorts);
-  }
-
-  /**
-   * Extracts the resources required from a task.
-   *
-   * @param task Task to get resources from.
-   * @return The resources required by the task.
-   */
-  public static Resources from(ITaskConfig task) {
-    checkNotNull(task);
-    return new Resources(
-        task.getNumCpus(),
-        Amount.of(task.getRamMb(), Data.MB),
-        Amount.of(task.getDiskMb(), Data.MB),
-        task.getRequestedPorts().size());
-  }
-
-  /**
-   * Extracts the resources specified in a list of resource objects.
-   *
-   * @param resources Resources to translate.
-   * @return The canonical resources.
-   */
-  public static Resources from(List<Resource> resources) {
-    checkNotNull(resources);
-    return new Resources(
-        getScalarValue(resources, CPUS),
-        Amount.of((long) getScalarValue(resources, RAM_MB), Data.MB),
-        Amount.of((long) getScalarValue(resources, DISK_MB), Data.MB),
-        getNumAvailablePorts(resources)
-    );
-  }
-
-  /**
-   * Extracts the resources available in a slave offer.
-   *
-   * @param offer Offer to get resources from.
-   * @return The resources available in the offer.
-   */
-  public static Resources from(Offer offer) {
-    checkNotNull(offer);
-    return new Resources(
-        getScalarValue(offer, CPUS),
-        Amount.of((long) getScalarValue(offer, RAM_MB), Data.MB),
-        Amount.of((long) getScalarValue(offer, DISK_MB), Data.MB),
-        getNumAvailablePorts(offer.getResourcesList()));
-  }
-
-  private static final Resources NO_RESOURCES =
-      new Resources(0, Amount.of(0L, Data.BITS), Amount.of(0L, Data.BITS), 0);
-
-  private static Resources none() {
-    return NO_RESOURCES;
-  }
-
-  /**
-   * a - b
-   */
-  public static Resources subtract(Resources a, Resources b) {
-    return new Resources(
-        a.getNumCpus() - b.getNumCpus(),
-        Amount.of(a.getRam().as(Data.MB) - b.getRam().as(Data.MB), Data.MB),
-        Amount.of(a.getDisk().as(Data.MB) - b.getDisk().as(Data.MB), Data.MB),
-        a.getNumPorts() - b.getNumPorts());
-  }
-
-  /**
-   * sum(a, b)
-   */
-  public static Resources sum(Resources a, Resources b) {
-    return sum(ImmutableList.of(a, b));
-  }
-
-  /**
-   * sum(rs)
-   */
-  public static Resources sum(Iterable<Resources> rs) {
-    Resources sum = none();
-
-    for (Resources r : rs) {
-      double numCpus = sum.getNumCpus() + r.getNumCpus();
-      Amount<Long, Data> disk =
-          Amount.of(sum.getDisk().as(Data.BYTES) + r.getDisk().as(Data.BYTES), Data.BYTES);
-      Amount<Long, Data> ram =
-          Amount.of(sum.getRam().as(Data.BYTES) + r.getRam().as(Data.BYTES), Data.BYTES);
-      int ports = sum.getNumPorts() + r.getNumPorts();
-      sum =  new Resources(numCpus, ram, disk, ports);
-    }
-
-    return sum;
-  }
-
-  private static int getNumAvailablePorts(List<Resource> resource) {
-    int offeredPorts = 0;
-    for (Range range : getPortRanges(resource)) {
-      offeredPorts += 1 + (range.getEnd() - range.getBegin());
-    }
-    return offeredPorts;
-  }
-
-  private static double getScalarValue(Offer offer, String key) {
-    return getScalarValue(offer.getResourcesList(), key);
-  }
-
-  private static double getScalarValue(List<Resource> resources, String key) {
-    Resource resource = getResource(resources, key);
-    if (resource == null) {
-      return 0;
-    }
-
-    return resource.getScalar().getValue();
-  }
-
-  private static Resource getResource(List<Resource> resource, String key) {
-      return Iterables.find(resource, withName(key), null);
-  }
-
-  private static Predicate<Resource> withName(final String name) {
-    return new Predicate<Resource>() {
-      @Override public boolean apply(Resource resource) {
-        return resource.getName().equals(name);
-      }
-    };
-  }
-
-  private static Iterable<Range> getPortRanges(List<Resource> resources) {
-    Resource resource = getResource(resources, Resources.PORTS);
-    if (resource == null) {
-      return ImmutableList.of();
-    }
-
-    return resource.getRanges().getRangeList();
-  }
-
-  /**
-   * Creates a scalar mesos resource.
-   *
-   * @param name Name of the resource.
-   * @param value Value for the resource.
-   * @return A mesos resource.
-   */
-  public static Resource makeMesosResource(String name, double value) {
-    return Resource.newBuilder().setName(name).setType(Type.SCALAR)
-        .setScalar(Scalar.newBuilder().setValue(value)).build();
-  }
-
-  private static final Function<com.google.common.collect.Range<Integer>, Range> RANGE_TRANSFORM =
-      new Function<com.google.common.collect.Range<Integer>, Range>() {
-        @Override public Range apply(com.google.common.collect.Range<Integer> input) {
-          return Range.newBuilder()
-              .setBegin(input.lowerEndpoint())
-              .setEnd(input.upperEndpoint())
-              .build();
-        }
-      };
-
-  /**
-   * Creates a mesos resource of integer ranges.
-   *
-   * @param name Name of the resource
-   * @param values Values to translate into ranges.
-   * @return A mesos ranges resource.
-   */
-  static Resource makeMesosRangeResource(String name, Set<Integer> values) {
-    return Resource.newBuilder()
-        .setName(name)
-        .setType(Type.RANGES)
-        .setRanges(Ranges.newBuilder()
-            .addAllRange(Iterables.transform(Numbers.toRanges(values), RANGE_TRANSFORM)))
-        .build();
-  }
-
-  /**
-   * Number of CPUs.
-   *
-   * @return CPUs.
-   */
-  public double getNumCpus() {
-    return numCpus;
-  }
-
-  /**
-   * Disk amount.
-   *
-   * @return Disk.
-   */
-  public Amount<Long, Data> getDisk() {
-    return disk;
-  }
-
-  /**
-   * RAM amount.
-   *
-   * @return RAM.
-   */
-  public Amount<Long, Data> getRam() {
-    return ram;
-  }
-
-  /**
-   * Number of ports.
-   *
-   * @return Port count.
-   */
-  public int getNumPorts() {
-    return numPorts;
-  }
-
-  /**
-   * Thrown when there are insufficient resources to satisfy a request.
-   */
-  static class InsufficientResourcesException extends RuntimeException {
-    public InsufficientResourcesException(String message) {
-      super(message);
-    }
-  }
-
-  /**
-   * Attempts to grab {@code numPorts} from the given resource {@code offer}.
-   *
-   * @param offer The offer to grab ports from.
-   * @param numPorts The number of ports to grab.
-   * @return The set of ports grabbed.
-   * @throws InsufficientResourcesException if not enough ports were available.
-   */
-  public static Set<Integer> getPorts(Offer offer, int numPorts)
-      throws InsufficientResourcesException {
-
-    checkNotNull(offer);
-
-    if (numPorts == 0) {
-      return ImmutableSet.of();
-    }
-
-    List<Integer> availablePorts = Lists.newArrayList(Sets.newHashSet(
-        Iterables.concat(
-            Iterables.transform(getPortRanges(offer.getResourcesList()), RANGE_TO_MEMBERS))));
-
-    if (availablePorts.size() < numPorts) {
-      throw new InsufficientResourcesException(
-          String.format("Could not get %d ports from %s", numPorts, offer));
-    }
-
-    Collections.shuffle(availablePorts);
-    return ImmutableSet.copyOf(availablePorts.subList(0, numPorts));
-  }
-
-  /**
-   * A Resources object is greater than another iff _all_ of its resource components are greater
-   * or equal. A Resources object compares as equal if some but not all components are greater than
-   * or equal to the other.
-   */
-  public static final Ordering<Resources> RESOURCE_ORDER = new Ordering<Resources>() {
-    @Override public int compare(Resources left, Resources right) {
-      int diskC = left.getDisk().compareTo(right.getDisk());
-      int ramC = left.getRam().compareTo(right.getRam());
-      int portC = Integer.compare(left.getNumPorts(), right.getNumPorts());
-      int cpuC = Double.compare(left.getNumCpus(), right.getNumCpus());
-
-      FluentIterable<Integer> vector =
-          FluentIterable.from(ImmutableList.of(diskC, ramC, portC, cpuC));
-
-      if (vector.allMatch(IS_ZERO))  {
-        return 0;
-      }
-
-      if (vector.filter(Predicates.not(IS_ZERO)).allMatch(IS_POSITIVE)) {
-        return 1;
-      }
-
-      if (vector.filter(Predicates.not(IS_ZERO)).allMatch(IS_NEGATIVE)) {
-        return -1;
-      }
-
-      return 0;
-    }
-  };
-
-  private static final Predicate<Integer> IS_POSITIVE = new Predicate<Integer>() {
-    @Override public boolean apply(Integer input) {
-      return input > 0;
-    }
-  };
-
-  private static final Predicate<Integer> IS_NEGATIVE = new Predicate<Integer>() {
-    @Override public boolean apply(Integer input) {
-      return input < 0;
-    }
-  };
-
-  private static final Predicate<Integer> IS_ZERO = new Predicate<Integer>() {
-    @Override public boolean apply(Integer input) {
-      return input == 0;
-    }
-  };
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/configuration/SanitizedConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/configuration/SanitizedConfiguration.java b/src/main/java/com/twitter/aurora/scheduler/configuration/SanitizedConfiguration.java
deleted file mode 100644
index 890acbb..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/configuration/SanitizedConfiguration.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.configuration;
-
-import java.util.Map;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Functions;
-import com.google.common.base.Objects;
-import com.google.common.collect.ContiguousSet;
-import com.google.common.collect.DiscreteDomain;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Range;
-
-import com.twitter.aurora.scheduler.configuration.ConfigurationManager.TaskDescriptionException;
-import com.twitter.aurora.scheduler.storage.entities.IJobConfiguration;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConfig;
-
-/**
- * Wrapper for a configuration that has been fully-sanitized and populated with defaults.
- */
-public final class SanitizedConfiguration {
-
-  private final IJobConfiguration sanitized;
-  private final Map<Integer, ITaskConfig> tasks;
-
-  /**
-   * Constructs a SanitizedConfiguration object and populates the set of {@link ITaskConfig}s for
-   * the provided config.
-   *
-   * @param sanitized A sanitized configuration.
-   */
-  @VisibleForTesting
-  public SanitizedConfiguration(IJobConfiguration sanitized) {
-    this.sanitized = sanitized;
-    this.tasks = Maps.toMap(
-        ContiguousSet.create(
-            Range.closedOpen(0, sanitized.getInstanceCount()),
-            DiscreteDomain.integers()),
-        Functions.constant(sanitized.getTaskConfig()));
-  }
-
-  /**
-   * Wraps an unsanitized job configuration.
-   *
-   * @param unsanitized Unsanitized configuration to sanitize/populate and wrap.
-   * @return A wrapper containing the sanitized configuration.
-   * @throws TaskDescriptionException If the configuration is invalid.
-   */
-  public static SanitizedConfiguration fromUnsanitized(IJobConfiguration unsanitized)
-      throws TaskDescriptionException {
-
-    return new SanitizedConfiguration(ConfigurationManager.validateAndPopulate(unsanitized));
-  }
-
-  public IJobConfiguration getJobConfig() {
-    return sanitized;
-  }
-
-  // TODO(William Farner): Rework this API now that all configs are identical.
-  public Map<Integer, ITaskConfig> getTaskConfigs() {
-    return tasks;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!(o instanceof SanitizedConfiguration)) {
-      return false;
-    }
-
-    SanitizedConfiguration other = (SanitizedConfiguration) o;
-
-    return Objects.equal(sanitized, other.sanitized);
-  }
-
-  @Override
-  public int hashCode() {
-    return sanitized.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return sanitized.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/CronException.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/CronException.java b/src/main/java/com/twitter/aurora/scheduler/cron/CronException.java
deleted file mode 100644
index c29a578..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/CronException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron;
-
-/**
- * Exception class to signal a failure in the underlying cron implementation.
- */
-public class CronException extends Exception {
-  public CronException(String msg) {
-    super(msg);
-  }
-
-  public CronException(String msg, Throwable t) {
-    super(msg, t);
-  }
-
-  public CronException(Throwable t) {
-    super(t);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/CronPredictor.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/CronPredictor.java b/src/main/java/com/twitter/aurora/scheduler/cron/CronPredictor.java
deleted file mode 100644
index d01e2f8..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/CronPredictor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron;
-
-import java.util.Date;
-
-/**
- * A utility function that predicts a cron run given a schedule.
- */
-public interface CronPredictor {
-  /**
-   * Predicts the next date at which a cron schedule will trigger.
-   *
-   * @param schedule Cron schedule to predict the next time for.
-   * @return A prediction for the next time a cron will run.
-   */
-  Date predictNextRun(String schedule);
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/CronScheduler.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/CronScheduler.java b/src/main/java/com/twitter/aurora/scheduler/cron/CronScheduler.java
deleted file mode 100644
index 0ea9b65..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/CronScheduler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron;
-
-import javax.annotation.Nullable;
-
-import com.google.common.base.Optional;
-
-/**
- * An execution manager that executes work on a cron schedule.
- */
-public interface CronScheduler {
-  /**
-   * Schedules a task on a cron schedule.
-   *
-   * @param schedule Cron-style schedule.
-   * @param task Work to run when on the cron schedule.
-   * @return A unique ID to identify the scheduled cron task.
-   * @throws CronException when there was a failure to schedule, for example if {@code schedule}
-   *         is not a valid input.
-   * @throws IllegalStateException If the cron scheduler is not currently running.
-   */
-  String schedule(String schedule, Runnable task) throws CronException, IllegalStateException;
-
-  /**
-   * Removes a scheduled cron item.
-   *
-   * @param key Key previously returned from {@link #schedule(String, Runnable)}.
-   * @throws IllegalStateException If the cron scheduler is not currently running.
-   */
-  void deschedule(String key) throws IllegalStateException;
-
-  /**
-   * Gets the cron schedule associated with a scheduling key.
-   *
-   * @param key Key previously returned from {@link #schedule(String, Runnable)}.
-   * @return The task's cron schedule, if a matching task was found.
-   * @throws IllegalStateException If the cron scheduler is not currently running.
-   */
-  Optional<String> getSchedule(String key) throws IllegalStateException;
-
-  /**
-   * Block until fully initialized. It is an error to call start twice. Prior to calling start,
-   * all other methods of this interface may throw {@link IllegalStateException}. The underlying
-   * implementation should not spawn threads or connect to databases prior to invocation of
-   * {@link #start()}.
-   *
-   * @throws IllegalStateException If called twice.
-   */
-  void start() throws IllegalStateException;
-
-  /**
-   * Block until stopped. Generally this means that underlying resources are freed, threads are
-   * terminated, and any bookkeeping state is persisted. If {@link #stop()} has already been called
-   * by another thread, {@link #stop()} either blocks until completion or returns immediately.
-   *
-   * @throws CronException If there was a problem stopping the scheduler, for example if it was not
-   *                       started.
-   */
-  void stop() throws CronException;
-
-  /**
-   * Checks to see if the scheduler would be accepted by the underlying scheduler.
-   *
-   * @param schedule Cron scheduler to validate.
-   * @return {@code true} if the schedule is valid.
-   */
-  boolean isValidSchedule(@Nullable String schedule);
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronModule.java b/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronModule.java
deleted file mode 100644
index d1c5419..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronModule.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron.noop;
-
-import javax.inject.Singleton;
-
-import com.google.inject.AbstractModule;
-
-import com.twitter.aurora.scheduler.cron.CronPredictor;
-import com.twitter.aurora.scheduler.cron.CronScheduler;
-
-/**
- * A Module to wire up a cron scheduler that does not actually schedule cron jobs.
- *
- * This class exists as a short term hack to get around a license compatibility issue - Real
- * Implementation (TM) coming soon.
- */
-public class NoopCronModule extends AbstractModule {
-  @Override
-  protected void configure() {
-    bind(CronScheduler.class).to(NoopCronScheduler.class);
-    bind(NoopCronScheduler.class).in(Singleton.class);
-
-    bind(CronPredictor.class).to(NoopCronPredictor.class);
-    bind(NoopCronPredictor.class).in(Singleton.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronPredictor.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronPredictor.java b/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronPredictor.java
deleted file mode 100644
index a779d2b..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronPredictor.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron.noop;
-
-import java.util.Date;
-
-import com.twitter.aurora.scheduler.cron.CronPredictor;
-
-/**
- * A cron predictor that always suggests that the next run is Unix epoch time.
- *
- * This class exists as a short term hack to get around a license compatibility issue - Real
- * Implementation (TM) coming soon.
- */
-class NoopCronPredictor implements CronPredictor {
-  @Override
-  public Date predictNextRun(String schedule) {
-    return new Date(0);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronScheduler.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronScheduler.java b/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronScheduler.java
deleted file mode 100644
index 2893a6a..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/noop/NoopCronScheduler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron.noop;
-
-import java.util.Collections;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.annotation.Nullable;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
-
-import com.twitter.aurora.scheduler.cron.CronException;
-import com.twitter.aurora.scheduler.cron.CronScheduler;
-
-/**
- * A cron scheduler that accepts cron jobs but never runs them. Useful if you want to hook up an
- * external triggering mechanism (e.g. a system cron job that calls the startCronJob RPC manually
- * on an interval).
- *
- * This class exists as a short term hack to get around a license compatibility issue - Real
- * Implementation (TM) coming soon.
- */
-class NoopCronScheduler implements CronScheduler {
-  private static final Logger LOG = Logger.getLogger(NoopCronScheduler.class.getName());
-
-  // Keep a list of schedules we've seen.
-  private final Set<String> schedules = Collections.synchronizedSet(Sets.<String>newHashSet());
-
-  @Override
-  public String schedule(String schedule, Runnable task) {
-    schedules.add(schedule);
-
-    LOG.warning(String.format(
-        "NO-OP cron scheduler is in use! %s with schedule %s WILL NOT be automatically triggered!",
-        task,
-        schedule));
-
-    return schedule;
-  }
-
-  @Override
-  public void deschedule(String key) throws IllegalStateException {
-    schedules.remove(key);
-  }
-
-  @Override
-  public Optional<String> getSchedule(String key) throws IllegalStateException {
-    return schedules.contains(key)
-        ? Optional.of(key)
-        : Optional.<String>absent();
-  }
-
-  @Override
-  public void start() throws IllegalStateException {
-    LOG.warning("NO-OP cron scheduler is in use. Cron jobs submitted will not be triggered!");
-  }
-
-  @Override
-  public void stop() throws CronException {
-    // No-op.
-  }
-
-  @Override
-  public boolean isValidSchedule(@Nullable String schedule) {
-    // Accept everything.
-    return schedule != null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/cron/testing/AbstractCronIT.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/cron/testing/AbstractCronIT.java b/src/main/java/com/twitter/aurora/scheduler/cron/testing/AbstractCronIT.java
deleted file mode 100644
index 6bfc909..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/cron/testing/AbstractCronIT.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.cron.testing;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.junit.Test;
-
-import com.twitter.aurora.scheduler.cron.CronPredictor;
-import com.twitter.aurora.scheduler.cron.CronScheduler;
-import com.twitter.common.testing.easymock.EasyMockTest;
-
-import static org.junit.Assert.assertTrue;
-
-import static com.twitter.aurora.gen.test.testConstants.VALID_CRON_SCHEDULES;
-
-/**
- * Abstract test to verify conformance with the {@link CronScheduler} interface.
- */
-public abstract class AbstractCronIT extends EasyMockTest {
-  /**
-   * Child should return an instance of the {@link CronScheduler} test under test here.
-   */
-  protected abstract CronScheduler makeCronScheduler() throws Exception;
-
-  /**
-   * Child should configure expectations for a scheduler start.
-   */
-  protected abstract void expectStartCronScheduler();
-
-  /**
-   * Child should configure expectations for a scheduler stop.
-   */
-  protected abstract void expectStopCronScheduler();
-
-  /**
-   * Child should return an instance of the {@link CronPredictor} under test here.
-   */
-  protected abstract CronPredictor makeCronPredictor() throws Exception;
-
-  @Test
-  public void testCronSchedulerLifecycle() throws Exception {
-    CronScheduler scheduler = makeCronScheduler();
-
-    expectStartCronScheduler();
-    expectStopCronScheduler();
-
-    control.replay();
-
-    scheduler.start();
-    final CountDownLatch cronRan = new CountDownLatch(1);
-    scheduler.schedule("* * * * *", new Runnable() {
-      @Override public void run() {
-        cronRan.countDown();
-      }
-    });
-    cronRan.await();
-    scheduler.stop();
-  }
-
-  @Test
-  public void testCronPredictorAcceptsValidSchedules() throws Exception {
-    control.replay();
-
-    CronPredictor cronPredictor = makeCronPredictor();
-    for (String schedule : VALID_CRON_SCHEDULES) {
-      cronPredictor.predictNextRun(schedule);
-    }
-  }
-
-  @Test
-  public void testCronScheduleValidatorAcceptsValidSchedules() throws Exception {
-    CronScheduler cron = makeCronScheduler();
-
-    control.replay();
-
-    for (String schedule : VALID_CRON_SCHEDULES) {
-      assertTrue(String.format("Cron schedule %s should validate.", schedule),
-          cron.isValidSchedule(schedule));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/events/NotifyingMethodInterceptor.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/events/NotifyingMethodInterceptor.java b/src/main/java/com/twitter/aurora/scheduler/events/NotifyingMethodInterceptor.java
deleted file mode 100644
index 2656766..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/events/NotifyingMethodInterceptor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.events;
-
-import java.lang.reflect.Method;
-import java.util.logging.Logger;
-
-import javax.inject.Inject;
-
-import com.google.common.base.Preconditions;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-
-import com.twitter.aurora.scheduler.events.PubsubEvent.Interceptors.Event;
-import com.twitter.aurora.scheduler.events.PubsubEvent.Interceptors.SendNotification;
-import com.twitter.common.base.Closure;
-
-/**
- * A method interceptor that sends pubsub notifications before and/or after a method annotated
- * with {@link SendNotification}
- * is invoked.
- */
-class NotifyingMethodInterceptor implements MethodInterceptor {
-  private static final Logger LOG = Logger.getLogger(NotifyingMethodInterceptor.class.getName());
-
-  @Inject
-  private Closure<PubsubEvent> eventSink;
-
-  private void maybeFire(Event event) {
-    if (event != Event.None) {
-      eventSink.execute(event.getEvent());
-    }
-  }
-
-  @Override
-  public Object invoke(MethodInvocation invocation) throws Throwable {
-    Preconditions.checkNotNull(eventSink, "Event sink has not yet been set.");
-
-    Method method = invocation.getMethod();
-    SendNotification sendNotification = method.getAnnotation(SendNotification.class);
-    if (sendNotification == null) {
-      LOG.warning("Interceptor should not match methods without @"
-          + SendNotification.class.getSimpleName());
-      return invocation.proceed();
-    }
-
-    maybeFire(sendNotification.before());
-    Object result = invocation.proceed();
-    maybeFire(sendNotification.after());
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/events/NotifyingSchedulingFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/events/NotifyingSchedulingFilter.java b/src/main/java/com/twitter/aurora/scheduler/events/NotifyingSchedulingFilter.java
deleted file mode 100644
index ffb952c..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/events/NotifyingSchedulingFilter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.events;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import com.google.inject.BindingAnnotation;
-
-import com.twitter.aurora.scheduler.ResourceSlot;
-import com.twitter.aurora.scheduler.events.PubsubEvent.Vetoed;
-import com.twitter.aurora.scheduler.filter.SchedulingFilter;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConfig;
-import com.twitter.common.base.Closure;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A decorating scheduling filter that sends an event when a scheduling assignment is vetoed.
- */
-class NotifyingSchedulingFilter implements SchedulingFilter {
-
-  /**
-   * Binding annotation that the underlying {@link SchedulingFilter} must be bound with.
-   */
-  @BindingAnnotation
-  @Target({FIELD, PARAMETER, METHOD}) @Retention(RUNTIME)
-  public @interface NotifyDelegate { }
-
-  private final SchedulingFilter delegate;
-  private final Closure<PubsubEvent> eventSink;
-
-  @Inject
-  NotifyingSchedulingFilter(
-      @NotifyDelegate SchedulingFilter delegate,
-      Closure<PubsubEvent> eventSink) {
-
-    this.delegate = checkNotNull(delegate);
-    this.eventSink = checkNotNull(eventSink);
-  }
-
-  @Override
-  public Set<Veto> filter(ResourceSlot offer, String slaveHost, ITaskConfig task, String taskId) {
-    Set<Veto> vetoes = delegate.filter(offer, slaveHost, task, taskId);
-    if (!vetoes.isEmpty()) {
-      eventSink.execute(new Vetoed(taskId, vetoes));
-    }
-
-    return vetoes;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/events/PubsubEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/events/PubsubEvent.java b/src/main/java/com/twitter/aurora/scheduler/events/PubsubEvent.java
deleted file mode 100644
index 400d8b7..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/events/PubsubEvent.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.events;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-
-import com.twitter.aurora.gen.HostStatus;
-import com.twitter.aurora.gen.ScheduleStatus;
-import com.twitter.aurora.scheduler.base.Tasks;
-import com.twitter.aurora.scheduler.filter.SchedulingFilter.Veto;
-import com.twitter.aurora.scheduler.storage.entities.IScheduledTask;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Event notifications related to tasks.
- */
-public interface PubsubEvent {
-
-  /**
-   * Interface with no functionality, but identifies a class as supporting task pubsub events.
-   */
-  public interface EventSubscriber {
-  }
-
-  /**
-   * Event sent when tasks were deleted.
-   */
-  public static class TasksDeleted implements PubsubEvent {
-    private final Set<IScheduledTask> tasks;
-
-    public TasksDeleted(Set<IScheduledTask> tasks) {
-      this.tasks = checkNotNull(tasks);
-    }
-
-    public Set<IScheduledTask> getTasks() {
-      return tasks;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof TasksDeleted)) {
-        return false;
-      }
-
-      TasksDeleted other = (TasksDeleted) o;
-      return Objects.equal(tasks, other.tasks);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(tasks);
-    }
-
-    @Override
-    public String toString() {
-      return Objects.toStringHelper(this)
-          .add("tasks", Tasks.ids(tasks))
-          .toString();
-    }
-  }
-
-  /**
-   * Event sent when a task changed state.
-   */
-  public static class TaskStateChange implements PubsubEvent {
-    private final IScheduledTask task;
-    private final ScheduleStatus oldState;
-
-    public TaskStateChange(IScheduledTask task, ScheduleStatus oldState) {
-      this.task = checkNotNull(task);
-      this.oldState = checkNotNull(oldState);
-    }
-
-    public String getTaskId() {
-      return Tasks.id(task);
-    }
-
-    public ScheduleStatus getOldState() {
-      return oldState;
-    }
-
-    public IScheduledTask getTask() {
-      return task;
-    }
-
-    public ScheduleStatus getNewState() {
-      return task.getStatus();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof TaskStateChange)) {
-        return false;
-      }
-
-      TaskStateChange other = (TaskStateChange) o;
-      return Objects.equal(task, other.task)
-          && Objects.equal(oldState, other.oldState);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(task, oldState);
-    }
-
-    @Override
-    public String toString() {
-      return Objects.toStringHelper(this)
-          .add("task", Tasks.id(task))
-          .add("oldState", getOldState())
-          .add("newState", getNewState())
-          .toString();
-    }
-  }
-
-  /**
-   * Event sent when a host changed maintenance state.
-   */
-  public static class HostMaintenanceStateChange implements PubsubEvent {
-    private final HostStatus status;
-
-    public HostMaintenanceStateChange(HostStatus status) {
-      this.status = checkNotNull(status);
-    }
-
-    public HostStatus getStatus() {
-      return status;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof HostMaintenanceStateChange)) {
-        return false;
-      }
-
-      HostMaintenanceStateChange other = (HostMaintenanceStateChange) o;
-      return Objects.equal(status, other.status);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(status);
-    }
-  }
-
-  /**
-   * Event sent when a scheduling assignment was vetoed.
-   */
-  public static class Vetoed implements PubsubEvent {
-    private final String taskId;
-    private final Set<Veto> vetoes;
-
-    public Vetoed(String taskId, Set<Veto> vetoes) {
-      this.taskId = checkNotNull(taskId);
-      this.vetoes = checkNotNull(vetoes);
-    }
-
-    public String getTaskId() {
-      return taskId;
-    }
-
-    public Set<Veto> getVetoes() {
-      return vetoes;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof Vetoed)) {
-        return false;
-      }
-
-      Vetoed other = (Vetoed) o;
-      return Objects.equal(taskId, other.taskId)
-          && Objects.equal(vetoes, other.vetoes);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(taskId, vetoes);
-    }
-  }
-
-  public static class TaskRescheduled implements PubsubEvent {
-    private final String role;
-    private final String job;
-    private final int instance;
-
-    public TaskRescheduled(String role, String job, int instance) {
-      this.role = role;
-      this.job = job;
-      this.instance = instance;
-    }
-
-    public String getRole() {
-      return role;
-    }
-
-    public String getJob() {
-      return job;
-    }
-
-    public int getInstance() {
-      return instance;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof TaskRescheduled)) {
-        return false;
-      }
-
-      TaskRescheduled other = (TaskRescheduled) o;
-      return Objects.equal(role, other.role)
-          && Objects.equal(job, other.job)
-          && Objects.equal(instance, other.instance);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(role, job, instance);
-    }
-  }
-
-  public static class StorageStarted implements PubsubEvent {
-    @Override
-    public boolean equals(Object o) {
-      return (o != null) && getClass().equals(o.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-      return getClass().hashCode();
-    }
-  }
-
-  public static class DriverRegistered implements PubsubEvent {
-    @Override
-    public boolean equals(Object o) {
-      return (o != null) && getClass().equals(o.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-      return getClass().hashCode();
-    }
-  }
-
-  public static class DriverDisconnected implements PubsubEvent {
-    @Override
-    public boolean equals(Object o) {
-      return (o != null) && getClass().equals(o.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-      return getClass().hashCode();
-    }
-  }
-
-  public static final class Interceptors {
-    private Interceptors() {
-      // Utility class.
-    }
-
-    public enum Event {
-      None(null),
-      StorageStarted(new StorageStarted()),
-      DriverRegistered(new DriverRegistered()),
-      DriverDisconnected(new DriverDisconnected());
-
-      private final PubsubEvent event;
-      private Event(PubsubEvent event) {
-        this.event = event;
-      }
-
-      public PubsubEvent getEvent() {
-        return event;
-      }
-    }
-
-    /**
-     * An annotation to place on methods of injected classes that which to fire events before
-     * and/or after their invocation.
-     */
-    @Target(METHOD) @Retention(RUNTIME)
-    public @interface SendNotification {
-      /**
-       * Event to fire prior to invocation.
-       */
-      Event before() default Event.None;
-
-      /**
-       * Event to fire after invocation.
-       */
-      Event after() default Event.None;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/events/PubsubEventModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/events/PubsubEventModule.java b/src/main/java/com/twitter/aurora/scheduler/events/PubsubEventModule.java
deleted file mode 100644
index a8b5633..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/events/PubsubEventModule.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.events;
-
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.eventbus.DeadEvent;
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import com.google.inject.AbstractModule;
-import com.google.inject.Binder;
-import com.google.inject.TypeLiteral;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.multibindings.Multibinder;
-
-import org.aopalliance.intercept.MethodInterceptor;
-
-import com.twitter.aurora.scheduler.events.NotifyingSchedulingFilter.NotifyDelegate;
-import com.twitter.aurora.scheduler.events.PubsubEvent.EventSubscriber;
-import com.twitter.aurora.scheduler.events.PubsubEvent.Interceptors.SendNotification;
-import com.twitter.aurora.scheduler.filter.SchedulingFilter;
-import com.twitter.common.application.modules.LifecycleModule;
-import com.twitter.common.base.Closure;
-import com.twitter.common.base.Command;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Binding module for plumbing event notifications.
- */
-public final class PubsubEventModule extends AbstractModule {
-
-  private static final Logger LOG = Logger.getLogger(PubsubEventModule.class.getName());
-
-  private PubsubEventModule() {
-    // Must be constructed through factory.
-  }
-
-  @VisibleForTesting
-  public static void installForTest(Binder binder) {
-    binder.install(new PubsubEventModule());
-  }
-
-  @Override
-  protected void configure() {
-    final EventBus eventBus = new EventBus("TaskEvents");
-    eventBus.register(new Object() {
-      @Subscribe public void logDeadEvent(DeadEvent event) {
-        LOG.warning("Captured dead event " + event.getEvent());
-      }
-    });
-
-    bind(EventBus.class).toInstance(eventBus);
-
-    Closure<PubsubEvent> eventPoster = new Closure<PubsubEvent>() {
-      @Override public void execute(PubsubEvent event) {
-        eventBus.post(event);
-      }
-    };
-    bind(new TypeLiteral<Closure<PubsubEvent>>() { }).toInstance(eventPoster);
-
-    // Ensure at least an empty binding is present.
-    getSubscriberBinder(binder());
-    LifecycleModule.bindStartupAction(binder(), RegisterSubscribers.class);
-    bindNotifyingInterceptor(binder());
-  }
-
-  static class RegisterSubscribers implements Command {
-    private final EventBus eventBus;
-    private final Set<EventSubscriber> subscribers;
-
-    @Inject
-    RegisterSubscribers(EventBus eventBus, Set<EventSubscriber> subscribers) {
-      this.eventBus = checkNotNull(eventBus);
-      this.subscribers = checkNotNull(subscribers);
-    }
-
-    @Override
-    public void execute() {
-      for (EventSubscriber subscriber : subscribers) {
-        eventBus.register(subscriber);
-      }
-    }
-  }
-
-  /**
-   * Binds a task event module.
-   *
-   * @param binder Binder to bind against.
-   * @param filterClass Delegate scheduling filter implementation class.
-   */
-  public static void bind(Binder binder, final Class<? extends SchedulingFilter> filterClass) {
-    binder.bind(SchedulingFilter.class).annotatedWith(NotifyDelegate.class).to(filterClass);
-    binder.bind(SchedulingFilter.class).to(NotifyingSchedulingFilter.class);
-    binder.bind(NotifyingSchedulingFilter.class).in(Singleton.class);
-    binder.install(new PubsubEventModule());
-  }
-
-  private static Multibinder<EventSubscriber> getSubscriberBinder(Binder binder) {
-    return Multibinder.newSetBinder(binder, EventSubscriber.class);
-  }
-
-  /**
-   * Binds a subscriber to receive task events.
-   *
-   * @param binder Binder to bind the subscriber with.
-   * @param subscriber Subscriber implementation class to register for events.
-   */
-  public static void bindSubscriber(Binder binder, Class<? extends EventSubscriber> subscriber) {
-    getSubscriberBinder(binder).addBinding().to(subscriber);
-  }
-
-  /**
-   * Binds a method interceptor to all methods annotated with {@link SendNotification}.
-   * <p>
-   * The interceptor will send notifications before and/or after the wrapped method invocation.
-   *
-   * @param binder Guice binder.
-   */
-  @VisibleForTesting
-  public static void bindNotifyingInterceptor(Binder binder) {
-    MethodInterceptor interceptor = new NotifyingMethodInterceptor();
-    binder.requestInjection(interceptor);
-    binder.bindInterceptor(
-        Matchers.any(),
-        Matchers.annotatedWith(SendNotification.class),
-        interceptor);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/filter/AttributeFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/filter/AttributeFilter.java b/src/main/java/com/twitter/aurora/scheduler/filter/AttributeFilter.java
deleted file mode 100644
index 66327fa..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/filter/AttributeFilter.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.filter;
-
-import java.util.Set;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-import com.twitter.aurora.gen.Attribute;
-import com.twitter.aurora.scheduler.base.Tasks;
-import com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.AttributeLoader;
-import com.twitter.aurora.scheduler.storage.entities.IJobKey;
-import com.twitter.aurora.scheduler.storage.entities.IScheduledTask;
-import com.twitter.aurora.scheduler.storage.entities.IValueConstraint;
-
-/**
- * Utility class that matches attributes to constraints.
- */
-final class AttributeFilter {
-
-  private static final Function<Attribute, Set<String>> GET_VALUES =
-      new Function<Attribute, Set<String>>() {
-        @Override public Set<String> apply(Attribute attribute) {
-          return attribute.getValues();
-        }
-      };
-
-  private AttributeFilter() {
-    // Utility class.
-  }
-
-  /**
-   * Tests whether a constraint is satisfied by attributes.
-   *
-   * @param attributes Host attributes.
-   * @param constraint Constraint to match.
-   * @return {@code true} if the attribute satisfies the constraint, {@code false} otherwise.
-   */
-  static boolean matches(Set<Attribute> attributes, IValueConstraint constraint) {
-    Set<String> allAttributes =
-        ImmutableSet.copyOf(Iterables.concat(Iterables.transform(attributes, GET_VALUES)));
-    boolean match = Iterables.any(constraint.getValues(), Predicates.in(allAttributes));
-    return constraint.isNegated() ^ match;
-  }
-
-  /**
-   * Tests whether an attribute matches a limit constraint.
-   *
-   * @param attributes Attributes to match against.
-   * @param jobKey Key of the job with the limited constraint.
-   * @param limit Limit value.
-   * @param activeTasks All active tasks in the system.
-   * @param attributeFetcher Interface for fetching attributes for hosts in the system.
-   * @return {@code true} if the limit constraint is satisfied, {@code false} otherwise.
-   */
-  static boolean matches(final Set<Attribute> attributes,
-      final IJobKey jobKey,
-      int limit,
-      Iterable<IScheduledTask> activeTasks,
-      final AttributeLoader attributeFetcher) {
-
-    Predicate<IScheduledTask> sameJob =
-        Predicates.compose(Predicates.equalTo(jobKey), Tasks.SCHEDULED_TO_JOB_KEY);
-
-    Predicate<IScheduledTask> hasAttribute = new Predicate<IScheduledTask>() {
-      @Override public boolean apply(IScheduledTask task) {
-        Iterable<Attribute> hostAttributes =
-            attributeFetcher.apply(task.getAssignedTask().getSlaveHost());
-        return Iterables.any(hostAttributes, Predicates.in(attributes));
-      }
-    };
-
-    return limit > Iterables.size(
-        Iterables.filter(activeTasks, Predicates.and(sameJob, hasAttribute)));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/filter/ConstraintFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/filter/ConstraintFilter.java b/src/main/java/com/twitter/aurora/scheduler/filter/ConstraintFilter.java
deleted file mode 100644
index 2612cb8..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/filter/ConstraintFilter.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.filter;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-import com.twitter.aurora.gen.Attribute;
-import com.twitter.aurora.scheduler.base.SchedulerException;
-import com.twitter.aurora.scheduler.filter.SchedulingFilter.Veto;
-import com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.AttributeLoader;
-import com.twitter.aurora.scheduler.storage.entities.IConstraint;
-import com.twitter.aurora.scheduler.storage.entities.IJobKey;
-import com.twitter.aurora.scheduler.storage.entities.IScheduledTask;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConstraint;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Filter that determines whether a task's constraints are satisfied.
- */
-class ConstraintFilter implements Function<IConstraint, Optional<Veto>> {
-
-  private static final Logger LOG = Logger.getLogger(ConstraintFilter.class.getName());
-
-  private final IJobKey jobKey;
-  private final Supplier<Collection<IScheduledTask>> activeTasksSupplier;
-  private final AttributeLoader attributeLoader;
-  private final Iterable<Attribute> hostAttributes;
-
-  /**
-   * Creates a new constraint filer for a given job.
-   *
-   * @param jobKey Key for the job.
-   * @param activeTasksSupplier Supplier to fetch active tasks (if necessary).
-   * @param attributeLoader Interface to fetch host attributes (if necessary).
-   * @param hostAttributes The attributes of the host to test against.
-   */
-  ConstraintFilter(
-      IJobKey jobKey,
-      Supplier<Collection<IScheduledTask>> activeTasksSupplier,
-      AttributeLoader attributeLoader,
-      Iterable<Attribute> hostAttributes) {
-
-    this.jobKey = checkNotNull(jobKey);
-    this.activeTasksSupplier = checkNotNull(activeTasksSupplier);
-    this.attributeLoader = checkNotNull(attributeLoader);
-    this.hostAttributes = checkNotNull(hostAttributes);
-  }
-
-  @VisibleForTesting
-  static Veto limitVeto(String limit) {
-    return new Veto("Limit not satisfied: " + limit, Veto.MAX_SCORE);
-  }
-
-  @VisibleForTesting
-  static Veto mismatchVeto(String constraint) {
-    return Veto.constraintMismatch("Constraint not satisfied: " + constraint);
-  }
-
-  @VisibleForTesting
-  static Veto maintenanceVeto(String reason) {
-    return new Veto("Host " + reason + " for maintenance", Veto.MAX_SCORE);
-  }
-
-  @Override
-  public Optional<Veto> apply(IConstraint constraint) {
-    Set<Attribute> attributes =
-        ImmutableSet.copyOf(Iterables.filter(hostAttributes, new NameFilter(constraint.getName())));
-
-    ITaskConstraint taskConstraint = constraint.getConstraint();
-    switch (taskConstraint.getSetField()) {
-      case VALUE:
-        boolean matches =
-            AttributeFilter.matches(attributes, taskConstraint.getValue());
-        return matches
-            ? Optional.<Veto>absent()
-            : Optional.of(mismatchVeto(constraint.getName()));
-
-      case LIMIT:
-        if (attributes.isEmpty()) {
-          return Optional.of(mismatchVeto(constraint.getName()));
-        }
-
-        boolean satisfied = AttributeFilter.matches(
-            attributes,
-            jobKey,
-            taskConstraint.getLimit().getLimit(),
-            activeTasksSupplier.get(),
-            attributeLoader);
-        return satisfied
-            ? Optional.<Veto>absent()
-            : Optional.of(limitVeto(constraint.getName()));
-
-      default:
-        LOG.warning("Unrecognized constraint type: " + taskConstraint.getSetField());
-        throw new SchedulerException("Failed to recognize the constraint type: "
-            + taskConstraint.getSetField());
-    }
-  }
-
-  /**
-   * A filter to find attributes matching a name.
-   */
-  static class NameFilter implements Predicate<Attribute> {
-    private final String attributeName;
-
-    NameFilter(String attributeName) {
-      this.attributeName = attributeName;
-    }
-
-    @Override public boolean apply(Attribute attribute) {
-      return attributeName.equals(attribute.getName());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilter.java b/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilter.java
deleted file mode 100644
index 7e8fbdb..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilter.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.filter;
-
-import java.util.Set;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Objects;
-
-import com.twitter.aurora.scheduler.ResourceSlot;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConfig;
-
-/**
- * Determines whether a proposed scheduling assignment should be allowed.
- */
-public interface SchedulingFilter {
-
-  /**
-   * Reason for a proposed scheduling assignment to be filtered out.
-   * A veto also contains a score, which is an opaque indicator as to how strong a veto is.  This
-   * is only intended to be used for relative ranking of vetoes for determining which veto against
-   * a scheduling assignment is 'weakest'.
-   */
-  public static class Veto {
-    public static final int MAX_SCORE = 1000;
-
-    private final String reason;
-    private final int score;
-    private final boolean valueMismatch;
-
-    private Veto(String reason, int score, boolean valueMismatch) {
-      this.reason = reason;
-      this.score = Math.min(MAX_SCORE, score);
-      this.valueMismatch = valueMismatch;
-    }
-
-    @VisibleForTesting
-    public Veto(String reason, int score) {
-      this(reason, score, false);
-    }
-
-    /**
-     * Creates a special veto that represents a mismatch between the server and task's configuration
-     * for an attribute.
-     *
-     * @param reason Information about the value mismatch.
-     * @return A constraint mismatch veto.
-     */
-    public static Veto constraintMismatch(String reason) {
-      return new Veto(reason, MAX_SCORE, true);
-    }
-
-    public String getReason() {
-      return reason;
-    }
-
-    public int getScore() {
-      return score;
-    }
-
-    public boolean isConstraintMismatch() {
-      return valueMismatch;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (!(o instanceof Veto)) {
-        return false;
-      }
-
-      Veto other = (Veto) o;
-      return Objects.equal(reason, other.reason)
-          && (score == other.score)
-          && (valueMismatch == other.valueMismatch);
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hashCode(reason, score, valueMismatch);
-    }
-
-    @Override
-    public String toString() {
-      return Objects.toStringHelper(this)
-          .add("reason", reason)
-          .add("score", score)
-          .add("valueMismatch", valueMismatch)
-          .toString();
-    }
-  }
-
-  /**
-   * Applies a task against the filter with the given resources, and on the host.
-   *
-   * @param offer Resources offered.
-   * @param slaveHost Host that the resources are associated with.
-   * @param task Task.
-   * @param taskId Canonical ID of the task.
-   * @return A set of vetoes indicating reasons the task cannot be scheduled.  If the task may be
-   *    scheduled, the set will be empty.
-   */
-  Set<Veto> filter(ResourceSlot offer, String slaveHost, ITaskConfig task, String taskId);
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilterImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilterImpl.java b/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilterImpl.java
deleted file mode 100644
index 33272ce..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/filter/SchedulingFilterImpl.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.filter;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Ordering;
-import com.google.common.collect.Sets;
-
-import com.twitter.aurora.gen.Attribute;
-import com.twitter.aurora.gen.MaintenanceMode;
-import com.twitter.aurora.gen.ScheduleStatus;
-import com.twitter.aurora.gen.TaskConstraint;
-import com.twitter.aurora.scheduler.ResourceSlot;
-import com.twitter.aurora.scheduler.base.Query;
-import com.twitter.aurora.scheduler.base.Tasks;
-import com.twitter.aurora.scheduler.configuration.ConfigurationManager;
-import com.twitter.aurora.scheduler.state.MaintenanceController;
-import com.twitter.aurora.scheduler.storage.AttributeStore;
-import com.twitter.aurora.scheduler.storage.Storage;
-import com.twitter.aurora.scheduler.storage.Storage.StoreProvider;
-import com.twitter.aurora.scheduler.storage.Storage.Work.Quiet;
-import com.twitter.aurora.scheduler.storage.entities.IConstraint;
-import com.twitter.aurora.scheduler.storage.entities.IScheduledTask;
-import com.twitter.aurora.scheduler.storage.entities.ITaskConfig;
-import com.twitter.common.quantity.Amount;
-import com.twitter.common.quantity.Data;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import static com.twitter.aurora.gen.MaintenanceMode.DRAINED;
-import static com.twitter.aurora.gen.MaintenanceMode.DRAINING;
-import static com.twitter.aurora.scheduler.configuration.ConfigurationManager.DEDICATED_ATTRIBUTE;
-import static com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.ResourceVector.CPU;
-import static com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.ResourceVector.DISK;
-import static com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.ResourceVector.PORTS;
-import static com.twitter.aurora.scheduler.filter.SchedulingFilterImpl.ResourceVector.RAM;
-
-/**
- * Implementation of the scheduling filter that ensures resource requirements of tasks are
- * fulfilled, and that tasks are allowed to run on the given machine.
- *
- */
-public class SchedulingFilterImpl implements SchedulingFilter {
-
-  @VisibleForTesting static final Veto DEDICATED_HOST_VETO =
-      Veto.constraintMismatch("Host is dedicated");
-
-  private static final Optional<Veto> NO_VETO = Optional.absent();
-
-  private static final Set<MaintenanceMode> VETO_MODES = EnumSet.of(DRAINING, DRAINED);
-
-  private final Storage storage;
-  private final MaintenanceController maintenance;
-
-  /**
-   * Creates a new scheduling filter.
-   *
-   * @param storage Interface to accessing the task store.
-   * @param maintenance Interface to accessing the maintenance controller
-   */
-  @Inject
-  public SchedulingFilterImpl(Storage storage, MaintenanceController maintenance) {
-    this.storage = checkNotNull(storage);
-    this.maintenance = checkNotNull(maintenance);
-  }
-
-  /**
-   * A function that fetches attributes associated with a given host.
-   */
-  public interface AttributeLoader extends Function<String, Iterable<Attribute>> { }
-
-  /**
-   * A function that may veto a task.
-   */
-  private interface FilterRule extends Function<ITaskConfig, Iterable<Veto>> { }
-
-  /**
-   * Convenience class for a rule that will only ever have a single veto.
-   */
-  private abstract static class SingleVetoRule implements FilterRule {
-    @Override public final Iterable<Veto> apply(ITaskConfig task) {
-      return doApply(task).asSet();
-    }
-
-    abstract Optional<Veto> doApply(ITaskConfig task);
-  }
-
-  // Scaling ranges to use for comparison of vetos.  This has no real bearing besides trying to
-  // determine if a veto along one resource vector is a 'stronger' veto than that of another vector.
-  // The values below represent the maximum resources on a typical slave machine.
-  @VisibleForTesting
-  enum ResourceVector {
-    CPU("CPU", 16),
-    RAM("RAM", Amount.of(24, Data.GB).as(Data.MB)),
-    DISK("disk", Amount.of(450, Data.GB).as(Data.MB)),
-    PORTS("ports", 1000);
-
-    private final String name;
-    private final int range;
-    @VisibleForTesting
-    int getRange() {
-      return range;
-    }
-
-    private ResourceVector(String name, int range) {
-      this.name = name;
-      this.range = range;
-    }
-
-    Optional<Veto> maybeVeto(double available, double requested) {
-      double tooLarge = requested - available;
-      if (tooLarge <= 0) {
-        return NO_VETO;
-      } else {
-        return Optional.of(veto(tooLarge));
-      }
-    }
-
-    private static int scale(double value, int range) {
-      return Math.min(Veto.MAX_SCORE, (int) ((Veto.MAX_SCORE * value)) / range);
-    }
-
-    @VisibleForTesting
-    Veto veto(double excess) {
-      return new Veto("Insufficient " + name, scale(excess, range));
-    }
-  }
-
-  private Iterable<FilterRule> rulesFromOffer(final ResourceSlot available) {
-    return ImmutableList.<FilterRule>of(
-        new SingleVetoRule() {
-          @Override public Optional<Veto> doApply(ITaskConfig task) {
-            return CPU.maybeVeto(
-                available.getNumCpus(),
-                ResourceSlot.from(task).getNumCpus());
-          }
-        },
-        new SingleVetoRule() {
-          @Override public Optional<Veto> doApply(ITaskConfig task) {
-            return RAM.maybeVeto(
-                available.getRam().as(Data.MB),
-                ResourceSlot.from(task).getRam().as(Data.MB));
-          }
-        },
-        new SingleVetoRule() {
-          @Override public Optional<Veto> doApply(ITaskConfig task) {
-            return DISK.maybeVeto(available.getDisk().as(Data.MB),
-                ResourceSlot.from(task).getDisk().as(Data.MB));
-          }
-        },
-        new SingleVetoRule() {
-          @Override public Optional<Veto> doApply(ITaskConfig task) {
-            return PORTS.maybeVeto(available.getNumPorts(),
-                ResourceSlot.from(task).getNumPorts());
-          }
-        }
-    );
-  }
-
-  private static boolean isValueConstraint(IConstraint constraint) {
-    return constraint.getConstraint().getSetField() == TaskConstraint._Fields.VALUE;
-  }
-
-  private static final Ordering<IConstraint> VALUES_FIRST = Ordering.from(
-      new Comparator<IConstraint>() {
-        @Override public int compare(IConstraint a, IConstraint b) {
-          if (a.getConstraint().getSetField() == b.getConstraint().getSetField()) {
-            return 0;
-          }
-          return isValueConstraint(a) ? -1 : 1;
-        }
-      });
-
-  private static final Iterable<ScheduleStatus> ACTIVE_NOT_PENDING_STATES =
-      EnumSet.copyOf(Sets.difference(Tasks.ACTIVE_STATES, EnumSet.of(ScheduleStatus.PENDING)));
-
-  private FilterRule getConstraintFilter(final String slaveHost) {
-    return new FilterRule() {
-      @Override public Iterable<Veto> apply(final ITaskConfig task) {
-        if (!task.isSetConstraints()) {
-          return ImmutableList.of();
-        }
-
-        // In the interest of performance, we perform a weakly consistent read here.  The biggest
-        // risk of this is that we might schedule against stale host attributes, or we might fail
-        // to correctly satisfy a diversity constraint.  Given that the likelihood is relatively low
-        // for both of these, and the impact is also low, the weak consistency is acceptable.
-        return storage.weaklyConsistentRead(new Quiet<Iterable<Veto>>() {
-          @Override public Iterable<Veto> apply(final StoreProvider storeProvider) {
-            AttributeLoader attributeLoader = new AttributeLoader() {
-              @Override public Iterable<Attribute> apply(String host) {
-                return AttributeStore.Util.attributesOrNone(storeProvider, host);
-              }
-            };
-
-            Supplier<Collection<IScheduledTask>> activeTasksSupplier =
-                Suppliers.memoize(new Supplier<Collection<IScheduledTask>>() {
-                  @Override public Collection<IScheduledTask> get() {
-                    return storeProvider.getTaskStore().fetchTasks(
-                        Query.jobScoped(Tasks.INFO_TO_JOB_KEY.apply(task))
-                            .byStatus(ACTIVE_NOT_PENDING_STATES));
-                  }
-                });
-
-            ConstraintFilter constraintFilter = new ConstraintFilter(
-                Tasks.INFO_TO_JOB_KEY.apply(task),
-                activeTasksSupplier,
-                attributeLoader,
-                attributeLoader.apply(slaveHost));
-            ImmutableList.Builder<Veto> vetoes = ImmutableList.builder();
-            for (IConstraint constraint : VALUES_FIRST.sortedCopy(task.getConstraints())) {
-              Optional<Veto> veto = constraintFilter.apply(constraint);
-              if (veto.isPresent()) {
-                vetoes.add(veto.get());
-                if (isValueConstraint(constraint)) {
-                  // Break when a value constraint mismatch is found to avoid other
-                  // potentially-expensive operations to satisfy other constraints.
-                  break;
-                }
-              }
-            }
-
-            return vetoes.build();
-          }
-        });
-      }
-    };
-  }
-
-  private Optional<Veto> getMaintenanceVeto(String slaveHost) {
-    MaintenanceMode mode = maintenance.getMode(slaveHost);
-    return VETO_MODES.contains(mode)
-        ? Optional.of(ConstraintFilter.maintenanceVeto(mode.toString().toLowerCase()))
-        : NO_VETO;
-  }
-
-  private Set<Veto> getResourceVetoes(ResourceSlot offer, ITaskConfig task) {
-    ImmutableSet.Builder<Veto> builder = ImmutableSet.builder();
-    for (FilterRule rule : rulesFromOffer(offer)) {
-      builder.addAll(rule.apply(task));
-    }
-    return builder.build();
-  }
-
-  private boolean isDedicated(final String slaveHost) {
-    Iterable<Attribute> slaveAttributes =
-        storage.weaklyConsistentRead(new Quiet<Iterable<Attribute>>() {
-          @Override public Iterable<Attribute> apply(final StoreProvider storeProvider) {
-            return AttributeStore.Util.attributesOrNone(storeProvider, slaveHost);
-          }
-        });
-
-    return Iterables.any(slaveAttributes, new ConstraintFilter.NameFilter(DEDICATED_ATTRIBUTE));
-  }
-
-  @Override
-  public Set<Veto> filter(ResourceSlot offer, String slaveHost, ITaskConfig task, String taskId) {
-    if (!ConfigurationManager.isDedicated(task) && isDedicated(slaveHost)) {
-      return ImmutableSet.of(DEDICATED_HOST_VETO);
-    }
-    return ImmutableSet.<Veto>builder()
-        .addAll(getConstraintFilter(slaveHost).apply(task))
-        .addAll(getResourceVetoes(offer, task))
-        .addAll(getMaintenanceVeto(slaveHost).asSet())
-        .build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/http/ClusterName.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/http/ClusterName.java b/src/main/java/com/twitter/aurora/scheduler/http/ClusterName.java
deleted file mode 100644
index 90c87a7..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/http/ClusterName.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.http;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Binding annotation for the cluster name.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface ClusterName { }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/http/Cron.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/http/Cron.java b/src/main/java/com/twitter/aurora/scheduler/http/Cron.java
deleted file mode 100644
index 8c97b5e..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/http/Cron.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.http;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import com.google.common.collect.ImmutableMap;
-
-import com.twitter.aurora.scheduler.state.CronJobManager;
-
-/**
- * HTTP interface to dump state of the internal cron scheduler.
- */
-@Path("/cron")
-public class Cron {
-  private final CronJobManager cronManager;
-
-  @Inject
-  Cron(CronJobManager cronManager) {
-    this.cronManager = cronManager;
-  }
-
-  /**
-   * Dumps the state of the cron manager.
-   *
-   * @return An HTTP response containing the cron manager's state.
-   */
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response dumpContents() {
-    Map<String, Object> response = ImmutableMap.<String, Object>builder()
-        .put("scheduled", cronManager.getScheduledJobs())
-        .put("pending", cronManager.getPendingRuns())
-        .build();
-
-   return Response.ok(response).build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/bc1635df/src/main/java/com/twitter/aurora/scheduler/http/DisplayUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/twitter/aurora/scheduler/http/DisplayUtils.java b/src/main/java/com/twitter/aurora/scheduler/http/DisplayUtils.java
deleted file mode 100644
index b4a2762..0000000
--- a/src/main/java/com/twitter/aurora/scheduler/http/DisplayUtils.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2013 Twitter, Inc.
- *
- * 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.twitter.aurora.scheduler.http;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Ordering;
-
-import com.twitter.aurora.scheduler.MesosTaskFactory.MesosTaskFactoryImpl;
-import com.twitter.aurora.scheduler.http.SchedulerzHome.Role;
-import com.twitter.aurora.scheduler.http.SchedulerzRole.Job;
-import com.twitter.aurora.scheduler.storage.entities.IJobKey;
-import com.twitter.common.args.Arg;
-import com.twitter.common.args.CmdLine;
-
-/**
- * Utility class to hold common display helper functions.
- */
-public final class DisplayUtils {
-
-  @CmdLine(name = "viz_job_url_prefix", help = "URL prefix for job container stats.")
-  private static final Arg<String> VIZ_JOB_URL_PREFIX = Arg.create("");
-
-  private DisplayUtils() {
-    // Utility class.
-  }
-
-  static final Ordering<Role> ROLE_ORDERING = Ordering.natural().onResultOf(
-      new Function<Role, String>() {
-        @Override public String apply(Role role) {
-          return role.getRole();
-        }
-      });
-
-  static final Ordering<Job> JOB_ORDERING = Ordering.natural().onResultOf(
-      new Function<Job, String>() {
-        @Override public String apply(Job job) {
-          return job.getName();
-        }
-      });
-
-  static String getJobDashboardUrl(IJobKey jobKey) {
-    return VIZ_JOB_URL_PREFIX.get() + MesosTaskFactoryImpl.getJobSourceName(jobKey);
-  }
-}