This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new c0be3ec GEODE-5006: Remove unused ObjectResultData (#1756)
c0be3ec is described below
commit c0be3eccc62963b3680f61599cf1b8c2520b2dd4
Author: Jens Deppe <[email protected]>
AuthorDate: Mon Apr 9 09:17:10 2018 -0700
GEODE-5006: Remove unused ObjectResultData (#1756)
- Also remove associated and unused RegionAttributesInfo, RegionDetails,
RegionMemberDetails and CliJsonSerializable*
---
.../cli/commands/dto/RegionAttributesInfo.java | 162 --------------
.../internal/cli/commands/dto/RegionDetails.java | 245 ---------------------
.../cli/commands/dto/RegionMemberDetails.java | 205 -----------------
.../internal/cli/result/CliJsonSerializable.java | 42 ----
.../cli/result/CliJsonSerializableFactory.java | 46 ----
.../cli/result/CliJsonSerializableIds.java | 29 ---
.../internal/cli/result/CommandResult.java | 161 +-------------
.../internal/cli/result/ObjectResultData.java | 86 --------
.../internal/cli/result/ResultBuilder.java | 37 ----
.../management/internal/cli/result/ResultData.java | 1 -
.../management/internal/cli/util/JsonUtil.java | 48 ----
11 files changed, 1 insertion(+), 1061 deletions(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionAttributesInfo.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionAttributesInfo.java
deleted file mode 100644
index 7505d24..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionAttributesInfo.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands.dto;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import org.apache.geode.management.internal.cli.result.CliJsonSerializable;
-import org.apache.geode.management.internal.cli.util.JsonUtil;
-
-
-public class RegionAttributesInfo implements CliJsonSerializable {
- private static Map<String, String> nameToDisplayName = new HashMap<String,
String>();
-
- static {
- nameToDisplayName.put("cacheLoader", "Cache Loader");
- nameToDisplayName.put("cacheWriter", "Cache Writer");
- nameToDisplayName.put("keyConstraint", "Key Constraint");
- nameToDisplayName.put("valueConstraint", "Value Constraint");
- }
-
- private String cacheLoader;
- private String cacheWriter;
- private String keyConstraint;
- private String valueConstraint;
- private String[] fieldsToSkipOnUI;
-
- public RegionAttributesInfo() {}
-
- /**
- * @param cacheLoader
- * @param cacheWriter
- * @param keyConstraint
- * @param valueConstraint
- */
- public RegionAttributesInfo(String cacheLoader, String cacheWriter, String
keyConstraint,
- String valueConstraint) {
- this.cacheLoader = cacheLoader;
- this.cacheWriter = cacheWriter;
- this.keyConstraint = keyConstraint;
- this.valueConstraint = valueConstraint;
- }
-
- public String getCacheLoader() {
- return cacheLoader;
- }
-
- public String getCacheWriter() {
- return cacheWriter;
- }
-
- public String getKeyConstraint() {
- return keyConstraint;
- }
-
- public String getValueConstraint() {
- return valueConstraint;
- }
-
- @Override
- public String[] getFieldsToSkipOnUI() {
- return fieldsToSkipOnUI;
- }
-
- @Override
- public void setFieldsToSkipOnUI(String... fieldsToSkipOnUI) {
- this.fieldsToSkipOnUI = fieldsToSkipOnUI;
- }
-
- @Override
- public int getJSId() {
- return CLI_DOMAIN_OBJECT__REGION_ATTR_INFO;
- }
-
- @Override
- public Map<String, String> getFieldNameToDisplayName() {
- return nameToDisplayName;
- }
-
- @Override
- public void fromJson(GfJsonObject objectStateAsjson) {
- this.cacheLoader = JsonUtil.getString(objectStateAsjson, "cacheLoader");
- this.cacheWriter = JsonUtil.getString(objectStateAsjson, "cacheWriter");
- this.keyConstraint = JsonUtil.getString(objectStateAsjson,
"keyConstraint");
- this.valueConstraint = JsonUtil.getString(objectStateAsjson,
"valueConstraint");
- }
-
- @Override
- public int hashCode() { // eclipse generated
- final int prime = 31;
- int result = 1;
- result = prime * result + ((cacheLoader == null) ? 0 :
cacheLoader.hashCode());
- result = prime * result + ((cacheWriter == null) ? 0 :
cacheWriter.hashCode());
- result = prime * result + Arrays.hashCode(fieldsToSkipOnUI);
- result = prime * result + ((keyConstraint == null) ? 0 :
keyConstraint.hashCode());
- result = prime * result + ((valueConstraint == null) ? 0 :
valueConstraint.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) { // eclipse generated
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RegionAttributesInfo other = (RegionAttributesInfo) obj;
- if (cacheLoader == null) {
- if (other.cacheLoader != null)
- return false;
- } else if (!cacheLoader.equals(other.cacheLoader))
- return false;
- if (cacheWriter == null) {
- if (other.cacheWriter != null)
- return false;
- } else if (!cacheWriter.equals(other.cacheWriter))
- return false;
- if (!Arrays.equals(fieldsToSkipOnUI, other.fieldsToSkipOnUI))
- return false;
- if (keyConstraint == null) {
- if (other.keyConstraint != null)
- return false;
- } else if (!keyConstraint.equals(other.keyConstraint))
- return false;
- if (valueConstraint == null) {
- if (other.valueConstraint != null)
- return false;
- } else if (!valueConstraint.equals(other.valueConstraint))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("RegionAttributesInfo [cacheLoader=");
- builder.append(cacheLoader);
- builder.append(", cacheWriter=");
- builder.append(cacheWriter);
- builder.append(", keyConstraint=");
- builder.append(keyConstraint);
- builder.append(", valueConstraint=");
- builder.append(valueConstraint);
- builder.append("]");
- return builder.toString();
- }
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionDetails.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionDetails.java
deleted file mode 100644
index 59e8af9..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionDetails.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands.dto;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.management.internal.cli.json.GfJsonArray;
-import org.apache.geode.management.internal.cli.json.GfJsonException;
-import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import org.apache.geode.management.internal.cli.result.CliJsonSerializable;
-import org.apache.geode.management.internal.cli.util.JsonUtil;
-
-public class RegionDetails implements CliJsonSerializable {
- private static Map<String, String> nameToDisplayName = new HashMap<String,
String>();
-
- static {
- nameToDisplayName.put("name", "Name");
- nameToDisplayName.put("path", "Path");
- nameToDisplayName.put("partitioned", "Is Partitioned");
- nameToDisplayName.put("persistent", "Is Persistent");
- nameToDisplayName.put("groups", "Group(s)");
- nameToDisplayName.put("regionAttributesInfo", "Region Attributes");
- nameToDisplayName.put("regionMemberDetailsList", "On Members");
- }
-
- private String name;
- private String path;
- private boolean isPartitioned;
- private boolean isPersistent;
- private String[] groups;
-
- private RegionAttributesInfo regionAttributesInfo;
-
- private List<RegionMemberDetails> regionMemberDetailsList;
-
- private String[] fieldsToSkipOnUI;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public boolean isPartitioned() {
- return isPartitioned;
- }
-
- public void setPartitioned(boolean isPartitioned) {
- this.isPartitioned = isPartitioned;
- }
-
- public boolean isPersistent() {
- return isPersistent;
- }
-
- public void setPersistent(boolean isPersistent) {
- this.isPersistent = isPersistent;
- }
-
- public RegionAttributesInfo getRegionAttributesInfo() {
- return regionAttributesInfo;
- }
-
- public void setRegionAttributesInfo(RegionAttributesInfo
regionAttributesInfo) {
- this.regionAttributesInfo = regionAttributesInfo;
- }
-
- public List<RegionMemberDetails> getRegionMemberDetailsList() {
- return regionMemberDetailsList;
- }
-
- public void setRegionMemberDetailsList(List<RegionMemberDetails>
regionMemberDetailsList) {
- this.regionMemberDetailsList = regionMemberDetailsList;
- }
-
- public String[] getGroups() {
- return groups;
- }
-
- public void setGroups(String... groups) {
- this.groups = groups;
- }
-
-
- @Override
- public int getJSId() {
- return CLI_DOMAIN_OBJECT__REGION_DETAILS;
- }
-
- @Override
- public Map<String, String> getFieldNameToDisplayName() {
- return nameToDisplayName;
- }
-
- @Override
- public String[] getFieldsToSkipOnUI() {
- return fieldsToSkipOnUI;
- }
-
- @Override
- public void setFieldsToSkipOnUI(String... fieldsToSkipOnUI) {
- this.fieldsToSkipOnUI = fieldsToSkipOnUI;
- }
-
- @Override
- public void fromJson(GfJsonObject objectStateAsjson) {
- this.name = JsonUtil.getString(objectStateAsjson, "name");
- this.path = JsonUtil.getString(objectStateAsjson, "path");
- this.isPartitioned = JsonUtil.getBoolean(objectStateAsjson,
"partitioned"); // NOTE: no 'is' in
-
// names
- this.isPersistent = JsonUtil.getBoolean(objectStateAsjson, "persistent");
- this.groups = JsonUtil.getStringArray(objectStateAsjson, "groups");
-
- if (objectStateAsjson.has("regionAttributesInfo")) {
- this.regionAttributesInfo = new RegionAttributesInfo();
- this.regionAttributesInfo
- .fromJson(JsonUtil.getJSONObject(objectStateAsjson,
"regionAttributesInfo"));
- }
-
- List<CliJsonSerializable> retrievedList =
- JsonUtil.getList(objectStateAsjson, "regionMemberDetailsList");
- regionMemberDetailsList = new ArrayList<RegionMemberDetails>();
- for (int i = 0; i < retrievedList.size(); i++) { // What's the better way?
- regionMemberDetailsList.add((RegionMemberDetails) retrievedList.get(i));
- }
- }
-
- @Override
- public int hashCode() { // eclipse generated
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(fieldsToSkipOnUI);
- result = prime * result + Arrays.hashCode(groups);
- result = prime * result + (isPartitioned ? 1231 : 1237);
- result = prime * result + (isPersistent ? 1231 : 1237);
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((path == null) ? 0 : path.hashCode());
- result =
- prime * result + ((regionAttributesInfo == null) ? 0 :
regionAttributesInfo.hashCode());
- result = prime * result
- + ((regionMemberDetailsList == null) ? 0 :
regionMemberDetailsList.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) { // eclipse generated
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RegionDetails other = (RegionDetails) obj;
- if (!Arrays.equals(fieldsToSkipOnUI, other.fieldsToSkipOnUI))
- return false;
- if (!Arrays.equals(groups, other.groups))
- return false;
- if (isPartitioned != other.isPartitioned)
- return false;
- if (isPersistent != other.isPersistent)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (path == null) {
- if (other.path != null)
- return false;
- } else if (!path.equals(other.path))
- return false;
- if (regionAttributesInfo == null) {
- if (other.regionAttributesInfo != null)
- return false;
- } else if (!regionAttributesInfo.equals(other.regionAttributesInfo))
- return false;
- if (regionMemberDetailsList == null) {
- if (other.regionMemberDetailsList != null)
- return false;
- } else if (!areMemberDetailsSame(regionMemberDetailsList,
other.regionMemberDetailsList))
- return false;
- return true;
- }
-
- private boolean areMemberDetailsSame(List<RegionMemberDetails> mine,
- List<RegionMemberDetails> other) {
- if (other != null && other.size() == mine.size()) {
- for (int i = 0; i < mine.size(); i++) {
- if (!mine.get(i).equals(other.get(i))) {
- return false;
- }
- }
- } else {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("RegionDetails [name=");
- builder.append(name);
- builder.append(", path=");
- builder.append(path);
- builder.append(", isPartitioned=");
- builder.append(isPartitioned);
- builder.append(", isPersistent=");
- builder.append(isPersistent);
- builder.append(", groups=");
- builder.append(Arrays.toString(groups));
- builder.append(", regionAttributesInfo=");
- builder.append(regionAttributesInfo);
- builder.append(", regionMemberDetailsList=");
- builder.append(regionMemberDetailsList);
- builder.append("]");
- return builder.toString();
- }
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionMemberDetails.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionMemberDetails.java
deleted file mode 100644
index ac0ae6b..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/dto/RegionMemberDetails.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands.dto;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.geode.management.internal.cli.json.GfJsonArray;
-import org.apache.geode.management.internal.cli.json.GfJsonException;
-import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import org.apache.geode.management.internal.cli.result.CliJsonSerializable;
-import org.apache.geode.management.internal.cli.util.JsonUtil;
-
-public class RegionMemberDetails implements CliJsonSerializable {
- private static Map<String, String> nameToDisplayName = new HashMap<String,
String>();
-
- static {
- nameToDisplayName.put("id", "Member Id");
- nameToDisplayName.put("primaryEntryCount", "PrimaryEntryCount");
- nameToDisplayName.put("backupEntryCount", "BbackupEntryCount");
- nameToDisplayName.put("memory", "Memory");
- nameToDisplayName.put("numOfCopies", "NumOfCopies");
- nameToDisplayName.put("numOfBuckets", "NumOfBuckets");
- }
-
- private String id;
- private long primaryEntryCount;
- private long backupEntryCount;
- private String memory;
- private int numOfCopies;
- private int numOfBuckets;
-
- private String[] fieldsToSkipOnUI;
-
- public RegionMemberDetails() {}
-
- public RegionMemberDetails(String id, long primaryEntryCount, long
backupEntryCount,
- String memory, int numOfCopies, int numOfBuckets) {
- this.id = id;
- this.primaryEntryCount = primaryEntryCount;
- this.backupEntryCount = backupEntryCount;
- this.memory = memory;
- this.numOfCopies = numOfCopies;
- this.numOfBuckets = numOfBuckets;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public long getPrimaryEntryCount() {
- return primaryEntryCount;
- }
-
- public void setPrimaryEntryCount(long primaryEntryCount) {
- this.primaryEntryCount = primaryEntryCount;
- }
-
- public long getBackupEntryCount() {
- return backupEntryCount;
- }
-
- public void setBackupEntryCount(long backupEntryCount) {
- this.backupEntryCount = backupEntryCount;
- }
-
- public String getMemory() {
- return memory;
- }
-
- public void setMemory(String memory) {
- this.memory = memory;
- }
-
- public int getNumOfCopies() {
- return numOfCopies;
- }
-
- public void setNumOfCopies(int numOfCopies) {
- this.numOfCopies = numOfCopies;
- }
-
- public int getNumOfBuckets() {
- return numOfBuckets;
- }
-
- public void setNumOfBuckets(int numOfBuckets) {
- this.numOfBuckets = numOfBuckets;
- }
-
- @Override
- public int getJSId() {
- return CLI_DOMAIN_OBJECT__REGION_MEMBER_DETAILS;
- }
-
- @Override
- public Map<String, String> getFieldNameToDisplayName() {
- return nameToDisplayName;
- }
-
- @Override
- public String[] getFieldsToSkipOnUI() {
- return fieldsToSkipOnUI;
- }
-
- @Override
- public void setFieldsToSkipOnUI(String... fieldsToSkipOnUI) {
- this.fieldsToSkipOnUI = fieldsToSkipOnUI;
- }
-
- @Override
- public void fromJson(GfJsonObject objectStateAsjson) {
- this.id = JsonUtil.getString(objectStateAsjson, "id");
- this.primaryEntryCount = JsonUtil.getLong(objectStateAsjson,
"primaryEntryCount");
- this.backupEntryCount = JsonUtil.getLong(objectStateAsjson,
"backupEntryCount");
- this.memory = JsonUtil.getString(objectStateAsjson, "memory");
- this.numOfCopies = JsonUtil.getInt(objectStateAsjson, "numOfCopies");
- this.numOfBuckets = JsonUtil.getInt(objectStateAsjson, "numOfBuckets");
- this.fieldsToSkipOnUI = JsonUtil.getStringArray(objectStateAsjson,
"fieldsToSkipOnUI");
- }
-
-
-
- @Override
- public int hashCode() { // eclipse generated
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (backupEntryCount ^ (backupEntryCount >>>
32));
- result = prime * result + Arrays.hashCode(fieldsToSkipOnUI);
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((memory == null) ? 0 : memory.hashCode());
- result = prime * result + numOfBuckets;
- result = prime * result + numOfCopies;
- result = prime * result + (int) (primaryEntryCount ^ (primaryEntryCount
>>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) { // eclipse generated
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RegionMemberDetails other = (RegionMemberDetails) obj;
- if (backupEntryCount != other.backupEntryCount)
- return false;
- if (!Arrays.equals(fieldsToSkipOnUI, other.fieldsToSkipOnUI))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (memory == null) {
- if (other.memory != null)
- return false;
- } else if (!memory.equals(other.memory))
- return false;
- if (numOfBuckets != other.numOfBuckets)
- return false;
- if (numOfCopies != other.numOfCopies)
- return false;
- if (primaryEntryCount != other.primaryEntryCount)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("RegionMemberDetails [id=");
- builder.append(id);
- builder.append(", primaryEntryCount=");
- builder.append(primaryEntryCount);
- builder.append(", backupEntryCount=");
- builder.append(backupEntryCount);
- builder.append(", memory=");
- builder.append(memory);
- builder.append(", numOfCopies=");
- builder.append(numOfCopies);
- builder.append(", numOfBuckets=");
- builder.append(numOfBuckets);
- builder.append("]");
- return builder.toString();
- }
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializable.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializable.java
deleted file mode 100644
index 7807f0e..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializable.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.result;
-
-import java.util.Map;
-
-import org.apache.geode.management.internal.cli.json.GfJsonObject;
-
-/**
- *
- *
- * @since GemFire 7.0
- */
-public interface CliJsonSerializable extends CliJsonSerializableIds {
- String FIELDS_TO_SKIP = "fieldNameToDisplayName, JSId, outputFormat,
fieldsToSkipOnUI";
- String JSID = "JSId";
- String FIELDS_TO_DISPLAYNAME_MAPPING = "fieldNameToDisplayName";
- String FIELDS_TO_SKIP_ON_UI = "fieldsToSkipOnUI";
- String OUTPUT_FORMAT = "outputFormat";
-
- int getJSId();
-
- Map<String, String> getFieldNameToDisplayName();
-
- String[] getFieldsToSkipOnUI();
-
- void setFieldsToSkipOnUI(String... fieldsToSkipOnUI);
-
- void fromJson(GfJsonObject objectStateAsjson);
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableFactory.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableFactory.java
deleted file mode 100644
index 6deb869..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.result;
-
-import
org.apache.geode.management.internal.cli.commands.dto.RegionAttributesInfo;
-import org.apache.geode.management.internal.cli.commands.dto.RegionDetails;
-import
org.apache.geode.management.internal.cli.commands.dto.RegionMemberDetails;
-
-public class CliJsonSerializableFactory implements CliJsonSerializableIds {
-
- public static CliJsonSerializable getCliJsonSerializable(int id) {
- CliJsonSerializable cliJsonSerializable = null;
-
- switch (id) {
- case CLI_DOMAIN_OBJECT__REGION_DETAILS:
- cliJsonSerializable = new RegionDetails();
- break;
-
- case CLI_DOMAIN_OBJECT__REGION_ATTR_INFO:
- cliJsonSerializable = new RegionAttributesInfo();
- break;
-
- case CLI_DOMAIN_OBJECT__REGION_MEMBER_DETAILS:
- cliJsonSerializable = new RegionMemberDetails();
- break;
-
- default:
- throw new IllegalArgumentException("Could not find type with given
identifer.");
- }
-
- return cliJsonSerializable;
- }
-
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableIds.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableIds.java
deleted file mode 100644
index e5ffef3..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CliJsonSerializableIds.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.result;
-
-/**
- *
- *
- * @since GemFire 7.0
- */
-public interface CliJsonSerializableIds {
- /* sample objects 11-20 */
- int CLI_DOMAIN_OBJECT__REGION_DETAILS = 11;
- int CLI_DOMAIN_OBJECT__REGION_ATTR_INFO = 12;
- int CLI_DOMAIN_OBJECT__REGION_MEMBER_DETAILS = 13;
-
- /* CLI Data Transfer Objects 100 onwards - add below */
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CommandResult.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CommandResult.java
index e0553bb..f13cfc0 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CommandResult.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/CommandResult.java
@@ -16,12 +16,9 @@ package org.apache.geode.management.internal.cli.result;
import java.io.IOException;
import java.nio.file.Path;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Vector;
import java.util.stream.Collectors;
import java.util.zip.DataFormatException;
@@ -102,9 +99,7 @@ public class CommandResult implements Result {
private void buildData() {
try {
- if (ResultData.TYPE_OBJECT.equals(resultData.getType())) {
- buildObjectResultOutput();
- } else if (ResultData.TYPE_COMPOSITE.equals(resultData.getType())) {
+ if (ResultData.TYPE_COMPOSITE.equals(resultData.getType())) {
buildComposite();
} else {
GfJsonObject content = getContent();
@@ -171,160 +166,6 @@ public class CommandResult implements Result {
}
}
- private void buildObjectResultOutput() {
- try {
- Table resultTable = TableBuilder.newTable();
- resultTable.setColumnSeparator(" : ");
-
- addHeaderInTable(resultTable, getGfJsonObject());
-
- GfJsonObject content = getContent();
-
- GfJsonArray objectsArray =
content.getJSONArray(ObjectResultData.OBJECTS_ACCESSOR);
- if (objectsArray != null) {
- int numOfObjects = objectsArray.size();
-
- for (int i = 0; i < numOfObjects; i++) {
- GfJsonObject object = objectsArray.getJSONObject(i);
- buildObjectSection(resultTable, null, object, 0);
- }
- }
- addFooterInTable(resultTable, getGfJsonObject());
-
- resultLines.addAll(resultTable.buildTableList());
-
- } catch (GfJsonException e) {
- resultLines
- .add("Error occurred while processing Command Result. Internal Error
- Invalid Result.");
- } finally {
- isDataBuilt = true;
- }
- }
-
- private void buildObjectSection(Table table, RowGroup parentRowGroup,
GfJsonObject object,
- int depth) throws GfJsonException {
- Iterator<String> keys = object.keys();
- RowGroup rowGroup;
- if (parentRowGroup != null) {
- rowGroup = parentRowGroup;
- } else {
- rowGroup = table.newRowGroup();
- }
- GfJsonArray nestedCollection = null;
- GfJsonObject nestedObject = null;
-
- GfJsonObject fieldDisplayNames =
-
object.getJSONObject(CliJsonSerializable.FIELDS_TO_DISPLAYNAME_MAPPING);
-
- List<String> fieldsToSkipOnUI = null;
- if (object.has(CliJsonSerializable.FIELDS_TO_SKIP_ON_UI)) {
- GfJsonArray jsonArray =
object.getJSONArray(CliJsonSerializable.FIELDS_TO_SKIP_ON_UI);
- fieldsToSkipOnUI = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- fieldsToSkipOnUI.add(String.valueOf(jsonArray.get(i)));
- }
- }
-
- while (keys.hasNext()) {
- String key = keys.next();
-
- if (CliJsonSerializable.FIELDS_TO_SKIP.contains(key)
- || (fieldsToSkipOnUI != null && fieldsToSkipOnUI.contains(key))) {
- continue;
- }
-
- try {
- nestedCollection = object.getJSONArray(key);
- } catch (GfJsonException ignored) {
- }
-
- Object field = null;
- if (nestedCollection == null) {
- field = object.get(key);
- if (!isPrimitiveOrStringOrWrapper(field)) {
- nestedObject = object.getJSONObject(key);
- }
- }
- if (nestedCollection != null &&
isPrimitiveOrStringOrWrapperArray(nestedCollection)) {
- String str = nestedCollection.toString();
- field = str.substring(1, str.length() - 1);
- nestedCollection = null;
- }
-
- Row newRow = rowGroup.newRow();
- String prefix = "";
- for (int i = 0; i < depth; i++) {
- prefix += " . ";
- }
- String fieldNameToDisplay = fieldDisplayNames.getString(key);
-
- if (nestedCollection == null) {
- newRow.newLeftCol(prefix + fieldNameToDisplay);
- }
-
- if (nestedCollection != null) {
- Map<String, Integer> columnsMap = new HashMap<>();
-
- RowGroup newRowGroup = table.newRowGroup();
- newRowGroup.setColumnSeparator(" | ");
- newRowGroup.newBlankRow();
- newRowGroup.newRow().newLeftCol(fieldNameToDisplay);
- Row headerRow = newRowGroup.newRow();
-
- int numOfRows = nestedCollection.size();
- List<String> tableFieldsToSkipOnUI = null;
- for (int j = 0; j < numOfRows; j++) {
- GfJsonObject content = nestedCollection.getJSONObject(j);
- if (content.has(CliJsonSerializable.FIELDS_TO_SKIP_ON_UI)) {
- GfJsonArray jsonArray =
content.getJSONArray(CliJsonSerializable.FIELDS_TO_SKIP_ON_UI);
- tableFieldsToSkipOnUI = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- tableFieldsToSkipOnUI.add(String.valueOf(jsonArray.get(i)));
- }
- }
- GfJsonArray columnNames = content.names();
- int numOfColumns = columnNames.size();
-
- if (headerRow.isEmpty()) {
- GfJsonObject innerFieldDisplayNames =
-
content.getJSONObject(CliJsonSerializable.FIELDS_TO_DISPLAYNAME_MAPPING);
- for (int i = 0; i < numOfColumns; i++) {
-
- Object columnName = columnNames.get(i);
- if (CliJsonSerializable.FIELDS_TO_SKIP.contains((String)
columnName)
- || (tableFieldsToSkipOnUI != null
- && tableFieldsToSkipOnUI.contains(columnName))) {
- // skip file data if any
- continue;
- }
-
- headerRow.newCenterCol(innerFieldDisplayNames.getString((String)
columnName));
- columnsMap.put((String) columnName, i);
- }
- newRowGroup.newRowSeparator('-', false);
- }
- newRow = newRowGroup.newRow();
- for (int i = 0; i < numOfColumns; i++) {
-
- Object columnName = columnNames.get(i);
- if (CliJsonSerializable.FIELDS_TO_SKIP.contains((String)
columnName)
- || (tableFieldsToSkipOnUI != null &&
tableFieldsToSkipOnUI.contains(columnName))) {
- // skip file data if any
- continue;
- }
- newRow.newLeftCol(String.valueOf(content.get((String)
columnName)));
- }
- }
- } else if (nestedObject != null) {
- buildObjectSection(table, rowGroup, nestedObject, depth + 1);
- } else {
- newRow.newLeftCol(field);
- }
- nestedCollection = null;
- nestedObject = null;
- }
- }
-
private boolean isPrimitiveOrStringOrWrapper(Object object) {
boolean isPrimitive = false;
if (String.class.isInstance(object)) {
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ObjectResultData.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ObjectResultData.java
deleted file mode 100644
index ab30a7c..0000000
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ObjectResultData.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.result;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.geode.management.internal.cli.json.GfJsonArray;
-import org.apache.geode.management.internal.cli.json.GfJsonException;
-import org.apache.geode.management.internal.cli.json.GfJsonObject;
-
-/**
- *
- *
- * @since GemFire 7.0
- */
-public class ObjectResultData<T extends CliJsonSerializable> extends
AbstractResultData {
- public static final String OBJECTS_ACCESSOR = "__objects__";
-
- /* package */ ObjectResultData() {
- super();
- }
-
- /* package */ ObjectResultData(GfJsonObject gfJsonObject) {
- super(gfJsonObject);
- }
-
- @Override
- public String getType() {
- return TYPE_OBJECT;
- }
-
- public ObjectResultData<T> addObject(T infoBean) {
- try {
- contentObject.accumulateAsJSONObject(OBJECTS_ACCESSOR, infoBean);
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return this;
- }
-
- public ObjectResultData<T> addCollection(Collection<T> infoBeans) {
- for (T infoBean : infoBeans) {
- try {
- contentObject.accumulateAsJSONObject(OBJECTS_ACCESSOR, infoBean);
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- }
- return this;
- }
-
- public List<CliJsonSerializable> getAllObjects() {
- List<CliJsonSerializable> list = new ArrayList<CliJsonSerializable>();
- try {
- GfJsonArray rootJsonArray = contentObject.getJSONArray(OBJECTS_ACCESSOR);
- int size = rootJsonArray.size();
-
- GfJsonObject jsonObject = null;
- CliJsonSerializable cliJsonSerializable = null;
- for (int i = 0; i < size; i++) {
- jsonObject = rootJsonArray.getJSONObject(i);
- cliJsonSerializable = CliJsonSerializableFactory
-
.getCliJsonSerializable(jsonObject.getInt(CliJsonSerializable.JSID));
- cliJsonSerializable.fromJson(jsonObject);
- list.add(cliJsonSerializable);
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return list;
- }
-}
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
index f234850..db580db 100755
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
@@ -157,10 +157,6 @@ public class ResultBuilder {
return new CompositeResultData();
}
- public static <T extends CliJsonSerializable> ObjectResultData<T>
createObjectResultData() {
- return new ObjectResultData<>();
- }
-
/**
* Creates a {@link InfoResultData} object to start building result that is
required to be shown
* as an information without any specific format.
@@ -239,8 +235,6 @@ public class ResultBuilder {
resultData = new ErrorResultData(data);
} else if (ResultData.TYPE_COMPOSITE.equals(contentType)) {
resultData = new CompositeResultData(data);
- } else if (ResultData.TYPE_OBJECT.equals(contentType)) {
- resultData = new ObjectResultData<>(data);
} else {
ErrorResultData errorResultData = new ErrorResultData();
errorResultData.addLine("Can not detect result type, unknown response
format: " + json);
@@ -380,37 +374,6 @@ public class ResultBuilder {
throw new UnsupportedOperationException("This is read only result
data");
}
};
- } else if (ResultData.TYPE_OBJECT.equals(contentType)) {
- final ObjectResultData<?> wrapped = (ObjectResultData<?>) resultData;
- wrapperResultData = new ObjectResultData<CliJsonSerializable>() {
- @Override
- public ResultData addAsFile(String fileName, byte[] data, int
fileType, String message,
- boolean addTimeStampToName) {
- throw new UnsupportedOperationException("This is read only result
data");
- }
-
- @Override
- public ResultData addAsFile(String fileName, String fileContents,
String message,
- boolean addTimeStampToName) {
- throw new UnsupportedOperationException("This is read only result
data");
- }
-
- @Override
- public ObjectResultData<CliJsonSerializable> addCollection(
- Collection<CliJsonSerializable> infoBeans) {
- throw new UnsupportedOperationException("This is read only result
data");
- }
-
- @Override
- public ObjectResultData<CliJsonSerializable>
addObject(CliJsonSerializable infoBean) {
- throw new UnsupportedOperationException("This is read only result
data");
- }
-
- @Override
- public List<CliJsonSerializable> getAllObjects() {
- return wrapped.getAllObjects();
- }
- };
} else {
ErrorResultData errorResultData = new ErrorResultData();
errorResultData
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultData.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultData.java
index 7c36709..cc0b5ab 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultData.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultData.java
@@ -31,7 +31,6 @@ public interface ResultData {
String TYPE_COMPOSITE = "composite";
String TYPE_ERROR = "error";
String TYPE_INFO = "info";
- String TYPE_OBJECT = "object";
String TYPE_TABULAR = "table";
String getHeader();
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JsonUtil.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JsonUtil.java
index f40e782..f28bd03 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JsonUtil.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JsonUtil.java
@@ -18,7 +18,6 @@ import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -36,8 +35,6 @@ import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.management.internal.cli.json.GfJsonArray;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import org.apache.geode.management.internal.cli.result.CliJsonSerializable;
-import
org.apache.geode.management.internal.cli.result.CliJsonSerializableFactory;
import org.apache.geode.management.internal.cli.result.ResultDataException;
/**
@@ -480,51 +477,6 @@ public class JsonUtil {
return byteArray;
}
- public static List<CliJsonSerializable> getList(GfJsonObject jsonObject,
String byName) {
- List<CliJsonSerializable> cliJsonSerializables = Collections.emptyList();
- try {
- GfJsonArray cliJsonSerializableArray = jsonObject.getJSONArray(byName);
- int size = cliJsonSerializableArray.size();
- if (size > 0) {
- cliJsonSerializables = new ArrayList<CliJsonSerializable>();
- }
- for (int i = 0; i < size; i++) {
- GfJsonObject cliJsonSerializableState =
cliJsonSerializableArray.getJSONObject(i);
- int jsId = cliJsonSerializableState.getInt(CliJsonSerializable.JSID);
- CliJsonSerializable cliJsonSerializable =
- CliJsonSerializableFactory.getCliJsonSerializable(jsId);
- cliJsonSerializable.fromJson(cliJsonSerializableState);
- cliJsonSerializables.add(cliJsonSerializable);
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return cliJsonSerializables;
- }
-
- public static Set<CliJsonSerializable> getSet(GfJsonObject jsonObject,
String byName) {
- Set<CliJsonSerializable> cliJsonSerializables = Collections.emptySet();
- try {
- GfJsonArray cliJsonSerializableArray = jsonObject.getJSONArray(byName);
- int size = cliJsonSerializableArray.size();
- if (size > 0) {
- cliJsonSerializables = new HashSet<CliJsonSerializable>();
- }
- for (int i = 0; i < size; i++) {
- GfJsonObject cliJsonSerializableState =
cliJsonSerializableArray.getJSONObject(i);
- int jsId = cliJsonSerializableState.getInt(CliJsonSerializable.JSID);
- CliJsonSerializable cliJsonSerializable =
- CliJsonSerializableFactory.getCliJsonSerializable(jsId);
- cliJsonSerializable.fromJson(cliJsonSerializableState);
- cliJsonSerializables.add(cliJsonSerializable);
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return cliJsonSerializables;
- }
-
-
// For testing purpose
public static void main(String[] args) {
System.out.println(capitalize("key"));
--
To stop receiving notification emails like this one, please contact
[email protected].