KNOX-483 added oozie service xml

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/c8484c99
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/c8484c99
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/c8484c99

Branch: refs/heads/KNOX-481
Commit: c8484c99cce2c26343a4cd523aaff752d4b27797
Parents: d378cdd
Author: Sumit Gupta <su...@apache.org>
Authored: Tue Jan 6 16:18:15 2015 -0500
Committer: Sumit Gupta <su...@apache.org>
Committed: Wed Feb 11 13:19:42 2015 -0500

----------------------------------------------------------------------
 .../ServiceDefinitionDeploymentContributor.java |   1 -
 .../resources/services/oozie/4.0.0/rewrite.xml  | 122 +++++++++++++++++++
 .../resources/services/oozie/4.0.0/service.xml  |  30 +++++
 .../oozie/OozieDeploymentContributor.java       |  19 ++-
 4 files changed, 165 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/c8484c99/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
----------------------------------------------------------------------
diff --git 
a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
 
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
index dd2a4c9..4cff585 100644
--- 
a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
+++ 
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
@@ -56,7 +56,6 @@ public class ServiceDefinitionDeploymentContributor extends 
ServiceDeploymentCon
 
     @Override
     public void contributeService(DeploymentContext context, Service service) 
throws Exception {
-        System.out.println("contributing service def");
         contributeRewriteRules(context, service);
         contributeResources(context, service);
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/c8484c99/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/rewrite.xml
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/rewrite.xml
 
b/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/rewrite.xml
new file mode 100644
index 0000000..d3c52bb
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/rewrite.xml
@@ -0,0 +1,122 @@
+<!--
+   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.
+-->
+<rules>
+
+    <rule dir="IN" name="OOZIE/oozie/root" 
pattern="*://*:*/**/oozie/{**}?{**}">
+        <rewrite template="{$serviceUrl[OOZIE]}/{**}?{**}"/>
+    </rule>
+
+    <rule dir="IN" name="OOZIE/oozie/v1" 
pattern="*://*:*/**/oozie/v1/{**}?{**}">
+        <rewrite template="{$serviceUrl[OOZIE]}/v1/{**}?{**}"/>
+    </rule>
+
+    <rule dir="IN" name="OOZIE/oozie/v2" 
pattern="*://*:*/**/oozie/v2/{**}?{**}">
+        <rewrite template="{$serviceUrl[OOZIE]}/v2/{**}?{**}"/>
+    </rule>
+
+    <rule name="OOZIE/oozie/user-name">
+        <rewrite template="{$username}"/>
+    </rule>
+
+    <rule name="OOZIE/oozie/name-node-url">
+        <rewrite template="hdfs://{$serviceMappedAddr[NAMENODE]}"/>
+    </rule>
+
+    <rule name="OOZIE/oozie/job-tracker-address">
+        <rewrite template="{$serviceMappedAddr[JOBTRACKER]}"/>
+    </rule>
+
+    <rule name="OOZIE/oozie/hdfs-path" flow="OR">
+        <match pattern="/~">
+            <rewrite 
template="hdfs://{$serviceMappedHost[NAMENODE]}:{$servicePort[NAMENODE]}/user/{$username}"/>
+        </match>
+        <match pattern="/~/{path=**}">
+            <rewrite 
template="hdfs://{$serviceMappedHost[NAMENODE]}:{$servicePort[NAMENODE]}/user/{$username}/{path=**}"/>
+        </match>
+        <match pattern="{path=**}">
+            <rewrite 
template="hdfs://{$serviceMappedHost[NAMENODE]}:{$servicePort[NAMENODE]}/{path=**}"/>
+        </match>
+    </rule>
+
+    <filter name="OOZIE/oozie/configuration">
+        <content type="*/xml">
+            <buffer path="/configuration/property">
+                <detect path="name" value="user.name">
+                    <apply path="value" rule="OOZIE/oozie/user-name"/>
+                </detect>
+                <detect path="name" value="nameNode">
+                    <apply path="value" rule="OOZIE/oozie/name-node-url"/>
+                </detect>
+                <detect path="name" value="jobTracker">
+                    <apply path="value" 
rule="OOZIE/oozie/job-tracker-address"/>
+                </detect>
+                <detect path="name" value="fs.default.name">
+                    <apply path="value" rule="OOZIE/oozie/name-node-url"/>
+                </detect>
+                <detect path="name" value="fs.defaultFS">
+                    <apply path="value" rule="OOZIE/oozie/name-node-url"/>
+                </detect>
+                <detect path="name" value="oozie.wf.application.path">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="oozie.coord.application.path">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="oozie.bundle.application.path">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="oozie.libpath">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="mapreduce.job.user.name">
+                    <apply path="value" rule="OOZIE/oozie/user-name"/>
+                </detect>
+                <detect path="name" value="mapred.job.tracker">
+                    <apply path="value" 
rule="OOZIE/oozie/job-tracker-address"/>
+                </detect>
+                <detect path="name" value="mapred.input.dir">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="inputDir">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="mapred.output.dir">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+                <detect path="name" value="outputDir">
+                    <apply path="value" rule="OOZIE/oozie/hdfs-path"/>
+                </detect>
+            </buffer>
+        </content>
+        <content type="*/json">
+            <apply path="$[user.name]" rule="OOZIE/oozie/user-name"/>
+            <apply path="$[nameNode]" rule="OOZIE/oozie/name-node-url"/>
+            <apply path="$[jobTracker]" rule="OOZIE/oozie/job-tracker-addr"/>
+            <apply path="$[fs.default.name]" rule="OOZIE/oozie/name-node-url"/>
+            <apply path="$[fs.defaultFS]" rule="OOZIE/oozie/name-node-url"/>
+            <apply path="$[oozie.wf.application.path]" 
rule="OOZIE/oozie/hdfs-path"/>
+            <apply path="$[oozie.coord.application.path]" 
rule="OOZIE/oozie/hdfs-path"/>
+            <apply path="$[oozie.bundle.application.path]" 
rule="OOZIE/oozie/hdfs-path"/>
+            <apply path="$[oozie.libpath]" rule="OOZIE/oozie/hdfs-path"/>
+            <apply path="$[mapreduce.job.user.name]" 
rule="OOZIE/oozie/user-name"/>
+            <apply path="$[mapred.job.tracker]" 
rule="OOZIE/oozie/job-tracker-address"/>
+            <apply path="$[mapred.input.dir]" rule="OOZIE/oozie/hdfs-path"/>
+            <apply path="$[mapred.output.dir]" rule="OOZIE/oozie/hdfs-path"/>
+        </content>
+    </filter>
+
+</rules>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/c8484c99/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/service.xml
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/service.xml
 
b/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/service.xml
new file mode 100644
index 0000000..b9c974e
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/oozie/4.0.0/service.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   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.
+-->
+<service role="OOZIE" name="oozie" version="4.0.0">
+    <urls>
+        <url pattern="/oozie/**?**">
+            <rewrite-filter ref="OOZIE/oozie/configuration" 
apply-to="request.body"/>
+        </url>
+        <url pattern="/oozie/v1/**?**">
+            <rewrite-filter ref="OOZIE/oozie/configuration" 
apply-to="request.body"/>
+        </url>
+        <url pattern="/oozie/v2/**?**">
+            <rewrite-filter ref="OOZIE/oozie/configuration" 
apply-to="request.body"/>
+        </url>
+    </urls>
+</service>

http://git-wip-us.apache.org/repos/asf/knox/blob/c8484c99/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
----------------------------------------------------------------------
diff --git 
a/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
 
b/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
index 0e9ffae..4074209 100644
--- 
a/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
+++ 
b/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
@@ -41,22 +41,23 @@ public class OozieDeploymentContributor extends 
ServiceDeploymentContributorBase
   private static final String REPLAY_BUFFER_SIZE_PARAM = "replayBufferSize";
   
   // Oozie replay buffer size in KB
-  private static final String DEFAULT_REPLAY_BUFFER_SIZE = "8";
+  private static final String OOZIW_REPLAY_BUFFER_SIZE = "8";
 
   @Override
   public String getRole() {
-    return "OOZIE";
+    return "xOOZIE";
   }
 
   @Override
   public String getName() {
-    return "oozie";
+    return "xoozie";
   }
 
   @Override
   public void contributeService( DeploymentContext context, Service service ) 
throws Exception {
-    contributeRewriteRules( context, service );
-    contributeResources( context, service );
+    //TODO: [sumit] remove once stacks is done KNOX-483
+//    contributeRewriteRules( context, service );
+//    contributeResources( context, service );
   }
 
   private void contributeRewriteRules( DeploymentContext context, Service 
service ) throws URISyntaxException, IOException {
@@ -106,7 +107,13 @@ public class OozieDeploymentContributor extends 
ServiceDeploymentContributorBase
 
   private void addDispatchFilter(DeploymentContext context, Service service,
       ResourceDescriptor resource) {
-    context.contributeFilter(service, resource, "dispatch", "http-client", 
null );
+    //TODO: [sumit] set the filter params for dispatch in stacks
+    List<FilterParamDescriptor> filterParams = new 
ArrayList<FilterParamDescriptor>();
+    FilterParamDescriptor filterParamDescriptor = resource.createFilterParam();
+    filterParamDescriptor.name(REPLAY_BUFFER_SIZE_PARAM);
+    filterParamDescriptor.value(OOZIW_REPLAY_BUFFER_SIZE);
+    filterParams.add(filterParamDescriptor);
+    context.contributeFilter(service, resource, "dispatch", "http-client", 
filterParams);
   }
 
   UrlRewriteRulesDescriptor loadRulesFromTemplate() throws IOException {

Reply via email to