Updated Branches: refs/heads/master 6e2a6980b -> 8760b0fd3
Removed unused search service in Abiquo Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/8760b0fd Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/8760b0fd Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/8760b0fd Branch: refs/heads/master Commit: 8760b0fd340862f5c32de745d56a8a94e93fdd5c Parents: 6e2a698 Author: Ignasi Barrera <[email protected]> Authored: Sun Aug 11 23:03:32 2013 +0200 Committer: Ignasi Barrera <[email protected]> Committed: Mon Aug 12 09:14:23 2013 +0200 ---------------------------------------------------------------------- .../java/org/jclouds/abiquo/AbiquoContext.java | 8 -- .../abiquo/features/services/SearchService.java | 125 ------------------ .../abiquo/internal/AbiquoContextImpl.java | 11 +- .../abiquo/internal/BaseSearchService.java | 132 ------------------- .../abiquo/internal/BaseSearchServiceTest.java | 37 ------ 5 files changed, 1 insertion(+), 312 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/8760b0fd/abiquo/src/main/java/org/jclouds/abiquo/AbiquoContext.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/AbiquoContext.java b/abiquo/src/main/java/org/jclouds/abiquo/AbiquoContext.java index 7f0d679..b0f6756 100644 --- a/abiquo/src/main/java/org/jclouds/abiquo/AbiquoContext.java +++ b/abiquo/src/main/java/org/jclouds/abiquo/AbiquoContext.java @@ -20,7 +20,6 @@ import org.jclouds.abiquo.features.services.AdministrationService; import org.jclouds.abiquo.features.services.CloudService; import org.jclouds.abiquo.features.services.EventService; import org.jclouds.abiquo.features.services.MonitoringService; -import org.jclouds.abiquo.features.services.SearchService; import org.jclouds.abiquo.internal.AbiquoContextImpl; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.rest.ApiContext; @@ -59,13 +58,6 @@ public interface AbiquoContext extends ComputeServiceContext { CloudService getCloudService(); /** - * Returns the search service. - * <p> - * This service provides an entry point to listing and filtering tasks. - */ - SearchService getSearchService(); - - /** * Returns the monitoring service. * <p> * This service provides an entry point to asynchronous task monitoring http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/8760b0fd/abiquo/src/main/java/org/jclouds/abiquo/features/services/SearchService.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/features/services/SearchService.java b/abiquo/src/main/java/org/jclouds/abiquo/features/services/SearchService.java deleted file mode 100644 index 7588879..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/features/services/SearchService.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.abiquo.features.services; - -import org.jclouds.abiquo.domain.cloud.VirtualDatacenter; -import org.jclouds.abiquo.domain.cloud.Volume; -import org.jclouds.abiquo.domain.cloud.options.VolumeOptions; -import org.jclouds.abiquo.domain.enterprise.Enterprise; -import org.jclouds.abiquo.domain.enterprise.options.EnterpriseOptions; -import org.jclouds.abiquo.domain.infrastructure.Datacenter; -import org.jclouds.abiquo.domain.infrastructure.StorageDevice; -import org.jclouds.abiquo.domain.infrastructure.StoragePool; -import org.jclouds.abiquo.domain.infrastructure.options.StoragePoolOptions; -import org.jclouds.abiquo.domain.network.PrivateIp; -import org.jclouds.abiquo.domain.network.PrivateNetwork; -import org.jclouds.abiquo.domain.network.PublicIp; -import org.jclouds.abiquo.domain.network.options.IpOptions; -import org.jclouds.abiquo.internal.BaseSearchService; - -import com.google.inject.ImplementedBy; - -/** - * Provides high level Abiquo search, filter and pagination operations. - * - * @author Ignasi Barrera - * @author Francesc Montserrat - */ -@ImplementedBy(BaseSearchService.class) -public interface SearchService { - /*********************** Enterprise ***********************/ - - /** - * Get the list of filtered enterprises. - * - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<Enterprise> searchEnterprises(final EnterpriseOptions options); - - /** - * Get the list of filtered enterprises for a datacenter. - * - * @param datacenter - * The given datacenter. - * @param options - * The set of filtering and pagination options of the search. - * @see API: <a href= - * "http://community.abiquo.com/display/ABI20/Datacenter+Resource#DatacenterResource-Retrievealistofenterprisesusingdatacenter" - * > http://community.abiquo.com/display/ABI20/Datacenter+Resource# - * DatacenterResource- Retrievealistofenterprisesusingdatacenter</a> - */ - Iterable<Enterprise> searchEnterprisesUsingDatacenter(final Datacenter datacenter, final EnterpriseOptions options); - - /*********************** Volume ***********************/ - - /** - * Get the list of filtered volumes for a virtual datacenter. - * - * @param virtualDatacenter - * The given virtual datacenter. - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<Volume> searchVolumes(final VirtualDatacenter virtualDatacenter, final VolumeOptions options); - - /*********************** Storage Pool ***********************/ - - /** - * Get the list of filtered storage pools for a storage device. - * - * @param device - * The given storage device. - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<StoragePool> searchStoragePools(final StorageDevice device, final StoragePoolOptions options); - - /*********************** Private IPs ***********************/ - - /** - * Get the list of filtered ips for a private network. - * - * @param network - * The given private network. - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<PrivateIp> searchPrivateIps(final PrivateNetwork network, final IpOptions options); - - /*********************** Public IPs ***********************/ - - /** - * Get the list of filtered public ips to purchase by a virtual datacenter. - * - * @param virtualDatacenter - * The given virtual datacenter. - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<PublicIp> searchPublicIpsToPurchase(final VirtualDatacenter virtualDatacenter, final IpOptions options); - - /** - * Get the list of filtered purchased public ips by a virtual datacenter. - * - * @param virtualDatacenter - * The given virtual datacenter. - * @param options - * The set of filtering and pagination options of the search. - */ - Iterable<PublicIp> searchPurchasedPublicIps(final VirtualDatacenter virtualDatacenter, final IpOptions options); -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/8760b0fd/abiquo/src/main/java/org/jclouds/abiquo/internal/AbiquoContextImpl.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/internal/AbiquoContextImpl.java b/abiquo/src/main/java/org/jclouds/abiquo/internal/AbiquoContextImpl.java index 9ab82e4..3bfb395 100644 --- a/abiquo/src/main/java/org/jclouds/abiquo/internal/AbiquoContextImpl.java +++ b/abiquo/src/main/java/org/jclouds/abiquo/internal/AbiquoContextImpl.java @@ -28,7 +28,6 @@ import org.jclouds.abiquo.features.services.AdministrationService; import org.jclouds.abiquo.features.services.CloudService; import org.jclouds.abiquo.features.services.EventService; import org.jclouds.abiquo.features.services.MonitoringService; -import org.jclouds.abiquo.features.services.SearchService; import org.jclouds.compute.ComputeService; import org.jclouds.compute.Utils; import org.jclouds.compute.internal.ComputeServiceContextImpl; @@ -49,8 +48,6 @@ public class AbiquoContextImpl extends ComputeServiceContextImpl implements Abiq private final CloudService cloudService; - private final SearchService searchService; - private final MonitoringService monitoringService; private final EventService eventService; @@ -59,11 +56,10 @@ public class AbiquoContextImpl extends ComputeServiceContextImpl implements Abiq public AbiquoContextImpl(@Provider final Context wrapped, @Provider final TypeToken<? extends Context> wrappedType, final ComputeService computeService, final Utils utils, final ApiContext<AbiquoApi> providerSpecificContext, final AdministrationService administrationService, final CloudService cloudService, - final SearchService searchService, final MonitoringService monitoringService, final EventService eventService) { + final MonitoringService monitoringService, final EventService eventService) { super(wrapped, wrappedType, computeService, utils); this.administrationService = checkNotNull(administrationService, "administrationService"); this.cloudService = checkNotNull(cloudService, "cloudService"); - this.searchService = checkNotNull(searchService, "searchService"); this.monitoringService = checkNotNull(monitoringService, "monitoringService"); this.eventService = checkNotNull(eventService, "eventService"); } @@ -84,11 +80,6 @@ public class AbiquoContextImpl extends ComputeServiceContextImpl implements Abiq } @Override - public SearchService getSearchService() { - return searchService; - } - - @Override public MonitoringService getMonitoringService() { return monitoringService; } http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/8760b0fd/abiquo/src/main/java/org/jclouds/abiquo/internal/BaseSearchService.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/internal/BaseSearchService.java b/abiquo/src/main/java/org/jclouds/abiquo/internal/BaseSearchService.java deleted file mode 100644 index 42070e9..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/internal/BaseSearchService.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.abiquo.internal; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.abiquo.domain.DomainWrapper.wrap; - -import java.util.List; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.abiquo.AbiquoApi; -import org.jclouds.abiquo.domain.cloud.VirtualDatacenter; -import org.jclouds.abiquo.domain.cloud.Volume; -import org.jclouds.abiquo.domain.cloud.options.VolumeOptions; -import org.jclouds.abiquo.domain.enterprise.Enterprise; -import org.jclouds.abiquo.domain.enterprise.options.EnterpriseOptions; -import org.jclouds.abiquo.domain.infrastructure.Datacenter; -import org.jclouds.abiquo.domain.infrastructure.StorageDevice; -import org.jclouds.abiquo.domain.infrastructure.StoragePool; -import org.jclouds.abiquo.domain.infrastructure.options.StoragePoolOptions; -import org.jclouds.abiquo.domain.network.PrivateIp; -import org.jclouds.abiquo.domain.network.PrivateNetwork; -import org.jclouds.abiquo.domain.network.PublicIp; -import org.jclouds.abiquo.domain.network.options.IpOptions; -import org.jclouds.abiquo.features.services.SearchService; -import org.jclouds.rest.ApiContext; - -import com.abiquo.server.core.enterprise.EnterpriseDto; -import com.abiquo.server.core.infrastructure.network.PrivateIpDto; -import com.abiquo.server.core.infrastructure.network.PublicIpDto; -import com.abiquo.server.core.infrastructure.storage.StoragePoolDto; -import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto; -import com.google.common.annotations.VisibleForTesting; - -/** - * Provides high level Abiquo search, filter and pagination operations. - * - * @author Ignasi Barrera - * @author Francesc Montserrat - */ -@Singleton -public class BaseSearchService implements SearchService { - @VisibleForTesting - protected ApiContext<AbiquoApi> context; - - @Inject - protected BaseSearchService(final ApiContext<AbiquoApi> context) { - this.context = checkNotNull(context, "context"); - } - - /*********************** Enterprise ***********************/ - - @Override - public Iterable<Enterprise> searchEnterprises(final EnterpriseOptions options) { - List<EnterpriseDto> enterprises = context.getApi().getEnterpriseApi().listEnterprises(options).getCollection(); - - return wrap(context, Enterprise.class, enterprises); - } - - @Override - public Iterable<Enterprise> searchEnterprisesUsingDatacenter(final Datacenter datacenter, - final EnterpriseOptions options) { - List<EnterpriseDto> enterprises = context.getApi().getEnterpriseApi() - .listEnterprises(datacenter.unwrap(), options).getCollection(); - - return wrap(context, Enterprise.class, enterprises); - } - - /*********************** Volume ********************** */ - - @Override - public Iterable<Volume> searchVolumes(final VirtualDatacenter virtualDatacenter, final VolumeOptions options) { - List<VolumeManagementDto> volumes = context.getApi().getCloudApi() - .listVolumes(virtualDatacenter.unwrap(), options).getCollection(); - - return wrap(context, Volume.class, volumes); - } - - /*********************** Storage Pool ***********************/ - - @Override - public List<StoragePool> searchStoragePools(final StorageDevice device, final StoragePoolOptions options) { - List<StoragePoolDto> pools = context.getApi().getInfrastructureApi().listStoragePools(device.unwrap(), options) - .getCollection(); - - return wrap(context, StoragePool.class, pools); - } - - /*********************** Private Network ***********************/ - - @Override - public Iterable<PrivateIp> searchPrivateIps(final PrivateNetwork network, final IpOptions options) { - List<PrivateIpDto> ips = context.getApi().getCloudApi().listPrivateNetworkIps(network.unwrap(), options) - .getCollection(); - - return wrap(context, PrivateIp.class, ips); - } - - @Override - public Iterable<PublicIp> searchPublicIpsToPurchase(final VirtualDatacenter virtualDatacenter, - final IpOptions options) { - List<PublicIpDto> ips = context.getApi().getCloudApi() - .listAvailablePublicIps(virtualDatacenter.unwrap(), options).getCollection(); - - return wrap(context, PublicIp.class, ips); - } - - @Override - public Iterable<PublicIp> searchPurchasedPublicIps(final VirtualDatacenter virtualDatacenter, final IpOptions options) { - List<PublicIpDto> ips = context.getApi().getCloudApi() - .listPurchasedPublicIps(virtualDatacenter.unwrap(), options).getCollection(); - - return wrap(context, PublicIp.class, ips); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/8760b0fd/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseSearchServiceTest.java ---------------------------------------------------------------------- diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseSearchServiceTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseSearchServiceTest.java deleted file mode 100644 index b2bd905..0000000 --- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseSearchServiceTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.abiquo.internal; - -import static org.testng.Assert.assertNotNull; - -import org.jclouds.abiquo.features.services.SearchService; -import org.testng.annotations.Test; - -/** - * Unit tests for the {@link BaseSearchService} class. - * - * @author Ignasi Barrera - */ -@Test(groups = "unit", testName = "BaseSearchServiceTest") -public class BaseSearchServiceTest extends BaseInjectionTest { - - public void testAllPropertiesInjected() { - BaseSearchService service = (BaseSearchService) injector.getInstance(SearchService.class); - - assertNotNull(service.context); - } -}
