You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/03/31 17:59:00 UTC

[jira] [Commented] (JCLOUDS-1492) Dimension Data Feature API Predicates are not usable

    [ https://issues.apache.org/jira/browse/JCLOUDS-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16806219#comment-16806219 ] 

ASF subversion and git services commented on JCLOUDS-1492:
----------------------------------------------------------

Commit f6ee52da4ad69bc783214ceeb5e289dc7371eba1 in jclouds-examples's branch refs/heads/master from Trevor Flanagan
[ https://gitbox.apache.org/repos/asf?p=jclouds-examples.git;h=f6ee52d ]

JCLOUDS-1492 Dimension Data Feature API Predicates are not usable (#2)

* JCLOUDS-1492 Dimension Data Feature API Predicates are not usable

* Fixing issue where during the clear down all servers in a Datacenter get deleted instead of just the ones in the Network Domain.


> Dimension Data Feature API Predicates are not usable
> ----------------------------------------------------
>
>                 Key: JCLOUDS-1492
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1492
>             Project: jclouds
>          Issue Type: Bug
>            Reporter: Trevor Flanagan
>            Priority: Major
>              Labels: dimensiondata
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> The predicates exposed in [https://github.com/apache/jclouds-labs/blob/master/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/features/ServerApi.java#L183-L197] and other Feature API are not working as expected.
> The issue is that where an interface is marked with {{@Delegate}} anything that exists inside is considered as something that will be invoked over HTTP. In the case of the Predicates these are not the case. The following error occurs when a call to {{api.getNetworkApi().networkDomainNormalPredicate().apply(networkDomainId);}} is made.
> {code:java}
> Exception in thread "main" java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
> at com.google.common.base.Absent.get(Absent.java:47)
> at org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:227)
> at org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:137)
> at org.jclouds.rest.internal.InvokeHttpMethod.toCommand(InvokeHttpMethod.java:189)
> at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:85)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
> at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
> at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
> at com.sun.proxy.$Proxy56.networkDomainNormalPredicate(Unknown Source)
> at org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer.deployNetworkDomain(DeployNetworkDomainVlanAndServer.java:148)
> at org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer.main(DeployNetworkDomainVlanAndServer.java:78){code}
> The fix is to move the Predicates into {{org.jclouds.dimensiondata.cloudcontrol.DimensionDataCloudControlApi}} and remove them from the API classes.
> {code:java}
> public interface DimensionDataCloudControlApi extends Closeable {
>    @Delegate
>    AccountApi getAccountApi();
>    @Delegate
>    InfrastructureApi getInfrastructureApi();
>    @Delegate
>    ServerImageApi getServerImageApi();
>    @Delegate
>    NetworkApi getNetworkApi();
>    @Delegate
>    ServerApi getServerApi();
>    @Delegate
>    TagApi getTagApi();
>    @Delegate
>    CustomerImageApi getCustomerImageApi();
>    @Provides
>    @Named(VLAN_DELETED_PREDICATE)
>    Predicate<String> vlanDeletedPredicate();
>    @Provides
>    @Named(NETWORK_DOMAIN_DELETED_PREDICATE)
>    Predicate<String> networkDomainDeletedPredicate();
>    @Provides
>    @Named(NETWORK_DOMAIN_NORMAL_PREDICATE)
>    Predicate<String> networkDomainNormalPredicate();
>    @Provides
>    @Named(VLAN_NORMAL_PREDICATE)
>    Predicate<String> vlanNormalPredicate();
>    @Provides
>    @Named(SERVER_STOPPED_PREDICATE)
>    Predicate<String> serverStoppedPredicate();
>    @Provides
>    @Named(SERVER_DELETED_PREDICATE)
>    Predicate<String> serverDeletedPredicate();
>    @Provides
>    @Named(SERVER_STARTED_PREDICATE)
>    Predicate<String> serverStartedPredicate();
>    @Provides
>    @Named(SERVER_NORMAL_PREDICATE)
>    Predicate<String> serverNormalPredicate();
> }
> {code}
> Fix also requires a change to the https://github.com/apache/jclouds-examples/tree/master/dimensiondata



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)