You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/07/12 22:42:51 UTC
svn commit: r963481 - in
/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction:
LongTransactionIdFactory.java StringTransactionIdFactory.java
TransactionId.java TransactionIdFactory.java
Author: mattmann
Date: Mon Jul 12 20:42:51 2010
New Revision: 963481
URL: http://svn.apache.org/viewvc?rev=963481&view=rev
Log:
- progress towards OODT-15 One trunk for all OODT components with top level build
Modified:
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/LongTransactionIdFactory.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/StringTransactionIdFactory.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionId.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionIdFactory.java
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/LongTransactionIdFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/LongTransactionIdFactory.java?rev=963481&r1=963480&r2=963481&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/LongTransactionIdFactory.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/LongTransactionIdFactory.java Mon Jul 12 20:42:51 2010
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -17,31 +17,38 @@
package org.apache.oodt.cas.catalog.struct.impl.transaction;
+//OODT imports
import org.apache.oodt.cas.catalog.struct.TransactionId;
import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
+/**
+ *
+ * Uses a Long representation of the current Time in miliseconds to represent a
+ * unique ID.
+ *
+ */
public class LongTransactionIdFactory implements TransactionIdFactory {
- public TransactionId<?> createNewTransactionId() {
- return new TransactionId<Long>(System.currentTimeMillis()) {
+ public TransactionId<?> createNewTransactionId() {
+ return new TransactionId<Long>(System.currentTimeMillis()) {
+
+ @Override
+ protected Long fromString(String stringId) {
+ return Long.parseLong(stringId);
+ }
+
+ };
+ }
+
+ public TransactionId<?> createTransactionId(String transactionIdString) {
+ return new TransactionId<Long>(transactionIdString) {
+
+ @Override
+ protected Long fromString(String stringId) {
+ return Long.parseLong(stringId);
+ }
- @Override
- protected Long fromString(String stringId) {
- return Long.parseLong(stringId);
- }
-
- };
- }
-
- public TransactionId<?> createTransactionId(String transactionIdString) {
- return new TransactionId<Long>(transactionIdString) {
-
- @Override
- protected Long fromString(String stringId) {
- return Long.parseLong(stringId);
- }
-
- };
- }
+ };
+ }
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/StringTransactionIdFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/StringTransactionIdFactory.java?rev=963481&r1=963480&r2=963481&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/StringTransactionIdFactory.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/StringTransactionIdFactory.java Mon Jul 12 20:42:51 2010
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -17,30 +17,37 @@
package org.apache.oodt.cas.catalog.struct.impl.transaction;
+//OODT imports
import org.apache.oodt.cas.catalog.struct.TransactionId;
import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
+/**
+ *
+ * Uses a String representation of the current Time in miliseconds to represent a
+ * unique ID.
+ *
+ */
public class StringTransactionIdFactory implements TransactionIdFactory {
- public TransactionId<String> createNewTransactionId() {
- return new StringTransactionId(Long.toString(System.currentTimeMillis()));
- }
-
- public TransactionId<?> createTransactionId(String transactionIdString) {
- return new StringTransactionId(transactionIdString);
- }
-
- private class StringTransactionId extends TransactionId<String> {
-
- public StringTransactionId(String stringValue) {
- this.nativeId = stringValue;
- }
-
- @Override
- protected String fromString(String stringId) {
- return stringId;
- }
-
- }
+ public TransactionId<String> createNewTransactionId() {
+ return new StringTransactionId(Long.toString(System.currentTimeMillis()));
+ }
+
+ public TransactionId<?> createTransactionId(String transactionIdString) {
+ return new StringTransactionId(transactionIdString);
+ }
+
+ private class StringTransactionId extends TransactionId<String> {
+
+ public StringTransactionId(String stringValue) {
+ this.nativeId = stringValue;
+ }
+
+ @Override
+ protected String fromString(String stringId) {
+ return stringId;
+ }
+
+ }
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionId.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionId.java?rev=963481&r1=963480&r2=963481&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionId.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionId.java Mon Jul 12 20:42:51 2010
@@ -18,55 +18,51 @@
package org.apache.oodt.cas.catalog.struct;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Interface for storing TransactionIds
- * <p>
+ * An abstract base class for storing identifiers associated with a Catalog
+ * transaction.
*/
public abstract class TransactionId<NativeType> {
- protected NativeType nativeId;
-
- public TransactionId() {}
-
- public TransactionId(NativeType nativeId) {
- this.nativeId = nativeId;
- }
-
- public TransactionId(String stringId) {
- this.nativeId = this.fromString(stringId);
- }
-
- @Override
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- public NativeType getNativeId() {
- return this.nativeId;
- }
-
- /**
- * Should override this method if NativeType.toString()
- * does not properly represent the String value of the
- * native type. The string value of the NativeType should
- * be as unique as in its native form.
- */
- public String toString() {
- return this.nativeId.toString();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof TransactionId<?>)
- return this.toString().equals(obj.toString());
- else if (obj instanceof String)
- return this.toString().equals((String) obj);
- else
- return false;
- }
-
- protected abstract NativeType fromString(String stringId);
-
+ protected NativeType nativeId;
+
+ public TransactionId() {
+ }
+
+ public TransactionId(NativeType nativeId) {
+ this.nativeId = nativeId;
+ }
+
+ public TransactionId(String stringId) {
+ this.nativeId = this.fromString(stringId);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+
+ public NativeType getNativeId() {
+ return this.nativeId;
+ }
+
+ /**
+ * Should override this method if NativeType.toString() does not properly
+ * represent the String value of the native type. The string value of the
+ * NativeType should be as unique as in its native form.
+ */
+ public String toString() {
+ return this.nativeId.toString();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TransactionId<?>)
+ return this.toString().equals(obj.toString());
+ else if (obj instanceof String)
+ return this.toString().equals((String) obj);
+ else
+ return false;
+ }
+
+ protected abstract NativeType fromString(String stringId);
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionIdFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionIdFactory.java?rev=963481&r1=963480&r2=963481&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionIdFactory.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/transaction/TransactionIdFactory.java Mon Jul 12 20:42:51 2010
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -17,10 +17,15 @@
package org.apache.oodt.cas.catalog.struct;
+/**
+ *
+ * Creates Transaction IDs.
+ *
+ */
public interface TransactionIdFactory {
- public TransactionId<?> createNewTransactionId();
-
- public TransactionId<?> createTransactionId(String transactionIdString);
-
+ public TransactionId<?> createNewTransactionId();
+
+ public TransactionId<?> createTransactionId(String transactionIdString);
+
}