001    package railo.runtime;
002    
003    import java.io.IOException;
004    
005    import railo.commons.io.res.Resource;
006    import railo.runtime.config.ConfigWeb;
007    import railo.runtime.exp.PageException;
008    
009    /**
010     * extends the source file with class features 
011     */
012    public interface PageSource extends SourceFile {
013    
014        /**
015         * loads the Page from this PageSource
016         * @param config
017         * @return page Loaded
018         * @throws PageException
019         */
020        public abstract Page loadPage(ConfigWeb config) throws PageException;
021        
022        public abstract Page loadPage(PageContext pc) throws PageException;
023        
024        /**
025         * loads the Page from this PageSource
026         * @param config
027         * @param defaultValue
028         * @return Page loaded
029         * @throws PageException 
030         */
031        public abstract Page loadPage(ConfigWeb config, Page defaultValue) throws PageException;
032            public abstract Page loadPage(PageContext pc, Page defaultValue) throws PageException;
033        
034        /**
035         * returns the ralpath without the mapping
036         * @return Returns the realpath.
037         */
038        public abstract String getRealpath();
039    
040        /**
041         * Returns the full name (mapping/realpath).
042         * @return mapping/realpath
043         */
044        public abstract String getFullRealpath();
045    
046        /**
047         * @return returns the full class name (Example: railo.web.test_cfm)
048         */
049        public abstract String getClazz();
050    
051        /**
052         * @return return the file name of the source file (test.cfm)
053         */
054        public abstract String getFileName();
055    
056        /**
057         * if the pageSource is based on a archive, Railo returns the ra:// path
058         * @return return the Resource matching this PageSource
059         */
060        public abstract Resource getResource();
061        
062    
063        /**
064         * if the pageSource is based on a archive, translate the source to a zip:// Resource
065         * @return return the Resource matching this PageSource
066         * @param pc the Page Context Object
067         */
068        public abstract Resource getResourceTranslated(PageContext pc) throws PageException;
069    
070        /**
071         * @return returns the a classname matching to filename (Example: /railo/web/test_cfm)
072         */
073        public abstract String getJavaName();
074    
075        /**
076         * @return returns the a package matching to file (Example: railo.web)
077         */
078        public abstract String getComponentName();
079    
080        /**
081         * @return returns mapping where PageSource based on
082         */
083        public abstract Mapping getMapping();
084    
085        /**
086         * @return returns if page source exists or not
087         */
088        public abstract boolean exists();
089    
090        /**
091         * @return returns if the physical part of the source file exists
092         */
093        public abstract boolean physcalExists();
094    
095        /**
096         * @return return the sozrce of the file as String array
097         * @throws IOException
098         */
099        public abstract String[] getSource() throws IOException;
100    
101        /**
102         * get an new Pagesoure from ralpath
103         * @param realPath
104         * @return new Pagesource
105         */
106        public abstract PageSource getRealPage(String realPath);
107    
108        /**
109         * sets time last accessed page
110         * @param lastAccess time ast accessed
111         */
112        public abstract void setLastAccessTime(long lastAccess);
113    
114        /**
115         * 
116         * @return returns time last accessed page
117         */
118        public abstract long getLastAccessTime();
119    
120        /**
121         * set time last accessed (now)
122         */
123        public abstract void setLastAccessTime();
124    
125        /**
126         * @return returns how many this page is accessed since server is in use.
127         */
128        public abstract int getAccessCount();
129    
130    }