예제 #1
0
            /// <summary>
            /// Gets an HTTP protocol client session using the given properties.
            /// </summary>
            /// <param name="properties">The properties.</param>
            /// <param name="tls">
            /// If set to <c>true</c>, the session uses transport layer security.
            /// </param>
            /// <returns>an HTTP protocol client session</returns>
            internal static HsqlSession NewHttpClientSession(
                HsqlProperties properties,
                bool tls)
            {
                if (properties == null)
                {
                    throw new ArgumentNullException("properties");
                }

                TranslateProperties(properties);

                string user     = properties.getProperty("user");
                string password = properties.getProperty("password");
                string host     = properties.getProperty("host");
                int    port     = properties.getIntegerProperty("port", 0);
                string path     = properties.getProperty("path");
                string database = properties.getProperty("database");

                try
                {
                    ISession session = new org.hsqldb.HTTPClientConnection(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

                    return(new HsqlSession(session));
                }
                catch (org.hsqldb.HsqlException e)
                {
                    throw new HsqlDataSourceException(e);
                }
            }
            /// <summary>
            /// Gets an HTTP protocol client session using the given properties.
            /// </summary>
            /// <param name="properties">The properties.</param>
            /// <param name="tls">
            /// If set to <c>true</c>, the session uses transport layer security.
            /// </param>
            /// <returns>an HTTP protocol client session</returns>
            internal static HsqlSession NewHttpClientSession(
                HsqlProperties properties,
                bool tls)
            {
                if (properties == null)
                {
                    throw new ArgumentNullException("properties");
                }

                TranslateProperties(properties);

                string user = properties.getProperty("user");
                string password = properties.getProperty("password");
                string host = properties.getProperty("host");
                int port = properties.getIntegerProperty("port", 0);
                string path = properties.getProperty("path");
                string database = properties.getProperty("database");

                try
                {
                    ISession session = new org.hsqldb.HTTPClientConnection(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

                    return new HsqlSession(session);
                }
                catch (org.hsqldb.HsqlException e)
                {
                    throw new HsqlDataSourceException(e);
                }
            }