Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7A750DB40 for ; Mon, 25 Feb 2013 00:59:21 +0000 (UTC) Received: (qmail 48711 invoked by uid 500); 25 Feb 2013 00:59:21 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 48675 invoked by uid 500); 25 Feb 2013 00:59:21 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 48667 invoked by uid 99); 25 Feb 2013 00:59:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Feb 2013 00:59:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Feb 2013 00:59:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F053C23888E7; Mon, 25 Feb 2013 00:59:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1449573 - in /accumulo/branches/1.5/core/src: main/java/org/apache/accumulo/core/data/Key.java test/java/org/apache/accumulo/core/data/KeyTest.java Date: Mon, 25 Feb 2013 00:59:00 -0000 To: commits@accumulo.apache.org From: elserj@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130225005900.F053C23888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elserj Date: Mon Feb 25 00:59:00 2013 New Revision: 1449573 URL: http://svn.apache.org/r1449573 Log: ACCUMULO-498 Applying patch to retrieve ColumnVisibility from a Key as a ColumnVisibility instead of only a Text. Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/data/Key.java accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/data/Key.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/data/Key.java?rev=1449573&r1=1449572&r2=1449573&view=diff ============================================================================== --- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/data/Key.java (original) +++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/data/Key.java Mon Feb 25 00:59:00 2013 @@ -478,6 +478,17 @@ public class Key implements WritableComp } /** + * This method creates a new ColumnVisibility representing the column visibility for this key + * + * WARNING: using this method may inhibit performance since a new ColumnVisibility object is created on every call. + * + * @return A new object representing the column visibility field + */ + public final ColumnVisibility getColumnVisibilityParsed() { + return new ColumnVisibility(colVisibility); + } + + /** * Sets this key's row, column family, column qualifier, column visibility, timestamp, and delete marker to be the same as another key's. */ public void set(Key k) { Modified: accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java?rev=1449573&r1=1449572&r2=1449573&view=diff ============================================================================== --- accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java (original) +++ accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java Mon Feb 25 00:59:00 2013 @@ -18,6 +18,7 @@ package org.apache.accumulo.core.data; import junit.framework.TestCase; +import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.hadoop.io.Text; public class KeyTest extends TestCase { @@ -97,4 +98,13 @@ public class KeyTest extends TestCase { Key k = new Key("r", "f", "q", "v"); assertEquals(k.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS).toString(), "r f:q [v%00;] " + Long.MAX_VALUE + " false"); } + + public void testVisibilityGetters() { + Key k = new Key("r", "f", "q", "v1|(v2&v3)"); + + Text expression = k.getColumnVisibility(); + ColumnVisibility parsed = k.getColumnVisibilityParsed(); + + assertEquals(expression, new Text(parsed.getExpression())); + } }