Skip to content
Permalink
Browse files
JCLOUDS-40 unasync Fallback.
  • Loading branch information
Adrian Cole committed Oct 6, 2014
1 parent 491dc97 commit 389a3d8c4468f2bb2e23ef6feb607c42f7ee774b
Showing 12 changed files with 28 additions and 116 deletions.
@@ -17,23 +17,16 @@

package org.jclouds.openstack.marconi.v1.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.marconi.v1.domain.Queues;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptyQueuesFallback implements Fallback<Queues> {

public ListenableFuture<Queues> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.marconi.v1.domain.Queues;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptyQueuesFallback implements Fallback<Queues> {
@Override
public Queues createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.FloatingIPs;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptyFloatingIPsFallback implements Fallback<FloatingIPs> {

public ListenableFuture<FloatingIPs> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.FloatingIPs;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptyFloatingIPsFallback implements Fallback<FloatingIPs> {
@Override
public FloatingIPs createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Networks;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptyNetworksFallback implements Fallback<Networks> {

public ListenableFuture<Networks> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Networks;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptyNetworksFallback implements Fallback<Networks> {
@Override
public Networks createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Ports;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptyPortsFallback implements Fallback<Ports> {

public ListenableFuture<Ports> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Ports;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptyPortsFallback implements Fallback<Ports> {
@Override
public Ports createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Routers;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptyRoutersFallback implements Fallback<Routers> {

public ListenableFuture<Routers> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Routers;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptyRoutersFallback implements Fallback<Routers> {
@Override
public Routers createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -19,21 +19,14 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Rules;
import org.jclouds.rest.ResourceNotFoundException;
import com.google.common.util.concurrent.ListenableFuture;

public class EmptyRulesFallback implements Fallback<Rules> {

public ListenableFuture<Rules> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}

@Override
public Rules createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.SecurityGroups;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptySecurityGroupsFallback implements Fallback<SecurityGroups> {

public ListenableFuture<SecurityGroups> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.SecurityGroups;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptySecurityGroupsFallback implements Fallback<SecurityGroups> {
@Override
public SecurityGroups createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -17,23 +17,16 @@

package org.jclouds.openstack.neutron.v2.fallbacks;

import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Subnets;
import org.jclouds.rest.ResourceNotFoundException;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

public class EmptySubnetsFallback implements Fallback<Subnets> {

public ListenableFuture<Subnets> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}
import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.Subnets;
import org.jclouds.rest.ResourceNotFoundException;

public class EmptySubnetsFallback implements Fallback<Subnets> {
@Override
public Subnets createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -19,22 +19,14 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors;
import org.jclouds.rest.ResourceNotFoundException;

import com.google.common.util.concurrent.ListenableFuture;

public class EmptyHealthMonitorsFallback implements Fallback<HealthMonitors> {

public ListenableFuture<HealthMonitors> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}

@Override
public HealthMonitors createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -19,22 +19,14 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members;
import org.jclouds.rest.ResourceNotFoundException;

import com.google.common.util.concurrent.ListenableFuture;

public class EmptyMembersFallback implements Fallback<Members> {

public ListenableFuture<Members> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}

@Override
public Members createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -19,22 +19,14 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools;
import org.jclouds.rest.ResourceNotFoundException;

import com.google.common.util.concurrent.ListenableFuture;

public class EmptyPoolsFallback implements Fallback<Pools> {

public ListenableFuture<Pools> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}

@Override
public Pools createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
@@ -19,22 +19,14 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;

import org.jclouds.Fallback;
import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs;
import org.jclouds.rest.ResourceNotFoundException;

import com.google.common.util.concurrent.ListenableFuture;

public class EmptyVIPsFallback implements Fallback<VIPs> {

public ListenableFuture<VIPs> create(Throwable t) throws Exception {
return immediateFuture(createOrPropagate(t));
}

@Override
public VIPs createOrPropagate(Throwable t) throws Exception {
if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)

0 comments on commit 389a3d8

Please sign in to comment.