sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1236955 - in /incubator/sqoop/branches/sqoop2: common/ common/src/ common/src/main/java/org/apache/sqoop/common/ common/src/main/java/org/apache/sqoop/json/ common/src/test/ common/src/test/java/ common/src/test/java/org/ common/src/test/j...
Date Sat, 28 Jan 2012 01:50:39 GMT
Author: blee
Date: Sat Jan 28 01:50:38 2012
New Revision: 1236955

URL: http://svn.apache.org/viewvc?rev=1236955&view=rev
Log:
SQOOP-365. Add versioning mechanism.

Added:
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
  (with props)
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/JsonBean.java
  (contents, props changed)
      - copied, changed from r1231245, incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/VersionsBean.java
  (contents, props changed)
      - copied, changed from r1231245, incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
    incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh   (with props)
    incubator/sqoop/branches/sqoop2/common/src/test/
    incubator/sqoop/branches/sqoop2/common/src/test/java/
    incubator/sqoop/branches/sqoop2/common/src/test/java/org/
    incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/
    incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/
    incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/
    incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
  (with props)
Removed:
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java
Modified:
    incubator/sqoop/branches/sqoop2/common/pom.xml
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java
    incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
    incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
    incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java
    incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
    incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java
    incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java

Modified: incubator/sqoop/branches/sqoop2/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/pom.xml?rev=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/pom.xml (original)
+++ incubator/sqoop/branches/sqoop2/common/pom.xml Sat Jan 28 01:50:38 2012
@@ -36,5 +36,66 @@ limitations under the License.
       <groupId>com.googlecode.json-simple</groupId>
       <artifactId>json-simple</artifactId>
     </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>save-version</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <mkdir dir="${project.build.directory}/generated-sources/java"/>
+                <exec executable="sh">
+                  <arg line="${basedir}/src/saveVersion.sh ${project.version} ${project.build.directory}/generated-sources/java"/>
+                </exec>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>add-source</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>${project.build.directory}/generated-sources/java</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java
(original)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/ExceptionInfo.java
Sat Jan 28 01:50:38 2012
@@ -20,6 +20,7 @@ package org.apache.sqoop.common;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 
+import org.apache.sqoop.json.JsonBean;
 import org.json.simple.JSONObject;
 
 public class ExceptionInfo implements JsonBean {

Added: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java?rev=1236955&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
(added)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
Sat Jan 28 01:50:38 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * A package attribute that captures the version that was compiled.
+ * Copied down from hadoop.  All is same except name of interface.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PACKAGE)
+public @interface VersionAnnotation {
+
+  /**
+   * Get the Hadoop version
+   * @return the version string (eg. "2.0.0")
+   */
+  String version();
+
+  /**
+   * Get the username that compiled the code.
+   */
+  String user();
+
+  /**
+   * Get the date when the code was compiled.
+   * @return the date in unix 'date' format
+   */
+  String date();
+
+  /**
+   * Get the url for the subversion repository.
+   */
+  String url();
+
+  /**
+   * Get the subversion revision.
+   * @return the revision number as a string (eg. "451451")
+   */
+  String revision();
+}

Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
(original)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
Sat Jan 28 01:50:38 2012
@@ -17,40 +17,58 @@
  */
 package org.apache.sqoop.common;
 
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
+public class VersionInfo {
 
-public class VersionInfo implements JsonBean {
+  private static Package myPackage;
+  private static VersionAnnotation annotation;
 
-  public static final String VERSIONS = "versions";
+  static {
+    myPackage = VersionAnnotation.class.getPackage();
+    annotation = myPackage.getAnnotation(VersionAnnotation.class);
+  }
+
+  private VersionInfo() {
+    // Disable explicit object creation
+  }
 
-  private String[] versions;
+  /**
+   * Get the version.
+   * @return the version string, eg. "2.0.0"
+   */
+  public static String getVersion() {
+    return annotation != null ? annotation.version() : "Unknown";
+  }
 
-  public VersionInfo(String[] versions) {
-    this.versions = new String[versions.length];
-    System.arraycopy(versions, 0, this.versions, 0, versions.length);
+  /**
+   * Get the subversion revision number for the root directory
+   * @return the revision number, eg. "451451"
+   */
+  public static String getRevision() {
+    return annotation != null ? annotation.revision() : "Unknown";
   }
 
+  /**
+   * The date that the code was compiled.
+   * @return the compilation date in unix date format
+   */
+  public static String getDate() {
+    return annotation != null ? annotation.date() : "Unknown";
+  }
 
-  @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;
+  /**
+   * The user that compiled the code.
+   * @return the username of the user
+   */
+  public static String getUser() {
+    return annotation != null ? annotation.user() : "Unknown";
   }
 
-  @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);
-    }
+  /**
+   * Get the subversion URL for the root directory.
+   * @return the url
+   */
+  public static String getUrl() {
+    return annotation != null ? annotation.url() : "Unknown";
   }
+
 }

Copied: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/JsonBean.java
(from r1231245, 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/json/JsonBean.java?p2=incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/JsonBean.java&p1=incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java&r1=1231245&r2=1236955&rev=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/JsonBean.java
(original)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/JsonBean.java
Sat Jan 28 01:50:38 2012
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sqoop.common;
+package org.apache.sqoop.json;
 
 import org.json.simple.JSONObject;
 

Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/JsonBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/VersionsBean.java
(from r1231245, 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/json/VersionsBean.java?p2=incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/VersionsBean.java&p1=incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java&r1=1231245&r2=1236955&rev=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/common/VersionInfo.java
(original)
+++ incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/VersionsBean.java
Sat Jan 28 01:50:38 2012
@@ -15,42 +15,99 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sqoop.common;
+package org.apache.sqoop.json;
+
+import java.util.Arrays;
 
 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 class VersionsBean implements JsonBean {
 
-  public VersionInfo(String[] versions) {
-    this.versions = new String[versions.length];
-    System.arraycopy(versions, 0, this.versions, 0, versions.length);
+  public static final String VERSION = "version";
+  public static final String REVISION = "revision";
+  public static final String DATE = "date";
+  public static final String USER = "user";
+  public static final String URL = "url";
+  public static final String PROTOCOLS = "protocols";
+
+  private String version;
+  private String revision;
+  private String date;
+  private String user;
+  private String url;
+  private String[] protocols;
+
+  // for "extract"
+  public VersionsBean(String version, String revision, String date,
+      String user, String url, String[] protocols) {
+    this.version = version;
+    this.revision = revision;
+    this.date = date;
+    this.user = user;
+    this.url = url;
+    this.protocols = new String[protocols.length];
+    System.arraycopy(protocols, 0, this.protocols, 0, protocols.length);
   }
 
+  // for "restore"
+  public VersionsBean() {
+  }
 
   @SuppressWarnings("unchecked")
   @Override
   public JSONObject extract() {
     JSONObject result = new JSONObject();
-    JSONArray versionsArray = new JSONArray();
-    for (String versionEntry : versions) {
-      versionsArray.add(versionEntry);
+    result.put(VERSION, version);
+    result.put(REVISION, revision);
+    result.put(DATE, date);
+    result.put(USER, user);
+    result.put(URL, url);
+    JSONArray protocolsArray = new JSONArray();
+    for (String protocol : protocols) {
+      protocolsArray.add(protocol);
     }
-    result.put(VERSIONS, versionsArray);
+    result.put(PROTOCOLS, protocolsArray);
     return result;
   }
 
   @Override
   public void restore(JSONObject jsonObject) {
-    JSONArray versionsArray = (JSONArray) jsonObject.get(VERSIONS);
-    int size = versionsArray.size();
-    this.versions = new String[size];
+    this.version = (String)jsonObject.get(VERSION);
+    this.revision = (String)jsonObject.get(REVISION);
+    this.date = (String)jsonObject.get(DATE);
+    this.user = (String)jsonObject.get(USER);
+    this.url = (String)jsonObject.get(URL);
+    JSONArray protocolsArray = (JSONArray) jsonObject.get(PROTOCOLS);
+    int size = protocolsArray.size();
+    this.protocols = new String[size];
     for (int i = 0; i<size; i++) {
-      versions[i] = (String) versionsArray.get(i);
+      protocols[i] = (String) protocolsArray.get(i);
     }
   }
+
+  public String getVersion() {
+    return this.version;
+  }
+
+  public String getRevision() {
+    return this.revision;
+  }
+
+  public String getDate() {
+    return this.date;
+  }
+
+  public String getUser() {
+    return this.user;
+  }
+
+  public String getUrl() {
+    return this.url;
+  }
+
+  public String getProtocols() {
+    return Arrays.toString(protocols);
+  }
+
 }

Propchange: incubator/sqoop/branches/sqoop2/common/src/main/java/org/apache/sqoop/json/VersionsBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh?rev=1236955&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh (added)
+++ incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh Sat Jan 28 01:50:38 2012
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# This file is used to generate the annotation of package info that
+# records the user, url, revision and timestamp.
+
+# 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.
+
+unset LANG
+unset LC_CTYPE
+version=$1
+outputDirectory=$2
+user=`whoami`
+date=`date`
+cwd=`pwd`
+if [ -d .svn ]; then
+  revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
+  url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
+elif [ -d .git ]; then
+  revision=`git log -1 --pretty=format:"%H"`
+  hostname=`hostname`
+  url="git://${hostname}${cwd}"
+else
+  revision="Unknown"
+  url="file://$cwd"
+fi
+mkdir -p "$outputDirectory/org/apache/sqoop/common"
+cat >"$outputDirectory/org/apache/sqoop/common/package-info.java" <<EOF
+/*
+ * Generated by src/saveVersion.sh
+ */
+@VersionAnnotation(version="$version", revision="$revision",
+                   user="$user", date="$date", url="$url")
+package org.apache.sqoop.common;
+EOF

Propchange: incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sqoop/branches/sqoop2/common/src/saveVersion.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java?rev=1236955&view=auto
==============================================================================
--- incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
(added)
+++ incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
Sat Jan 28 01:50:38 2012
@@ -0,0 +1,34 @@
+/**
+ * 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.junit.Assert;
+import org.junit.Test;
+
+public class TestVersionInfo {
+
+  @Test
+  public void testValues() throws Exception {
+    Assert.assertNotSame("Unknown", VersionInfo.getVersion());
+    Assert.assertNotSame("Unknown", VersionInfo.getRevision());
+    Assert.assertNotSame("Unknown", VersionInfo.getDate());
+    Assert.assertNotSame("Unknown", VersionInfo.getUser());
+    Assert.assertNotSame("Unknown", VersionInfo.getUrl());
+  }
+
+}

Propchange: incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sqoop/branches/sqoop2/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
(original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
Sat Jan 28 01:50:38 2012
@@ -18,9 +18,10 @@
 package org.apache.sqoop.handler;
 
 import org.apache.log4j.Logger;
-import org.apache.sqoop.common.JsonBean;
-import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.common.VersionInfo;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.json.JsonBean;
+import org.apache.sqoop.json.VersionsBean;
 import org.apache.sqoop.server.RequestContext;
 import org.apache.sqoop.server.RequestHandler;
 
@@ -30,14 +31,16 @@ public class VersionRequestHandler imple
       Logger.getLogger(VersionRequestHandler.class);
 
   /** The API version supported by this server */
-  public static final String VERSION_V1 = "1";
+  public static final String PROTOCOL_V1 = "1";
 
 
-  private final VersionInfo versionInfo;
+  private final VersionsBean versionsBean;
 
   public VersionRequestHandler() {
-    String[] versions = { VERSION_V1 };
-    versionInfo = new VersionInfo(versions);
+    String[] protocols = { PROTOCOL_V1 };
+    versionsBean = new VersionsBean(VersionInfo.getVersion(),
+        VersionInfo.getRevision(), VersionInfo.getDate(),
+        VersionInfo.getUser(), VersionInfo.getUrl(), protocols);
 
     LOG.info("VersionRequestHandler initialized");
   }
@@ -45,6 +48,6 @@ public class VersionRequestHandler imple
 
   @Override
   public JsonBean handleEvent(RequestContext ctx) throws SqoopException {
-    return versionInfo;
+    return versionsBean;
   }
 }

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java
(original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/RequestHandler.java
Sat Jan 28 01:50:38 2012
@@ -18,8 +18,8 @@
 package org.apache.sqoop.server;
 
 
-import org.apache.sqoop.common.JsonBean;
 import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.json.JsonBean;
 
 public interface RequestHandler {
 

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
(original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
Sat Jan 28 01:50:38 2012
@@ -29,11 +29,11 @@ import javax.servlet.http.HttpServletRes
 import org.apache.log4j.Logger;
 import org.apache.sqoop.common.ErrorCode;
 import org.apache.sqoop.common.ExceptionInfo;
-import org.apache.sqoop.common.JsonBean;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.common.SqoopProtocolConstants;
 import org.apache.sqoop.common.SqoopResponseCode;
 import org.apache.sqoop.core.CoreError;
+import org.apache.sqoop.json.JsonBean;
 
 @SuppressWarnings("serial")
 public class SqoopProtocolServlet extends HttpServlet {

Modified: 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=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java
(original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/VersionServlet.java
Sat Jan 28 01:50:38 2012
@@ -17,8 +17,8 @@
  */
 package org.apache.sqoop.server;
 
-import org.apache.sqoop.common.JsonBean;
 import org.apache.sqoop.handler.VersionRequestHandler;
+import org.apache.sqoop.json.JsonBean;
 
 /**
  * Exposes the supported versions available in the server.

Modified: incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java?rev=1236955&r1=1236954&r2=1236955&view=diff
==============================================================================
--- incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
(original)
+++ incubator/sqoop/branches/sqoop2/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
Sat Jan 28 01:50:38 2012
@@ -17,7 +17,7 @@
  */
 package org.apache.sqoop.server.v1;
 
-import org.apache.sqoop.common.JsonBean;
+import org.apache.sqoop.json.JsonBean;
 import org.apache.sqoop.server.RequestContext;
 import org.apache.sqoop.server.SqoopProtocolServlet;
 



Mime
View raw message