Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OConfigurationException


    if (dbPath == null) {
      // SEARCH IN DEFAULT DATABASE DIRECTORY
      dbPath = OSystemVariableResolver.resolveSystemVariables("${ORIENTDB_HOME}/databases/" + name + "/");
      File f = new File(dbPath + "default.odh");
      if (!f.exists())
        throw new OConfigurationException("Database '" + name + "' is not configured on server");

      dbPath = "local:${ORIENTDB_HOME}/databases/" + name;
    }

    return dbPath;
View Full Code Here


    return recordClass;
  }

  public <RET extends Object> RET newInstance() {
    if (recordClass == null)
      throw new OConfigurationException("Can't create record since no record class was specified");

    return (RET) ORecordFactory.instance().newInstance(this, recordClass);
  }
View Full Code Here

        else if (type.equals("LOGICAL"))
          clusterId = database.addLogicalCluster(name, database.getClusterIdByName(OStorage.CLUSTER_INTERNAL_NAME));
      }

      if (clusterId != id)
        throw new OConfigurationException("Imported cluster '" + name + "' has id=" + clusterId + " different from the original: "
            + id);

      listener.onMessage("OK, assigned id=" + clusterId);

      total++;
View Full Code Here

      configuration.dataSegments.add(conf);

      final int pos = registerDataSegment(conf);

      if (pos == -1)
        throw new OConfigurationException("Can't add segment " + conf.name + " because it's already part of current storage");

      dataSegments[pos].create(-1);
      configuration.update();

      return pos;
View Full Code Here

      long tot = 0;

      for (int i = 0; i < iClusterIds.length; ++i) {
        if (iClusterIds[i] >= clusters.length)
          throw new OConfigurationException("Cluster id " + iClusterIds[i] + "was not found");

        final OCluster c = clusters[iClusterIds[i]];
        if (c != null)
          tot += c.getEntries();
      }
View Full Code Here

        registerPojo(pojo, record);

        stream2pojo(record, pojo, iFetchPlan);

      } catch (Exception e) {
        throw new OConfigurationException("Can't retrieve pojo from the record " + record, e);
      }
    }

    return (T) pojo;
  }
View Full Code Here

  public void fromStream() {
    // READ CURRENT SCHEMA VERSION
    int schemaVersion = (Integer) document.field("schemaVersion");
    if (schemaVersion != CURRENT_VERSION_NUMBER) {
      // HANDLE SCHEMA UPGRADE
      throw new OConfigurationException(
          "Database schema is different. Please export your old database with the previous verison of OrientDB and reimport it using the current one.");
    }

    // REGISTER ALL THE CLASSES
    classes.clear();
    OClassImpl cls;
    Collection<ODocument> storedClasses = document.field("classes");
    for (ODocument c : storedClasses) {
      c.setDatabase(getDatabase());
      cls = new OClassImpl(this, c);
      cls.fromStream();
      classes.put(cls.getName().toLowerCase(), cls);

      if (cls.getShortName() != null)
        classes.put(cls.getShortName().toLowerCase(), cls);
    }

    // REBUILD THE INHERITANCE TREE
    String superClassName;
    OClass superClass;
    for (ODocument c : storedClasses) {
      superClassName = c.field("superClass");

      if (superClassName != null) {
        // HAS A SUPER CLASS
        cls = (OClassImpl) classes.get(((String) c.field("name")).toLowerCase());

        superClass = classes.get(superClassName.toLowerCase());

        if (superClass == null)
          throw new OConfigurationException("Super class '" + superClassName + "' was declared in class '" + cls.getName()
              + "' but was not found in schema. Remove the dependency or create the class to continue.");

        cls.setSuperClassInternal(superClass);
      }
    }
View Full Code Here

    if (iDirectory.isDirectory())
      for (File f : iDirectory.listFiles()) {
        if (f.isDirectory())
          deleteDirectory(f);
        else if (!f.delete())
          throw new OConfigurationException("Can't delete the file: " + f);
      }
  }
View Full Code Here

      iURL = iURL.substring(0, iURL.length() - 1);

    // SEARCH FOR ENGINE
    int pos = iURL.indexOf(':');
    if (pos <= 0)
      throw new OConfigurationException("Error in database URL: the engine was not specified. Syntax is: " + URL_SYNTAX
          + ". URL was: " + iURL);

    final String engineName = iURL.substring(0, pos);

    engineLock.readLock().lock();
    try {
      final OEngine engine = engines.get(engineName.toLowerCase());

      if (engine == null)
        throw new OConfigurationException("Error on opening database: the engine '" + engineName + "' was not found. URL was: "
            + iURL + ". Registered engines are: " + engines.keySet());

      // SEARCH FOR DB-NAME
      iURL = iURL.substring(pos + 1);
      pos = iURL.indexOf('?');

      Map<String, String> parameters = null;
      String dbPath = null;
      if (pos > 0) {
        dbPath = iURL.substring(0, pos);
        iURL = iURL.substring(pos + 1);

        // PARSE PARAMETERS
        parameters = new HashMap<String, String>();
        String[] pairs = iURL.split("&");
        String[] kv;
        for (String pair : pairs) {
          kv = pair.split("=");
          if (kv.length < 2)
            throw new OConfigurationException("Error on opening database: parameter has no value. Syntax is: " + URL_SYNTAX
                + ". URL was: " + iURL);
          parameters.put(kv[0], kv[1]);
        }
      } else
        dbPath = iURL;
View Full Code Here

      } else {
        binding.put("params", new Object[0]);
      }

      if (this.function.getLanguage() == null)
        throw new OConfigurationException("Database function '" + this.function.getName() + "' has no language");
      final String funcStr = scriptManager.getFunctionDefinition(this.function);
      if (funcStr != null) {
        try {
          scriptEngine.eval(funcStr);
        } catch (ScriptException e) {
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OConfigurationException

Copyright © 2018 www.massapicom. 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.