[14/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal

2016-11-15 Thread klund
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticAttributeInfo.java
--
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticAttributeInfo.java
 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticAttributeInfo.java
new file mode 100755
index 000..ec675f1
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticAttributeInfo.java
@@ -0,0 +1,71 @@
+/*
+ * 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.jmx.impl;
+
+import org.apache.geode.internal.admin.api.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 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/b6c305f8/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticResourceJmxImpl.java
--
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticResourceJmxImpl.java
 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticResourceJmxImpl.java
new file mode 100755
index 000..f7b776b
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/StatisticResourceJmxImpl.java
@@ -0,0 +1,342 @@
+/*
+ * 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.jmx.impl;
+
+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 

[14/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal

2016-11-07 Thread klund
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6bb27bf1/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/package.html
--
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/package.html
 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/package.html
new file mode 100755
index 000..ab335d1
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/admin/api/jmx/impl/package.html
@@ -0,0 +1,166 @@
+
+
+
+
+Contains the implementation of the external JMX APIs from
+org.apache.geode.internal.admin.api.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.internal.admin.api.GemFireManager represents a type of member 
in a GemFire system which manages shared memory. 

[14/50] [abbrv] incubator-geode git commit: GEODE-288: move admin packages to internal

2016-10-27 Thread klund
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/20a32286/geode-core/src/main/resources/org/apache/geode/admin/api/jmx/mbeans-descriptors.xml
--
diff --git 
a/geode-core/src/main/resources/org/apache/geode/admin/api/jmx/mbeans-descriptors.xml
 
b/geode-core/src/main/resources/org/apache/geode/admin/api/jmx/mbeans-descriptors.xml
new file mode 100755
index 000..1735f5f
--- /dev/null
+++ 
b/geode-core/src/main/resources/org/apache/geode/admin/api/jmx/mbeans-descriptors.xml
@@ -0,0 +1,1452 @@
+
+http://jakarta.apache.org/commons/dtds/mbeans-descriptors.dtd;>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+  
+  
+
+
+  
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.member.joined
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.member.left
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.member.crashed
+
+
+
+  
+
+
+
+  
+  gemfire.distributedsystem.alert
+
+
+
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+   
+
+  
+  
+  
+  
+
+
+
+  
+
+
+
+
+
+
+  
+
+
+
+  
+
+
+
+  
+
+
+  
+  
+
+
+
+
+   
+
+  
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.created
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.closed
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.region.created
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.region.lost
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.client.joined
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.client.left
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.client.crashed
+
+ 
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+  
+
+
+
+  
+
+
+
+
+
+
+
+   
+  
+
+  
+  
+  
+  
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+ 
+
+
+
+
+
+
+
+
+
+
+
+   
+   
+ 
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+  
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+ 
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.created
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.closed
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.region.created
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.region.lost
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.client.joined
+
+
+
+  
+
+
+
+  
+  
gemfire.distributedsystem.cache.client.left
+
+
+
+  
+
+
+
+  
+