Examples of TorqueException


Examples of org.apache.torque.TorqueException

        log.debug("Starting initJNDI");

        Configuration c = configuration.subset("jndi");
        if (c == null || c.isEmpty())
        {
            throw new TorqueException(
                "JndiDataSourceFactory requires a jndi "
                    + "path property to lookup the DataSource in JNDI.");
        }

        try
        {
            Hashtable env = new Hashtable();
            for (Iterator i = c.getKeys(); i.hasNext(); )
            {
                String key = (String) i.next();
                if (key.equals("path"))
                {
                    path = c.getString(key);
                    if (log.isDebugEnabled())
                    {
                        log.debug("JNDI path: " + path);
                    }
                }
                else if (key.equals("ttl"))
                {
                    ttl = c.getLong(key, ttl);
                    if (log.isDebugEnabled())
                    {
                        log.debug("Time between context lookups: " + ttl);
                    }
                }
                else
                {
                    String value = c.getString(key);
                    env.put(key, value);
                    if (log.isDebugEnabled())
                    {
                        log.debug("Set jndi property: " + key + "=" + value);
                    }
                }
            }

            ctx = new InitialContext(env);
            log.debug("Created new InitialContext");
            debugCtx(ctx);
        }
        catch (Exception e)
        {
            log.error("", e);
            throw new TorqueException(e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.