Merge pull request #1186 from dralves/gce-base

gce - paging system bug correction
This commit is contained in:
Adrian Cole 2013-01-16 15:04:21 -08:00
commit b239a0239a
8 changed files with 16 additions and 25 deletions

View File

@ -19,9 +19,9 @@
package org.jclouds.googlecompute.functions.internal;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.collect.Iterables.tryFind;
import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.collect.PagedIterables;
@ -31,9 +31,8 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.InvocationContext;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.collect.Iterables.tryFind;
/**
* @author Adrian Cole
@ -57,13 +56,11 @@ public abstract class BaseToPagedIterable<T, I extends BaseToPagedIterable<T, I>
+ "project", request.getCaller().get().getInvokable());
return PagedIterables.advance(
input,
fetchNextPage(project.get().toString(), (String) input.nextMarker().orNull(),
(ListOptions) listOptions.orNull()));
input, fetchNextPage(project.get().toString(), (ListOptions) listOptions.orNull()));
}
protected abstract Function<Object, IterableWithMarker<T>> fetchNextPage(String projectName, String marker,
ListOptions listOptions);
protected abstract Function<Object, IterableWithMarker<T>> fetchNextPage(String projectName,
ListOptions listOptions);
@SuppressWarnings("unchecked")
@Override

View File

@ -56,13 +56,12 @@ public class ParseDisks extends ParseJson<ListPage<Disk>> {
@Override
protected Function<Object, IterableWithMarker<Disk>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Disk>>() {
@Override
public IterableWithMarker<Disk> apply(Object input) {
return api.getDiskApiForProject(projectName).listAtMarker(marker, options);
return api.getDiskApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -54,13 +54,12 @@ public class ParseFirewalls extends ParseJson<ListPage<Firewall>> {
@Override
protected Function<Object, IterableWithMarker<Firewall>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Firewall>>() {
@Override
public IterableWithMarker<Firewall> apply(Object input) {
return api.getFirewallApiForProject(projectName).listAtMarker(marker, options);
return api.getFirewallApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -54,13 +54,12 @@ public class ParseKernels extends ParseJson<ListPage<Kernel>> {
@Override
protected Function<Object, IterableWithMarker<Kernel>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Kernel>>() {
@Override
public IterableWithMarker<Kernel> apply(Object input) {
return api.getKernelApiForProject(projectName).listAtMarker(marker, options);
return api.getKernelApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -54,13 +54,12 @@ public class ParseMachineTypes extends ParseJson<ListPage<MachineType>> {
@Override
protected Function<Object, IterableWithMarker<MachineType>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<MachineType>>() {
@Override
public IterableWithMarker<MachineType> apply(Object input) {
return api.getMachineTypeApiForProject(projectName).listAtMarker(marker, options);
return api.getMachineTypeApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -54,13 +54,12 @@ public class ParseNetworks extends ParseJson<ListPage<Network>> {
@Override
protected Function<Object, IterableWithMarker<Network>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Network>>() {
@Override
public IterableWithMarker<Network> apply(Object input) {
return api.getNetworkApiForProject(projectName).listAtMarker(marker, options);
return api.getNetworkApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -54,13 +54,12 @@ public class ParseOperations extends ParseJson<ListPage<Operation>> {
@Override
protected Function<Object, IterableWithMarker<Operation>> fetchNextPage(final String projectName,
final String marker,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Operation>>() {
@Override
public IterableWithMarker<Operation> apply(Object input) {
return api.getOperationApiForProject(projectName).listAtMarker(marker, options);
return api.getOperationApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}

View File

@ -53,13 +53,13 @@ public class ParseZones extends ParseJson<ListPage<Zone>> {
}
@Override
protected Function<Object, IterableWithMarker<Zone>> fetchNextPage(final String projectName, final String marker,
protected Function<Object, IterableWithMarker<Zone>> fetchNextPage(final String projectName,
final ListOptions options) {
return new Function<Object, IterableWithMarker<Zone>>() {
@Override
public IterableWithMarker<Zone> apply(Object input) {
return api.getZoneApiForProject(projectName).listAtMarker(marker, options);
return api.getZoneApiForProject(projectName).listAtMarker(input.toString(), options);
}
};
}