mirror of https://github.com/apache/jclouds.git
fixed generic types for CloudStackContext
This commit is contained in:
parent
3db62b6f8b
commit
3870313e95
|
@ -33,6 +33,10 @@ import com.google.inject.ImplementedBy;
|
|||
@ImplementedBy(CloudStackContextImpl.class)
|
||||
public interface CloudStackContext extends ComputeServiceContext {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
RestContext<CloudStackClient, CloudStackAsyncClient> getProviderSpecificContext();
|
||||
|
||||
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext();
|
||||
|
||||
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext();
|
||||
|
|
|
@ -42,19 +42,27 @@ import org.jclouds.rest.RestContext;
|
|||
@Singleton
|
||||
public class CloudStackContextImpl extends ComputeServiceContextImpl<CloudStackClient, CloudStackAsyncClient> implements
|
||||
CloudStackContext {
|
||||
private final RestContext<CloudStackClient,CloudStackAsyncClient> providerSpecificContext;
|
||||
private final RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext;
|
||||
private final RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
|
||||
|
||||
@Inject
|
||||
public CloudStackContextImpl(ComputeService computeService, Map<String, Credentials> credentialStore, Utils utils,
|
||||
@SuppressWarnings("rawtypes") RestContext providerSpecificContext,
|
||||
RestContext<CloudStackClient,CloudStackAsyncClient> providerSpecificContext,
|
||||
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
|
||||
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
|
||||
super(computeService, credentialStore, utils, providerSpecificContext);
|
||||
this.providerSpecificContext=providerSpecificContext;
|
||||
this.domainContext = domainContext;
|
||||
this.globalContext = globalContext;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RestContext<CloudStackClient,CloudStackAsyncClient> getProviderSpecificContext() {
|
||||
return providerSpecificContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext() {
|
||||
return domainContext;
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudstack.CloudStackClient;
|
||||
import org.jclouds.cloudstack.CloudStackContext;
|
||||
import org.jclouds.cloudstack.domain.Account;
|
||||
import org.jclouds.cloudstack.domain.User;
|
||||
|
@ -110,6 +109,6 @@ public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest<
|
|||
|
||||
@Override
|
||||
protected AccountClient clientFrom(CloudStackContext context) {
|
||||
return CloudStackClient.class.cast(context.getProviderSpecificContext().getApi()).getAccountClient();
|
||||
return context.getProviderSpecificContext().getApi().getAccountClient();
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import static org.testng.Assert.assertNull;
|
|||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudstack.CloudStackClient;
|
||||
import org.jclouds.cloudstack.CloudStackContext;
|
||||
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
|
||||
import org.jclouds.cloudstack.domain.FirewallRule;
|
||||
|
@ -311,6 +310,6 @@ public class FirewallClientExpectTest extends BaseCloudStackRestClientExpectTest
|
|||
|
||||
@Override
|
||||
protected FirewallClient clientFrom(CloudStackContext context) {
|
||||
return CloudStackClient.class.cast(context.getProviderSpecificContext().getApi()).getFirewallClient();
|
||||
return context.getProviderSpecificContext().getApi().getFirewallClient();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue