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.commons.io.res.type.datasource.core; 020 021import java.sql.PreparedStatement; 022import java.sql.SQLException; 023import java.util.Calendar; 024 025import lucee.commons.date.JREDateTimeUtil; 026import lucee.commons.io.res.type.datasource.Attr; 027import lucee.runtime.db.DatasourceConnection; 028import lucee.runtime.db.SQLImpl; 029import lucee.runtime.engine.ThreadLocalPageContext; 030 031public abstract class CoreSupport implements Core { 032 public static final Attr ATTR_ROOT = new Attr(0,null,null,true,Attr.TYPE_DIRECTORY,0,0,(short)0777,(short)0,0); 033 034 035 public static boolean isDirectory(int type) { 036 return type==Attr.TYPE_DIRECTORY; 037 } 038 039 public static boolean isFile(int type) { 040 return type==Attr.TYPE_FILE; 041 } 042 043 public static boolean isLink(int type) { 044 return type==Attr.TYPE_LINK; 045 } 046 047 public static Calendar getCalendar() { 048 return JREDateTimeUtil.getThreadCalendar(ThreadLocalPageContext.getTimeZone()); 049 } 050 051 public static void log(String s1) { 052 //aprint.out(s1); 053 } 054 public static void log(String s1, String s2) { 055 //aprint.out(s1+";"+s2); 056 } 057 public static void log(String s1, String s2, String s3) { 058 //aprint.out(s1+";"+s2+";"+s3); 059 } 060 public static void log(String s1, String s2, String s3, String s4) { 061 //aprint.out(s1+";"+s2+";"+s3+";"+s4); 062 } 063 064 PreparedStatement prepareStatement(DatasourceConnection dc,String sql) throws SQLException { 065 return dc.getPreparedStatement(new SQLImpl(sql), false, true); 066 } 067 068}