Pregunta

Derby tiene una serie de opciones de configuración que son controlados por las propiedades del sistema. Es muy doloroso para organizar el sistema de valores de propiedades en una aplicación web. Alguien ha llegado a una solución?

Además, no he sido capaz de hacer que funcionen en una aplicación web.

Aquí está el código de un oyente contexto de servlet. derby.log todavía se crea en la caquexia crónica del contenedor, en lugar de realizar llamadas a mi procedimiento de registro.

/**
 * Listener to try to get Derby to behave better.
 */
public class ContextListener implements ServletContextListener {

    private static final String TEMP_DIR_ATTRIBUTE = "javax.servlet.context.tempdir";
    private static ServletContext context;
    private static Writer logWriter;

    private class LogWriter extends Writer {

        @Override
        public void close() throws IOException {
        }

        @Override
        public void flush() throws IOException {
        }

        @Override
        public void write(char[] cbuf, int off, int len) throws IOException {
            context.log(new String(cbuf, off, len));
        }

    }

    /** {@inheritDoc}*/
    public void contextDestroyed(ServletContextEvent sce) {
    }

    public static Writer getLogSteam() {
        return logWriter;
    }

    /** {@inheritDoc}*/
    public void contextInitialized(ServletContextEvent sce) {
        logWriter = new LogWriter();
        File tempDirFile = (File)sce.getServletContext().getAttribute(TEMP_DIR_ATTRIBUTE);
        context = sce.getServletContext();
        System.setProperty("derby.system.home", tempDirFile.getAbsolutePath());
        System.setProperty("derby.stream.error.method", "com.basistech.vws.ContextListener.getLogStream");
    }

}
¿Fue útil?

Solución

Hay varias maneras de establecer las propiedades de Derby. He aquí algunos documentos: http://db.apache.org/derby/ docs / 10,5 / DevGuide / cdevsetprop24222.html usted no dice qué parte de este se encuentra a ser doloroso, sin embargo, por lo que es difícil saber qué tipo de solución que está buscando.

¿Qué son las propiedades que tratar de establecer, y qué aspecto de la que fueron está resultando doloroso?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top