http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/SSLServerConnectorFactory.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/SSLServerConnectorFactory.java b/server/src/main/java/org/apache/oozie/server/SSLServerConnectorFactory.java new file mode 100644 index 0000000..2797cf4 --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/SSLServerConnectorFactory.java @@ -0,0 +1,136 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + + +import com.google.common.base.Preconditions; +import com.google.inject.Inject; +import org.apache.hadoop.conf.Configuration; +import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.SecureRequestCustomizer; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; + +/** + * Factory that is used to configure SSL settings for the Oozie server. + */ +class SSLServerConnectorFactory { + private static final Logger LOG = LoggerFactory.getLogger(SSLServerConnectorFactory.class); + public static final String OOZIE_HTTPS_TRUSTSTORE_FILE = "oozie.https.truststore.file"; + public static final String OOZIE_HTTPS_TRUSTSTORE_PASS = "oozie.https.truststore.pass"; + public static final String OOZIE_HTTPS_KEYSTORE_PASS = "oozie.https.keystore.pass"; + public static final String OOZIE_HTTPS_KEYSTORE_FILE = "oozie.https.keystore.file"; + + private SslContextFactory sslContextFactory; + private Configuration conf; + + @Inject + public SSLServerConnectorFactory(final SslContextFactory sslContextFactory) { + this.sslContextFactory = Preconditions.checkNotNull(sslContextFactory, "sslContextFactory is null"); + } + + /** + * Construct a ServerConnector object with SSL settings + * + * @param oozieHttpsPort Oozie HTTPS port + * @param conf Oozie configuration + * @param server jetty Server which the connector is attached to + * + * @return ServerConnector + */ + public ServerConnector createSecureServerConnector(int oozieHttpsPort, Configuration conf, Server server) { + this.conf = Preconditions.checkNotNull(conf, "conf is null"); + Preconditions.checkNotNull(server, "server is null"); + Preconditions.checkState(oozieHttpsPort >= 1 && oozieHttpsPort <= 65535, + String.format("Invalid port number specified: \'%d\'. It should be between 1 and 65535.", oozieHttpsPort)); + + setIncludeProtocols(); + setCipherSuites(); + setTrustStorePath(); + setTrustStorePass(); + + setKeyStoreFile(); + setKeystorePass(); + + HttpConfiguration httpsConfiguration = getHttpsConfiguration(); + ServerConnector secureServerConnector = new ServerConnector(server, + new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfiguration)); + + secureServerConnector.setPort(oozieHttpsPort); + + LOG.info(String.format("Secure server connector created, listenning on port %d", oozieHttpsPort)); + return secureServerConnector; + } + + private void setCipherSuites() { + String excludeCipherList = conf.get("oozie.https.exclude.cipher.suites"); + String[] excludeCipherSuites = excludeCipherList.split(","); + sslContextFactory.setExcludeCipherSuites(excludeCipherSuites); + + LOG.info(String.format("SSL context - excluding cipher suites: %s", Arrays.toString(excludeCipherSuites))); + } + + private void setIncludeProtocols() { + String enabledProtocolsList = conf.get("oozie.https.include.protocols"); + String[] enabledProtocols = enabledProtocolsList.split(","); + sslContextFactory.setIncludeProtocols(enabledProtocols); + + LOG.info(String.format("SSL context - including protocols: %s", Arrays.toString(enabledProtocols))); + } + + private void setTrustStorePath() { + String trustStorePath = conf.get(OOZIE_HTTPS_TRUSTSTORE_FILE); + Preconditions.checkNotNull(trustStorePath, "trustStorePath is null"); + sslContextFactory.setTrustStorePath(trustStorePath); + } + + private void setTrustStorePass() { + String trustStorePass = conf.get(OOZIE_HTTPS_TRUSTSTORE_PASS); + Preconditions.checkNotNull(trustStorePass, "setTrustStorePass is null"); + sslContextFactory.setTrustStorePassword(trustStorePass); + } + + private void setKeystorePass() { + String keystorePass = conf.get(OOZIE_HTTPS_KEYSTORE_PASS); + Preconditions.checkNotNull(keystorePass, "keystorePass is null"); + sslContextFactory.setKeyManagerPassword(keystorePass); + } + + private void setKeyStoreFile() { + String keystoreFile = conf.get(OOZIE_HTTPS_KEYSTORE_FILE); + Preconditions.checkNotNull(keystoreFile, "keystoreFile is null"); + sslContextFactory.setKeyStorePath(keystoreFile); + } + + private HttpConfiguration getHttpsConfiguration() { + HttpConfiguration https = new HttpConfigurationWrapper(conf).getDefaultHttpConfiguration(); + https.setSecureScheme("https"); + https.addCustomizer(new SecureRequestCustomizer()); + return https; + } +}
http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/ServletMapper.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/ServletMapper.java b/server/src/main/java/org/apache/oozie/server/ServletMapper.java new file mode 100644 index 0000000..ae27ac3 --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/ServletMapper.java @@ -0,0 +1,95 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + +import com.google.common.base.Preconditions; +import com.google.inject.Inject; +import org.apache.oozie.servlet.CallbackServlet; +import org.apache.oozie.servlet.SLAServlet; +import org.apache.oozie.servlet.V0AdminServlet; +import org.apache.oozie.servlet.V0JobServlet; +import org.apache.oozie.servlet.V0JobsServlet; +import org.apache.oozie.servlet.V1AdminServlet; +import org.apache.oozie.servlet.V1JobServlet; +import org.apache.oozie.servlet.V2AdminServlet; +import org.apache.oozie.servlet.V2JobServlet; +import org.apache.oozie.servlet.V2SLAServlet; +import org.apache.oozie.servlet.V2ValidateServlet; +import org.apache.oozie.servlet.VersionServlet; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.servlet.ServletMapping; +import org.eclipse.jetty.webapp.WebAppContext; + +import javax.servlet.Servlet; + + +public class ServletMapper { + private final WebAppContext servletContextHandler; + + @Inject + public ServletMapper(final WebAppContext servletContextHandler) { + this.servletContextHandler = Preconditions.checkNotNull(servletContextHandler, "ServletContextHandler is null"); + } + /** + * Maps Oozie servlets to path specs. Make sure it is in sync with FilterMapper when making changes. + * */ + void mapOozieServlets() { + mapServlet(VersionServlet.class, "/versions"); + mapServlet(V0AdminServlet.class, "/v0/admin/*"); + mapServlet(V1AdminServlet.class, "/v1/admin/*"); + mapServlet(V2AdminServlet.class, "/v2/admin/*"); + + mapServlet(CallbackServlet.class, "/callback/*"); + + ServletHandler servletHandler = servletContextHandler.getServletHandler(); + String voJobservletName = V0JobsServlet.class.getSimpleName(); + servletHandler.addServlet(new ServletHolder(voJobservletName, new V0JobsServlet())); + ServletMapping jobServletMappingV0 = new ServletMapping(); + jobServletMappingV0.setPathSpec("/v0/jobs"); + jobServletMappingV0.setServletName(voJobservletName); + + ServletMapping jobServletMappingV1 = new ServletMapping(); + jobServletMappingV1.setPathSpec("/v1/jobs"); + jobServletMappingV1.setServletName(voJobservletName); + + ServletMapping jobServletMappingV2 = new ServletMapping(); + jobServletMappingV2.setPathSpec("/v2/jobs"); + jobServletMappingV2.setServletName(voJobservletName); + + servletHandler.addServletMapping(jobServletMappingV0); + servletHandler.addServletMapping(jobServletMappingV1); + servletHandler.addServletMapping(jobServletMappingV2); + + mapServlet(V0JobServlet.class, "/v0/job/*"); + mapServlet(V1JobServlet.class, "/v1/job/*"); + mapServlet(V2JobServlet.class, "/v2/job/*"); + mapServlet(SLAServlet.class, "/v1/sla/*"); + mapServlet(V2SLAServlet.class, "/v2/sla/*"); + mapServlet(V2ValidateServlet.class, "/v2/validate/*"); + } + + private void mapServlet(final Class<? extends Servlet> servletClass, final String servletPath) { + try { + servletContextHandler.addServlet(new ServletHolder(servletClass.newInstance()), servletPath); + } catch (final InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/WebRootResourceLocator.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/WebRootResourceLocator.java b/server/src/main/java/org/apache/oozie/server/WebRootResourceLocator.java new file mode 100644 index 0000000..190d1c2 --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/WebRootResourceLocator.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + +import java.io.FileNotFoundException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + +public class WebRootResourceLocator { + private static final String WEBROOT_INDEX = "/webapp/"; + + public URI getWebRootResourceUri() throws FileNotFoundException, URISyntaxException + { + URL indexUri = JspHandler.class.getResource(WebRootResourceLocator.WEBROOT_INDEX); + if (indexUri == null) + { + throw new FileNotFoundException("Unable to find resource " + WebRootResourceLocator.WEBROOT_INDEX); + } + // Points to wherever /webroot/ (the resource) is + return indexUri.toURI(); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/ConstraintSecurityHandlerProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/ConstraintSecurityHandlerProvider.java b/server/src/main/java/org/apache/oozie/server/guice/ConstraintSecurityHandlerProvider.java new file mode 100644 index 0000000..6c313fe --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/ConstraintSecurityHandlerProvider.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.Provider; +import org.eclipse.jetty.security.ConstraintMapping; +import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.util.security.Constraint; + +import java.util.Arrays; + +class ConstraintSecurityHandlerProvider implements Provider<ConstraintSecurityHandler> { + @Override + public ConstraintSecurityHandler get() { + ConstraintMapping callbackConstraintMapping = new ConstraintMapping(); + callbackConstraintMapping.setPathSpec("/callback/*"); + Constraint unsecureConstraint = new Constraint(); + unsecureConstraint.setDataConstraint(Constraint.DC_NONE); + callbackConstraintMapping.setConstraint(unsecureConstraint); + + ConstraintMapping mapping = new ConstraintMapping(); + mapping.setPathSpec("/*"); + Constraint constraint = new Constraint(); + constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL); + mapping.setConstraint(constraint); + + ConstraintSecurityHandler security = new ConstraintSecurityHandler(); + security.setConstraintMappings(Arrays.asList(callbackConstraintMapping, mapping)); + return security; + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/JettyServerProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/JettyServerProvider.java b/server/src/main/java/org/apache/oozie/server/guice/JettyServerProvider.java new file mode 100644 index 0000000..6580a9a --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/JettyServerProvider.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.Inject; +import com.google.inject.Provider; +import org.apache.hadoop.conf.Configuration; +import org.apache.oozie.service.ConfigurationService; +import org.apache.oozie.service.Services; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.util.thread.QueuedThreadPool; + +class JettyServerProvider implements Provider<Server> { + public static final String OOZIE_SERVER_THREADPOOL_MAX_THREADS = "oozie.server.threadpool.max.threads"; + private final Configuration oozieConfiguration; + + @Inject + public JettyServerProvider(final Services oozieServices) { + oozieConfiguration = oozieServices.get(ConfigurationService.class).getConf(); + } + + @Override + public Server get() { + final QueuedThreadPool threadPool = new QueuedThreadPool(); + + final int maxThreads = Integer.parseInt( + oozieConfiguration.get(OOZIE_SERVER_THREADPOOL_MAX_THREADS)); + threadPool.setMaxThreads(maxThreads); + + return new Server(threadPool); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/JspHandlerProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/JspHandlerProvider.java b/server/src/main/java/org/apache/oozie/server/guice/JspHandlerProvider.java new file mode 100644 index 0000000..8a54a9a --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/JspHandlerProvider.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.Inject; +import com.google.inject.Provider; +import org.apache.hadoop.conf.Configuration; +import org.apache.oozie.server.JspHandler; +import org.apache.oozie.server.WebRootResourceLocator; +import org.apache.oozie.service.ConfigurationService; +import org.apache.oozie.service.Services; + +import java.io.File; + +public class JspHandlerProvider implements Provider<JspHandler> { + public static final String OOZIE_JSP_TMP_DIR = "oozie.jsp.tmp.dir"; + public static final String EMBEDDED_JETTY_JSP_DIR = "embedded-jetty-jsp"; + private final Configuration oozieConfiguration; + + @Inject + public JspHandlerProvider(final Services oozieServices) { + oozieConfiguration = oozieServices.get(ConfigurationService.class).getConf(); + } + + @Override + public JspHandler get() { + final File tempDir = new File(oozieConfiguration.get(OOZIE_JSP_TMP_DIR), EMBEDDED_JETTY_JSP_DIR); + + return new JspHandler(tempDir, new WebRootResourceLocator()); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/OozieGuiceModule.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/OozieGuiceModule.java b/server/src/main/java/org/apache/oozie/server/guice/OozieGuiceModule.java new file mode 100644 index 0000000..bb79f0f --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/OozieGuiceModule.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.AbstractModule; +import com.google.inject.Singleton; +import org.apache.oozie.server.JspHandler; +import org.apache.oozie.service.Services; +import org.eclipse.jetty.rewrite.handler.RewriteHandler; +import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.webapp.WebAppContext; + +public class OozieGuiceModule extends AbstractModule { + @Override + protected void configure() { + bind(Services.class).toProvider(ServicesProvider.class).in(Singleton.class); + + bind(Server.class).toProvider(JettyServerProvider.class).in(Singleton.class); + + bind(WebAppContext.class).in(Singleton.class); + + bind(ConstraintSecurityHandler.class).toProvider(ConstraintSecurityHandlerProvider.class).in(Singleton.class); + + bind(JspHandler.class).toProvider(JspHandlerProvider.class).in(Singleton.class); + + bind(RewriteHandler.class).toProvider(RewriteHandlerProvider.class).in(Singleton.class); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/RewriteHandlerProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/RewriteHandlerProvider.java b/server/src/main/java/org/apache/oozie/server/guice/RewriteHandlerProvider.java new file mode 100644 index 0000000..e54d0cb --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/RewriteHandlerProvider.java @@ -0,0 +1,44 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.Inject; +import com.google.inject.Provider; +import org.eclipse.jetty.rewrite.handler.RedirectPatternRule; +import org.eclipse.jetty.rewrite.handler.RewriteHandler; + +class RewriteHandlerProvider implements Provider<RewriteHandler> { + private final RewriteHandler rewriteHandler; + + @Override + public RewriteHandler get() { + return rewriteHandler; + } + + @Inject + public RewriteHandlerProvider(final RedirectPatternRule redirectPatternRule) { + this.rewriteHandler = new RewriteHandler(); + + redirectPatternRule.setPattern(""); + redirectPatternRule.setLocation("/oozie"); + redirectPatternRule.setTerminating(true); + + this.rewriteHandler.addRule(redirectPatternRule); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/java/org/apache/oozie/server/guice/ServicesProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/oozie/server/guice/ServicesProvider.java b/server/src/main/java/org/apache/oozie/server/guice/ServicesProvider.java new file mode 100644 index 0000000..cc4ed17 --- /dev/null +++ b/server/src/main/java/org/apache/oozie/server/guice/ServicesProvider.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server.guice; + +import com.google.inject.Provider; +import org.apache.oozie.service.ServiceException; +import org.apache.oozie.service.Services; + +class ServicesProvider implements Provider<Services> { + @Override + public Services get() { + try { + final Services oozieServices = new Services(); + + oozieServices.init(); + + return oozieServices; + } catch (ServiceException e) { + throw new ExceptionInInitializerError( + String.format("Could not instantiate Oozie services. [e.message=%s]", e.getMessage())); + } + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/resources/checkstyle-header.txt ---------------------------------------------------------------------- diff --git a/server/src/main/resources/checkstyle-header.txt b/server/src/main/resources/checkstyle-header.txt new file mode 100644 index 0000000..4247452 --- /dev/null +++ b/server/src/main/resources/checkstyle-header.txt @@ -0,0 +1,17 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/main/resources/checkstyle.xml ---------------------------------------------------------------------- diff --git a/server/src/main/resources/checkstyle.xml b/server/src/main/resources/checkstyle.xml new file mode 100644 index 0000000..6e8be5d --- /dev/null +++ b/server/src/main/resources/checkstyle.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<module name="Checker"> + + <module name="RegexpSingleline"> + <property name="severity" value="warning"/> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + + <module name="Header"> + <property name="headerFile" value="${checkstyle.header.file}"/> + </module> + + <module name="TreeWalker"> + <module name="LineLength"> + <property name="severity" value="warning"/> + <property name="max" value="132"/> + </module> + </module> + +</module> + http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/test/java/org/apache/oozie/server/TestEmbeddedOozieServer.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/oozie/server/TestEmbeddedOozieServer.java b/server/src/test/java/org/apache/oozie/server/TestEmbeddedOozieServer.java new file mode 100644 index 0000000..0f36e8c --- /dev/null +++ b/server/src/test/java/org/apache/oozie/server/TestEmbeddedOozieServer.java @@ -0,0 +1,119 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + +import org.apache.hadoop.conf.Configuration; +import org.apache.oozie.service.ConfigurationService; +import org.apache.oozie.service.ServiceException; +import org.apache.oozie.service.Services; +import org.eclipse.jetty.rewrite.handler.RewriteHandler; +import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.eclipse.jetty.webapp.WebAppContext; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import java.io.IOException; +import java.net.URISyntaxException; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +/** + * Server tests + */ +@RunWith(MockitoJUnitRunner.class) +public class TestEmbeddedOozieServer { + @Mock private JspHandler mockJspHandler; + @Mock private Services mockServices; + @Mock private SslContextFactory mockSSLContextFactory; + @Mock private SSLServerConnectorFactory mockSSLServerConnectorFactory; + @Mock private Server mockServer; + @Mock private ServerConnector mockServerConnector; + @Mock private ConfigurationService mockConfigService; + @Mock private Configuration mockConfiguration; + @Mock private RewriteHandler mockOozieRewriteHandler; + @Mock private EmbeddedOozieServer embeddedOozieServer; + @Mock private WebAppContext servletContextHandler; + @Mock private ServletMapper oozieServletMapper; + @Mock private FilterMapper oozieFilterMapper; + @Mock private ConstraintSecurityHandler constraintSecurityHandler; + + @Before public void setUp() { + embeddedOozieServer = new EmbeddedOozieServer(mockServer, mockJspHandler, mockServices, mockSSLServerConnectorFactory, + mockOozieRewriteHandler, servletContextHandler, oozieServletMapper, oozieFilterMapper, constraintSecurityHandler); + + doReturn("11000").when(mockConfiguration).get("oozie.http.port"); + doReturn("11443").when(mockConfiguration).get("oozie.https.port"); + doReturn("65536").when(mockConfiguration).get("oozie.http.request.header.size"); + doReturn("65536").when(mockConfiguration).get("oozie.http.response.header.size"); + doReturn("42").when(mockConfiguration).get("oozie.server.threadpool.max.threads"); + doReturn(mockConfiguration).when(mockConfigService).getConf(); + doReturn(mockConfigService).when(mockServices).get(ConfigurationService.class); + } + + @After public void tearDown() { + verify(mockServices).get(ConfigurationService.class); + + verifyNoMoreInteractions( + mockJspHandler, + mockServices, + mockServerConnector, + mockSSLServerConnectorFactory); + } + + @Test + public void testServerSetup() throws Exception { + doReturn("false").when(mockConfiguration).get("oozie.https.enabled"); + embeddedOozieServer.setup(); + verify(mockJspHandler).setupWebAppContext(isA(WebAppContext.class)); + } + + @Test + public void testSecureServerSetup() throws Exception { + doReturn("true").when(mockConfiguration).get("oozie.https.enabled"); + + ServerConnector mockSecuredServerConnector = new ServerConnector(embeddedOozieServer.server); + doReturn(mockSecuredServerConnector) + .when(mockSSLServerConnectorFactory) + .createSecureServerConnector(anyInt(), any(Configuration.class), any(Server.class)); + + embeddedOozieServer.setup(); + + verify(mockJspHandler).setupWebAppContext(isA(WebAppContext.class)); + verify(mockSSLServerConnectorFactory).createSecureServerConnector( + isA(Integer.class), isA(Configuration.class), isA(Server.class)); + } + + @Test(expected=NumberFormatException.class) + public void numberFormatExceptionThrownWithInvalidHttpPort() throws ServiceException, IOException, URISyntaxException { + doReturn("INVALID_PORT").when(mockConfiguration).get("oozie.http.port"); + embeddedOozieServer.setup(); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/test/java/org/apache/oozie/server/TestJspHandler.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/oozie/server/TestJspHandler.java b/server/src/test/java/org/apache/oozie/server/TestJspHandler.java new file mode 100644 index 0000000..741aa5d --- /dev/null +++ b/server/src/test/java/org/apache/oozie/server/TestJspHandler.java @@ -0,0 +1,94 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + +import org.eclipse.jetty.webapp.WebAppContext; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class TestJspHandler { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Mock File mockScratchDir; + @Mock WebAppContext mockWebAppContext; + @Mock WebRootResourceLocator mockWebRootResourceLocator; + + private JspHandler jspHandler; + + @Before + public void setUp() throws Exception { + jspHandler = new JspHandler(mockScratchDir, mockWebRootResourceLocator); + when(mockWebRootResourceLocator.getWebRootResourceUri()).thenReturn(new URI("/webroot")); + } + + @After + public void tearDown() throws Exception { + verify(mockScratchDir).exists(); + } + + @Test + public void scratchDir_Is_Created_When_Setup_Called_And_ScratchDir_Did_Not_Exist() throws IOException, URISyntaxException { + when(mockScratchDir.exists()).thenReturn(false); + when(mockScratchDir.mkdirs()).thenReturn(true); + + jspHandler.setupWebAppContext(mockWebAppContext); + + verify(mockScratchDir).mkdirs(); + } + + @Test + public void scratchDir_Cannot_Be_Created_When_Setup_Called_And_ScratchDir_Did_Not_Exist() + throws IOException, URISyntaxException { + when(mockScratchDir.exists()).thenReturn(false); + when(mockScratchDir.mkdirs()).thenReturn(false); + + expectedException.expect(IOException.class); + jspHandler.setupWebAppContext(mockWebAppContext); + + verify(mockScratchDir).mkdirs(); + } + + @Test + public void scratchDir_Is_Reused_When_Setup_Called_And_ScratchDir_Existed() throws IOException, URISyntaxException { + when(mockScratchDir.exists()).thenReturn(true); + + jspHandler.setupWebAppContext(mockWebAppContext); + + verify(mockScratchDir, times(0)).mkdirs(); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/server/src/test/java/org/apache/oozie/server/TestSSLServerConnectorFactory.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/oozie/server/TestSSLServerConnectorFactory.java b/server/src/test/java/org/apache/oozie/server/TestSSLServerConnectorFactory.java new file mode 100644 index 0000000..9634da8 --- /dev/null +++ b/server/src/test/java/org/apache/oozie/server/TestSSLServerConnectorFactory.java @@ -0,0 +1,137 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.oozie.server; + +import org.apache.hadoop.conf.Configuration; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +/** + * Server tests + */ +@RunWith(MockitoJUnitRunner.class) +public class TestSSLServerConnectorFactory { + @Mock private SslContextFactory mockSSLContextFactory; + @Mock private SSLServerConnectorFactory mockSSLServerConnectorFactory; + @Mock private Server mockServer; + @Mock private ServerConnector mockServerConnector; + + private Configuration testConfig; + private SSLServerConnectorFactory sslServerConnectorFactory; + + @Before public void setUp() { + testConfig = new Configuration(); + testConfig.set("oozie.https.truststore.file", "test_truststore_file"); + testConfig.set("oozie.https.truststore.pass", "trustpass"); + testConfig.set("oozie.https.keystore.file", "test_keystore_file"); + testConfig.set("oozie.https.keystore.pass", "keypass"); + testConfig.set("oozie.http.port", "11000"); + testConfig.set("oozie.http.request.header.size", "65536"); + testConfig.set("oozie.http.response.header.size", "65536"); + testConfig.set("oozie.https.include.protocols", "TLSv1,SSLv2Hello,TLSv1.1,TLSv1.2"); + testConfig.set("oozie.https.exclude.cipher.suites", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA,SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA," + + "SSL_DHE_RSA_WITH_DES_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5,SSL_RSA_EXPORT_WITH_DES40_CBC_SHA," + + "SSL_RSA_WITH_RC4_128_MD5"); + + sslServerConnectorFactory = new SSLServerConnectorFactory(mockSSLContextFactory); + } + + @After + public void tearDown() { + verify(mockSSLContextFactory).setTrustStorePath(anyString()); + verify(mockSSLContextFactory).setTrustStorePassword(anyString()); + verify(mockSSLContextFactory).setKeyStorePath(anyString()); + verify(mockSSLContextFactory).setKeyManagerPassword(anyString()); + verifyNoMoreInteractions( + mockServerConnector, + mockSSLServerConnectorFactory); + } + + private void verifyDefaultExcludeCipherSuites() { + verify(mockSSLContextFactory).setExcludeCipherSuites( + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_RSA_WITH_RC4_128_MD5"); + } + + private void verifyDefaultIncludeProtocols() { + verify(mockSSLContextFactory).setIncludeProtocols( + "TLSv1", + "SSLv2Hello", + "TLSv1.1", + "TLSv1.2"); + } + + @Test + public void includeProtocolsHaveDefaultValues() throws Exception { + sslServerConnectorFactory.createSecureServerConnector(42, testConfig, mockServer); + + verifyDefaultIncludeProtocols(); + verifyDefaultExcludeCipherSuites(); + } + + @Test + public void includeProtocolsCanBeSetViaConfigFile() throws Exception { + SSLServerConnectorFactory sslServerConnectorFactory = new SSLServerConnectorFactory(mockSSLContextFactory); + testConfig.set("oozie.https.include.protocols", "TLSv1,TLSv1.2"); + sslServerConnectorFactory.createSecureServerConnector(42, testConfig, mockServer); + + verify(mockSSLContextFactory).setIncludeProtocols( + "TLSv1", + "TLSv1.2"); + } + + @Test + public void excludeCipherSuitesHaveDefaultValues() throws Exception { + sslServerConnectorFactory.createSecureServerConnector(42, testConfig, mockServer); + + verifyDefaultExcludeCipherSuites(); + verifyDefaultIncludeProtocols(); + } + + @Test + public void excludeCipherSuitesCanBeSetViaConfigFile() throws Exception { + testConfig.set("oozie.https.exclude.cipher.suites","TLS_ECDHE_RSA_WITH_RC4_128_SHA,SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA," + + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA"); + + sslServerConnectorFactory.createSecureServerConnector(42, testConfig, mockServer); + + verify(mockSSLContextFactory).setExcludeCipherSuites( + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA"); + verifyDefaultIncludeProtocols(); + } +} http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/src/main/assemblies/distro-jetty.xml ---------------------------------------------------------------------- diff --git a/src/main/assemblies/distro-jetty.xml b/src/main/assemblies/distro-jetty.xml new file mode 100644 index 0000000..a4bee03 --- /dev/null +++ b/src/main/assemblies/distro-jetty.xml @@ -0,0 +1,155 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<assembly> + <id>distro</id> + <formats> + <format>dir</format> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>oozie-${project.version}</baseDirectory> + <fileSets> + <!-- Oozie configuration files --> + <fileSet> + <directory>${basedir}/../core/src/main/conf/</directory> + <outputDirectory>/conf</outputDirectory> + <includes> + <include>**</include> + </includes> + </fileSet> + <!-- Distro files, readme, licenses, etc --> + <fileSet> + <directory>${basedir}/../</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>license.txt</include> + <include>notice.txt</include> + <include>readme.txt</include> + <include>release-log.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/src/main/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <!-- Client --> + <fileSet> + <directory>${basedir}/../client/target/oozie-client-${project.version}-client/oozie-client-${project.version}/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <!-- Tools --> + <fileSet> + <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/libtools</directory> + <outputDirectory>/libtools</outputDirectory> + <includes> + <include>*</include> + </includes> + </fileSet> + <!-- Oozie Login Server Example war and jar --> + <fileSet> + <directory>${basedir}/../login/target</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>oozie-login.war</include> + <include>oozie-login.jar</include> + </includes> + <fileMode>0555</fileMode> + </fileSet> + <!-- Oozie Server - embedded jetty --> + <fileSet> + <directory>${basedir}/../server/target/</directory> + <outputDirectory>/embedded-oozie-server</outputDirectory> + <includes> + <include>oozie-server*.jar</include> + <include>**/jetty*.jar</include> + <include>**/*jsp*.jar</include> + <include>**/mail*.jar</include> + <include>**/apache*.jar</include> + <include>**/commons-el*.jar</include> + <include>**/javax.servlet-api-3.1.0.jar</include> + <include>**/jasper*jar</include> + <include>**/taglibs-*jar</include> + <include>**/org.eclipse.jdt.core-*jar</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/../webapp/target/oozie-webapp-${project.version}</directory> + <outputDirectory>/embedded-oozie-server/webapp</outputDirectory> + <excludes> + <exclude>**/web.xml</exclude> + </excludes> + </fileSet> + </fileSets> + <files> + <!-- Oozie configuration files --> + <file> + <source>${basedir}/../core/src/main/resources/oozie-default.xml</source> + <outputDirectory>/conf</outputDirectory> + </file> + <!-- Oozie core jar --> + <file> + <source>${basedir}/../core/target/oozie-core-${project.version}.jar</source> + <outputDirectory>/oozie-core</outputDirectory> + </file> + <!-- Oozie core test jar --> + <file> + <source>${basedir}/../core/target/oozie-core-${project.version}-tests.jar</source> + <outputDirectory>/oozie-core</outputDirectory> + </file> + <!-- Oozie Documentation --> + <file> + <source>${basedir}/../docs/target/oozie-docs-${project.version}-docs.zip</source> + <outputDirectory>/</outputDirectory> + <destName>docs.zip</destName> + </file> + <!-- Oozie Client TAR.GZ --> + <file> + <source>${basedir}/../client/target/oozie-client-${project.version}-client.tar.gz</source> + <outputDirectory>/</outputDirectory> + <destName>oozie-client-${project.version}.tar.gz</destName> + </file> + <!-- Oozie examples TAR.GZ --> + <file> + <source>${basedir}/../examples/target/oozie-examples-${project.version}-examples.tar.gz</source> + <outputDirectory>/</outputDirectory> + <destName>oozie-examples.tar.gz</destName> + </file> + <!-- Oozie sharelib TAR.GZ --> + <file> + <source>${basedir}/../sharelib/target/oozie-sharelib-${project.version}.tar.gz</source> + <outputDirectory>/</outputDirectory> + <fileMode>0444</fileMode> + </file> + </files> +</assembly> http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/src/main/assemblies/distro-tomcat.xml ---------------------------------------------------------------------- diff --git a/src/main/assemblies/distro-tomcat.xml b/src/main/assemblies/distro-tomcat.xml new file mode 100644 index 0000000..d7018a3 --- /dev/null +++ b/src/main/assemblies/distro-tomcat.xml @@ -0,0 +1,153 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<assembly> + <id>distro</id> + <formats> + <format>dir</format> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>oozie-${project.version}</baseDirectory> + <fileSets> + <!-- Oozie configuration files --> + <fileSet> + <directory>${basedir}/../core/src/main/conf/</directory> + <outputDirectory>/conf</outputDirectory> + <includes> + <include>**</include> + </includes> + </fileSet> + <!-- Distro files, readme, licenses, etc --> + <fileSet> + <directory>${basedir}/../</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>license.txt</include> + <include>notice.txt</include> + <include>readme.txt</include> + <include>release-log.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/src/main/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <!-- Client --> + <fileSet> + <directory>${basedir}/../client/target/oozie-client-${project.version}-client/oozie-client-${project.version}/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <!-- Tools --> + <fileSet> + <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/bin</directory> + <outputDirectory>/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/libtools</directory> + <outputDirectory>/libtools</outputDirectory> + <includes> + <include>*</include> + </includes> + </fileSet> + <!-- Embedded Tomcat --> + <fileSet> + <directory>${basedir}/target/tomcat/oozie-server</directory> + <outputDirectory>/oozie-server</outputDirectory> + <excludes> + <exclude>bin/*.sh</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>${basedir}/target/tomcat/oozie-server/bin</directory> + <outputDirectory>/oozie-server/bin</outputDirectory> + <includes> + <include>*.sh</include> + </includes> + <fileMode>0555</fileMode> + </fileSet> + <!-- Oozie Login Server Example war and jar --> + <fileSet> + <directory>${basedir}/../login/target</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>oozie-login.war</include> + <include>oozie-login.jar</include> + </includes> + <fileMode>0555</fileMode> + </fileSet> + </fileSets> + <files> + <!-- Oozie configuration files --> + <file> + <source>${basedir}/../core/src/main/resources/oozie-default.xml</source> + <outputDirectory>/conf</outputDirectory> + </file> + <!-- Oozie core jar --> + <file> + <source>${basedir}/../core/target/oozie-core-${project.version}.jar</source> + <outputDirectory>/oozie-core</outputDirectory> + </file> + <!-- Oozie core test jar --> + <file> + <source>${basedir}/../core/target/oozie-core-${project.version}-tests.jar</source> + <outputDirectory>/oozie-core</outputDirectory> + </file> + <!-- Oozie war --> + <file> + <source>${basedir}/../webapp/target/oozie-webapp-${project.version}.war</source> + <outputDirectory>/</outputDirectory> + <destName>oozie.war</destName> + </file> + <!-- Oozie Documentation --> + <file> + <source>${basedir}/../docs/target/oozie-docs-${project.version}-docs.zip</source> + <outputDirectory>/</outputDirectory> + <destName>docs.zip</destName> + </file> + <!-- Oozie Client TAR.GZ --> + <file> + <source>${basedir}/../client/target/oozie-client-${project.version}-client.tar.gz</source> + <outputDirectory>/</outputDirectory> + <destName>oozie-client-${project.version}.tar.gz</destName> + </file> + <!-- Oozie examples TAR.GZ --> + <file> + <source>${basedir}/../examples/target/oozie-examples-${project.version}-examples.tar.gz</source> + <outputDirectory>/</outputDirectory> + <destName>oozie-examples.tar.gz</destName> + </file> + <!-- Oozie sharelib TAR.GZ --> + <file> + <source>${basedir}/../sharelib/target/oozie-sharelib-${project.version}.tar.gz</source> + <outputDirectory>/</outputDirectory> + <fileMode>0444</fileMode> + </file> + </files> +</assembly> http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/src/main/assemblies/distro.xml ---------------------------------------------------------------------- diff --git a/src/main/assemblies/distro.xml b/src/main/assemblies/distro.xml deleted file mode 100644 index 1ffbfd6..0000000 --- a/src/main/assemblies/distro.xml +++ /dev/null @@ -1,155 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<assembly> - <id>distro</id> - <formats> - <format>dir</format> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <baseDirectory>oozie-${project.version}</baseDirectory> - <fileSets> - <!-- Oozie configuration files --> - <fileSet> - <directory>${basedir}/../core/src/main/conf/</directory> - <outputDirectory>/conf</outputDirectory> - <includes> - <include>**</include> - </includes> - </fileSet> - <!-- Distro files, readme, licenses, etc --> - <fileSet> - <directory>${basedir}/../</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>license.txt</include> - <include>notice.txt</include> - <include>readme.txt</include> - <include>release-log.txt</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/bin</directory> - <outputDirectory>/bin</outputDirectory> - <includes> - <include>*</include> - </includes> - <fileMode>0755</fileMode> - </fileSet> - <!-- Client --> - <fileSet> - <directory>${basedir}/../client/target/oozie-client-${project.version}-client/oozie-client-${project.version}/bin</directory> - <outputDirectory>/bin</outputDirectory> - <includes> - <include>*</include> - </includes> - <fileMode>0755</fileMode> - </fileSet> - <!-- Tools --> - <fileSet> - <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/bin</directory> - <outputDirectory>/bin</outputDirectory> - <includes> - <include>*</include> - </includes> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/../tools/target/oozie-tools-${project.version}-tools/oozie-tools-${project.version}/libtools</directory> - <outputDirectory>/libtools</outputDirectory> - <includes> - <include>*</include> - </includes> - </fileSet> - <!-- Embedded Tomcat --> - <fileSet> - <directory>${basedir}/target/tomcat/oozie-server</directory> - <outputDirectory>/oozie-server</outputDirectory> - <excludes> - <exclude>bin/*.sh</exclude> - </excludes> - </fileSet> - <fileSet> - <directory>${basedir}/target/tomcat/oozie-server/bin</directory> - <outputDirectory>/oozie-server/bin</outputDirectory> - <includes> - <include>*.sh</include> - </includes> - <fileMode>0555</fileMode> - </fileSet> - <!-- Oozie Login Server Example war and jar --> - <fileSet> - <directory>${basedir}/../login/target</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>oozie-login.war</include> - <include>oozie-login.jar</include> - </includes> - <fileMode>0555</fileMode> - </fileSet> - - </fileSets> - <files> - <!-- Oozie configuration files --> - <file> - <source>${basedir}/../core/src/main/resources/oozie-default.xml</source> - <outputDirectory>/conf</outputDirectory> - <destName>oozie-default.xml.reference</destName> - </file> - <!-- Oozie core jar --> - <file> - <source>${basedir}/../core/target/oozie-core-${project.version}.jar</source> - <outputDirectory>/oozie-core</outputDirectory> - </file> - <!-- Oozie core test jar --> - <file> - <source>${basedir}/../core/target/oozie-core-${project.version}-tests.jar</source> - <outputDirectory>/oozie-core</outputDirectory> - </file> - <!-- Oozie war --> - <file> - <source>${basedir}/../webapp/target/oozie-webapp-${project.version}.war</source> - <outputDirectory>/</outputDirectory> - <destName>oozie.war</destName> - </file> - <!-- Oozie Documentation --> - <file> - <source>${basedir}/../docs/target/oozie-docs-${project.version}-docs.zip</source> - <outputDirectory>/</outputDirectory> - <destName>docs.zip</destName> - </file> - <!-- Oozie Client TAR.GZ --> - <file> - <source>${basedir}/../client/target/oozie-client-${project.version}-client.tar.gz</source> - <outputDirectory>/</outputDirectory> - <destName>oozie-client-${project.version}.tar.gz</destName> - </file> - <!-- Oozie examples TAR.GZ --> - <file> - <source>${basedir}/../examples/target/oozie-examples-${project.version}-examples.tar.gz</source> - <outputDirectory>/</outputDirectory> - <destName>oozie-examples.tar.gz</destName> - </file> - <!-- Oozie sharelib TAR.GZ --> - <file> - <source>${basedir}/../sharelib/target/oozie-sharelib-${project.version}.tar.gz</source> - <outputDirectory>/</outputDirectory> - <fileMode>0444</fileMode> - </file> - </files> -</assembly> http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/webapp/src/main/webapp/403.html ---------------------------------------------------------------------- diff --git a/webapp/src/main/webapp/403.html b/webapp/src/main/webapp/403.html new file mode 100644 index 0000000..f3183d9 --- /dev/null +++ b/webapp/src/main/webapp/403.html @@ -0,0 +1,31 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Error 403 Not Found</title> +</head> +<body> + <h2>HTTP ERROR 403</h2> + <p>Problem accessing page. Reason:</p> + <pre> Forbidden</pre> + <p></p> +</body> +</html> http://git-wip-us.apache.org/repos/asf/oozie/blob/ca01c283/webapp/src/main/webapp/404.html ---------------------------------------------------------------------- diff --git a/webapp/src/main/webapp/404.html b/webapp/src/main/webapp/404.html new file mode 100644 index 0000000..a953df2 --- /dev/null +++ b/webapp/src/main/webapp/404.html @@ -0,0 +1,31 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Error 404 Not Found</title> +</head> +<body> + <h2>HTTP ERROR 404</h2> + <p>Problem accessing page Reason:</p> + <pre> Not Found</pre> + <p></p> +</body> +</html>
