Permalink
Browse files

Ability to jump to a specific row number (con.)

  • Loading branch information...
1 parent 053d457 commit cfb2014e95d27eab5ceaee29ac3935a8ae78dee4 Igor Cher committed Dec 12, 2012
Showing with 59 additions and 40 deletions.
  1. +3 −0 .gitignore
  2. +40 −29 pom.xml
  3. +7 −4 src/main/java/hrider/hbase/Scanner.java
  4. +9 −7 src/main/java/hrider/ui/views/DesignerView.java
View
@@ -36,6 +36,9 @@ target/
.idea/
*.iml
+# project specific
+config.properties
+
#################
## Visual Studio
#################
View
@@ -10,7 +10,7 @@
<description>hbase viewer and editor</description>
<packaging>jar</packaging>
- <version>1.0.0.0</version>
+ <version>1.0.0.1</version>
<properties>
<hbase.version>0.90.4</hbase.version>
</properties>
@@ -23,22 +23,22 @@
</repository>
</repositories>
- <profiles>
- <profile>
- <id>cdh4</id>
- <properties>
- <hadoop.version>2.0.0-cdh4.1.2</hadoop.version>
- <hbase.version>0.92.1-cdh4.1.2</hbase.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <version>${hadoop.version}</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
+ <!--<profiles>-->
+ <!--<profile>-->
+ <!--<id>cdh4</id>-->
+ <!--<properties>-->
+ <!--<hadoop.version>2.0.0-cdh4.1.2</hadoop.version>-->
+ <!--<hbase.version>0.92.1-cdh4.1.2</hbase.version>-->
+ <!--</properties>-->
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.hadoop</groupId>-->
+ <!--<artifactId>hadoop-client</artifactId>-->
+ <!--<version>${hadoop.version}</version>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
+ <!--</profile>-->
+ <!--</profiles>-->
<dependencies>
<dependency>
@@ -69,23 +69,34 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.5</version>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>com.ccih.categories.services.ServiceLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.5.1</version>
<executions>
<execution>
- <id>exec-shade</id>
+ <id>copy-dependencies</id>
<phase>package</phase>
<goals>
- <goal>shade</goal>
+ <goal>copy-dependencies</goal>
</goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
</execution>
</executions>
- <configuration>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <!-- Main class -->
- </transformer>
- </transformers>
- </configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -124,8 +135,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
</plugins>
@@ -230,9 +230,14 @@ public void resetCurrent(TypedObject startKey) {
this.current.size() != rowsNumber ||
this.current.size() + offset != this.lastRow) {
+ // offset should start from 1.
+ if (offset == 0) {
+ offset++;
+ }
+
this.markers.clear();
this.current = next(offset - 1, rowsNumber);
- this.lastRow = offset + this.current.size();
+ this.lastRow = offset + this.current.size() - 1;
}
return this.current;
}
@@ -334,8 +339,7 @@ protected boolean isValidRow(Result row) {
* @return A key of the last loaded row. Used to mark the current position for the next scan.
* @throws IOException Error accessing hbase.
*/
- protected TypedObject loadRows(ResultScanner scanner, long offset, int rowsNumber, Collection<DataRow> rows, Collection<String> columns) throws
- IOException {
+ protected TypedObject loadRows(ResultScanner scanner, long offset, int rowsNumber, Collection<DataRow> rows, Collection<String> columns) throws IOException {
ObjectType keyType = this.columnTypes.get("key");
int index = 0;
@@ -433,7 +437,6 @@ protected TypedObject loadRows(ResultScanner scanner, long offset, int rowsNumbe
Scan scan = getScanner();
scan.setCaching(itemsNumber);
- scan.setBatch(itemsNumber);
if (!this.markers.isEmpty()) {
scan.setStartRow(peekMarker().key.toByteArray());
@@ -203,15 +203,17 @@ public void actionPerformed(ActionEvent e) {
String rowNumber = JOptionPane.showInputDialog(
DesignerView.this.topPanel, "Row number:", "Jump to specific row", JOptionPane.PLAIN_MESSAGE);
- try {
- long offset = Long.parseLong(rowNumber);
+ if (rowNumber != null) {
+ try {
+ long offset = Long.parseLong(rowNumber);
- DesignerView.this.lastQuery = null;
+ DesignerView.this.lastQuery = null;
- populateRowsTable(offset, Direction.Current);
- }
- catch (NumberFormatException ignore) {
- JOptionPane.showMessageDialog(DesignerView.this.topPanel, "Row number must be a number.", "Error", JOptionPane.ERROR_MESSAGE);
+ populateRowsTable(offset, Direction.Current);
+ }
+ catch (NumberFormatException ignore) {
+ JOptionPane.showMessageDialog(DesignerView.this.topPanel, "Row number must be a number.", "Error", JOptionPane.ERROR_MESSAGE);
+ }
}
}
});

0 comments on commit cfb2014

Please sign in to comment.