本文整理汇总了Java中com.orientechnologies.orient.core.intent.OIntentMassiveInsert类的典型用法代码示例。如果您正苦于以下问题:Java OIntentMassiveInsert类的具体用法?Java OIntentMassiveInsert怎么用?Java OIntentMassiveInsert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OIntentMassiveInsert类属于com.orientechnologies.orient.core.intent包,在下文中一共展示了OIntentMassiveInsert类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
public OrientConnection connect() throws Exception {
final OrientGraphFactory graphFactory = new OrientGraphFactory(url.toString(), userName, password);
final ODatabaseDocumentTx database = graphFactory.getDatabase(false, false);
if (database.exists()) {
database.open(userName, password);
database.drop();
}
graphFactory.setAutoStartTx(false);
graphFactory.declareIntent(new OIntentMassiveInsert().setEnableCache(false));
return new AbstractOrientConnection(graphFactory.getNoTx()) {
@Override
public void close() throws Exception {
graph.commit();
graph.getRawGraph().close();
}
};
}
示例2: begin
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public void begin() {
ODatabaseDocumentTx documentDatabase = init();
if (documentDatabase == null) {
switch (dbType) {
case DOCUMENT:
documentDatabase = new ODatabaseDocumentTx(dbURL);
documentDatabase.open(dbUser, dbPassword);
break;
case GRAPH:
final OrientGraphFactory factory = new OrientGraphFactory(dbURL, dbUser, dbPassword);
final OrientBaseGraph graphDatabase = tx ? factory.getTx() : factory.getNoTx();
graphDatabase.setUseLightweightEdges(useLightweightEdges);
graphDatabase.setStandardElementConstraints(standardElementConstraints);
documentDatabase = graphDatabase.getRawGraph();
pipeline.setGraphDatabase(graphDatabase);
break;
}
pipeline.setDocumentDatabase(documentDatabase);
}
documentDatabase.declareIntent(new OIntentMassiveInsert());
}
示例3: run
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public void run() {
db = new ODatabaseDocumentTx(url);
db.open("admin", "admin");
db.declareIntent(new OIntentMassiveInsert());
db.begin();
for (int i = 0; i < cycle; i++) {
ODocument doc = new ODocument("City");
doc.field("name", "Rome");
db.save(doc);
if (i % commitBuf == 0) {
db.commit();
db.begin();
}
}
db.close();
}
示例4: loadDB
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
private void loadDB(ODatabaseDocumentTx db, int documents) throws IOException
{
db.declareIntent(new OIntentMassiveInsert());
for (int i = 1; i <= documents; i++)
{
ODocument doc = new ODocument();
doc.setClassName("Item");
doc = createItem(i, doc);
db.save(doc, "Item");
}
db.declareIntent(null);
}
示例5: openNoTxForMassiveInsert
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
protected void openNoTxForMassiveInsert()
{
OGlobalConfiguration.USE_WAL.setValue(false);
OGlobalConfiguration.WAL_SYNC_ON_PAGE_FLUSH.setValue(false);
noTx = new OrientGraphNoTx(
"plocal:" + System.getProperty("ORIENTDB_HOME") + "/databases/" + dbName);
noTx.declareIntent(new OIntentMassiveInsert());
}
示例6: create
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public ODatabaseDocumentTx create() throws Exception {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbURL);
if (exists(db)) {
db.open("admin", "admin");
}
db.declareIntent(currentMode == Mode.NO_TX_MODE ? new OIntentMassiveInsert() : new OIntentMassiveRead());
allConns.add(db);
return db;
}
示例7: init
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
@Test(enabled = false)
public void init() throws Exception {
String buildDirectory = System.getProperty("buildDirectory", ".");
if (buildDirectory == null)
buildDirectory = ".";
String uri = "plocal:" + buildDirectory + "/databases/city";
databaseDocumentTx = new ODatabaseDocumentTx(uri);
if (databaseDocumentTx.exists()) {
databaseDocumentTx.open("admin", "admin");
databaseDocumentTx.drop();
}
databaseDocumentTx.create();
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
if (schema.getClass("City") == null) {
OClass oClass = schema.createClass("City");
oClass.createProperty("latitude", OType.DOUBLE);
oClass.createProperty("longitude", OType.DOUBLE);
oClass.createProperty("name", OType.STRING);
oClass.createIndex("City.name", "FULLTEXT", null, null, "LUCENE", new String[] { "name" });
oClass.createIndex("City.lat_lng", "SPATIAL", null, null, "LUCENE", new String[] { "latitude", "longitude" });
}
ZipFile zipFile = new ZipFile("files/allCountries.zip");
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.getName().equals("allCountries.txt")) {
InputStream stream = zipFile.getInputStream(entry);
lineReader = new LineNumberReader(new InputStreamReader(stream));
}
}
databaseDocumentTx.declareIntent(new OIntentMassiveInsert());
}
示例8: init
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public void init() {
log.debug("Init loader");
documentDatabase = new ODatabaseDocumentTx(dbUrl, false);
String databaseName = documentDatabase.getName();
if (documentDatabase.exists() && dbAutoDropIfExists) {
log.debug("Dropping existent database '{}'", databaseName);
documentDatabase.open(dbUser, dbPassword).drop();
}
if (documentDatabase.exists()) {
log.debug("Open database '{}'", databaseName);
documentDatabase.open(dbUser, dbPassword);
if ((className != null) && autoDropClass) {
OSchema schema = documentDatabase.getMetadata().getSchema();
if (schema.existsClass(className)) {
log.debug("Dropping class '{}'", className);
documentDatabase.command(new OCommandSQL("DELETE FROM " + className)).execute();
schema.dropClass(className);
}
}
} else {
long time = System.currentTimeMillis();
log.debug("Create database '{}'", databaseName);
documentDatabase.create();
time = System.currentTimeMillis() - time;
log.debug("Created database '{}' in {} ms", databaseName, time);
}
documentDatabase.declareIntent(new OIntentMassiveInsert());
}
示例9: setMassInsertIntent
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public void setMassInsertIntent() {
factory.declareIntent(new OIntentMassiveInsert());
}
示例10: enableMassInsert
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
@Override
public void enableMassInsert() {
OrientBaseGraph tx = unwrapCurrentGraph();
tx.getRawGraph().getTransaction().setUsingLog(false);
tx.declareIntent(new OIntentMassiveInsert().setDisableHooks(true).setDisableValidation(true));
}
示例11: init
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; //导入依赖的package包/类
/**
* Initialize any state for this DB. Called once per DB instance; there is one DB instance per client thread.
*/
public void init() throws DBException {
// initialize OrientDB driver
Properties props = getProperties();
String url = props.getProperty("orientdb.url", "local:C:/temp/databases/ycsb");
String user = props.getProperty("orientdb.user", "admin");
String password = props.getProperty("orientdb.password", "admin");
Boolean newdb = Boolean.parseBoolean(props.getProperty("orientdb.newdb", "false"));
try {
System.out.println("OrientDB loading database url = " + url);
OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue(false);
db = new ODatabaseDocumentTx(url);
if (db.exists()) {
db.open(user, password);
if (newdb) {
System.out.println("OrientDB drop and recreate fresh db");
db.drop();
db.create();
}
} else {
System.out.println("OrientDB database not found, create fresh db");
db.create();
}
System.out.println("OrientDB connection created with " + url);
dictionary = db.getMetadata().getIndexManager().getDictionary();
if (!db.getMetadata().getSchema().existsClass(CLASS))
db.getMetadata().getSchema().createClass(CLASS);
db.declareIntent(new OIntentMassiveInsert());
} catch (Exception e1) {
System.err.println("Could not initialize OrientDB connection pool for Loader: " + e1.toString());
e1.printStackTrace();
return;
}
}