You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ar...@apache.org on 2011/12/15 03:11:44 UTC
svn commit: r1214596 - in /incubator/sqoop/branches/sqoop2: ./ client/
common/ common/src/ common/src/main/ common/src/main/java/
common/src/main/java/org/ common/src/main/java/org/apache/
common/src/main/java/org/apache/sqoop/ common/src/main/java/org...
Author: arvind
Date: Thu Dec 15 02:11:43 2011
New Revision: 1214596
URL: http://svn.apache.org/viewvc?rev=1214596&view=rev
Log:
SQOOP-365. Added JSON servlet mechanism and introduced version servlet.
Added:
incubator/sqoop/branches/sqoop2/common/ (with props)
incubator/sqoop/branches/sqoop2/common/pom.xml
incubator/sqoop/branches/sqoop2/common/src/
incubator/sqoop/branches/sqoop2/common/src/main/
incubator/sqoop/branches/sqoop2/common/src/main/java/
incubator/sqoop/branches/sqoop2/common/src/main/java/org/
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java (with props)
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java (with props)
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java (with props)
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java (with props)
incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java (with props)
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java (with props)
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/sqoopconnector.properties
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java (with props)
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java (with props)
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java (with props)
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java (with props)
incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java (with props)
Modified:
incubator/sqoop/branches/sqoop2/client/pom.xml
incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/pom.xml
incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java
incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepoConfigurationConstants.java
incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java
incubator/sqoop/branches/sqoop2/pom.xml
incubator/sqoop/branches/sqoop2/server/pom.xml
incubator/sqoop/branches/sqoop2/server/src/main/webapp/WEB-INF/web.xml
Modified: incubator/sqoop/branches/sqoop2/client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/client/pom.xml?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/client/pom.xml (original)
+++ incubator/sqoop/branches/sqoop2/client/pom.xml Thu Dec 15 02:11:43 2011
@@ -37,5 +37,10 @@ limitations under the License.
<artifactId>sqoop-core</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.sqoop</groupId>
+ <artifactId>sqoop-common</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
Propchange: incubator/sqoop/branches/sqoop2/common/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 15 02:11:43 2011
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target
Added: incubator/sqoop/branches/sqoop2/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/pom.xml?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/pom.xml (added)
+++ incubator/sqoop/branches/sqoop2/common/pom.xml Thu Dec 15 02:11:43 2011
@@ -0,0 +1,40 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>sqoop</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.sqoop</groupId>
+ <artifactId>sqoop-common</artifactId>
+ <name>Sqoop Common</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java (added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,63 @@
+/**
+ * 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.sqoop.common;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.json.simple.JSONObject;
+
+public class ExceptionInfo implements JsonBean {
+
+ public static final String ERROR_CODE = "error-code";
+ public static final String ERROR_MESSAGE = "error-message";
+ public static final String STACK_TRACE = "stack-trace";
+
+ private String errorCode;
+ private String errorMessage;
+ private String stackTrace;
+
+ public ExceptionInfo(String code, String message, Exception ex) {
+ errorCode = code;
+ errorMessage = message;
+
+ StringWriter writer = new StringWriter();
+ ex.printStackTrace(new PrintWriter(writer));
+ writer.flush();
+
+ stackTrace = writer.getBuffer().toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public JSONObject extract() {
+ JSONObject result = new JSONObject();
+ result.put(ERROR_CODE, errorCode);
+ result.put(ERROR_MESSAGE, errorMessage);
+ result.put(STACK_TRACE, stackTrace);
+
+ return result;
+ }
+
+ @Override
+ public void restore(JSONObject jsonObject) {
+ errorCode = (String) jsonObject.get(ERROR_CODE);
+ errorMessage = (String) jsonObject.get(ERROR_MESSAGE);
+ stackTrace = (String) jsonObject.get(STACK_TRACE);
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java (added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,39 @@
+/**
+ * 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.sqoop.common;
+
+import org.json.simple.JSONObject;
+
+public interface JsonBean {
+
+ public JSONObject extract();
+
+ public void restore(JSONObject jsonObject);
+
+ public static final JsonBean EMPTY_BEAN = new JsonBean() {
+
+ @Override
+ public JSONObject extract() {
+ return new JSONObject();
+ }
+
+ @Override
+ public void restore(JSONObject jsonObject) {
+ }
+ };
+}
Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java (added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,38 @@
+/**
+ * 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.sqoop.common;
+
+public class SqoopProtocolConstants {
+
+ public static final String HEADER_SQOOP_ERROR_CODE = "sqoop-error-code";
+
+ public static final String HEADER_SQOOP_ERROR_MESSAGE = "sqoop-error-message";
+
+ public static final String HEADER_SQOOP_INTERNAL_ERROR_CODE =
+ "sqoop-internal-error-code";
+
+ public static final String HEADER_SQOOP_INTERNAL_ERROR_MESSAGE =
+ "sqoop-internal-error-message";
+
+ public static final String JSON_CONTENT_TYPE =
+ "application/json; charset=\"UTF-8\"";
+
+ private SqoopProtocolConstants() {
+ // Disable explicit object creation
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopProtocolConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java (added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,45 @@
+/**
+ * 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.sqoop.common;
+
+public enum SqoopResponseCode {
+
+ SQOOP_1000("1000", "OK"),
+ SQOOP_2000("2000", "ERROR");
+
+ private final String code;
+ private final String message;
+
+ private SqoopResponseCode(String code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public static SqoopResponseCode getFromCode(String code) {
+ return SqoopResponseCode.valueOf("SQOOP_" + code);
+ }
+
+}
Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/SqoopResponseCode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java (added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,56 @@
+/**
+ * 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.sqoop.common;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+
+public class VersionInfo implements JsonBean {
+
+ public static final String VERSIONS = "versions";
+
+ private String[] versions;
+
+ public VersionInfo(String[] versions) {
+ this.versions = new String[versions.length];
+ System.arraycopy(versions, 0, this.versions, 0, versions.length);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public JSONObject extract() {
+ JSONObject result = new JSONObject();
+ JSONArray versionsArray = new JSONArray();
+ for (String versionEntry : versions) {
+ versionsArray.add(versionEntry);
+ }
+ result.put(VERSIONS, versionsArray);
+ return result;
+ }
+
+ @Override
+ public void restore(JSONObject jsonObject) {
+ JSONArray versionsArray = (JSONArray) jsonObject.get(VERSIONS);
+ int size = versionsArray.size();
+ this.versions = new String[size];
+ for (int i = 0; i<size; i++) {
+ versions[i] = (String) versionsArray.get(i);
+ }
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/pom.xml?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/pom.xml (original)
+++ incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/pom.xml Thu Dec 15 02:11:43 2011
@@ -37,5 +37,10 @@ limitations under the License.
<artifactId>sqoop-spi</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.sqoop.connector</groupId>
+ <artifactId>sqoop-connector-generic-jdbc</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
Added: incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java (added)
+++ incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,33 @@
+/**
+ * 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.sqoop.connector.mysqljdbc;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.sqoop.spi.SqoopConnector;
+
+public class MySqlJdbcConnector implements SqoopConnector {
+
+ @Override
+ public ResourceBundle getBundle(Locale locale) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Propchange: incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/java/org/apache/sqoop/connector/mysqljdbc/MySqlJdbcConnector.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/sqoopconnector.properties
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/sqoopconnector.properties?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/sqoopconnector.properties (added)
+++ incubator/sqoop/branches/sqoop2/connector/connector-mysql-jdbc/src/main/resources/sqoopconnector.properties Thu Dec 15 02:11:43 2011
@@ -0,0 +1,17 @@
+# 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.
+
+# Generic JDBC Connector Properties
+org.apache.sqoop.connector = org.apache.sqoop.connector.mysqljdbc.MySqlJdbcConnector
Modified: incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java (original)
+++ incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java Thu Dec 15 02:11:43 2011
@@ -46,7 +46,6 @@ public class PropertiesConfigurationProv
private File configFile;
private ConfigFilePoller poller;
- private Thread pollerThread;
public PropertiesConfigurationProvider() {
// Default constructor
@@ -70,17 +69,14 @@ public class PropertiesConfigurationProv
LOG.info("Shutting down configuration poller thread");
if (poller != null) {
poller.setShutdown();
- }
- if (pollerThread != null) {
- pollerThread.interrupt();
+ poller.interrupt();
try {
- pollerThread.join();
+ poller.join();
} catch (InterruptedException ex) {
- // No handling requried - best effort only
+ Thread.currentThread().interrupt();
}
}
poller = null;
- pollerThread = null;
}
@Override
@@ -93,12 +89,8 @@ public class PropertiesConfigurationProv
loadConfiguration(false); // at least one load must succeed
poller = new ConfigFilePoller(configFile);
- pollerThread = new Thread(poller);
- pollerThread.setName("sqoop-config-file-poller");
- pollerThread.setDaemon(true);
-
LOG.info("Starting config file poller thread");
- pollerThread.start();
+ poller.start();
}
private synchronized void loadConfiguration(boolean notifyListeners) {
@@ -133,7 +125,7 @@ public class PropertiesConfigurationProv
}
}
- private class ConfigFilePoller implements Runnable {
+ private class ConfigFilePoller extends Thread {
private File file;
private long lastUpdatedAt;
@@ -143,6 +135,8 @@ public class PropertiesConfigurationProv
ConfigFilePoller(File configFile) {
this.file = configFile;
lastUpdatedAt = configFile.lastModified();
+ this.setName("sqoop-config-file-poller");
+ this.setDaemon(true);
}
synchronized void setShutdown() {
@@ -162,6 +156,7 @@ public class PropertiesConfigurationProv
if (file.lastModified() > lastUpdatedAt) {
LOG.info("Configuration file change detected, attempting to load");
try {
+ lastUpdatedAt = file.lastModified();
loadConfiguration(true);
} catch (Exception ex) {
LOG.error("Exception while loading configuration", ex);
Modified: incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java (original)
+++ incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java Thu Dec 15 02:11:43 2011
@@ -27,5 +27,4 @@ public interface JdbcRepositoryHandler {
public void shutdown();
public Repository getRepository();
-
}
Modified: incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java (original)
+++ incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java Thu Dec 15 02:11:43 2011
@@ -78,6 +78,7 @@ public class JdbcRepositoryProvider impl
if (driver != null) {
try {
+ LOG.info("Deregistering JDBC driver");
DriverManager.deregisterDriver(driver);
} catch (SQLException ex) {
LOG.error("Failed to deregister driver", ex);
@@ -86,7 +87,6 @@ public class JdbcRepositoryProvider impl
handler = null;
driver = null;
dataSource = null;
-
}
private void initializeRepositoryHandler() {
@@ -125,6 +125,13 @@ public class JdbcRepositoryProvider impl
jdbcDriverClassName);
}
+ try {
+ driver = (Driver) driverClass.newInstance();
+ } catch (Exception ex) {
+ throw new SqoopException(RepositoryError.JDBCREPO_0003,
+ jdbcDriverClassName, ex);
+ }
+
Properties jdbcProps = repoContext.getConnectionProperties();
ConnectionFactory connFactory =
@@ -143,8 +150,6 @@ public class JdbcRepositoryProvider impl
dataSource = new PoolingDataSource(connectionPool);
handler.initialize(dataSource, repoContext);
-
-
}
@Override
Modified: incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepoConfigurationConstants.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepoConfigurationConstants.java?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepoConfigurationConstants.java (original)
+++ incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepoConfigurationConstants.java Thu Dec 15 02:11:43 2011
@@ -29,6 +29,13 @@ public final class RepoConfigurationCons
ConfigurationConstants.PREFIX_GLOBAL_CONFIG + "repository.";
/**
+ * System properties set up by the Repository Manager before initializing
+ * the provider.
+ */
+ public static final String SYSCFG_REPO_SYSPROP_PREFIX = PREFIX_REPO_CONFIG
+ + "sysprop.";
+
+ /**
* Class name of the repository implementation specified by:
* <tt>org.apache.sqoop.repository.provider</tt>
*/
Modified: incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java (original)
+++ incubator/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java Thu Dec 15 02:11:43 2011
@@ -17,10 +17,10 @@
*/
package org.apache.sqoop.repository;
+import java.util.Map;
+
import org.apache.log4j.Logger;
-import org.apache.sqoop.core.ConfigurationConstants;
import org.apache.sqoop.core.Context;
-import org.apache.sqoop.core.CoreError;
import org.apache.sqoop.core.SqoopConfiguration;
import org.apache.sqoop.core.SqoopException;
import org.apache.sqoop.utils.ClassLoadingUtils;
@@ -34,6 +34,15 @@ public final class RepositoryManager {
public synchronized static void initialize() {
Context context = SqoopConfiguration.getContext();
+ Map<String, String> repoSysProps = context.getNestedProperties(
+ RepoConfigurationConstants.SYSCFG_REPO_SYSPROP_PREFIX);
+
+ LOG.info("Setting system properties: " + repoSysProps);
+
+ for (String key : repoSysProps.keySet()) {
+ System.setProperty(key, repoSysProps.get(key));
+ }
+
String repoProviderClassName = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);
Modified: incubator/sqoop/branches/sqoop2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/pom.xml?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/pom.xml (original)
+++ incubator/sqoop/branches/sqoop2/pom.xml Thu Dec 15 02:11:43 2011
@@ -113,6 +113,11 @@ limitations under the License.
<version>2.5</version>
</dependency>
<dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
@@ -120,7 +125,7 @@ limitations under the License.
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
- <version>10.8.1.2</version>
+ <version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -131,6 +136,7 @@ limitations under the License.
</dependencyManagement>
<modules>
+ <module>common</module>
<module>spi</module>
<module>core</module>
<module>repository</module>
Modified: incubator/sqoop/branches/sqoop2/server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/pom.xml?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/pom.xml (original)
+++ incubator/sqoop/branches/sqoop2/server/pom.xml Thu Dec 15 02:11:43 2011
@@ -40,6 +40,12 @@ limitations under the License.
</dependency>
<dependency>
+ <groupId>org.apache.sqoop</groupId>
+ <artifactId>sqoop-common</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.sqoop.repository</groupId>
<artifactId>sqoop-repository-derby</artifactId>
<version>2.0.0-SNAPSHOT</version>
@@ -52,10 +58,21 @@ limitations under the License.
</dependency>
<dependency>
+ <groupId>org.apache.sqoop.connector</groupId>
+ <artifactId>sqoop-connector-mysql-jdbc</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
</dependencies>
<build>
Added: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java (added)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.sqoop.handler;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.common.JsonBean;
+import org.apache.sqoop.common.VersionInfo;
+import org.apache.sqoop.core.SqoopException;
+import org.apache.sqoop.server.RequestContext;
+import org.apache.sqoop.server.RequestHandler;
+
+public class VersionRequestHandler implements RequestHandler {
+
+ private static final Logger LOG =
+ Logger.getLogger(VersionRequestHandler.class);
+
+ /** The API version supported by this server */
+ public static final String VERSION_V1 = "1";
+
+
+ private final VersionInfo versionInfo;
+
+ public VersionRequestHandler() {
+ String[] versions = { VERSION_V1 };
+ versionInfo = new VersionInfo(versions);
+
+ LOG.info("VersionRequestHandler initialized");
+ }
+
+
+ @Override
+ public JsonBean handleEvent(RequestContext ctx) throws SqoopException {
+ return versionInfo;
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java (added)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,44 @@
+/**
+ * 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.sqoop.server;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class RequestContext {
+
+ private final HttpServletRequest request;
+ private final HttpServletResponse response;
+
+ public RequestContext(HttpServletRequest req, HttpServletResponse resp) {
+ request = req;
+ response = resp;
+ }
+
+ public HttpServletRequest getRequest() {
+ return request;
+ }
+
+ public HttpServletResponse getResponse() {
+ return response;
+ }
+
+ public String getPath() {
+ return request.getRequestURL().toString();
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java (added)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,27 @@
+/**
+ * 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.sqoop.server;
+
+
+import org.apache.sqoop.common.JsonBean;
+import org.apache.sqoop.core.SqoopException;
+
+public interface RequestHandler {
+
+ public JsonBean handleEvent(RequestContext ctx) throws SqoopException;
+}
Propchange: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java (added)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,143 @@
+/**
+ * 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.sqoop.server;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.nio.charset.Charset;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.common.ExceptionInfo;
+import org.apache.sqoop.common.JsonBean;
+import org.apache.sqoop.common.SqoopProtocolConstants;
+import org.apache.sqoop.common.SqoopResponseCode;
+import org.apache.sqoop.core.CoreError;
+import org.apache.sqoop.core.ErrorCode;
+import org.apache.sqoop.core.SqoopException;
+
+@SuppressWarnings("serial")
+public class SqoopProtocolServlet extends HttpServlet {
+
+ private static final Logger LOG =
+ Logger.getLogger(SqoopProtocolServlet.class);
+
+ @Override
+ protected final void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ RequestContext rctx = new RequestContext(req, resp);
+
+ try {
+ JsonBean bean = handleGetRequest(rctx);
+ if (bean != null) {
+ sendSuccessResponse(rctx, bean);
+ }
+ } catch (Exception ex) {
+ LOG.error("Exception in GET " + rctx.getPath(), ex);
+ sendErrorResponse(rctx, ex);
+ }
+ }
+
+ @Override
+ protected final void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ RequestContext rctx = new RequestContext(req, resp);
+ try {
+ JsonBean bean = handlePostRequest(rctx);
+ if (bean != null) {
+ sendSuccessResponse(rctx, bean);
+ }
+ } catch (Exception ex) {
+ LOG.error("Exception in POST " + rctx.getPath(), ex);
+ sendErrorResponse(rctx, ex);
+ }
+ }
+
+ private void sendSuccessResponse(RequestContext ctx, JsonBean bean)
+ throws IOException {
+ HttpServletResponse response = ctx.getResponse();
+ response.setStatus(HttpServletResponse.SC_OK);
+ setContentType(response);
+ setHeaders(response, SqoopResponseCode.SQOOP_1000);
+ String responseString = bean.extract().toJSONString();
+ response.getWriter().write(responseString);
+ response.getWriter().flush();
+ }
+
+ private void sendErrorResponse(RequestContext ctx, Exception ex)
+ throws IOException
+ {
+ HttpServletResponse response = ctx.getResponse();
+ setContentType(response);
+ setHeaders(response, SqoopResponseCode.SQOOP_2000);
+
+ if (ex != null) {
+ ErrorCode ec = null;
+ if (ex instanceof SqoopException) {
+ ec = ((SqoopException) ex).getErrorCode();
+ } else {
+ ec = CoreError.CORE_0000;
+ }
+
+ response.setHeader(
+ SqoopProtocolConstants.HEADER_SQOOP_INTERNAL_ERROR_CODE,
+ ec.getCode());
+
+ response.setHeader(
+ SqoopProtocolConstants.HEADER_SQOOP_INTERNAL_ERROR_MESSAGE,
+ ex.getMessage());
+
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+ new ExceptionInfo(ec.getCode(),
+ ex.getMessage(), ex).extract().toJSONString());
+ } else {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ }
+
+ private void setContentType(HttpServletResponse response) {
+ response.setContentType(SqoopProtocolConstants.JSON_CONTENT_TYPE);
+ }
+
+ private void setHeaders(HttpServletResponse response, SqoopResponseCode code)
+ {
+ response.setHeader(SqoopProtocolConstants.HEADER_SQOOP_ERROR_CODE,
+ code.getCode());
+ response.setHeader(SqoopProtocolConstants.HEADER_SQOOP_ERROR_MESSAGE,
+ code.getMessage());
+
+
+ }
+
+ protected JsonBean handleGetRequest(RequestContext ctx) throws Exception {
+ super.doGet(ctx.getRequest(), ctx.getResponse());
+
+ return null;
+ }
+
+ protected JsonBean handlePostRequest(RequestContext ctx) throws Exception {
+ super.doPost(ctx.getRequest(), ctx.getResponse());
+
+ return null;
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java?rev=1214596&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java (added)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java Thu Dec 15 02:11:43 2011
@@ -0,0 +1,40 @@
+/**
+ * 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.sqoop.server;
+
+import org.apache.sqoop.common.JsonBean;
+import org.apache.sqoop.handler.VersionRequestHandler;
+
+/**
+ * Exposes the supported versions available in the server.
+ *
+ */
+@SuppressWarnings("serial")
+public class VersionServlet extends SqoopProtocolServlet {
+
+ private RequestHandler versionRequestHandler;
+
+ public VersionServlet() {
+ versionRequestHandler = new VersionRequestHandler();
+ }
+
+ @Override
+ protected JsonBean handleGetRequest(RequestContext ctx) throws Exception {
+ return versionRequestHandler.handleEvent(ctx);
+ }
+}
Propchange: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sqoop/branches/sqoop2/server/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/webapp/WEB-INF/web.xml?rev=1214596&r1=1214595&r2=1214596&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/webapp/WEB-INF/web.xml Thu Dec 15 02:11:43 2011
@@ -27,5 +27,17 @@ limitations under the License.
<listener-class>org.apache.sqoop.server.ServerInitializer</listener-class>
</listener>
+ <servlet>
+ <servlet-name>VersionServlet</servlet-name>
+ <display-name>Version Servlet</display-name>
+ <servlet-class>org.apache.sqoop.server.VersionServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>VersionServlet</servlet-name>
+ <url-pattern>/versions</url-pattern>
+ </servlet-mapping>
+
</web-app>