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/35e0c711 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/35e0c711 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/35e0c711 Branch: refs/heads/KNOX-481 Commit: 35e0c7113dd80228c4b905c5423607c29c777d0a Parents: bfb3abd Author: Sumit Gupta <su...@apache.org> Authored: Tue Jan 6 12:07:29 2015 -0500 Committer: Sumit Gupta <su...@apache.org> Committed: Wed Feb 11 13:43:53 2015 -0500 ---------------------------------------------------------------------- .../gateway/config/impl/GatewayConfigImpl.java | 5 ++ .../gateway/deploy/DeploymentFactory.java | 10 +++- .../service/definition/PolicyBinding.java | 21 +++++++++ .../service/definition/RewriteFilter.java | 47 +++++++++++++++++++ .../gateway/service/definition/UrlBinding.java | 49 ++++++++++++++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/35e0c711/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 97853b3..4241856 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 @@ -169,6 +169,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/35e0c711/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java ---------------------------------------------------------------------- diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java index 16d188a..54e58f2 100644 --- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java +++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java @@ -43,7 +43,15 @@ import java.beans.Statement; import java.io.File; import java.io.IOException; import java.io.StringWriter; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.Set; +import java.util.LinkedHashMap; public abstract class DeploymentFactory { http://git-wip-us.apache.org/repos/asf/knox/blob/35e0c711/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/35e0c711/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/35e0c711/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; + } +}