You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Ignasi <ig...@gmail.com> on 2013/08/01 11:21:37 UTC

Re: New Provider Implementation Support

Hi Timur,

To create a new provider, the first thing you need to do is to create
the API for that provider. That API will be the one directly talking
to the REST service.

The common advice is to take a look at some of the latest providers
being added, because we are still missing a detailed documentation on
how to write an entire new provider. Here is a checklist, though:

* First you need to create an implementation of ApiMetadata describing
the target API service.
* You have to create the API interface, with its methods annotated
accordingly so the requests are properly generated.
* Once that is done, a Guice module has to be added to configure the
API and the injector that will allow all Guice magic to happen.
* Once that is done, you will have to add Expect and Live tests for
the API, to make sure everything is working fine.

You can take a look at the existing providers, or, for example, read
the comments in the CloudSigma v2 pull request [1]. It hasn't been
merged yet, but you'll find there some tips and things to take into
account when adding a new api.


HTH,


Ignasi




[1] https://github.com/jclouds/jclouds-labs/pull/12



On 30 July 2013 14:26, Timur Sungur <ti...@gmail.com> wrote:
> Hi,
>
> I will create a general provider implementation using jclouds for the
> "providers" which use orion. The authentication is based on basic HTTP
> authentication and server API supports REST.
>
> I created the template using maven archetype. I'm checking related
> examples but they provide limited information due to lack of
> documentation. As far as I understood created project provides a
> client API for CRUD operations and a a key API for authentication. I
> want to follow general implementation style which has been used in the
> other provider implementations.
>
> Could you please explain me briefly the steps for a provider
> implementation or the general code structure? The authentication needs
> to be based on basic HTTP authentication.
>
> Regards,
>
> Timur

Re: New Provider Implementation Support

Posted by Andrew Phillips <ap...@qrmedia.com>.
Hi Timur

Is the code available online for us to look at somewhere? The problem  
is that Guice is evidently not finding a binding for a dependency  
that's declared somewhere in your module, or inherited from the base  
BlobStore code.

We'd need to have a look at the OrionBlobStoreModule, as well as the  
place where you're actually *creating* your context, to know more...

Regards

ap

Re: New Provider Implementation Support

Posted by Timur Sungur <ti...@gmail.com>.
Hi,

Thanks for the reference. I skimmed through it already.

After copying the message, the error was more clear. The problem was
Optional.abstent() in the place of defaultLocation and locations
elements.

I guess it is not possible to apply the third solution you mentioned
("remove the two arguments from the OrionBlobStore constructor if we
don't need the") since the super constructor needs them. If it is so
what are the most basic properties to make locations and default
location available?

Regards,

Timur

On Thu, Aug 15, 2013 at 4:47 PM, Andrew Phillips <ap...@qrmedia.com> wrote:
> Do you have a link to a Pastie or Gist with the exception? And if you're
> going to be doing jclouds development I would definitely recommend that you
> read the Guice User Guide [1], if you haven't done so already...
>
> Regards
>
> ap
>
> [1] https://code.google.com/p/google-guice/wiki/GettingStarted

Re: New Provider Implementation Support

Posted by Andrew Phillips <ap...@qrmedia.com>.
Do you have a link to a Pastie or Gist with the exception? And if  
you're going to be doing jclouds development I would definitely  
recommend that you read the Guice User Guide [1], if you haven't done  
so already...

Regards

ap

[1] https://code.google.com/p/google-guice/wiki/GettingStarted

Re: New Provider Implementation Support

Posted by Timur Sungur <ti...@gmail.com>.
Hi Andrew,

Thanks for the reply.

I opt for the option "remove the two arguments from the OrionBlobStore
constructor if we don't need them" however super constructor requires
the location and locations. I used Optional.absent() for now and I
don't get an exception related to location or locations.

Could you please check the code again? I get a long exception and I
can't go further. I want to get over with jcloud specific problems and
focus on the Orion specific details however my progress is too slowly
due to such exceptions :(


Regards,

Timur




On Mon, Aug 5, 2013 at 6:32 PM, Andrew Phillips <ap...@qrmedia.com> wrote:
>> I added OrionAsyncBlobStore.java because otherwise BaseBlobLiveTest
>> was complaining about it.
>
>
> Async blobstores are deprecated - please refactor the live test to use the
> *sync* API and remove the async blobstore.
>
> The Guice error is straightforward, thankfully:
>
> In the module, we're telling Guice to make an OrionBlobStore [1]. But if you
> look at the dependencies of OrionBlobStore, as demonstated by its
> constructor [2], it needs a
>
> Supplier<Location> defaultLocation, Supplier<Set<? extends Location>>
> locations
>
> jclouds provides these in a rather complicated way, based on region if no
> explicit provider is defined [3]. And we are not defining any regions in our
> ApiMetadata or ProviderMetadata (there's a typo in OrionProviderMetada, by
> the way ;-)).
>
> So we have a couple of choices:
>
> * define the region and other properties required for the implicit location
> supplier to work
> * define an *explicit* supplier for defaultLocation and locations
> * remove the two arguments from the OrionBlobStore constructor if we don't
> need them
>
> Regards
>
> ap
>
> [1]
> https://github.com/timur87/orion/blob/master/src/main/java/org/jclouds/orion/config/OrionBlobStoreModule.java#L19
> [2]
> https://github.com/timur87/orion/blob/master/src/main/java/org/jclouds/orion/blobstore/OrionBlobStore.java#L28
> [3]
> https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/location/suppliers/implicit/OnlyLocationOrFirstRegionOptionallyMatchingRegionId.java

Re: New Provider Implementation Support

Posted by Andrew Phillips <ap...@qrmedia.com>.
> I added OrionAsyncBlobStore.java because otherwise BaseBlobLiveTest
> was complaining about it.

Async blobstores are deprecated - please refactor the live test to use  
the *sync* API and remove the async blobstore.

The Guice error is straightforward, thankfully:

In the module, we're telling Guice to make an OrionBlobStore [1]. But  
if you look at the dependencies of OrionBlobStore, as demonstated by  
its constructor [2], it needs a

Supplier<Location> defaultLocation, Supplier<Set<? extends Location>>  
locations

jclouds provides these in a rather complicated way, based on region if  
no explicit provider is defined [3]. And we are not defining any  
regions in our ApiMetadata or ProviderMetadata (there's a typo in  
OrionProviderMetada, by the way ;-)).

So we have a couple of choices:

* define the region and other properties required for the implicit  
location supplier to work
* define an *explicit* supplier for defaultLocation and locations
* remove the two arguments from the OrionBlobStore constructor if we  
don't need them

Regards

ap

[1]  
https://github.com/timur87/orion/blob/master/src/main/java/org/jclouds/orion/config/OrionBlobStoreModule.java#L19
[2]  
https://github.com/timur87/orion/blob/master/src/main/java/org/jclouds/orion/blobstore/OrionBlobStore.java#L28
[3]  
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/location/suppliers/implicit/OnlyLocationOrFirstRegionOptionallyMatchingRegionId.java

Re: New Provider Implementation Support

Posted by Timur Sungur <ti...@gmail.com>.
Hi,

Thanks for the quick answers.

I created a repo in github. Could you please check it:

https://github.com/timur87/orion

Regards,

Timur

On Sun, Aug 4, 2013 at 5:10 PM, Andrew Phillips <ap...@qrmedia.com> wrote:
> Hi Timur
>
> Is the code available online for us to look at somewhere? The problem is
> that Guice is evidently not finding a binding for a dependency that's
> declared somewhere in your module, or inherited from the base BlobStore
> code.
>
> We'd need to have a look at the OrionBlobStoreModule, as well as the place
> where you're actually *creating* your context, to know more...
>
> Regards
>
> ap

Re: New Provider Implementation Support

Posted by Andrew Phillips <ap...@qrmedia.com>.
Hi Timur

Is the code available online for us to look at somewhere? The problem  
is that Guice is evidently not finding a binding for a dependency  
that's declared somewhere in your module, or inherited from the base  
BlobStore code.

We'd need to have a look at the OrionBlobStoreModule, as well as the  
place where you're actually *creating* your context, to know more...

Regards

ap

Re: New Provider Implementation Support

Posted by Timur Sungur <ti...@gmail.com>.
Hi,

Thanks for the answer.

I started my implementation and checked resources that you provided.

I'm going to implement a blob store provider not a compute provider
and the available examples for that really less in the number :(

I'm stuck at this exception:

No implementation for com.google.common.base.Supplier<java.util.Set<?
extends org.jclouds.domain.Location>> was bound.
  while locating com.google.common.base.Supplier<java.util.Set<?
extends org.jclouds.domain.Location>>
    for parameter 3 at
org.jclouds.orion.blobstore.OrionBlobStore.<init>(OrionBlobStore.java:29)
  at org.jclouds.orion.config.OrionBlobStoreModule.configure(OrionBlobStoreModule.java:19)

Do you have any idea for the cause of the problem?

My current provider source classes are as listed below:

org.jclouds.orion
-OrionApi.java
-OrionApiMetadata.java
-OrionProviderMetada.java
org.jclouds.orion.blobstore
-OrionAsyncBlobStore.java
-OrionBlobStore.java
org.jclouds.orion.config
-OrionBlobStoreModule.java
-OrionHttpApiModule.java
org.jclouds.orion.domain
-Key.java
org.jclouds.orion.features
-KeyApi.java
-KeyAsyncApi.java
org.jclouds.orion.handlers
-OrionErrorHandler.java

Do you think I'm missing some critical classes?

OrionApi has this annotation
@RequestFilters(BasicAuthentication.class) which means I assume it
implicitly uses a basic HTTP authentication mechanism?

I added OrionAsyncBlobStore.java because otherwise BaseBlobLiveTest
was complaining about it.

Any help will be appreciated thanks in advance!

Regards,

Timur

On Thu, Aug 1, 2013 at 11:21 AM, Ignasi <ig...@gmail.com> wrote:
> Hi Timur,
>
> To create a new provider, the first thing you need to do is to create
> the API for that provider. That API will be the one directly talking
> to the REST service.
>
> The common advice is to take a look at some of the latest providers
> being added, because we are still missing a detailed documentation on
> how to write an entire new provider. Here is a checklist, though:
>
> * First you need to create an implementation of ApiMetadata describing
> the target API service.
> * You have to create the API interface, with its methods annotated
> accordingly so the requests are properly generated.
> * Once that is done, a Guice module has to be added to configure the
> API and the injector that will allow all Guice magic to happen.
> * Once that is done, you will have to add Expect and Live tests for
> the API, to make sure everything is working fine.
>
> You can take a look at the existing providers, or, for example, read
> the comments in the CloudSigma v2 pull request [1]. It hasn't been
> merged yet, but you'll find there some tips and things to take into
> account when adding a new api.
>
>
> HTH,
>
>
> Ignasi
>
>
>
>
> [1] https://github.com/jclouds/jclouds-labs/pull/12
>
>
>
> On 30 July 2013 14:26, Timur Sungur <ti...@gmail.com> wrote:
>> Hi,
>>
>> I will create a general provider implementation using jclouds for the
>> "providers" which use orion. The authentication is based on basic HTTP
>> authentication and server API supports REST.
>>
>> I created the template using maven archetype. I'm checking related
>> examples but they provide limited information due to lack of
>> documentation. As far as I understood created project provides a
>> client API for CRUD operations and a a key API for authentication. I
>> want to follow general implementation style which has been used in the
>> other provider implementations.
>>
>> Could you please explain me briefly the steps for a provider
>> implementation or the general code structure? The authentication needs
>> to be based on basic HTTP authentication.
>>
>> Regards,
>>
>> Timur