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.activemq.web; 018 019import javax.management.openmbean.CompositeData; 020 021public class JobFacade { 022 private final CompositeData data; 023 public JobFacade(CompositeData data) { 024 this.data = data; 025 } 026 public String getCronEntry() { 027 return data.get("cronEntry").toString(); 028 } 029 030 public String getJobId() { 031 return toString(data.get("jobId")); 032 } 033 034 public String getNextExecutionTime() { 035 return toString(data.get("next")); 036 } 037 038 public long getDelay() { 039 Long result = (Long) data.get("delay"); 040 if (result != null) { 041 return result.longValue(); 042 } 043 return 0l; 044 } 045 046 public long getPeriod() { 047 Long result = (Long) data.get("period"); 048 if (result != null) { 049 return result.longValue(); 050 } 051 return 0l; 052 } 053 054 public int getRepeat() { 055 Integer result = (Integer) data.get("repeat"); 056 if (result != null) { 057 return result.intValue(); 058 } 059 return 0; 060 } 061 062 public String getStart() { 063 return toString(data.get("start")); 064 } 065 066 private String toString(Object object) { 067 return object != null ? object.toString() : ""; 068 } 069 070}