[35/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/GemFireHealthConfigJmxImpl.java -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/GemFireHealthConfigJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/GemFireHealthConfigJmxImpl.java deleted file mode 100644 index 6c44811..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/GemFireHealthConfigJmxImpl.java +++ /dev/null @@ -1,211 +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.ObjectName; -import javax.management.modelmbean.ModelMBean; - -import org.apache.geode.admin.AdminException; -import org.apache.geode.admin.GemFireHealth; -import org.apache.geode.admin.GemFireHealthConfig; -import org.apache.geode.admin.internal.GemFireHealthConfigImpl; - -/** - * The JMX "managed resource" that represents the configuration for the health of GemFire. - * Basically, it provides the behavior of GemFireHealthConfigImpl, but does some JMX - * stuff like registering beans with the agent. - * - * - * - * Unlike other ManagedResources this class cannot simply subclass - * GemFireHealthImpl because it instances are serialized and sent to other VMs. This is - * problematic because the other VMs most likely do not have JMX classes like - * ModelMBean on their classpaths. So, instead we delegate all of the - * GemFireHealthConfig behavior to another object which IS serialized. - * - * @see GemFireHealthJmxImpl#createDistributedSystemHealthConfig - * - * - * @since GemFire 3.5 - */ -@edu.umd.cs.findbugs.annotations.SuppressWarnings( -justification = "This class is deprecated. Also, any further changes so close to the release is inadvisable.") -public class GemFireHealthConfigJmxImpl -implements GemFireHealthConfig, ManagedResource, java.io.Serializable { - - private static final long serialVersionUID = 1482719647163239953L; - - /** The GemFireHealth that we help configure */ - private GemFireHealth health; - - /** The name of the MBean that will manage this resource */ - private String mbeanName; - - /** The ModelMBean that is configured to manage this resource */ - private ModelMBean modelMBean; - - /** The delegate that contains the real config state */ - private GemFireHealthConfig delegate; - - /** The object name of this managed resource */ - private ObjectName objectName; - - /// Constructors /// - - /** - * Creates a new GemFireHealthConfigJmxImpl that configures the health monitoring of - * components running on the given host. - */ - GemFireHealthConfigJmxImpl(GemFireHealthJmxImpl health, String hostName) throws AdminException { - -this.delegate = new GemFireHealthConfigImpl(hostName); -this.health = health; -this.mbeanName = new StringBuffer().append(MBEAN_NAME_PREFIX).append("GemFireHealthConfig,id=") - .append(MBeanUtil.makeCompliantMBeanNameProperty(health.getDistributedSystem().getId())) -.append(",host=") -.append((hostName == null ? "default" : MBeanUtil.makeCompliantMBeanNameProperty(hostName))) -.toString(); -this.objectName = MBeanUtil.createMBean(this); - } - - // Instance Methods // - - /** - * Applies the changes made to this config back to the health monitor. - * - * @see GemFireHealth#setDistributedSystemHealthConfig - */ - public void applyChanges() { -String hostName = this.getHostName(); -if (hostName == null) { - this.health.setDefaultGemFireHealthConfig(this); - -} else { - this.health.setGemFireHealthConfig(hostName, this); -} - } - - public String getMBeanName() { -return this.mbeanName; - } - - public ModelMBean getModelMBean() { -return this.modelMBean; - } - - public ObjectName getObjectName() { -return this.objectName; - } - - public void setModelMBean(ModelMBean modelMBean) { -this.modelMBean = modelMBean; - } - - public ManagedResourceType getManagedResourceType()
[35/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/MX4JModelMBean.java -- diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MX4JModelMBean.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MX4JModelMBean.java deleted file mode 100755 index d3f4ab2..000 --- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MX4JModelMBean.java +++ /dev/null @@ -1,1232 +0,0 @@ -/* - * Copyright (C) MX4J. All rights reserved. - * - * This software is distributed under the terms of the MX4J License version 1.0. See the terms of - * the MX4J License in the documentation provided with this software. - */ - -package org.apache.geode.admin.jmx.internal; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Date; -import java.util.Iterator; - -import javax.management.Attribute; -import javax.management.AttributeChangeNotification; -import javax.management.AttributeChangeNotificationFilter; -import javax.management.AttributeList; -import javax.management.AttributeNotFoundException; -import javax.management.Descriptor; -import javax.management.InstanceNotFoundException; -import javax.management.InvalidAttributeValueException; -import javax.management.ListenerNotFoundException; -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanException; -import javax.management.MBeanInfo; -import javax.management.MBeanNotificationInfo; -import javax.management.MBeanOperationInfo; -import javax.management.MBeanRegistration; -import javax.management.MBeanRegistrationException; -import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; -import javax.management.Notification; -import javax.management.NotificationBroadcasterSupport; -import javax.management.NotificationEmitter; -import javax.management.NotificationFilter; -import javax.management.NotificationListener; -import javax.management.ObjectName; -import javax.management.ReflectionException; -import javax.management.RuntimeErrorException; -import javax.management.RuntimeOperationsException; -import javax.management.ServiceNotFoundException; -import javax.management.loading.ClassLoaderRepository; -import javax.management.modelmbean.InvalidTargetObjectTypeException; -import javax.management.modelmbean.ModelMBean; -import javax.management.modelmbean.ModelMBeanAttributeInfo; -import javax.management.modelmbean.ModelMBeanInfo; -import javax.management.modelmbean.ModelMBeanOperationInfo; - -import mx4j.ImplementationException; -import mx4j.log.FileLogger; -import mx4j.log.Log; -import mx4j.log.Logger; -import mx4j.log.MBeanLogger; -import mx4j.persist.FilePersister; -import mx4j.persist.MBeanPersister; -import mx4j.persist.PersisterMBean; -import mx4j.util.Utils; - -import org.apache.geode.internal.i18n.LocalizedStrings; - -/** - * @author mailto:biorn_stee...@users.sourceforge.net;>Simone Bordet - * @version $Revision: 1.14 $ - */ -public class MX4JModelMBean implements ModelMBean, MBeanRegistration, NotificationEmitter { - private static final String OBJECT_RESOURCE_TYPE = "ObjectReference"; - - private static final int ALWAYS_STALE = 1; - private static final int NEVER_STALE = 2; - private static final int STALE = 3; - private static final int NOT_STALE = 4; - - private static final int PERSIST_NEVER = -1; - private static final int PERSIST_ON_TIMER = -2; - private static final int PERSIST_ON_UPDATE = -3; - private static final int PERSIST_NO_MORE_OFTEN_THAN = -4; - - private MBeanServer m_mbeanServer; - private Object m_managedResource; - private boolean m_canBeRegistered; - private ModelMBeanInfo m_modelMBeanInfo; - private NotificationBroadcasterSupport m_attributeChangeBroadcaster = - new NotificationBroadcasterSupport(); - private NotificationBroadcasterSupport m_generalBroadcaster = - new NotificationBroadcasterSupport(); - - public MX4JModelMBean() throws MBeanException, RuntimeOperationsException { -try { - load(); -} catch (Exception x) { - Logger logger = getLogger(); - logger.warn(LocalizedStrings.MX4JModelMBean_CANNOT_RESTORE_PREVIOUSLY_SAVED_STATUS - .toLocalizedString(), x); -} - } - - public MX4JModelMBean(ModelMBeanInfo info) throws MBeanException, RuntimeOperationsException { -if (info == null) - throw new RuntimeOperationsException(new IllegalArgumentException( - LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_PARAMETER_CANT_BE_NULL - .toLocalizedString())); -else - setModelMBeanInfo(info); - } - - private Logger getLogger() { -return Log.getLogger(getClass().getName()); - } - - public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { -if (m_canBeRegistered) { - m_mbeanServer = server; - return name; -}
[35/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/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