GEODE-429: Remove hdfsStore gfsh commands
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7f251978 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7f251978 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7f251978 Branch: refs/heads/feature/GEODE-409 Commit: 7f251978c9730c403534a62fb385e922eecc8e5b Parents: 7bcc1e4 Author: Ashvin Agrawal <[email protected]> Authored: Mon Oct 19 14:01:01 2015 -0700 Committer: Ashvin Agrawal <[email protected]> Committed: Wed Oct 21 08:55:22 2015 -0700 ---------------------------------------------------------------------- .../gemfire/internal/redis/RegionProvider.java | 2 +- .../gemfire/management/cli/ConverterHint.java | 1 - .../CreateAlterDestroyRegionCommands.java | 12 +- .../cli/commands/HDFSStoreCommands.java | 695 --------------- .../cli/converters/HdfsStoreNameConverter.java | 88 -- .../cli/functions/AlterHDFSStoreFunction.java | 228 ----- .../cli/functions/CreateHDFSStoreFunction.java | 124 --- .../cli/functions/DestroyHDFSStoreFunction.java | 100 --- .../cli/functions/ListHDFSStoresFunction.java | 102 --- .../cli/functions/RegionFunctionArgs.java | 66 +- .../internal/cli/i18n/CliStrings.java | 112 --- .../HDFSStoreCommandsController.java | 229 ----- .../controllers/ShellCommandsController.java | 28 +- .../commands/HDFSStoreCommandsJUnitTest.java | 838 ------------------- .../AlterHDFSStoreFunctionJUnitTest.java | 324 ------- .../CreateHDFSStoreFunctionJUnitTest.java | 307 ------- .../DescribeHDFSStoreFunctionJUnitTest.java | 364 -------- .../DestroyHDFSStoreFunctionJUnitTest.java | 305 ------- .../ListHDFSStoresFunctionJUnitTest.java | 319 ------- 19 files changed, 17 insertions(+), 4227 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java index 0240a4c..a01858e 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java @@ -378,7 +378,7 @@ public class RegionProvider implements Closeable { r = cache.getRegion(key); if (r != null) return r; do { - Result result = cliCmds.createRegion(key, defaultRegionType, null, null, true, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); + Result result = cliCmds.createRegion(key, defaultRegionType, null, null, true, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); r = cache.getRegion(key); if (result.getStatus() == Status.ERROR && r == null) { String err = ""; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/cli/ConverterHint.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/cli/ConverterHint.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/cli/ConverterHint.java index f295983..afe8c76 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/cli/ConverterHint.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/cli/ConverterHint.java @@ -41,5 +41,4 @@ public interface ConverterHint { public static final String LOG_LEVEL = "converter.hint.log.levels"; public static final String STRING_DISABLER = "converter.hint.disable-string-converter"; - public static final String HDFSSTORE_ALL = "converter.hint.cluster.hdfsstore"; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java index 919d6fe..41cf531 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java @@ -202,14 +202,6 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport { help = CliStrings.CREATE_REGION__GATEWAYSENDERID__HELP) @CliMetaData (valueSeparator = ",") String[] gatewaySenderIds, - @CliOption (key = CliStrings.CREATE_REGION__HDFSSTORE_NAME, - help = CliStrings.CREATE_REGION__HDFSSTORE_NAME__HELP , - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE) - String hdfsStoreName, - @CliOption (key = CliStrings.CREATE_REGION__HDFSSTORE_WRITEONLY, - help = CliStrings.CREATE_REGION__HDFSSTORE_WRITEONLY__HELP, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE) - Boolean hdfsWriteOnly, @CliOption (key = CliStrings.CREATE_REGION__KEYCONSTRAINT, help = CliStrings.CREATE_REGION__KEYCONSTRAINT__HELP) String keyConstraint, @@ -319,7 +311,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport { prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies, prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, - offHeap, hdfsStoreName , hdfsWriteOnly, regionAttributes); + offHeap, regionAttributes); if (regionAttributes.getPartitionAttributes() == null && regionFunctionArgs.hasPartitionAttributes()) { @@ -339,7 +331,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport { concurrencyChecksEnabled, cloningEnabled, concurrencyLevel, prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies, prStartupRecoveryDelay, - prTotalMaxMemory, prTotalNumBuckets, null,compressor, offHeap , hdfsStoreName , hdfsWriteOnly); + prTotalMaxMemory, prTotalNumBuckets, null,compressor, offHeap); if (!regionShortcut.name().startsWith("PARTITION") && regionFunctionArgs.hasPartitionAttributes()) { throw new IllegalArgumentException( http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommands.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommands.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommands.java deleted file mode 100644 index 6e573f1..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommands.java +++ /dev/null @@ -1,695 +0,0 @@ -package com.gemstone.gemfire.management.internal.cli.commands; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Set; - -import org.springframework.shell.core.annotation.CliAvailabilityIndicator; -import org.springframework.shell.core.annotation.CliCommand; -import org.springframework.shell.core.annotation.CliOption; - -import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.execute.Execution; -import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException; -import com.gemstone.gemfire.cache.execute.ResultCollector; -import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.cache.execute.AbstractExecution; -import com.gemstone.gemfire.internal.lang.ClassUtils; -import com.gemstone.gemfire.management.cli.CliMetaData; -import com.gemstone.gemfire.management.cli.ConverterHint; -import com.gemstone.gemfire.management.cli.Result; -import com.gemstone.gemfire.management.cli.Result.Status; -import com.gemstone.gemfire.management.internal.cli.CliUtil; -import com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction; -import com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction.AlterHDFSStoreAttributes; -import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult; -import com.gemstone.gemfire.management.internal.cli.functions.CreateHDFSStoreFunction; -import com.gemstone.gemfire.management.internal.cli.functions.DescribeHDFSStoreFunction; -import com.gemstone.gemfire.management.internal.cli.functions.DestroyHDFSStoreFunction; -import com.gemstone.gemfire.management.internal.cli.functions.ListHDFSStoresFunction; -import com.gemstone.gemfire.management.internal.cli.functions.ListHDFSStoresFunction.HdfsStoreDetails; -import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings; -import com.gemstone.gemfire.management.internal.cli.result.CommandResultException; -import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData; -import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder; -import com.gemstone.gemfire.management.internal.cli.result.ResultDataException; -import com.gemstone.gemfire.management.internal.cli.result.TabularResultData; -import com.gemstone.gemfire.management.internal.cli.util.HDFSStoreNotFoundException; -import com.gemstone.gemfire.management.internal.cli.util.MemberNotFoundException; -import com.gemstone.gemfire.management.internal.configuration.SharedConfigurationWriter; -import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; - -/** - * The HdfsStoreCommands class encapsulates all GemFire Hdfs Store commands in Gfsh. - * </p> - * - * @author Namrata Thanvi - * @see com.gemstone.gemfire.management.internal.cli.commands.AbstractCommandsSupport - */ - - -public class HDFSStoreCommands extends AbstractCommandsSupport { - @CliCommand (value = CliStrings.CREATE_HDFS_STORE, help = CliStrings.CREATE_HDFS_STORE__HELP) - @CliMetaData (relatedTopic = CliStrings.TOPIC_GEMFIRE_HDFSSTORE, writesToSharedConfiguration = true) - public Result createHdfsStore( - @CliOption (key = CliStrings.CREATE_HDFS_STORE__NAME, - mandatory = true, - optionContext = ConverterHint.HDFSSTORE_ALL, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__NAME__HELP) - String hdfsUniqueName, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__NAMENODE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__NAMENODE__HELP) - String namenode, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__HOMEDIR, - optionContext = ConverterHint.DIR_PATHSTRING, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__HOMEDIR__HELP) - String homeDir, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__BATCHSIZE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__BATCHSIZE__HELP) - Integer batchSize, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__BATCHINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__BATCHINTERVAL__HELP) - Integer batchInterval, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__READCACHESIZE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__READCACHESIZE__HELP) - Float readCacheSize, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__DISPATCHERTHREADS, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__DISPATCHERTHREADS__HELP) - Integer dispatcherThreads, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MAXMEMORY, - mandatory = false, - unspecifiedDefaultValue =CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MAXMEMORY__HELP) - Integer maxMemory, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__BUFFERPERSISTENT, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__BUFFERPERSISTENT__HELP) - Boolean bufferPersistent, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__SYNCDISKWRITE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__SYNCDISKWRITE__HELP) - Boolean syncDiskWrite, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__DISKSTORENAME, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__DISKSTORENAME__HELP) - String diskStoreName, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MINORCOMPACT, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MINORCOMPACT__HELP) - Boolean minorCompact, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS__HELP) - Integer minorCompactionThreads, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACT, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACT__HELP) - Boolean majorCompact, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL__HELP) - Integer majorCompactionInterval, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS__HELP) - Integer majorCompactionThreads, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__PURGEINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__PURGEINTERVAL__HELP) - Integer purgeInterval, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__WRITEONLYFILESIZE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__WRITEONLYFILESIZE__HELP) - Integer maxWriteonlyFileSize, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__FILEROLLOVERINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__FILEROLLOVERINTERVAL__HELP) - Integer fileRolloverInterval, - @CliOption (key = CliStrings.CREATE_HDFS_STORE__CLIENTCONFIGFILE, - optionContext = ConverterHint.FILE_PATHSTRING, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.CREATE_HDFS_STORE__CLIENTCONFIGFILE__HELP) - String clientConfigFile, - @CliOption(key=CliStrings.CREATE_HDFS_STORE__GROUP, - help=CliStrings.CREATE_HDFS_STORE__GROUP__HELP, - optionContext=ConverterHint.MEMBERGROUP) - @CliMetaData (valueSeparator = ",") - String[] groups ) { - try { - - return getCreatedHdfsStore(groups, hdfsUniqueName, namenode, homeDir, clientConfigFile, fileRolloverInterval, - maxWriteonlyFileSize, minorCompact, majorCompact, batchSize, batchInterval, diskStoreName, bufferPersistent, - dispatcherThreads, syncDiskWrite, readCacheSize, majorCompactionInterval, majorCompactionThreads, - minorCompactionThreads, purgeInterval, maxMemory); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - String formattedErrString = CliStrings.format(CliStrings.CREATE_HDFS_STORE__ERROR_WHILE_CREATING_REASON_0, - new Object[] { th.getMessage() }); - SystemFailure.checkFailure(); - return ResultBuilder.createGemFireErrorResult(formattedErrString); - } - } - - public Result getCreatedHdfsStore(String[] groups, String hdfsUniqueName, String namenode, String homeDir, - String clientConfigFile, Integer fileRolloverInterval, Integer maxWriteonlyFileSize, Boolean minorCompact, - Boolean majorCompact, Integer batchSize, Integer batchInterval, String diskStoreName, Boolean bufferPersistent, - Integer dispatcherThreads, Boolean syncDiskWrite, Float readCacheSize, Integer majorCompactionInterval, - Integer majorCompactionThreads, Integer minorCompactionThreads, Integer purgeInterval, Integer maxMemory) { - - XmlEntity xmlEntity = null; - - Set<DistributedMember> targetMembers = null; - - try { - targetMembers = getGroupMembers(groups); - } catch (CommandResultException cre) { - return cre.getResult(); - } - - HDFSStoreConfigHolder configHolder = new HDFSStoreConfigHolder(); - configHolder.setName(hdfsUniqueName); - if (readCacheSize != null) - configHolder.setBlockCacheSize(readCacheSize); - - if (fileRolloverInterval != null) - configHolder.setWriteOnlyFileRolloverInterval(fileRolloverInterval); - if (clientConfigFile != null) - configHolder.setHDFSClientConfigFile(clientConfigFile); - if (homeDir != null) - configHolder.setHomeDir(homeDir); - if (maxWriteonlyFileSize != null) - configHolder.setWriteOnlyFileRolloverSize(maxWriteonlyFileSize); - if (namenode != null) - configHolder.setNameNodeURL(namenode); - - if (minorCompact != null) - configHolder.setMinorCompaction(minorCompact); - if (majorCompact != null) - configHolder.setMajorCompaction(majorCompact); - if (majorCompactionInterval != null) - configHolder.setMajorCompactionInterval(majorCompactionInterval); - if (majorCompactionThreads != null) - configHolder.setMajorCompactionThreads(majorCompactionThreads); - if (minorCompactionThreads != null) - configHolder.setMinorCompactionThreads(minorCompactionThreads); - if (purgeInterval != null) - configHolder.setPurgeInterval(purgeInterval); - - if (batchSize != null) - configHolder.setBatchSize(batchSize); - if (batchInterval != null) - configHolder.setBatchInterval(batchInterval); - if (diskStoreName != null) - configHolder.setDiskStoreName(diskStoreName); - if (syncDiskWrite != null) - configHolder.setSynchronousDiskWrite(syncDiskWrite); - if (dispatcherThreads != null) - configHolder.setDispatcherThreads(dispatcherThreads); - if (maxMemory != null) - configHolder.setMaxMemory(maxMemory); - if (bufferPersistent != null) - configHolder.setBufferPersistent(bufferPersistent); - - ResultCollector<?, ?> resultCollector = getMembersFunctionExecutor(targetMembers) - .withArgs(configHolder).execute(new CreateHDFSStoreFunction()); - - List<CliFunctionResult> hdfsStoreCreateResults = CliFunctionResult.cleanResults((List<?>)resultCollector - .getResult()); - - TabularResultData tabularResultData = ResultBuilder.createTabularResultData(); - - Boolean accumulatedData = false; - - for (CliFunctionResult hdfsStoreCreateResult : hdfsStoreCreateResults) { - if (hdfsStoreCreateResult.getThrowable() != null) { - String memberId = hdfsStoreCreateResult.getMemberIdOrName(); - String errorMsg = hdfsStoreCreateResult.getThrowable().getMessage(); - String errClass = hdfsStoreCreateResult.getThrowable().getClass().getName(); - tabularResultData.accumulate("Member", memberId); - tabularResultData.accumulate("Result", "ERROR: " + errClass + ": " + errorMsg); - accumulatedData = true; - tabularResultData.setStatus(Status.ERROR); - } - else if (hdfsStoreCreateResult.isSuccessful()) { - String memberId = hdfsStoreCreateResult.getMemberIdOrName(); - String successMsg = hdfsStoreCreateResult.getMessage(); - tabularResultData.accumulate("Member", memberId); - tabularResultData.accumulate("Result", successMsg); - if (xmlEntity == null) { - xmlEntity = hdfsStoreCreateResult.getXmlEntity(); - } - accumulatedData = true; - } - } - - if (!accumulatedData) { - return ResultBuilder.createInfoResult("Unable to create hdfs store:" + hdfsUniqueName); - } - - Result result = ResultBuilder.buildResult(tabularResultData); - if (xmlEntity != null) { - result.setCommandPersisted((new SharedConfigurationWriter()).addXmlEntity(xmlEntity, groups)); - } - - return ResultBuilder.buildResult(tabularResultData); - } - - - @CliCommand(value = CliStrings.DESCRIBE_HDFS_STORE, help = CliStrings.DESCRIBE_HDFS_STORE__HELP) - @CliMetaData(shellOnly = false, relatedTopic = { CliStrings.TOPIC_GEMFIRE_HDFSSTORE}) - public Result describeHdfsStore( - @CliOption(key = CliStrings.DESCRIBE_HDFS_STORE__MEMBER, - mandatory = true, optionContext = ConverterHint.MEMBERIDNAME, - help = CliStrings.DESCRIBE_HDFS_STORE__MEMBER__HELP) - final String memberName, - @CliOption(key = CliStrings.DESCRIBE_HDFS_STORE__NAME, - mandatory = true, - optionContext = ConverterHint.HDFSSTORE_ALL, - help = CliStrings.DESCRIBE_HDFS_STORE__NAME__HELP) - final String hdfsStoreName) { - try{ - return toCompositeResult(getHDFSStoreDescription(memberName , hdfsStoreName)); - - }catch (HDFSStoreNotFoundException e){ - return ResultBuilder.createShellClientErrorResult(((HDFSStoreNotFoundException)e).getMessage()); - } - catch (FunctionInvocationTargetException ignore) { - return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, - CliStrings.DESCRIBE_HDFS_STORE)); - - } catch (MemberNotFoundException e) { - return ResultBuilder.createShellClientErrorResult(e.getMessage()); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable t) { - SystemFailure.checkFailure(); - return ResultBuilder.createGemFireErrorResult(String.format(CliStrings.DESCRIBE_HDFS_STORE__ERROR_MESSAGE, - memberName, hdfsStoreName, t)); - } - } - - public HDFSStoreConfigHolder getHDFSStoreDescription(String memberName, String hdfsStoreName) { - - final DistributedMember member = getMember(getCache(), memberName); - - ResultCollector<?, ?> resultCollector = getMembersFunctionExecutor(Collections.singleton(member)) - .withArgs(hdfsStoreName).execute(new DescribeHDFSStoreFunction()); - - Object result = ((List<?>)resultCollector.getResult()).get(0); - - if (result instanceof HDFSStoreConfigHolder) { - return (HDFSStoreConfigHolder)result; - } - if (result instanceof HDFSStoreNotFoundException) { - throw (HDFSStoreNotFoundException)result; - } - else { - final Throwable cause = (result instanceof Throwable ? (Throwable)result : null); - throw new RuntimeException(CliStrings.format(CliStrings.UNEXPECTED_RETURN_TYPE_EXECUTING_COMMAND_ERROR_MESSAGE, - ClassUtils.getClassName(result), CliStrings.DESCRIBE_HDFS_STORE), cause); - - } - } - - public Result toCompositeResult(final HDFSStoreConfigHolder storePrms) { - final CompositeResultData hdfsStoreCompositeResult = ResultBuilder.createCompositeResultData(); - final CompositeResultData.SectionResultData hdfsStoreSection = hdfsStoreCompositeResult.addSection(); - - hdfsStoreSection.addData("Hdfs Store Name", storePrms.getName()); - hdfsStoreSection.addData("Name Node URL", storePrms.getNameNodeURL()); - hdfsStoreSection.addData("Home Dir", storePrms.getHomeDir()); - hdfsStoreSection.addData("Block Cache", storePrms.getBlockCacheSize()); - hdfsStoreSection.addData("File RollOver Interval", storePrms.getWriteOnlyFileRolloverInterval()); - hdfsStoreSection.addData("Max WriteOnly File Size", storePrms.getWriteOnlyFileRolloverSize()); - - hdfsStoreSection.addData("Client Configuration File", storePrms.getHDFSClientConfigFile()); - - hdfsStoreSection.addData("Disk Store Name", storePrms.getDiskStoreName()); - hdfsStoreSection.addData("Batch Size In MB", storePrms.getBatchSize()); - hdfsStoreSection.addData("Batch Interval Time", storePrms.getBatchInterval()); - hdfsStoreSection.addData("Maximum Memory", storePrms.getMaxMemory()); - hdfsStoreSection.addData("Dispatcher Threads", storePrms.getDispatcherThreads()); - hdfsStoreSection.addData("Buffer Persistence", storePrms.getBufferPersistent()); - hdfsStoreSection.addData("Synchronous Persistence", storePrms.getSynchronousDiskWrite()); - - hdfsStoreSection.addData("Major Compaction Enabled", storePrms.getMajorCompaction()); - hdfsStoreSection.addData("Major Compaction Threads", storePrms.getMajorCompactionThreads()); - hdfsStoreSection.addData("Major compaction Interval", storePrms.getMajorCompactionInterval()); - hdfsStoreSection.addData("Minor Compaction Enabled", storePrms.getMinorCompaction()); - hdfsStoreSection.addData("Minor Compaction Threads", storePrms.getMinorCompactionThreads()); - hdfsStoreSection.addData("Purge Interval", storePrms.getPurgeInterval()); - - return ResultBuilder.buildResult(hdfsStoreCompositeResult); - } - - @CliCommand(value = CliStrings.LIST_HDFS_STORE, help = CliStrings.LIST_HDFS_STORE__HELP) - @CliMetaData(shellOnly = false, relatedTopic = { CliStrings.TOPIC_GEMFIRE_HDFSSTORE }) - public Result listHdfsStore() { - try { - Set<DistributedMember> dataMembers = getNormalMembers(getCache()); - if (dataMembers.isEmpty()) { - return ResultBuilder.createInfoResult(CliStrings.NO_CACHING_MEMBERS_FOUND_MESSAGE); - } - return toTabularResult(getHdfsStoreListing(dataMembers)); - - } catch (FunctionInvocationTargetException ignore) { - return ResultBuilder.createGemFireErrorResult( - CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, - CliStrings.LIST_HDFS_STORE)); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable t) { - SystemFailure.checkFailure(); - return ResultBuilder.createGemFireErrorResult( - String.format(CliStrings.LIST_HDFS_STORE__ERROR_MESSAGE, t.getMessage())); - } - } - - protected List<HdfsStoreDetails> getHdfsStoreListing(Set<DistributedMember> members) { - - final Execution membersFunctionExecutor = getMembersFunctionExecutor(members); - - if (membersFunctionExecutor instanceof AbstractExecution) { - ((AbstractExecution)membersFunctionExecutor).setIgnoreDepartedMembers(true); - } - - final ResultCollector<?, ?> resultCollector = membersFunctionExecutor.execute(new ListHDFSStoresFunction()); - final List<?> results = (List<?>)resultCollector.getResult(); - final List<HdfsStoreDetails> hdfsStoreList = new ArrayList<HdfsStoreDetails>(results.size()); - - for (final Object result : results) { - if (result instanceof Set) { // ignore FunctionInvocationTargetExceptions and other Exceptions... - hdfsStoreList.addAll((Set<HdfsStoreDetails>)result); - } - } - - Collections.sort(hdfsStoreList, new Comparator<HdfsStoreDetails>() { - public <T extends Comparable<T>> int compare(final T obj1, final T obj2) { - return (obj1 == null && obj2 == null ? 0 : (obj1 == null ? 1 : (obj2 == null ? -1 : obj1.compareTo(obj2)))); - } - - @Override - public int compare(HdfsStoreDetails store1, HdfsStoreDetails store2) { - int comparisonValue = compare(store1.getMemberName(), store2.getMemberName()); - comparisonValue = (comparisonValue != 0 ? comparisonValue : compare(store1.getMemberId(), store2.getMemberId())); - return (comparisonValue != 0 ? comparisonValue : store1.getStoreName().compareTo(store2.getStoreName())); - } - }); - - return hdfsStoreList; - } - - - protected Result toTabularResult(final List<HdfsStoreDetails> hdfsStoreList) throws ResultDataException { - if (!hdfsStoreList.isEmpty()) { - final TabularResultData hdfsStoreData = ResultBuilder.createTabularResultData(); - for (final HdfsStoreDetails hdfsStoreDetails : hdfsStoreList) { - hdfsStoreData.accumulate("Member Name", hdfsStoreDetails.getMemberName()); - hdfsStoreData.accumulate("Member Id", hdfsStoreDetails.getMemberId()); - hdfsStoreData.accumulate("Hdfs Store Name", hdfsStoreDetails.getStoreName()); - } - return ResultBuilder.buildResult(hdfsStoreData); - } - else { - return ResultBuilder.createInfoResult(CliStrings.LIST_HDFS_STORE__HDFS_STORES_NOT_FOUND_MESSAGE); - } - } - - - @CliCommand(value=CliStrings.DESTROY_HDFS_STORE, help=CliStrings.DESTROY_HDFS_STORE__HELP) - @CliMetaData(shellOnly=false, relatedTopic={CliStrings.TOPIC_GEMFIRE_HDFSSTORE}, writesToSharedConfiguration=true) - public Result destroyHdfstore( - @CliOption (key=CliStrings.DESTROY_HDFS_STORE__NAME, - optionContext=ConverterHint.HDFSSTORE_ALL, - mandatory=true, - help=CliStrings.DESTROY_HDFS_STORE__NAME__HELP) - String hdfsStoreName, - @CliOption(key=CliStrings.DESTROY_HDFS_STORE__GROUP, - help=CliStrings.DESTROY_HDFS_STORE__GROUP__HELP, - optionContext=ConverterHint.MEMBERGROUP) - @CliMetaData (valueSeparator = ",") - String[] groups) { - try{ - return destroyStore(hdfsStoreName,groups); - - } catch (FunctionInvocationTargetException ignore) { - return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, - CliStrings.DESTROY_HDFS_STORE)); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - SystemFailure.checkFailure(); - return ResultBuilder.createGemFireErrorResult(CliStrings.format( - CliStrings.DESTROY_HDFS_STORE__ERROR_WHILE_DESTROYING_REASON_0, new Object[] { th.getMessage() })); - } - } - - protected Result destroyStore(String hdfsStoreName , String[] groups){ - TabularResultData tabularData = ResultBuilder.createTabularResultData(); - boolean accumulatedData = false; - - Set<DistributedMember> targetMembers = null; - try { - targetMembers = getGroupMembers(groups); - } catch (CommandResultException cre) { - return cre.getResult(); - } - - ResultCollector<?, ?> rc = getMembersFunctionExecutor(targetMembers) - .withArgs(hdfsStoreName).execute(new DestroyHDFSStoreFunction()); - - List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>)rc.getResult()); - - XmlEntity xmlEntity = null; - for (CliFunctionResult result : results) { - - if (result.getThrowable() != null) { - tabularData.accumulate("Member", result.getMemberIdOrName()); - tabularData.accumulate("Result", "ERROR: " + result.getThrowable().getClass().getName() + ": " - + result.getThrowable().getMessage()); - accumulatedData = true; - tabularData.setStatus(Status.ERROR); - } - else if (result.getMessage() != null) { - tabularData.accumulate("Member", result.getMemberIdOrName()); - tabularData.accumulate("Result", result.getMessage()); - accumulatedData = true; - - if (xmlEntity == null) { - xmlEntity = result.getXmlEntity(); - } - } - } - - if (!accumulatedData) { - return ResultBuilder.createInfoResult("No matching hdfs stores found."); - } - - Result result = ResultBuilder.buildResult(tabularData); - if (xmlEntity != null) { - result.setCommandPersisted((new SharedConfigurationWriter()).deleteXmlEntity(xmlEntity, groups)); - } - - return result; - } - @CliCommand(value=CliStrings.ALTER_HDFS_STORE, help=CliStrings.ALTER_HDFS_STORE__HELP) - @CliMetaData(shellOnly=false, relatedTopic={CliStrings.TOPIC_GEMFIRE_HDFSSTORE}, writesToSharedConfiguration=true) - public Result alterHdfstore( - @CliOption (key = CliStrings.ALTER_HDFS_STORE__NAME, - mandatory = true, - optionContext = ConverterHint.HDFSSTORE_ALL, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__NAME__HELP) - String hdfsUniqueName, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__BATCHSIZE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__BATCHSIZE__HELP) - Integer batchSize, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__BATCHINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__BATCHINTERVAL__HELP) - Integer batchInterval, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__MINORCOMPACT, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__MINORCOMPACT__HELP) - Boolean minorCompact, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS__HELP) - Integer minorCompactionThreads, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACT, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACT__HELP) - Boolean majorCompact, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL__HELP) - Integer majorCompactionInterval, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS__HELP) - Integer majorCompactionThreads, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__PURGEINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__PURGEINTERVAL__HELP) - Integer purgeInterval, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__FILEROLLOVERINTERVAL, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__FILEROLLOVERINTERVAL__HELP) - Integer fileRolloverInterval, - @CliOption (key = CliStrings.ALTER_HDFS_STORE__WRITEONLYFILESIZE, - mandatory = false, - unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, - help = CliStrings.ALTER_HDFS_STORE__WRITEONLYFILESIZE__HELP) - Integer maxWriteonlyFileSize, - @CliOption(key=CliStrings.ALTER_HDFS_STORE__GROUP, - help=CliStrings.ALTER_HDFS_STORE__GROUP__HELP, - optionContext=ConverterHint.MEMBERGROUP) - @CliMetaData (valueSeparator = ",") - String[] groups){ - try { - - return getAlteredHDFSStore(groups, hdfsUniqueName, batchSize, batchInterval, minorCompact, - minorCompactionThreads, majorCompact, majorCompactionInterval, majorCompactionThreads, purgeInterval, - fileRolloverInterval, maxWriteonlyFileSize); - - } catch (FunctionInvocationTargetException ignore) { - return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, - CliStrings.ALTER_HDFS_STORE)); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - SystemFailure.checkFailure(); - return ResultBuilder.createGemFireErrorResult(CliStrings.format( - CliStrings.ALTER_HDFS_STORE__ERROR_WHILE_ALTERING_REASON_0, new Object[] { th.getMessage() })); - } - } - - - protected Result getAlteredHDFSStore(String[] groups, String hdfsUniqueName, Integer batchSize, - Integer batchInterval, Boolean minorCompact, Integer minorCompactionThreads, Boolean majorCompact, - Integer majorCompactionInterval, Integer majorCompactionThreads, Integer purgeInterval, - Integer fileRolloverInterval, Integer maxWriteonlyFileSize) { - - Set<DistributedMember> targetMembers = null; - try { - targetMembers = getGroupMembers(groups); - } catch (CommandResultException cre) { - return cre.getResult(); - } - - TabularResultData tabularData = ResultBuilder.createTabularResultData(); - - AlterHDFSStoreAttributes alterAttributes = new AlterHDFSStoreAttributes( - hdfsUniqueName, batchSize, batchInterval, minorCompact, - majorCompact, minorCompactionThreads, majorCompactionInterval, - majorCompactionThreads, purgeInterval, fileRolloverInterval, - maxWriteonlyFileSize); - - ResultCollector<?, ?> rc = getMembersFunctionExecutor(targetMembers) - .withArgs(alterAttributes).execute(new AlterHDFSStoreFunction()); - - List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>)rc.getResult()); - - XmlEntity xmlEntity = null; - - for (CliFunctionResult result : results) { - if (result.getThrowable() != null) { - tabularData.accumulate("Member", result.getMemberIdOrName()); - tabularData.accumulate("Result", "ERROR: " + result.getThrowable().getClass().getName() + ": " - + result.getThrowable().getMessage()); - tabularData.setStatus(Status.ERROR); - } - else if (result.getMessage() != null) { - tabularData.accumulate("Member", result.getMemberIdOrName()); - tabularData.accumulate("Result", result.getMessage()); - - if (xmlEntity == null) { - xmlEntity = result.getXmlEntity(); - } - } - } - - Result result = ResultBuilder.buildResult(tabularData); - - if (xmlEntity != null) { - result.setCommandPersisted((new SharedConfigurationWriter()).deleteXmlEntity(xmlEntity, groups)); - } - - return result; - } - @CliAvailabilityIndicator({CliStrings.CREATE_HDFS_STORE, CliStrings.LIST_HDFS_STORE, - CliStrings.DESCRIBE_HDFS_STORE, CliStrings.ALTER_HDFS_STORE, CliStrings.DESTROY_HDFS_STORE}) - public boolean hdfsStoreCommandsAvailable() { - // these hdfs store commands are always available in GemFire - return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady())); - } - - @Override - protected Set<DistributedMember> getMembers(final Cache cache) { - return CliUtil.getAllMembers(cache); - } - - protected Set<DistributedMember> getNormalMembers(final Cache cache) { - return CliUtil.getAllNormalMembers(cache); - } - - protected Set<DistributedMember> getGroupMembers(String[] groups) throws CommandResultException { - return CliUtil.findAllMatchingMembers(groups, null); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/HdfsStoreNameConverter.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/HdfsStoreNameConverter.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/HdfsStoreNameConverter.java deleted file mode 100644 index e595c77..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/HdfsStoreNameConverter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * ========================================================================= - * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved. - * This product is protected by U.S. and international copyright - * and intellectual property laws. Pivotal products are covered by - * more patents listed at http://www.pivotal.io/patents. - * ======================================================================== - */ -package com.gemstone.gemfire.management.internal.cli.converters; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - -import com.gemstone.gemfire.management.cli.ConverterHint; -import com.gemstone.gemfire.management.internal.cli.shell.Gfsh; - -import org.springframework.shell.core.Completion; -import org.springframework.shell.core.Converter; -import org.springframework.shell.core.MethodTarget; - -/** - * - * @author Namrata Thanvi - * - */ - -public class HdfsStoreNameConverter implements Converter<String> { - - @Override - public boolean supports(Class<?> type, String optionContext) { - return String.class.equals(type) && ConverterHint.HDFSSTORE_ALL.equals(optionContext); - } - - @Override - public String convertFromText(String value, Class<?> targetType, String optionContext) { - return value; - } - - @Override - public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, - String optionContext, MethodTarget target) { - if (String.class.equals(targetType) && ConverterHint.HDFSSTORE_ALL.equals(optionContext)) { - Set<String> hdfsStoreNames = getHdfsStoreNames(); - - for (String hdfsStoreName : hdfsStoreNames) { - if (existingData != null) { - if (hdfsStoreName.startsWith(existingData)) { - completions.add(new Completion(hdfsStoreName)); - } - } - else { - completions.add(new Completion(hdfsStoreName)); - } - } - } - - return !completions.isEmpty(); - } - - private Set<String> getHdfsStoreNames() { - SortedSet<String> hdfsStoreNames = new TreeSet<String>(); - Gfsh gfsh = Gfsh.getCurrentInstance(); - - if (gfsh != null && gfsh.isConnectedAndReady()) { - Map<String, String[]> hdfsStoreInfo = gfsh.getOperationInvoker().getDistributedSystemMXBean() - .listMemberHDFSStore(); - if (hdfsStoreInfo != null) { - Set<Entry<String, String[]>> entries = hdfsStoreInfo.entrySet(); - - for (Entry<String, String[]> entry : entries) { - String[] value = entry.getValue(); - if (value != null) { - hdfsStoreNames.addAll(Arrays.asList(value)); - } - } - - } - } - - return hdfsStoreNames; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunction.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunction.java deleted file mode 100644 index b5b5341..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunction.java +++ /dev/null @@ -1,228 +0,0 @@ -/*========================================================================= - * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved. - * This product is protected by U.S. and international copyright - * and intellectual property laws. Pivotal products are covered by - * one or more patents listed at http://www.pivotal.io/patents. - *========================================================================= - */ -package com.gemstone.gemfire.management.internal.cli.functions; - -import java.io.Serializable; - -import org.apache.logging.log4j.Logger; - -import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheClosedException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.execute.FunctionAdapter; -import com.gemstone.gemfire.cache.execute.FunctionContext; -import com.gemstone.gemfire.cache.hdfs.HDFSStore; -import com.gemstone.gemfire.cache.hdfs.HDFSStoreMutator; -import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreMutatorImpl; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.InternalEntity; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.InternalCache; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; - -/** - * Function used by the 'alter hdfs-store' gfsh command to alter a hdfs store on - * each member. - * - * @author Namrata Thanvi - */ - -public class AlterHDFSStoreFunction extends FunctionAdapter implements InternalEntity { - private static final Logger logger = LogService.getLogger(); - - private static final String ID = AlterHDFSStoreFunction.class.getName(); - - private static final long serialVersionUID = 1L; - - @Override - public void execute(FunctionContext context) { - String memberId = ""; - - try { - final AlterHDFSStoreAttributes alterAttributes = (AlterHDFSStoreAttributes)context.getArguments(); - GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); - DistributedMember member = getDistributedMember(cache); - - memberId = member.getId(); - // If they set a name use it instead - if (!member.getName().equals("")) { - memberId = member.getName(); - } - HDFSStore hdfsStore = cache.findHDFSStore(alterAttributes.getHdfsUniqueName()); - CliFunctionResult result; - if (hdfsStore != null) { - // TODO - Need to verify what all attributes needs to be persisted in - // cache.xml - XmlEntity xmlEntity = getXMLEntity(hdfsStore.getName()); - alterHdfsStore(hdfsStore, alterAttributes); - result = new CliFunctionResult(memberId, xmlEntity, "Success"); - } - else { - result = new CliFunctionResult(memberId, false, "Hdfs store not found on this member"); - } - context.getResultSender().lastResult(result); - - } catch (CacheClosedException cce) { - CliFunctionResult result = new CliFunctionResult(memberId, false, null); - context.getResultSender().lastResult(result); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - SystemFailure.checkFailure(); - logger.error("Could not alter hdfs store: {}", th.getMessage(), th); - - CliFunctionResult result = new CliFunctionResult(memberId, th, null); - context.getResultSender().lastResult(result); - } - - } - - @Override - public String getId() { - return ID; - } - - /** - * Alter HDFSStore with given configuration. - * - * @param hdfsStore - * @param alterAttributes - * @return HDFSStore - */ - - protected HDFSStore alterHdfsStore(HDFSStore hdfsStore, AlterHDFSStoreAttributes alterAttributes) { - HDFSStoreMutator storeMutator = new HDFSStoreMutatorImpl(hdfsStore); - - if (alterAttributes.getFileRolloverInterval() != null) - storeMutator.setWriteOnlyFileRolloverInterval(alterAttributes - .getFileRolloverInterval()); - - if (alterAttributes.getMaxWriteonlyFileSize() != null) - storeMutator.setWriteOnlyFileRolloverSize(alterAttributes.getMaxWriteonlyFileSize()); - - if (alterAttributes.getMinorCompact() != null) - storeMutator.setMinorCompaction(alterAttributes.getMinorCompact()); - - if (alterAttributes.getMajorCompact() != null) - storeMutator.setMajorCompaction(alterAttributes.getMajorCompact()); - - if (alterAttributes.getMajorCompactionInterval() != null) - storeMutator.setMajorCompactionInterval(alterAttributes.getMajorCompactionInterval()); - - if (alterAttributes.getMajorCompactionThreads() != null) - storeMutator.setMajorCompactionThreads(alterAttributes.getMajorCompactionThreads()); - - if (alterAttributes.getMajorCompactionThreads() != null) - storeMutator.setMinorCompactionThreads(alterAttributes.getMajorCompactionThreads()); - - if (alterAttributes.getPurgeInterval() != null) - storeMutator.setPurgeInterval(alterAttributes.getPurgeInterval()); - - if (alterAttributes.getBatchSize() != null) - storeMutator.setBatchSize(alterAttributes.getBatchSize()); - - if (alterAttributes.getBatchInterval() != null) - storeMutator.setBatchInterval(alterAttributes.getBatchInterval()); - - hdfsStore.alter(storeMutator); - return hdfsStore; - } - - - public static class AlterHDFSStoreAttributes implements Serializable { - private static final long serialVersionUID = 1L; - String hdfsUniqueName; - Integer batchSize , batchInterval; - Boolean minorCompact, majorCompact; - Integer minorCompactionThreads, majorCompactionInterval, majorCompactionThreads, purgeInterval; - Integer fileRolloverInterval, maxWriteonlyFileSize; - - public AlterHDFSStoreAttributes(String hdfsUniqueName, Integer batchSize, - Integer batchInterval, Boolean minorCompact, Boolean majorCompact, - Integer minorCompactionThreads, Integer majorCompactionInterval, - Integer majorCompactionThreads, Integer purgeInterval, - Integer fileRolloverInterval, Integer maxWriteonlyFileSize) { - this.hdfsUniqueName = hdfsUniqueName; - this.batchSize = batchSize; - this.batchInterval = batchInterval; - this.minorCompact = minorCompact; - this.majorCompact = majorCompact; - this.minorCompactionThreads = minorCompactionThreads; - this.majorCompactionInterval = majorCompactionInterval; - this.majorCompactionThreads = majorCompactionThreads; - this.purgeInterval = purgeInterval; - this.fileRolloverInterval = fileRolloverInterval; - this.maxWriteonlyFileSize = maxWriteonlyFileSize; - } - - public String getHdfsUniqueName() { - return hdfsUniqueName; - } - - public Integer getBatchSize() { - return batchSize; - } - - public Integer getBatchInterval() { - return batchInterval; - } - - public Boolean getMinorCompact() { - return minorCompact; - } - - public Boolean getMajorCompact() { - return majorCompact; - } - - public Integer getMinorCompactionThreads() { - return minorCompactionThreads; - } - - public Integer getMajorCompactionInterval() { - return majorCompactionInterval; - } - - public Integer getMajorCompactionThreads() { - return majorCompactionThreads; - } - - public Integer getPurgeInterval() { - return purgeInterval; - } - - public Integer getFileRolloverInterval() { - return fileRolloverInterval; - } - - public Integer getMaxWriteonlyFileSize() { - return maxWriteonlyFileSize; - } - - - } - - - protected Cache getCache() { - return CacheFactory.getAnyInstance(); - } - - protected DistributedMember getDistributedMember(Cache cache){ - return ((InternalCache)cache).getMyId(); - } - - protected XmlEntity getXMLEntity(String storeName){ - return new XmlEntity(CacheXml.HDFS_STORE, "name", storeName); - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunction.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunction.java deleted file mode 100644 index b4e5033..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunction.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.gemstone.gemfire.management.internal.cli.functions; - -import org.apache.logging.log4j.Logger; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheClosedException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.execute.FunctionAdapter; -import com.gemstone.gemfire.cache.execute.FunctionContext; -import com.gemstone.gemfire.cache.hdfs.HDFSStore; -import com.gemstone.gemfire.cache.hdfs.HDFSStoreFactory; -import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.InternalEntity; -import com.gemstone.gemfire.internal.cache.InternalCache; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; - -import com.gemstone.gemfire.management.internal.cli.CliUtil; -import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; - - -/** - * Function used by the 'create hdfs-store' gfsh command to create a hdfs store - * on each member. - * - * @author Namrata Thanvi - */ - -public class CreateHDFSStoreFunction extends FunctionAdapter implements InternalEntity { - - private static final long serialVersionUID = 1L; - - private static final Logger logger = LogService.getLogger(); - - public static final CreateHDFSStoreFunction INSTANCE = new CreateHDFSStoreFunction(); - - private static final String ID = CreateHDFSStoreFunction.class.getName(); - - @Override - public void execute(FunctionContext context) { - String memberId = ""; - try { - Cache cache = getCache(); - DistributedMember member = getDistributedMember(cache); - - memberId = member.getId(); - if (!member.getName().equals("")) { - memberId = member.getName(); - } - HDFSStoreConfigHolder configHolder = (HDFSStoreConfigHolder)context.getArguments(); - - HDFSStore hdfsStore = createHdfsStore(cache, configHolder); - // TODO - Need to verify what all attributes needs to be persisted in - // cache.xml - XmlEntity xmlEntity = getXMLEntity(hdfsStore.getName()); - context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity, "Success")); - - } catch (CacheClosedException cce) { - context.getResultSender().lastResult(new CliFunctionResult(memberId, false, null)); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - SystemFailure.checkFailure(); - logger.error("Could not create hdfs store: {}", CliUtil.stackTraceAsString(th), th); - context.getResultSender().lastResult(new CliFunctionResult(memberId, th, th.getMessage())); - } - } - - @Override - public String getId() { - return ID; - } - - /** - * Creates the HDFSStore with given configuration. - * - * @param cache - * @param configHolder - * @return HDFSStore - */ - - protected HDFSStore createHdfsStore(Cache cache, HDFSStoreConfigHolder configHolder) { - HDFSStoreFactory hdfsStoreFactory = cache.createHDFSStoreFactory(); - hdfsStoreFactory.setName(configHolder.getName()); - hdfsStoreFactory.setNameNodeURL(configHolder.getNameNodeURL()); - hdfsStoreFactory.setBlockCacheSize(configHolder.getBlockCacheSize()); - hdfsStoreFactory.setWriteOnlyFileRolloverInterval(configHolder.getWriteOnlyFileRolloverInterval()); - hdfsStoreFactory.setHomeDir(configHolder.getHomeDir()); - hdfsStoreFactory.setHDFSClientConfigFile(configHolder.getHDFSClientConfigFile()); - hdfsStoreFactory.setWriteOnlyFileRolloverSize(configHolder.getWriteOnlyFileRolloverSize()); - hdfsStoreFactory.setMajorCompaction(configHolder.getMajorCompaction()); - hdfsStoreFactory.setMajorCompactionInterval(configHolder.getMajorCompactionInterval()); - hdfsStoreFactory.setMajorCompactionThreads(configHolder.getMajorCompactionThreads()); - hdfsStoreFactory.setMinorCompaction(configHolder.getMinorCompaction()); - hdfsStoreFactory.setMaxMemory(configHolder.getMaxMemory()); - hdfsStoreFactory.setBatchSize(configHolder.getBatchSize()); - hdfsStoreFactory.setBatchInterval(configHolder.getBatchInterval()); - hdfsStoreFactory.setDiskStoreName(configHolder.getDiskStoreName()); - hdfsStoreFactory.setDispatcherThreads(configHolder.getDispatcherThreads()); - hdfsStoreFactory.setMinorCompactionThreads(configHolder.getMinorCompactionThreads()); - hdfsStoreFactory.setPurgeInterval(configHolder.getPurgeInterval()); - hdfsStoreFactory.setSynchronousDiskWrite(configHolder.getSynchronousDiskWrite()); - hdfsStoreFactory.setBufferPersistent(configHolder.getBufferPersistent()); - - return hdfsStoreFactory.create(configHolder.getName()); - } - - protected Cache getCache() { - return CacheFactory.getAnyInstance(); - } - - protected DistributedMember getDistributedMember(Cache cache){ - return ((InternalCache)cache).getMyId(); - } - - protected XmlEntity getXMLEntity(String storeName){ - return new XmlEntity(CacheXml.HDFS_STORE, "name", storeName); - } -} - http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/DestroyHDFSStoreFunction.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/DestroyHDFSStoreFunction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/DestroyHDFSStoreFunction.java deleted file mode 100644 index 83f6740..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/DestroyHDFSStoreFunction.java +++ /dev/null @@ -1,100 +0,0 @@ -/*========================================================================= - * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved. - * This product is protected by U.S. and international copyright - * and intellectual property laws. Pivotal products are covered by - * one or more patents listed at http://www.pivotal.io/patents. - *========================================================================= - */ -package com.gemstone.gemfire.management.internal.cli.functions; - -import org.apache.logging.log4j.Logger; - -import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheClosedException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.execute.FunctionAdapter; -import com.gemstone.gemfire.cache.execute.FunctionContext; -import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.InternalEntity; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.InternalCache; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; - -/** - * Function used by the 'destroy hdfs-store' gfsh command to destroy a hdfs - * store on each member. - * - * @author Namrata Thanvi - */ - -public class DestroyHDFSStoreFunction extends FunctionAdapter implements InternalEntity { - private static final Logger logger = LogService.getLogger(); - - private static final String ID = DestroyHDFSStoreFunction.class.getName(); - - private static final long serialVersionUID = 1L; - - @Override - public void execute(FunctionContext context) { - String memberId = ""; - try { - final String hdfsStoreName = (String)context.getArguments(); - GemFireCacheImpl cache = (GemFireCacheImpl)getCache(); - DistributedMember member = getDistributedMember(cache); - CliFunctionResult result; - - memberId = member.getId(); - if (!member.getName().equals("")) { - memberId = member.getName(); - } - - HDFSStoreImpl hdfsStore = cache.findHDFSStore(hdfsStoreName); - - if (hdfsStore != null) { - hdfsStore.destroy(); - // TODO - Need to verify what all attributes needs to be persisted in cache.xml and how - XmlEntity xmlEntity = getXMLEntity(hdfsStoreName); - result = new CliFunctionResult(memberId, xmlEntity, "Success"); - } - else { - result = new CliFunctionResult(memberId, false, "Hdfs store not found on this member"); - } - context.getResultSender().lastResult(result); - - } catch (CacheClosedException cce) { - CliFunctionResult result = new CliFunctionResult(memberId, false, null); - context.getResultSender().lastResult(result); - - } catch (VirtualMachineError e) { - SystemFailure.initiateFailure(e); - throw e; - - } catch (Throwable th) { - SystemFailure.checkFailure(); - logger.error("Could not destroy hdfs store: {}", th.getMessage(), th); - CliFunctionResult result = new CliFunctionResult(memberId, th, null); - context.getResultSender().lastResult(result); - } - } - - @Override - public String getId() { - return ID; - } - - protected Cache getCache() { - return CacheFactory.getAnyInstance(); - } - - protected DistributedMember getDistributedMember(Cache cache){ - return ((InternalCache)cache).getMyId(); - } - - protected XmlEntity getXMLEntity(String storeName){ - return new XmlEntity(CacheXml.HDFS_STORE, "name", storeName); - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/ListHDFSStoresFunction.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/ListHDFSStoresFunction.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/ListHDFSStoresFunction.java deleted file mode 100644 index fb947ae..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/ListHDFSStoresFunction.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved. - * This product is protected by U.S. and international copyright - * and intellectual property laws. Pivotal products are covered by - * more patents listed at http://www.pivotal.io/patents. - */ - -package com.gemstone.gemfire.management.internal.cli.functions; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; - -import org.apache.logging.log4j.Logger; - -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.execute.FunctionAdapter; -import com.gemstone.gemfire.cache.execute.FunctionContext; -import com.gemstone.gemfire.cache.hdfs.HDFSStore; -import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.InternalEntity; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.InternalCache; -import com.gemstone.gemfire.internal.logging.LogService; - -/** - * Function used by the 'list hdfs-stores' gfsh command to determine all the - * Hdfs stores that exist for the entire cache, distributed across the GemFire distributed system. - * on each member. - * - * @author Namrata Thanvi - */ - -public class ListHDFSStoresFunction extends FunctionAdapter implements InternalEntity { - - private static final long serialVersionUID = 1L; - - private static final String ID = ListHDFSStoresFunction.class.getName(); - - private static final Logger logger = LogService.getLogger(); - - protected Cache getCache() { - return CacheFactory.getAnyInstance(); - } - - protected DistributedMember getDistributedMemberId(Cache cache){ - return ((InternalCache)cache).getMyId(); - } - - public void execute(final FunctionContext context) { - Set<HdfsStoreDetails> hdfsStores = new HashSet<HdfsStoreDetails>(); - try { - final Cache cache = getCache(); - if (cache instanceof GemFireCacheImpl) { - final GemFireCacheImpl gemfireCache = (GemFireCacheImpl)cache; - final DistributedMember member = getDistributedMemberId(cache); - for (final HDFSStore store : gemfireCache.getHDFSStores()) { - hdfsStores.add(new HdfsStoreDetails (store.getName() , member.getId() , member.getName())); - } - } - context.getResultSender().lastResult(hdfsStores); - } catch (Exception e) { - context.getResultSender().sendException(e); - } - } - - @Override - public String getId() { - return ID; - } - - - public static class HdfsStoreDetails implements Serializable { - private static final long serialVersionUID = 1L; - private String storeName; - private String memberId, memberName; - - public HdfsStoreDetails(String storeName, String memberId, String memberName) { - super(); - this.storeName = storeName; - this.memberId = memberId; - this.memberName = memberName; - } - - public String getStoreName() { - return storeName; - } - - public String getMemberId() { - return memberId; - } - - public String getMemberName() { - return memberName; - } - -} -} - - http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/RegionFunctionArgs.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/RegionFunctionArgs.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/RegionFunctionArgs.java index bd5e196..f7b2b4d 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/RegionFunctionArgs.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/RegionFunctionArgs.java @@ -70,48 +70,9 @@ public class RegionFunctionArgs implements Serializable { private final boolean isSetCompressor; private Boolean offHeap; private final boolean isSetOffHeap; - private String hdfsStoreName; - private Boolean isSetHdfsWriteOnly = false; - private Boolean hdfsWriteOnly; - private RegionAttributes<?, ?> regionAttributes; public RegionFunctionArgs(String regionPath, - RegionShortcut regionShortcut, String useAttributesFrom, - boolean skipIfExists, String keyConstraint, String valueConstraint, - Boolean statisticsEnabled, - RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime, - RegionFunctionArgs.ExpirationAttrs entryExpirationTTL, - RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime, - RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, String diskStore, - Boolean diskSynchronous, Boolean enableAsyncConflation, - Boolean enableSubscriptionConflation, String[] cacheListeners, - String cacheLoader, String cacheWriter, String[] asyncEventQueueIds, - String[] gatewaySenderIds, Boolean concurrencyChecksEnabled, - Boolean cloningEnabled, Integer concurrencyLevel, String prColocatedWith, - Integer prLocalMaxMemory, Long prRecoveryDelay, - Integer prRedundantCopies, Long prStartupRecoveryDelay, - Long prTotalMaxMemory, Integer prTotalNumBuckets, Integer evictionMax, - String compressor, Boolean offHeap , String hdfsStoreName , Boolean hdfsWriteOnly) { - this(regionPath, regionShortcut, useAttributesFrom, skipIfExists, - keyConstraint, valueConstraint, statisticsEnabled, - entryExpirationIdleTime, entryExpirationTTL, - regionExpirationIdleTime, regionExpirationTTL, diskStore, - diskSynchronous, enableAsyncConflation, - enableSubscriptionConflation, cacheListeners, cacheLoader, - cacheWriter, asyncEventQueueIds, gatewaySenderIds, - concurrencyChecksEnabled, cloningEnabled, concurrencyLevel, - prColocatedWith, prLocalMaxMemory, prRecoveryDelay, - prRedundantCopies, prStartupRecoveryDelay, prTotalMaxMemory, - prTotalNumBuckets, evictionMax, compressor, offHeap); - this.isSetHdfsWriteOnly = hdfsWriteOnly != null; - if (isSetHdfsWriteOnly) { - this.hdfsWriteOnly = hdfsWriteOnly; - } - if (hdfsStoreName != null ) - this.hdfsStoreName = hdfsStoreName; - } - public RegionFunctionArgs(String regionPath, RegionShortcut regionShortcut, String useAttributesFrom, boolean skipIfExists, String keyConstraint, String valueConstraint, Boolean statisticsEnabled, @@ -219,8 +180,7 @@ public class RegionFunctionArgs implements Serializable { Integer prLocalMaxMemory, Long prRecoveryDelay, Integer prRedundantCopies, Long prStartupRecoveryDelay, Long prTotalMaxMemory, Integer prTotalNumBuckets, - Boolean offHeap, String hdfsStoreName , Boolean hdfsWriteOnly , - RegionAttributes<?, ?> regionAttributes) { + Boolean offHeap, RegionAttributes<?, ?> regionAttributes) { this(regionPath, null, useAttributesFrom, skipIfExists, keyConstraint, valueConstraint, statisticsEnabled, entryExpirationIdleTime, entryExpirationTTL, regionExpirationIdleTime, regionExpirationTTL, @@ -230,7 +190,7 @@ public class RegionFunctionArgs implements Serializable { concurrencyChecksEnabled, cloningEnabled, concurrencyLevel, prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies, prStartupRecoveryDelay, - prTotalMaxMemory, prTotalNumBuckets, null, null, offHeap , hdfsStoreName , hdfsWriteOnly); + prTotalMaxMemory, prTotalNumBuckets, null, null, offHeap); this.regionAttributes = regionAttributes; } @@ -277,28 +237,6 @@ public class RegionFunctionArgs implements Serializable { } /** - * @return the hdfsStoreName - */ - public String getHDFSStoreName() { - return this.hdfsStoreName; - } - - /** - * @return the hdfsWriteOnly - */ - public Boolean getHDFSWriteOnly() { - return this.hdfsWriteOnly; - } - - /** - * @return the isSetHDFSWriteOnly - */ - public Boolean isSetHDFSWriteOnly() { - return this.isSetHdfsWriteOnly; - } - - - /** * @return the valueConstraint */ public String getValueConstraint() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java index a4561bf..5ae8e82 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java @@ -11,10 +11,7 @@ package com.gemstone.gemfire.management.internal.cli.i18n; import java.text.MessageFormat; import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory; import com.gemstone.gemfire.cache.server.CacheServer; -import com.gemstone.gemfire.cache.wan.GatewayEventFilter; -import com.gemstone.gemfire.cache.wan.GatewayEventSubstitutionFilter; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.SharedConfiguration; import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; @@ -104,8 +101,6 @@ public class CliStrings { public static final String TOPIC_SHARED_CONFIGURATION = "Cluster Configuration"; public static final String TOPIC_SHARED_CONFIGURATION_HELP = "Configuration for cluster and various groups. It consists of cache.xml, gemfire properties and deployed jars.\nChanges due to gfshs command are persisted to the locator hosting the cluster configuration service."; public static final String TOPIC_CHANGELOGLEVEL = "User can change the log-level for a memeber run time and generate log contents as per the need"; - public static final String TOPIC_GEMFIRE_HDFSSTORE = "Hdfs Store"; - public static final String TOPIC_GEMFIRE_HDFSSTORE__DESC = "Hdfs stores are used to persist data to hadoop distributed file system as a backup to your in-memory copy or as overflow storage when eviction criteria is specified."; /*-************************************************************************* * ********* String Constants other than command name, options & help ****** @@ -680,114 +675,7 @@ public class CliStrings { public static final String CREATE_REGION__OFF_HEAP = "off-heap"; public static final String CREATE_REGION__OFF_HEAP__HELP = "Causes the values of the region to be stored in off-heap memory. The default is on heap."; - public static final String CREATE_REGION__HDFSSTORE_NAME = "hdfs-store"; - public static final String CREATE_REGION__HDFSSTORE_NAME__HELP = "HDFS Store to be used by this region. \"list hdfs-store\" can be used to display existing HDFSStores."; - public static final String CREATE_REGION__HDFSSTORE_WRITEONLY = "hdfs-write-only"; - public static final String CREATE_REGION__HDFSSTORE_WRITEONLY__HELP = "HDFS write-only mode will be used. All data will be persisted in the HDFS store, and user can access the stored data only through the MapReduce API"; - /* hdfsstore commands */ - public static final String CREATE_HDFS_STORE ="create hdfs-store"; - public static final String CREATE_HDFS_STORE__HELP = "Create a hdfsstore and persist region data on the specified hadoop cluster."; - public static final String CREATE_HDFS_STORE__NAME = "name"; - public static final String CREATE_HDFS_STORE__NAME__HELP = "Name of the store."; - public static final String CREATE_HDFS_STORE__NAMENODE = "namenode"; - public static final String CREATE_HDFS_STORE__NAMENODE__HELP = "The URL of the Hadoop NameNode for your HD cluster.HDFSStore persists data on a HDFS cluster identified by cluster's NameNode URL or NameNode Service URL.NameNode URL can also be provided via hdfs-site.xml"; - public static final String CREATE_HDFS_STORE__HOMEDIR = "home-dir"; - public static final String CREATE_HDFS_STORE__HOMEDIR__HELP ="The HDFS directory path in which HDFSStore stores files. The value must not contain the NameNode URL"; - public static final String CREATE_HDFS_STORE__READCACHESIZE= "read-cache-size"; - public static final String CREATE_HDFS_STORE__READCACHESIZE__HELP ="The maximum amount of memory in megabytes used by HDFSStore read cache."; - public static final String CREATE_HDFS_STORE__BATCHSIZE = "batch-size"; - public static final String CREATE_HDFS_STORE__BATCHSIZE__HELP ="HDFSStore buffer data is persisted on HDFS in batches, and the BatchSize defines the maximum size (in megabytes) of each batch that is written to HDFS."; - public static final String CREATE_HDFS_STORE__BATCHINTERVAL = "batch-interval"; - public static final String CREATE_HDFS_STORE__BATCHINTERVAL__HELP ="It defines the maximum time that can elapse between writing batches to HDFS. "; - public static final String CREATE_HDFS_STORE__MAXMEMORY = "max-memory"; - public static final String CREATE_HDFS_STORE__MAXMEMORY__HELP ="The maximum amount of memory in megabytes used by HDFSStore"; - public static final String CREATE_HDFS_STORE__DISPATCHERTHREADS = "dispatcher-threads"; - public static final String CREATE_HDFS_STORE__DISPATCHERTHREADS__HELP ="The maximum number of threads (per region) used to write batches of HDFS."; - public static final String CREATE_HDFS_STORE__BUFFERPERSISTENT = "buffer-persistent"; - public static final String CREATE_HDFS_STORE__BUFFERPERSISTENT__HELP ="Configure if HDFSStore in-memory buffer data, that has not been persisted on HDFS yet, should be persisted to a local disk to buffer prevent data loss"; - public static final String CREATE_HDFS_STORE__SYNCDISKWRITE = "synchronous-disk-write"; - public static final String CREATE_HDFS_STORE__SYNCDISKWRITE__HELP ="Enable or disable synchronous writes to the local DiskStore."; - public static final String CREATE_HDFS_STORE__DISKSTORENAME = "disk-store-name"; - public static final String CREATE_HDFS_STORE__DISKSTORENAME__HELP ="The named DiskStore to use for any local disk persistence needs of HDFSStore."; - public static final String CREATE_HDFS_STORE__MINORCOMPACT= "minor-compact"; - public static final String CREATE_HDFS_STORE__MINORCOMPACT__HELP ="Minor compaction reorganizes data in files to optimize read performance and reduce number of files created on HDFS."; - - public static final String CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS = "minor-compaction-threads"; - public static final String CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS__HELP ="The maximum number of threads that GemFire uses to perform minor compaction in this HDFS store."; - public static final String CREATE_HDFS_STORE__MAJORCOMPACT= "major-compact"; - public static final String CREATE_HDFS_STORE__MAJORCOMPACT__HELP ="Major compaction removes old values of a key and deleted records from the HDFS files."; - public static final String CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL= "major-compaction-interval"; - public static final String CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL__HELP ="Interval Between two major compactions."; - public static final String CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS = "major-compaction-threads"; - public static final String CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS__HELP ="The maximum number of threads that GemFire uses to perform major compaction in this HDFS store."; - public static final String CREATE_HDFS_STORE__PURGEINTERVAL = "purge-interval"; - public static final String CREATE_HDFS_STORE__PURGEINTERVAL__HELP ="PurgeInterval defines the amount of time old files remain available for MapReduce jobs. After this interval has passed, old files are deleted."; - public static final String CREATE_HDFS_STORE__WRITEONLYFILESIZE = "max-write-only-file-size"; - public static final String CREATE_HDFS_STORE__WRITEONLYFILESIZE__HELP ="For HDFS write-only regions, this defines the maximum size (in megabytes) that an HDFS log file can reach before HDFSStore closes the file and begins writing to a new file."; - public static final String CREATE_HDFS_STORE__FILEROLLOVERINTERVAL = "write-only-file-rollover-interval"; - public static final String CREATE_HDFS_STORE__FILEROLLOVERINTERVAL__HELP ="For HDFS write-only regions, this defines the maximum time that can elapse before HDFSStore closes an HDFS file and begins writing to a new file."; - public static final String CREATE_HDFS_STORE__CLIENTCONFIGFILE = "client-config-files"; - public static final String CREATE_HDFS_STORE__CLIENTCONFIGFILE__HELP ="The full path to the HDFS client configuration file that the store uses.The full path to the HDFS client configuration files, for e.g. hdfs-site.xml and core-site.xml. These files must be accessible to any node where an instance of this HDFSStore will be created"; - public static final String CREATE_HDFS_STORE__ERROR_WHILE_CREATING_REASON_0 = "An error occurred while creating the hdfs store: \"{0}\""; - public static final String CREATE_HDFS_STORE__GROUP = "group"; - public static final String CREATE_HDFS_STORE__GROUP__HELP = "Group(s) of members on which the hdfs store will be created. If no group is specified the hdfs store will be created on all members."; - - /*HDFS describe command*/ - public static final String DESCRIBE_HDFS_STORE = "describe hdfs-store"; - public static final String DESCRIBE_HDFS_STORE__HELP = "Display information about a hdfs store."; - public static final String DESCRIBE_HDFS_STORE__NAME = "name"; - public static final String DESCRIBE_HDFS_STORE__NAME__HELP = "name of the hdfs store"; - public static final String DESCRIBE_HDFS_STORE__MEMBER = "member"; - public static final String DESCRIBE_HDFS_STORE__MEMBER__HELP = "Name/Id of the member with the hdfs store to be described."; - public static final String DESCRIBE_HDFS_STORE__ERROR_MESSAGE = "An error occurred while getting information about the hdfs store: \"{0}\""; - - /*HDFS list command*/ - public static final String LIST_HDFS_STORE = "list hdfs-stores"; - public static final String LIST_HDFS_STORE__HELP = "Display hdfs stores for all members."; - public static final String LIST_HDFS_STORE__NAME__HELP = "name of the hdfs store"; - public static final String LIST_HDFS_STORE__ERROR_MESSAGE = "An error occurred while collecting Hdfs Store information for all members across the GemFire cluster: %1$s"; - public static final String LIST_HDFS_STORE__HDFS_STORES_NOT_FOUND_MESSAGE = "No Hdfs Stores Found"; - - - /* 'destroy hdfs-store' command */ - public static final String DESTROY_HDFS_STORE = "destroy hdfs-store"; - public static final String DESTROY_HDFS_STORE__HELP = "Destroy a hdfs store"; - public static final String DESTROY_HDFS_STORE__NAME = "name"; - public static final String DESTROY_HDFS_STORE__NAME__HELP = "Name of the hdfs store that will be destroyed."; - public static final String DESTROY_HDFS_STORE__GROUP = "group"; - public static final String DESTROY_HDFS_STORE__GROUP__HELP = "Group(s) of members on which the hdfs store will be destroyed. If no group is specified the hdfs store will be destroyed on all members."; - public static final String DESTROY_HDFS_STORE__ERROR_WHILE_DESTROYING_REASON_0 = "An error occurred while destroying the hdfs store: \"{0}\""; - - /* 'alter hdfs-store' command */ - public static final String ALTER_HDFS_STORE = "alter hdfs-store"; - public static final String ALTER_HDFS_STORE__HELP = "Alter a hdfs store"; - public static final String ALTER_HDFS_STORE__NAME = "name"; - public static final String ALTER_HDFS_STORE__NAME__HELP = "Name of the hdfs store that will be Altered."; - public static final String ALTER_HDFS_STORE__GROUP = "group"; - public static final String ALTER_HDFS_STORE__GROUP__HELP = "Group(s) of members on which the hdfs store will be altered. If no group is specified the hdfs store will be altered on all members."; - public static final String ALTER_HDFS_STORE__ERROR_WHILE_ALTERING_REASON_0 = "An error occurred while altering the hdfs store: \"{0}\""; - public static final String ALTER_HDFS_STORE__BATCHSIZE = "batch-size"; - public static final String ALTER_HDFS_STORE__BATCHSIZE__HELP ="HDFSStore buffer data is persisted on HDFS in batches, and the BatchSize defines the maximum size (in megabytes) of each batch that is written to HDFS."; - public static final String ALTER_HDFS_STORE__BATCHINTERVAL = "batch-interval"; - public static final String ALTER_HDFS_STORE__BATCHINTERVAL__HELP ="It defines the maximum time that can elapse between writing batches to HDFS. "; - public static final String ALTER_HDFS_STORE__MINORCOMPACT= "minor-compact"; - public static final String ALTER_HDFS_STORE__MINORCOMPACT__HELP ="Minor compaction reorganizes data in files to optimize read performance and reduce number of files created on HDFS."; - public static final String ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS = "minor-compaction-threads"; - public static final String ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS__HELP ="The maximum number of threads that GemFire uses to perform minor compaction in this HDFS store."; - public static final String ALTER_HDFS_STORE__MAJORCOMPACT= "major-compact"; - public static final String ALTER_HDFS_STORE__MAJORCOMPACT__HELP ="Major compaction removes old values of a key and deleted records from the HDFS files."; - public static final String ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL= "major-compaction-interval"; - public static final String ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL__HELP ="Interval Between two major compactions."; - public static final String ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS = "major-compaction-threads"; - public static final String ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS__HELP ="The maximum number of threads that GemFire uses to perform major compaction in this HDFS store."; - public static final String ALTER_HDFS_STORE__PURGEINTERVAL = "purge-interval"; - public static final String ALTER_HDFS_STORE__PURGEINTERVAL__HELP ="PurgeInterval defines the amount of time old files remain available for MapReduce jobs. After this interval has passed, old files are deleted."; - public static final String ALTER_HDFS_STORE__FILEROLLOVERINTERVAL = "write-only-file-rollover-interval"; - public static final String ALTER_HDFS_STORE__FILEROLLOVERINTERVAL__HELP = "For HDFS write-only regions, this defines the maximum time that can elapse before HDFSStore closes an HDFS file and begins writing to a new file."; - public static final String ALTER_HDFS_STORE__WRITEONLYFILESIZE = "max-write-only-file-size"; - public static final String ALTER_HDFS_STORE__WRITEONLYFILESIZE__HELP ="For HDFS write-only regions, this defines the maximum size (in megabytes) that an HDFS log file can reach before HDFSStore closes the file and begins writing to a new file."; - /* debug command */ public static final String DEBUG = "debug"; public static final String DEBUG__HELP = "Enable/Disable debugging output in GFSH.";
