Does jclouds support SLO for OpenStack Swift?

2016-09-23 Thread Alexandr Porunov
Hello,

To merge several objects into one we have to send a JSON file into the
Swift with the quary parameter "multipart-manifest=put".
Is it possible to add one more query parameters when we create an object
with the jclouds?

Sincerely,
Alexandr


Is it possible to configure jclouds 1.9.2 to work with openstack 2.7.1 with tempauth?

2016-09-15 Thread Alexandr Porunov
Hello,
I wonder to know if jclouds still can be used with openstack swift. I am
using jclouds 1.9.2 and openstack swift 2.7.1 with tempauth. The problem I
can't connect it to my cluster and can't find any working examples. There
is only one example how to use jclouds with keystone in jclouds Docs but
none of examples how to use jclouds with tempauth.

I have tried a lot of variants but none of them is working. It loks like
jclouds understand only keystone authentication (I may be wrong). If it
isn't, please help me to connect jclouds to swift.

Here is my debug logs:
http://paste.openstack.org/show/577329/

Here is the code which I try to use:
Iterable modules = ImmutableSet.of(
new SLF4JLoggingModule());

SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://192.168.0.58:8080/auth/v1.0/";)
.credentials("admin:admin", "admin")
.modules(modules)
.buildApi(SwiftApi.class);

Set regions = swiftApi.getConfiguredRegions();

for(String region : regions){
System.out.println("REGION: "+region);
}

Sincerely,
Alexandr


Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
My OpenStack Swift works if I use curl:

//authenticate
curl -v -H 'X-Auth-User: admin:admin' -H 'X-Auth-Key: admin'
http://192.168.0.58:8080/auth/v1.0/

//check containers
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad'
http://192.168.0.58:8080/v1/AUTH_admin/

//create a container
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X
PUT http://192.168.0.58:8080/v1/AUTH_admin/mycontainer

//upload file
swift -A http://192.168.0.58:8080/auth/v1.0/ -U admin:admin -K admin upload
mycontainer some_file

//get file
curl -v -H 'X-Auth-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X GET
http://192.168.0.58:8080/v1/AUTH_admin/mycontainer/some_file

On Wed, Sep 14, 2016 at 11:37 PM, Alexandr Porunov <
alexandr.poru...@gmail.com> wrote:

> Andrew,
>
> Ignasi Barrera helped me. I had to use Gson version 2.5 to handle that
> error.
>
> As you said I tried to call:
> Set regions = swiftApi.getConfiguredRegions();
>
> But I got an error:
> Request processing failed; nested exception is 
> org.jclouds.http.HttpResponseException:
> command: POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed
> with response: HTTP/1.1 400 Bad Request; content: [Bad
> RequestThe server could not comply with the request since it is
> either malformed or otherwise incorrect.]] with root cause
> org.jclouds.http.HttpResponseException: command: POST
> http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response:
> HTTP/1.1 400 Bad Request; content: [Bad RequestThe server
> could not comply with the request since it is either malformed or otherwise
> incorrect.]
> at org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.
> handleError(SwiftErrorHandler.java:46)
> at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(
> DelegatingErrorHandler.java:65)
> at org.jclouds.http.internal.BaseHttpCommandExecutorService
> .shouldContinue(BaseHttpCommandExecutorService.java:136)
> at org.jclouds.http.internal.BaseHttpCommandExecutorService
> .invoke(BaseHttpCommandExecutorService.java:105)
> at org.jclouds.rest.internal.InvokeHttpMethod.invoke(
> InvokeHttpMethod.java:90)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(
> InvokeHttpMethod.java:73)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(
> InvokeHttpMethod.java:44)
> at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(
> DelegatesToInvocationFunction.java:156)
> at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(
> DelegatesToInvocationFunction.java:123)
> at 
> com.sun.proxy.$Proxy111.authenticateWithTenantNameAndCredentials(Unknown
> Source)
> at org.jclouds.openstack.keystone.v2_0.functions.
> AuthenticatePasswordCredentials.authenticateWithTenantName(
> AuthenticatePasswordCredentials.java:43)
> at org.jclouds.openstack.keystone.v2_0.functions.
> AuthenticatePasswordCredentials.authenticateWithTenantName(
> AuthenticatePasswordCredentials.java:31)
> at org.jclouds.openstack.keystone.v2_0.functions.
> internal.BaseAuthenticator.apply(BaseAuthenticator.java:79)
> at org.jclouds.openstack.keystone.v2_0.functions.
> internal.BaseAuthenticator.apply(BaseAuthenticator.java:36)
> at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(
> CacheLoader.java:148)
> at com.google.common.cache.LocalCache$LoadingValueReference.
> loadFuture(LocalCache.java:3524)
> at com.google.common.cache.LocalCache$Segment.loadSync(
> LocalCache.java:2317)
> at com.google.common.cache.LocalCache$Segment.
> lockedGetOrLoad(LocalCache.java:2280)
> at com.google.common.cache.LocalCache$Segment.get(
> LocalCache.java:2195)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
> at com.google.common.cache.LocalCache.getOrLoad(
> LocalCache.java:3938)
> at com.google.common.cache.LocalCache$LocalLoadingCache.
> get(LocalCache.java:4821)
> at com.google.common.cache.LocalCache$LocalLoadingCache.
> getUnchecked(LocalCache.java:4827)
> at org.jclouds.openstack.keystone.v2_0.config.
> KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:234)
> at org.jclouds.openstack.keystone.v2_0.config.
> KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:231)
> at org.jclouds.openstack.keystone.v2_0.suppliers.
> LocationIdToURIFromAccessForTypeAndVersion.get(
> LocationIdToURIFromAccessForTypeAndVersion.java:94)
> at org.jclouds.openstack.keystone.v2_0.suppliers.
> LocationIdToURIFromAccessForTypeAndVersion.get(
> LocationIdToU

Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
(HttpPutFormContentFilter.java:87)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Here is an spring's output:

{"timestamp":1473877865201,"status":500,"error":"Internal Server
Error","exception":"org.jclouds.http.HttpResponseException","message":"command:
POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with
response: HTTP/1.1 400 Bad Request; content: [Bad
RequestThe server could not comply with the request since it is
either malformed or otherwise incorrect.]","path":"/get_regions"}

Do you know why am I get this error?

Best regards,
Alexandr

On Wed, Sep 14, 2016 at 9:13 PM, Alexandr Porunov <
alexandr.poru...@gmail.com> wrote:

> Yes, I found Gson in the classpath. It has version 2.7
>
> On Wed, Sep 14, 2016 at 8:48 PM, Alexandr Porunov <
> alexandr.poru...@gmail.com> wrote:
>
>> Hello Andrew,
>>
>> Now I cannot call that method because I cannot connect to OpenStack Swift
>> itself. I always get next error:
>> http://paste.openstack.org/show/576305/
>>
>> Here is my proxy configs:
>> [filter:tempauth]
>> use = egg:swift#tempauth
>> user_admin_admin = admin .admin .reseller_admin
>> user_test_tester = testing .admin
>> user_test2_tester2 = testing2 .admin
>> user_test_tester3 = testing3
>>
>> Here is my code:
>> SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
>> .endpoint("http://192.168.0.58:8080/v1/";)
>> .credentials("admin:admin", "admin")
>> .buildApi(SwiftApi.class);
>>
>> Can you help me please?
>>
>> Regards,
>> Alexandr
>>
>> On Wed, Sep 14, 2016 at 7:21 PM, Andrew Phillips 
>> wrote:
>>
>>> What is "RegionOne" ? First of all if we talk about regions in Swift
>>>> then it can't be a String. It is Integer value. That is why I can't
>>>> understand what is "RegionOne" and how to create a simple container
>>>> with SwiftApi.
>>>>
>>>
>>> Could you call "getConfiguredRegions" on your API instance to see which
>>> regions are available?
>>>
>>> https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclou
>>> ds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()
>>>
>>> Regards
>>>
>>> ap
>>>
>>
>>
>


Re: Can not create SwiftApi with tempauth

2016-09-14 Thread Alexandr Porunov
 
org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at 
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at 
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at 
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at 
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at 
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at 
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)


Here is an spring's output:

{"timestamp":1473877865201,"status":500,"error":"Internal Server
Error","exception":"org.jclouds.http.HttpResponseException","message":"command:
POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with
response: HTTP/1.1 400 Bad Request; content: [Bad
RequestThe server could not comply with the request since it is
either malformed or otherwise incorrect.]","path":"/get_regions"}

Can you help me please with this error?

Best regards,
Alexandr

On Wed, Sep 14, 2016 at 9:13 PM, Ignasi Barrera  wrote:

> If you use Spring Boot 1.4, then you might be affected by JCLOUDS-1160
> [1], as it comes with a Gson version newer than the one supported by
> jclouds. See the issue and the linked one for more details.
>
> If that is your case, is there any chance you can force a version of
> Gson <= 2.5?
>
>
>
> [1] https://issues.apache.org/jira/browse/JCLOUDS-1160
>
> On 14 September 2016 at 20:07, Alexandr Porunov
>  wrote:
> > I use 1.9.2 version of jclouds as in the example.
> > Here is my gradle dependencies:
> >
> > compile group: 'org.apache.jclouds.driver', name: 'jclouds-slf4j',
> version:
> > '1.9.2'
> > compile group: 'org.apache.jclouds.driver', name: 'jclouds-sshj',
> version:
> > '1.9.2'
> > compile group: 'org.apache.jclouds.api', name: 'openstack-swift',
> version:
> > '1.9.2'
> > compile group: 'org.apache.jclouds.labs', name: 'openstack-marconi',
> > version: '1.9.2'
> >
> >
> > I don't use gson. But I use spring-boot framework. It may use gson. I am
> not
> > sure. But I don't see it in External Libraries.
> >
> > Also I tried to use:
> > SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
> > .endpoint("http://192.168.0.58:8080/auth/v1.0";)
> > .credentials("admin:admin", "admin")
> > .buildApi(SwiftApi.class);
> >
> >

Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Yes, I found Gson in the classpath. It has version 2.7

On Wed, Sep 14, 2016 at 8:48 PM, Alexandr Porunov <
alexandr.poru...@gmail.com> wrote:

> Hello Andrew,
>
> Now I cannot call that method because I cannot connect to OpenStack Swift
> itself. I always get next error:
> http://paste.openstack.org/show/576305/
>
> Here is my proxy configs:
> [filter:tempauth]
> use = egg:swift#tempauth
> user_admin_admin = admin .admin .reseller_admin
> user_test_tester = testing .admin
> user_test2_tester2 = testing2 .admin
> user_test_tester3 = testing3
>
> Here is my code:
> SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
> .endpoint("http://192.168.0.58:8080/v1/";)
> .credentials("admin:admin", "admin")
> .buildApi(SwiftApi.class);
>
> Can you help me please?
>
> Regards,
> Alexandr
>
> On Wed, Sep 14, 2016 at 7:21 PM, Andrew Phillips 
> wrote:
>
>> What is "RegionOne" ? First of all if we talk about regions in Swift
>>> then it can't be a String. It is Integer value. That is why I can't
>>> understand what is "RegionOne" and how to create a simple container
>>> with SwiftApi.
>>>
>>
>> Could you call "getConfiguredRegions" on your API instance to see which
>> regions are available?
>>
>> https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclou
>> ds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()
>>
>> Regards
>>
>> ap
>>
>
>


Re: Can not create SwiftApi with tempauth

2016-09-14 Thread Alexandr Porunov
I use 1.9.2 version of jclouds as in the example.
Here is my gradle dependencies:

compile group: 'org.apache.jclouds.driver', name: 'jclouds-slf4j',
version: '1.9.2'
compile group: 'org.apache.jclouds.driver', name: 'jclouds-sshj',
version: '1.9.2'
compile group: 'org.apache.jclouds.api', name: 'openstack-swift',
version: '1.9.2'
compile group: 'org.apache.jclouds.labs', name: 'openstack-marconi',
version: '1.9.2'


I don't use gson. But I use spring-boot framework. It may use gson. I am
not sure. But I don't see it in External Libraries.

Also I tried to use:
SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://192.168.0.58:8080/auth/v1.0";)
.credentials("admin:admin", "admin")
.buildApi(SwiftApi.class);

It shows the same error.

My OpenStack Swift works if I use curl:

//authenticate
curl -v -H 'X-Auth-User: admin:admin' -H 'X-Auth-Key: admin'
http://192.168.0.58:8080/auth/v1.0/

//check containers
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad'
http://192.168.0.58:8080/v1/AUTH_admin/

//create a container
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X
PUT http://192.168.0.58:8080/v1/AUTH_admin/mycontainer

//upload file
swift -A http://192.168.0.58:8080/auth/v1.0/ -U admin:admin -K admin upload
mycontainer some_file

//get file
curl -v -H 'X-Auth-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X GET
http://192.168.0.58:8080/v1/AUTH_admin/mycontainer/some_file

Sincerely,
Alexandr


On Wed, Sep 14, 2016 at 8:56 PM, Ignasi Barrera  wrote:

> Which version of jclouds are you using? Are you using Gson too in your
> project? In that case, which version of Gson are you using?
>
> On 14 September 2016 at 19:45, Alexandr Porunov
>  wrote:
> > Hello,
> >
> > How to use jclouds with OpenStack Swift?
> >
> > Here is my code:
> > SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
> > .endpoint("http://192.168.0.58:8080/v1/";)
> > .credentials("admin:admin", "admin")
> > .buildApi(SwiftApi.class);
> >
> > I use tempauth in OpenStack Swift. Here is my configs:
> > [filter:tempauth]
> > use = egg:swift#tempauth
> > user_admin_admin = admin .admin .reseller_admin
> > user_test_tester = testing .admin
> > user_test2_tester2 = testing2 .admin
> > user_test_tester3 = testing3
> >
> > I can not create swiftApi because I always get next error:
> > Exception in thread "main" java.lang.reflect.InvocationTargetException
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:497)
> > at
> > org.springframework.boot.loader.MainMethodRunner.run(
> MainMethodRunner.java:48)
> > at org.springframework.boot.loader.Launcher.launch(
> Launcher.java:87)
> > at org.springframework.boot.loader.Launcher.launch(
> Launcher.java:50)
> > at
> > org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
> > Caused by: java.lang.NoSuchMethodError:
> > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.<
> init>(Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/
> FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V
> > at
> > org.jclouds.json.internal.DeserializationConstructorAndR
> eflectiveTypeAdapterFactory.(DeserializationConstructorAndR
> eflectiveTypeAdapterFactory.java:116)
> > at
> > org.jclouds.json.config.GsonModule.provideGson(GsonModule.java:129)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:497)
> > at
> > com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
> > at
> > com.google.inject.internal.InternalFactoryToProviderAdapter.get(
> InternalFactoryToProviderAdapter.java:40)
> > at
> > com.google.inject.internal.Provi

Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Hello Andrew,

Now I cannot call that method because I cannot connect to OpenStack Swift
itself. I always get next error:
http://paste.openstack.org/show/576305/

Here is my proxy configs:
[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

Here is my code:
SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://192.168.0.58:8080/v1/";)
.credentials("admin:admin", "admin")
.buildApi(SwiftApi.class);

Can you help me please?

Regards,
Alexandr

On Wed, Sep 14, 2016 at 7:21 PM, Andrew Phillips  wrote:

> What is "RegionOne" ? First of all if we talk about regions in Swift
>> then it can't be a String. It is Integer value. That is why I can't
>> understand what is "RegionOne" and how to create a simple container
>> with SwiftApi.
>>
>
> Could you call "getConfiguredRegions" on your API instance to see which
> regions are available?
>
> https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclou
> ds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()
>
> Regards
>
> ap
>


Can not create SwiftApi with tempauth

2016-09-14 Thread Alexandr Porunov
Hello,

How to use jclouds with OpenStack Swift?

Here is my code:
SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://192.168.0.58:8080/v1/";)
.credentials("admin:admin", "admin")
.buildApi(SwiftApi.class);

I use tempauth in OpenStack Swift. Here is my configs:
[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

I can not create swiftApi because I always get next error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at
org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.NoSuchMethodError:
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.(Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V
at
org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:116)
at
org.jclouds.json.config.GsonModule.provideGson(GsonModule.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
at
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
at
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
at
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at
com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
at
com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:402)
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:326)
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:644)
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:636)
at com.fyfine.loader.Application.main(Application.java:26)
... 8 more

Please, help me connect to OpenStack Swift

Sincerely,
Alexandr


How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Hello,

I am using jclouds to store objects into OpenStack Swift.

The problem is that I don't understand what "region" is meant.
When I need to create an object or a container I have to use next API:
ContainerApi containerApi = swiftApi.getContainerApi("RegionOne");

What is "RegionOne" ? First of all if we talk about regions in Swift then
it can't be a String. It is Integer value. That is why I can't understand
what is "RegionOne" and how to create a simple container with SwiftApi.

Please, help me to figure out how to use this API

Sincerely,
Alexandr


Stream file to the OpenStack Swift

2016-09-13 Thread Alexandr Porunov
Hello,

I need to store very large files in the OpenStack Swift through the Java
server.
The problem is that I don't need to store big files locally on the Java
server. I don't need them there. So, Java server has to act like a pipe. It
has to accept an input stream from the client and create an output stream
to the OpenStack Swift Proxy after that it has to read small parts of data
from the input stream and send them to the output stream.

Can jclouds perform such acts?

Sincerely,
Alexandr