Commit Graph

1626 Commits

Author SHA1 Message Date
gurkerl83 dec017c116 Remove distribution profiles
Remove distribution profiles from the JClouds parent, main, and core modules. Each profile defines assembly descriptors, but none of those files are provided by the project anymore.
The maven assembly plugin relies on those descriptors to dictate its execution.
The estimation is that individual maven artifacts, one per module, get deployed instead of a compressed deployment unit.
In that case, it is enough to use mavens deploy command in combination with distribution management configuration pushing individual jars to the artifact repositories.
2021-02-19 23:31:03 +09:00
korlov42 d74dcca6dd fix UnsupportedOperationException during setting socketFactory 2021-02-12 18:57:46 +09:00
korlov42 44ff69d144 JCLOUDS-1551: Update version of OkHttp 3.14.9 2021-02-12 18:57:46 +09:00
gurkerl83 0eb89aef6d Move from OSGi Spec V4.2 to V6
Increase of OSGi dependencies core and compendium (now cmpn) from 4.2 to 6.0.
Previously it was possible to run JClouds in OSGi environments from version 4.

An essential aspect to use JClouds in an OSGi environment requires so-called feature sets. These can be generated manually or automatically - see JClouds-Karaf project. Since there have been significant changes in the structure and behaviour of Karaf in the meantime, an adaptation is appropriate.

Breaking change - probably not, as no other APIs of core and compendium are used than up to now.

OSGi - V4.2 - Karaf 2.2.x - to 2.2.9 (Current Status - not active)
OSGi - V6.0 - Karaf 4.1.x - 4.2 (Current Status - active)
2021-01-31 22:03:59 +09:00
gurkerl83 0dc92e5103 Reorder dependencies for core module
Reorder dependencies, integrate library javax.ws.rs-api in the parents' dependency management section
2021-01-31 22:03:59 +09:00
gurkerl83 d0c4a5825e Remove javax libraries
Remove javax libraries inject and annotation. In JDK 8 those libraries are provided by the JDK. Younger JDK versions > 11 exclude them again to make the JDK leaner. Supporting younger JDK versions means integrating more younger libraries maintained by the Jakarta project.
2021-01-31 22:03:59 +09:00
roded 3a7e41f4e2 JCLOUDS-1559: add Charset to Json.fromJson InputStream methods 2020-12-05 20:46:11 +09:00
gurkerl83 9215bfcb70 In the final state of this feature, a rebase on Master was executed. In resolving a merge problem with the Maven project file "JClouds Project," an important instruction got overwritten, to generate test jars for each module. This modification re-adds this ability for all modules. Counter versa, defining this build step repeatedly, e.g., in the api/oauth module, is no longer required. Also, correct a typo, add groupId.
Note: Previously, the maven jar plugin contained a configuration embedded in each module's generated manifest files. The configuration got relocated to the project/bnd.bnd file in a previous commit, and gets handled through the bnd plugin.
2020-10-26 19:58:41 +09:00
gurkerl83 8ac994c2b5 Integrate GSON library in Clouds Core Bundle Final
In the last commit (last section of squashed commit), the GSON library was integrated into the JClouds core module using maven-bundle plugins include resource instruction. Building OSGi instruction variables from the respective modules show a weakness when resources such as script builder shell scripts are required to be integrated into the bundle but not provide a dedicated variable declaration for the resource section.

The following commit demonstrates a change in strategy in declaration and integration of OSGi metadata.

- Replace old bundle-plugin with newest bnd-plugin (bundle-plugin uses bnd-plugin internally)
- Move OSGi metadata declarations from a maven variable passing strategy into dedicated bnd.bnd files
+ Cleaner pom files, no bundle packaging
+ Intellisense / Autocomplete support for .bnd files in terms of package exports etc.

For demonstration, the overall OSGi adjustments are limited to project, core, script builder, compute, blob store, and load balancer because most custom OSGi metadata is defined here.

Note: Other modules are currently disabled from build because some feedback is needed first.

Make GSON integration work.
To understand the changes, see the core modules' bnd file. GSON internal packages also define a version. Both already exported and new export declarations are fused. The global JClouds core module exports defined the entire set of GSON packages available.

Some minor modifications were made in the module project; replace maven jar plugin with a minified version of the declaration, outsourced in projects bnd file.
2020-10-26 19:58:41 +09:00
gurkerl83 d82868cc47 Replace embedded and repackaged GSON library
Replace substituted GSON package names with those provided from the vendor.
Reduce OSGi-metadata declaration of core-module because the artificial package org.jclouds.json.gson.internal was removed.
Remove the Gson module its children Gson bundle, and Gson shaded.
Remove duplication conflict and check-style rules due to the removal of the internal Gson module.
Add maven repository where a custom version of the Gson library gets hosted, which exports all packages.

Remove particular repository

Remove the declaration of the repository that serves a custom build GSON version. The build uses GSON in its original form of the vendor, which gets distributed through the standard distribution channel. The identifiers for group, artifact, and version correspond to the latest stable release of GSON.

Integrate GSON library in Clouds Core Bundle

The change contained in the commit puts the GSON library into the classpath of the JClouds core module.
After several tests with Karaf and Karaf JClouds, especially if the Maven identifier matches the original GSON library, there are only a limited number of ways to keep the deployment effort low.

Specifically, Karaf has a set of predefined Maven repositories that can be easily customized. The order in which a particular repository is resolved into the customized GSON library is more difficult. In normal OSGi applications, which do not have such a management function, I imagine this configuration to be more complicated.  Sure, a unique identifier would help, but then we are back to step 1.

Although I honestly don't like to see this kind of approach in a codebase I'm working with, there are not many alternatives to the main aspect of deployment mentioned above.

Maybe the approach can still ease the problem in the short term. In a further mid-term step, however, this problem must be addressed in general.
2020-10-26 19:58:41 +09:00
Tamas Cservenak d65047c87b
JCLOUDS-1552: Do not attempt to parse empty payload (#82) 2020-09-21 15:46:25 +02:00
Jean-Noël Rouvignac 9e4c7a16da
JCLOUDS-1542 follow-up: check whether isAccessible() is already set (#79)
AccessibleObject.canAccess() would be much much better,
but this API can only be used from Java 9 onward.
2020-07-05 23:33:07 +02:00
Jean-Noël Rouvignac 238c975078
JCLOUDS-1542 Java 11 warns of illegal reflective access (#76)
With Java 11, an illegal reflective access is output for the google cloud storage blobstore.

    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.jclouds.reflect.Reflection2$1 (file:/.../jclouds-core.jar) to constructor java.lang.String(char[],int,int,java.lang.Void)
    WARNING: Please consider reporting this to the maintainers of org.jclouds.reflect.Reflection2$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release

Indeed, JClouds calls `setAccessible(true)` on the package protected constructor
     `java.lang.String(char[],int,int,java.lang.Void)`.
Investigating the code, it turns out it is looking for constructors annotated with any of:
* java.beans.ConstructorProperties
* org.jclouds.json.SerializedNames
* com.google.inject.Inject

But `String` being defined in `java.base` module, it is impossible
     that it will be annotated with any of these annotation.

This commit is complementary to JClouds commit db4e4af931 .

 

Reflection2.java:
Do not call `setAccessible(true)` on core java constructors and methods.

 

For reference, here is the stacktrace of this illegal access warning:

    java.lang.String.<init>(String.java:3208)
    java.lang.String.<init>(String.java:251)
    java.util.StringJoiner.compactElts(StringJoiner.java:250)
    java.util.StringJoiner.toString(StringJoiner.java:173)
    jdk.internal.module.IllegalAccessLogger.loudWarning(IllegalAccessLogger.java:339)
    jdk.internal.module.IllegalAccessLogger.log(IllegalAccessLogger.java:288)
    jdk.internal.module.IllegalAccessLogger.log(IllegalAccessLogger.java:261)
    jdk.internal.module.IllegalAccessLogger.logIfOpenedForIllegalAccess(IllegalAccessLogger.java:226)
    java.lang.reflect.AccessibleObject.logIfOpenedForIllegalAccess(AccessibleObject.java:366)
    java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:325)
    java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
    java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:189)
    java.lang.reflect.Constructor.setAccessible(Constructor.java:182)
    org.jclouds.reflect.Reflection2$1.load(Reflection2$1.java:157)
    org.jclouds.reflect.Reflection2$1.load(Reflection2$1.java:153)
    com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache$LoadingValueReference.java:3529)
    com.google.common.cache.LocalCache$Segment.loadSync(LocalCache$Segment.java:2278)
    com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache$Segment.java:2155)
    com.google.common.cache.LocalCache$Segment.get(LocalCache$Segment.java:2045)
    com.google.common.cache.LocalCache.get(LocalCache.java:3953)
    com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3976)
    com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache$LocalLoadingCache.java:4960)
    org.jclouds.reflect.Reflection2.get(Reflection2.java:346)
    org.jclouds.reflect.Reflection2.constructors(Reflection2.java:100)
    org.jclouds.json.internal.NamingStrategies$AnnotationConstructorNamingStrategy.getDeserializer(NamingStrategies$AnnotationConstructorNamingStrategy.java:271)
    org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.create(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:125)
    com.google.gson.Gson.getAdapter(Gson.java:458)
    org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    com.google.gson.Gson.getAdapter(Gson.java:458)
    com.google.gson.Gson.toJson(Gson.java:696)
    com.google.gson.Gson.toJson(Gson.java:683)
    com.google.gson.Gson.toJson(Gson.java:638)
    com.google.gson.Gson.toJson(Gson.java:618)
    org.jclouds.json.internal.GsonWrapper.toJson(GsonWrapper.java:65)
    org.jclouds.oauth.v2.functions.ClaimsToAssertion.apply(ClaimsToAssertion.java:59)
    org.jclouds.oauth.v2.functions.ClaimsToAssertion.apply(ClaimsToAssertion.java:43)
    org.jclouds.rest.internal.RestAnnotationProcessor.getParamValue(RestAnnotationProcessor.java:829)
    org.jclouds.rest.internal.RestAnnotationProcessor.getFormParamKeyValues(RestAnnotationProcessor.java:847)
    org.jclouds.rest.internal.RestAnnotationProcessor.addFormParams(RestAnnotationProcessor.java:435)
    org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:258)
    org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:137)
    org.jclouds.rest.internal.InvokeHttpMethod.toCommand(InvokeHttpMethod.java:189)
    org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:85)
    org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
    org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
    org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
    org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
    com.sun.proxy.$Proxy49.authorize(Unknown Source)
    org.jclouds.oauth.v2.filters.JWTBearerTokenFlow$AuthorizeToken.load(JWTBearerTokenFlow$AuthorizeToken.java:84)
    org.jclouds.oauth.v2.filters.JWTBearerTokenFlow$AuthorizeToken.load(JWTBearerTokenFlow$AuthorizeToken.java:68)
    com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache$LoadingValueReference.java:3529)
    com.google.common.cache.LocalCache$Segment.loadSync(LocalCache$Segment.java:2278)
    com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache$Segment.java:2155)
    com.google.common.cache.LocalCache$Segment.get(LocalCache$Segment.java:2045)
    com.google.common.cache.LocalCache.get(LocalCache.java:3953)
    com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3976)
    com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache$LocalLoadingCache.java:4960)
    com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache$LocalLoadingCache.java:4966)
    org.jclouds.oauth.v2.filters.JWTBearerTokenFlow.filter(JWTBearerTokenFlow.java:99)
    org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:90)
    org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
    org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
    org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
    org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
    com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:86)
    com.sun.proxy.$Proxy54.simpleUpload(Unknown Source)
    org.jclouds.googlecloudstorage.blobstore.GoogleCloudStorageBlobStore.uploadMultipartPart(GoogleCloudStorageBlobStore.java:422)
    org.jclouds.blobstore.internal.BaseBlobStore$BlobUploader.call(BaseBlobStore.java:415)
    org.jclouds.blobstore.internal.BaseBlobStore$BlobUploader.call(BaseBlobStore.java:402)
    com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
    com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
    com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor$Worker.java:628)
    java.lang.Thread.run(Thread.java:834)
2020-06-26 19:55:32 +02:00
Andrew Gaul 62767a1461 JCLOUDS-1333: JCLOUDS-1334: JCLOUDS-1470: Require Java 8 and Guava 22
This allows compatibility with Guava 29.  Also unwind some older
workarounds.
2020-06-25 08:11:30 +09:00
Jean-Noël Rouvignac 20b1394f36 JCLOUDS-1491 Jclouds uses a deprecated version of Guava to support Azure storage
DnsNameValidator.java uses a deprecated guava APIs in code that is used
 to support Azure cloud storage. When forcing the use of more recent guava
 versions, the code fails with NoSuchFieldError.

However, CharMatcher.JAVA_LETTER_OR_DIGIT has been removed in guava 26.0,
 and CharMatcher.javaLetterOrDigit() should be used instead since guava
 19.0. Note that CharMatcher.javaLetterOrDigit() was immediately
 deprecated in Guava 26.0, and java.lang.Character.isLetterOrDigit(int)
 should be used instead.

This commit replaces the use of this deprecated API by
 java.lang.Character.isLetterOrDigit(int).
 It is no worse than the previous code.

(If I understand correctly, updating the guava version is a challenge due to
dependencies on Apache Karaf anyway)
2020-06-03 09:14:41 +09:00
Andrew Gaul 6e6f8ebf77 JCLOUDS-912: JCLOUDS-1547: GCS InputStream single-part upload
Previously this provider worked around a RestAnnotationProcessor quirk
by using multi-part uploads for InputStream payloads.  Instead work
around the quirk another way which allows a single-part upload.  This
allows inclusion of the Content-MD5 header during object creation.
Backfill tests with both ByteSource and InputStream inputs.
2020-05-31 17:48:31 +09:00
Ian Springer 3db2939885 JCLOUDS-1538: fix typo in rfc1123SimpleDateFormat (#60) 2020-01-24 09:34:50 -05:00
Markus Alexander Kuppe 11d05ac9bf JCLOUDS-1529: Do not export org.jclouds.json.gson.internal (#56)
Do not export packages matching org.jclouds.json.gson.internal*
because it causes a use constraint violation with OSGi between
jclouds-core and jclouds-gson.

https://issues.apache.org/jira/browse/JCLOUDS-1529
2019-11-28 10:34:16 +01:00
Colm O hEigeartaigh 3a338da682 JCLOUDS-1528 - Use TLS instead of SSL in SSLContext.getInstance (#55) 2019-11-25 14:54:48 +01:00
Ignasi Barrera f5b29c7028 Next development version 2.3.0-SNAPSHOT 2019-10-21 10:32:43 +02:00
Ignasi Barrera 7221844fac Apache jclouds 2.2.0-rc1 release 2019-10-21 10:32:43 +02:00
roded 6d389b0d86 JCLOUDS-1520: change UntrustedSSLContextSupplier to return the same SSLContext (#49)
Using the same SSLContext prevents consistent cache misses on the JVM's KeepAliveCache
when attempting to reuse TLS connections.
2019-10-16 09:48:47 +02:00
Roded Bahat dfeafcc6fb JCLOUDS-1510: ParseSax use charset constant for all String creations
This commit prevents the convertStreamToStringAndParse method from
failing XML validation on environments in which the default charset is
not compatible with UTF-8.
2019-08-19 04:59:51 -07:00
Olaf Flebbe 51da020d2e JCLOUDS-1500: Update gson to 2.8.5 (#29) 2019-07-03 09:11:26 +02:00
Ignasi Barrera b8606a10dd
JCLOUDS-1166: Relocate the gson internal packge to be able to keep using it (#35)
* JCLOUDS-1166: Relocate the gson internal packge to be able to keep using it

* Fixes

* Fix import order and shaded jar

* More fixes

* Proper dependency configuration

* Fix typos

* Bring back duplicate exclusions
2019-06-17 17:43:29 +02:00
Dori Polotsky 1c57d07f70 JCLOUDS-847: Poor upload performance for putBlob
This change improves the performance of writing to sockets with the
default Java URL connection HTTP client, by enlarging the buffer used
for socket writes from an implicit hard-coded 4KB / 8KB buffer to a
configurable 32KB buffer.

The buffer size is now controlled by the following property with the
following default value:

jclouds.output-socket-buffer-size: 32768

The implementation is based on a variant of ByteStreams.copy (written as
ByteStreams2.copy) which accepts the buffer size as an argument, unlike
the original Guava code that uses a hard-coded size.

The change was done directly within the loop that copies the input
stream to the output stream, and not by wrapping a BufferedOutputStream
around the existing output stream, in order to avoid copying the payload
twice.

On some platforms this change can improve both the putBlob throughput
and the total CPU consumption.
2019-04-27 15:16:08 +09:00
Andrew Gaul 731c7aa698 Fix always-true date comparison
Found via error-prone 2.3.3.
2019-02-24 21:03:17 +09:00
Andrew Gaul 53c47aa0bd Correct uses of checkNotNull
These should provide a descriptive second argument, not the same as
the first argument which is null in the failure case.  This also found
a logic error in CreateVolumeResponseHandler.
2019-02-23 16:33:40 +09:00
Andrew Gaul d14276d9a5 Upgrade to modernizer-maven-plugin 1.8.0
Notably this adds support for inline suppressions.  Release notes:

https://github.com/gaul/modernizer-maven-plugin/releases
2019-02-03 13:09:12 -08:00
Andrew Gaul cc65957997 Error-prone 2.3.2 fixes 2018-10-12 23:28:00 -07:00
David Currie 7ebf12bf38 JCLOUDS-1447: URL encode x-amz-copy-source
The x-amz-copy-source header on S3 CopyObject should be URL encoded (as
a path). This is not universally true of all headers though (for example
the = in x-amz-copy-source-range) therefore introducing a new parameter
on @Headers to indicate whether URL encoding should take place.
2018-09-12 08:01:43 -07:00
Mathieu Tortuyaux bcc6a26488 JCLOUDS-1443: fix(rest/processor): check if `/` is ending a default endpoint 2018-08-23 20:24:38 +02:00
Ignasi Barrera 4958f1f29a Adds ConcurrentModificationException to the list of propagatable types 2018-07-11 09:43:04 -07:00
Jesse Glick c34935dcd3 [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException. 2018-07-10 15:00:56 -07:00
Jesse Glick 65a5ec8164 [JCLOUDS-1200] Mark nonserializable fields in HttpResponseException and subtypes as transient. 2018-05-21 22:13:04 -07:00
Andrew Gaul 1f6ec343c0 Upgrade to SpotBugs 3.1.3
This replaces FindBugs.  Also address a few violations.
2018-05-21 22:06:27 -07:00
Ignasi Barrera b29f716a02
JCLOUDS-1294: Attempt to retry RetryableErrors in Azure ARM 2018-05-04 11:03:43 +02:00
Ignasi Barrera d2f566d725 Consider the zone id filter in the location supplier 2018-04-17 10:41:11 +02:00
Andrew Gaul f6d47b9c0e JCLOUDS-1333: Fix Java 8 and Guava 21 issues 2018-04-10 08:17:35 -07:00
andreaturli d17487b223 fix typo in project.version
- from 2.2.0-SNAPSHOST to 2.2.0-SNAPSHOT
2018-02-21 16:45:43 +01:00
andreaturli a5db565581 Next development version 2.2.0-SNAPSHOST 2018-02-16 11:23:12 +01:00
andreaturli 9273bd56ad Apache jclouds 2.1.0-rc3 release 2018-02-16 11:20:21 +01:00
Ignasi Barrera 9fef6ed06b JCLOUDS-1362: Better password generation utility 2018-01-08 08:39:20 +01:00
Andrew Gaul 11640b6c2e Correct RandomByteSource.read return value
Previously read returned a value between -128 and 127.  -1 indicates
end of stream, causing issues for callers.  Instead return values
between 0 and 255 as intended.
2018-01-04 15:12:29 -08:00
Andrew Gaul 50026c8f2d Return Atmos objectID as ETag
Previously Atmos returned null.  Also rework the fix for JCLOUDS-339
which does not reproduce with AT&T Synaptic.  Fixes gaul/s3proxy#247.
2017-11-11 14:20:49 -08:00
Andrew Gaul 46759f8bda Fix a few Coverity defects 2017-11-05 20:12:47 -08:00
Andrew Gaul 31f528263a JCLOUDS-1340: Disable BackoffLimitedRetryHandlerTest
These often fail in our continuous integration tests.
2017-09-11 18:47:04 -07:00
Andrew Gaul 64553eda5f JCLOUDS-1340: Improve BackoffLimitedRetryHandlerTest asserts
These emit a more specific error message.
2017-09-11 13:13:39 -07:00
Andrew Gaul 7704893650 Remove Inject on constructors for abstract classes
This is not meaningful since these classes cannot be instantiated.
Found via error-prone.
2017-09-07 23:37:24 -07:00
Andrew Gaul e7d0c29ce1 JCLOUDS-1101: Skip JDK 9 methods in tests 2017-08-30 10:39:40 -07:00