User: rinkrank Date: 02/04/21 18:19:57 Modified: core/src/xdoclet/tags TagDefTagsHandler.java Log: -added some defaults and validvalues to struts -moved a util method from xdoclettagsupport to tagdefshandler - only used here Revision Changes Path 1.8 +80 -54 xdoclet/core/src/xdoclet/tags/TagDefTagsHandler.java Index: TagDefTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/tags/TagDefTagsHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- TagDefTagsHandler.java 4 Apr 2002 01:03:05 -0000 1.7 +++ TagDefTagsHandler.java 22 Apr 2002 01:19:57 -0000 1.8 @@ -22,9 +22,21 @@ * * @author Ara Abrahamian ([EMAIL PROTECTED]) * @created Nov 11, 2001 - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ -public class TagDefTagsHandler extends XDocletTagSupport { +public class TagDefTagsHandler extends XDocletTagSupport +{ + /** + * @param template_tag_name + * @param param_name + * @exception XDocletException + */ + private static void mandatoryTemplateTagParamNotFound( String template_tag_name, String param_name ) throws XDocletException + { + throw new XDocletException( Translator.getString( "mandatory_tag_param_missing_template", + new String[]{param_name, template_tag_name} ) ); + } + /** * Defines a template tag handler for a template tag to TemplateEngine. * @@ -32,60 +44,74 @@ * @return Description of the Returned Value * @exception XDocletException Description of Exception * @doc:tag type="content" - * @doc:param name="namespace" optional="false" description="The template - * namespace name, 'Merge' for example if we were to define template - * namespace 'Merge' this way." - * @doc:param name="handler" optional="false" description="The template tag - * handler full qualified class name. It's the class that implements tags - * of namespace. It should be a public class, with a no argument public - * constructor, and should extend xdoclet.XDocletTagSupport." + * @doc:param name="namespace" optional="false" + * description="The template namespace name, 'Merge' for example if we + * were to define template namespace 'Merge' this way." + * @doc:param name="handler" optional="false" + * description="The template tag handler full qualified class name. It's + * the class that implements tags of namespace. It should be a public + * class, with a no argument public constructor, and should extend + * xdoclet.XDocletTagSupport." */ - public String tagDef(Properties attributes) throws XDocletException { + public String tagDef( Properties attributes ) throws XDocletException + { Category cat = Log.getCategory(TagDefTagsHandler.class, "tagDef"); String namespace = attributes.getProperty("namespace"); String handler_full_class_name = attributes.getProperty("handler"); - if (cat.isDebugEnabled()) { + if( cat.isDebugEnabled() ) + { cat.debug("namespace=" + namespace); cat.debug("handler=" + handler_full_class_name); } - if (namespace == null) { + if( namespace == null ) + { mandatoryTemplateTagParamNotFound("tagDef", "namespace"); } - if (handler_full_class_name == null) { + if( handler_full_class_name == null ) + { mandatoryTemplateTagParamNotFound("tagDef", "handler"); } Class handler_class = null; - try { + try + { handler_class = Class.forName(handler_full_class_name); Object handler_instance = handler_class.newInstance(); getEngine().setTagHandlerFor(namespace, (TemplateTagHandler)handler_instance); - } catch (ClassNotFoundException e) { + } + catch( ClassNotFoundException e ) + { String msg = Translator.getString("class_not_found", new String[]{handler_class.toString()}); cat.error(msg, e); throw new XDocletException(e, msg); - } catch (InstantiationException e) { + } + catch( InstantiationException e ) + { String msg = Translator.getString("tagdef_instantiation_exception", new String[]{handler_class.toString()}); cat.error(msg, e); throw new XDocletException(e, msg); - } catch (IllegalAccessException e) { + } + catch( IllegalAccessException e ) + { String msg = Translator.getString("tagdef_illegalaccess_exception", new String[]{handler_class.toString()}); cat.error(msg, e); throw new XDocletException(e, msg); - } catch (TemplateException e) { + } + catch( TemplateException e ) + { String msg = Translator.getString("tagdef_couldnt_def_handler", new String[]{handler_full_class_name, namespace});
_______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel