Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.IRubyObject.toJava()


        final String jdbcURL = buildURL(context, url);
        final ConnectionFactory factory;

        if ( driver_instance != null && ! driver_instance.isNil() ) {
            final Object driverInstance = driver_instance.toJava(Object.class);
            if ( driverInstance instanceof DriverWrapper ) {
                setConnectionFactory(factory = new DriverConnectionFactoryImpl(
                    (DriverWrapper) driverInstance, jdbcURL,
                    ( username.isNil() ? null : username.toString() ),
                    ( password.isNil() ? null : password.toString() )
View Full Code Here


    }

    private Properties resolveDriverProperties(final ThreadContext context) {
        IRubyObject properties = getConfigValue(context, "properties");
        if ( properties == null || properties.isNil() ) return null;
        Map<?, ?> propertiesJava = (Map) properties.toJava(Map.class);
        if ( propertiesJava instanceof Properties ) {
            return (Properties) propertiesJava;
        }
        final Properties props = new Properties();
        for ( Map.Entry entry : propertiesJava.entrySet() ) {
View Full Code Here

            value = getConfigValue(context, "jndi");
            final String name = value.toString();
            dataSource = (DataSource) lookup(context, name);
        }
        else {
            dataSource = (DataSource) value.toJava(DataSource.class);
        }
        return dataSource;
    }

    private static InitialContext initialContext;
View Full Code Here

            // NOTE: only for (backwards) compatibility (to be deleted) :
            IRubyObject connection_factory = getInstanceVariable("@connection_factory");
            if ( connection_factory == null ) {
                throw getRuntime().newRuntimeError("@connection_factory not set");
            }
            connectionFactory = (ConnectionFactory) connection_factory.toJava(ConnectionFactory.class);
        }
        return connectionFactory;
    }

    public void setConnectionFactory(ConnectionFactory connectionFactory) {
View Full Code Here

        IRubyObject options = args[3];

        String encString = encoding.isNil() ? null : rubyStringToString(encoding);

        SaveContextVisitor visitor =
            new SaveContextVisitor((Integer) options.toJava(Integer.class), rubyStringToString(indentString), encString, isHtmlDoc(context), isFragment(), 0);
        accept(context, visitor);

        IRubyObject rubyString = null;
        if (NokogiriHelpers.isUTF8(encString)) {
            rubyString = stringOrNil(context.getRuntime(), visitor.toString());
View Full Code Here

        ThreadContext context = (ThreadContext) XsltStylesheet.getRegistry().get("context");
        IRubyObject receiver = (IRubyObject)XsltStylesheet.getRegistry().get("receiver");
        if (context == null || receiver == null) return null;
        IRubyObject arg0 = JavaUtil.convertJavaToUsableRubyObject(context.getRuntime(), arg);
        IRubyObject result = RuntimeHelpers.invoke(context, receiver, method, arg0);
        return result.toJava(Object.class);
    }
}
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.