knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject git commit: KNOX-82: Support properties file format for topology files. Completes support by allowing .conf files in deployments directory.
Date Thu, 11 Jul 2013 15:18:59 GMT
Updated Branches:
  refs/heads/master 874d6fedf -> 80c829f6b


KNOX-82: Support properties file format for topology files.
Completes support by allowing .conf files in deployments directory.


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

Branch: refs/heads/master
Commit: 80c829f6b96d9db60529f49a6cb873e79b9a1b8a
Parents: 874d6fe
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Thu Jul 11 11:18:55 2013 -0400
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Thu Jul 11 11:18:55 2013 -0400

----------------------------------------------------------------------
 gateway-release/home/deployments/sample2.conf   | 75 ++++++++++++++++++++
 .../topology/file/FileTopologyProvider.java     |  7 +-
 .../topology/xml/TopologyRulesModuleTest.java   |  2 +-
 .../xml/simple-topology-ambari-format.conf      | 75 ++++++++++++++++++++
 .../xml/simple-topology-ambari-format.xml       | 75 --------------------
 5 files changed, 157 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/80c829f6/gateway-release/home/deployments/sample2.conf
----------------------------------------------------------------------
diff --git a/gateway-release/home/deployments/sample2.conf b/gateway-release/home/deployments/sample2.conf
new file mode 100644
index 0000000..a112b80
--- /dev/null
+++ b/gateway-release/home/deployments/sample2.conf
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
+<configuration>
+    <property>
+        <name>topology.name</name>
+        <value>topology2</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.enabled</name>
+        <value>true</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm</name>
+        <value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.userDnTemplate</name>
+        <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.url</name>
+        <value>ldap://localhost:33389</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.authenticationMechanism</name>
+        <value>simple</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.urls./**</name>
+        <value>authcBasic</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.enabled</name>
+        <value>false</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.param.name</name>
+        <value>user.name</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.param.principal.mapping</name>
+        <value>hdfs=lmccay;kminder=admin</value>
+    </property>
+    <property>
+        <name>topology.service.NAMENODE..url</name>
+        <value>http://host:50070/webhdfs/v1</value>
+    </property>
+    <property>
+        <name>topology.service.TEMPLETON..url</name>
+        <value>http://host:50111/templeton/v1</value>
+    </property>
+    <property>
+        <name>topology.service.OOZIE..url</name>
+        <value>http://host:11000/oozie</value>
+    </property>
+    <property>
+        <name>topology.service.HIVE..url</name>
+        <value>http://host:10000</value>
+    </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/80c829f6/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/file/FileTopologyProvider.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/file/FileTopologyProvider.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/file/FileTopologyProvider.java
index e199c51..15bb75e 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/file/FileTopologyProvider.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/file/FileTopologyProvider.java
@@ -59,6 +59,11 @@ public class FileTopologyProvider implements TopologyProvider, TopologyMonitor,
 
   private static GatewayMessages log = MessagesFactory.get( GatewayMessages.class );
   private static DigesterLoader digesterLoader = newLoader( new KnoxFormatXmlTopologyRules(),
new AmbariFormatXmlTopologyRules() );
+  private static final List<String> SUPPORTED_TOPOLOGY_FILE_EXTENSIONS = new ArrayList<String>();
+  static {
+      SUPPORTED_TOPOLOGY_FILE_EXTENSIONS.add("xml");
+      SUPPORTED_TOPOLOGY_FILE_EXTENSIONS.add("conf");
+  }
 
   private DefaultFileMonitor monitor;
   private FileObject directory;
@@ -94,7 +99,7 @@ public class FileTopologyProvider implements TopologyProvider, TopologyMonitor,
     Map<FileName, Topology> map = new HashMap<FileName, Topology>();
     if( directory.exists() && directory.getType().hasChildren() ) {
       for( FileObject file : directory.getChildren() ) {
-        if( file.exists() && !file.getType().hasChildren() && "xml".equals(
file.getName().getExtension() ) ) {
+        if( file.exists() && !file.getType().hasChildren() && SUPPORTED_TOPOLOGY_FILE_EXTENSIONS.contains(
file.getName().getExtension() )) {
           try {
             map.put( file.getName(), loadTopology( file ) );
           } catch( IOException e ) {

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/80c829f6/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/xml/TopologyRulesModuleTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/xml/TopologyRulesModuleTest.java
b/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/xml/TopologyRulesModuleTest.java
index fd04b61..162166c 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/xml/TopologyRulesModuleTest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/xml/TopologyRulesModuleTest.java
@@ -82,7 +82,7 @@ public class TopologyRulesModuleTest {
   @Test
   public void testParseSimpleTopologyXmlInHadoopFormat() throws IOException, SAXException
{
     Digester digester = loader.newDigester();
-    String name = "org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.xml";
+    String name = "org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.conf";
     URL url = ClassLoader.getSystemResource( name );
     assertThat( "Failed to find URL for resource " + name, url, notNullValue() );
     File file = new File( url.getFile() );

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/80c829f6/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.conf
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.conf
b/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.conf
new file mode 100644
index 0000000..a112b80
--- /dev/null
+++ b/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.conf
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
+<configuration>
+    <property>
+        <name>topology.name</name>
+        <value>topology2</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.enabled</name>
+        <value>true</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm</name>
+        <value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.userDnTemplate</name>
+        <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.url</name>
+        <value>ldap://localhost:33389</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.authenticationMechanism</name>
+        <value>simple</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.authentication.ShiroProvider.param.urls./**</name>
+        <value>authcBasic</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.enabled</name>
+        <value>false</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.param.name</name>
+        <value>user.name</value>
+    </property>
+    <property>
+        <name>topology.gateway.provider.identity-assertion.Pseudo.param.principal.mapping</name>
+        <value>hdfs=lmccay;kminder=admin</value>
+    </property>
+    <property>
+        <name>topology.service.NAMENODE..url</name>
+        <value>http://host:50070/webhdfs/v1</value>
+    </property>
+    <property>
+        <name>topology.service.TEMPLETON..url</name>
+        <value>http://host:50111/templeton/v1</value>
+    </property>
+    <property>
+        <name>topology.service.OOZIE..url</name>
+        <value>http://host:11000/oozie</value>
+    </property>
+    <property>
+        <name>topology.service.HIVE..url</name>
+        <value>http://host:10000</value>
+    </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/80c829f6/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.xml
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.xml
b/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.xml
deleted file mode 100644
index a112b80..0000000
--- a/gateway-server/src/test/resources/org/apache/hadoop/gateway/topology/xml/simple-topology-ambari-format.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
--->
-<configuration>
-    <property>
-        <name>topology.name</name>
-        <value>topology2</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.enabled</name>
-        <value>true</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm</name>
-        <value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.userDnTemplate</name>
-        <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.url</name>
-        <value>ldap://localhost:33389</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.param.main.ldapRealm.contextFactory.authenticationMechanism</name>
-        <value>simple</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.authentication.ShiroProvider.param.urls./**</name>
-        <value>authcBasic</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.identity-assertion.Pseudo.enabled</name>
-        <value>false</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.identity-assertion.Pseudo.param.name</name>
-        <value>user.name</value>
-    </property>
-    <property>
-        <name>topology.gateway.provider.identity-assertion.Pseudo.param.principal.mapping</name>
-        <value>hdfs=lmccay;kminder=admin</value>
-    </property>
-    <property>
-        <name>topology.service.NAMENODE..url</name>
-        <value>http://host:50070/webhdfs/v1</value>
-    </property>
-    <property>
-        <name>topology.service.TEMPLETON..url</name>
-        <value>http://host:50111/templeton/v1</value>
-    </property>
-    <property>
-        <name>topology.service.OOZIE..url</name>
-        <value>http://host:11000/oozie</value>
-    </property>
-    <property>
-        <name>topology.service.HIVE..url</name>
-        <value>http://host:10000</value>
-    </property>
-</configuration>


Mime
View raw message