http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertLevel.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertLevel.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertLevel.java new file mode 100755 index 0000000..1bcc0e6 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertLevel.java @@ -0,0 +1,168 @@ +/* + * 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.internal.admin.api; + +import org.apache.geode.internal.admin.Alert; +import org.apache.geode.internal.i18n.LocalizedStrings; + +/** + * Type-safe enumeration for {@link org.apache.geode.internal.admin.api.Alert Alert} level. + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public class AlertLevel implements java.io.Serializable { + private static final long serialVersionUID = -4752438966587392126L; + + public static final AlertLevel WARNING = new AlertLevel(Alert.WARNING, "WARNING"); + public static final AlertLevel ERROR = new AlertLevel(Alert.ERROR, "ERROR"); + public static final AlertLevel SEVERE = new AlertLevel(Alert.SEVERE, "SEVERE"); + + public static final AlertLevel OFF = new AlertLevel(Alert.OFF, "OFF"); + + /** The severity level of this AlertLevel. Greater is more severe. */ + private final transient int severity; + + /** The name of this AlertLevel. */ + private final transient String name; + + // The 4 declarations below are necessary for serialization + /** int used as ordinal to represent this AlertLevel */ + public final int ordinal = nextOrdinal++; + + private static int nextOrdinal = 0; + + private static final AlertLevel[] VALUES = {WARNING, ERROR, SEVERE, OFF}; + + private Object readResolve() throws java.io.ObjectStreamException { + return VALUES[ordinal]; // Canonicalize + } + + /** Creates a new instance of AlertLevel. */ + private AlertLevel(int severity, String name) { + this.severity = severity; + this.name = name; + } + + /** Return the AlertLevel represented by specified ordinal */ + public static AlertLevel fromOrdinal(int ordinal) { + return VALUES[ordinal]; + } + + /** + * Returns the <code>AlertLevel</code> for the given severity + * + * @throws IllegalArgumentException If there is no alert level with the given + * <code>severity</code> + */ + public static AlertLevel forSeverity(int severity) { + switch (severity) { + case Alert.WARNING: + return AlertLevel.WARNING; + case Alert.ERROR: + return AlertLevel.ERROR; + case Alert.SEVERE: + return AlertLevel.SEVERE; + case Alert.OFF: + return AlertLevel.OFF; + default: + throw new IllegalArgumentException(LocalizedStrings.AlertLevel_UNKNOWN_ALERT_SEVERITY_0 + .toLocalizedString(Integer.valueOf(severity))); + } + } + + /** + * Returns the <code>AlertLevel</code> with the given name + * + * @throws IllegalArgumentException If there is no alert level named <code>name</code> + */ + public static AlertLevel forName(String name) { + for (int i = 0; i < VALUES.length; i++) { + AlertLevel level = VALUES[i]; + if (level.getName().equalsIgnoreCase(name)) { + return level; + } + } + + throw new IllegalArgumentException( + LocalizedStrings.AlertLevel_THERE_IS_NO_ALERT_LEVEL_0.toLocalizedString(name)); + } + + public int getSeverity() { + return this.severity; + } + + public String getName() { + return this.name; + } + + public static AlertLevel[] values() { + return VALUES; + } + + /** + * Returns a string representation for this alert level. + * + * @return the name of this alert level + */ + @Override + public String toString() { + return this.name /* + "=" + this.severity */; + } + + /** + * Indicates whether some other object is "equal to" this one. + * + * @param other the reference object with which to compare. + * @return true if this object is the same as the obj argument; false otherwise. + */ + @Override + public boolean equals(Object other) { + if (other == this) + return true; + if (other == null) + return false; + if (!(other instanceof AlertLevel)) + return false; + final AlertLevel that = (AlertLevel) other; + + if (this.severity != that.severity) + return false; + if (this.name != null && !this.name.equals(that.name)) + return false; + + return true; + } + + /** + * Returns a hash code for the object. This method is supported for the benefit of hashtables such + * as those provided by java.util.Hashtable. + * + * @return the integer 0 if description is null; otherwise a unique integer. + */ + @Override + public int hashCode() { + int result = 17; + final int mult = 37; + + result = mult * result + this.severity; + result = mult * result + (this.name == null ? 0 : this.name.hashCode()); + + return result; + } + +}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertListener.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertListener.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertListener.java new file mode 100755 index 0000000..073431f --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/AlertListener.java @@ -0,0 +1,30 @@ +/* + * 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.internal.admin.api; + +/** + * A listener whose callback methods are invoked when an {@link Alert} is received. + * + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface AlertListener extends java.util.EventListener { + + /** + * Invoked when an <code>Alert</code> is received. + */ + public void alert(Alert alert); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/BackupStatus.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/BackupStatus.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/BackupStatus.java new file mode 100644 index 0000000..f9d396e --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/BackupStatus.java @@ -0,0 +1,46 @@ +/* + * 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.internal.admin.api; + +import java.util.Map; +import java.util.Set; + +import org.apache.geode.cache.persistence.PersistentID; +import org.apache.geode.distributed.DistributedMember; + +/** + * The status of a backup operation, returned by + * {@link AdminDistributedSystem#backupAllMembers(java.io.File,java.io.File)}. + * + * @since GemFire 6.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface BackupStatus { + + /** + * Returns a map of disk stores that were successfully backed up. The key is an online distributed + * member. The value is the set of disk stores on that distributed member. + */ + Map<DistributedMember, Set<PersistentID>> getBackedUpDiskStores(); + + /** + * Returns the set of disk stores that were known to be offline at the time of the backup. These + * members were not backed up. If this set is not empty the backup may not contain a complete + * snapshot of any partitioned regions in the distributed system. + */ + Set<PersistentID> getOfflineDiskStores(); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheDoesNotExistException.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheDoesNotExistException.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheDoesNotExistException.java new file mode 100644 index 0000000..7ff2f06 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheDoesNotExistException.java @@ -0,0 +1,80 @@ +/* + * 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.internal.admin.api; + +/** + * An <code>CacheDoesNotExistException</code> is thrown when an attempt is made to get a cache and + * one does not exist. + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public class CacheDoesNotExistException extends AdminException { + private static final long serialVersionUID = -1639933911265729978L; + + /** + * Constructs a new exception with <code>null</code> as its detail message. The cause is not + * initialized, and may subsequently be initialized by a call to {@link Throwable#initCause}. + */ + public CacheDoesNotExistException() { + super(); + } + + /** + * Constructs a new exception with the specified detail message. The cause is not initialized, and + * may subsequently be initialized by a call to {@link Throwable#initCause}. + * + * @param message the detail message. The detail message is saved for later retrieval by the + * {@link #getMessage()} method. + */ + public CacheDoesNotExistException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * <p> + * Note that the detail message associated with <code>cause</code> is <i>not</i> automatically + * incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by the + * {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). + * (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or + * unknown.) + */ + public CacheDoesNotExistException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * <tt>(cause==null ? null : cause.toString())</tt> (which typically contains the class and detail + * message of <tt>cause</tt>). This constructor is useful for exceptions that are little more than + * wrappers for other throwables (for example, {@link java.security.PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). + * (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or + * unknown.) + */ + public CacheDoesNotExistException(Throwable cause) { + super(cause); + } + +} + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheHealthConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheHealthConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheHealthConfig.java new file mode 100644 index 0000000..69c0c82 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheHealthConfig.java @@ -0,0 +1,151 @@ +/* + * 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.internal.admin.api; + +/** + * Provides configuration information relating to the health of a member of a GemFire distributed + * system that hosts a GemFire {@link org.apache.geode.cache.Cache Cache}. + * + * <P> + * + * If any of the following criteria is true, then a cache member is considered to be in + * {@link GemFireHealth#OKAY_HEALTH OKAY_HEALTH}. + * + * <UL> + * + * <LI><code>netSearch</code> operations take {@linkplain #getMaxNetSearchTime too long} to + * complete.</LI> + * + * <LI>Cache <code>load</code> operations take {@linkplain #getMaxLoadTime too long} to + * complete.</LI> + * + * <LI>The overall cache {@link #getMinHitRatio hitRatio} is too small</LI> + * + * <LI>The number of entries in the Cache {@link #getMaxEventQueueSize event delivery queue} is too + * large.</LI> + * + * <LI>If one of the regions is configured with {@link org.apache.geode.cache.LossAction#FULL_ACCESS + * FULL_ACCESS} on role loss.</LI> + * + * </UL> + * + * If any of the following criteria is true, then a cache member is considered to be in + * {@link GemFireHealth#POOR_HEALTH POOR_HEALTH}. + * + * <UL> + * + * <LI>If one of the regions is configured with {@link org.apache.geode.cache.LossAction#NO_ACCESS + * NO_ACCESS} on role loss.</LI> + * + * <LI>If one of the regions is configured with + * {@link org.apache.geode.cache.LossAction#LIMITED_ACCESS LIMITED_ACCESS} on role loss.</LI> + * + * </UL> + * + * <UL> + * + * </UL> + * + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface CacheHealthConfig { + + /** + * The default maximum number of milliseconds a <code>netSearch</code> operation can take before + * the cache member is considered to be unhealthy. + */ + public static final long DEFAULT_MAX_NET_SEARCH_TIME = 60 * 1000; + + /** + * The default maximum mumber of milliseconds a cache <code>load</code> operation can take before + * the cache member is considered to be unhealthy. + */ + public static final long DEFAULT_MAX_LOAD_TIME = 60 * 1000; + + /** The default minimum hit ratio of a healthy cache member. */ + public static final double DEFAULT_MIN_HIT_RATIO = 0.0; + + /** + * The default maximum number of entries in the event delivery queue of a healthy cache member. + */ + public static final long DEFAULT_MAX_EVENT_QUEUE_SIZE = 1000; + + /////////////////////// Instance Methods /////////////////////// + + /** + * Returns the maximum number of milliseconds a <code>netSearch</code> operation can take before + * the cache member is considered to be unhealthy. + * + * @see #DEFAULT_MAX_NET_SEARCH_TIME + */ + public long getMaxNetSearchTime(); + + /** + * Sets the maximum number of milliseconds a <code>netSearch</code> operation can take before the + * cache member is considered to be unhealthy. + * + * @see #getMaxNetSearchTime + */ + public void setMaxNetSearchTime(long maxNetSearchTime); + + /** + * Returns the maximum mumber of milliseconds a cache <code>load</code> operation can take before + * the cache member is considered to be unhealthy. + * + * @see #DEFAULT_MAX_LOAD_TIME + */ + public long getMaxLoadTime(); + + /** + * Sets the maximum mumber of milliseconds a cache <code>load</code> operation can take before the + * cache member is considered to be unhealthy. + * + * @see #getMaxLoadTime + */ + public void setMaxLoadTime(long maxLoadTime); + + /** + * Returns the minimum hit ratio of a healthy cache member. + * + * @see #DEFAULT_MIN_HIT_RATIO + */ + public double getMinHitRatio(); + + /** + * Sets the minimum hit ratio of a healthy cache member. + * + * @see #getMinHitRatio + */ + public void setMinHitRatio(double minHitRatio); + + /** + * Returns the maximum number of entries in the event delivery queue of a healthy cache member. + * + * @see #DEFAULT_MAX_EVENT_QUEUE_SIZE + */ + public long getMaxEventQueueSize(); + + /** + * Sets the maximum number of entries in the event delivery queue of a healthy cache member. + * + * @see #getMaxEventQueueSize + */ + public void setMaxEventQueueSize(long maxEventQueueSize); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServer.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServer.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServer.java new file mode 100644 index 0000000..79f6e7a --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServer.java @@ -0,0 +1,43 @@ +/* + * 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.internal.admin.api; + +/** + * A dedicated cache server VM that is managed by the administration API. + * + * @since GemFire 4.0 + * @deprecated as of 5.7 use {@link CacheVm} instead. + */ +@Deprecated +public interface CacheServer extends SystemMember, ManagedEntity { + /** + * Returns the configuration of this cache vm + * + * @deprecated as of 5.7 use {@link CacheVm#getVmConfig} instead. + */ + @Deprecated + public CacheServerConfig getConfig(); + + /** + * Find whether this server is primary for given client (durableClientId) + * + * @param durableClientId - durable-id of the client + * @return true if the server is primary for given client + * + * @since GemFire 5.6 + */ + public boolean isPrimaryForDurableClient(String durableClientId); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServerConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServerConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServerConfig.java new file mode 100644 index 0000000..383cf2e --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheServerConfig.java @@ -0,0 +1,50 @@ +/* + * 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.internal.admin.api; + +/** + * Configuration for a GemFire cache server that is managed by the administration API. The cache + * server may or may not be running. + * + * @see AdminDistributedSystem#addCacheServer() + * + * @since GemFire 4.0 + * @deprecated as of 5.7 use {@link CacheVmConfig} instead. + */ +@Deprecated +public interface CacheServerConfig extends CacheVmConfig { + /** + * Returns the <code>cache.xml</code> declarative caching initialization file used to configure + * this cache server VM. By default, a cache server VM is started without an XML file. + */ + public String getCacheXMLFile(); + + /** + * Sets the <code>cache.xml</code> declarative caching initialization file used to configure this + * cache server VM. + */ + public void setCacheXMLFile(String cacheXml); + + /** + * Returns the location(s) of user classes (such as cache loaders) required by the cache server + * VM. + */ + public String getClassPath(); + + /** + * Sets the location(s) of user classes (such as cache loaders) required by the cache server VM. + */ + public void setClassPath(String classpath); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVm.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVm.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVm.java new file mode 100755 index 0000000..139e189 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVm.java @@ -0,0 +1,35 @@ +/* + * 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.internal.admin.api; + +/** + * A dedicated cache server VM that is managed by the administration API. + * <p> + * Note that this may not represent an instance of + * {@link org.apache.geode.cache.server.CacheServer}. It is possible for a cache VM to be started + * but for it not to listen for client connections in which case it is not a + * {@link org.apache.geode.cache.server.CacheServer} but is an instance of this interface. + * + * @since GemFire 5.7 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface CacheVm extends SystemMember, ManagedEntity { + /** + * Returns the configuration of this cache vm + */ + public CacheVmConfig getVmConfig(); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVmConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVmConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVmConfig.java new file mode 100755 index 0000000..a42437d --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/CacheVmConfig.java @@ -0,0 +1,51 @@ +/* + * 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.internal.admin.api; + +/** + * Configuration for a GemFire cache server VM that is managed by the administration API. The VM may + * or may not be running. + * + * @see AdminDistributedSystem#addCacheVm() + * + * @since GemFire 5.7 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface CacheVmConfig extends ManagedEntityConfig { + /** + * Returns the <code>cache.xml</code> declarative caching initialization file used to configure + * this cache server VM. By default, a cache server VM is started without an XML file. + */ + public String getCacheXMLFile(); + + /** + * Sets the <code>cache.xml</code> declarative caching initialization file used to configure this + * cache server VM. + */ + public void setCacheXMLFile(String cacheXml); + + /** + * Returns the location(s) of user classes (such as cache loaders) required by the cache server + * VM. + */ + public String getClassPath(); + + /** + * Sets the location(s) of user classes (such as cache loaders) required by the cache server VM. + */ + public void setClassPath(String classpath); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/ConfigurationParameter.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/ConfigurationParameter.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/ConfigurationParameter.java new file mode 100755 index 0000000..88e8aa8 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/ConfigurationParameter.java @@ -0,0 +1,72 @@ +/* + * 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.internal.admin.api; + +/** + * A single configuration parameter of a {@link SystemMember}. + * + * @since GemFire 3.5 + * + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface ConfigurationParameter { + + /** Gets the identifying name of this configuration parameter. */ + public String getName(); + + /** Gets the full description of this configuration parameter */ + public String getDescription(); + + /** Gets the current value */ + public Object getValue(); + + /** Gets the current value as a string */ + public String getValueAsString(); + + /** Gets the class type of the value */ + public Class getValueType(); + + /** True if this is modifiable; false if read-only */ + public boolean isModifiable(); + + /** Returns true if this config parameter uses a string array for value. */ + public boolean isArray(); + + /** Returns true if this config parameter represents an InetAddress value. */ + public boolean isInetAddress(); + + /** Returns true if this config parameter represents a File value. */ + public boolean isFile(); + + /** Returns true if this config parameter represents an octal value. */ + public boolean isOctal(); + + /** Returns true if this config parameter represents a string value. */ + public boolean isString(); + + /** + * Sets a new value for this configuration parameter. + * + * @param value the new value which must be of type {@link #getValueType} + * @throws IllegalArgumentException if value type does not match {@link #getValueType} + * @throws UnmodifiableConfigurationException if attempting to set value when isModifiable is + * false + */ + public void setValue(Object value) throws UnmodifiableConfigurationException; +} + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemConfig.java new file mode 100755 index 0000000..9755d76 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemConfig.java @@ -0,0 +1,625 @@ +/* + * 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.internal.admin.api; + +import org.apache.geode.internal.admin.api.impl.InetAddressUtil; +import org.apache.geode.distributed.internal.DistributionConfig; + +import java.util.Properties; + +import static org.apache.geode.distributed.ConfigurationProperties.*; + + +/** + * Configuration for defining a GemFire distributed system to administrate. This configuration + * includes information about the discovery mechanism used to find members of the distributed system + * and information about {@linkplain ManagedEntity managed entities} such as + * {@linkplain DistributionLocator distribution locators} and {@linkplain CacheVm GemFire cache vms} + * that can be {@linkplain AdminDistributedSystem#start started}. + * + * <P> + * + * Detailed descriptions of many of these configuration attributes can be found in the + * {@link org.apache.geode.distributed.DistributedSystem DistributedSystem} class. Note that the + * default values of these configuration attributes can be specified using Java system properties. + * + * <P> + * + * A <code>DistributedSystemConfig</code> can be modified using a number of mutator methods until + * the <code>AdminDistributedSystem</code> that it configures + * {@linkplain AdminDistributedSystem#connect connects} to the distributed system. After that, + * attempts to modify most attributes in the <code>DistributedSystemConfig</code> will result in an + * {@link IllegalStateException} being thrown. If you wish to use the same + * <code>DistributedSystemConfig</code> to configure multiple <code>AdminDistributedSystem</code>s, + * a copy of the <code>DistributedSystemConfig</code> object can be made by invoking the + * {@link #clone} method. + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface DistributedSystemConfig extends Cloneable { + + /** + * The name of an XML file that specifies the configuration for the {@linkplain ManagedEntity + * managed entities} administered by the <code>DistributedSystem</code>. The XML file must conform + * to a <a href="doc-files/ds5_0.dtd">dtd</a>. + */ + String ENTITY_CONFIG_XML_FILE_NAME = "entity-config-xml-file"; + + /** + * The default value of the "entity-config-xml-file" property ("distributed-system.xml"). + */ + String DEFAULT_ENTITY_CONFIG_XML_FILE = "distributed-system.xml"; + + /** The name of the "system-id" property */ + String SYSTEM_ID_NAME = "system-id"; + + /** The default value of the "system-id" property ("") */ + String DEFAULT_SYSTEM_ID = "Default System"; + + /** The name of the "name" property. See {@link #getSystemName()}. */ + String NAME_NAME = NAME; + + /** The default value of the "name" property (""). See {@link #getSystemName()}. */ + String DEFAULT_NAME = ""; + + /** The name of the "mcastPort" property */ + String MCAST_PORT_NAME = MCAST_PORT; + + /** The default value of the "mcastPort" property (10334) */ + int DEFAULT_MCAST_PORT = DistributionConfig.DEFAULT_MCAST_PORT; + + /** The minimum mcastPort (0) */ + int MIN_MCAST_PORT = DistributionConfig.MIN_MCAST_PORT; + + /** The maximum mcastPort (65535) */ + int MAX_MCAST_PORT = DistributionConfig.MAX_MCAST_PORT; + + /** The name of the "mcastAddress" property */ + String MCAST_ADDRESS_NAME = MCAST_ADDRESS; + + /** The default value of the "mcastAddress" property (239.192.81.1). */ + String DEFAULT_MCAST_ADDRESS = InetAddressUtil.toString(DistributionConfig.DEFAULT_MCAST_ADDRESS); + + /** + * The name of the "membership-port-range" property + * + * @since GemFire 6.5 + */ + String MEMBERSHIP_PORT_RANGE_NAME = MEMBERSHIP_PORT_RANGE; + + /** + * The default membership-port-range. + * <p> + * Actual value is <code>[1024,65535]</code>. + * + * @since GemFire 6.5 + */ + int[] DEFAULT_MEMBERSHIP_PORT_RANGE = DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE; + + /** + * settings for tcp-port + * + * @since GemFire 6.5 + */ + String TCP_PORT_NAME = TCP_PORT; + /** + * The default value of the "tcpPort" property. + * <p> + * Actual value is <code>0</code>. + * + * @since GemFire 6.5 + */ + int DEFAULT_TCP_PORT = DistributionConfig.DEFAULT_TCP_PORT; + + /** + * The default AckWaitThreshold. + * <p> + * Actual value of this constant is <code>15</code> seconds. + */ + int DEFAULT_ACK_WAIT_THRESHOLD = DistributionConfig.DEFAULT_ACK_WAIT_THRESHOLD; + /** + * The minimum AckWaitThreshold. + * <p> + * Actual value of this constant is <code>1</code> second. + */ + int MIN_ACK_WAIT_THRESHOLD = DistributionConfig.MIN_ACK_WAIT_THRESHOLD; + /** + * The maximum AckWaitThreshold. + * <p> + * Actual value of this constant is <code>MAX_INT</code> seconds. + */ + int MAX_ACK_WAIT_THRESHOLD = DistributionConfig.MIN_ACK_WAIT_THRESHOLD; + + /** + * The default ackSevereAlertThreshold. + * <p> + * Actual value of this constant is <code>0</code> seconds, which turns off forced disconnects + * based on ack wait periods. + */ + int DEFAULT_ACK_SEVERE_ALERT_THRESHOLD = DistributionConfig.DEFAULT_ACK_SEVERE_ALERT_THRESHOLD; + /** + * The minimum ackSevereAlertThreshold. + * <p> + * Actual value of this constant is <code>0</code> second, which turns off forced disconnects + * based on ack wait periods. + */ + int MIN_ACK_SEVERE_ALERT_THRESHOLD = DistributionConfig.MIN_ACK_SEVERE_ALERT_THRESHOLD; + /** + * The maximum ackSevereAlertThreshold. + * <p> + * Actual value of this constant is <code>MAX_INT</code> seconds. + */ + int MAX_ACK_SEVERE_ALERT_THRESHOLD = DistributionConfig.MAX_ACK_SEVERE_ALERT_THRESHOLD; + + /** The name of the "locators" property (comma-delimited host[port] list) */ + String LOCATORS_NAME = LOCATORS; + + /** The default value of the "locators" property ("") */ + String DEFAULT_LOCATORS = DistributionConfig.DEFAULT_LOCATORS; + + /** The name of the "bindAddress" property */ + String BIND_ADDRESS_NAME = BIND_ADDRESS; + + /** The default value of the "bindAddress" property */ + String DEFAULT_BIND_ADDRESS = DistributionConfig.DEFAULT_BIND_ADDRESS; + + /** The name of the remote-command property */ + String REMOTE_COMMAND_NAME = "remote-command"; + + /** The default value of the remote-command property */ + String DEFAULT_REMOTE_COMMAND = "rsh -n {HOST} {CMD}"; + + /** The default disable-tcp value (<code>false</code>) */ + boolean DEFAULT_DISABLE_TCP = DistributionConfig.DEFAULT_DISABLE_TCP; + + /** The default enable-network-partition-detection setting (<code>false</code>) */ + boolean DEFAULT_ENABLE_NETWORK_PARTITION_DETECTION = + DistributionConfig.DEFAULT_ENABLE_NETWORK_PARTITION_DETECTION; + + /** The default disable-auto-reconnect setting (<code>false</code>) */ + boolean DEFAULT_DISABLE_AUTO_RECONNECT = DistributionConfig.DEFAULT_DISABLE_AUTO_RECONNECT; + + /** The default failure-detection timeout period for member heart-beat responses */ + int DEFAULT_MEMBER_TIMEOUT = DistributionConfig.DEFAULT_MEMBER_TIMEOUT; + + /** The name of the "logFile" property */ + String LOG_FILE_NAME = LOG_FILE; + + /** + * The default log-file value ("" which directs logging to standard output) + */ + String DEFAULT_LOG_FILE = ""; + + /** The name of the "logLevel" property */ + String LOG_LEVEL_NAME = LOG_LEVEL; + + /** The default log level ("config") */ + String DEFAULT_LOG_LEVEL = "config"; + + /** The name of the "LogDiskSpaceLimit" property */ + String LOG_DISK_SPACE_LIMIT_NAME = LOG_DISK_SPACE_LIMIT; + + /** The default log disk space limit in megabytes (0) */ + int DEFAULT_LOG_DISK_SPACE_LIMIT = DistributionConfig.DEFAULT_LOG_DISK_SPACE_LIMIT; + + /** The minimum log disk space limit in megabytes (0) */ + int MIN_LOG_DISK_SPACE_LIMIT = DistributionConfig.MIN_LOG_DISK_SPACE_LIMIT; + + /** The minimum log disk space limit in megabytes (1000000) */ + int MAX_LOG_DISK_SPACE_LIMIT = DistributionConfig.MAX_LOG_DISK_SPACE_LIMIT; + + /** The name of the "LogFileSizeLimit" property */ + String LOG_FILE_SIZE_LIMIT_NAME = LOG_FILE_SIZE_LIMIT; + + /** The default log file size limit in megabytes (0) */ + int DEFAULT_LOG_FILE_SIZE_LIMIT = DistributionConfig.DEFAULT_LOG_FILE_SIZE_LIMIT; + + /** The minimum log file size limit in megabytes (0) */ + int MIN_LOG_FILE_SIZE_LIMIT = DistributionConfig.MIN_LOG_FILE_SIZE_LIMIT; + + /** The minimum log file size limit in megabytes (1000000) */ + int MAX_LOG_FILE_SIZE_LIMIT = DistributionConfig.MAX_LOG_FILE_SIZE_LIMIT; + + /** + * The name of the "refreshInterval" property which will apply to SystemMember, SystemMemberCache + * and StatisticResource refresh. This interval (in seconds) is used for auto-polling and updating + * AdminDistributedSystem constituents including SystemMember, CacheServer, SystemMemberCache and + * StatisticResource. This interval is read-only and retains the value set when the config is + * created. Note that the resource MBeans actually refresh and hit the DS only if there is an RMI + * client connected + */ + String REFRESH_INTERVAL_NAME = "refresh-interval"; + + /** + * The default "refreshInterval" in seconds which will apply to REFRESH_INTERVAL_NAME property. + * The default value is 15 secs + */ + int DEFAULT_REFRESH_INTERVAL = 15; + + ////////////////////// Instance Methods ////////////////////// + + /** + * Returns the name of the XML file that specifies the configuration of the + * {@linkplain ManagedEntity managed entities} administered by the <code>DistributedSystem</code>. + * The XML file must conform to a <a href="doc-files/ds5_0.dtd">dtd</a>. + * + * @since GemFire 4.0 + */ + public String getEntityConfigXMLFile(); + + /** + * Sets the name of the XML file that specifies the configuration of managed entities administered + * by the <code>DistributedSystem</code>. + */ + public void setEntityConfigXMLFile(String xmlFile); + + /** Returns the string identity for the system */ + public String getSystemId(); + + /** Sets the string identity for the system */ + public void setSystemId(String systemId); + + /** Returns the optional non-unique name for the system */ + public String getSystemName(); + + /** Sets the optional non-unique name for the system */ + public void setSystemName(final String name); + + /** Returns the multicast address for the system */ + public String getMcastAddress(); + + /** Sets the multicast address for the system */ + public void setMcastAddress(String mcastAddress); + + /** Returns the multicast port for the system */ + public int getMcastPort(); + + /** Sets the multicast port for the system */ + public void setMcastPort(int mcastPort); + + /** Returns the ack-wait-threshold for the system */ + public int getAckWaitThreshold(); + + /** Sets the ack-wait-threshold for the system */ + public void setAckWaitThreshold(int seconds); + + /** Returns the ack-severe-alert-threshold for the system */ + public int getAckSevereAlertThreshold(); + + /** Sets the ack-severe-alert-threshold for the system */ + public void setAckSevereAlertThreshold(int seconds); + + /** Returns a comma-delimited list of locators for the system */ + public String getLocators(); + + /** Sets the comma-delimited list of locators for the system */ + public void setLocators(String locators); + + /** + * Returns the membership-port-range property of the Distributed System. This range is given as + * two numbers separated by a minus sign. + * + * @since GemFire 6.5 + */ + public String getMembershipPortRange(); + + /** + * Sets the membership-port-range property of the Distributed System. This range is given as two + * numbers separated by a minus sign. + * + * @since GemFire 6.5 + */ + public void setMembershipPortRange(String membershipPortRange); + + + /** + * Sets the primary communication port number for the Distributed System. + * + * @since GemFire 6.5 + */ + public void setTcpPort(int port); + + /** + * Returns the primary communication port number for the Distributed System. + * + * @since GemFire 6.5 + */ + public int getTcpPort(); + + + /** + * Sets the disable-tcp property for the system. When tcp is disabled, the cache uses udp for + * unicast messaging. This must be consistent across all members of the distributed system. The + * default is to enable tcp. + */ + public void setDisableTcp(boolean flag); + + /** + * Returns the disable-tcp property for the system. When tcp is disabled, the cache uses udp for + * unicast messaging. This must be consistent across all members of the distributed system. The + * default is to enable tcp. + */ + public boolean getDisableTcp(); + + + /** + * Turns on network partition detection + */ + public void setEnableNetworkPartitionDetection(boolean newValue); + + /** + * Returns true if network partition detection is enabled. + */ + public boolean getEnableNetworkPartitionDetection(); + + /** + * Disables auto reconnect after being forced out of the distributed system + */ + public void setDisableAutoReconnect(boolean newValue); + + /** + * Returns true if auto reconnect is disabled + */ + public boolean getDisableAutoReconnect(); + + + + /** + * Returns the member-timeout millisecond value used in failure-detection protocols + */ + public int getMemberTimeout(); + + /** + * Set the millisecond value of the member-timeout used in failure-detection protocols. This + * timeout determines how long a member has to respond to a heartbeat request. The member is given + * three chances before being kicked out of the distributed system with a SystemConnectException. + */ + public void setMemberTimeout(int value); + + /** + * Returns the IP address to which the distributed system's server sockets are bound. + * + * @since GemFire 4.0 + */ + public String getBindAddress(); + + /** + * Sets the IP address to which the distributed system's server sockets are bound. + * + * @since GemFire 4.0 + */ + public void setBindAddress(String bindAddress); + + + /** + * Returns the IP address to which client/server server sockets are bound + */ + public String getServerBindAddress(); + + /** + * Sets the IP address to which a server cache will bind when listening for client cache + * connections. + */ + public void setServerBindAddress(String bindAddress); + + + /** Returns the remote command setting to use for remote administration */ + public String getRemoteCommand(); + + /** + * Sets the remote command setting to use for remote administration. This attribute may be + * modified after this <code>DistributedSystemConfig</code> has been used to create an + * <codE>AdminDistributedSystem</code>. + */ + public void setRemoteCommand(String command); + + /** Returns the value of the "ssl-enabled" property. */ + public boolean isSSLEnabled(); + + /** Sets the value of the "ssl-enabled" property. */ + public void setSSLEnabled(boolean enabled); + + /** Returns the value of the "ssl-protocols" property. */ + public String getSSLProtocols(); + + /** Sets the value of the "ssl-protocols" property. */ + public void setSSLProtocols(String protocols); + + /** Returns the value of the "ssl-ciphers" property. */ + public String getSSLCiphers(); + + /** Sets the value of the "ssl-ciphers" property. */ + public void setSSLCiphers(String ciphers); + + /** Returns the value of the "ssl-require-authentication" property. */ + public boolean isSSLAuthenticationRequired(); + + /** Sets the value of the "ssl-require-authentication" property. */ + public void setSSLAuthenticationRequired(boolean authRequired); + + /** Returns the provider-specific properties for SSL. */ + public Properties getSSLProperties(); + + /** Sets the provider-specific properties for SSL. */ + public void setSSLProperties(Properties sslProperties); + + /** Adds an SSL property */ + public void addSSLProperty(String key, String value); + + /** Removes an SSL property */ + public void removeSSLProperty(String key); + + /** + * Returns the name of the log file to which informational messages are written. + * + * @see org.apache.geode.i18n.LogWriterI18n + */ + public String getLogFile(); + + /** + * Sets the name of the log file to which informational messages are written. + * + * @see org.apache.geode.i18n.LogWriterI18n + */ + public void setLogFile(String logFile); + + /** + * Returns the level at which informational messages are logged. + */ + public String getLogLevel(); + + /** + * Sets the level at which information messages are logged. + */ + public void setLogLevel(String logLevel); + + /** + * Returns the log disk space limit in megabytes + */ + public int getLogDiskSpaceLimit(); + + /** + * Sets the log disk space limit in megabytes + */ + public void setLogDiskSpaceLimit(int limit); + + /** + * Returns the log file size limit in megabytes + */ + public int getLogFileSizeLimit(); + + /** + * Sets the log file size limit in megabytes + */ + public void setLogFileSizeLimit(int limit); + + /** + * Returns the refreshInterval in seconds used for auto-polling and updating + * AdminDistributedSystem constituents including SystemMember, CacheServer, SystemMemberCache and + * StatisticResource + * + * @since GemFire 6.0 + */ + public int getRefreshInterval(); + + /** + * Sets the refreshInterval in seconds + * + * @since GemFire 6.0 + */ + public void setRefreshInterval(int timeInSecs); + + /** + * Returns an array of configurations for statically known <code>CacheServers</code>. + * + * @deprecated as of 5.7 use {@link #getCacheVmConfigs} instead. + */ + @Deprecated + public CacheServerConfig[] getCacheServerConfigs(); + + /** + * Creates the configuration for a CacheServer + * + * @deprecated as of 5.7 use {@link #createCacheVmConfig} instead. + */ + @Deprecated + public CacheServerConfig createCacheServerConfig(); + + /** + * Removes the configuration for a CacheServer + * + * @deprecated as of 5.7 use {@link #removeCacheVmConfig} instead. + */ + @Deprecated + public void removeCacheServerConfig(CacheServerConfig managerConfig); + + /** + * Returns an array of configurations for statically known {@link CacheVm}s. + * + * @since GemFire 5.7 + */ + public CacheVmConfig[] getCacheVmConfigs(); + + /** + * Creates the configuration for a {@link CacheVm}. + * + * @since GemFire 5.7 + */ + public CacheVmConfig createCacheVmConfig(); + + /** + * Removes the configuration for a {@link CacheVm} + * + * @since GemFire 5.7 + */ + public void removeCacheVmConfig(CacheVmConfig existing); + + /** + * Returns configuration information about {@link DistributionLocator}s that are managed by an + * <code>AdminDistributedSystem</code>. + */ + public DistributionLocatorConfig[] getDistributionLocatorConfigs(); + + /** + * Creates a new <code>DistributionLocatorConfig</code> for a distribution locator that is managed + * in this distributed system. The default locator config is set to not use multicast + */ + public DistributionLocatorConfig createDistributionLocatorConfig(); + + /** + * Removes a <code>DistributionLocatorConfig</code> from the distributed system. + */ + public void removeDistributionLocatorConfig(DistributionLocatorConfig config); + + /** Registers listener for notification of changes in this config. */ + public void addListener(ConfigListener listener); + + /** Removes previously registered listener of this config. */ + public void removeListener(ConfigListener listener); + + /** + * Validates that this distributed system configuration is correct and consistent. + * + * @throws IllegalStateException If this config is not valid + * @throws AdminXmlException If the {@linkplain #getEntityConfigXMLFile entity config XML file} is + * not valid + */ + public void validate(); + + /** + * Returns a copy of this <code>DistributedSystemConfig</code> object whose configuration can be + * modified. Note that this {@link DistributedSystemConfig.ConfigListener ConfigListener}s that + * are registered on this config object are not cloned. + * + * @since GemFire 4.0 + */ + public Object clone() throws CloneNotSupportedException; + + ////////////////////// Inner Classes ////////////////////// + + /** + * A listener whose callback methods are invoked when this config changes. + */ + public interface ConfigListener extends java.util.EventListener { + + /** Invoked when this configurated is changed. */ + public void configChanged(DistributedSystemConfig config); + } + +} + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemHealthConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemHealthConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemHealthConfig.java new file mode 100644 index 0000000..c308aa2 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributedSystemHealthConfig.java @@ -0,0 +1,74 @@ +/* + * 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.internal.admin.api; + +/** + * Provides configuration information relating to the health of an entire GemFire distributed + * system. + * + * <P> + * + * If any of the following criteria is true, then the distributed system is considered to be in + * {@link GemFireHealth#OKAY_HEALTH OKAY_HEALTH}. + * + * <UL> + * + * </UL> + * + * If any of the following criteria is true, then the distributed system is considered to be in + * {@link GemFireHealth#POOR_HEALTH POOR_HEALTH}. + * + * <UL> + * + * <LI>Too many application members {@linkplain #getMaxDepartedApplications unexpectedly leave} the + * distributed system.</LI> + * + * <LI>Too many application members {@linkplain #getMaxDepartedApplications unexpectedly leave} the + * distributed system.</LI> + * + * </UL> + * + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface DistributedSystemHealthConfig { + + /** + * The default maximum number of application members that can unexceptedly leave a healthy the + * distributed system. + */ + public static final long DEFAULT_MAX_DEPARTED_APPLICATIONS = 10; + + /////////////////////// Instance Methods /////////////////////// + + /** + * Returns the maximum number of application members that can unexceptedly leave a healthy the + * distributed system. + * + * @see #DEFAULT_MAX_DEPARTED_APPLICATIONS + */ + public long getMaxDepartedApplications(); + + /** + * Sets the maximum number of application members that can unexceptedly leave a healthy the + * distributed system. + * + * @see #getMaxDepartedApplications + */ + public void setMaxDepartedApplications(long maxDepartedApplications); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocator.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocator.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocator.java new file mode 100755 index 0000000..4595a52 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocator.java @@ -0,0 +1,45 @@ +/* + * 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.internal.admin.api; + +/** + * Represents a single distribution locator server, of which a distributed system may use zero or + * many. The distributed system will be configured to use either multicast discovery or locator + * service. + * + * @see DistributionLocatorConfig + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface DistributionLocator extends ManagedEntity { + + /** + * Returns the identity name for this locator. + */ + public String getId(); + + /** + * Returns the configuration object for this distribution locator. + * + * @since GemFire 4.0 + */ + public DistributionLocatorConfig getConfig(); + +} + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocatorConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocatorConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocatorConfig.java new file mode 100644 index 0000000..f331de6 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/DistributionLocatorConfig.java @@ -0,0 +1,81 @@ +/* + * 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.internal.admin.api; + +import java.util.Properties; + +/** + * Describes the configuration of a {@link DistributionLocator} managed by the GemFire + * administration APIs. + * + * <P> + * + * A <code>DistributionLocatorConfig</code> can be modified using a number of mutator methods until + * the <code>DistributionLocator</code> configured by this object is {@linkplain ManagedEntity#start + * started}. After that, attempts to modify most attributes in the + * <code>DistributionLocatorConfig</code> will result in an {@link IllegalStateException} being + * thrown. If you wish to use the same <code>DistributionLocatorConfig</code> to configure another + * <code>DistributionLocator</code>s, a copy of the <code>DistributionLocatorConfig</code> object + * can be made by invoking the {@link Object#clone} method. + * + * @see AdminDistributedSystem#addDistributionLocator + * @see org.apache.geode.distributed.Locator + * + * @since GemFire 4.0 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface DistributionLocatorConfig extends ManagedEntityConfig { + + /** + * Returns the port on which ths distribution locator listens for members to connect. There is no + * default locator port, so a non-default port must be specified. + */ + public int getPort(); + + /** + * Sets the port on which the distribution locator listens for members to connect. + */ + public void setPort(int port); + + /** + * Returns the address to which the distribution locator's port is (or will be) bound. By default, + * the bind address is <code>null</code> meaning that the port will be bound to all network + * addresses on the host. + */ + public String getBindAddress(); + + /** + * Sets the address to which the distribution locator's port is (or will be) bound. + */ + public void setBindAddress(String bindAddress); + + /** + * Sets the properties used to configure the locator's DistributedSystem. + * + * @since GemFire 5.0 + */ + public void setDistributedSystemProperties(Properties props); + + /** + * Retrieves the properties used to configure the locator's DistributedSystem. + * + * @since GemFire 5.0 + */ + public Properties getDistributedSystemProperties(); + + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealth.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealth.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealth.java new file mode 100644 index 0000000..b2b9f69 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealth.java @@ -0,0 +1,209 @@ +/* + * 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.internal.admin.api; + +import org.apache.geode.internal.Assert; +import org.apache.geode.internal.i18n.LocalizedStrings; + +/** + * Provides information about the aggregate health of the members of a GemFire distributed system + * ("components"). The {@link #getHealth getHealth} method provides an indication of the overall + * health. Health is expressed as one of three levels: {@link #GOOD_HEALTH GOOD_HEALTH}, + * {@link #OKAY_HEALTH OKAY_HEALTH}, and {@link #POOR_HEALTH POOR_HEALTH}. The {@link #getDiagnosis + * getDiagnosis} method provides a more detailed explanation of the cause of ill health. + * + * <P> + * + * The aggregate health of the GemFire component is evaluated + * {@linkplain GemFireHealthConfig#setHealthEvaluationInterval every so often} and if certain + * criteria are met, then the overall health of the component changes accordingly. If any of the + * components is in <code>OKAY_HEALTH</code>, then the overall health is <code>OKAY_HEALTH</code>. + * If any of the components is in <code>POOR_HEALTH</code>, then the overall health is + * <code>POOR_HEALTH</code>. + * + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface GemFireHealth { + + /** + * An indicator that the GemFire components are healthy. + * + * @see #getHealth + */ + public static final Health GOOD_HEALTH = new Health(Health.GOOD_STRING); + + /** + * An indicator that one or more GemFire components is slightly unhealthy. The problem may or may + * not require configuration changes and may not necessarily lead to poorer component health. + * + * @see #getHealth + */ + public static final Health OKAY_HEALTH = new Health(Health.OKAY_STRING); + + /** + * An indicator that one or more GemFire components is unhealthy. While it may be possible for the + * components to recover on their own, it is likely that they will have to be restarted. + * + * @see #getHealth + */ + public static final Health POOR_HEALTH = new Health(Health.POOR_STRING); + + /////////////////////// Instance Methods /////////////////////// + + /** + * Returns an indicator of the overall health of the GemFire components. + * + * @see #GOOD_HEALTH + * @see #OKAY_HEALTH + * @see #POOR_HEALTH + */ + public Health getHealth(); + + /** + * Resets the overall health of the GemFire components to {@link #GOOD_HEALTH}. This operation + * should be invoked when the operator has determined that warnings about the components's health + * do not need to be regarded. + */ + public void resetHealth(); + + /** + * Returns a message that provides a description of the cause of a component's ill health. + */ + public String getDiagnosis(); + + /** + * Returns the configuration for determining the health of the distributed system itself. + */ + public DistributedSystemHealthConfig getDistributedSystemHealthConfig(); + + /** + * Sets the configuration for determining the health of the distributed system itself. + */ + public void setDistributedSystemHealthConfig(DistributedSystemHealthConfig config); + + /** + * Returns the <code>GemFireHealthConfig</code> for GemFire components whose configurations are + * not overridden on a per-host basis. Note that changes made to the returned + * <code>GemFireHealthConfig</code> will not take effect until + * {@link #setDefaultGemFireHealthConfig} is invoked. + */ + public GemFireHealthConfig getDefaultGemFireHealthConfig(); + + /** + * Sets the <code>GemFireHealthConfig</code> for GemFire components whose configurations are not + * overridden on a per-host basis. + * + * @throws IllegalArgumentException If <code>config</code> specifies the config for a host + */ + public void setDefaultGemFireHealthConfig(GemFireHealthConfig config); + + /** + * Returns the <code>GemFireHealthConfig</code> for GemFire components that reside on a given + * host. This configuration will override the {@linkplain #getDefaultGemFireHealthConfig default} + * configuration. + * + * @param hostName The {@linkplain java.net.InetAddress#getCanonicalHostName canonical} name of + * the host. + */ + public GemFireHealthConfig getGemFireHealthConfig(String hostName); + + /** + * Sets the <code>GemFireHealthConfig</code> for GemFire components that reside on a given host. + * This configuration will override the {@linkplain #getDefaultGemFireHealthConfig default} + * configuration. Note that changes made to the returned <code>GemFireHealthConfig</code> will not + * take effect until {@link #setDefaultGemFireHealthConfig} is invoked. + * + * @param hostName The {@linkplain java.net.InetAddress#getCanonicalHostName canonical} name of + * the host. + * + * @throws IllegalArgumentException If host <code>hostName</code> does not exist or if there are + * no GemFire components running on that host or if <code>config</code> does not configure + * host <code>hostName</code>. + */ + public void setGemFireHealthConfig(String hostName, GemFireHealthConfig config); + + /** + * Closes this health monitor and releases all resources associated with it. + */ + public void close(); + + /** + * Returns whether or not this <code>GemFireHealth</code> is {@linkplain #close closed}. + */ + public boolean isClosed(); + + ////////////////////// Inner Classes ////////////////////// + + /** + * An enumerated type for the health of GemFire. + */ + public static class Health implements java.io.Serializable { + private static final long serialVersionUID = 3039539430412151801L; + /** The string for good health */ + static final String GOOD_STRING = LocalizedStrings.GemFireHealth_GOOD.toLocalizedString(); + + /** The string for okay health */ + static final String OKAY_STRING = LocalizedStrings.GemFireHealth_OKAY.toLocalizedString(); + + /** The string for poor health */ + static final String POOR_STRING = LocalizedStrings.GemFireHealth_POOR.toLocalizedString(); + + //////////////////// Instance Fields //////////////////// + + /** The string for this health */ + private String healthString; + + ///////////////////// Constructors ////////////////////// + + /** + * Creates a new <code>Health</code> with the given string + */ + protected Health(String healthString) { + this.healthString = healthString; + } + + //////////////////// Instance Methods //////////////////// + + /** + * Returns the appropriate canonical instance of <code>Health</code>. + */ + public Object readResolve() { + if (this.healthString.equals(GOOD_STRING)) { + return GemFireHealth.GOOD_HEALTH; + + } else if (this.healthString.equals(OKAY_STRING)) { + return GemFireHealth.OKAY_HEALTH; + + } else if (this.healthString.equals(POOR_STRING)) { + return GemFireHealth.POOR_HEALTH; + + } else { + Assert.assertTrue(false, "Unknown healthString: " + this.healthString); + return null; + } + } + + @Override + public String toString() { + return this.healthString; + } + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealthConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealthConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealthConfig.java new file mode 100644 index 0000000..c07cc77 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireHealthConfig.java @@ -0,0 +1,54 @@ +/* + * 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.internal.admin.api; + +/** + * Provides configuration information relating to all of the components of a GemFire distributed + * system. + * + * + * @since GemFire 3.5 + * @deprecated as of 7.0 use the <code><a href= + * "{@docRoot}/org/apache/geode/management/package-summary.html">management</a></code> + * package instead + */ +public interface GemFireHealthConfig extends MemberHealthConfig, CacheHealthConfig { + + /** + * The default number of seconds between assessments of the health of the GemFire components. + */ + public static final int DEFAULT_HEALTH_EVALUATION_INTERVAL = 30; + + ////////////////////// Instance Methods ////////////////////// + + /** + * Returns the name of the host to which this configuration applies. If this is the "default" + * configuration, then <code>null</code> is returned. + * + * @see GemFireHealth#getGemFireHealthConfig + */ + public String getHostName(); + + /** + * Sets the number of seconds between assessments of the health of the GemFire components. + */ + public void setHealthEvaluationInterval(int interval); + + /** + * Returns the number of seconds between assessments of the health of the GemFire components. + */ + public int getHealthEvaluationInterval(); + +}