Move MXBean definitions to cds-mgmt-api
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardMBeanFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore;
9
10 import org.eclipse.jdt.annotation.NonNull;
11
12 /**
13  * Factory for creating ShardStats mbeans.
14  *
15  * @author Basheeruddin syedbahm@cisco.com
16  */
17 final class ShardMBeanFactory {
18
19     private ShardMBeanFactory() {
20     }
21
22     static ShardStats getShardStatsMBean(final String shardName, final String mxBeanType,
23             final @NonNull Shard shard) {
24         String finalMXBeanType = mxBeanType != null ? mxBeanType : "DistDataStore";
25         ShardStats shardStatsMBeanImpl = new ShardStats(shardName, finalMXBeanType, shard);
26         shardStatsMBeanImpl.registerMBean();
27         return shardStatsMBeanImpl;
28     }
29 }