KNOX-483 initial commit for loading service definitions

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

Branch: refs/heads/KNOX-481
Commit: 56eaf1431542f1713e05720daf3cf3aade405595
Parents: 751785b
Author: Sumit Gupta <su...@apache.org>
Authored: Tue Jan 6 12:07:29 2015 -0500
Committer: Sumit Gupta <su...@apache.org>
Committed: Thu Feb 12 17:16:07 2015 -0500

----------------------------------------------------------------------
 .../gateway/config/impl/GatewayConfigImpl.java  |  5 ++
 .../service/definition/PolicyBinding.java       | 21 +++++++++
 .../service/definition/RewriteFilter.java       | 47 +++++++++++++++++++
 .../gateway/service/definition/UrlBinding.java  | 49 ++++++++++++++++++++
 4 files changed, 122 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/56eaf143/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
----------------------------------------------------------------------
diff --git 
a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
 
b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
index b250623..66557a9 100644
--- 
a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
+++ 
b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
@@ -184,6 +184,11 @@ public class GatewayConfigImpl extends Configuration 
implements GatewayConfig {
   }
 
   @Override
+  public String getGatewayStacksDir() {
+    return getVar( GATEWAY_DATA_HOME_VAR, getGatewayHomeDir() + File.separator 
+ "stacks" );
+  }
+
+  @Override
   public String getHadoopConfDir() {
     return get( HADOOP_CONF_DIR );
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/56eaf143/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/PolicyBinding.java
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/PolicyBinding.java
 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/PolicyBinding.java
new file mode 100644
index 0000000..ad6b0a6
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/PolicyBinding.java
@@ -0,0 +1,21 @@
+/**
+ * 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.hadoop.gateway.service.definition;
+
+public class PolicyBinding {
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/56eaf143/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/RewriteFilter.java
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/RewriteFilter.java
 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/RewriteFilter.java
new file mode 100644
index 0000000..4b0dccc
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/RewriteFilter.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.hadoop.gateway.service.definition;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "rewrite-filter")
+public class RewriteFilter {
+
+  private String ref;
+
+  private String applyTo;
+
+  @XmlAttribute
+  public String getRef() {
+    return ref;
+  }
+
+  public void setRef(String ref) {
+    this.ref = ref;
+  }
+
+  @XmlAttribute(name = "apply-to")
+  public String getApplyTo() {
+    return applyTo;
+  }
+
+  public void setApplyTo(String applyTo) {
+    this.applyTo = applyTo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/56eaf143/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/UrlBinding.java
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/UrlBinding.java
 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/UrlBinding.java
new file mode 100644
index 0000000..3630ebf
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/java/org/apache/hadoop/gateway/service/definition/UrlBinding.java
@@ -0,0 +1,49 @@
+/**
+ * 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.hadoop.gateway.service.definition;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import java.util.List;
+
+@XmlType(name = "url")
+public class UrlBinding {
+
+  private String pattern;
+
+  private List<RewriteFilter> rewriteFilters;
+
+  @XmlAttribute
+  public String getPattern() {
+    return pattern;
+  }
+
+  public void setPattern(String pattern) {
+    this.pattern = pattern;
+  }
+
+  @XmlElement(name = "rewrite-filter")
+  public List<RewriteFilter> getRewriteFilters() {
+    return rewriteFilters;
+  }
+
+  public void setRewriteFilters(List<RewriteFilter> rewriteFilters) {
+    this.rewriteFilters = rewriteFilters;
+  }
+}

Reply via email to