[30/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal
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 000..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 management + * 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 AlertLevel for the given severity + * + * @throws IllegalArgumentException If there is no alert level with the given + * severity + */ + 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 AlertLevel with the given name + * + * @throws IllegalArgumentException If there is no alert level named name + */ + 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
[30/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6bb27bf1/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireMemberStatus.java -- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireMemberStatus.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireMemberStatus.java new file mode 100755 index 000..6bac386 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/GemFireMemberStatus.java @@ -0,0 +1,670 @@ +/* + * 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.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.client.PoolManager; +import org.apache.geode.cache.server.CacheServer; +import org.apache.geode.distributed.DistributedSystem; +import org.apache.geode.distributed.Locator; +import org.apache.geode.distributed.internal.DM; +import org.apache.geode.distributed.internal.DistributionConfig; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.net.SocketCreator; +import org.apache.geode.internal.admin.ClientHealthMonitoringRegion; +import org.apache.geode.internal.admin.remote.ClientHealthStats; +import org.apache.geode.internal.cache.*; +import org.apache.geode.internal.cache.tier.InternalClientMembership; +import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID; + +import java.io.IOException; +import java.io.Serializable; +import java.net.InetAddress; +import java.util.*; + +/** + * Class GemFireMemberStatus provides the status of a specific GemFire member VM. This + * VM can be a peer, a client, a server and/or a gateway. + * + * @deprecated as of 7.0 use the management + * package instead + */ +public class GemFireMemberStatus implements Serializable { + private static final long serialVersionUID = 3389997790525991310L; + + /** + * Notifies whether this member is a client to a cache server. + */ + protected boolean _isClient; + + /** + * Notifies whether this member is a cache server. + */ + protected boolean _isServer; + + /** + * Notifies whether this member is a hub for WAN gateways. + */ + protected boolean _isGatewayHub; + + /** + * Notifies whether this member is a locator. + */ + protected boolean _isLocator; + + protected boolean _isPrimaryGatewayHub; + + protected Object/* GatewayHubStatus */ _gatewayHubStatus; + + protected boolean _isConnected; + protected Serializable _memberId; + protected Set _connectedPeers; + protected Set _connectedServers; + protected Set _unconnectedServers; + protected Set _connectedClients; + protected Map _connectedIncomingGateways; + protected Map _outgoingGateways; + + protected Map _clientHostNames; + protected Map _clientQueueSizes; + protected Map _gatewayQueueSizes; + protected Map _regionStatuses; + protected Map _clientHealthStats; + + protected String _memberName; + protected int _mcastPort; + protected int _serverPort; + protected InetAddress _mcastAddress; + protected String _bindAddress; + protected String _locators; + protected InetAddress _hostAddress; + + protected long _maximumHeapSize; + protected long _freeHeapSize; + + protected long upTime = -1; + + protected transient final Cache cache; + + public GemFireMemberStatus() { +this(null); + } + + public GemFireMemberStatus(Cache cache) { +this.cache = cache; +DistributedSystem ds = null; +if (cache != null) { + ds = cache.getDistributedSystem(); +} +initialize(ds); + } + + public boolean getIsConnected() { +return this._isConnected; + } + + protected void setIsConnected(boolean isConnected) { +this._isConnected = isConnected; + } + + /** + * Returns whether this member is a client to a cache server + * + * @return whether this member is a client to a cache server + */ + public boolean getIsClient() { +return this._isClient; + } + + /** + * Sets whether this member is a client to a cache server +
[30/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/20a32286/geode-core/src/main/java/org/apache/geode/internal/admin/api/SystemMemberCacheServer.java -- diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/api/SystemMemberCacheServer.java b/geode-core/src/main/java/org/apache/geode/internal/admin/api/SystemMemberCacheServer.java new file mode 100755 index 000..ba31538 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/admin/api/SystemMemberCacheServer.java @@ -0,0 +1,308 @@ +/* + * 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.cache.server.ServerLoadProbe; + +/** + * Administrative interface that represents a {@link org.apache.geode.cache.server.CacheServer + * CacheServer} that serves the contents of a system member's cache to clients. + * + * @see SystemMemberCache#addCacheServer + * + * @since GemFire 5.7 + * @deprecated as of 7.0 use the management + * package instead + */ +public interface SystemMemberCacheServer { + + /** + * Returns the port on which this cache server listens for clients to connect. + */ + public int getPort(); + + /** + * Sets the port on which this cache server listens for clients to connect. + * + * @throws AdminException If this cache server is running + */ + public void setPort(int port) throws AdminException; + + /** + * Starts this cache server. Once the server is running, its configuration cannot be changed. + * + * @throws AdminException If an error occurs while starting the cache server + */ + public void start() throws AdminException; + + /** + * Returns whether or not this cache server is running + */ + public boolean isRunning(); + + /** + * Stops this cache server. Note that the CacheServer can be reconfigured and + * restarted if desired. + */ + public void stop() throws AdminException; + + /** + * Updates the information about this cache server. + */ + public void refresh(); + + /** + * Returns a string representing the ip address or host name that this server will listen on. + * + * @return the ip address or host name that this server is to listen on + * @since GemFire 5.7 + */ + public String getBindAddress(); + + /** + * Sets the ip address or host name that this server is to listen on for client connections. + * + * Setting a specific bind address will cause the cache server to always use this address and + * ignore any address specified by "server-bind-address" or "bind-address" in the + * gemfire.properties file (see + * {@link org.apache.geode.distributed.DistributedSystem} for a description of these properties). + * + * A null value will be treated the same as the default "". + * + * The default value does not override the gemfire.properties. If you wish to override the + * properties and want to have your server bind to all local addresses then use this string + * "0.0.0.0". + * + * @param address the ip address or host name that this server is to listen on + * @throws AdminException if this cache server is running + * @since GemFire 5.7 + */ + public void setBindAddress(String address) throws AdminException; + + /** + * Returns a string representing the ip address or host name that server locators will tell + * clients that this server is listening on. + * + * @return the ip address or host name to give to clients so they can connect to this server + * @since GemFire 5.7 + */ + public String getHostnameForClients(); + + /** + * Sets the ip address or host name that this server is to listen on for client connections. + * + * Setting a specific hostname-for-clients will cause server locators to use this value when + * telling clients how to connect to this server. + * + * The default value causes the bind-address to be given to clients + * + * A null value will be treated the same as the default "". + * + * @param name the ip address or host name that will be given to clients so they can connect to + *this server + * @throws AdminException if this