You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by km...@apache.org on 2013/03/22 20:12:09 UTC
[6/9] Cleaned up gateway-release directory by adding src and home
directories and moving files there.
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/samples/SampleScript.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/SampleScript.groovy b/gateway-release/home/samples/SampleScript.groovy
new file mode 100644
index 0000000..8258d90
--- /dev/null
+++ b/gateway-release/home/samples/SampleScript.groovy
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+import org.apache.hadoop.gateway.shell.Hadoop
+
+gateway = "https://localhost:8443/gateway/sample"
+username = "mapred"
+password = "mapred-password"
+
+hadoop = Hadoop.login( gateway, username, password )
+
+println "JSON=" + SampleService.simple(hadoop).param("/tmp").now().string
+
+println "Names=" + SampleService.complex(hadoop).param("/tmp").now().names
+
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/samples/SampleService.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/SampleService.groovy b/gateway-release/home/samples/SampleService.groovy
new file mode 100644
index 0000000..e8c5bdf
--- /dev/null
+++ b/gateway-release/home/samples/SampleService.groovy
@@ -0,0 +1,32 @@
+/*
+* 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.
+*/
+import org.apache.hadoop.gateway.shell.Hadoop
+
+class SampleService {
+
+ static String PATH = "/namenode/api/v1"
+
+ static SampleSimpleCommand simple( Hadoop hadoop ) {
+ return new SampleSimpleCommand( hadoop )
+ }
+
+ static SampleComplexCommand.Request complex( Hadoop hadoop ) {
+ return new SampleComplexCommand.Request( hadoop )
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/samples/SampleSimpleCommand.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/SampleSimpleCommand.groovy b/gateway-release/home/samples/SampleSimpleCommand.groovy
new file mode 100644
index 0000000..600113d
--- /dev/null
+++ b/gateway-release/home/samples/SampleSimpleCommand.groovy
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+import org.apache.hadoop.gateway.shell.AbstractRequest
+import org.apache.hadoop.gateway.shell.BasicResponse
+import org.apache.hadoop.gateway.shell.Hadoop
+import org.apache.http.client.methods.HttpGet
+import org.apache.http.client.utils.URIBuilder
+
+import java.util.concurrent.Callable
+
+class SampleSimpleCommand extends AbstractRequest<BasicResponse> {
+
+ SampleSimpleCommand( Hadoop hadoop ) {
+ super( hadoop )
+ }
+
+ private String param
+ SampleSimpleCommand param( String param ) {
+ this.param = param
+ return this
+ }
+
+ @Override
+ protected Callable<BasicResponse> callable() {
+ return new Callable<BasicResponse>() {
+ @Override
+ BasicResponse call() {
+ URIBuilder uri = uri( SampleService.PATH, param )
+ addQueryParam( uri, "op", "LISTSTATUS" )
+ HttpGet get = new HttpGet( uri.build() )
+ return new BasicResponse( execute( get ) )
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/samples/hadoop-examples.jar
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/hadoop-examples.jar b/gateway-release/home/samples/hadoop-examples.jar
new file mode 100644
index 0000000..351b77a
Binary files /dev/null and b/gateway-release/home/samples/hadoop-examples.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/templates/topology.xml
----------------------------------------------------------------------
diff --git a/gateway-release/home/templates/topology.xml b/gateway-release/home/templates/topology.xml
new file mode 100644
index 0000000..4c2dd69
--- /dev/null
+++ b/gateway-release/home/templates/topology.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+<topology>
+
+ <gateway>
+ <provider>
+ <role>authentication</role>
+ <enabled>true</enabled>
+ <param>
+ <name>main.ldapRealm</name>
+ <value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
+ </param>
+ <param>
+ <name>main.ldapRealm.userDnTemplate</name>
+ <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
+ </param>
+ <param>
+ <name>main.ldapRealm.contextFactory.url</name>
+ <value>ldap://localhost:33389</value>
+ </param>
+ <param>
+ <name>main.ldapRealm.contextFactory.authenticationMechanism</name>
+ <value>simple</value>
+ </param>
+ <param>
+ <name>urls./**</name>
+ <value>authcBasic</value>
+ </param>
+ </provider>
+ </gateway>
+
+ <service>
+ <role>NAMENODE</role>
+ <url>http://vm:50070/webhdfs/v1</url>
+ </service>
+ <service>
+ <role>TEMPLETON</role>
+ <url>http://vm:50111/templeton/v1</url>
+ </service>
+
+</topology>
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/templates/users.ldif
----------------------------------------------------------------------
diff --git a/gateway-release/home/templates/users.ldif b/gateway-release/home/templates/users.ldif
new file mode 100644
index 0000000..571f261
--- /dev/null
+++ b/gateway-release/home/templates/users.ldif
@@ -0,0 +1,62 @@
+# 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.
+
+version: 1
+
+dn: ou=users,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:organizationalUnit
+ou: users
+
+dn: uid=hdfs,ou=users,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:person
+objectclass:organizationalPerson
+objectclass:inetOrgPerson
+cn: HDFS
+sn: HDFS
+uid: hdfs
+userPassword:hdfs-password
+
+dn: uid=mapred,ou=users,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:person
+objectclass:organizationalPerson
+objectclass:inetOrgPerson
+cn: MapReduce
+sn: MapReduce
+uid: mapred
+userPassword:mapred-password
+
+dn: uid=hive,ou=people,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:person
+objectclass:organizationalPerson
+objectclass:inetOrgPerson
+cn: Hive
+sn: Hive
+uid: hive
+userPassword:hive-password
+
+dn: uid=hcat,ou=people,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:person
+objectclass:organizationalPerson
+objectclass:inetOrgPerson
+cn: HCat
+sn: HCat
+uid: hcat
+userPassword:hcat-password
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/templates/workflow-configuration.xml
----------------------------------------------------------------------
diff --git a/gateway-release/home/templates/workflow-configuration.xml b/gateway-release/home/templates/workflow-configuration.xml
new file mode 100644
index 0000000..a35000d
--- /dev/null
+++ b/gateway-release/home/templates/workflow-configuration.xml
@@ -0,0 +1,47 @@
+<?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>jobTracker</name>
+ <value>REPLACE.JOBTRACKER.RPCHOSTPORT</value>
+ <!-- Example: <value>sandbox:50300</value> -->
+ </property>
+ <property>
+ <name>nameNode</name>
+ <value>hdfs://REPLACE.NAMENODE.RPCHOSTPORT</value>
+ <!-- Example: <value>hdfs://sandbox:8020</value> -->
+ </property>
+ <property>
+ <name>oozie.wf.application.path</name>
+ <value>hdfs://REPLACE.NAMENODE.RPCHOSTPORT/tmp/test</value>
+ <!-- Example: <value>hdfs://sandbox:8020/tmp/test</value> -->
+ </property>
+ <property>
+ <name>user.name</name>
+ <value>mapred</value>
+ </property>
+ <property>
+ <name>inputDir</name>
+ <value>/tmp/test/input</value>
+ </property>
+ <property>
+ <name>outputDir</name>
+ <value>/tmp/test/output</value>
+ </property>
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/home/templates/workflow-definition.xml
----------------------------------------------------------------------
diff --git a/gateway-release/home/templates/workflow-definition.xml b/gateway-release/home/templates/workflow-definition.xml
new file mode 100644
index 0000000..a608d6b
--- /dev/null
+++ b/gateway-release/home/templates/workflow-definition.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<workflow-app xmlns="uri:oozie:workflow:0.2" name="wordcount-workflow">
+ <start to="root"/>
+ <action name="root">
+ <java>
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <main-class>org.apache.hadoop.examples.WordCount</main-class>
+ <arg>${inputDir}</arg>
+ <arg>${outputDir}</arg>
+ </java>
+ <ok to="end"/>
+ <error to="fail"/>
+ </action>
+ <kill name="fail">
+ <message>Java failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
+ </kill>
+ <end name="end"/>
+</workflow-app>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/lib/README
----------------------------------------------------------------------
diff --git a/gateway-release/lib/README b/gateway-release/lib/README
deleted file mode 100644
index 39cee63..0000000
--- a/gateway-release/lib/README
+++ /dev/null
@@ -1 +0,0 @@
-THIS DIRECTORY IS RESERVED FOR USE BY FUTURE SYSTEM JARS AND CLASSES
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-release/pom.xml b/gateway-release/pom.xml
index 3a605be..bb09cad 100644
--- a/gateway-release/pom.xml
+++ b/gateway-release/pom.xml
@@ -53,7 +53,7 @@
<outputDirectory>../target</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
- <descriptor>assembly.xml</descriptor>
+ <descriptor>src/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/ExamplePutFile.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/ExamplePutFile.groovy b/gateway-release/samples/ExamplePutFile.groovy
deleted file mode 100644
index 9debf9e..0000000
--- a/gateway-release/samples/ExamplePutFile.groovy
+++ /dev/null
@@ -1,37 +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.
- */
-
-import groovy.json.JsonSlurper
-import org.apache.hadoop.gateway.shell.Hadoop
-import org.apache.hadoop.gateway.shell.hdfs.Hdfs
-
-gateway = "https://localhost:8443/gateway/sample"
-username = "mapred"
-password = "mapred-password"
-dataFile = "README"
-
-hadoop = Hadoop.login( gateway, username, password )
-Hdfs.rm( hadoop ).file( "/tmp/example" ).recursive().now()
-Hdfs.put( hadoop ).file( dataFile ).to( "/tmp/example/README" ).now()
-text = Hdfs.ls( hadoop ).dir( "/tmp/example" ).now().string
-json = (new JsonSlurper()).parseText( text )
-println json.FileStatuses.FileStatus.pathSuffix
-hadoop.shutdown()
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/ExampleSubmitJob.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/ExampleSubmitJob.groovy b/gateway-release/samples/ExampleSubmitJob.groovy
deleted file mode 100644
index d2522ea..0000000
--- a/gateway-release/samples/ExampleSubmitJob.groovy
+++ /dev/null
@@ -1,61 +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.
- */
-import com.jayway.jsonpath.JsonPath
-import org.apache.hadoop.gateway.shell.Hadoop
-import org.apache.hadoop.gateway.shell.hdfs.Hdfs
-import org.apache.hadoop.gateway.shell.job.Job
-
-import static java.util.concurrent.TimeUnit.SECONDS
-
-gateway = "https://localhost:8443/gateway/sample"
-username = "mapred"
-password = "mapred-password"
-dataFile = "LICENSE"
-jarFile = "samples/hadoop-examples.jar"
-
-hadoop = Hadoop.login( gateway, username, password )
-
-println "Delete /tmp/test " + Hdfs.rm(hadoop).file( "/tmp/test" ).recursive().now().statusCode
-println "Create /tmp/test " + Hdfs.mkdir(hadoop).dir( "/tmp/test").now().statusCode
-
-putData = Hdfs.put(hadoop).file( dataFile ).to( "/tmp/test/input/FILE" ).later() {
- println "Put /tmp/test/input/FILE " + it.statusCode }
-putJar = Hdfs.put(hadoop).file( jarFile ).to( "/tmp/test/hadoop-examples.jar" ).later() {
- println "Put /tmp/test/hadoop-examples.jar " + it.statusCode }
-hadoop.waitFor( putData, putJar )
-
-jobId = Job.submitJava(hadoop) \
- .jar( "/tmp/test/hadoop-examples.jar" ) \
- .app( "wordcount" ) \
- .input( "/tmp/test/input" ) \
- .output( "/tmp/test/output" ) \
- .now().jobId
-println "Submitted job " + jobId
-
-println "Polling for completion..."
-done = false
-count = 0
-while( !done && count++ < 60 ) {
- sleep( 1000 )
- json = Job.queryStatus(hadoop).jobId(jobId).now().string
- done = JsonPath.read( json, "\$.status.jobComplete" )
-}
-println "Done " + done
-
-println "Shutdown " + hadoop.shutdown( 10, SECONDS )
-
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/ExampleSubmitWorkflow.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/ExampleSubmitWorkflow.groovy b/gateway-release/samples/ExampleSubmitWorkflow.groovy
deleted file mode 100644
index 4dfc367..0000000
--- a/gateway-release/samples/ExampleSubmitWorkflow.groovy
+++ /dev/null
@@ -1,92 +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.
- */
-import com.jayway.jsonpath.JsonPath
-import org.apache.hadoop.gateway.shell.Hadoop
-import org.apache.hadoop.gateway.shell.hdfs.Hdfs
-import org.apache.hadoop.gateway.shell.workflow.Workflow
-
-import static java.util.concurrent.TimeUnit.SECONDS
-
-gateway = "https://localhost:8443/gateway/sample"
-jobTracker = "sandbox:50300";
-nameNode = "sandbox:8020";
-username = "mapred"
-password = "mapred-password"
-inputFile = "LICENSE"
-jarFile = "samples/hadoop-examples.jar"
-
-definition = """\
-<workflow-app xmlns="uri:oozie:workflow:0.2" name="wordcount-workflow">
- <start to="root-node"/>
- <action name="root-node">
- <java>
- <job-tracker>$jobTracker</job-tracker>
- <name-node>hdfs://$nameNode</name-node>
- <main-class>org.apache.hadoop.examples.WordCount</main-class>
- <arg>/tmp/test/input</arg>
- <arg>/tmp/test/output</arg>
- </java>
- <ok to="end"/>
- <error to="fail"/>
- </action>
- <kill name="fail">
- <message>Java failed, error message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
- </kill>
- <end name="end"/>
-</workflow-app>
-"""
-
-configuration = """\
-<configuration>
- <property>
- <name>user.name</name>
- <value>$username</value>
- </property>
- <property>
- <name>oozie.wf.application.path</name>
- <value>hdfs://$nameNode/tmp/test</value>
- </property>
-</configuration>
-"""
-
-hadoop = Hadoop.login( gateway, username, password )
-
-println "Delete /tmp/test " + Hdfs.rm(hadoop).file( "/tmp/test" ).recursive().now().statusCode
-println "Mkdir /tmp/test " + Hdfs.mkdir(hadoop).dir( "/tmp/test").now().statusCode
-putWorkflow = Hdfs.put(hadoop).text( definition ).to( "/tmp/test/workflow.xml" ).later() {
- println "Put /tmp/test/workflow.xml " + it.statusCode }
-putData = Hdfs.put(hadoop).file( inputFile ).to( "/tmp/test/input/FILE" ).later() {
- println "Put /tmp/test/input/FILE " + it.statusCode }
-putJar = Hdfs.put(hadoop).file( jarFile ).to( "/tmp/test/lib/hadoop-examples.jar" ).later() {
- println "Put /tmp/test/lib/hadoop-examples.jar " + it.statusCode }
-hadoop.waitFor( putWorkflow, putData, putJar )
-
-jobId = Workflow.submit(hadoop).text( configuration ).now().jobId
-println "Submitted job " + jobId
-
-println "Polling for completion..."
-status = "UNKNOWN";
-count = 0;
-while( status != "SUCCEEDED" && count++ < 60 ) {
- sleep( 1000 )
- json = Workflow.status(hadoop).jobId( jobId ).now().string
- status = JsonPath.read( json, "\$.status" )
-}
-println "Job status " + status;
-
-println "Shutdown " + hadoop.shutdown( 10, SECONDS )
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/SampleComplexCommand.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/SampleComplexCommand.groovy b/gateway-release/samples/SampleComplexCommand.groovy
deleted file mode 100644
index add1afb..0000000
--- a/gateway-release/samples/SampleComplexCommand.groovy
+++ /dev/null
@@ -1,69 +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.
- */
-import com.jayway.jsonpath.JsonPath
-import org.apache.hadoop.gateway.shell.AbstractRequest
-import org.apache.hadoop.gateway.shell.BasicResponse
-import org.apache.hadoop.gateway.shell.Hadoop
-import org.apache.http.HttpResponse
-import org.apache.http.client.methods.HttpGet
-import org.apache.http.client.utils.URIBuilder
-
-import java.util.concurrent.Callable
-
-class SampleComplexCommand {
-
- static class Request extends AbstractRequest<Response> {
-
- Request( Hadoop hadoop ) {
- super( hadoop )
- }
-
- private String param;
- Request param( String param ) {
- this.param = param;
- return this;
- }
-
- @Override
- protected Callable<Response> callable() {
- return new Callable<Response>() {
- @Override
- Response call() {
- URIBuilder uri = uri( SampleService.PATH, param )
- addQueryParam( uri, "op", "LISTSTATUS" )
- HttpGet get = new HttpGet( uri.build() )
- return new Response( execute( get ) )
- }
- }
- }
-
- }
-
- static class Response extends BasicResponse {
-
- Response(HttpResponse response) {
- super(response)
- }
-
- public List<String> getNames() {
- return JsonPath.read( string, "\$.FileStatuses.FileStatus[*].pathSuffix" )
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/SampleScript.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/SampleScript.groovy b/gateway-release/samples/SampleScript.groovy
deleted file mode 100644
index 8258d90..0000000
--- a/gateway-release/samples/SampleScript.groovy
+++ /dev/null
@@ -1,29 +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.
-*/
-import org.apache.hadoop.gateway.shell.Hadoop
-
-gateway = "https://localhost:8443/gateway/sample"
-username = "mapred"
-password = "mapred-password"
-
-hadoop = Hadoop.login( gateway, username, password )
-
-println "JSON=" + SampleService.simple(hadoop).param("/tmp").now().string
-
-println "Names=" + SampleService.complex(hadoop).param("/tmp").now().names
-
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/SampleService.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/SampleService.groovy b/gateway-release/samples/SampleService.groovy
deleted file mode 100644
index e8c5bdf..0000000
--- a/gateway-release/samples/SampleService.groovy
+++ /dev/null
@@ -1,32 +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.
-*/
-import org.apache.hadoop.gateway.shell.Hadoop
-
-class SampleService {
-
- static String PATH = "/namenode/api/v1"
-
- static SampleSimpleCommand simple( Hadoop hadoop ) {
- return new SampleSimpleCommand( hadoop )
- }
-
- static SampleComplexCommand.Request complex( Hadoop hadoop ) {
- return new SampleComplexCommand.Request( hadoop )
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/SampleSimpleCommand.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/samples/SampleSimpleCommand.groovy b/gateway-release/samples/SampleSimpleCommand.groovy
deleted file mode 100644
index 600113d..0000000
--- a/gateway-release/samples/SampleSimpleCommand.groovy
+++ /dev/null
@@ -1,51 +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.
- */
-import org.apache.hadoop.gateway.shell.AbstractRequest
-import org.apache.hadoop.gateway.shell.BasicResponse
-import org.apache.hadoop.gateway.shell.Hadoop
-import org.apache.http.client.methods.HttpGet
-import org.apache.http.client.utils.URIBuilder
-
-import java.util.concurrent.Callable
-
-class SampleSimpleCommand extends AbstractRequest<BasicResponse> {
-
- SampleSimpleCommand( Hadoop hadoop ) {
- super( hadoop )
- }
-
- private String param
- SampleSimpleCommand param( String param ) {
- this.param = param
- return this
- }
-
- @Override
- protected Callable<BasicResponse> callable() {
- return new Callable<BasicResponse>() {
- @Override
- BasicResponse call() {
- URIBuilder uri = uri( SampleService.PATH, param )
- addQueryParam( uri, "op", "LISTSTATUS" )
- HttpGet get = new HttpGet( uri.build() )
- return new BasicResponse( execute( get ) )
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/samples/hadoop-examples.jar
----------------------------------------------------------------------
diff --git a/gateway-release/samples/hadoop-examples.jar b/gateway-release/samples/hadoop-examples.jar
deleted file mode 100644
index 351b77a..0000000
Binary files a/gateway-release/samples/hadoop-examples.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/src/assembly.xml
----------------------------------------------------------------------
diff --git a/gateway-release/src/assembly.xml b/gateway-release/src/assembly.xml
new file mode 100644
index 0000000..0edb7ba
--- /dev/null
+++ b/gateway-release/src/assembly.xml
@@ -0,0 +1,81 @@
+<?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.
+-->
+<assembly>
+ <id>bin</id>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>home</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/.idea/**</exclude>
+ <exclude>**/*.iml</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>dep</outputDirectory>
+ <excludes>
+ <exclude>maven-test:*</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>${gateway-group}:*</include>
+ </includes>
+ <excludes>
+ <exclude>${gateway-group}:gateway-util-launcher</exclude>
+ <exclude>${gateway-group}:gateway-server-launcher</exclude>
+ <exclude>${gateway-group}:gateway-shell-launcher</exclude>
+ <exclude>${gateway-group}:gateway-test-ldap-launcher</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>gateway.jar</outputFileNameMapping>
+ <includes>
+ <include>${gateway-group}:gateway-server-launcher</include>
+ </includes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>shell.jar</outputFileNameMapping>
+ <includes>
+ <include>${gateway-group}:gateway-shell-launcher</include>
+ </includes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>ldap.jar</outputFileNameMapping>
+ <includes>
+ <include>${gateway-group}:gateway-test-ldap-launcher</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/templates/topology.xml
----------------------------------------------------------------------
diff --git a/gateway-release/templates/topology.xml b/gateway-release/templates/topology.xml
deleted file mode 100644
index 4c2dd69..0000000
--- a/gateway-release/templates/topology.xml
+++ /dev/null
@@ -1,56 +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.
--->
-<topology>
-
- <gateway>
- <provider>
- <role>authentication</role>
- <enabled>true</enabled>
- <param>
- <name>main.ldapRealm</name>
- <value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
- </param>
- <param>
- <name>main.ldapRealm.userDnTemplate</name>
- <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
- </param>
- <param>
- <name>main.ldapRealm.contextFactory.url</name>
- <value>ldap://localhost:33389</value>
- </param>
- <param>
- <name>main.ldapRealm.contextFactory.authenticationMechanism</name>
- <value>simple</value>
- </param>
- <param>
- <name>urls./**</name>
- <value>authcBasic</value>
- </param>
- </provider>
- </gateway>
-
- <service>
- <role>NAMENODE</role>
- <url>http://vm:50070/webhdfs/v1</url>
- </service>
- <service>
- <role>TEMPLETON</role>
- <url>http://vm:50111/templeton/v1</url>
- </service>
-
-</topology>
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/templates/users.ldif
----------------------------------------------------------------------
diff --git a/gateway-release/templates/users.ldif b/gateway-release/templates/users.ldif
deleted file mode 100644
index 571f261..0000000
--- a/gateway-release/templates/users.ldif
+++ /dev/null
@@ -1,62 +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.
-
-version: 1
-
-dn: ou=users,dc=hadoop,dc=apache,dc=org
-objectclass:top
-objectclass:organizationalUnit
-ou: users
-
-dn: uid=hdfs,ou=users,dc=hadoop,dc=apache,dc=org
-objectclass:top
-objectclass:person
-objectclass:organizationalPerson
-objectclass:inetOrgPerson
-cn: HDFS
-sn: HDFS
-uid: hdfs
-userPassword:hdfs-password
-
-dn: uid=mapred,ou=users,dc=hadoop,dc=apache,dc=org
-objectclass:top
-objectclass:person
-objectclass:organizationalPerson
-objectclass:inetOrgPerson
-cn: MapReduce
-sn: MapReduce
-uid: mapred
-userPassword:mapred-password
-
-dn: uid=hive,ou=people,dc=hadoop,dc=apache,dc=org
-objectclass:top
-objectclass:person
-objectclass:organizationalPerson
-objectclass:inetOrgPerson
-cn: Hive
-sn: Hive
-uid: hive
-userPassword:hive-password
-
-dn: uid=hcat,ou=people,dc=hadoop,dc=apache,dc=org
-objectclass:top
-objectclass:person
-objectclass:organizationalPerson
-objectclass:inetOrgPerson
-cn: HCat
-sn: HCat
-uid: hcat
-userPassword:hcat-password
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/templates/workflow-configuration.xml
----------------------------------------------------------------------
diff --git a/gateway-release/templates/workflow-configuration.xml b/gateway-release/templates/workflow-configuration.xml
deleted file mode 100644
index a35000d..0000000
--- a/gateway-release/templates/workflow-configuration.xml
+++ /dev/null
@@ -1,47 +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>jobTracker</name>
- <value>REPLACE.JOBTRACKER.RPCHOSTPORT</value>
- <!-- Example: <value>sandbox:50300</value> -->
- </property>
- <property>
- <name>nameNode</name>
- <value>hdfs://REPLACE.NAMENODE.RPCHOSTPORT</value>
- <!-- Example: <value>hdfs://sandbox:8020</value> -->
- </property>
- <property>
- <name>oozie.wf.application.path</name>
- <value>hdfs://REPLACE.NAMENODE.RPCHOSTPORT/tmp/test</value>
- <!-- Example: <value>hdfs://sandbox:8020/tmp/test</value> -->
- </property>
- <property>
- <name>user.name</name>
- <value>mapred</value>
- </property>
- <property>
- <name>inputDir</name>
- <value>/tmp/test/input</value>
- </property>
- <property>
- <name>outputDir</name>
- <value>/tmp/test/output</value>
- </property>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/800736a8/gateway-release/templates/workflow-definition.xml
----------------------------------------------------------------------
diff --git a/gateway-release/templates/workflow-definition.xml b/gateway-release/templates/workflow-definition.xml
deleted file mode 100644
index a608d6b..0000000
--- a/gateway-release/templates/workflow-definition.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<workflow-app xmlns="uri:oozie:workflow:0.2" name="wordcount-workflow">
- <start to="root"/>
- <action name="root">
- <java>
- <job-tracker>${jobTracker}</job-tracker>
- <name-node>${nameNode}</name-node>
- <main-class>org.apache.hadoop.examples.WordCount</main-class>
- <arg>${inputDir}</arg>
- <arg>${outputDir}</arg>
- </java>
- <ok to="end"/>
- <error to="fail"/>
- </action>
- <kill name="fail">
- <message>Java failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
- </kill>
- <end name="end"/>
-</workflow-app>
\ No newline at end of file