Commit Graph

1553 Commits

Author SHA1 Message Date
Ignasi Barrera d290705419 Next development version 2.1.0-SNAPSHOT 2016-11-15 01:12:59 +01:00
Ignasi Barrera 6a3a37f4e0 Apache jclouds 2.0.0-rc3 release 2016-11-09 22:30:45 +01:00
Ignasi Barrera 0b48d4a25a Make code compatible with newer OSGi framework versions 2016-11-03 09:43:36 +01:00
Ignasi Barrera cfe22389a8 Resource management moved to the caller 2016-10-25 15:19:20 +02:00
Ignasi Barrera a43acaffce JCLOUDS-1187: Do not load Json payloads to memory when serializing objects 2016-10-25 15:19:20 +02:00
Andrew Gaul 3c9f66b8e9 Avoid lower-case l literal suffix
Readers can confuse this with 1.  Found via error-prone.  Fixed via:

find -name \*.java | xargs sed -i 's/\( [0-9][0-9]*\)l/\1L/g'
find -name \*.java | xargs sed -i 's/\(([0-9][0-9]*\)l/\1L/g'
2016-10-23 14:24:35 -07:00
Andrew Gaul 8117574c83 Avoid C-style array declarations
Found via error-prone.
2016-10-23 13:51:59 -07:00
Ignasi Barrera 8030e53f32 Move digital ocean rate limit handler to core to make it reusable 2016-10-19 16:56:51 +02:00
Zack Shoylev 00f7ee0738 jclouds was not properly retrying on an expect: 100-continue PUT request that requires re-athentication because of java protocol code
JCLOUDS-1179 This fix also addresses the same problem with other providers

No currently working tests because of https://github.com/square/okhttp/issues/675

This is a common problem in other tools as well https://curl.haxx.se/mail/lib-2004-08/0002.html
2016-10-13 12:17:19 -05:00
Andrew Gaul 7cde28a4d2 JCLOUDS-1074: Guava 20 compatibility
* dynamically call TypeToken.isSupertypeOf with Guava 19 and later and
  TypeToken.isAssignableFrom with Guava 18 and earlier
* consume or ignore values from methods with CheckReturnValue
* replace usage of removed Iterators.emptyIterator
2016-09-06 21:49:20 -07:00
Duncan Grant 7aad599721 Fix autovalue class loading in karaf
When Class.forName is called for a class in a different bundle it will
fail as the default karaf class loader won't load classes from other
bundles.

I have fixed this by using the classloader of the original
(non-autovalue) type and assuming it will be in the same bundle as the
autovalue type (I think this is a reasonable assumtion).

So far the only place where I've actually seen this being an issue is
when using the jclouds-labs-google provider within karaf. It fails
when serialising the Firewall.Rule class within a FirewallOptions
object.
2016-09-05 14:11:59 +02:00
Ignasi Barrera 4c92763663 Upgrade to Gson 2.5 instead of Gson 2.7
Related issues: JCLOUDS-1166, JCLOUDS-1160, JCLOUDS-1169

This change reverts commit da4614e and upgrades from Gson 2.3.1 to 2.5,
which is the last version that exports the internal packages, used in
jclouds-core, in the OSGi bundle.
2016-09-02 08:33:21 +02:00
Andrew Gaul da4614e72c JCLOUDS-1160: Upgrade to Gson 2.7
Changelog:

https://github.com/google/gson/blob/master/CHANGELOG.md
2016-08-29 19:54:44 -07:00
Iván Lomba 79e95c5a4c JCLOUDS-482: Add support for arbitrary CPU and RAM
This is a combination of 16 commits:

* First approach to ArbitraryCpuRamTemplateBuilderImpl
* Several fixes: refactoring some names, format, identation problems, some missing license headers and generateId method
* Refactored parse utility
* Added GoogleComputeEngineArbitraryCpuRamTemplateBuilderImpl to support GCE custom machine URI
* extracted hardware creation to automaticHardwareForCpuAndRam method
* Fixed ide automatic asterisk imports
* correcting WIP base case PR according to comments
* added machineTypeUriToHardware to set custom hardware in nodes
* fix checkstyle violations and other PR comments
* Set the providerId to custom machineType URI and fix adding node log
* Arbitrary hardware tests added to BaseTemplateBuilderLiveTest and GoogleComputeEngineTemplateBuilderLiveTest
* Added two more tests to BaseTemplateBuilderLiveTest
* Move repeated constants to TestUtils to reuse code
* Fix full path in the Hardware id and URI
* Add custom hardware tests to BaseComputeServiceLiveTest and GCEServiceLiveTest
* Change customHardware test to use buildTemplate and fix identation
2016-08-16 02:44:04 +02:00
Ignasi Barrera 040df11d3f JCLOUDS-1116: Delegate endpoint should be preferred to the caller's one 2016-06-21 09:40:53 +02:00
Andrew Gaul 1d192dfe56 Remove scoping annotations on abstract types
These annotations are not meaningful.  Found via error-prone.
2016-06-20 10:54:52 -07:00
Andrew Gaul d6454b822f Disentangle Iterable and Iterator
Found via error-prone.
2016-06-20 10:21:01 -07:00
Andrew Gaul 5fec2346a6 JCLOUDS-1028: Configure idempotent methods
Enable POST for Atmos, S3, and Swift.
2016-06-15 16:35:22 -07:00
Andrew Gaul 28ed955183 Address error-prone ClassNewInstance errors
Previous behavior deprecated in Java 9.
2016-06-03 03:34:06 -07:00
Andrew Gaul a67ae3f27b Make inner classes static where possible
Found via error-prone.
2016-06-01 20:03:54 -07:00
Ignasi Barrera 613290ea8d Allow to link contexts and views together
Some providers need other APIs or portable services to perform certain
operations. This change allows to pass existing Context and View
instances when creating a context, so they are added to the injector of
the context being built. This allows to inject external apis and
providers into an existing provider to leverage the external
functionality.
2016-05-25 21:14:26 +02:00
Andrew Gaul b7ed4f34ab Replace identity in RestAnnotationProcessor
References jclouds/jclouds-labs#270.
2016-05-23 14:21:42 -07:00
Andrew Gaul 981b882f59 Handle nested braces in UriTemplates.expand
This allows replacement of JSON-like payloads without using hacks like
percent-encoding braces.
2016-05-20 09:26:45 -07:00
Andrew Gaul cdbf856900 Address error-prone AssertFalse warnings 2016-04-27 18:54:09 -07:00
Andrew Gaul 66cda12b50 Avoid eager evaluation of Preconditions messages
Found via error-prone.
2016-04-24 23:28:55 -07:00
Ignasi Barrera e5f65a4791 Revert "Add FalseOnNotFoundOr204 Fallback"
This fallback was added by mistake and because of my bad advice
on a code review. Fallbacks only apply for failed responses which
status code is >= 300, so a fallback for a 204 would never
be triggered.

This reverts commit e65950b858.
2016-04-19 16:36:30 +02:00
Andrew Gaul 3cf4e3d79c JCLOUDS-1101: Correct generics wildcard errors
Always incorrect but previously broken on Java 9.  Reference:

https://bugs.openjdk.java.net/browse/JDK-8075793
2016-04-18 09:49:58 -07:00
Rita Zhang e65950b858 Add FalseOnNotFoundOr204 Fallback 2016-04-15 23:51:55 +02:00
Alex Heneveld 4ecb078092 JCLOUDS-1075: Clean up logic and docs for setting proxies 2016-02-08 19:12:04 -05:00
Andrew Gaul eb6f16e2f9 Enable CollectionIncompatibleType
Also suppress two false positives.
2016-01-29 08:50:09 -08:00
Andrew Gaul bcc06cc6ec Emit sensitive property name instead of constant
This makes more sense to users of external utilities like jclouds-cli.
2016-01-28 22:58:15 -08:00
Andrew Gaul 3872b57483 Remove userMetadata from equals and hashCode
This caused test failures, regression from
a3376d4efe.
2016-01-26 14:08:39 -08:00
Andrew Gaul a3376d4efe Consistently implement domain object methods
Including equals, hashCode, and toString.
2016-01-24 21:58:39 -08:00
Ignasi Barrera 40f31786c5 JCLOUDS-512: Implement the ImageCache
This commit refactors the ImageCacheSupplier to act as a
proper cache. It is used by the ImageExtesion and all operations
on the images are propagated to the cache.

A method has also been added to the TemplateBuilder to let users
force a cache refresh. There have been several requests to provide a way
to disable image caching in the compute abstraction, and this new method
should fix that.
2016-01-19 11:25:09 +01:00
Andrew Gaul 5fd7b1aa78 JCLOUDS-948: Portable Cache-Control support 2016-01-15 04:41:01 -08:00
Josef Cacek 0fb1b459a6 JCLOUDS-1044 fix handling NULL JsonTokens in adapters under NullFilteringTypeAdapterFactories class 2015-12-05 22:45:24 +01:00
Andrew Gaul 25f4807df8 Tolerate missing or extra quotes in ETags
References andrewgaul/s3proxy#77.
2015-11-19 17:40:48 -08:00
Andrew Gaul df48540cb7 Enable FindBugs CheckRelaxingNullnessAnnotation
Also fix up warnings.
2015-11-13 17:44:55 -08:00
Zack Shoylev 41ce90ec36 Fixes tests failing on windows filesystems Makes windows behavior more consistent, especially for deletes 2015-11-11 21:01:13 -06:00
Timur Alperovich 1fc9b0e259 Move QueryParam encoding to a separate class.
The patch implements a QueryValue class, which encodes the underlying
value based on whether the "encoded" flag is set. This class is used
by the RestAnnotationProcessor to propagate the @Encoded value set on
any parameters.

Since the encoding is now handled by the QueryValue instances, we
should no longer call encodeQueryLine() in the URI builder and instead
call buildQueryLine(). The caveat is that we need to make sure all of
the parameters that may need to be encoded are converted to QueryValue
objects. This is done by converting Object instances to QueryValue by
an instance of the TransformObjectToQueryValue when adding any query
parameters to the URI.
2015-11-02 17:11:42 +01:00
Ignasi Barrera afd3c322a9 JCLOUDS-1030: Ignore synthetic members in serialization strategies 2015-10-28 23:15:41 +01:00
Ignasi Barrera 0a27a04888 Added RateLimit exception 2015-10-21 23:12:01 +02:00
Timur Alperovich 5bbcb8342f JCLOUDS-1008: Add @Encoded to @QueryParam.
Adds support for the @Encoded option for the @QueryParam annotation.
The @Encoded params are not encoded, while all parameters that don't
have it are encoded. The change applies to the @QueryParam annotation
on a single parameter. There is no way to express @Encoded on the list
of parameters and their values in @QueryParams.

The big change is that query parameter encoding is now handled within
the annotation processor, as opposed to relying on the UriBuilder to
perform the encoding. This is required since the UriBuilder does not
have any information about additional annotations associated with each
of the query parameters.

Also, adds unit tests for making sure keys and values are properly
encoded when using the @QueryParams option.
2015-10-21 00:06:23 +02:00
Timur Alperovich 94b3cba6c2 JCLOUDS-1008: Add @Encoded annotation.
Certain providers (e.g. Google Cloud Storage) place tokens that should
be encoded in the request path (e.g. GET
http://<host>/b/<bucket>/o/<object>) and expect them to be
percent-encoded. In the above example a GET request for "foo/bar"
should be translated to http://<host>/b/<bucket>/o/foo%2Fbar.
Currently, there is no way to express this in jclouds, as the entire
request path is encoded exactly once and there is no control over
whether a request parameter should be handled specially. In the
example above, "/" are not encoded in the path and the URL is
submitted as "http://<host>/b/<bucket>/o/foo/bar", which may be wrong.

This patch extends the annotation processor to support @Encoded for
the individual parameters of the request. However, this means that the
entire path is _NOT_ URL encoded. The caller *must* make sure that the
appropriate parameters are encoded -- ones that are marked with the
@Encoded annotation. Parameters not marked with the @Encoded
annotation are URI encoded prior to being added to the path. This
means that "/" characters will also be URI encoded in this case (i.e.
"foo/bar" is turned into "foo%2Fbar").

For the Google Storage provider, we will annotate the parameters that
are going to be pre-encoded (object names) and ensure the provider
encodes them prior to calling the API (separate patch in
jclouds-labs-google).
2015-10-21 00:06:15 +02:00
Ignasi Barrera 07e64a2d07 Allow to globally configure the 'Connection: close' header 2015-10-02 15:44:24 +02:00
Timur Alperovich 075c912d87 JCLOUDS-217: Do not decode query strings.
jclouds should not decode query strings that are passed to create HTTP
requests. This is problematic because in some cases a wrong request
may be generated. The most obvious example is if one passes the "+"
character. For example, the following query parameter: "users=me+you"
is stored by the URI builder as "me you" and subsequently appears in
the request as "users=me%20you", as opposed to "users=me%2Byou" (%2b
is percent encoding for "+").

This is not currently a problem because jclouds relies on the
isUrlEncoded() method to check if a query parameter should be decoded
and the situation above is avoided.

This PR attempts to suggest an alternative (and what I believe is
simpler) approach: on the path of crafting requests, jclouds should
only *encode*, not decode strings. Specifically, jclouds should
_never_ be in a situation where it relies on the isUrlEncoded()
method.
2015-09-17 13:08:44 -07:00
Timur Alperovich a0b95ea7a3 JCLOUDS-217: Fix encoding handling in S3.
When constructing the query path, S3 does not properly handle encoded
paths. For example, if a blob named %20 is to be placed into the blob
store, S3 would end up placing blob named " " (what %20 represents).
This occurs because the S3 provider examines the URI's path portion
(which is presented in a decoded fasion to the caller). After
examining the path, it is not encoded again. Instead, we should call
getRawPath() to avoid this issue.

There are two issues on the decoding path:
1. Given a blob named " ", S3 API will throw a RuntimeException due to
a NULL check -- the key that it uses is NULL to represent the XML
content " " corresponding to the blob name.
2. Given a blob named "%20 ", S3 API will generate a URI for a blob
named "%20%20", which is also incorrect. The correct URI would be
"%2520%20" (escaping the first "%" and " " characters).

The first issue is due to the currentOrNull() helper, which calls
trim() on the string and then compares the string to an empty string.
This means that a blob named " " will be parsed as "" and then
converted to NULL as the result of that method. Passing "null" as the
key then fails in a number of places (notably, appendPath()).

The second issue is due to the appendPath() method in the jclouds Uris
class. The issue here is that appendPath() calls urlDecode() and
passes the result to path(). The path() method, in turn, also calls
urlDecode(). After these transformations, a properly encoded blob of
the form %2520%20 turns into "%20 " and then "  " (two spaces). After
these transformations the path is encoded again, resulting in "%20%20"
(which is wrong).
2015-09-08 15:19:02 -07:00
Timur Alperovich aaa164179c JCLOUDS-217: Percent encoding changes.
jclouds should not check if the string is encoded, but rather expect
that all strings would be encoded prior to transmission. As part of
that change, we must make sure that no code relies on such behavior
within jclouds. This commit adds a blobstore test to check encoding
pattern for blobs. It also removes the encoding check in the Strings2
class and the related test.
2015-09-08 15:12:14 -07:00
Oliver Gondža edde721937 JCLOUDS-962: Make all @Provider methods final 2015-09-02 23:54:44 +02:00
Oliver Gondža 6cd716f1ea JCLOUDS-962: Do not override provider methods 2015-09-02 23:54:44 +02:00