Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D1CA310273 for ; Wed, 31 Jul 2013 15:48:27 +0000 (UTC) Received: (qmail 53291 invoked by uid 500); 31 Jul 2013 15:48:27 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 53256 invoked by uid 500); 31 Jul 2013 15:48:26 -0000 Mailing-List: contact commits-help@curator.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.incubator.apache.org Delivered-To: mailing list commits@curator.incubator.apache.org Received: (qmail 53244 invoked by uid 99); 31 Jul 2013 15:48:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jul 2013 15:48:24 +0000 X-ASF-Spam-Status: No, hits=-2001.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 31 Jul 2013 15:48:20 +0000 Received: (qmail 53157 invoked by uid 99); 31 Jul 2013 15:47:59 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jul 2013 15:47:59 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B38F883185A; Wed, 31 Jul 2013 15:47:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: iocanel@apache.org To: commits@curator.incubator.apache.org Message-Id: <50bf7348a7944fd49f3eed0c640722d4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [CURATOR-2] Add PathUtils as part of curator client utils. Add OSGi metadata to curator artifacts. Date: Wed, 31 Jul 2013 15:47:59 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Updated Branches: refs/heads/master d90677f98 -> 55cab7af0 [CURATOR-2] Add PathUtils as part of curator client utils. Add OSGi metadata to curator artifacts. Project: http://git-wip-us.apache.org/repos/asf/incubator-curator/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-curator/commit/55cab7af Tree: http://git-wip-us.apache.org/repos/asf/incubator-curator/tree/55cab7af Diff: http://git-wip-us.apache.org/repos/asf/incubator-curator/diff/55cab7af Branch: refs/heads/master Commit: 55cab7af0415f0625664e310d4b878d632259b85 Parents: d90677f Author: Ioannis Canellos Authored: Wed Jul 31 11:10:09 2013 +0300 Committer: Ioannis Canellos Committed: Wed Jul 31 18:44:14 2013 +0300 ---------------------------------------------------------------------- curator-client/pom.xml | 10 ++ .../org/apache/curator/utils/PathUtils.java | 105 +++++++++++++++++++ .../java/org/apache/curator/utils/ZKPaths.java | 1 - curator-framework/pom.xml | 10 ++ .../curator/framework/imps/NamespaceImpl.java | 2 +- curator-recipes/pom.xml | 10 ++ .../framework/recipes/locks/LockInternals.java | 2 +- curator-x-discovery-server/pom.xml | 7 ++ curator-x-discovery/pom.xml | 10 ++ pom.xml | 44 ++++++++ 10 files changed, 198 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-client/pom.xml ---------------------------------------------------------------------- diff --git a/curator-client/pom.xml b/curator-client/pom.xml index 7b5069d..1ddbdfe 100644 --- a/curator-client/pom.xml +++ b/curator-client/pom.xml @@ -30,11 +30,21 @@ org.apache.curator curator-client 2.1.1-incubating-SNAPSHOT + bundle Curator Client Low-level API 2011 + + + * + + + org.apache.curator*;version="${project.version}";-noimport:=true + + + org.slf4j http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-client/src/main/java/org/apache/curator/utils/PathUtils.java ---------------------------------------------------------------------- diff --git a/curator-client/src/main/java/org/apache/curator/utils/PathUtils.java b/curator-client/src/main/java/org/apache/curator/utils/PathUtils.java new file mode 100644 index 0000000..c491874 --- /dev/null +++ b/curator-client/src/main/java/org/apache/curator/utils/PathUtils.java @@ -0,0 +1,105 @@ +/** + * 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.curator.utils; + +/** + * This class is copied from Apache ZooKeeper. + * The original class is not exported by ZooKeeper bundle and thus it can't be used in OSGi. + * See issue: https://issues.apache.org/jira/browse/ZOOKEEPER-1627 + * A temporary workaround till the issue is resolved is to keep a copy of this class locally. + */ +public class PathUtils { + + /** validate the provided znode path string + * @param path znode path string + * @param isSequential if the path is being created + * with a sequential flag + * @throws IllegalArgumentException if the path is invalid + */ + public static void validatePath(String path, boolean isSequential) + throws IllegalArgumentException { + validatePath(isSequential? path + "1": path); + } + + /** + * Validate the provided znode path string + * @param path znode path string + * @throws IllegalArgumentException if the path is invalid + */ + public static void validatePath(String path) throws IllegalArgumentException { + if (path == null) { + throw new IllegalArgumentException("Path cannot be null"); + } + if (path.length() == 0) { + throw new IllegalArgumentException("Path length must be > 0"); + } + if (path.charAt(0) != '/') { + throw new IllegalArgumentException( + "Path must start with / character"); + } + if (path.length() == 1) { // done checking - it's the root + return; + } + if (path.charAt(path.length() - 1) == '/') { + throw new IllegalArgumentException( + "Path must not end with / character"); + } + + String reason = null; + char lastc = '/'; + char chars[] = path.toCharArray(); + char c; + for (int i = 1; i < chars.length; lastc = chars[i], i++) { + c = chars[i]; + + if (c == 0) { + reason = "null character not allowed @" + i; + break; + } else if (c == '/' && lastc == '/') { + reason = "empty node name specified @" + i; + break; + } else if (c == '.' && lastc == '.') { + if (chars[i-2] == '/' && + ((i + 1 == chars.length) + || chars[i+1] == '/')) { + reason = "relative paths not allowed @" + i; + break; + } + } else if (c == '.') { + if (chars[i-1] == '/' && + ((i + 1 == chars.length) + || chars[i+1] == '/')) { + reason = "relative paths not allowed @" + i; + break; + } + } else if (c > '\u0000' && c < '\u001f' + || c > '\u007f' && c < '\u009F' + || c > '\ud800' && c < '\uf8ff' + || c > '\ufff0' && c < '\uffff') { + reason = "invalid charater @" + i; + break; + } + } + + if (reason != null) { + throw new IllegalArgumentException( + "Invalid path string \"" + path + "\" caused by " + reason); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java ---------------------------------------------------------------------- diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java index 40c5bd7..5f688fd 100644 --- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java +++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java @@ -23,7 +23,6 @@ import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.ZooKeeper; -import org.apache.zookeeper.common.PathUtils; import java.util.Collections; import java.util.List; http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-framework/pom.xml ---------------------------------------------------------------------- diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml index dbbaabd..1ceacb2 100644 --- a/curator-framework/pom.xml +++ b/curator-framework/pom.xml @@ -30,11 +30,21 @@ org.apache.curator curator-framework 2.1.1-incubating-SNAPSHOT + bundle Curator Framework High-level API that greatly simplifies using ZooKeeper. 2011 + + + * + + + org.apache.curator.framework*;version="${project.version}";-noimport:=true + + + org.apache.curator http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java index 23ea516..169ded5 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java @@ -20,7 +20,7 @@ package org.apache.curator.framework.imps; import org.apache.curator.utils.EnsurePath; import org.apache.curator.utils.ZKPaths; -import org.apache.zookeeper.common.PathUtils; +import org.apache.curator.utils.PathUtils; class NamespaceImpl { http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-recipes/pom.xml ---------------------------------------------------------------------- diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml index b4a9a21..6b5fef9 100644 --- a/curator-recipes/pom.xml +++ b/curator-recipes/pom.xml @@ -30,11 +30,21 @@ org.apache.curator curator-recipes 2.1.1-incubating-SNAPSHOT + bundle Curator Recipes All of the recipes listed on the ZooKeeper recipes doc (except two phase commit). 2011 + + + * + + + org.apache.curator.framework.recipes*;version="${project.version}";-noimport:=true + + + org.apache.curator http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java index 310701c..06a1f6b 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java @@ -31,7 +31,7 @@ import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; -import org.apache.zookeeper.common.PathUtils; +import org.apache.curator.utils.PathUtils; import org.apache.zookeeper.data.Stat; import java.util.Arrays; import java.util.Collection; http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-x-discovery-server/pom.xml ---------------------------------------------------------------------- diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index bffc3a1..fae8c86 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -30,6 +30,7 @@ org.apache.curator curator-x-discovery-server 2.1.1-incubating-SNAPSHOT + bundle Curator Service Discovery Server Bridges non-Java or legacy applications with the Curator Service Discovery. @@ -37,6 +38,12 @@ 1.11 + + * + + + org.apache.curator.x.discovery.server*;version="${project.version}";-noimport:=true + http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/curator-x-discovery/pom.xml ---------------------------------------------------------------------- diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml index 0286c80..4eb3e2b 100644 --- a/curator-x-discovery/pom.xml +++ b/curator-x-discovery/pom.xml @@ -30,11 +30,21 @@ org.apache.curator curator-x-discovery 2.1.1-incubating-SNAPSHOT + bundle Curator Service Discovery A service discovery recipe. 2011 + + + * + + + org.apache.curator.x.discovery*;version="${project.version}";-noimport:=true + + + org.apache.curator http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/55cab7af/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 53c0a7a..ef7ca38 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,15 @@ UTF-8 UTF-8 UTF-8 + + + + + + + + + @@ -364,6 +373,41 @@ 1.6 + + org.apache.felix + maven-bundle-plugin + 2.3.7 + true + true + + + ${project.name} + ${project.artifactId} + ${osgi.export.package} + ${osgi.import.package} + ${osgi.dynamic.import} + ${osgi.private.package} + ${osgi.require.bundle} + ${osgi.activator} + ${osgi.export.service} + + + jar + war + bundle + + true + + + + bundle-manifest + process-classes + + manifest + + + + org.apache.maven.plugins