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;
020
021
022import lucee.commons.lang.types.RefBoolean;
023import lucee.runtime.component.Property;
024import lucee.runtime.exp.PageException;
025import lucee.runtime.type.Collection;
026import lucee.runtime.type.Objects;
027import lucee.runtime.type.Struct;
028import lucee.runtime.type.UDF;
029import lucee.runtime.type.UDFProperties;
030/**
031 * interface for a Component
032 */
033public interface Component extends Struct,Objects,CFObject {
034    
035    /**
036     * Constant for Access Mode Remote
037     */
038    public static final int ACCESS_REMOTE = 0;
039
040    /**
041     * Constant for Access Mode Public
042     */
043    public static final int ACCESS_PUBLIC = 1;
044
045    /**
046     * Constant for Access Mode Package
047     */
048    public static final int ACCESS_PACKAGE = 2;
049
050    /**
051     * Constant for Access Mode Private
052     */
053    public static final int ACCESS_PRIVATE = 3;
054    
055    /**
056     * Field <code>ACCESS_COUNT</code>
057     */
058    public static final int ACCESS_COUNT=4;
059    
060    /**
061     * returns java class to the component interface (all UDFs),
062     * this class is generated dynamic when used
063     * @param isNew 
064     * @throws PageException
065     * FUTURE deprecated
066     */
067    public Class getJavaAccessClass(RefBoolean isNew) throws PageException;
068    // FUTURE public Class getJavaAccessClass(PageContext pc,RefBoolean isNew) throws PageException;
069
070    /**
071     * @return Returns the display name.
072     */
073    public abstract String getDisplayName();
074
075    /**
076     * @return Returns the Extends.
077     */
078    public abstract String getExtends();
079
080    /**
081     * @return Returns the Hint.
082     */
083    public abstract String getHint();
084
085    /**
086     * @return Returns the Name.
087     */
088    public abstract String getName();
089
090    /**
091     * @return Returns the Name.
092     */
093    public abstract String getCallName();
094
095    /**
096     * @return Returns the Name.
097     */
098    public abstract String getAbsName();
099
100    /**
101     * @return Returns the output.
102     */
103    public abstract boolean getOutput();
104
105    /**
106     * check if Component is instance of this type
107     * @param type type to compare as String
108     * @return is instance of this type
109     */
110    public abstract boolean instanceOf(String type);
111
112    /**
113     * check if value is a valid access modifier constant
114     * @param access
115     * @return is valid access
116     */
117    public abstract boolean isValidAccess(int access);
118    
119
120    /**
121     * returns Meta Data to the Component
122     * @param pc
123     * @return meta data to component
124     * @throws PageException
125     */
126    public abstract Struct getMetaData(PageContext pc) throws PageException;
127    
128    /**
129     * call a method of the component with no named arguments
130     * @param pc PageContext
131     * @param key name of the method
132     * @param args Arguments for the method
133     * @return return result of the method
134     * @throws PageException
135     */
136    public abstract Object call(PageContext pc, String key, Object[] args) throws PageException;
137    
138    /**
139     * call a method of the component with named arguments
140     * @param pc PageContext
141     * @param key name of the method
142     * @param args Named Arguments for the method
143     * @return return result of the method
144     * @throws PageException
145     */
146    public abstract Object callWithNamedValues(PageContext pc, String key, Struct args) throws PageException;
147    
148    
149        /**
150         * return all properties from component
151         * @param onlyPeristent if true return only columns where attribute persistent is not set to false
152         * @return
153         */
154        public Property[] getProperties(boolean onlyPeristent);// FUTURE deprecated
155
156        public void setProperty(Property property) throws PageException;
157        
158        public ComponentScope getComponentScope();
159        
160        public boolean contains(PageContext pc,Key key);
161        
162        public PageSource getPageSource();
163        //public Member getMember(int access,Collection.Key key, boolean dataMember,boolean superAccess);
164        
165        public String getBaseAbsName();
166        
167        public boolean isBasePeristent();
168        
169        public boolean equalTo(String type);
170        
171        public String getWSDLFile();
172        
173
174        
175
176    public void registerUDF(String key, UDF udf);
177    
178    public void registerUDF(Collection.Key key, UDF udf);
179    
180    public void registerUDF(String key, UDFProperties props);
181    
182    public void registerUDF(Collection.Key key, UDFProperties props);
183}