src/core/net/sf/basedb/util/extensions/ExtensionPointBean.java

Code
Comments
Other
Rev Date Author Line
4158 22 Feb 08 nicklas 1 /**
4320 29 May 08 nicklas 2   $Id:ExtensionPointBean.java 4187 2008-03-20 11:15:25Z nicklas $
4158 22 Feb 08 nicklas 3
4158 22 Feb 08 nicklas 4   Copyright (C) Authors contributing to this file.
4158 22 Feb 08 nicklas 5
4158 22 Feb 08 nicklas 6   This file is part of BASE - BioArray Software Environment.
4158 22 Feb 08 nicklas 7   Available at http://base.thep.lu.se/
4158 22 Feb 08 nicklas 8
4158 22 Feb 08 nicklas 9   BASE is free software; you can redistribute it and/or
4158 22 Feb 08 nicklas 10   modify it under the terms of the GNU General Public License
4479 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
4158 22 Feb 08 nicklas 12   of the License, or (at your option) any later version.
4158 22 Feb 08 nicklas 13
4158 22 Feb 08 nicklas 14   BASE is distributed in the hope that it will be useful,
4158 22 Feb 08 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
4158 22 Feb 08 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4158 22 Feb 08 nicklas 17   GNU General Public License for more details.
4158 22 Feb 08 nicklas 18
4158 22 Feb 08 nicklas 19   You should have received a copy of the GNU General Public License
4515 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
4158 22 Feb 08 nicklas 21 */
4158 22 Feb 08 nicklas 22 package net.sf.basedb.util.extensions;
4158 22 Feb 08 nicklas 23
4158 22 Feb 08 nicklas 24 /**
4163 28 Feb 08 nicklas 25   A bean-like implementation of the {@link ExtensionPoint}
4163 28 Feb 08 nicklas 26   interface. This implementation adds setter methods for simple
4163 28 Feb 08 nicklas 27   initialisation of the bean properties.
4158 22 Feb 08 nicklas 28
4158 22 Feb 08 nicklas 29   @author nicklas
4158 22 Feb 08 nicklas 30   @version 2.7
4320 29 May 08 nicklas 31   @base.modified $Date:2008-03-20 12:15:25 +0100 (Thu, 20 Mar 2008) $
4158 22 Feb 08 nicklas 32 */
4163 28 Feb 08 nicklas 33 public class ExtensionPointBean<A extends Action>
4158 22 Feb 08 nicklas 34   implements ExtensionPoint<A>
4158 22 Feb 08 nicklas 35 {
4158 22 Feb 08 nicklas 36
4163 28 Feb 08 nicklas 37   private String id;
4168 04 Mar 08 nicklas 38   private String name;
4163 28 Feb 08 nicklas 39   private String description;
4163 28 Feb 08 nicklas 40   private Class<A> actionClass;
4170 07 Mar 08 nicklas 41   private RendererFactory<? super A> rendererFactory;
4163 28 Feb 08 nicklas 42   private boolean allowRendererOverride;
5486 12 Nov 10 nicklas 43   private ErrorHandlerFactory<? super A> errorHandlerFactory;
4158 22 Feb 08 nicklas 44   
4163 28 Feb 08 nicklas 45   /**
4163 28 Feb 08 nicklas 46     Create a new empty extension point bean. Use the setter
4163 28 Feb 08 nicklas 47     methods to set the properties before registering 
7703 11 Apr 19 nicklas 48     the extension with {@link Registry#registerExtensionPoint(ExtensionPoint, ClassLoader)}.
4163 28 Feb 08 nicklas 49   */
4163 28 Feb 08 nicklas 50   public ExtensionPointBean()
4163 28 Feb 08 nicklas 51   {}
4163 28 Feb 08 nicklas 52   
4163 28 Feb 08 nicklas 53   /**
4163 28 Feb 08 nicklas 54     Create a new fully initialised extension point bean. See the 
4163 28 Feb 08 nicklas 55     {@link ExtensionPoint} interface for a description of the 
4163 28 Feb 08 nicklas 56     parameters.
4163 28 Feb 08 nicklas 57   */
4163 28 Feb 08 nicklas 58   public ExtensionPointBean(
4163 28 Feb 08 nicklas 59     String id, 
4168 04 Mar 08 nicklas 60     String name,
4163 28 Feb 08 nicklas 61     String description, 
4163 28 Feb 08 nicklas 62     Class<A> actionClass, 
4163 28 Feb 08 nicklas 63     RendererFactory<A> rendererFactory, 
4163 28 Feb 08 nicklas 64     boolean allowRendererOverride)
4158 22 Feb 08 nicklas 65   {
4158 22 Feb 08 nicklas 66     this.id = id;
4168 04 Mar 08 nicklas 67     this.name = name;
4158 22 Feb 08 nicklas 68     this.description = description;
4158 22 Feb 08 nicklas 69     this.actionClass = actionClass;
4158 22 Feb 08 nicklas 70     this.rendererFactory = rendererFactory;
4158 22 Feb 08 nicklas 71     this.allowRendererOverride = allowRendererOverride;
4158 22 Feb 08 nicklas 72   }
4158 22 Feb 08 nicklas 73   
4163 28 Feb 08 nicklas 74   @Override
4320 29 May 08 nicklas 75   public String toString()
4320 29 May 08 nicklas 76   {
4320 29 May 08 nicklas 77     return "ExtensionPointBean[id="+ id +"]";
4320 29 May 08 nicklas 78   }
4320 29 May 08 nicklas 79   
4320 29 May 08 nicklas 80   @Override
4163 28 Feb 08 nicklas 81   public String getId()
4163 28 Feb 08 nicklas 82   {
4163 28 Feb 08 nicklas 83     return id;
4163 28 Feb 08 nicklas 84   }
4163 28 Feb 08 nicklas 85   public void setId(String id)
4163 28 Feb 08 nicklas 86   {
4163 28 Feb 08 nicklas 87     this.id = id;
4163 28 Feb 08 nicklas 88   }
4158 22 Feb 08 nicklas 89   
4163 28 Feb 08 nicklas 90   @Override
4168 04 Mar 08 nicklas 91   public String getName()
4168 04 Mar 08 nicklas 92   {
4168 04 Mar 08 nicklas 93     return name;
4168 04 Mar 08 nicklas 94   }
4168 04 Mar 08 nicklas 95   public void setName(String name)
4168 04 Mar 08 nicklas 96   {
4168 04 Mar 08 nicklas 97     this.name = name;
4168 04 Mar 08 nicklas 98   }
4168 04 Mar 08 nicklas 99   
4168 04 Mar 08 nicklas 100   @Override
4163 28 Feb 08 nicklas 101   public String getDescription()
4163 28 Feb 08 nicklas 102   {
4163 28 Feb 08 nicklas 103     return description;
4163 28 Feb 08 nicklas 104   }
4163 28 Feb 08 nicklas 105   public void setDescription(String description)
4163 28 Feb 08 nicklas 106   {
4163 28 Feb 08 nicklas 107     this.description = description;
4163 28 Feb 08 nicklas 108   }
4163 28 Feb 08 nicklas 109   
4163 28 Feb 08 nicklas 110   @Override
4158 22 Feb 08 nicklas 111   public Class<A> getActionClass()
4158 22 Feb 08 nicklas 112   {
4158 22 Feb 08 nicklas 113     return actionClass;
4158 22 Feb 08 nicklas 114   }
4163 28 Feb 08 nicklas 115   public void setActionClass(Class<A> actionClass)
4163 28 Feb 08 nicklas 116   {
4163 28 Feb 08 nicklas 117     this.actionClass = actionClass;
4163 28 Feb 08 nicklas 118   }
4158 22 Feb 08 nicklas 119
4163 28 Feb 08 nicklas 120   @Override
4170 07 Mar 08 nicklas 121   public RendererFactory<? super A> getRendererFactory()
4158 22 Feb 08 nicklas 122   {
4158 22 Feb 08 nicklas 123     return rendererFactory;
4158 22 Feb 08 nicklas 124   }
4170 07 Mar 08 nicklas 125   public void setRendererFactory(RendererFactory<? super A> rendererFactory)
4163 28 Feb 08 nicklas 126   {
4163 28 Feb 08 nicklas 127     this.rendererFactory = rendererFactory;
4163 28 Feb 08 nicklas 128   }
4163 28 Feb 08 nicklas 129   
4163 28 Feb 08 nicklas 130   @Override
4158 22 Feb 08 nicklas 131   public boolean allowRendererOverride()
4158 22 Feb 08 nicklas 132   {
4158 22 Feb 08 nicklas 133     return allowRendererOverride;
4158 22 Feb 08 nicklas 134   }
4163 28 Feb 08 nicklas 135   public void setAllowRendererOverrider(boolean allowRendererOverride)
4158 22 Feb 08 nicklas 136   {
4163 28 Feb 08 nicklas 137     this.allowRendererOverride = allowRendererOverride;
4158 22 Feb 08 nicklas 138   }
4158 22 Feb 08 nicklas 139
5486 12 Nov 10 nicklas 140   @Override
5486 12 Nov 10 nicklas 141   public ErrorHandlerFactory<? super A> getErrorHandlerFactory()
5486 12 Nov 10 nicklas 142   {
5486 12 Nov 10 nicklas 143     return errorHandlerFactory;
5486 12 Nov 10 nicklas 144   }
5486 12 Nov 10 nicklas 145   public void setErrorHandlerFactory(ErrorHandlerFactory<? super A> errorHandlerFactory)
5486 12 Nov 10 nicklas 146   {
5486 12 Nov 10 nicklas 147     this.errorHandlerFactory = errorHandlerFactory;
5486 12 Nov 10 nicklas 148   }
4158 22 Feb 08 nicklas 149
5486 12 Nov 10 nicklas 150
4158 22 Feb 08 nicklas 151 }