Re: Guice 4.0-beta5

2015-02-16 Thread Ignasi Barrera
Thanks for the feedback Florent,

Mind opening a JIRA issue [1] so we can properly track this? Also, I see no
problem in your patch, as it should be backwards compatible, so if you want
to open a PR with it, that would make things move faster :)

Regarding Rocoto, IIRC we only use it to parse the properties provided to
the context when building it, but I think we should be able to remove it,
as it does not provide many value IMO. I'd suggest to add a separate issue
for that so we can properly work on it too.


Thx!

I.

[1] https://issues.apache.org/jira/browse/JCLOUDS

On 16 February 2015 at 13:04, Florent Guillaume f...@nuxeo.com wrote:

 Hi,

 We're trying to the latest use jclouds 1.8.1 with a recent version of
 Guice 4.0-beta5, as Guice 3 is quite old.

 There are two problems:

 1. jclouds has to be modified to work with Guice 4.0-beta5. Otherwise
 you get this:

 1) Overriding @Provides methods is not allowed.
 @Provides method:
 org.jclouds.logging.config.LoggingModule.createLoggerFactory()
 overridden by:
 org.jclouds.logging.jdk.config.JDKLoggingModule.createLoggerFactory()
  at
 com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:128)

 The @Provides annotation has to be moved from the base method to each
 of the overriding concrete methods. I'm attaching to this mail an
 example which solves my use case for reference but there are likely
 other places where this has to be done.

 2. jclouds depends on Rocoto 6.2 which is basically unmaintained. We
 had to fork it, a (very simple) patch is available at

 https://github.com/nuxeo/rocoto/commit/7c09617dac9cbbf8cd9f179ceb799f9d5e733d46

 Because Rocoto is unmaintained, a solution has to be found for jclouds
 to keep using it. Maybe it could simply be included as an additional
 module inside jclouds?


 It would be great if the upcoming jclouds 1.9.0 would include this to
 support a more recent version of Guice, because otherwise projects
 using it with Java 8 and requiring a recent Guice won't work. Witness
 for instance https://issues.jenkins-ci.org/browse/JENKINS-26639


 Regards,
 Florent


 --
 Florent Guillaume, Director of RD, Nuxeo
 Open Source Content Management Platform for Business Apps
 http://www.nuxeo.com   http://community.nuxeo.com



Guice 4.0-beta5

2015-02-16 Thread Florent Guillaume
Hi,

We're trying to the latest use jclouds 1.8.1 with a recent version of
Guice 4.0-beta5, as Guice 3 is quite old.

There are two problems:

1. jclouds has to be modified to work with Guice 4.0-beta5. Otherwise
you get this:

1) Overriding @Provides methods is not allowed.
@Provides method:
org.jclouds.logging.config.LoggingModule.createLoggerFactory()
overridden by:
org.jclouds.logging.jdk.config.JDKLoggingModule.createLoggerFactory()
 at 
com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:128)

The @Provides annotation has to be moved from the base method to each
of the overriding concrete methods. I'm attaching to this mail an
example which solves my use case for reference but there are likely
other places where this has to be done.

2. jclouds depends on Rocoto 6.2 which is basically unmaintained. We
had to fork it, a (very simple) patch is available at
https://github.com/nuxeo/rocoto/commit/7c09617dac9cbbf8cd9f179ceb799f9d5e733d46

Because Rocoto is unmaintained, a solution has to be found for jclouds
to keep using it. Maybe it could simply be included as an additional
module inside jclouds?


It would be great if the upcoming jclouds 1.9.0 would include this to
support a more recent version of Guice, because otherwise projects
using it with Java 8 and requiring a recent Guice won't work. Witness
for instance https://issues.jenkins-ci.org/browse/JENKINS-26639


Regards,
Florent


-- 
Florent Guillaume, Director of RD, Nuxeo
Open Source Content Management Platform for Business Apps
http://www.nuxeo.com   http://community.nuxeo.com
diff --git a/core/pom.xml b/core/pom.xml
index 3cc3b89..9913737 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -55,12 +55,12 @@
 dependency
   groupIdcom.google.inject.extensions/groupId
   artifactIdguice-assistedinject/artifactId
-  version3.0/version
+  version4.0-beta5/version
 /dependency
 dependency
   groupIdcom.google.inject/groupId
   artifactIdguice/artifactId
-  version3.0/version
+  version4.0-beta5/version
 /dependency
 dependency
   groupIdorg.99soft.guice/groupId
diff --git 
a/core/src/main/java/org/jclouds/logging/config/ConsoleLoggingModule.java 
b/core/src/main/java/org/jclouds/logging/config/ConsoleLoggingModule.java
index 6f1f6f6..d346f76 100644
--- a/core/src/main/java/org/jclouds/logging/config/ConsoleLoggingModule.java
+++ b/core/src/main/java/org/jclouds/logging/config/ConsoleLoggingModule.java
@@ -18,11 +18,15 @@ package org.jclouds.logging.config;
 
 import org.jclouds.logging.Logger;
 
+import com.google.inject.Provides;
+
 /**
  * Configures logging of type {@link ConsoleLogger}
  */
 public class ConsoleLoggingModule extends LoggingModule {
 
+   @Provides
+   @Override
public Logger.LoggerFactory createLoggerFactory() {
   return new Logger.LoggerFactory() {
  public Logger getLogger(String category) {
diff --git a/core/src/main/java/org/jclouds/logging/config/LoggingModule.java 
b/core/src/main/java/org/jclouds/logging/config/LoggingModule.java
index ad47bd1..ae89fcf 100644
--- a/core/src/main/java/org/jclouds/logging/config/LoggingModule.java
+++ b/core/src/main/java/org/jclouds/logging/config/LoggingModule.java
@@ -23,7 +23,6 @@ import javax.inject.Singleton;
 import org.jclouds.logging.Logger;
 
 import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
 
 /**
  * Creates a post-injection listener that binds Loggers named the same as the 
enclosing class.
@@ -35,7 +34,6 @@ public abstract class LoggingModule extends AbstractModule {
   bindListener(any(), new 
BindLoggersAnnotatedWithResource(createLoggerFactory()));
}
 
-   @Provides
@Singleton
public abstract Logger.LoggerFactory createLoggerFactory();
 
diff --git 
a/core/src/main/java/org/jclouds/logging/config/NullLoggingModule.java 
b/core/src/main/java/org/jclouds/logging/config/NullLoggingModule.java
index a771b2a..886bbea 100644
--- a/core/src/main/java/org/jclouds/logging/config/NullLoggingModule.java
+++ b/core/src/main/java/org/jclouds/logging/config/NullLoggingModule.java
@@ -18,11 +18,15 @@ package org.jclouds.logging.config;
 
 import org.jclouds.logging.Logger;
 
+import com.google.inject.Provides;
+
 /**
  * Configures logging of type {@link NullLogger}
  */
 public class NullLoggingModule extends LoggingModule {
 
+   @Provides
+   @Override
public Logger.LoggerFactory createLoggerFactory() {
   return new Logger.LoggerFactory() {
  public Logger getLogger(String category) {
diff --git 
a/core/src/main/java/org/jclouds/logging/jdk/config/JDKLoggingModule.java 
b/core/src/main/java/org/jclouds/logging/jdk/config/JDKLoggingModule.java
index 5a57473..be9a12a 100644
--- a/core/src/main/java/org/jclouds/logging/jdk/config/JDKLoggingModule.java
+++ b/core/src/main/java/org/jclouds/logging/jdk/config/JDKLoggingModule.java
@@ -20,10 +20,15 @@ import org.jclouds.logging.Logger;
 import