Examples of ODatabaseRecordTx


Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

   * Prepares the command API to execute an arbitrary SQL statement
   * @param theQuery
   * @return
   */
  public static OCommandRequest genericSQLStatementCommandBuilder (String theQuery){
    ODatabaseRecordTx db =  DbHelper.getConnection();
    OCommandRequest command = db.command(new OCommandSQL(theQuery));
    return command;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

   * Returns an edge (link), belonging to the class @LinkDao.MODEL_NAME, by its id (not RID)
   * @param id
   * @return
   */
  public static ORID getRidLinkByUUID(String id){
    ODatabaseRecordTx db =DbHelper.getConnection();
    OIndex<?> index = db.getMetadata().getIndexManager().getIndex(LinkDao.MODEL_NAME + ".id");
    ORID rid = (ORID) index.get(id)
    return rid;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    Object ret = genericSQLCommandExecute(command,params);
    return ret;
  }
 
  public static void shutdownDB(boolean repopulate){
    ODatabaseRecordTx db = null;

    try{
      //WE GET THE CONNECTION BEFORE SETTING THE SEMAPHORE
      db = getConnection();

      synchronized(DbHelper.class)  {
        if(!dbFreeze.get()){
          dbFreeze.set(true);
        }
        db.drop();
        db.close();
        db.create();
        db.getLevel1Cache().clear();
        db.getLevel2Cache().clear();
        db.reload();
        db.getMetadata().reload();
        if(repopulate){
          HooksManager.registerAll(db);
          setupDb();
        }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    if (Logger.isTraceEnabled()) Logger.trace("Method End");
    return created();
  }

  public static Result getDBStatistics(){
    ODatabaseRecordTx db = DbHelper.getConnection();
    ImmutableMap response;
    try {
      String bbId = Internal.INSTALLATION_ID.getValueAsString();
      if (bbId==null) bbId="00-00-00"; //--<<--- this prevents an OrientDB bug retrieving keys
      response = ImmutableMap.<String,Object>builder().
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    }

  }

  public static ODatabaseRecordTx getOrOpenConnection(String appcode, String username,String password) throws InvalidAppCodeException {
    ODatabaseRecordTx db= getConnection();
    if (db==null || db.isClosed()) db = open ( appcode,  username, password) ;
    return db;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    if (db==null || db.isClosed()) db = open ( appcode,  username, password) ;
    return db;
  }

  public static ODatabaseRecordTx getOrOpenConnectionWIthHTTPUsername() throws InvalidAppCodeException {
    ODatabaseRecordTx db= getConnection();
    if (db==null || db.isClosed()) db = open
        (String) Http.Context.current().args.get("appcode")
        getCurrentHTTPUsername(),
        getCurrentHTTPPassword()) ;
    return db;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

      }
    }else if (Logger.isDebugEnabled()) Logger.debug("connection already close or null");
  }

  public static ODatabaseRecordTx getConnection(){
    ODatabaseRecordTx db = null;
    try {
      db=(ODatabaseRecordTx)ODatabaseRecordThreadLocal.INSTANCE.get();
      if (Logger.isDebugEnabled()) Logger.debug("Connection id: " + db + " " + ((Object) db).hashCode());
    }catch (ODatabaseException e){
      Logger.debug("Cound not retrieve the DB connection within this thread: " + e.getMessage());
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

  }

 
  public static void updateDefaultUsers() throws Exception{
    if (Logger.isTraceEnabled()) Logger.trace("Method Start");
    ODatabaseRecordTx db = DbHelper.getConnection();
    OUser user=db.getMetadata().getSecurity().getUser(BBConfiguration.getBaasBoxUsername());
    user.setPassword(BBConfiguration.getBaasBoxPassword());
    user.save();

    user=db.getMetadata().getSecurity().getUser(BBConfiguration.getBaasBoxAdminUsername());
    user.setPassword(BBConfiguration.getBaasBoxAdminPassword());
    user.save();

    if (Logger.isTraceEnabled()) Logger.trace("Method End");
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    if (Logger.isTraceEnabled()) Logger.trace("Method End");
  }


  public static void populateDB() throws IOException{
    ODatabaseRecordTx db = getConnection();
    //DO NOT DELETE THE FOLLOWING LINE!
    OrientGraphNoTx dbg =  new OrientGraphNoTx(getODatabaseDocumentTxConnection());
    Logger.info("Populating the db...");
    InputStream is;
    if (Play.application().isProd()) is  =Play.application().resourceAsStream(SCRIPT_FILE_NAME);
    else is = new FileInputStream(Play.application().getFile("conf/"+SCRIPT_FILE_NAME));
    List<String> script=IOUtils.readLines(is, "UTF-8");
    is.close();

    for (String line:script){
      if (Logger.isDebugEnabled()) Logger.debug(line);
      if (!line.startsWith("--") && !line.trim().isEmpty()){ //skip comments
        db.command(new OCommandSQL(line.replace(';', ' '))).execute();
      }
    }
    Internal.DB_VERSION._setValue(BBConfiguration.configuration.getString(IBBConfigurationKeys.API_VERSION));
    String uniqueId="";
    try{
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ODatabaseRecordTx

    populateConfiguration();
        createDefaultPermissionTags();
  }

  public static void exportData(String appcode,OutputStream os) throws UnableToExportDbException{
    ODatabaseRecordTx db = null;
    try{
      db = open(appcode, BBConfiguration.getBaasBoxAdminUsername(), BBConfiguration.getBaasBoxAdminPassword());
     
      ODatabaseExport oe = new ODatabaseExport(db, os, new OCommandOutputListener() {
        @Override
        public void onMessage(String m) {
          Logger.info(m);
        }
      });
      synchronized(DbHelper.class)  {
        if(!dbFreeze.get()){
          dbFreeze.set(true);
        }
      }
      oe.setUseLineFeedForRecords(true);
      oe.setIncludeManualIndexes(true);
      oe.exportDatabase();
      oe.close();
    }catch(Exception ioe){
      throw new UnableToExportDbException(ioe);
    }finally{
      if(db!=null && ! db.isClosed()){
        db.close();
      }
      dbFreeze.set(false);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.