Coverage Report - org.kuali.rice.ksb.messaging.service.impl.BusAdminServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
BusAdminServiceImpl
0%
0/26
0%
0/6
1.5
 
 1  
 /*
 2  
  * Copyright 2006-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.kuali.rice.ksb.messaging.service.impl;
 18  
 
 19  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 20  
 import org.kuali.rice.core.api.lifecycle.BaseLifecycle;
 21  
 import org.kuali.rice.ksb.messaging.service.BusAdminService;
 22  
 import org.kuali.rice.ksb.messaging.threadpool.KSBThreadPool;
 23  
 
 24  
 
 25  
 /**
 26  
  * Implementation of the Bus Admin service.
 27  
  *
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  0
 public class BusAdminServiceImpl extends BaseLifecycle implements BusAdminService {
 31  
 
 32  0
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BusAdminServiceImpl.class);
 33  
 
 34  
     private KSBThreadPool threadPool;
 35  
 
 36  
     public void setThreadPool(KSBThreadPool threadPool) {
 37  0
             this.threadPool = threadPool;
 38  0
     }
 39  
     
 40  
     protected KSBThreadPool getThreadPool() {
 41  0
             return this.threadPool;
 42  
     }
 43  
     
 44  
     public void ping() {
 45  0
     }
 46  
 
 47  
     public void setCorePoolSize(int corePoolSize) {
 48  0
             LOG.info("Setting core pool size to " + corePoolSize);
 49  0
             getThreadPool().setCorePoolSize(corePoolSize);
 50  0
     }
 51  
 
 52  
     public void setMaximumPoolSize(int maxPoolSize) {
 53  0
             LOG.info("Setting max pool size to " + maxPoolSize);
 54  0
             if (maxPoolSize < getThreadPool().getCorePoolSize()) {
 55  0
                     maxPoolSize = getThreadPool().getCorePoolSize();
 56  
             }
 57  0
             getThreadPool().setMaximumPoolSize(maxPoolSize);
 58  0
     }
 59  
 
 60  
     public void setConfigProperty(String propertyName, String propertyValue) {
 61  0
             String originalValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName);
 62  0
             LOG.info("Changing config property '" + propertyName + "' from " + originalValue + " to " + propertyValue);
 63  0
             if (propertyValue == null) {
 64  0
                     ConfigContext.getCurrentContextConfig().removeProperty(propertyName);
 65  
             } else {
 66  0
                     ConfigContext.getCurrentContextConfig().putProperty(propertyName, propertyValue);
 67  
             }
 68  0
     }
 69  
 
 70  
     public void start() throws Exception {
 71  0
             if (getThreadPool() == null) {
 72  0
                     throw new IllegalStateException("The threadPool has not been set on the busAdminService");
 73  
             }
 74  0
             setStarted(true);
 75  0
     }
 76  
 
 77  
     public void stop() throws Exception {
 78  0
             setStarted(false);
 79  0
     }
 80  
 
 81  
 }