001 package railo.commons.io.res.type.datasource.core; 002 003 import java.sql.PreparedStatement; 004 import java.sql.SQLException; 005 import java.util.Calendar; 006 007 import railo.commons.date.JREDateTimeUtil; 008 import railo.commons.io.res.type.datasource.Attr; 009 import railo.runtime.db.DatasourceConnection; 010 import railo.runtime.db.SQLImpl; 011 import railo.runtime.engine.ThreadLocalPageContext; 012 013 public abstract class CoreSupport implements Core { 014 public static final Attr ATTR_ROOT = new Attr(0,null,null,true,Attr.TYPE_DIRECTORY,0,0,(short)0777,(short)0,0); 015 016 017 public static boolean isDirectory(int type) { 018 return type==Attr.TYPE_DIRECTORY; 019 } 020 021 public static boolean isFile(int type) { 022 return type==Attr.TYPE_FILE; 023 } 024 025 public static boolean isLink(int type) { 026 return type==Attr.TYPE_LINK; 027 } 028 029 public static Calendar getCalendar() { 030 return JREDateTimeUtil.newInstance(ThreadLocalPageContext.getTimeZone()); 031 } 032 033 public static void log(String s1) { 034 //aprint.out(s1); 035 } 036 public static void log(String s1, String s2) { 037 //aprint.out(s1+";"+s2); 038 } 039 public static void log(String s1, String s2, String s3) { 040 //aprint.out(s1+";"+s2+";"+s3); 041 } 042 public static void log(String s1, String s2, String s3, String s4) { 043 //aprint.out(s1+";"+s2+";"+s3+";"+s4); 044 } 045 046 PreparedStatement prepareStatement(DatasourceConnection dc,String sql) throws SQLException { 047 return dc.getPreparedStatement(new SQLImpl(sql), false, true); 048 } 049 050 }