Class OConsoleDatabaseApp

java.lang.Object
com.orientechnologies.common.console.OConsoleApplication
com.orientechnologies.orient.console.OConsoleDatabaseApp
All Implemented Interfaces:
OProgressListener, OTableFormatter.OTableOutput, OCommandOutputListener

  • Field Details

    • currentDatabase

      protected ODatabaseDocumentInternal currentDatabase
    • currentDatabaseName

      protected String currentDatabaseName
    • currentRecord

      protected ORecord currentRecord
    • currentRecordIdx

      protected int currentRecordIdx
    • currentResultSet

      protected List<OIdentifiable> currentResultSet
    • currentResult

      protected Object currentResult
    • urlConnection

      protected OURLConnection urlConnection
    • orientDB

      protected OrientDB orientDB
  • Constructor Details

    • OConsoleDatabaseApp

      public OConsoleDatabaseApp(String[] args)
  • Method Details

    • main

      public static void main(String[] args)
    • restoreTerminal

      protected static void restoreTerminal(boolean interactiveMode)
    • setTerminalToCBreak

      protected static boolean setTerminalToCBreak(boolean interactiveMode) throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • stty

      protected static int stty(String args, boolean interactiveMode) throws IOException, InterruptedException
      Execute the stty command with the specified arguments against the current active terminal.
      Throws:
      IOException
      InterruptedException
    • connect

      public void connect(String iURL, String iUserName, String iUserPassword) throws IOException
      Throws:
      IOException
    • disconnect

      public void disconnect()
    • createDatabase

      public void createDatabase(String databaseURL, String userName, String userPassword, String storageType, String databaseType, String options) throws IOException
      Throws:
      IOException
    • parseCommandOptions

      protected Map<String,String> parseCommandOptions(String options)
    • listDatabases

      public void listDatabases() throws IOException
      Throws:
      IOException
    • listConnections

      public void listConnections() throws IOException
      Throws:
      IOException
    • reloadSchema

      public void reloadSchema() throws IOException
      Throws:
      IOException
    • createCluster

      public void createCluster(String iCommandText)
    • dropCluster

      public void dropCluster(String iClusterName)
    • alterCluster

      public void alterCluster(String iCommandText)
    • begin

      public void begin() throws IOException
      Throws:
      IOException
    • commit

      public void commit() throws IOException
      Throws:
      IOException
    • rollback

      public void rollback() throws IOException
      Throws:
      IOException
    • truncateClass

      public void truncateClass(String iCommandText)
    • truncateCluster

      public void truncateCluster(String iCommandText)
    • truncateRecord

      public void truncateRecord(String iCommandText)
    • loadRecord

      public void loadRecord(String iRecordId, String iFetchPlan)
    • loadRecord

      public void loadRecord(String iRecordId)
    • reloadRecord

      public void reloadRecord(String iRecordId, String iFetchPlan)
    • reloadRecord

      public void reloadRecord(String iRecordId)
    • explain

      public void explain(String iCommandText)
    • transactional

      public void transactional(String iCommandText)
    • insert

      public void insert(String iCommandText)
    • createVertex

      public void createVertex(String iCommandText)
    • createEdge

      public void createEdge(String iCommandText)
    • profileStorageOn

      public void profileStorageOn()
    • profileStorageOff

      public void profileStorageOff()
    • update

      public void update(String iCommandText)
    • ha

      public void ha(String iCommandText)
    • moveVertex

      public void moveVertex(String iCommandText)
    • optimizeDatabase

      public void optimizeDatabase(String iCommandText)
    • gc

      public void gc()
    • delete

      public void delete(String iCommandText)
    • grant

      public void grant(String iCommandText)
    • revoke

      public void revoke(String iCommandText)
    • createLink

      public void createLink(String iCommandText)
    • findReferences

      public void findReferences(String iCommandText)
    • alterDatabase

      public void alterDatabase(String iCommandText)
    • freezeDatabase

      public void freezeDatabase(String storageType) throws IOException
      Throws:
      IOException
    • releaseDatabase

      public void releaseDatabase(String storageType) throws IOException
      Throws:
      IOException
    • flushDatabase

      public void flushDatabase(String storageType) throws IOException
      Throws:
      IOException
    • current

      public void current()
    • next

      public void next()
    • prev

      public void prev()
    • alterClass

      public void alterClass(String iCommandText)
    • createClass

      public void createClass(String iCommandText)
    • createSequence

      public void createSequence(String iCommandText)
    • alterSequence

      public void alterSequence(String iCommandText)
    • dropSequence

      public void dropSequence(String iCommandText)
    • createUser

      public void createUser(String iCommandText)
    • dropUser

      public void dropUser(String iCommandText)
    • alterProperty

      public void alterProperty(String iCommandText)
    • createProperty

      public void createProperty(String iCommandText)
    • createFunction

      public void createFunction(String iCommandText)
      * Creates a function.
      Parameters:
      iCommandText - the command text to execute
    • traverse

      public void traverse(String iQueryText)
    • select

      public void select(String iQueryText)
    • match

      public void match(String iQueryText)
    • move

      public void move(String iText)
    • eval

      public void eval(String iText)
    • script

      public void script(String iText)
    • js

      public void js(String iText)
    • jss

      public void jss(String iText)
    • setServerUser

      public void setServerUser(String iServerUserName, String iServerUserPasswd, String iPermissions)
    • dropServerUser

      public void dropServerUser(String iServerUserName)
    • listServerUsers

      public void listServerUsers()
    • createIndex

      public void createIndex(String iCommandText) throws IOException
      Throws:
      IOException
    • dropDatabase

      public void dropDatabase(String storageType) throws IOException
      Throws:
      IOException
    • dropDatabase

      public void dropDatabase(String iDatabaseURL, String iUserName, String iUserPassword, String storageType) throws IOException
      Throws:
      IOException
    • dropIndex

      public void dropIndex(String iCommandText) throws IOException
      Throws:
      IOException
    • rebuildIndex

      public void rebuildIndex(String iCommandText) throws IOException
      Throws:
      IOException
    • dropClass

      public void dropClass(String iCommandText) throws IOException
      Throws:
      IOException
    • dropProperty

      public void dropProperty(String iCommandText) throws IOException
      Throws:
      IOException
    • browseClass

      public void browseClass(String iClassName)
    • browseCluster

      public void browseCluster(String iClusterName)
    • displayRecord

      public void displayRecord(String iRecordNumber)
    • info

      public void info()
    • listProperties

      public void listProperties()
    • infoClass

      public void infoClass(String iClassName)
    • infoProperty

      public void infoProperty(String iPropertyName)
    • listIndexes

      public void listIndexes()
    • listClusters

      public void listClusters(String options)
    • listClasses

      public void listClasses()
    • listServers

      public void listServers()
    • dictionaryGet

      public void dictionaryGet(String iKey)
    • dictionaryPut

      public void dictionaryPut(String iKey, String iRecordId)
    • dictionaryRemove

      public void dictionaryRemove(String iKey)
    • clusterStatus

      public void clusterStatus() throws IOException
      Throws:
      IOException
    • checkDatabase

      public void checkDatabase(String iOptions) throws IOException
      Throws:
      IOException
    • repairDatabase

      public void repairDatabase(String iOptions) throws IOException
      Throws:
      IOException
    • compareDatabases

      public void compareDatabases(String iDb1URL, String iDb2URL, String iUserName, String iUserPassword, String autoDiscoveringMappingData) throws IOException
      Throws:
      IOException
    • loadScript

      public void loadScript(String scriptPath) throws IOException
      Throws:
      IOException
    • importDatabase

      public void importDatabase(String text) throws IOException
      Throws:
      IOException
    • backupDatabase

      public void backupDatabase(String iText) throws IOException
      Throws:
      IOException
    • restoreDatabase

      public void restoreDatabase(String text) throws IOException
      Throws:
      IOException
    • exportDatabase

      public void exportDatabase(String iText) throws IOException
      Throws:
      IOException
    • exportSchema

      public void exportSchema(String iOutputFilePath) throws IOException
      Throws:
      IOException
    • exportRecord

      public void exportRecord(String iFormat, String iOptions) throws IOException
      Throws:
      IOException
    • properties

      public void properties()
    • get

      public void get(String iPropertyName)
    • set

      public void set(String iPropertyName, String iPropertyValue)
    • profiler

      public void profiler(String iCommandName)
    • configGet

      public void configGet(String iConfigName) throws IOException
      Throws:
      IOException
    • sleep

      public void sleep(String iTime)
    • configSet

      public void configSet(String iConfigName, String iConfigValue) throws IOException
      Throws:
      IOException
    • config

      public void config() throws IOException
      Throws:
      IOException
    • getCurrentDatabase

      public ODatabaseDocument getCurrentDatabase()
      Should be used only by console commands
    • setCurrentDatabase

      public OConsoleDatabaseApp setCurrentDatabase(ODatabaseDocumentInternal iCurrentDatabase)
      Pass an existent database instance to be used as current.
    • getCurrentDatabaseName

      public String getCurrentDatabaseName()
      Should be used only by console commands
    • getCurrentDatabaseUserName

      public String getCurrentDatabaseUserName()
      Should be used only by console commands
    • getCurrentDatabaseUserPassword

      public String getCurrentDatabaseUserPassword()
      Should be used only by console commands
    • getCurrentRecord

      public ORecord getCurrentRecord()
      Should be used only by console commands
    • getCurrentResultSet

      public List<OIdentifiable> getCurrentResultSet()
      Should be used only by console commands
    • loadRecordInternal

      public void loadRecordInternal(String iRecordId, String iFetchPlan)
      Should be used only by console commands
    • reloadRecordInternal

      public void reloadRecordInternal(String iRecordId, String iFetchPlan)
      Should be used only by console commands
    • open

      public void open(String dbName, String user, String password)
      console command to open a db

      usage: open dbName dbUser dbPwd

      Parameters:
      dbName -
      user -
      password -
    • executeServerCommand

      protected OConsoleApplication.RESULT executeServerCommand(String iCommand)
      Overrides:
      executeServerCommand in class OConsoleApplication
    • checkForRemoteServer

      protected void checkForRemoteServer()
      Should be used only by console commands
    • checkForDatabase

      protected void checkForDatabase()
      Should be used only by console commands
    • checkCurrentObject

      protected void checkCurrentObject()
      Should be used only by console commands
    • ask

      public String ask(String iText)
    • onMessage

      public void onMessage(String iText)
      Specified by:
      onMessage in interface OCommandOutputListener
    • onBegin

      public void onBegin(Object iTask, long iTotal, Object metadata)
      Specified by:
      onBegin in interface OProgressListener
    • onProgress

      public boolean onProgress(Object iTask, long iCounter, float iPercent)
      Specified by:
      onProgress in interface OProgressListener
    • pwd

      public void pwd()
    • onCompletition

      public void onCompletition(Object iTask, boolean iSucceed)
      Specified by:
      onCompletition in interface OProgressListener
    • close

      public void close()
      Closes the console freeing all the used resources.
    • dumpDistributedConfiguration

      protected void dumpDistributedConfiguration(boolean iForce)
    • getDistributedConfiguration

      protected ODocument getDistributedConfiguration()
    • isCollectingCommands

      protected boolean isCollectingCommands(String iLine)
      Overrides:
      isCollectingCommands in class OConsoleApplication
    • onBefore

      protected void onBefore()
      Overrides:
      onBefore in class OConsoleApplication
    • setCurrentRecord

      protected OIdentifiable setCurrentRecord(int iIndex)
    • printApplicationInfo

      protected void printApplicationInfo()
    • dumpResultSet

      protected void dumpResultSet(int limit)
    • getElapsedSecs

      protected float getElapsedSecs(long start)
    • printError

      protected void printError(Throwable e)
    • updateDatabaseInfo

      protected void updateDatabaseInfo()
    • getContext

      protected String getContext()
      Overrides:
      getContext in class OConsoleApplication
    • getPrompt

      protected String getPrompt()
      Overrides:
      getPrompt in class OConsoleApplication
    • parseResult

      protected void parseResult()
    • setResultset

      protected void setResultset(List<OIdentifiable> iResultset)
    • resetResultSet

      protected void resetResultSet()
    • executeServerSideScript

      protected void executeServerSideScript(String iLanguage, String iText)
    • parseOptions

      protected Map<String,List<String>> parseOptions(String iOptions)
    • getMaxMultiValueEntries

      public int getMaxMultiValueEntries()
    • onMessage

      public void onMessage(String text, Object... args)
      Specified by:
      onMessage in interface OTableFormatter.OTableOutput
    • onException

      protected void onException(Throwable e)
      Overrides:
      onException in class OConsoleApplication
    • onAfter

      protected void onAfter()
      Overrides:
      onAfter in class OConsoleApplication
    • format

      protected String format(String iValue, int iMaxSize)
    • historyEnabled

      public boolean historyEnabled()