001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.jmx.export.metadata;
018
019import org.springframework.lang.Nullable;
020
021/**
022 * Metadata indicating that instances of an annotated class
023 * are to be registered with a JMX server.
024 * Only valid when used on a {@code Class}.
025 *
026 * @author Rob Harrop
027 * @since 1.2
028 * @see org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
029 * @see org.springframework.jmx.export.naming.MetadataNamingStrategy
030 * @see org.springframework.jmx.export.MBeanExporter
031 */
032public class ManagedResource extends AbstractJmxAttribute {
033
034        @Nullable
035        private String objectName;
036
037        private boolean log = false;
038
039        @Nullable
040        private String logFile;
041
042        @Nullable
043        private String persistPolicy;
044
045        private int persistPeriod = -1;
046
047        @Nullable
048        private String persistName;
049
050        @Nullable
051        private String persistLocation;
052
053
054        /**
055         * Set the JMX ObjectName of this managed resource.
056         */
057        public void setObjectName(@Nullable String objectName) {
058                this.objectName = objectName;
059        }
060
061        /**
062         * Return the JMX ObjectName of this managed resource.
063         */
064        @Nullable
065        public String getObjectName() {
066                return this.objectName;
067        }
068
069        public void setLog(boolean log) {
070                this.log = log;
071        }
072
073        public boolean isLog() {
074                return this.log;
075        }
076
077        public void setLogFile(@Nullable String logFile) {
078                this.logFile = logFile;
079        }
080
081        @Nullable
082        public String getLogFile() {
083                return this.logFile;
084        }
085
086        public void setPersistPolicy(@Nullable String persistPolicy) {
087                this.persistPolicy = persistPolicy;
088        }
089
090        @Nullable
091        public String getPersistPolicy() {
092                return this.persistPolicy;
093        }
094
095        public void setPersistPeriod(int persistPeriod) {
096                this.persistPeriod = persistPeriod;
097        }
098
099        public int getPersistPeriod() {
100                return this.persistPeriod;
101        }
102
103        public void setPersistName(@Nullable String persistName) {
104                this.persistName = persistName;
105        }
106
107        @Nullable
108        public String getPersistName() {
109                return this.persistName;
110        }
111
112        public void setPersistLocation(@Nullable String persistLocation) {
113                this.persistLocation = persistLocation;
114        }
115
116        @Nullable
117        public String getPersistLocation() {
118                return this.persistLocation;
119        }
120
121}