openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1765567 - in /openwebbeans/microwave/trunk: microwave-core/ microwave-core/src/main/java/org/apache/microwave/ microwave-core/src/main/java/org/apache/microwave/cxf/ microwave-core/src/main/java/org/apache/microwave/openwebbeans/ microwave...
Date Wed, 19 Oct 2016 09:53:56 GMT
Author: rmannibucau
Date: Wed Oct 19 09:53:55 2016
New Revision: 1765567

URL: http://svn.apache.org/viewvc?rev=1765567&view=rev
Log:
removing lombok

Modified:
    openwebbeans/microwave/trunk/microwave-core/pom.xml
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/BusInstance.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/CxfCdiAutoSetup.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBAutoSetup.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
    openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/MicrowaveTest.java
    openwebbeans/microwave/trunk/microwave-core/src/test/java/org/superbiz/app/Endpoint.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
    openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java

Modified: openwebbeans/microwave/trunk/microwave-core/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/pom.xml?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/pom.xml (original)
+++ openwebbeans/microwave/trunk/microwave-core/pom.xml Wed Oct 19 09:53:55 2016
@@ -41,12 +41,6 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.projectlombok</groupId>
-      <artifactId>lombok</artifactId>
-      <version>1.16.10</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-annotation_1.2_spec</artifactId>
       <version>1.0</version>

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
Wed Oct 19 09:53:55 2016
@@ -18,9 +18,6 @@
  */
 package org.apache.microwave;
 
-import lombok.Data;
-import lombok.Getter;
-import lombok.experimental.Accessors;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Globals;
@@ -83,10 +80,7 @@ import static java.util.Collections.empt
 import static java.util.Optional.ofNullable;
 
 public class Microwave implements AutoCloseable {
-    @Getter
     private final Builder configuration;
-
-    @Getter
     protected File base;
 
     protected InternalTomcat tomcat;
@@ -98,6 +92,14 @@ public class Microwave implements AutoCl
         this.configuration = builder;
     }
 
+    public Builder getConfiguration() {
+        return configuration;
+    }
+
+    public File getBase() {
+        return base;
+    }
+
     public Tomcat getTomcat() {
         return tomcat;
     }
@@ -140,8 +142,8 @@ public class Microwave implements AutoCl
                     ctx.getResources().setCachingAllowed(configuration.webResourceCached);
                     break;
                 case Lifecycle.BEFORE_START_EVENT:
-                    if (configuration.loginConfig() != null) {
-                        ctx.setLoginConfig(configuration.loginConfig().build());
+                    if (configuration.loginConfig != null) {
+                        ctx.setLoginConfig(configuration.loginConfig.build());
                     }
                     for (final SecurityConstaintBuilder sc : configuration.securityConstraints)
{
                         ctx.addConstraint(sc.build());
@@ -516,8 +518,6 @@ public class Microwave implements AutoCl
         }
     }
 
-    @Data
-    @Accessors(fluent = true)
     public static class Builder {
         @CliOption(name = "http", description = "HTTP port")
         private int httpPort = 8080;
@@ -612,6 +612,9 @@ public class Microwave implements AutoCl
         @CliOption(name = "cdi-conversation", description = "Should CDI conversation be activated")
         private boolean cdiConversation;
 
+        @CliOption(name = "jaxrs-provider-setup", description = "Should default JAX-RS provider
be configured")
+        private boolean jaxrsProviderSetup;
+
         @CliOption(name = "jaspic-skip-override", description = "Should Tomcat jaspic AuthConfigFactory
implementation not be forced (global for the JVM)")
         public boolean skipJaspicProperty;
 
@@ -619,6 +622,266 @@ public class Microwave implements AutoCl
             loadFrom("microwave.properties");
         }
 
+        public boolean isJaxrsProviderSetup() {
+            return jaxrsProviderSetup;
+        }
+
+        public void setJaxrsProviderSetup(final boolean jaxrsProviderSetup) {
+            this.jaxrsProviderSetup = jaxrsProviderSetup;
+        }
+
+        public int getHttpPort() {
+            return httpPort;
+        }
+
+        public void setHttpPort(final int httpPort) {
+            this.httpPort = httpPort;
+        }
+
+        public int getHttpsPort() {
+            return httpsPort;
+        }
+
+        public void setHttpsPort(final int httpsPort) {
+            this.httpsPort = httpsPort;
+        }
+
+        public int getStopPort() {
+            return stopPort;
+        }
+
+        public void setStopPort(final int stopPort) {
+            this.stopPort = stopPort;
+        }
+
+        public String getHost() {
+            return host;
+        }
+
+        public void setHost(final String host) {
+            this.host = host;
+        }
+
+        public String getDir() {
+            return dir;
+        }
+
+        public void setDir(final String dir) {
+            this.dir = dir;
+        }
+
+        public File getServerXml() {
+            return serverXml;
+        }
+
+        public void setServerXml(final File serverXml) {
+            this.serverXml = serverXml;
+        }
+
+        public boolean isKeepServerXmlAsThis() {
+            return keepServerXmlAsThis;
+        }
+
+        public void setKeepServerXmlAsThis(final boolean keepServerXmlAsThis) {
+            this.keepServerXmlAsThis = keepServerXmlAsThis;
+        }
+
+        public Properties getProperties() {
+            return properties;
+        }
+
+        public void setProperties(final Properties properties) {
+            this.properties = properties;
+        }
+
+        public boolean isQuickSession() {
+            return quickSession;
+        }
+
+        public void setQuickSession(final boolean quickSession) {
+            this.quickSession = quickSession;
+        }
+
+        public boolean isSkipHttp() {
+            return skipHttp;
+        }
+
+        public void setSkipHttp(final boolean skipHttp) {
+            this.skipHttp = skipHttp;
+        }
+
+        public boolean isSsl() {
+            return ssl;
+        }
+
+        public void setSsl(final boolean ssl) {
+            this.ssl = ssl;
+        }
+
+        public String getKeystoreFile() {
+            return keystoreFile;
+        }
+
+        public void setKeystoreFile(final String keystoreFile) {
+            this.keystoreFile = keystoreFile;
+        }
+
+        public String getKeystorePass() {
+            return keystorePass;
+        }
+
+        public void setKeystorePass(final String keystorePass) {
+            this.keystorePass = keystorePass;
+        }
+
+        public String getKeystoreType() {
+            return keystoreType;
+        }
+
+        public void setKeystoreType(final String keystoreType) {
+            this.keystoreType = keystoreType;
+        }
+
+        public String getClientAuth() {
+            return clientAuth;
+        }
+
+        public void setClientAuth(final String clientAuth) {
+            this.clientAuth = clientAuth;
+        }
+
+        public String getKeyAlias() {
+            return keyAlias;
+        }
+
+        public void setKeyAlias(final String keyAlias) {
+            this.keyAlias = keyAlias;
+        }
+
+        public String getSslProtocol() {
+            return sslProtocol;
+        }
+
+        public void setSslProtocol(final String sslProtocol) {
+            this.sslProtocol = sslProtocol;
+        }
+
+        public String getWebXml() {
+            return webXml;
+        }
+
+        public void setWebXml(final String webXml) {
+            this.webXml = webXml;
+        }
+
+        public LoginConfigBuilder getLoginConfig() {
+            return loginConfig;
+        }
+
+        public void setLoginConfig(final LoginConfigBuilder loginConfig) {
+            this.loginConfig = loginConfig;
+        }
+
+        public Collection<SecurityConstaintBuilder> getSecurityConstraints() {
+            return securityConstraints;
+        }
+
+        public void setSecurityConstraints(final Collection<SecurityConstaintBuilder>
securityConstraints) {
+            this.securityConstraints = securityConstraints;
+        }
+
+        public Realm getRealm() {
+            return realm;
+        }
+
+        public void setRealm(final Realm realm) {
+            this.realm = realm;
+        }
+
+        public Map<String, String> getUsers() {
+            return users;
+        }
+
+        public void setUsers(final Map<String, String> users) {
+            this.users = users;
+        }
+
+        public Map<String, String> getRoles() {
+            return roles;
+        }
+
+        public void setRoles(final Map<String, String> roles) {
+            this.roles = roles;
+        }
+
+        public boolean isHttp2() {
+            return http2;
+        }
+
+        public void setHttp2(final boolean http2) {
+            this.http2 = http2;
+        }
+
+        public Collection<Connector> getConnectors() {
+            return connectors;
+        }
+
+        public String getTempDir() {
+            return tempDir;
+        }
+
+        public void setTempDir(final String tempDir) {
+            this.tempDir = tempDir;
+        }
+
+        public boolean isWebResourceCached() {
+            return webResourceCached;
+        }
+
+        public void setWebResourceCached(final boolean webResourceCached) {
+            this.webResourceCached = webResourceCached;
+        }
+
+        public String getConf() {
+            return conf;
+        }
+
+        public void setConf(final String conf) {
+            this.conf = conf;
+        }
+
+        public boolean isDeleteBaseOnStartup() {
+            return deleteBaseOnStartup;
+        }
+
+        public void setDeleteBaseOnStartup(final boolean deleteBaseOnStartup) {
+            this.deleteBaseOnStartup = deleteBaseOnStartup;
+        }
+
+        public String getJaxrsMapping() {
+            return jaxrsMapping;
+        }
+
+        public void setJaxrsMapping(final String jaxrsMapping) {
+            this.jaxrsMapping = jaxrsMapping;
+        }
+
+        public boolean isCdiConversation() {
+            return cdiConversation;
+        }
+
+        public void setCdiConversation(final boolean cdiConversation) {
+            this.cdiConversation = cdiConversation;
+        }
+
+        public boolean isSkipJaspicProperty() {
+            return skipJaspicProperty;
+        }
+
+        public void setSkipJaspicProperty(final boolean skipJaspicProperty) {
+            this.skipJaspicProperty = skipJaspicProperty;
+        }
+
         public Builder randomHttpPort() {
             try (final ServerSocket serverSocket = new ServerSocket(0)) {
                 this.httpPort = serverSocket.getLocalPort();

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/BusInstance.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/BusInstance.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/BusInstance.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/BusInstance.java
Wed Oct 19 09:53:55 2016
@@ -18,16 +18,105 @@
  */
 package org.apache.microwave.cxf;
 
-import lombok.experimental.Delegate;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
+import org.apache.cxf.feature.Feature;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
 
 @Named("cxf")
 @ApplicationScoped
 public class BusInstance implements Bus {
-    @Delegate
     private Bus delegate = new ExtensionManagerBus();
+
+    @Override
+    public <T> T getExtension(final Class<T> extensionType) {
+        return delegate.getExtension(extensionType);
+    }
+
+    @Override
+    public <T> void setExtension(final T extension, final Class<T> extensionType)
{
+        delegate.setExtension(extension, extensionType);
+    }
+
+    @Override
+    public boolean hasExtensionByName(final String name) {
+        return delegate.hasExtensionByName(name);
+    }
+
+    @Override
+    public String getId() {
+        return delegate.getId();
+    }
+
+    @Override
+    public void setId(final String i) {
+        delegate.setId(i);
+    }
+
+    @Override
+    public void shutdown(final boolean wait) {
+        delegate.shutdown(wait);
+    }
+
+    @Override
+    public void setProperty(final String s, final Object o) {
+        delegate.setProperty(s, o);
+    }
+
+    @Override
+    public Object getProperty(final String s) {
+        return delegate.getProperty(s);
+    }
+
+    @Override
+    public void setProperties(final Map<String, Object> properties) {
+        delegate.setProperties(properties);
+    }
+
+    @Override
+    public Map<String, Object> getProperties() {
+        return delegate.getProperties();
+    }
+
+    @Override
+    public Collection<Feature> getFeatures() {
+        return delegate.getFeatures();
+    }
+
+    @Override
+    public void setFeatures(final Collection<? extends Feature> features) {
+        delegate.setFeatures(features);
+    }
+
+    @Override
+    public BusState getState() {
+        return delegate.getState();
+    }
+
+    @Override
+    public List<Interceptor<? extends Message>> getInInterceptors() {
+        return delegate.getInInterceptors();
+    }
+
+    @Override
+    public List<Interceptor<? extends Message>> getOutInterceptors() {
+        return delegate.getOutInterceptors();
+    }
+
+    @Override
+    public List<Interceptor<? extends Message>> getInFaultInterceptors() {
+        return delegate.getInFaultInterceptors();
+    }
+
+    @Override
+    public List<Interceptor<? extends Message>> getOutFaultInterceptors() {
+        return delegate.getOutFaultInterceptors();
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/CxfCdiAutoSetup.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/CxfCdiAutoSetup.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/CxfCdiAutoSetup.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/cxf/CxfCdiAutoSetup.java
Wed Oct 19 09:53:55 2016
@@ -44,7 +44,7 @@ public class CxfCdiAutoSetup implements
             @Override
             protected void loadBus(final ServletConfig servletConfig) {
                 super.loadBus(servletConfig);
-                if (!"true".equalsIgnoreCase(builder.properties().getProperty("microwave.jaxrs.providers.setup",
"true"))) {
+                if (builder.isJaxrsProviderSetup()) {
                     return;
                 }
 
@@ -67,6 +67,6 @@ public class CxfCdiAutoSetup implements
         });
         jaxrs.setLoadOnStartup(1);
         jaxrs.setAsyncSupported(true);
-        jaxrs.addMapping(builder.jaxrsMapping());
+        jaxrs.addMapping(builder.getJaxrsMapping());
     }
 }

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBAutoSetup.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBAutoSetup.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBAutoSetup.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBAutoSetup.java
Wed Oct 19 09:53:55 2016
@@ -34,7 +34,7 @@ public class OWBAutoSetup implements Ser
     @Override
     public void onStartup(final Set<Class<?>> c, final ServletContext ctx) throws
ServletException {
         final Microwave.Builder builder = Microwave.Builder.class.cast(ctx.getAttribute("microwave.configuration"));
-        if (builder.cdiConversation()) {
+        if (builder.isCdiConversation()) {
             final FilterRegistration.Dynamic filter = ctx.addFilter("owb-conversation", WebConversationFilter.class);
             filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*");
         }

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
Wed Oct 19 09:53:55 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.microwave.runner;
 
-import lombok.NoArgsConstructor;
 import org.apache.catalina.connector.Connector;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
@@ -41,11 +40,13 @@ import java.util.stream.Stream;
 
 import static java.util.Optional.ofNullable;
 import static java.util.stream.Collectors.toList;
-import static lombok.AccessLevel.PRIVATE;
 
 @Vetoed
-@NoArgsConstructor(access = PRIVATE)
 public class Cli {
+    private Cli() {
+        // no-op
+    }
+
     public static void main(final String[] args) {
         final Options options = new Options();
         options.addOption("help", false, "Show help");

Modified: openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/MicrowaveTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/MicrowaveTest.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/MicrowaveTest.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/MicrowaveTest.java
Wed Oct 19 09:53:55 2016
@@ -20,9 +20,9 @@ package org.apache.microwave;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.cxf.helpers.FileUtils;
+import org.junit.Test;
 import org.superbiz.app.Endpoint;
 import org.superbiz.app.RsApp;
-import org.junit.Test;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -53,7 +53,7 @@ public class MicrowaveTest {
         });
         try (final Microwave microwave = new Microwave(new Microwave.Builder().randomHttpPort()).start())
{
             microwave.deployWebapp("", root);
-            assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + microwave.getConfiguration().httpPort()
+ "/api/test")));
+            assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + microwave.getConfiguration().getHttpPort()
+ "/api/test")));
         } catch (final IOException e) {
             fail(e.getMessage());
         }
@@ -62,7 +62,7 @@ public class MicrowaveTest {
     @Test
     public void classpath() {
         try (final Microwave microwave = new Microwave(new Microwave.Builder().randomHttpPort()).bake())
{
-            assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + microwave.getConfiguration().httpPort()
+ "/api/test")));
+            assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + microwave.getConfiguration().getHttpPort()
+ "/api/test")));
         } catch (final IOException e) {
             fail(e.getMessage());
         }
@@ -71,7 +71,7 @@ public class MicrowaveTest {
     @Test
     public void json() {
         try (final Microwave microwave = new Microwave(new Microwave.Builder().randomHttpPort()).bake())
{
-            assertEquals("{\"name\":\"test\"}", IOUtils.toString(new URL("http://localhost:"
+ microwave.getConfiguration().httpPort() + "/api/test/json")));
+            assertEquals("{\"name\":\"test\"}", IOUtils.toString(new URL("http://localhost:"
+ microwave.getConfiguration().getHttpPort() + "/api/test/json")));
         } catch (final IOException e) {
             fail(e.getMessage());
         }

Modified: openwebbeans/microwave/trunk/microwave-core/src/test/java/org/superbiz/app/Endpoint.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/test/java/org/superbiz/app/Endpoint.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/test/java/org/superbiz/app/Endpoint.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/test/java/org/superbiz/app/Endpoint.java
Wed Oct 19 09:53:55 2016
@@ -18,10 +18,6 @@
  */
 package org.superbiz.app;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 import javax.ws.rs.GET;
@@ -48,10 +44,23 @@ public class Endpoint {
         return new Simple("test");
     }
 
-    @Data
-    @AllArgsConstructor
-    @NoArgsConstructor
     public static class Simple {
         private String name;
+
+        public Simple() {
+            // no-op
+        }
+
+        public Simple(final String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(final String name) {
+            this.name = name;
+        }
     }
 }

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
Wed Oct 19 09:53:55 2016
@@ -25,13 +25,13 @@ import java.util.Map;
 
 public class MicrowaveExtension {
     private boolean skipMavenCentral;
-    private String context;
+    private String context = "";
     private File webapp;
 
-    private int httpPort;
-    private int httpsPort;
-    private int stopPort;
-    private String host;
+    private int httpPort = 8080;
+    private int httpsPort = 8443;
+    private int stopPort = -1;
+    private String host = "localhost";
     protected String dir;
     private File serverXml;
     private boolean keepServerXmlAsThis;
@@ -52,13 +52,14 @@ public class MicrowaveExtension {
     private Map<String, String> roles;
     private boolean http2;
     private String tempDir;
-    private boolean webResourceCached;
+    private boolean webResourceCached = true;
     private String conf;
-    private boolean deleteBaseOnStartup;
+    private boolean deleteBaseOnStartup = true;
     private String jaxrsMapping;
     private boolean cdiConversation;
     private boolean skip;
     private boolean skipJaspicProperty;
+    private boolean jaxrsProviderSetup = true;
 
     public String getContext() {
         return context;

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
Wed Oct 19 09:53:55 2016
@@ -29,6 +29,7 @@ import org.gradle.api.tasks.TaskAction;
 
 import java.io.File;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -41,28 +42,30 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Scanner;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Stream;
 
 import static java.util.Arrays.asList;
 import static java.util.Optional.ofNullable;
+import static java.util.stream.Collectors.toList;
 
 public class MicrowaveTask extends DefaultTask {
     private Configuration classpath;
 
     @Input
     @Optional
-    private int httpPort;
+    private int httpPort = 8080;
 
     @Input
     @Optional
-    private int httpsPort;
+    private int httpsPort = 8443;
 
     @Input
     @Optional
-    private int stopPort;
+    private int stopPort = -1;
 
     @Input
     @Optional
-    private String host;
+    private String host = "localhost";
 
     @Input
     @Optional
@@ -82,7 +85,7 @@ public class MicrowaveTask extends Defau
 
     @Input
     @Optional
-    private boolean quickSession;
+    private boolean quickSession = true;
 
     @Input
     @Optional
@@ -154,11 +157,15 @@ public class MicrowaveTask extends Defau
 
     @Input
     @Optional
-    private boolean deleteBaseOnStartup;
+    private boolean deleteBaseOnStartup = true;
 
     @Input
     @Optional
-    private String jaxrsMapping;
+    private String jaxrsMapping = "/*";
+
+    @Input
+    @Optional
+    private boolean jaxrsProviderSetup = true;
 
     @Input
     @Optional
@@ -186,7 +193,7 @@ public class MicrowaveTask extends Defau
 
     @Input
     @Optional
-    private String context;
+    private String context = "";
 
     @Input
     @Optional
@@ -254,7 +261,7 @@ public class MicrowaveTask extends Defau
                 configClass.getMethod("deployWebapp", String.class, File.class).invoke(container,
fixedContext, webapp);
             }
 
-            getLogger().info("Microwave started on " + configClass.getMethod("host").invoke(config)
+ ":" + configClass.getMethod("httpPort").invoke(config));
+            getLogger().info("Microwave started on " + configClass.getMethod("getHost").invoke(config)
+ ":" + configClass.getMethod("getHttpPort").invoke(config));
         } catch (final Exception e) {
             ofNullable(hook).ifPresent(h -> {
                 try {
@@ -319,7 +326,54 @@ public class MicrowaveTask extends Defau
                 getLogger().warn("can't initialize attribute " + field.getName());
             }
         }
-        // TODO: securityConstraints, loginConfig
+
+        if (securityConstraints != null) {
+            configClass.getMethod("setSecurityConstraints", Collection.class).invoke(config,
securityConstraints.stream()
+                    .map(item -> {
+                        try {
+                            final Class<?> recipeType = configClass.getClassLoader().loadClass("org.apache.xbean.recipe.ObjectRecipe");
+                            final Class<?> builderType = configClass.getClassLoader().loadClass("org.apache.microwave.Microwave$SecurityConstaintBuilder");
+                            final Object recipe = recipeType.getConstructor(Class.class).newInstance(builderType);
+                            Stream.of(item.split(";"))
+                                    .map(v -> v.split("="))
+                                    .forEach(v -> {
+                                        try {
+                                            recipe.getClass().getMethod("setProperty", String.class,
String.class).invoke(recipe, v[0], v[1]);
+                                        } catch (final NoSuchMethodException | IllegalAccessException
e) {
+                                            throw new IllegalStateException(e);
+                                        } catch (final InvocationTargetException e) {
+                                            throw new IllegalStateException(e.getCause());
+                                        }
+                                    });
+                            return recipe.getClass().getMethod("create", ClassLoader.class).invoke(recipe,
configClass.getClassLoader());
+                        } catch (final Exception cnfe) {
+                            throw new IllegalArgumentException(item);
+                        }
+                    }).collect(toList()));
+        }
+        ofNullable(loginConfig).ifPresent(lc -> {
+            try {
+                final Class<?> recipeType = configClass.getClassLoader().loadClass("org.apache.xbean.recipe.ObjectRecipe");
+                final Class<?> builderType = configClass.getClassLoader().loadClass("org.apache.microwave.Microwave$LoginConfigBuilder");
+                final Object recipe = recipeType.getConstructor(Class.class).newInstance(builderType);
+                Stream.of(loginConfig.split(";"))
+                        .map(v -> v.split("="))
+                        .forEach(v -> {
+                            try {
+                                recipe.getClass().getMethod("setProperty", String.class,
String.class).invoke(recipe, v[0], v[1]);
+                            } catch (final NoSuchMethodException | IllegalAccessException
e) {
+                                throw new IllegalStateException(e);
+                            } catch (final InvocationTargetException e) {
+                                throw new IllegalStateException(e.getCause());
+                            }
+                        });
+                configClass.getMethod("setLoginConfig", Collection.class)
+                        .invoke(config, recipe.getClass().getMethod("create", ClassLoader.class).invoke(recipe,
configClass.getClassLoader()));
+            } catch (final Exception cnfe) {
+                throw new IllegalArgumentException(loginConfig);
+            }
+        });
+
         return config;
     }
 

Modified: openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java?rev=1765567&r1=1765566&r2=1765567&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
(original)
+++ openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
Wed Oct 19 09:53:55 2016
@@ -144,6 +144,9 @@ public class MicrowaveRunMojo extends Ab
     @Parameter(name = "microwave.skip-jaspic-setup", defaultValue = "false")
     private boolean skipJaspicProperty;
 
+    @Parameter(name = "microwave.jaxrs-provider-setup", defaultValue = "true")
+    private boolean jaxrsProviderSetup;
+
     @Parameter
     private List<String> jsCustomizers;
 
@@ -264,7 +267,7 @@ public class MicrowaveRunMojo extends Ab
             }
         }
         if (properties != null) {
-            config.properties().putAll(properties);
+            config.getProperties().putAll(properties);
         }
         return config;
     }



Mime
View raw message