Package com.orientechnologies.orient.core.exception

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


      color = inStream.getAsBoolean();
      init();
      size = inStream.getAsInteger();

      if (size > pageSize)
        throw new OConfigurationException("Loaded index with page size setted to " + pageSize
            + " while the loaded was built with: " + size);

      // UNCOMPACT KEYS SEPARATELY
      serializedKeys = new int[pageSize];
      for (int i = 0; i < size; ++i) {
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

      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;

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

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

   * @throws IOException
   */
  private int registerCluster(final OCluster iCluster) throws IOException {
    // CHECK FOR DUPLICATION OF NAMES
    if (clusterMap.containsKey(iCluster.getName()))
      throw new OConfigurationException("Can't add segment '" + iCluster.getName() + "' because it was already registered");

    // CREATE AND ADD THE NEW REF SEGMENT
    clusterMap.put(iCluster.getName(), iCluster);

    final int id = iCluster.getId();
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

      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);

    acquireExclusiveLock();
    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);

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

      Map<String, String> parameters = null;
      String dbName = null;
      if (pos > 0) {
        dbName = 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: the parameter has no value. Syntax is: " + URL_SYNTAX
                + ". URL was: " + iURL);
          parameters.put(kv[0], kv[1]);
        }
      } else
        dbName = iURL;
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);

    acquireExclusiveLock();
    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 dbName = null;
      if (pos > 0) {
        dbName = 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: the parameter has no value. Syntax is: " + URL_SYNTAX
                + ". URL was: " + iURL);
          parameters.put(kv[0], kv[1]);
        }
      } else
        dbName = iURL;
View Full Code Here

  public ONetworkProtocolDistributed() {
    super("Distributed-DB");

    manager = OServerMain.server().getHandler(ODistributedServerManager.class);
    if (manager == null)
      throw new OConfigurationException(
          "Can't find a ODistributedServerDiscoveryManager instance registered as handler. Check the server configuration in the handlers section.");
  }
View Full Code Here

          return (ORecordId) id;
        } else if (id instanceof Number) {
          // TREATS AS CLUSTER POSITION
          final OClass cls = iDb.getMetadata().getSchema().getClass(iPojo.getClass());
          if (cls == null)
            throw new OConfigurationException("Class " + iPojo.getClass() + " is not managed by current database");

          return new ORecordId(cls.getDefaultClusterId(), ((Number) id).longValue());
        } else if (id instanceof String)
          return new ORecordId((String) id);
      }
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.