Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletClientService.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletClientService.java?rev=1467287&r1=1467286&r2=1467287&view=diff ============================================================================== --- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletClientService.java (original) +++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletClientService.java Fri Apr 12 14:37:09 2013 @@ -1,3 +1,19 @@ +/* + * 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. + */ /** * Autogenerated by Thrift * @@ -2863,7 +2879,7 @@ import org.slf4j.LoggerFactory; public boolean isolated; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)11, "tinfo"), CREDENTIALS((short)1, "credentials"), EXTENT((short)2, "extent"), @@ -4223,7 +4239,7 @@ import org.slf4j.LoggerFactory; public TooManyFilesException tmfe; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"), NSTE((short)2, "nste"), @@ -4783,7 +4799,7 @@ import org.slf4j.LoggerFactory; public long scanID; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), SCAN_ID((short)1, "scanID"); @@ -5174,7 +5190,7 @@ import org.slf4j.LoggerFactory; public TooManyFilesException tmfe; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), NSSI((short)1, "nssi"), NSTE((short)2, "nste"), @@ -5734,7 +5750,7 @@ import org.slf4j.LoggerFactory; public long scanID; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), SCAN_ID((short)1, "scanID"); @@ -6133,7 +6149,7 @@ import org.slf4j.LoggerFactory; public boolean waitForWrites; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)8, "tinfo"), CREDENTIALS((short)1, "credentials"), BATCH((short)2, "batch"), @@ -7286,7 +7302,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -7672,7 +7688,7 @@ import org.slf4j.LoggerFactory; public long scanID; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), SCAN_ID((short)1, "scanID"); @@ -8059,7 +8075,7 @@ import org.slf4j.LoggerFactory; public NoSuchScanIDException nssi; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), NSSI((short)1, "nssi"); @@ -8445,7 +8461,7 @@ import org.slf4j.LoggerFactory; public long scanID; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), SCAN_ID((short)1, "scanID"); @@ -8830,7 +8846,7 @@ import org.slf4j.LoggerFactory; public NoSuchScanIDException nssi; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { NSSI((short)1, "nssi"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -9129,7 +9145,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.AuthInfo credentials; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), CREDENTIALS((short)1, "credentials"); @@ -9517,7 +9533,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -9906,7 +9922,7 @@ import org.slf4j.LoggerFactory; public List<org.apache.accumulo.core.data.thrift.TMutation> mutations; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)1, "tinfo"), UPDATE_ID((short)2, "updateID"), KEY_EXTENT((short)3, "keyExtent"), @@ -10506,7 +10522,7 @@ import org.slf4j.LoggerFactory; public long updateID; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), UPDATE_ID((short)1, "updateID"); @@ -10893,7 +10909,7 @@ import org.slf4j.LoggerFactory; public NoSuchScanIDException nssi; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), NSSI((short)1, "nssi"); @@ -11283,7 +11299,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.data.thrift.TMutation mutation; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)4, "tinfo"), CREDENTIALS((short)1, "credentials"), KEY_EXTENT((short)2, "keyExtent"), @@ -11849,7 +11865,7 @@ import org.slf4j.LoggerFactory; public ConstraintViolationException cve; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SEC((short)1, "sec"), NSTE((short)2, "nste"), CVE((short)3, "cve"); @@ -12328,7 +12344,7 @@ import org.slf4j.LoggerFactory; public boolean setTime; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"), TID((short)4, "tid"), @@ -13025,7 +13041,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -13452,7 +13468,7 @@ import org.slf4j.LoggerFactory; public ByteBuffer splitPoint; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)4, "tinfo"), CREDENTIALS((short)1, "credentials"), EXTENT((short)2, "extent"), @@ -14026,7 +14042,7 @@ import org.slf4j.LoggerFactory; public NotServingTabletException nste; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SEC((short)1, "sec"), NSTE((short)2, "nste"); @@ -14416,7 +14432,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.data.thrift.TKeyExtent extent; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)5, "tinfo"), CREDENTIALS((short)1, "credentials"), LOCK((short)4, "lock"), @@ -14985,7 +15001,7 @@ import org.slf4j.LoggerFactory; public boolean save; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)5, "tinfo"), CREDENTIALS((short)1, "credentials"), LOCK((short)4, "lock"), @@ -15643,7 +15659,7 @@ import org.slf4j.LoggerFactory; public ByteBuffer endRow; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)4, "tinfo"), CREDENTIALS((short)1, "credentials"), LOCK((short)3, "lock"), @@ -16405,7 +16421,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.data.thrift.TKeyExtent extent; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)1, "tinfo"), CREDENTIALS((short)2, "credentials"), LOCK((short)3, "lock"), @@ -16972,7 +16988,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.data.thrift.TKeyExtent extent; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)1, "tinfo"), CREDENTIALS((short)2, "credentials"), LOCK((short)3, "lock"), @@ -17543,7 +17559,7 @@ import org.slf4j.LoggerFactory; public ByteBuffer endRow; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)1, "tinfo"), CREDENTIALS((short)2, "credentials"), LOCK((short)3, "lock"), @@ -18303,7 +18319,7 @@ import org.slf4j.LoggerFactory; public Set<String> loggers; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"), LOGGERS((short)2, "loggers"); @@ -18815,7 +18831,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.AuthInfo credentials; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"); @@ -19203,7 +19219,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -19591,7 +19607,7 @@ import org.slf4j.LoggerFactory; public String tableId; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"), TABLE_ID((short)2, "tableId"); @@ -20066,7 +20082,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -20489,7 +20505,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.AuthInfo credentials; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), CREDENTIALS((short)1, "credentials"); @@ -20877,7 +20893,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec"); @@ -21265,7 +21281,7 @@ import org.slf4j.LoggerFactory; public String lock; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"), LOCK((short)2, "lock"); @@ -21738,7 +21754,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SEC((short)1, "sec"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -22039,7 +22055,7 @@ import org.slf4j.LoggerFactory; public String lock; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)3, "tinfo"), CREDENTIALS((short)1, "credentials"), LOCK((short)2, "lock"); @@ -22514,7 +22530,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.AuthInfo credentials; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TINFO((short)2, "tinfo"), CREDENTIALS((short)1, "credentials"); @@ -22902,7 +22918,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.security.thrift.ThriftSecurityException sec; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUCCESS((short)0, "success"), SEC((short)1, "sec");
Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletMutations.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletMutations.java?rev=1467287&r1=1467286&r2=1467287&view=diff ============================================================================== --- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletMutations.java (original) +++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletMutations.java Fri Apr 12 14:37:09 2013 @@ -1,3 +1,19 @@ +/* + * 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. + */ /** * Autogenerated by Thrift * @@ -32,7 +48,7 @@ import org.slf4j.LoggerFactory; public List<org.apache.accumulo.core.data.thrift.TMutation> mutations; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { TABLET_ID((short)1, "tabletID"), SEQ((short)2, "seq"), MUTATIONS((short)3, "mutations"); Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletStats.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletStats.java?rev=1467287&r1=1467286&r2=1467287&view=diff ============================================================================== --- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletStats.java (original) +++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletStats.java Fri Apr 12 14:37:09 2013 @@ -1,3 +1,19 @@ +/* + * 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. + */ /** * Autogenerated by Thrift * @@ -42,7 +58,7 @@ import org.slf4j.LoggerFactory; public long splitCreationTime; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { EXTENT((short)1, "extent"), MAJOR((short)2, "major"), MINOR((short)3, "minor"), Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TooManyFilesException.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TooManyFilesException.java?rev=1467287&r1=1467286&r2=1467287&view=diff ============================================================================== --- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TooManyFilesException.java (original) +++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TooManyFilesException.java Fri Apr 12 14:37:09 2013 @@ -1,3 +1,19 @@ +/* + * 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. + */ /** * Autogenerated by Thrift * @@ -28,7 +44,7 @@ import org.slf4j.LoggerFactory; public org.apache.accumulo.core.data.thrift.TKeyExtent extent; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { EXTENT((short)1, "extent"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); Modified: accumulo/branches/1.4/src/core/src/main/thrift/thrift.sh URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/thrift/thrift.sh?rev=1467287&r1=1467286&r2=1467287&view=diff ============================================================================== --- accumulo/branches/1.4/src/core/src/main/thrift/thrift.sh (original) +++ accumulo/branches/1.4/src/core/src/main/thrift/thrift.sh Fri Apr 12 14:37:09 2013 @@ -15,44 +15,96 @@ # See the License for the specific language governing permissions and # limitations under the License. +# This script will regenerate the thrift code for Accumulo's RPC mechanisms. + +# NOTES: +# To support this script being called by other modules, only edit the right side. +# In other scripts, set the variables that diverge from the defaults below, then call this script. +# PACKAGES_TO_GENERATE should be an array, and each element should be the portion of the dot-separated Java package +# name following the BASE_OUTPUT_PACKAGE +# Leave the BUILD_DIR and FINAL_DIR alone for Maven builds. +# INCLUDED_MODULES should be an array that includes other Maven modules with src/main/thrift directories +# Use INCLUDED_MODULES=(-) in calling scripts that require no other modules +# ======================================================================================================================== +[ -z $REQUIRED_THRIFT_VERSION ] && REQUIRED_THRIFT_VERSION='0.6' +[ -z $INCLUDED_MODULES ] && INCLUDED_MODULES=(../trace) +[ -z $BASE_OUTPUT_PACKAGE ] && BASE_OUTPUT_PACKAGE='org.apache.accumulo.core' +[ -z $PACKAGES_TO_GENERATE ] && PACKAGES_TO_GENERATE=(gc master tabletserver security client.impl data) +[ -z $BUILD_DIR ] && BUILD_DIR='target' +[ -z $FINAL_DIR ] && FINAL_DIR='src/main/java' +# ======================================================================================================================== fail() { - echo $@ - exit 1 + echo $@ + exit 1 } -# test to see if we have thrift installed -VERSION=`thrift -version 2>/dev/null | grep "0.6" | wc -l` -if [ "$VERSION" -ne 1 ] ; then - # Nope: bail - echo "thrift is not available" - exit 0 +# Test to see if we have thrift installed +VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" | wc -l) +if [ "$VERSION" -ne 1 ] ; then + # Nope: bail + echo "****************************************************" + echo "*** thrift is not available" + echo "*** expecting 'thrift -version' to return ${REQUIRED_THRIFT_VERSION}" + echo "*** generated code will not be updated" + echo "****************************************************" + exit 0 fi -CLOUDTRACE=../trace -test -d ${CLOUDTRACE} || ( echo 'need to configure cloudtrace' ; exit 0 ) -THRIFT_ARGS="-I $CLOUDTRACE/src/main/thrift -o target " +# Include thrift sources from additional modules +THRIFT_ARGS='' +for i in "${INCLUDED_MODULES[@]}"; do + if [ ${i} != '-' ]; then + test -d ${i} || fail missing required included module ${i} + THRIFT_ARGS="${THRIFT_ARGS} -I ${i}/src/main/thrift" + fi +done -mkdir -p target -rm -rf target/gen-java -for f in src/main/thrift/*.thrift -do - thrift ${THRIFT_ARGS} --gen java $f || fail unable to generate java thrift classes - thrift ${THRIFT_ARGS} --gen py $f || fail unable to generate python thrift classes - thrift ${THRIFT_ARGS} --gen rb $f || fail unable to generate ruby thrift classes +# Ensure output directories are created +THRIFT_ARGS="${THRIFT_ARGS} -o $BUILD_DIR" +mkdir -p $BUILD_DIR +rm -rf $BUILD_DIR/gen-java +for f in src/main/thrift/*.thrift; do + thrift ${THRIFT_ARGS} --gen java $f || fail unable to generate java thrift classes + thrift ${THRIFT_ARGS} --gen py $f || fail unable to generate python thrift classes + thrift ${THRIFT_ARGS} --gen rb $f || fail unable to generate ruby thrift classes + thrift ${THRIFT_ARGS} --gen cpp $f || fail unable to generate cpp thrift classes done -find target/gen-java -name '*.java' -print | xargs sed -i.orig -e 's/public class /@SuppressWarnings("all") public class /' -find target/gen-java -name '*.orig' -print | xargs rm -f -# copy only files that have changed -for d in gc master tabletserver security client/impl data -do - mkdir -p src/main/java/org/apache/accumulo/core/$d/thrift >& /dev/null - for f in target/gen-java/org/apache/accumulo/core/$d/thrift/* - do - DEST="src/main/java/org/apache/accumulo/core/$d/thrift/`basename $f`" - if ! cmp -s ${f} ${DEST} ; then - echo cp ${f} ${DEST} - cp ${f} ${DEST} || fail unable to copy files to java workspace - fi - done + +# For all generated thrift code, suppress all warnings and add the LICENSE header +find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public class /@SuppressWarnings("all") public class /' +find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public enum /@SuppressWarnings("all") public enum /' +for f in $(find $BUILD_DIR/gen-java -name '*.java'); do + cat - $f >${f}-with-license <<EOF +/* + * 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. + */ +EOF +done + +# For every generated java file, compare it with the version-controlled one, and copy the ones that have changed into place +for d in "${PACKAGES_TO_GENERATE[@]}"; do + SDIR="${BUILD_DIR}/gen-java/${BASE_OUTPUT_PACKAGE//.//}/${d//.//}/thrift" + DDIR="${FINAL_DIR}/${BASE_OUTPUT_PACKAGE//.//}/${d//.//}/thrift" + mkdir -p "$DDIR" + for f in "$SDIR"/*.java; do + DEST="$DDIR/`basename $f`" + if ! cmp -s "${f}-with-license" "${DEST}" ; then + echo cp -f "${f}-with-license" "${DEST}" + cp -f "${f}-with-license" "${DEST}" || fail unable to copy files to java workspace + fi + done done Propchange: accumulo/branches/1.4/src/proxy/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Apr 12 14:37:09 2013 @@ -0,0 +1 @@ +target Added: accumulo/branches/1.4/src/proxy/README URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/README?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/README (added) +++ accumulo/branches/1.4/src/proxy/README Fri Apr 12 14:37:09 2013 @@ -0,0 +1,48 @@ +Title: Apache Accumulo Proxy +Notice: 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. + +This is a thrift proxy server to interact with the Accumulo database. + +1. Building + +To compile, you must first install Thrift 0.6.1. + +After thrift is installed, compile the project with: +mvn clean install +This will compile the thrift and java files, and will provide C++, python and ruby bindings. + +2. Proxy Server Execution + +Please note that the proxy can only function correctly when connected to an Accumulo 1.4 instance, or when run standalone in the Mock configuration. +To run the server, edit the configuration file with parameters suited for your Accumulo installation. If you wish to instead use an in-memory Mock instance, set: +org.apache.accumulo.proxy.ProxyServer.useMockInstance=true +This option will override any "real" Accumulo instance information. + +Once the properties file is configured correctly, run this command: +./bin/accumulo proxy -p proxy/proxy.properties + +3. Clients + +An example java client is incuded with this distribution in the class TestProxyClient. Also the unit tests included show how to use the proxy. Normal Accumulo APIs are emulated whereever possible. + +Additional client examples can be found in the examples directory. These clients are tested and function, however, the setup for each language is beyond the scope of this document currently. + +In general, to create a client for a new language one must compile the proxy.thrift API (along with the accumulo core data.thrift API) to the language of choice. +Then one includes the resulting generated code along with the thrift core library for that language to use the proxy. + +As a note, many of the clients here assume "secret" is your root password. Protip: to make the examples work, change this code to your password, do not change your root password to "secret". Propchange: accumulo/branches/1.4/src/proxy/README ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/examples/python/README URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/examples/python/README?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/examples/python/README (added) +++ accumulo/branches/1.4/src/proxy/examples/python/README Fri Apr 12 14:37:09 2013 @@ -0,0 +1,24 @@ +Title: Apache Accumulo Python Example +Notice: 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. + +This is an example python client for the accumulo proxy. After launching the proxy server, You should be able to run it by typing: + + +PYTHONPATH=path/to/generated/api:path/to/thrift/libs python TestClient.py + +As a warning, this script will create a table in your accumulo instance and add a few cells to it. Propchange: accumulo/branches/1.4/src/proxy/examples/python/README ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/examples/python/TestClient.py URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/examples/python/TestClient.py?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/examples/python/TestClient.py (added) +++ accumulo/branches/1.4/src/proxy/examples/python/TestClient.py Fri Apr 12 14:37:09 2013 @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# 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 sys + +from thrift import Thrift +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TCompactProtocol + +from proxy import AccumuloProxy +from proxy.ttypes import * + +transport = TSocket.TSocket('localhost', 42424) +transport = TTransport.TFramedTransport(transport) +protocol = TCompactProtocol.TCompactProtocol(transport) +client = AccumuloProxy.Client(protocol) +transport.open() + +login = client.login('root', {'password':'secret'}) + +print client.listTables(login) + +testtable = "pythontest" +if not client.tableExists(login, testtable): + client.createTable(login, testtable, True, TimeType.MILLIS) + +row1 = {'a':[ColumnUpdate('a','a',value='value1'), ColumnUpdate('b','b',value='value2')]} +client.updateAndFlush(login, testtable, row1) + +cookie = client.createScanner(login, testtable, None) +for entry in client.nextK(cookie, 10).results: + print entry Propchange: accumulo/branches/1.4/src/proxy/examples/python/TestClient.py ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/examples/ruby/README URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/examples/ruby/README?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/examples/ruby/README (added) +++ accumulo/branches/1.4/src/proxy/examples/ruby/README Fri Apr 12 14:37:09 2013 @@ -0,0 +1,26 @@ +Title: Apache Accumulo Ruby Example +Notice: 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. + +This directory contains the compiled thrift Accumulo proxy API and an example client for ruby. + +To run this script, type the following: +ruby -I . test_client.rb <host of server> + +(the -I option is needed for ruby 1.9.x) + +Warning: the script as it is will attempt to connect to your accumulo instance, create a table, and add some rows to it. Propchange: accumulo/branches/1.4/src/proxy/examples/ruby/README ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/examples/ruby/test_client.rb URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/examples/ruby/test_client.rb?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/examples/ruby/test_client.rb (added) +++ accumulo/branches/1.4/src/proxy/examples/ruby/test_client.rb Fri Apr 12 14:37:09 2013 @@ -0,0 +1,48 @@ + +# 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. + +require 'rubygems' +require 'thrift' +require 'accumulo_proxy' + +server = ARGV[0] || 'localhost' + +socket = Thrift::Socket.new(server, 42424, 9001) +transport = Thrift::FramedTransport.new(socket) +proto = Thrift::CompactProtocol.new(transport) +proxy = AccumuloProxy::Client.new(proto) + +# open up the connect +transport.open() + +# Test if the server is up +login = proxy.login('root', {'password' => 'secret'}) + +# print out a table list +puts "List of tables: #{proxy.listTables(login).inspect}" + +testtable = "rubytest" +proxy.createTable(login, testtable, true, TimeType::MILLIS) unless proxy.tableExists(login,testtable) + +update1 = ColumnUpdate.new({'colFamily' => "cf1", 'colQualifier' => "cq1", 'value'=> "a"}) +update2 = ColumnUpdate.new({'colFamily' => "cf2", 'colQualifier' => "cq2", 'value'=> "b"}) +proxy.updateAndFlush(login,testtable,{'row1' => [update1,update2]}) + +cookie = proxy.createScanner(login,testtable,nil) +result = proxy.nextK(cookie,10) +result.results.each{ |keyvalue| puts "Key: #{keyvalue.key.inspect} Value: #{keyvalue.value}" } + +transport.close() Propchange: accumulo/branches/1.4/src/proxy/examples/ruby/test_client.rb ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/pom.xml URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/pom.xml?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/pom.xml (added) +++ accumulo/branches/1.4/src/proxy/pom.xml Fri Apr 12 14:37:09 2013 @@ -0,0 +1,123 @@ +<?xml version="1.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. +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>accumulo</artifactId> + <groupId>org.apache.accumulo</groupId> + <version>1.4.4-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> + <artifactId>accumulo-proxy</artifactId> + <name>Proxy</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestSections> + <manifestSection> + <name>accumulo/proxy/</name> + <manifestEntries> + <Sealed>true</Sealed> + </manifestEntries> + </manifestSection> + </manifestSections> + </archive> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-thrift</id> + <phase>generate-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>${basedir}/src/main/scripts/generate-thrift.sh</executable> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-core</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-core</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>zookeeper</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>13.0.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>examples-simple</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-server</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> Propchange: accumulo/branches/1.4/src/proxy/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/proxy.properties URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/proxy.properties?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/proxy.properties (added) +++ accumulo/branches/1.4/src/proxy/proxy.properties Fri Apr 12 14:37:09 2013 @@ -0,0 +1,7 @@ +org.apache.accumulo.proxy.ProxyServer.useMockInstance=false +org.apache.accumulo.proxy.ProxyServer.protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory +org.apache.accumulo.proxy.ProxyServer.port=42424 + +org.apache.accumulo.proxy.ProxyServer.instancename=test +org.apache.accumulo.proxy.ProxyServer.zookeepers=localhost:2181 + Propchange: accumulo/branches/1.4/src/proxy/proxy.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/CredentialHelper.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/CredentialHelper.java?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/CredentialHelper.java (added) +++ accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/CredentialHelper.java Fri Apr 12 14:37:09 2013 @@ -0,0 +1,52 @@ +/* + * 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.accumulo.proxy; + +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.security.thrift.AuthInfo; +import org.apache.accumulo.core.security.thrift.SecurityErrorCode; +import org.apache.thrift.TDeserializer; +import org.apache.thrift.TException; +import org.apache.thrift.TSerializer; + +public class CredentialHelper { + + public static byte[] asByteArray(AuthInfo cred) throws AccumuloSecurityException { + TSerializer ts = new TSerializer(); + try { + return ts.serialize(cred); + } catch (TException e) { + // This really shouldn't happen + throw new AccumuloSecurityException(cred.getUser(), SecurityErrorCode.DEFAULT_SECURITY_ERROR, e); + } + } + + public static AuthInfo fromByteArray(byte[] serializedCredential) throws AccumuloSecurityException { + if (serializedCredential == null) + return null; + TDeserializer td = new TDeserializer(); + try { + AuthInfo toRet = new AuthInfo(); + td.deserialize(toRet, serializedCredential); + return toRet; + } catch (TException e) { + // This really shouldn't happen + throw new AccumuloSecurityException("unknown", SecurityErrorCode.DEFAULT_SECURITY_ERROR, e); + } + } + +} Propchange: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/CredentialHelper.java ------------------------------------------------------------------------------ svn:eol-style = native Added: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java?rev=1467287&view=auto ============================================================================== --- accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java (added) +++ accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java Fri Apr 12 14:37:09 2013 @@ -0,0 +1,89 @@ +/* + * 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.accumulo.proxy; + +import org.apache.accumulo.proxy.thrift.AccumuloProxy; +import org.apache.log4j.Logger; +import org.apache.thrift.TProcessor; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.Properties; + +public class Proxy { + + private static final Logger log = Logger.getLogger(Proxy.class); + + public static void main(String[] args) throws Exception { + String api = ProxyServer.class.getName(); + + if(args.length != 2 || !args[0].equals("-p")) { + + System.err.println("Missing '-p' option with a valid property file"); + System.exit(1); + } + Properties props = new Properties(); + try { + FileInputStream is = new FileInputStream(new File(args[1])); + props.load(is); + is.close(); + } catch(IOException e) { + + System.err.println("There was an error opening the property file"); + System.exit(1); + + } + + if (!props.containsKey(api + ".port")) { + System.err.println("No port in the " + api + ".port property"); + System.exit(1); + } + + Class<? extends TProtocolFactory> protoFactoryClass = Class.forName(props.getProperty(api + ".protocolFactory")).asSubclass(TProtocolFactory.class); + int port = Integer.parseInt(props.getProperty(api + ".port")); + TServer server = createProxyServer(AccumuloProxy.class, ProxyServer.class, port, protoFactoryClass, props); + server.serve(); + } + + public static TServer createProxyServer(Class<?> api, Class<?> implementor, final int port, Class<? extends TProtocolFactory> protoClass, + Properties properties) throws Exception { + final TNonblockingServerSocket socket = new TNonblockingServerSocket(port); + + // create the implementor + Object impl = implementor.getConstructor(Properties.class).newInstance(properties); + + Class<?> proxyProcClass = Class.forName(api.getName() + "$Processor"); + Class<?> proxyIfaceClass = Class.forName(api.getName() + "$Iface"); + @SuppressWarnings("unchecked") + Constructor<? extends TProcessor> proxyProcConstructor = (Constructor<? extends TProcessor>) proxyProcClass.getConstructor(proxyIfaceClass); + + final TProcessor processor = proxyProcConstructor.newInstance(impl); + + THsHaServer.Args args = new THsHaServer.Args(socket); + args.processor(processor); + args.transportFactory(new TFramedTransport.Factory()); + args.protocolFactory(protoClass.newInstance()); + return new THsHaServer(args); + } +} Propchange: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java ------------------------------------------------------------------------------ svn:eol-style = native
