garydgregory commented on a change in pull request #85: URL: https://github.com/apache/commons-vfs/pull/85#discussion_r422187511
########## File path: commons-vfs2-zookeeper/src/main/java/org/apache/commons/vfs2/provider/zookeeper/ZkFileSystemConfigBuilder.java ########## @@ -0,0 +1,179 @@ +/* + * 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.commons.vfs2.provider.zookeeper; + +import org.apache.commons.vfs2.FileSystem; +import org.apache.commons.vfs2.FileSystemConfigBuilder; +import org.apache.commons.vfs2.FileSystemOptions; +import org.apache.curator.RetryPolicy; +import org.apache.curator.framework.CuratorFramework; +import org.apache.curator.retry.ExponentialBackoffRetry; + +/** + * Configuration options for Apache Zookeeper. + * @since 2.7.0 + */ +public class ZkFileSystemConfigBuilder extends FileSystemConfigBuilder { + protected static final String KEY_CONFIGURED_FRAMEWORK = "framework"; + protected static final String KEY_ZK_CONNECTION_STRING = "connectionString"; + protected static final String KEY_RETRY_TIMEOUT = "retryTimeout"; + protected static final String KEY_RETRY_RETRIES = "retries"; + protected static final String KEY_RETRY_POLICY = "retryPolicy"; + protected static final String KEY_CONNECTION_TIMEOUT = "connectionTimeout"; + protected static final String KEY_SESSION_TIMEOUT = "sessionTimeout"; + protected static final String KEY_NAMESPACE = "zkNamespace"; + protected static final String KEY_AUTH_SCHEME = "zkAuthScheme"; + protected static final String KEY_AUTH_BYTES = "zkAuthBytes"; + protected static final String KEY_OWNS_CLIENT = "ownsClientFlag"; + + private static final int DEFAULT_RETRY_TIMOUT = 1000; + private static final int DEFAULT_RETRY_RETRIES = 3; + private static final int DEFAULT_CONNECTION_TIMEOUT = 1000; + private static final int DEFAULT_SESSION_TIMEOUT = 5000; + private static final String DEFAULT_ZK_CONNECTION_STRING = "localhost:2180"; + + private static final ZkFileSystemConfigBuilder BUILDER = + new ZkFileSystemConfigBuilder(); + + private ZkFileSystemConfigBuilder() { + super("zk."); + } + + public static ZkFileSystemConfigBuilder getInstance() { + return BUILDER; + } + + public CuratorFramework getCuratorFramework(final FileSystemOptions opts) { Review comment: Please add Javadoc comments to public elements. ########## File path: commons-vfs2/src/test/java/org/apache/commons/vfs2/test/FileInfo.java ########## @@ -74,6 +74,18 @@ public FileInfo addFolder(final String baseName) { return child; } + public FileInfo addFileOrFolder(final String baseName) { Review comment: Please add Javadoc comments to public elements. ########## File path: commons-vfs2-zookeeper/src/main/java/org/apache/commons/vfs2/provider/zookeeper/ZkFileSystemConfigBuilder.java ########## @@ -0,0 +1,179 @@ +/* + * 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.commons.vfs2.provider.zookeeper; + +import org.apache.commons.vfs2.FileSystem; +import org.apache.commons.vfs2.FileSystemConfigBuilder; +import org.apache.commons.vfs2.FileSystemOptions; +import org.apache.curator.RetryPolicy; +import org.apache.curator.framework.CuratorFramework; +import org.apache.curator.retry.ExponentialBackoffRetry; + +/** + * Configuration options for Apache Zookeeper. + * @since 2.7.0 + */ +public class ZkFileSystemConfigBuilder extends FileSystemConfigBuilder { + protected static final String KEY_CONFIGURED_FRAMEWORK = "framework"; + protected static final String KEY_ZK_CONNECTION_STRING = "connectionString"; + protected static final String KEY_RETRY_TIMEOUT = "retryTimeout"; + protected static final String KEY_RETRY_RETRIES = "retries"; + protected static final String KEY_RETRY_POLICY = "retryPolicy"; + protected static final String KEY_CONNECTION_TIMEOUT = "connectionTimeout"; + protected static final String KEY_SESSION_TIMEOUT = "sessionTimeout"; + protected static final String KEY_NAMESPACE = "zkNamespace"; + protected static final String KEY_AUTH_SCHEME = "zkAuthScheme"; + protected static final String KEY_AUTH_BYTES = "zkAuthBytes"; + protected static final String KEY_OWNS_CLIENT = "ownsClientFlag"; + + private static final int DEFAULT_RETRY_TIMOUT = 1000; + private static final int DEFAULT_RETRY_RETRIES = 3; + private static final int DEFAULT_CONNECTION_TIMEOUT = 1000; + private static final int DEFAULT_SESSION_TIMEOUT = 5000; + private static final String DEFAULT_ZK_CONNECTION_STRING = "localhost:2180"; + + private static final ZkFileSystemConfigBuilder BUILDER = + new ZkFileSystemConfigBuilder(); + + private ZkFileSystemConfigBuilder() { + super("zk."); + } + + public static ZkFileSystemConfigBuilder getInstance() { + return BUILDER; + } + + public CuratorFramework getCuratorFramework(final FileSystemOptions opts) { + return (CuratorFramework) getParam(opts, KEY_CONFIGURED_FRAMEWORK); + } + + public void setCuratorFramework(final FileSystemOptions opts, Review comment: Please add Javadoc comments to public elements. ########## File path: commons-vfs2/src/test/java/org/apache/commons/vfs2/test/FileInfo.java ########## @@ -74,6 +74,18 @@ public FileInfo addFolder(final String baseName) { return child; } + public FileInfo addFileOrFolder(final String baseName) { + final FileInfo child = new FileInfo(baseName, FileType.FILE_OR_FOLDER, null); + addChild(child); + return child; + } + + public FileInfo addFileOrFolder(final String baseName, final String content) { Review comment: Please add Javadoc comments to public elements. ########## File path: commons-vfs2-zookeeper/src/main/java/org/apache/commons/vfs2/provider/zookeeper/package.html ########## @@ -0,0 +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. +--> +<body> +<p>The Zookeeper File Provider</p> Review comment: A one-loner is pretty thin here. Please consider that users and maintainers will be reading this. How can you help them get started using the package and understanding your implementation choices? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
