001    package railo.commons.io.res.type.datasource.core;
002    
003    import java.io.IOException;
004    import java.io.InputStream;
005    import java.sql.SQLException;
006    import java.util.List;
007    
008    import railo.commons.io.res.type.datasource.Attr;
009    import railo.runtime.db.DatasourceConnection;
010    
011    public interface Core {
012    
013            /**
014             * @return return true if this core support concatination of existing data with new data (getOutputStream(append:true))
015             */
016            public boolean concatSupported();
017            
018            /**
019             * return a single Attr, if Attr does not exist it returns null
020             * @param dc
021             * @param path
022             * @param name
023             * @param name2 
024             * @return
025             * @throws SQLException
026             */
027            public abstract Attr getAttr(DatasourceConnection dc, String prefix,
028                            int fullPathHash, String path, String name) throws SQLException;
029    
030            /**
031             * return all child Attrs of a given path
032             * @param dc
033             * @param prefix
034             * @param path
035             * @return
036             * @throws SQLException
037             */
038            public abstract List getAttrs(DatasourceConnection dc, String prefix,
039                            int pathHash, String path) throws SQLException;
040    
041            /**
042             * create a new entry (file or directory)
043             * @param dc
044             * @param prefix
045             * @param path
046             * @param name
047             * @param type
048             * @throws SQLException
049             */
050            public abstract void create(DatasourceConnection dc, String prefix,
051                            int fullPatHash, int pathHash, String path, String name, int type)
052                            throws SQLException;
053    
054            /**
055             * deletes a entry (file or directory)
056             * @param dc
057             * @param prefix
058             * @param attr
059             * @return
060             * @throws SQLException
061             */
062            public abstract boolean delete(DatasourceConnection dc, String prefix,
063                            Attr attr) throws SQLException;
064    
065            /**
066             * returns a inputStram to a entry data
067             * @param dc
068             * @param prefix
069             * @param attr
070             * @return
071             * @throws SQLException
072             * @throws IOException
073             */
074            public abstract InputStream getInputStream(DatasourceConnection dc,
075                            String prefix, Attr attr) throws SQLException, IOException;
076    
077            public abstract void write(DatasourceConnection dc, String prefix,
078                            Attr attr, InputStream is, boolean append) throws SQLException;
079    
080            public abstract void setLastModified(DatasourceConnection dc,
081                            String prefix, Attr attr, long time) throws SQLException;
082    
083            public abstract void setMode(DatasourceConnection dc, String prefix,
084                            Attr attr, int mode) throws SQLException;
085    
086            public abstract void setAttributes(DatasourceConnection dc, String prefix,
087                            Attr attr, int attributes) throws SQLException;
088    
089    }