X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.application%2Fsrc%2Forg%2Fsimantics%2Fapplication%2Fdb%2FDatabaseUtils.java;h=35a2077afdc92e18495e52bd85ece9afb7b337f4;hp=b65ff0c1286eae275bdb0e76c1ae8d82a918ffbd;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.application/src/org/simantics/application/db/DatabaseUtils.java b/bundles/org.simantics.application/src/org/simantics/application/db/DatabaseUtils.java index b65ff0c12..35a2077af 100644 --- a/bundles/org.simantics.application/src/org/simantics/application/db/DatabaseUtils.java +++ b/bundles/org.simantics.application/src/org/simantics/application/db/DatabaseUtils.java @@ -1,49 +1,49 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.application.db; - -import java.util.Properties; - -import org.simantics.db.Driver; -import org.simantics.db.Manager; -import org.simantics.db.Session; -import org.simantics.db.services.GlobalServiceInitializer; - -public final class DatabaseUtils { - -// public static Session connect(String host, int port) throws Exception { -// return connect(new ServerAddress(host, port)); -// } -// -// public static Session connect(String host, int port, String dbid) throws Exception { -// return connect(new ServerAddress(host, port, dbid)); -// } - - public static Session connect(String addr) throws Exception { - // Try to load and register the Driver instance with the driver manager - Class.forName("org.simantics.db.procore.ProCoreDriver"); - Driver driver = Manager.getDriver("procore"); - - // Connect to the server at the specified host and credentials. - // Note that we normally user authentication agent for user identification. - Properties props = new Properties(); - props.setProperty("user", "Default User"); - props.setProperty("password", ""); - - Session session = driver.getSession(addr, props); - - new GlobalServiceInitializer().initialize(session); - - return session; - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.application.db; + +import java.util.Properties; + +import org.simantics.db.Driver; +import org.simantics.db.Manager; +import org.simantics.db.Session; +import org.simantics.db.services.GlobalServiceInitializer; + +public final class DatabaseUtils { + +// public static Session connect(String host, int port) throws Exception { +// return connect(new ServerAddress(host, port)); +// } +// +// public static Session connect(String host, int port, String dbid) throws Exception { +// return connect(new ServerAddress(host, port, dbid)); +// } + + public static Session connect(String addr) throws Exception { + // Try to load and register the Driver instance with the driver manager + Class.forName("org.simantics.db.procore.ProCoreDriver"); + Driver driver = Manager.getDriver("procore"); + + // Connect to the server at the specified host and credentials. + // Note that we normally user authentication agent for user identification. + Properties props = new Properties(); + props.setProperty("user", "Default User"); + props.setProperty("password", ""); + + Session session = driver.getSession(addr, props); + + new GlobalServiceInitializer().initialize(session); + + return session; + } + +}