1 16 package scriptella.driver.velocity; 17 18 import org.apache.velocity.runtime.RuntimeServices; 19 import org.apache.velocity.runtime.log.LogSystem; 20 import scriptella.spi.AbstractScriptellaDriver; 21 import scriptella.spi.Connection; 22 import scriptella.spi.ConnectionParameters; 23 import scriptella.spi.DialectIdentifier; 24 25 import java.util.logging.Level ; 26 import java.util.logging.Logger ; 27 28 34 public class Driver extends AbstractScriptellaDriver { 35 static final DialectIdentifier DIALECT = new DialectIdentifier("Velocity", "1.4"); 36 private static final Logger LOG = Logger.getLogger(Driver.class.getName()); 37 static final LogSystem LOG_SYSTEM = new LogSystem() { 38 public void init(RuntimeServices rs) { 39 } 40 41 public void logVelocityMessage(int level, String message) { 42 if (level < 0) { 43 return; 44 } 45 Level lev; switch (level) { 47 case DEBUG_ID: 48 lev = Level.FINE; 49 break; 50 case INFO_ID: lev = Level.CONFIG; 52 break; 53 case WARN_ID: 54 lev = Level.INFO; 55 break; 56 case ERROR_ID: 57 lev = Level.WARNING; 58 break; 59 default: 60 lev = Level.INFO; 61 } 62 if (LOG.isLoggable(lev)) { 63 LOG.log(lev, "Engine: " + message); 64 } 65 } 66 }; 67 68 74 public Connection connect(ConnectionParameters connectionParameters) { 75 return new VelocityConnection(connectionParameters); 76 } 77 78 79 } 80 | Popular Tags |