001package org.apache.commons.jcs.auxiliary; 002 003import org.apache.commons.jcs.engine.behavior.ICacheEventQueue; 004 005/* 006 * Licensed to the Apache Software Foundation (ASF) under one 007 * or more contributor license agreements. See the NOTICE file 008 * distributed with this work for additional information 009 * regarding copyright ownership. The ASF licenses this file 010 * to you under the Apache License, Version 2.0 (the 011 * "License"); you may not use this file except in compliance 012 * with the License. You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, 017 * software distributed under the License is distributed on an 018 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 019 * KIND, either express or implied. See the License for the 020 * specific language governing permissions and limitations 021 * under the License. 022 */ 023 024/** 025 * This has common attributes used by all auxiliaries. 026 */ 027public abstract class AbstractAuxiliaryCacheAttributes 028 implements AuxiliaryCacheAttributes 029{ 030 /** Don't change */ 031 private static final long serialVersionUID = -6594609334959187673L; 032 033 /** cacheName */ 034 private String cacheName; 035 036 /** name */ 037 private String name; 038 039 /** eventQueueType -- pooled, or single threaded */ 040 private ICacheEventQueue.QueueType eventQueueType; 041 042 /** Named when pooled */ 043 private String eventQueuePoolName; 044 045 /** 046 * @param name 047 */ 048 @Override 049 public void setCacheName( String name ) 050 { 051 this.cacheName = name; 052 } 053 054 /** 055 * Gets the cacheName attribute of the AuxiliaryCacheAttributes object 056 * <p> 057 * @return The cacheName value 058 */ 059 @Override 060 public String getCacheName() 061 { 062 return this.cacheName; 063 } 064 065 /** 066 * This is the name of the auxiliary in configuration file. 067 * <p> 068 * @see org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes#setName(java.lang.String) 069 */ 070 @Override 071 public void setName( String s ) 072 { 073 this.name = s; 074 } 075 076 /** 077 * Gets the name attribute of the AuxiliaryCacheAttributes object 078 * <p> 079 * @return The name value 080 */ 081 @Override 082 public String getName() 083 { 084 return this.name; 085 } 086 087 /** 088 * SINGLE is the default. If you choose POOLED, the value of EventQueuePoolName will be used 089 * <p> 090 * @param queueType SINGLE or POOLED 091 */ 092 @Override 093 public void setEventQueueType( ICacheEventQueue.QueueType queueType ) 094 { 095 this.eventQueueType = queueType; 096 } 097 098 /** 099 * @return SINGLE or POOLED 100 */ 101 @Override 102 public ICacheEventQueue.QueueType getEventQueueType() 103 { 104 return eventQueueType; 105 } 106 107 /** 108 * If you choose a POOLED event queue type, the value of EventQueuePoolName will be used. This 109 * is ignored if the pool type is SINGLE 110 * <p> 111 * @param s SINGLE or POOLED 112 */ 113 @Override 114 public void setEventQueuePoolName( String s ) 115 { 116 eventQueuePoolName = s; 117 } 118 119 /** 120 * Sets the pool name to use. If a pool is not found by this name, the thread pool manager will 121 * return a default configuration. 122 * <p> 123 * @return name of thread pool to use for this auxiliary 124 */ 125 @Override 126 public String getEventQueuePoolName() 127 { 128 return eventQueuePoolName; 129 } 130 131 /** 132 * @see java.lang.Object#clone() 133 */ 134 @Override 135 public AbstractAuxiliaryCacheAttributes clone() 136 { 137 try 138 { 139 return (AbstractAuxiliaryCacheAttributes)super.clone(); 140 } 141 catch (CloneNotSupportedException e) 142 { 143 throw new RuntimeException("Clone not supported. This should never happen.", e); 144 } 145 } 146}