001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.tag;
020
021import lucee.runtime.ext.tag.AppendixTag;
022import lucee.runtime.ext.tag.BodyTagTryCatchFinallyImpl;
023import lucee.runtime.ext.tag.DynamicAttributes;
024import lucee.runtime.type.Collection;
025import lucee.runtime.type.KeyImpl;
026import lucee.runtime.type.Struct;
027import lucee.runtime.type.StructImpl;
028import lucee.runtime.type.scope.Caller;
029import lucee.runtime.type.scope.Scope;
030
031public abstract class CustomTag extends BodyTagTryCatchFinallyImpl implements DynamicAttributes,AppendixTag {
032        
033
034        protected static final Collection.Key ON_ERROR = KeyImpl.intern("onError");
035        protected static final Collection.Key ON_FINALLY = KeyImpl.intern("onFinally");
036        protected static final Collection.Key ON_START_TAG = KeyImpl.intern("onStartTag");
037        protected static final Collection.Key ON_END_TAG = KeyImpl.intern("onEndTag");
038        protected static final Collection.Key INIT = KeyImpl.intern("init");
039        protected static final Collection.Key GENERATED_CONTENT=KeyImpl.intern("GENERATEDCONTENT");
040
041        protected static final Collection.Key EXECUTION_MODE=KeyImpl.intern("EXECUTIONMODE");      
042        protected static final Collection.Key EXECUTE_BODY=KeyImpl.intern("EXECUTEBODY");
043        protected static final Collection.Key HAS_END_TAG=KeyImpl.intern("HASENDTAG");
044        
045
046        protected static final Collection.Key ATTRIBUTES=KeyImpl.intern("ATTRIBUTES");
047        protected static final Collection.Key CALLER=KeyImpl.intern("CALLER");
048        protected static final Collection.Key THIS_TAG=KeyImpl.intern("THISTAG");
049        
050
051    protected StructImpl attributesScope;
052    protected Caller callerScope;
053        
054    @Override
055    public void doInitBody()    {}
056    
057    
058
059    @Override
060    public final void setDynamicAttribute(String uri, String name, Object value) {
061        TagUtil.setDynamicAttribute(attributesScope,KeyImpl.init(name),value,TagUtil.UPPER_CASE);
062    }
063    
064    /**
065     * @return return thistag scope
066     */
067    public abstract Struct getThisTagScope();
068    
069    /**
070     * @return return the caller scope
071     */
072    public abstract Struct getCallerScope();
073    
074    /**
075     * @return return attributes scope
076     */
077    public abstract Struct getAttributesScope();
078
079        /**
080         * @return the variables scope
081         */
082        public abstract Scope getVariablesScope();
083
084}