Examples of OStorageConfiguration


Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

    if (Pattern.matches("^\\d+$", stringValue)) {
      return new Date(Long.valueOf(stringValue).longValue());
    }

    final OStorageConfiguration config = iRecord.getDatabase().getStorage().getConfiguration();

    DateFormat formatter = config.getDateFormatInstance();

    if (stringValue.length() > config.dateFormat.length()) {
      // ASSUMES YOU'RE USING THE DATE-TIME FORMATTE
      formatter = config.getDateTimeFormatInstance();
    }

    try {
      return formatter.parse(stringValue);
    } catch (ParseException pe) {
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

  private final List<OClusterMemory>  clusters          = new ArrayList<OClusterMemory>();
  private int                          defaultClusterId  = 0;

  public OStorageMemory(final String iURL) {
    super(iURL, OEngineMemory.NAME + ":" + iURL, "rw");
    configuration = new OStorageConfiguration(this);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

      if (!(iValue instanceof String) && !iType.isAssignableFrom(iValue.getClass()))
        throw new IllegalArgumentException("Property '" + iPropertyName + "' of type '" + iType + "' can't accept value of type: "
            + iValue.getClass());
    } else if (Date.class.isAssignableFrom(iType)) {
      if (iValue instanceof String && _database != null) {
        final OStorageConfiguration config = _database.getStorage().getConfiguration();

        DateFormat formatter = config.getDateFormatInstance();

        if (((String) iValue).length() > config.dateFormat.length()) {
          // ASSUMES YOU'RE USING THE DATE-TIME FORMATTE
          formatter = config.getDateTimeFormatInstance();
        }

        try {
          Date newValue = formatter.parse((String) iValue);
          // _fieldValues.put(iPropertyName, newValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

  private final List<OClusterMemory>  clusters          = new ArrayList<OClusterMemory>();
  private int                          defaultClusterId  = 0;

  public OStorageMemory(final String iURL) {
    super(iURL, OEngineMemory.NAME + ":" + iURL, "rw");
    configuration = new OStorageConfiguration(this);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

      if (!(iValue instanceof String) && !iFieldType.isAssignableFrom(iValue.getClass()))
        throw new IllegalArgumentException("Property '" + iFieldName + "' of type '" + iFieldType
            + "' cannot accept value of type: " + iValue.getClass());
    } else if (Date.class.isAssignableFrom(iFieldType)) {
      if (iValue instanceof String && ODatabaseRecordThreadLocal.INSTANCE.isDefined()) {
        final OStorageConfiguration config = ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getConfiguration();

        DateFormat formatter = config.getDateFormatInstance();

        if (((String) iValue).length() > config.dateFormat.length()) {
          // ASSUMES YOU'RE USING THE DATE-TIME FORMATTE
          formatter = config.getDateTimeFormatInstance();
        }

        try {
          Date newValue = formatter.parse((String) iValue);
          // _fieldValues.put(iFieldName, newValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

    Assert.assertTrue(new File(buildDirectory).delete());
  }

  private void createActualSBTree() throws IOException {
    actualStorage = mock(OLocalPaginatedStorage.class);
    OStorageConfiguration storageConfiguration = mock(OStorageConfiguration.class);
    storageConfiguration.clusters = new ArrayList<OStorageClusterConfiguration>();
    storageConfiguration.fileTemplate = new OStorageSegmentConfiguration();
    storageConfiguration.binaryFormatVersion = Integer.MAX_VALUE;

    actualStorageDir = buildDirectory + "/sbtreeWithWALTestActual";
    when(actualStorage.getStoragePath()).thenReturn(actualStorageDir);
    when(actualStorage.getName()).thenReturn("sbtreeWithWALTesActual");
    when(actualStorage.getComponentsFactory()).thenReturn(new OCurrentStorageComponentsFactory(storageConfiguration));

    File buildDir = new File(buildDirectory);
    if (!buildDir.exists())
      buildDir.mkdirs();

    File actualStorageDirFile = new File(actualStorageDir);
    if (!actualStorageDirFile.exists())
      actualStorageDirFile.mkdirs();

    writeAheadLog = new ODiskWriteAheadLog(6000, -1, 10 * 1024L * OWALPage.PAGE_SIZE, 100L * 1024 * 1024 * 1024, actualStorage);
    actualAtomicOperationsManager = new OAtomicOperationsManager(writeAheadLog);

    actualDiskCache = new OReadWriteDiskCache(400L * 1024 * 1024 * 1024, 1648L * 1024 * 1024,
        OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024, 1000000, 100, actualStorage, null, false, false);

    when(actualStorage.getStorageTransaction()).thenReturn(null);
    when(actualStorage.getAtomicOperationsManager()).thenReturn(actualAtomicOperationsManager);
    when(actualStorage.getDiskCache()).thenReturn(actualDiskCache);
    when(actualStorage.getWALInstance()).thenReturn(writeAheadLog);
    when(actualStorage.getConfiguration()).thenReturn(storageConfiguration);
    when(actualStorage.getMode()).thenReturn("rw");

    when(storageConfiguration.getDirectory()).thenReturn(actualStorageDir);

    sbTree = new OSBTreeBonsaiLocal<Integer, OIdentifiable>(".sbt", true);
    sbTree.create("actualSBTree", OIntegerSerializer.INSTANCE, OLinkSerializer.INSTANCE, actualStorage);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

    sbTree.create("actualSBTree", OIntegerSerializer.INSTANCE, OLinkSerializer.INSTANCE, actualStorage);
  }

  private void createExpectedSBTree() {
    final OLocalPaginatedStorage expectedStorage = mock(OLocalPaginatedStorage.class);
    OStorageConfiguration storageConfiguration = mock(OStorageConfiguration.class);
    storageConfiguration.clusters = new ArrayList<OStorageClusterConfiguration>();
    storageConfiguration.fileTemplate = new OStorageSegmentConfiguration();
    storageConfiguration.binaryFormatVersion = Integer.MAX_VALUE;

    expectedStorageDir = buildDirectory + "/sbtreeWithWALTestExpected";
    when(expectedStorage.getStoragePath()).thenReturn(expectedStorageDir);
    when(expectedStorage.getName()).thenReturn("sbtreeWithWALTesExpected");
    when(expectedStorage.getComponentsFactory()).thenReturn(new OCurrentStorageComponentsFactory(storageConfiguration));

    File buildDir = new File(buildDirectory);
    if (!buildDir.exists())
      buildDir.mkdirs();

    File expectedStorageDirFile = new File(expectedStorageDir);
    if (!expectedStorageDirFile.exists())
      expectedStorageDirFile.mkdirs();

    expectedDiskCache = new OReadWriteDiskCache(400L * 1024 * 1024 * 1024, 1648L * 1024 * 1024,
        OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024, 1000000, 100, expectedStorage, null, false, false);

    OStorageVariableParser variableParser = new OStorageVariableParser(expectedStorageDir);
    OAtomicOperationsManager atomicOperationsManager = new OAtomicOperationsManager(null);

    when(expectedStorage.getStorageTransaction()).thenReturn(null);
    when(expectedStorage.getAtomicOperationsManager()).thenReturn(atomicOperationsManager);
    when(expectedStorage.getDiskCache()).thenReturn(expectedDiskCache);
    when(expectedStorage.getWALInstance()).thenReturn(null);
    when(expectedStorage.getVariableParser()).thenReturn(variableParser);
    when(expectedStorage.getConfiguration()).thenReturn(storageConfiguration);
    when(expectedStorage.getMode()).thenReturn("rw");

    when(storageConfiguration.getDirectory()).thenReturn(expectedStorageDir);

    expectedSBTree = new OSBTreeBonsaiLocal<Integer, OIdentifiable>(".sbt", true);
    expectedSBTree.create("expectedSBTree", OIntegerSerializer.INSTANCE, OLinkSerializer.INSTANCE, expectedStorage);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

    if (currentDatabase == null)
      return;

    final OStorage stg = currentDatabase.getStorage();

    final OStorageConfiguration dbCfg = stg.getConfiguration();

    message("\n\nDATABASE PROPERTIES");

    if (dbCfg.properties != null) {
      message("\n--------------------------------+----------------------------------------------------+");
      message("\n NAME                           | VALUE                                              |");
      message("\n--------------------------------+----------------------------------------------------+");
      message("\n %-30s | %-50s |", "Name", format(dbCfg.name, 50));
      message("\n %-30s | %-50s |", "Version", format("" + dbCfg.version, 50));
      message("\n %-30s | %-50s |", "Conflict Strategy", format(dbCfg.getConflictStrategy(), 50));
      message("\n %-30s | %-50s |", "Date format", format(dbCfg.dateFormat, 50));
      message("\n %-30s | %-50s |", "Datetime format", format(dbCfg.dateTimeFormat, 50));
      message("\n %-30s | %-50s |", "Timezone", format(dbCfg.getTimeZone().getID(), 50));
      message("\n %-30s | %-50s |", "Locale Country", format(dbCfg.getLocaleCountry(), 50));
      message("\n %-30s | %-50s |", "Locale Language", format(dbCfg.getLocaleLanguage(), 50));
      message("\n %-30s | %-50s |", "Charset", format(dbCfg.getCharset(), 50));
      message("\n %-30s | %-50s |", "Schema RID", format(dbCfg.schemaRecordId, 50));
      message("\n %-30s | %-50s |", "Index Manager RID", format(dbCfg.indexMgrRecordId, 50));
      message("\n %-30s | %-50s |", "Dictionary RID", format(dbCfg.dictionaryRecordId, 50));
      message("\n--------------------------------+----------------------------------------------------+");
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

  protected Date getDate(final Object value) {
    if (value == null)
      return null;

    final OStorageConfiguration config = ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getConfiguration();

    if (value instanceof Long) {
      Calendar calendar = Calendar.getInstance(config.getTimeZone());
      calendar.setTimeInMillis(((Long) value));
      return calendar.getTime();
    }

    String stringValue = value.toString();

    if (NULL_VALUE.equals(stringValue))
      return null;

    if (stringValue.length() <= 0)
      return null;

    if (Pattern.matches("^\\d+$", stringValue))
      return new Date(Long.valueOf(stringValue).longValue());

    SimpleDateFormat formatter = config.getDateFormatInstance();

    if (stringValue.length() > config.dateFormat.length())
      // ASSUMES YOU'RE USING THE DATE-TIME FORMATTE
      formatter = config.getDateTimeFormatInstance();

    try {
      return formatter.parse(stringValue);
    } catch (ParseException pe) {
      try {
View Full Code Here

Examples of com.orientechnologies.orient.core.config.OStorageConfiguration

      connectionOptions = iOptions != null ? new HashMap<String, Object>(iOptions) : null; // CREATE A COPY TO AVOID USER
      // MANIPULATION
      // POST OPEN
      openRemoteDatabase();

      final OStorageConfiguration storageConfiguration = new OStorageRemoteConfiguration(this, ODatabaseDocumentTx
          .getDefaultSerializer().toString());
      storageConfiguration.load();

      configuration = storageConfiguration;

      componentsFactory = new OCurrentStorageComponentsFactory(configuration);
    } catch (Exception e) {
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.