@@ -131,66 +131,24 @@ public static ArangoDBGraphException getNamingConventionError(String cause, Stri
131131 private final ArangoDBGraph graph ;
132132
133133 /**
134- * Create a simple graph client and connect to the provided db. If the DB does not exist, the driver will try to
135- * create one.
134+ * Create a simple graph client and connect to the provided db.
136135 *
137136 * @param graph the ArangoDB graph that uses this client
138137 * @param properties the ArangoDB configuration properties
139138 * @param dbname the ArangoDB name to connect to or create
140139 * @throws ArangoDBGraphException If the db does not exist and cannot be created
141140 */
142-
143- public ArangoDBGraphClient (ArangoDBGraph graph , Properties properties , String dbname ) {
144- this (graph , properties , dbname , false );
145- }
146-
147- /**
148- * Create a simple graph client and connect to the provided db. The create flag controls what is the
149- * behaviour if the db is not found
150- *
151- * @param graph the ArangoDB graph that uses this client
152- * @param properties the ArangoDB configuration properties
153- * @param dbname the ArangoDB name to connect to or create
154- * @param createDatabase if true, the driver will attempt to crate the DB if it does not exist
155- * @throws ArangoDBGraphException If the db does not exist and cannot be created
156- */
157-
158141 public ArangoDBGraphClient (
159142 ArangoDBGraph graph ,
160143 Properties properties ,
161- String dbname ,
162- boolean createDatabase )
144+ String dbname )
163145 throws ArangoDBGraphException {
164146 logger .debug ("Initiating the ArangoDb Client" );
165147 this .graph = graph ;
166148 db = new ArangoDB .Builder ()
167149 .loadProperties (ArangoConfigProperties .fromProperties (properties ))
168150 .build ()
169151 .db (dbname );
170- if (createDatabase ) {
171- if (!db .exists ()) {
172- logger .debug ("DB not found, attemtping to create it." );
173- try {
174- if (!db .create ()) {
175- throw new ArangoDBGraphException ("Unable to crate the database " + dbname );
176- }
177- } catch (ArangoDBException ex ) {
178- throw ArangoDBExceptions .getArangoDBException (ex );
179- }
180- }
181- } else {
182- boolean exists = false ;
183- try {
184- exists = db .exists ();
185- } catch (ArangoDBException ex ) {
186- // Pass
187- }
188- if (!exists ) {
189- logger .error ("Database does not exist, or the user has no access" );
190- throw new ArangoDBGraphException (String .format ("DB not found or user has no access: %s@%s" ,
191- properties .getProperty ("arangodb.user" ), dbname ));
192- }
193- }
194152 }
195153
196154 /**
0 commit comments