Exemplo n.º 1
0
            /// <summary>
            /// Translates the given properties object.
            /// </summary>
            /// <param name="properties">The properties.</param>
            private static void TranslateProperties(HsqlProperties properties)
            {
                string user     = properties.getProperty("user");
                string password = properties.getProperty("password");
                int    port     = properties.getIntegerProperty("port", 0);

                if (user == null)
                {
                    user = "******";
                }
                else
                {
                    user = user.ToUpperInvariant();
                }

                if (password == null)
                {
                    password = "";
                }
                else
                {
                    password = password.ToUpperInvariant();
                }

                properties.setProperty("user", user);
                properties.setProperty("password", password);
                properties.setProperty("port", port);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Gets an HSQL 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 HSQL protocol client session</returns>
            internal static HsqlSession NewHsqlClientSession(
                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
                {
                    //Console.WriteLine(
                    //    "GetHsqlClientSession : host {0}, port {1}, database {2}, tls {3}",
                    //    host,
                    //    port,
                    //    database,
                    //    tls);

                    ISession session = new HsqlTcpClient(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

                    return(new HsqlSession(session));
                }
                catch (org.hsqldb.HsqlException e)
                {
                    throw new HsqlDataSourceException(e);
                }
            }
Exemplo n.º 3
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>
            /// Translates the given properties object.
            /// </summary>
            /// <param name="properties">The properties.</param>
            private static void TranslateProperties(HsqlProperties properties)
            {
                string user = properties.getProperty("user");
                string password = properties.getProperty("password");
                int port = properties.getIntegerProperty("port", 0);

                if (user == null)
                {
                    user = "******";
                }
                else
                {
                    user = user.ToUpperInvariant();
                }

                if (password == null)
                {
                    password = "";
                }
                else
                {
                    password = password.ToUpperInvariant();
                }

                properties.setProperty("user", user);
                properties.setProperty("password", password);
                properties.setProperty("port", port);
            }
            /// <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 HSQL 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 HSQL protocol client session</returns>
            internal static HsqlSession NewHsqlClientSession(
                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
                {

                    //Console.WriteLine(
                    //    "GetHsqlClientSession : host {0}, port {1}, database {2}, tls {3}",
                    //    host,
                    //    port,
                    //    database,
                    //    tls);

                    ISession session = new HsqlTcpClient(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

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