[33/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/admin/jmx/internal/MemberInfoWithStatsMBean.java -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MemberInfoWithStatsMBean.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MemberInfoWithStatsMBean.java deleted file mode 100644 index 40a514a..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MemberInfoWithStatsMBean.java +++ /dev/null @@ -1,1347 +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.admin.jmx.internal; - -import static org.apache.geode.distributed.ConfigurationProperties.*; - -import org.apache.geode.admin.*; -import org.apache.geode.admin.jmx.Agent; -import org.apache.geode.cache.InterestPolicy; -import org.apache.geode.cache.SubscriptionAttributes; -import org.apache.geode.distributed.internal.DistributionConfig; -import org.apache.geode.internal.GemFireVersion; -import org.apache.geode.internal.admin.remote.ClientHealthStats; -import org.apache.geode.internal.i18n.LocalizedStrings; -import org.apache.geode.internal.logging.LogService; -import org.apache.geode.internal.logging.log4j.LocalizedMessage; -import mx4j.AbstractDynamicMBean; -import org.apache.logging.log4j.Logger; - -import javax.management.*; -import java.net.InetAddress; -import java.text.MessageFormat; -import java.util.*; -import java.util.concurrent.atomic.AtomicLong; - -/** - * This class uses the JMX Attributes/Operations that use (return/throw) GemFire types. This is the - * single MBean accessible with ObjectName string {@link MemberInfoWithStatsMBean#MBEAN_NAME}}. This - * MBean can be used to retrieve the all member details as plain java types. - * - * This MBean also acts as a Notification Hub for all the Notifications that are defined for Admin - * Distributed System. - * - * - * @since GemFire 6.5 - */ -public class MemberInfoWithStatsMBean extends AbstractDynamicMBean implements NotificationEmitter { - private static final Logger logger = LogService.getLogger(); - - /* constants defining max no of attributes/operations/notifications */ - private static final int MAX_ATTRIBUTES_COUNT = 3; - private static final int MAX_OPERATIONS_COUNT = 3; - private static final int MAX_NOTIFICATIONS_COUNT = 9; - - private static final String NOT_AVAILABLE_STR = "N/A"; - private static final String NOT_AVAILABLE = null; - private static final Number NOT_AVAILABLE_NUMBER = null; - - /* - * String constant used for a region that is used on admin side just as a root for rootRegions - * defined on the member - */ - private static final String PLACE_HOLDER_ROOT_REGION = "/Root/"; - - /* String that are used to form QueryExp/ObjectName for querying MBeanServer */ - private static final String REGION_QUERY_EXPRESSION = "*GemFire.Cache*:*,owner={0},type=Region"; - private static final String STATS_QUERY_EXPRESSION = "*GemFire.Statistic*:*,source={0},name={1}"; - - /** mbean name string for this MBean */ - /* default */static final String MBEAN_NAME = "GemFire:type=MemberInfoWithStatsMBean"; - - /** ObjectName handle for this MBean */ - private ObjectName objectName; - - /** version of the GemFire Enterprise system that is running */ - private String version; - private int refreshInterval; - private String id; - - private Agent agent; - private AdminDistributedSystemJmxImpl adminDSJmx; - - private NotificationForwarder forwarder; - private boolean isInitialized;// needs synchronization? - - /** - * Default Constructor - * - * @param agent Admin Agent instance - * @throws OperationsException if ObjectName can't be formed for this MBean - * @throws MBeanRegistrationException - * @throws AdminException - */ - MemberInfoWithStatsMBean(Agent agent) - throws OperationsException, MBeanRegistrationException, AdminException { -this.agent = agent; -this.objectName = ObjectName.getInstance(MBEAN_NAME); -this.version = GemFireVersion.getGemFireVersion(); -this.refreshInterval = -1; -this.id = NOT_AVAILABLE_STR; -this.forwarder = new
[33/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/admin/jmx/internal/StatisticAttributeInfo.java -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java deleted file mode 100755 index c257ad5..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java +++ /dev/null @@ -1,71 +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.admin.jmx.internal; - -import org.apache.geode.admin.Statistic; -import org.apache.geode.internal.Assert; - -import javax.management.Descriptor; -import javax.management.modelmbean.DescriptorSupport; -import javax.management.modelmbean.ModelMBeanAttributeInfo; - -/** - * Subclass of AttributeInfo with {@link org.apache.geode.admin.Statistic} added for use as the - * {@link javax.management.modelmbean.ModelMBeanAttributeInfo} descriptor's targetObject - * value. - * - * @since GemFire 3.5 - * - */ -class StatisticAttributeInfo extends org.apache.commons.modeler.AttributeInfo { - private static final long serialVersionUID = 28022387514935560L; - - private Statistic stat; - - public StatisticAttributeInfo() { -super(); - } - - public Statistic getStat() { -return this.stat; - } - - public void setStat(Statistic stat) { -// System.out.println(">> stat = " + stat); -Assert.assertTrue(stat != null, "Attempting to set stat to null"); -this.stat = stat; - } - - @Override - public ModelMBeanAttributeInfo createAttributeInfo() { -Descriptor desc = new DescriptorSupport(new String[] {"name=" + this.displayName, -"descriptorType=attribute", "currencyTimeLimit=-1", // always stale -"displayName=" + this.displayName, "getMethod=getValue"}); - -Assert.assertTrue(this.stat != null, "Stat target object is null!"); -desc.setField("targetObject", this.stat); - -ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name -this.type, // type -this.description, // description -this.readable, // isReadable -this.writeable, // isWritable -this.is, // isIs -desc); - -return info; - } -} - http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6bb27bf1/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java deleted file mode 100755 index 4f46d5a..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java +++ /dev/null @@ -1,344 +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.admin.jmx.internal; - -import javax.management.Notification; -import javax.management.ObjectName; -import javax.management.modelmbean.ModelMBean; -import javax.naming.OperationNotSupportedException; - -import org.apache.commons.modeler.ManagedBean; -import org.apache.logging.log4j.Logger; - -import org.apache.geode.CancelException; -import org.apache.geode.LogWriter; -import
[33/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/admin/jmx/internal/package.html -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/package.html b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/package.html deleted file mode 100755 index bc2b2f2..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/package.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - -Contains the implementation of the external JMX APIs from -org.apache.geode.admin.jmx. - -JMX Support in GemFire - -Our goal was to provide JMX administrative support in GemFire. The design was influenced by these important factors: - - -1) Requirement to not impact performance of the product -2) Desire to introduce JMX without altering the existing product or the management console -3) Similar functionality already existed in the console and the internal.admin pkg which the console uses -4) Requirement to also introduce a simple and usable Admin API which or may not be related to JMX - - -From a functional stand point, the JMX support was supposed to provide most of the same administrative and operational monitoring that the console already provides. In some cases we limited the functionality due to security concerns and in others because it was hard to express the features as JMX beans. The JMX Agent also provides some functionality (such as Health monitoring) that is not currently in the console. - -The Agent communicates with the distributed system using the same distribution manager {@link org.apache.geode.distributed.internal.DistributionManager} as the console uses and thus has the same requirements that determine what distributed system it can manage. Although the Console currently supports managing multiple distributed systems, we decided that a given Agent should only be able to manage a single system. We have not tested the use of more than one Agent for the same system, however nothing currently prohibits this. - -We decided to develop a simple public Admin API which in essence wraps the internal.admin API that the Console currently uses extensively. The Admin API also contains implementations of new functionality not in internal.admin. Our JMX support is an extension to this Admin API. In an overly simplified view, the GemFire JMX MBeans are ModelMBeans that manage instances of the Admin API objects housed in the Agent's MBeanServer. - -The selected architecture consists of a Daemon Agent, which exists in a separate VM that GemFire does not depend on. This Agent hosts an MBeanServer, instances of any and all MBeans registered for managing a GemFire distributed system, and server connectors/adaptors that various types of clients can connect to. - -The two server connectors we selected are the HttpAdaptor and the RMI Connector. The HttpAdaptor provides an HTML user interface of all MBeans in the MBeanServer. Although this generic UI is not as rich as an RMI client (or the GemFire Console) could be, it provides a functional and easy to use UI with no development required. The JMX Remote specification details the standard connectors. Although the HttpAdaptor is not required by this Sun spec. it is included in some form with all JMX implementations that I investigated. It should be noted that our JMX Agent currently starts up the HttpAdaptor, but not the RMI Connector. The latter is deferred as later work since some form of client must be developed for testing. Further research may also uncover a generic, configurable open-source RMI client for JMX. The GemFire Console could in theory be reworked as an RMI Connector client, but this is not currently planned. - -Two open-source JMX implementations made it to our final review for consideration: http://www.xmojo.org;>XMOJO and http://www.mx4j.org;>MX4J. The decision to go with MX4J was based mainly on our perceptions of MX4J being more active and widespread in use. Additionally, XMOJO is associated with http://www.adventnet.com/;>AdventNet which produces commercial products. This made MX4J seem more true to open-source and safer from corporate tampering. - -ModelMBeans are very dynamic and capable of managing aggregate resources. Use of a ModelMBean entails specifying meta-data to an instance of javax.management.modelmbean.RequiredModelMBean. This meta-data identifies the manageble resource(s) which can consist of a single object, or many objects, including those in one VM or in any number of distributed VMs. We decided to subclass classes in the Admin API in order to massage them a little and make them easier to use as a managed resource by the ModelMBean. For example, org.apache.geode.admin.GemFireManager represents a type of member in a GemFire system which manages shared memory. When an MBean is registered for managing the