001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.management.mbean;
018
019import java.util.concurrent.TimeUnit;
020
021import org.apache.camel.CamelContext;
022import org.apache.camel.api.management.ManagedResource;
023import org.apache.camel.api.management.mbean.ManagedSchedulePollConsumerMBean;
024import org.apache.camel.impl.ScheduledPollConsumer;
025
026/**
027 * @version 
028 */
029@ManagedResource(description = "Managed Scheduled Polling Consumer")
030public class ManagedScheduledPollConsumer extends ManagedConsumer implements ManagedSchedulePollConsumerMBean {
031    private final ScheduledPollConsumer consumer;
032
033    public ManagedScheduledPollConsumer(CamelContext context, ScheduledPollConsumer consumer) {
034        super(context, consumer);
035        this.consumer = consumer;
036    }
037
038    public ScheduledPollConsumer getConsumer() {
039        return consumer;
040    }
041
042    public long getDelay() {
043        return getConsumer().getDelay();
044    }
045
046    public void setDelay(long delay) {
047        getConsumer().setDelay(delay);
048    }
049
050    public long getInitialDelay() {
051        return getConsumer().getInitialDelay();
052    }
053
054    public void setInitialDelay(long initialDelay) {
055        getConsumer().setInitialDelay(initialDelay);
056    }
057
058    public boolean isUseFixedDelay() {
059        return getConsumer().isUseFixedDelay();
060    }
061
062    public void setUseFixedDelay(boolean useFixedDelay) {
063        getConsumer().setUseFixedDelay(useFixedDelay);
064    }
065
066    public String getTimeUnit() {
067        return getConsumer().getTimeUnit().name();
068    }
069
070    public void setTimeUnit(String timeUnit) {
071        getConsumer().setTimeUnit(TimeUnit.valueOf(timeUnit));
072    }
073
074    public boolean isSchedulerStarted() {
075        return getConsumer().isSchedulerStarted();
076    }
077
078    public void startScheduler() {
079        getConsumer().startScheduler();
080    }
081
082    public String getSchedulerClassName() {
083        return getConsumer().getScheduler().getClass().getName();
084    }
085
086    public int getBackoffMultiplier() {
087        return getConsumer().getBackoffMultiplier();
088    }
089
090    public int getBackoffIdleThreshold() {
091        return getConsumer().getBackoffIdleThreshold();
092    }
093
094    public int getBackoffErrorThreshold() {
095        return getConsumer().getBackoffErrorThreshold();
096    }
097
098    public int getBackoffCounter() {
099        return getConsumer().getBackoffCounter();
100    }
101}