package org.apache.tinkerpop.gremlin.orientdb.structure;

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.exception.ODatabaseException;


public final class OrientGraphFactory {
    public OrientGraph open(String url, String user, String password) {
        return new OrientGraph(getDatabase(url, user, password));
    }

    protected ODatabaseDocumentTx getDatabase(String url, String user, String password) {
        final ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
        db.open(user, password);

        return db;
    }
}

@@ -253,308 +253,1451 @@
 lic 
-OrientGraph open(String url, String user, String password) %7B%0A        return new OrientGraph(getDatabase(url, user, password));%0A    %7D%0A%0A    protected ODatabaseDocumentTx getDatabase(String url, String user, String password) %7B%0A        final ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);%0A       
+static String ADMIN = %22admin%22;%0A    protected final String url;%0A    protected final String user;%0A    protected final String password;%0A%0A    public OrientGraphFactory(String url) %7B%0A        this.url = url;%0A        this.user = ADMIN;%0A        this.password = ADMIN;%0A    %7D%0A%0A    public OrientGraphFactory(String url, String user, String password) %7B%0A        this.url = url;%0A        this.user = user;%0A        this.password = password;%0A    %7D%0A%0A    public OrientGraph getTx() %7B%0A        return new OrientGraph(getDatabase(true, true));%0A    %7D%0A%0A    /**%0A     * @param create%0A     *          if true automatically creates database if database with given URL does not exist%0A     * @param open%0A     *          if true automatically opens the database%0A     */%0A    public OrientGraph getTx(boolean create, boolean open) %7B%0A        return new OrientGraph(getDatabase(create, open));%0A    %7D%0A%0A    /**%0A     * @param create%0A     *          if true automatically creates database if database with given URL does not exist%0A     * @param open%0A     *          if true automatically opens the database%0A     */%0A    protected ODatabaseDocumentTx getDatabase(boolean create, boolean open) %7B%0A        final ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);%0A        if (!db.getURL().startsWith(%22remote:%22) && !db.exists()) %7B%0A            if (create) db.create();%0A            else if (open) throw new ODatabaseException(%22Database '%22 + url + %22' not found%22);%0A        %7D else if (open)
  db.

support memory driver