├── .gitignore ├── README.md ├── _base ├── base-build.xml ├── ide │ └── eclipse-formatter.xml ├── images │ └── orient_db.png └── lib │ └── UmlGraph.jar ├── build.bat ├── build.number ├── build.sh ├── client ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── orientechnologies │ │ └── orient │ │ └── client │ │ ├── db │ │ └── ODatabaseHelper.java │ │ └── remote │ │ ├── OClusterRemote.java │ │ ├── OEngineRemote.java │ │ ├── ONetworkConnectionPool.java │ │ ├── OServerAdmin.java │ │ ├── OStorageRemote.java │ │ ├── OStorageRemoteAsynchEventListener.java │ │ ├── OStorageRemoteThread.java │ │ └── OStorageRemoteThreadLocal.java │ └── resources │ └── META-INF │ └── MANIFEST.MF ├── commons ├── lib │ └── testng-5.10-jdk15.jar ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── orientechnologies │ │ └── common │ │ ├── collection │ │ ├── AbstractEntryIterator.java │ │ ├── OAlwaysGreaterKey.java │ │ ├── OAlwaysLessKey.java │ │ ├── OCompositeKey.java │ │ ├── OIdentityHashSet.java │ │ ├── OIterableObjectArray.java │ │ ├── OLazyIterator.java │ │ ├── OLazyIteratorListWrapper.java │ │ ├── OMVRBTree.java │ │ ├── OMVRBTreeEntry.java │ │ ├── OMVRBTreeEntryMemory.java │ │ ├── OMVRBTreeEntryPosition.java │ │ ├── OMVRBTreeMemory.java │ │ ├── OMVRBTreeSet.java │ │ ├── OMultiValue.java │ │ ├── ONavigableMap.java │ │ ├── ONavigableSet.java │ │ └── OSimpleImmutableEntry.java │ │ ├── comparator │ │ ├── OByteArrayComparator.java │ │ ├── OComparatorFactory.java │ │ ├── ODefaultComparator.java │ │ └── OUnsafeByteArrayComparator.java │ │ ├── concur │ │ ├── ONeedRetryException.java │ │ ├── OTimeoutException.java │ │ ├── lock │ │ │ ├── OLockException.java │ │ │ ├── OLockManager.java │ │ │ ├── OModificationLock.java │ │ │ ├── OModificationOperationProhibitedException.java │ │ │ └── OSharedLockEntry.java │ │ └── resource │ │ │ ├── OCloseable.java │ │ │ ├── ONotSharedResource.java │ │ │ ├── OResourcePool.java │ │ │ ├── OResourcePoolListener.java │ │ │ ├── OSharedContainer.java │ │ │ ├── OSharedContainerImpl.java │ │ │ ├── OSharedResource.java │ │ │ ├── OSharedResourceAbstract.java │ │ │ ├── OSharedResourceAdaptive.java │ │ │ ├── OSharedResourceAdaptiveExternal.java │ │ │ ├── OSharedResourceExternal.java │ │ │ ├── OSharedResourceExternalTimeout.java │ │ │ └── OSharedResourceTimeout.java │ │ ├── console │ │ ├── DefaultConsoleReader.java │ │ ├── OConsoleApplication.java │ │ ├── OConsoleCommandCollection.java │ │ ├── OConsoleReader.java │ │ ├── TTYConsoleReader.java │ │ └── annotation │ │ │ ├── ConsoleCommand.java │ │ │ └── ConsoleParameter.java │ │ ├── exception │ │ └── OException.java │ │ ├── factory │ │ ├── ODynamicFactory.java │ │ └── ODynamicFactoryInverse.java │ │ ├── io │ │ ├── OFileUtils.java │ │ ├── OIOException.java │ │ └── OIOUtils.java │ │ ├── listener │ │ └── OProgressListener.java │ │ ├── log │ │ ├── OLogFormatter.java │ │ └── OLogManager.java │ │ ├── parser │ │ ├── OBaseParser.java │ │ ├── OStringForwardReader.java │ │ ├── OStringParser.java │ │ ├── OSystemVariableResolver.java │ │ ├── OVariableParser.java │ │ └── OVariableParserListener.java │ │ ├── profiler │ │ ├── OProfiler.java │ │ └── OProfilerMBean.java │ │ ├── reflection │ │ └── OReflectionHelper.java │ │ ├── synch │ │ └── OSynchEventAdapter.java │ │ ├── thread │ │ ├── OPollerThread.java │ │ └── OSoftThread.java │ │ ├── types │ │ ├── OBinary.java │ │ ├── OModifiableInteger.java │ │ └── ORef.java │ │ └── util │ │ ├── OArrays.java │ │ ├── OByteBufferUtils.java │ │ ├── OCallable.java │ │ ├── OCaseIncentiveComparator.java │ │ ├── OClassLoaderHelper.java │ │ ├── OCollections.java │ │ ├── OMultiKey.java │ │ ├── OPair.java │ │ ├── OService.java │ │ └── OTriple.java │ └── test │ └── java │ └── com │ └── orientechnologies │ └── common │ ├── collection │ └── OCompositeKeyTest.java │ ├── comparator │ └── UnsafeComparatorTest.java │ ├── test │ ├── SpeedTest.java │ ├── SpeedTestAbstract.java │ ├── SpeedTestData.java │ ├── SpeedTestGroup.java │ ├── SpeedTestMonoThread.java │ ├── SpeedTestMultiThreads.java │ └── SpeedTestThread.java │ └── util │ └── OMultiKeyTest.java ├── core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── orientechnologies │ │ │ └── orient │ │ │ └── core │ │ │ ├── OConstants.java │ │ │ ├── OOrientListener.java │ │ │ ├── Orient.java │ │ │ ├── OrientShutdownHook.java │ │ │ ├── annotation │ │ │ ├── OAccess.java │ │ │ ├── OAfterDeserialization.java │ │ │ ├── OAfterSerialization.java │ │ │ ├── OBeforeDeserialization.java │ │ │ ├── OBeforeSerialization.java │ │ │ ├── ODocumentInstance.java │ │ │ ├── OId.java │ │ │ └── OVersion.java │ │ │ ├── cache │ │ │ ├── OAbstractRecordCache.java │ │ │ ├── OCache.java │ │ │ ├── OCacheLocator.java │ │ │ ├── ODefaultCache.java │ │ │ ├── OLevel1RecordCache.java │ │ │ └── OLevel2RecordCache.java │ │ │ ├── command │ │ │ ├── OBasicCommandContext.java │ │ │ ├── OCommand.java │ │ │ ├── OCommandContext.java │ │ │ ├── OCommandDistributedConditionalReplicateRequest.java │ │ │ ├── OCommandDistributedReplicateRequest.java │ │ │ ├── OCommandExecutor.java │ │ │ ├── OCommandExecutorAbstract.java │ │ │ ├── OCommandGenericIterator.java │ │ │ ├── OCommandManager.java │ │ │ ├── OCommandOutputListener.java │ │ │ ├── OCommandPredicate.java │ │ │ ├── OCommandProcess.java │ │ │ ├── OCommandRequest.java │ │ │ ├── OCommandRequestAbstract.java │ │ │ ├── OCommandRequestAsynch.java │ │ │ ├── OCommandRequestInternal.java │ │ │ ├── OCommandRequestText.java │ │ │ ├── OCommandRequestTextAbstract.java │ │ │ ├── OCommandResultListener.java │ │ │ ├── script │ │ │ │ ├── OCommandScript.java │ │ │ │ └── OCommandScriptException.java │ │ │ └── traverse │ │ │ │ ├── OTraverse.java │ │ │ │ ├── OTraverseAbstractProcess.java │ │ │ │ ├── OTraverseContext.java │ │ │ │ ├── OTraverseFieldProcess.java │ │ │ │ ├── OTraverseMultiValueProcess.java │ │ │ │ ├── OTraverseRecordProcess.java │ │ │ │ └── OTraverseRecordSetProcess.java │ │ │ ├── config │ │ │ ├── OAbstractStorageClusterConfiguration.java │ │ │ ├── OConfigurationChangeCallback.java │ │ │ ├── OContextConfiguration.java │ │ │ ├── OGlobalConfiguration.java │ │ │ ├── OStorageClusterConfiguration.java │ │ │ ├── OStorageClusterHoleConfiguration.java │ │ │ ├── OStorageConfiguration.java │ │ │ ├── OStorageDataConfiguration.java │ │ │ ├── OStorageDataHoleConfiguration.java │ │ │ ├── OStorageEntryConfiguration.java │ │ │ ├── OStorageFileConfiguration.java │ │ │ ├── OStorageMemoryClusterConfiguration.java │ │ │ ├── OStoragePhysicalClusterConfiguration.java │ │ │ ├── OStorageSegmentConfiguration.java │ │ │ └── OStorageTxConfiguration.java │ │ │ ├── db │ │ │ ├── ODataSegmentStrategy.java │ │ │ ├── ODatabase.java │ │ │ ├── ODatabaseComplex.java │ │ │ ├── ODatabaseFactory.java │ │ │ ├── ODatabaseLifecycleListener.java │ │ │ ├── ODatabaseListener.java │ │ │ ├── ODatabasePoolAbstract.java │ │ │ ├── ODatabasePoolBase.java │ │ │ ├── ODatabasePoolEntry.java │ │ │ ├── ODatabasePooled.java │ │ │ ├── ODatabaseRecordThreadLocal.java │ │ │ ├── ODatabaseRecordWrapperAbstract.java │ │ │ ├── ODatabaseSchemaAware.java │ │ │ ├── ODatabaseWrapperAbstract.java │ │ │ ├── ODefaultDataSegmentStrategy.java │ │ │ ├── OUserObject2RecordHandler.java │ │ │ ├── document │ │ │ │ ├── ODatabaseDocument.java │ │ │ │ ├── ODatabaseDocumentPool.java │ │ │ │ ├── ODatabaseDocumentTx.java │ │ │ │ └── ODatabaseDocumentTxPooled.java │ │ │ ├── graph │ │ │ │ ├── OGraphDatabase.java │ │ │ │ ├── OGraphDatabaseMigration.java │ │ │ │ ├── OGraphDatabasePool.java │ │ │ │ └── OGraphDatabasePooled.java │ │ │ ├── object │ │ │ │ ├── ODatabaseObject.java │ │ │ │ ├── OLazyObjectListInterface.java │ │ │ │ ├── OLazyObjectMapInterface.java │ │ │ │ ├── OLazyObjectMultivalueElement.java │ │ │ │ └── OLazyObjectSetInterface.java │ │ │ ├── raw │ │ │ │ └── ODatabaseRaw.java │ │ │ ├── record │ │ │ │ ├── ODatabaseBinary.java │ │ │ │ ├── ODatabaseFlat.java │ │ │ │ ├── ODatabaseRecord.java │ │ │ │ ├── ODatabaseRecordAbstract.java │ │ │ │ ├── ODatabaseRecordTx.java │ │ │ │ ├── ODetachable.java │ │ │ │ ├── OIdentifiable.java │ │ │ │ ├── OLazyRecordIterator.java │ │ │ │ ├── OLazyRecordMultiIterator.java │ │ │ │ ├── OMultiValueChangeEvent.java │ │ │ │ ├── OMultiValueChangeListener.java │ │ │ │ ├── OMultiValueChangeTimeLine.java │ │ │ │ ├── OProxedResource.java │ │ │ │ ├── ORecordElement.java │ │ │ │ ├── ORecordLazyList.java │ │ │ │ ├── ORecordLazyListener.java │ │ │ │ ├── ORecordLazyMap.java │ │ │ │ ├── ORecordLazyMultiValue.java │ │ │ │ ├── ORecordLazySet.java │ │ │ │ ├── ORecordMultiValueHelper.java │ │ │ │ ├── ORecordOperation.java │ │ │ │ ├── ORecordTrackedIterator.java │ │ │ │ ├── ORecordTrackedList.java │ │ │ │ ├── ORecordTrackedSet.java │ │ │ │ ├── OTrackedList.java │ │ │ │ ├── OTrackedMap.java │ │ │ │ ├── OTrackedMultiValue.java │ │ │ │ └── OTrackedSet.java │ │ │ └── tool │ │ │ │ ├── ODatabaseCompare.java │ │ │ │ ├── ODatabaseExport.java │ │ │ │ ├── ODatabaseExportException.java │ │ │ │ ├── ODatabaseImpExpAbstract.java │ │ │ │ ├── ODatabaseImport.java │ │ │ │ └── ODatabaseImportException.java │ │ │ ├── dictionary │ │ │ └── ODictionary.java │ │ │ ├── engine │ │ │ ├── OEngine.java │ │ │ ├── OEngineAbstract.java │ │ │ ├── local │ │ │ │ └── OEngineLocal.java │ │ │ └── memory │ │ │ │ └── OEngineMemory.java │ │ │ ├── entity │ │ │ ├── OClassDictionary.java │ │ │ ├── OEntityManager.java │ │ │ ├── OEntityManagerClassHandler.java │ │ │ └── OEntityManagerInternal.java │ │ │ ├── exception │ │ │ ├── OCommandExecutionException.java │ │ │ ├── OConcurrentModificationException.java │ │ │ ├── OConfigurationException.java │ │ │ ├── ODatabaseException.java │ │ │ ├── OFetchException.java │ │ │ ├── OGraphException.java │ │ │ ├── OMemoryLockException.java │ │ │ ├── OQueryParsingException.java │ │ │ ├── ORecordNotFoundException.java │ │ │ ├── OSchemaException.java │ │ │ ├── OSecurityAccessException.java │ │ │ ├── OSecurityException.java │ │ │ ├── OSerializationException.java │ │ │ ├── OStorageException.java │ │ │ ├── OTransactionAbortedException.java │ │ │ ├── OTransactionBlockedException.java │ │ │ ├── OTransactionException.java │ │ │ └── OValidationException.java │ │ │ ├── fetch │ │ │ ├── OFetchContext.java │ │ │ ├── OFetchHelper.java │ │ │ ├── OFetchListener.java │ │ │ ├── json │ │ │ │ ├── OJSONFetchContext.java │ │ │ │ └── OJSONFetchListener.java │ │ │ └── remote │ │ │ │ ├── ORemoteFetchContext.java │ │ │ │ └── ORemoteFetchListener.java │ │ │ ├── hook │ │ │ ├── ODocumentHookAbstract.java │ │ │ ├── OHookThreadLocal.java │ │ │ ├── ORecordHook.java │ │ │ └── ORecordHookAbstract.java │ │ │ ├── id │ │ │ ├── ORID.java │ │ │ └── ORecordId.java │ │ │ ├── index │ │ │ ├── OAbstractIndexDefinitionMultiValue.java │ │ │ ├── OClassIndexManager.java │ │ │ ├── OCompositeIndexDefinition.java │ │ │ ├── ODocumentFieldsHashSet.java │ │ │ ├── OIndex.java │ │ │ ├── OIndexAbstractDelegate.java │ │ │ ├── OIndexCallback.java │ │ │ ├── OIndexDefinition.java │ │ │ ├── OIndexDefinitionFactory.java │ │ │ ├── OIndexDefinitionMultiValue.java │ │ │ ├── OIndexDictionary.java │ │ │ ├── OIndexException.java │ │ │ ├── OIndexFactory.java │ │ │ ├── OIndexFullText.java │ │ │ ├── OIndexInternal.java │ │ │ ├── OIndexMVRBTreeAbstract.java │ │ │ ├── OIndexManager.java │ │ │ ├── OIndexManagerAbstract.java │ │ │ ├── OIndexManagerProxy.java │ │ │ ├── OIndexManagerRemote.java │ │ │ ├── OIndexManagerShared.java │ │ │ ├── OIndexMultiValues.java │ │ │ ├── OIndexNotUnique.java │ │ │ ├── OIndexOneValue.java │ │ │ ├── OIndexRemote.java │ │ │ ├── OIndexRemoteMultiValue.java │ │ │ ├── OIndexRemoteOneValue.java │ │ │ ├── OIndexTxAware.java │ │ │ ├── OIndexTxAwareDictionary.java │ │ │ ├── OIndexTxAwareMultiValue.java │ │ │ ├── OIndexTxAwareOneValue.java │ │ │ ├── OIndexUnique.java │ │ │ ├── OIndexes.java │ │ │ ├── OMVRBIndexFactory.java │ │ │ ├── OPropertyIndexDefinition.java │ │ │ ├── OPropertyListIndexDefinition.java │ │ │ ├── OPropertyMapIndexDefinition.java │ │ │ ├── ORuntimeKeyIndexDefinition.java │ │ │ └── OSimpleKeyIndexDefinition.java │ │ │ ├── intent │ │ │ ├── OIntent.java │ │ │ ├── OIntentMassiveInsert.java │ │ │ └── OIntentMassiveRead.java │ │ │ ├── iterator │ │ │ ├── OEmptyIterator.java │ │ │ ├── OIdentifiableIterator.java │ │ │ ├── OIterationException.java │ │ │ ├── ORecordIteratorClass.java │ │ │ ├── ORecordIteratorCluster.java │ │ │ ├── ORecordIteratorClusters.java │ │ │ └── object │ │ │ │ ├── OObjectIteratorClassInterface.java │ │ │ │ └── OObjectIteratorClusterInterface.java │ │ │ ├── memory │ │ │ ├── OLowMemoryException.java │ │ │ └── OMemoryWatchDog.java │ │ │ ├── metadata │ │ │ ├── OMetadata.java │ │ │ ├── schema │ │ │ │ ├── OClass.java │ │ │ │ ├── OClassImpl.java │ │ │ │ ├── OProperty.java │ │ │ │ ├── OPropertyImpl.java │ │ │ │ ├── OSchema.java │ │ │ │ ├── OSchemaProxy.java │ │ │ │ ├── OSchemaShared.java │ │ │ │ └── OType.java │ │ │ └── security │ │ │ │ ├── ODatabaseSecurityResources.java │ │ │ │ ├── ORole.java │ │ │ │ ├── OSecurity.java │ │ │ │ ├── OSecurityNull.java │ │ │ │ ├── OSecurityProxy.java │ │ │ │ ├── OSecurityShared.java │ │ │ │ ├── OUser.java │ │ │ │ └── OUserTrigger.java │ │ │ ├── package.html │ │ │ ├── query │ │ │ ├── OQuery.java │ │ │ ├── OQueryAbstract.java │ │ │ ├── OQueryContext.java │ │ │ ├── OQueryHelper.java │ │ │ ├── OQueryRuntimeValueMulti.java │ │ │ └── nativ │ │ │ │ ├── ONativeAsynchQuery.java │ │ │ │ ├── ONativeQuery.java │ │ │ │ ├── ONativeSynchQuery.java │ │ │ │ ├── OQueryContextNative.java │ │ │ │ └── OQueryContextNativeSchema.java │ │ │ ├── record │ │ │ ├── ORecord.java │ │ │ ├── ORecordAbstract.java │ │ │ ├── ORecordFactoryManager.java │ │ │ ├── ORecordInternal.java │ │ │ ├── ORecordListener.java │ │ │ ├── ORecordPositional.java │ │ │ ├── ORecordSchemaAware.java │ │ │ ├── ORecordSchemaAwareAbstract.java │ │ │ ├── ORecordStringable.java │ │ │ └── impl │ │ │ │ ├── ODocument.java │ │ │ │ ├── ODocumentComparator.java │ │ │ │ ├── ODocumentHelper.java │ │ │ │ ├── ORecordBytes.java │ │ │ │ ├── ORecordBytesLazy.java │ │ │ │ └── ORecordFlat.java │ │ │ ├── security │ │ │ └── OSecurityManager.java │ │ │ ├── serialization │ │ │ ├── OBase64Utils.java │ │ │ ├── OBinaryProtocol.java │ │ │ ├── OMemoryInputStream.java │ │ │ ├── OMemoryStream.java │ │ │ ├── OSerializableStream.java │ │ │ └── serializer │ │ │ │ ├── OJSONReader.java │ │ │ │ ├── OJSONWriter.java │ │ │ │ ├── OStringSerializerHelper.java │ │ │ │ ├── binary │ │ │ │ ├── OBinarySerializer.java │ │ │ │ ├── OBinarySerializerFactory.java │ │ │ │ └── impl │ │ │ │ │ ├── OBinaryTypeSerializer.java │ │ │ │ │ ├── OBooleanSerializer.java │ │ │ │ │ ├── OByteSerializer.java │ │ │ │ │ ├── OCharSerializer.java │ │ │ │ │ ├── ODateSerializer.java │ │ │ │ │ ├── ODateTimeSerializer.java │ │ │ │ │ ├── ODecimalSerializer.java │ │ │ │ │ ├── ODoubleSerializer.java │ │ │ │ │ ├── OFloatSerializer.java │ │ │ │ │ ├── OIntegerSerializer.java │ │ │ │ │ ├── OLinkSerializer.java │ │ │ │ │ ├── OLongSerializer.java │ │ │ │ │ ├── ONullSerializer.java │ │ │ │ │ ├── OShortSerializer.java │ │ │ │ │ ├── OStringSerializer.java │ │ │ │ │ └── index │ │ │ │ │ ├── OCompositeKeySerializer.java │ │ │ │ │ └── OSimpleKeySerializer.java │ │ │ │ ├── object │ │ │ │ ├── OObjectSerializer.java │ │ │ │ ├── OObjectSerializerHelperDocument.java │ │ │ │ ├── OObjectSerializerHelperInterface.java │ │ │ │ └── OObjectSerializerHelperManager.java │ │ │ │ ├── record │ │ │ │ ├── ORecordSerializer.java │ │ │ │ ├── ORecordSerializerFactory.java │ │ │ │ ├── ORecordSerializerRaw.java │ │ │ │ ├── OSerializableRecordPositional.java │ │ │ │ ├── OSerializationThreadLocal.java │ │ │ │ └── string │ │ │ │ │ ├── ORecordSerializerCSVAbstract.java │ │ │ │ │ ├── ORecordSerializerDocument2Binary.java │ │ │ │ │ ├── ORecordSerializerJSON.java │ │ │ │ │ ├── ORecordSerializerSchemaAware2CSV.java │ │ │ │ │ └── ORecordSerializerStringAbstract.java │ │ │ │ ├── stream │ │ │ │ ├── OStreamSerializer.java │ │ │ │ ├── OStreamSerializerAnyRecord.java │ │ │ │ ├── OStreamSerializerAnyRuntime.java │ │ │ │ ├── OStreamSerializerAnyStatic.java │ │ │ │ ├── OStreamSerializerAnyStreamable.java │ │ │ │ ├── OStreamSerializerFactory.java │ │ │ │ ├── OStreamSerializerHelper.java │ │ │ │ ├── OStreamSerializerInteger.java │ │ │ │ ├── OStreamSerializerListRID.java │ │ │ │ ├── OStreamSerializerLiteral.java │ │ │ │ ├── OStreamSerializerLong.java │ │ │ │ ├── OStreamSerializerRID.java │ │ │ │ ├── OStreamSerializerRecord.java │ │ │ │ └── OStreamSerializerString.java │ │ │ │ └── string │ │ │ │ ├── OStringBuilderSerializable.java │ │ │ │ ├── OStringSerializer.java │ │ │ │ ├── OStringSerializerAnyRuntime.java │ │ │ │ ├── OStringSerializerAnyStreamable.java │ │ │ │ └── OStringSerializerEmbedded.java │ │ │ ├── sql │ │ │ ├── OCommandExecutorSQLAbstract.java │ │ │ ├── OCommandExecutorSQLAlterClass.java │ │ │ ├── OCommandExecutorSQLAlterCluster.java │ │ │ ├── OCommandExecutorSQLAlterDatabase.java │ │ │ ├── OCommandExecutorSQLAlterProperty.java │ │ │ ├── OCommandExecutorSQLCreateClass.java │ │ │ ├── OCommandExecutorSQLCreateEdge.java │ │ │ ├── OCommandExecutorSQLCreateIndex.java │ │ │ ├── OCommandExecutorSQLCreateLink.java │ │ │ ├── OCommandExecutorSQLCreateProperty.java │ │ │ ├── OCommandExecutorSQLCreateVertex.java │ │ │ ├── OCommandExecutorSQLDelegate.java │ │ │ ├── OCommandExecutorSQLDelete.java │ │ │ ├── OCommandExecutorSQLDropClass.java │ │ │ ├── OCommandExecutorSQLDropCluster.java │ │ │ ├── OCommandExecutorSQLDropIndex.java │ │ │ ├── OCommandExecutorSQLDropProperty.java │ │ │ ├── OCommandExecutorSQLEarlyResultsetAbstract.java │ │ │ ├── OCommandExecutorSQLFactory.java │ │ │ ├── OCommandExecutorSQLFindReferences.java │ │ │ ├── OCommandExecutorSQLGrant.java │ │ │ ├── OCommandExecutorSQLInsert.java │ │ │ ├── OCommandExecutorSQLPermissionAbstract.java │ │ │ ├── OCommandExecutorSQLRebuildIndex.java │ │ │ ├── OCommandExecutorSQLResultsetAbstract.java │ │ │ ├── OCommandExecutorSQLResultsetDelegate.java │ │ │ ├── OCommandExecutorSQLRevoke.java │ │ │ ├── OCommandExecutorSQLSelect.java │ │ │ ├── OCommandExecutorSQLSetAware.java │ │ │ ├── OCommandExecutorSQLTraverse.java │ │ │ ├── OCommandExecutorSQLTruncateClass.java │ │ │ ├── OCommandExecutorSQLTruncateCluster.java │ │ │ ├── OCommandExecutorSQLTruncateRecord.java │ │ │ ├── OCommandExecutorSQLUpdate.java │ │ │ ├── OCommandParameters.java │ │ │ ├── OCommandSQL.java │ │ │ ├── OCommandSQLParsingException.java │ │ │ ├── OCommandSQLResultset.java │ │ │ ├── ODefaultCommandExecutorSQLFactory.java │ │ │ ├── ODynamicSQLElementFactory.java │ │ │ ├── OFindReferenceHelper.java │ │ │ ├── OIndexProxy.java │ │ │ ├── OIndexSearchResult.java │ │ │ ├── OSQLEngine.java │ │ │ ├── OSQLHelper.java │ │ │ ├── filter │ │ │ │ ├── OSQLFilter.java │ │ │ │ ├── OSQLFilterCondition.java │ │ │ │ ├── OSQLFilterFieldOperator.java │ │ │ │ ├── OSQLFilterItem.java │ │ │ │ ├── OSQLFilterItemAbstract.java │ │ │ │ ├── OSQLFilterItemField.java │ │ │ │ ├── OSQLFilterItemFieldAll.java │ │ │ │ ├── OSQLFilterItemFieldAny.java │ │ │ │ ├── OSQLFilterItemFieldMultiAbstract.java │ │ │ │ ├── OSQLFilterItemParameter.java │ │ │ │ ├── OSQLFilterItemVariable.java │ │ │ │ └── OSQLPredicate.java │ │ │ ├── functions │ │ │ │ ├── ODefaultSQLFunctionFactory.java │ │ │ │ ├── OSQLFunction.java │ │ │ │ ├── OSQLFunctionAbstract.java │ │ │ │ ├── OSQLFunctionFactory.java │ │ │ │ ├── OSQLFunctionRuntime.java │ │ │ │ ├── coll │ │ │ │ │ ├── OSQLFunctionCollAbstract.java │ │ │ │ │ ├── OSQLFunctionDifference.java │ │ │ │ │ ├── OSQLFunctionDistinct.java │ │ │ │ │ ├── OSQLFunctionIntersect.java │ │ │ │ │ └── OSQLFunctionUnion.java │ │ │ │ ├── geo │ │ │ │ │ └── OSQLFunctionDistance.java │ │ │ │ ├── math │ │ │ │ │ ├── OSQLFunctionAverage.java │ │ │ │ │ ├── OSQLFunctionMathAbstract.java │ │ │ │ │ ├── OSQLFunctionMax.java │ │ │ │ │ ├── OSQLFunctionMin.java │ │ │ │ │ └── OSQLFunctionSum.java │ │ │ │ └── misc │ │ │ │ │ ├── OSQLFunctionCount.java │ │ │ │ │ ├── OSQLFunctionDate.java │ │ │ │ │ ├── OSQLFunctionFormat.java │ │ │ │ │ └── OSQLFunctionSysdate.java │ │ │ ├── operator │ │ │ │ ├── ODefaultQueryOperatorFactory.java │ │ │ │ ├── OIndexReuseType.java │ │ │ │ ├── OQueryOperator.java │ │ │ │ ├── OQueryOperatorAnd.java │ │ │ │ ├── OQueryOperatorBetween.java │ │ │ │ ├── OQueryOperatorContains.java │ │ │ │ ├── OQueryOperatorContainsAll.java │ │ │ │ ├── OQueryOperatorContainsKey.java │ │ │ │ ├── OQueryOperatorContainsText.java │ │ │ │ ├── OQueryOperatorContainsValue.java │ │ │ │ ├── OQueryOperatorEquality.java │ │ │ │ ├── OQueryOperatorEqualityNotNulls.java │ │ │ │ ├── OQueryOperatorEquals.java │ │ │ │ ├── OQueryOperatorFactory.java │ │ │ │ ├── OQueryOperatorIn.java │ │ │ │ ├── OQueryOperatorInstanceof.java │ │ │ │ ├── OQueryOperatorIs.java │ │ │ │ ├── OQueryOperatorLike.java │ │ │ │ ├── OQueryOperatorMajor.java │ │ │ │ ├── OQueryOperatorMajorEquals.java │ │ │ │ ├── OQueryOperatorMatches.java │ │ │ │ ├── OQueryOperatorMinor.java │ │ │ │ ├── OQueryOperatorMinorEquals.java │ │ │ │ ├── OQueryOperatorNot.java │ │ │ │ ├── OQueryOperatorNotEquals.java │ │ │ │ ├── OQueryOperatorOr.java │ │ │ │ ├── OQueryOperatorTraverse.java │ │ │ │ ├── OQueryTargetOperator.java │ │ │ │ └── math │ │ │ │ │ ├── OQueryOperatorDivide.java │ │ │ │ │ ├── OQueryOperatorMinus.java │ │ │ │ │ ├── OQueryOperatorMod.java │ │ │ │ │ ├── OQueryOperatorMultiply.java │ │ │ │ │ └── OQueryOperatorPlus.java │ │ │ └── query │ │ │ │ ├── OSQLAsynchQuery.java │ │ │ │ ├── OSQLQuery.java │ │ │ │ └── OSQLSynchQuery.java │ │ │ ├── storage │ │ │ ├── OCluster.java │ │ │ ├── OClusterFactory.java │ │ │ ├── OClusterPositionIterator.java │ │ │ ├── ODataSegment.java │ │ │ ├── ODefaultClusterFactory.java │ │ │ ├── OPhysicalPosition.java │ │ │ ├── ORawBuffer.java │ │ │ ├── ORecordCallback.java │ │ │ ├── ORecordLockManager.java │ │ │ ├── OStorage.java │ │ │ ├── OStorageAbstract.java │ │ │ ├── OStorageEmbedded.java │ │ │ ├── OStorageProxy.java │ │ │ ├── fs │ │ │ │ ├── OAbstractFile.java │ │ │ │ ├── OFile.java │ │ │ │ ├── OFileClassic.java │ │ │ │ ├── OFileFactory.java │ │ │ │ ├── OFileMMap.java │ │ │ │ ├── OMMapBufferEntry.java │ │ │ │ ├── OMMapManager.java │ │ │ │ ├── OMMapManagerAbstract.java │ │ │ │ ├── OMMapManagerLocator.java │ │ │ │ ├── OMMapManagerNew.java │ │ │ │ └── OMMapManagerOld.java │ │ │ ├── impl │ │ │ │ ├── local │ │ │ │ │ ├── OClusterLocal.java │ │ │ │ │ ├── OClusterLocalHole.java │ │ │ │ │ ├── ODataHoleInfo.java │ │ │ │ │ ├── ODataLocal.java │ │ │ │ │ ├── ODataLocalHole.java │ │ │ │ │ ├── OMultiFileSegment.java │ │ │ │ │ ├── OSegment.java │ │ │ │ │ ├── OSingleFileSegment.java │ │ │ │ │ ├── OStorageConfigurationSegment.java │ │ │ │ │ ├── OStorageLocal.java │ │ │ │ │ ├── OStorageLocalTxExecuter.java │ │ │ │ │ ├── OStorageVariableParser.java │ │ │ │ │ ├── OTxSegment.java │ │ │ │ │ ├── TestSimulateError.java │ │ │ │ │ └── package.html │ │ │ │ └── memory │ │ │ │ │ ├── OClusterMemory.java │ │ │ │ │ ├── ODataSegmentMemory.java │ │ │ │ │ └── OStorageMemory.java │ │ │ └── package.html │ │ │ ├── tx │ │ │ ├── OTransaction.java │ │ │ ├── OTransactionAbstract.java │ │ │ ├── OTransactionIndexChanges.java │ │ │ ├── OTransactionIndexChangesPerKey.java │ │ │ ├── OTransactionNoTx.java │ │ │ ├── OTransactionOptimistic.java │ │ │ ├── OTransactionRealAbstract.java │ │ │ └── OTxListener.java │ │ │ └── type │ │ │ ├── ODocumentWrapper.java │ │ │ ├── ODocumentWrapperNoClass.java │ │ │ └── tree │ │ │ ├── OMVRBTreeDatabase.java │ │ │ ├── OMVRBTreeDatabaseLazySave.java │ │ │ ├── OMVRBTreeEntryPersistent.java │ │ │ ├── OMVRBTreePersistent.java │ │ │ ├── OMVRBTreeRID.java │ │ │ ├── OMVRBTreeRIDSet.java │ │ │ ├── OMVRBTreeStorage.java │ │ │ └── provider │ │ │ ├── OIdentityChangedListener.java │ │ │ ├── OMVRBTreeEntryDataProvider.java │ │ │ ├── OMVRBTreeEntryDataProviderAbstract.java │ │ │ ├── OMVRBTreeMapEntryProvider.java │ │ │ ├── OMVRBTreeMapProvider.java │ │ │ ├── OMVRBTreeProvider.java │ │ │ ├── OMVRBTreeProviderAbstract.java │ │ │ ├── OMVRBTreeRIDEntryProvider.java │ │ │ └── OMVRBTreeRIDProvider.java │ └── resources │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── services │ │ ├── com.orientechnologies.orient.core.index.OIndexFactory │ │ ├── com.orientechnologies.orient.core.sql.OCommandExecutorSQLFactory │ │ ├── com.orientechnologies.orient.core.sql.functions.OSQLFunctionFactory │ │ └── com.orientechnologies.orient.core.sql.operator.OQueryOperatorFactory │ └── test │ └── java │ └── com │ └── orientechnologies │ ├── common │ ├── collection │ │ ├── OMVRBTreeCompositeTest.java │ │ └── OMVRBTreeNonCompositeTest.java │ └── util │ │ └── OByteBufferUtilsTest.java │ └── orient │ └── core │ ├── cache │ ├── ODefaultCacheCleanUpTest.java │ └── ODefaultCacheTest.java │ ├── db │ └── record │ │ ├── TrackedListTest.java │ │ ├── TrackedMapTest.java │ │ └── TrackedSetTest.java │ ├── index │ ├── OCompositeIndexDefinitionTest.java │ ├── OPropertyIndexDefinitionTest.java │ ├── OPropertyListIndexDefinitionTest.java │ ├── OPropertyMapIndexDefinitionTest.java │ └── OSimpleKeyIndexDefinitionTest.java │ ├── record │ └── impl │ │ └── ORecordBytesTest.java │ ├── serialization │ └── serializer │ │ └── binary │ │ └── impl │ │ ├── BinarySerializerTest.java │ │ ├── BooleanSerializerTest.java │ │ ├── ByteSerializerTest.java │ │ ├── CharSerializerTest.java │ │ ├── DateSerializerTest.java │ │ ├── DateTimeSerializerTest.java │ │ ├── DecimalSerializerTest.java │ │ ├── DoubleSerializerTest.java │ │ ├── FloatSerializerTest.java │ │ ├── IntegerSerializerTest.java │ │ ├── LinkSerializerTest.java │ │ ├── LongSerializerTest.java │ │ ├── ShortSerializerTest.java │ │ └── StringSerializerTest.java │ ├── sql │ └── OOQueryOperatorTest.java │ ├── storage │ ├── StorageModificationLockTest.java │ └── impl │ │ └── local │ │ └── OStorageLocalTest.java │ └── type │ └── tree │ ├── OMVRBTreeDatabaseLazySaveCompositeTest.java │ └── OMVRBTreeDatabaseLazySaveNonCompositeTest.java ├── distribution ├── pom.xml └── src │ └── main │ └── assembly │ └── bin.xml ├── doc └── images │ └── orientdb-android-logo.png ├── enterprise ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── orientechnologies │ │ └── orient │ │ └── enterprise │ │ ├── channel │ │ ├── OChannel.java │ │ ├── binary │ │ │ ├── OAsynchChannelServiceThread.java │ │ │ ├── OChannelBinary.java │ │ │ ├── OChannelBinaryAsynch.java │ │ │ ├── OChannelBinaryClient.java │ │ │ ├── OChannelBinaryClientSynch.java │ │ │ ├── OChannelBinaryInputStream.java │ │ │ ├── OChannelBinaryOutputStream.java │ │ │ ├── OChannelBinaryProtocol.java │ │ │ ├── OChannelBinaryServer.java │ │ │ ├── ONetworkProtocolException.java │ │ │ └── ORemoteServerEventListener.java │ │ └── text │ │ │ ├── OChannelText.java │ │ │ └── OChannelTextServer.java │ │ └── command │ │ ├── OCommandExecutorScript.java │ │ ├── OScriptDocumentDatabaseWrapper.java │ │ ├── OScriptGraphDatabaseWrapper.java │ │ └── script │ │ └── OCommandScriptException.java │ └── resources │ └── META-INF │ └── MANIFEST.MF ├── history.txt ├── license.txt ├── nativeos ├── lib │ ├── jna-3.4.0.jar │ └── platform.jar ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── orientechnologies │ └── nio │ ├── MemoryLocker.java │ └── MemoryLockerLinux.java ├── object ├── .gitignore ├── lib │ ├── hibernate-jpa-2.0-api-1.0.0.Final.jar │ └── javassist.jar ├── pom.xml ├── script │ ├── console.bat │ └── console.sh └── src │ ├── main │ └── java │ │ └── com │ │ └── orientechnologies │ │ └── orient │ │ └── object │ │ ├── db │ │ ├── OCommandSQLPojoWrapper.java │ │ ├── ODatabaseObjectPool.java │ │ ├── ODatabaseObjectTx.java │ │ ├── ODatabaseObjectTxPooled.java │ │ ├── ODatabasePojoAbstract.java │ │ ├── OLazyObjectIterator.java │ │ ├── OLazyObjectList.java │ │ ├── OLazyObjectMap.java │ │ ├── OLazyObjectSet.java │ │ ├── OObjectDatabasePool.java │ │ ├── OObjectDatabaseTx.java │ │ ├── OObjectDatabaseTxPooled.java │ │ ├── OObjectLazyIterator.java │ │ ├── OObjectLazyList.java │ │ ├── OObjectLazyListIterator.java │ │ ├── OObjectLazyMap.java │ │ ├── OObjectLazySet.java │ │ ├── OObjectNotDetachedException.java │ │ ├── OObjectNotManagedException.java │ │ └── graph │ │ │ ├── ODatabaseGraphTx.java │ │ │ ├── OGraphEdge.java │ │ │ ├── OGraphElement.java │ │ │ └── OGraphVertex.java │ │ ├── dictionary │ │ └── ODictionaryWrapper.java │ │ ├── enhancement │ │ ├── OObjectEntityEnhancer.java │ │ ├── OObjectEntitySerializer.java │ │ └── OObjectProxyMethodHandler.java │ │ ├── entity │ │ └── OObjectEntityClassHandler.java │ │ ├── enumerations │ │ ├── OLazyObjectEnumSerializer.java │ │ ├── OObjectEnumLazyIterator.java │ │ ├── OObjectEnumLazyList.java │ │ ├── OObjectEnumLazyMap.java │ │ └── OObjectEnumLazySet.java │ │ ├── fetch │ │ ├── OObjectFetchContext.java │ │ └── OObjectFetchListener.java │ │ ├── iterator │ │ ├── OObjectIteratorClass.java │ │ ├── OObjectIteratorCluster.java │ │ └── graph │ │ │ ├── OGraphEdgeIterator.java │ │ │ ├── OGraphElementIterator.java │ │ │ └── OGraphVertexIterator.java │ │ ├── jpa │ │ ├── OJPAEntityManager.java │ │ ├── OJPAEntityManagerFactory.java │ │ ├── OJPAEntityTransaction.java │ │ └── OJPAPersistenceProvider.java │ │ └── serialization │ │ ├── OLazyObjectCustomSerializer.java │ │ ├── OObjectCustomSerializerIterator.java │ │ ├── OObjectCustomSerializerList.java │ │ ├── OObjectCustomSerializerMap.java │ │ ├── OObjectCustomSerializerSet.java │ │ ├── OObjectSerializationThreadLocal.java │ │ ├── OObjectSerializerContext.java │ │ ├── OObjectSerializerHelper.java │ │ └── OObjectSerializerManager.java │ └── test │ └── java │ └── com │ └── orientechnologies │ └── orient │ └── object │ └── enhancement │ ├── AbstractEntity.java │ ├── ExactEntity.java │ └── OObjectEntitySerializerTest.java ├── pom.xml ├── readme.txt └── tools ├── META-INF └── MANIFEST.MF ├── pom.xml ├── script ├── console.bat └── console.sh └── src └── main └── java └── com └── orientechnologies └── orient └── console ├── OConsoleDatabaseApp.java ├── OConsoleDatabaseListener.java └── OrientConsole.java /.gitignore: -------------------------------------------------------------------------------- 1 | #Eclipse 2 | .project 3 | .classpath 4 | .settings 5 | .checkstyle 6 | project.properties 7 | 8 | #IntelliJ IDEA 9 | .idea 10 | *.iml 11 | *.ipr 12 | *.iws 13 | classes 14 | gen-external-apklibs 15 | 16 | #Maven 17 | target 18 | release.properties 19 | pom.xml.* 20 | 21 | #OSX 22 | .DS_Store 23 | .DS_Store* 24 | ehthumbs.db 25 | Icon? 26 | Thumbs.db 27 | 28 | #Android 29 | bin 30 | gen 31 | lint.xml 32 | proguard 33 | android-support-v4.jar 34 | proguard.cfg 35 | proguard-project.txt 36 | AndroidManifest.xml 37 | 38 | #Ant 39 | build.xml 40 | ant.properties 41 | local.properties 42 | 43 | -------------------------------------------------------------------------------- /_base/images/orient_db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/_base/images/orient_db.png -------------------------------------------------------------------------------- /_base/lib/UmlGraph.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/_base/lib/UmlGraph.jar -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM Copyright (c) 1999-2011 Luca Garulli 3 | @REM 4 | call ant 5 | 6 | pause 7 | -------------------------------------------------------------------------------- /build.number: -------------------------------------------------------------------------------- 1 | #Build Number for ANT. Do not edit! 2 | #Tue Jul 24 17:31:25 CEST 2012 3 | build.number=12316 4 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ant 3 | -------------------------------------------------------------------------------- /client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | com.wu-man 8 | orientdb-android-parent 9 | 1.1.0.2-SNAPSHOT 10 | ../ 11 | 12 | 13 | orientdb-android-client 14 | 15 | OrientDB Client 16 | 17 | 18 | * 19 | com.orientechnologies.orient.client.* 20 | 21 | 22 | 23 | 24 | com.wu-man 25 | orientdb-android-enterprise 26 | ${project.version} 27 | 28 | 29 | dnsjava 30 | dnsjava 31 | 2.1.1 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteAsynchEventListener.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.client.remote; 2 | 3 | import com.orientechnologies.common.log.OLogManager; 4 | import com.orientechnologies.orient.core.record.ORecordInternal; 5 | import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol; 6 | import com.orientechnologies.orient.enterprise.channel.binary.ORemoteServerEventListener; 7 | 8 | public class OStorageRemoteAsynchEventListener implements ORemoteServerEventListener { 9 | 10 | private OStorageRemote storage; 11 | 12 | public OStorageRemoteAsynchEventListener(OStorageRemote storage) { 13 | this.storage = storage; 14 | } 15 | 16 | public void onRequest(final byte iRequestCode, final Object obj) { 17 | if (iRequestCode == OChannelBinaryProtocol.REQUEST_PUSH_RECORD) 18 | // ASYNCHRONOUS PUSH INTO THE LEVEL2 CACHE 19 | storage.getLevel2Cache().updateRecord((ORecordInternal) obj); 20 | else if (iRequestCode == OChannelBinaryProtocol.REQUEST_PUSH_DISTRIB_CONFIG) { 21 | storage.updateClusterConfiguration((byte[]) obj); 22 | 23 | if (OLogManager.instance().isInfoEnabled()) 24 | OLogManager.instance().info(this, "Received new cluster configuration: %s", storage.getClusterConfiguration().toJSON("")); 25 | } 26 | } 27 | 28 | public OStorageRemote getStorage() { 29 | return storage; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteThreadLocal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.client.remote; 17 | 18 | import com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal.OStorageRemoteSession; 19 | 20 | public class OStorageRemoteThreadLocal extends ThreadLocal { 21 | public static OStorageRemoteThreadLocal INSTANCE = new OStorageRemoteThreadLocal(); 22 | 23 | public class OStorageRemoteSession { 24 | public boolean commandExecuting = false; 25 | public Integer sessionId = -1; 26 | } 27 | 28 | @Override 29 | protected OStorageRemoteSession initialValue() { 30 | return new OStorageRemoteSession(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /client/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: orient-database-enterprise.jar -------------------------------------------------------------------------------- /commons/lib/testng-5.10-jdk15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/lib/testng-5.10-jdk15.jar -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/collection/OAlwaysGreaterKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.collection; 17 | 18 | /** 19 | * Key that is used in {@link OMVRBTree} for partial composite key search. 20 | * It always greater than any passed in key. 21 | * 22 | * @author Andrey Lomakin 23 | * @since 20.03.12 24 | */ 25 | public final class OAlwaysGreaterKey implements Comparable>{ 26 | public int compareTo(Comparable o) { 27 | return 1; 28 | } 29 | } -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/collection/OAlwaysLessKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.collection; 17 | 18 | /** 19 | * Key that is used in {@link OMVRBTree} for partial composite key search. 20 | * It always lesser than any passed in key. 21 | * 22 | * @author Andrey Lomakin 23 | * @since 20.03.12 24 | */ 25 | public final class OAlwaysLessKey implements Comparable> { 26 | public int compareTo(Comparable o) { 27 | return -1; 28 | } 29 | } -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/collection/OLazyIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.collection; 17 | 18 | import java.util.Iterator; 19 | 20 | /** 21 | * Generic interface for lazy iterators allowing the update of current value. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public interface OLazyIterator extends Iterator { 27 | public T update(T iValue); 28 | } 29 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/collection/OLazyIteratorListWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.collection; 17 | 18 | import java.util.ListIterator; 19 | 20 | /** 21 | * Lazy iterator implementation based on List Iterator. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public class OLazyIteratorListWrapper implements OLazyIterator { 27 | private ListIterator underlying; 28 | 29 | public OLazyIteratorListWrapper(ListIterator iUnderlying) { 30 | underlying = iUnderlying; 31 | } 32 | 33 | public boolean hasNext() { 34 | return underlying.hasNext(); 35 | } 36 | 37 | public T next() { 38 | return underlying.next(); 39 | } 40 | 41 | public void remove() { 42 | underlying.remove(); 43 | } 44 | 45 | public T update(T e) { 46 | underlying.set(e); 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/ONeedRetryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | /** 21 | * Abstract base exception to extend for all the exception that report to the user it has been thrown but re-executing it could 22 | * succeed. 23 | * 24 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 25 | * 26 | */ 27 | public abstract class ONeedRetryException extends OException { 28 | private static final long serialVersionUID = 1L; 29 | 30 | public ONeedRetryException() { 31 | super(); 32 | } 33 | 34 | public ONeedRetryException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public ONeedRetryException(String message) { 39 | super(message); 40 | } 41 | 42 | public ONeedRetryException(Throwable cause) { 43 | super(cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/OTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur; 17 | 18 | 19 | /** 20 | * Timeout exception. The acquiring of a shared resource caused a timeout. 21 | * 22 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 23 | * 24 | */ 25 | public class OTimeoutException extends ONeedRetryException { 26 | private static final long serialVersionUID = 1L; 27 | 28 | public OTimeoutException() { 29 | super(); 30 | } 31 | 32 | public OTimeoutException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public OTimeoutException(String message) { 37 | super(message); 38 | } 39 | 40 | public OTimeoutException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/lock/OLockException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.lock; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | import com.orientechnologies.common.profiler.OProfiler; 20 | 21 | public class OLockException extends OException { 22 | private static final long serialVersionUID = 2215169397325875189L; 23 | 24 | public OLockException(String iMessage) { 25 | super(iMessage); 26 | OProfiler.getInstance().updateCounter("system.concurrency.OLockException", +1); 27 | } 28 | 29 | public OLockException(String iMessage, Exception iException) { 30 | super(iMessage, iException); 31 | OProfiler.getInstance().updateCounter("system.concurrency.OLockException", +1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/lock/OModificationOperationProhibitedException.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.concur.lock; 2 | 3 | import com.orientechnologies.common.exception.OException; 4 | 5 | /** 6 | * Exception is thrown in case DB is locked for modifications but modification request ist trying to be acquired. 7 | * 8 | * @author Andrey Lomakin 9 | * @since 03.07.12 10 | */ 11 | public class OModificationOperationProhibitedException extends OException { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public OModificationOperationProhibitedException() { 15 | } 16 | 17 | public OModificationOperationProhibitedException(String message) { 18 | super(message); 19 | } 20 | 21 | public OModificationOperationProhibitedException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public OModificationOperationProhibitedException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OCloseable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.resource; 17 | 18 | public interface OCloseable { 19 | public void close(); 20 | } 21 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/ONotSharedResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.resource; 17 | 18 | /** 19 | * Not shared resource. No lock is managed. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public class ONotSharedResource { 25 | protected void acquireSharedLock() { 26 | } 27 | 28 | protected void releaseSharedLock() { 29 | } 30 | 31 | protected void acquireExclusiveLock() { 32 | } 33 | 34 | protected void releaseExclusiveLock() { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OResourcePoolListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.resource; 17 | 18 | public interface OResourcePoolListener { 19 | 20 | /** 21 | * Creates a new resource to be used and to be pooled when the client finishes with it. 22 | * 23 | * @return The new resource 24 | */ 25 | public V createNewResource(K iKey, Object... iAdditionalArgs); 26 | 27 | /** 28 | * Reuses the pooled resource. 29 | * 30 | * @return true if can be reused, otherwise false. In this case the resource will be removed from the pool 31 | */ 32 | public boolean reuseResource(K iKey, Object[] iAdditionalArgs, V iValue); 33 | } 34 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OSharedContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.resource; 17 | 18 | import java.util.concurrent.Callable; 19 | 20 | /** 21 | * Shared container interface that works with callbacks like closures. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public interface OSharedContainer { 27 | public boolean existsResource(final String iName); 28 | 29 | public T removeResource(final String iName); 30 | 31 | public T getResource(final String iName, final Callable iCallback); 32 | } 33 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OSharedResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.concur.resource; 17 | 18 | /** 19 | * Shared resource interface. Implementations can acquire and release shared and exclusive locks. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OSharedResource { 25 | void acquireSharedLock(); 26 | 27 | void releaseSharedLock(); 28 | 29 | void acquireExclusiveLock(); 30 | 31 | void releaseExclusiveLock(); 32 | } 33 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OSharedResourceExternal.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.concur.resource; 2 | 3 | public class OSharedResourceExternal extends OSharedResourceAbstract implements OSharedResource { 4 | 5 | @Override 6 | public void acquireExclusiveLock() { 7 | super.acquireExclusiveLock(); 8 | } 9 | 10 | @Override 11 | public void acquireSharedLock() { 12 | super.acquireSharedLock(); 13 | } 14 | 15 | @Override 16 | public void releaseExclusiveLock() { 17 | super.releaseExclusiveLock(); 18 | } 19 | 20 | @Override 21 | public void releaseSharedLock() { 22 | super.releaseSharedLock(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/concur/resource/OSharedResourceExternalTimeout.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.concur.resource; 2 | 3 | import com.orientechnologies.common.concur.OTimeoutException; 4 | 5 | public class OSharedResourceExternalTimeout extends OSharedResourceTimeout { 6 | 7 | public OSharedResourceExternalTimeout(final int timeout) { 8 | super(timeout); 9 | } 10 | 11 | @Override 12 | public void acquireExclusiveLock() throws OTimeoutException { 13 | super.acquireExclusiveLock(); 14 | } 15 | 16 | @Override 17 | public void acquireSharedLock() throws OTimeoutException { 18 | super.acquireSharedLock(); 19 | } 20 | 21 | @Override 22 | public void releaseExclusiveLock() { 23 | super.releaseExclusiveLock(); 24 | } 25 | 26 | @Override 27 | public void releaseSharedLock() { 28 | super.releaseSharedLock(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/console/DefaultConsoleReader.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.console; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | public class DefaultConsoleReader implements OConsoleReader { 8 | final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 9 | 10 | public String readLine() { 11 | try { 12 | return reader.readLine(); 13 | } catch (IOException e) { 14 | return null; 15 | } 16 | } 17 | 18 | public OConsoleApplication getConsole() { 19 | return null; 20 | } 21 | 22 | public void setConsole(OConsoleApplication console) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/console/OConsoleCommandCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Orient Technologies. 3 | * Copyright 2012 Geomatys. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.common.console; 18 | 19 | import com.orientechnologies.common.console.annotation.ConsoleCommand; 20 | 21 | /** 22 | * Commun interface for addtitional console commands. 23 | * Instances of this class are discovered throught serviceLoaders. 24 | * It should be declared in file : 25 | * META-INF/services/com.orientechnologies.common.console.OConsoleCommandCollection 26 | * 27 | * This interface is empty, all wanted commands are expected to be annoted with 28 | * {@link ConsoleCommand}. 29 | * 30 | * @author Johann Sorel (Geomatys) 31 | */ 32 | public abstract class OConsoleCommandCollection { 33 | 34 | protected OConsoleApplication context; 35 | 36 | void setContext(OConsoleApplication context){ 37 | this.context = context; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/console/OConsoleReader.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.console; 2 | 3 | public interface OConsoleReader { 4 | public String readLine(); 5 | 6 | public void setConsole(OConsoleApplication console); 7 | 8 | public OConsoleApplication getConsole(); 9 | } 10 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/console/annotation/ConsoleCommand.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.console.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface ConsoleCommand { 11 | String[] aliases() default {}; 12 | 13 | String description() default ""; 14 | 15 | boolean splitInWords() default true; 16 | } 17 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/console/annotation/ConsoleParameter.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.console.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.PARAMETER) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface ConsoleParameter { 11 | String name() default ""; 12 | 13 | String description() default ""; 14 | 15 | boolean optional() default false; 16 | } 17 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/exception/OException.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.exception; 2 | 3 | public class OException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 3882447822497861424L; 6 | 7 | public OException() { 8 | } 9 | 10 | public OException(final String message) { 11 | super(message); 12 | } 13 | 14 | public OException(final Throwable cause) { 15 | super(cause); 16 | } 17 | 18 | public OException(final String message, final Throwable cause) { 19 | super(message, cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/factory/ODynamicFactory.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.factory; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class ODynamicFactory { 7 | protected Map registry = new HashMap(); 8 | 9 | public V get(K iKey) { 10 | return registry.get(iKey); 11 | } 12 | 13 | public void register(K iKey, V iValue) { 14 | registry.put(iKey, iValue); 15 | } 16 | 17 | public void unregister(K iKey) { 18 | registry.remove(iKey); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/factory/ODynamicFactoryInverse.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.factory; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class ODynamicFactoryInverse extends ODynamicFactory { 7 | protected Map inverseRegistry = new HashMap(); 8 | 9 | public K getInverse(V iValue) { 10 | return inverseRegistry.get(iValue); 11 | } 12 | 13 | @Override 14 | public void register(K iKey, V iValue) { 15 | super.register(iKey, iValue); 16 | inverseRegistry.put(iValue, iKey); 17 | } 18 | 19 | @Override 20 | public void unregister(K iKey) { 21 | V value = get(iKey); 22 | if (value == null) 23 | return; 24 | super.unregister(iKey); 25 | inverseRegistry.remove(value); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/io/OIOException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.io; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OIOException extends OException { 21 | 22 | private static final long serialVersionUID = -3003977236203691448L; 23 | 24 | public OIOException(String string) { 25 | super(string); 26 | } 27 | 28 | public OIOException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/listener/OProgressListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.listener; 17 | 18 | /** 19 | * Listener interface called on task execution. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OProgressListener { 25 | public void onBegin(Object iTask, long iTotal); 26 | 27 | public boolean onProgress(Object iTask, long iCounter, float iPercent); 28 | 29 | public void onCompletition(Object iTask, boolean iSucceed); 30 | } 31 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/parser/OVariableParserListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2008 Luca Garulli (luca.garulli--at--assetdata.it) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.parser; 17 | 18 | /** 19 | * Wake up at every variable found. 20 | * 21 | * @author Luca Garulli (luca.garulli--at--assetdata.it 22 | * 23 | */ 24 | public interface OVariableParserListener { 25 | public String resolve(String iVariable); 26 | } 27 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/profiler/OProfilerMBean.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.profiler; 2 | 3 | import java.util.Date; 4 | 5 | public interface OProfilerMBean { 6 | 7 | // ---------------------------------------------------------------------------- 8 | public void updateCounter(String iStatName, long iPlus); 9 | 10 | // ---------------------------------------------------------------------------- 11 | public long getCounter(String iStatName); 12 | 13 | public String dump(); 14 | 15 | public String dumpCounters(); 16 | 17 | // ---------------------------------------------------------------------------- 18 | /** 19 | * Resetta i contatori statistici e i chrono. 20 | */ 21 | public void reset(); 22 | 23 | // ---------------------------------------------------------------------------- 24 | /** 25 | * Fa partire un nuovo chrono. 26 | */ 27 | public long startChrono(); 28 | 29 | // ---------------------------------------------------------------------------- 30 | /** 31 | * Ferma un chrono con nome . 32 | */ 33 | public long stopChrono(String iName, long iStartTime); 34 | 35 | public String dumpChronos(); 36 | 37 | public String[] getCountersAsString(); 38 | 39 | public String[] getChronosAsString(); 40 | 41 | public Date getLastReset(); 42 | 43 | public boolean isRecording(); 44 | 45 | public OProfilerMBean startRecording(); 46 | 47 | public OProfilerMBean stopRecording(); 48 | } -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/thread/OPollerThread.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.thread; 2 | 3 | public abstract class OPollerThread extends OSoftThread { 4 | protected final long delay; 5 | 6 | public OPollerThread(final long iDelay) { 7 | delay = iDelay; 8 | } 9 | 10 | public OPollerThread(long iDelay, final ThreadGroup iThreadGroup) { 11 | super(iThreadGroup, OPollerThread.class.getSimpleName()); 12 | delay = iDelay; 13 | } 14 | 15 | public OPollerThread(final long iDelay, final String name) { 16 | super(name); 17 | delay = iDelay; 18 | } 19 | 20 | public OPollerThread(final long iDelay, final ThreadGroup group, final String name) { 21 | super(group, name); 22 | delay = iDelay; 23 | } 24 | 25 | @Override 26 | protected void afterExecution() throws InterruptedException { 27 | pauseCurrentThread(delay); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/types/OBinary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.types; 17 | 18 | /** 19 | * Binary wrapper to let to byte[] to be managed inside OrientDB where comparable is needed, like for indexes. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public class OBinary implements Comparable { 25 | private byte[] value; 26 | 27 | public OBinary(final byte[] buffer) { 28 | value = buffer; 29 | } 30 | 31 | public int compareTo(final OBinary o) { 32 | final int size = value.length; 33 | 34 | for (int i = 0; i < size; ++i) { 35 | if (value[i] > o.value[i]) 36 | return 1; 37 | else if (value[i] < o.value[i]) 38 | return -1; 39 | } 40 | return 0; 41 | } 42 | 43 | public byte[] toByteArray() { 44 | return value; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/types/ORef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.types; 17 | 18 | /** 19 | * Modifiable value. Point to the real value. Useful to pass in method as parameter, letting the method to change. A sort of void* 20 | * of C language. 21 | * 22 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 23 | * 24 | */ 25 | public class ORef { 26 | public T value; 27 | 28 | public ORef() { 29 | } 30 | 31 | public ORef(final T object) { 32 | this.value = object; 33 | } 34 | 35 | public ORef clear() { 36 | value = null; 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/util/OCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.util; 17 | 18 | /** 19 | * Generic callable interface that accepts a parameter. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OCallable { 25 | public RET call(PAR iArgument); 26 | } 27 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/util/OCaseIncentiveComparator.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.util; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Compares strings without taking into account their case. 7 | */ 8 | public class OCaseIncentiveComparator implements Comparator { 9 | public int compare(final String stringOne, final String stringTwo) { 10 | return stringOne.toLowerCase().compareTo(stringTwo.toLowerCase()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/util/OClassLoaderHelper.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.util; 2 | 3 | import java.util.Iterator; 4 | 5 | import com.wuman.spi.ServiceRegistry; 6 | 7 | public class OClassLoaderHelper { 8 | 9 | /** 10 | * Switch to the OrientDb classloader before lookups on ServiceRegistry for 11 | * implementation of the given Class. Useful under OSGI and generally under 12 | * applications where jars are loaded by another class loader 13 | * 14 | * @param clazz 15 | * the class to lookup foor 16 | * @return an Iterator on the class implementation 17 | */ 18 | public static synchronized Iterator lookupProviderWithOrientClassLoader(Class clazz) { 19 | 20 | return lookupProviderWithOrientClassLoader(clazz,OClassLoaderHelper.class.getClassLoader()); 21 | } 22 | 23 | public static synchronized Iterator lookupProviderWithOrientClassLoader(Class clazz,ClassLoader orientClassLoader) { 24 | 25 | ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); 26 | 27 | Thread.currentThread().setContextClassLoader(orientClassLoader); 28 | Iterator lookupProviders = ServiceRegistry.lookupProviders(clazz); 29 | Thread.currentThread().setContextClassLoader(origClassLoader); 30 | 31 | return lookupProviders; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /commons/src/main/java/com/orientechnologies/common/util/OService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.common.util; 17 | 18 | /** 19 | * Generic Service interface. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OService { 25 | public String getName(); 26 | 27 | public void startup(); 28 | 29 | public void shutdown(); 30 | } 31 | -------------------------------------------------------------------------------- /commons/src/test/java/com/orientechnologies/common/test/SpeedTest.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.test; 2 | 3 | 4 | public interface SpeedTest { 5 | public void cycle() throws Exception; 6 | 7 | public void init() throws Exception; 8 | 9 | public void deinit() throws Exception; 10 | 11 | public void beforeCycle() throws Exception; 12 | 13 | public void afterCycle() throws Exception; 14 | } 15 | -------------------------------------------------------------------------------- /commons/src/test/java/com/orientechnologies/common/test/SpeedTestMonoThread.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.test; 2 | 3 | public abstract class SpeedTestMonoThread extends SpeedTestAbstract { 4 | protected SpeedTestMonoThread() { 5 | } 6 | 7 | protected SpeedTestMonoThread(final long iCycles) { 8 | super(iCycles); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /commons/src/test/java/com/orientechnologies/common/test/SpeedTestMultiThreads.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.test; 2 | 3 | import org.testng.annotations.Test; 4 | 5 | @Test(enabled = false) 6 | public abstract class SpeedTestMultiThreads extends SpeedTestAbstract { 7 | protected Class threadClass; 8 | protected int threads; 9 | protected long threadCycles; 10 | 11 | protected SpeedTestMultiThreads(long iCycles, int iThreads, Class iThreadClass) { 12 | super(1); 13 | threadClass = iThreadClass; 14 | threads = iThreads; 15 | threadCycles = iCycles; 16 | } 17 | 18 | @Override 19 | public void cycle() throws InterruptedException { 20 | SpeedTestThread[] ts = new SpeedTestThread[threads]; 21 | SpeedTestThread t; 22 | for (int i = 0; i < threads; ++i) 23 | try { 24 | t = threadClass.newInstance(); 25 | ts[i] = t; 26 | 27 | t.setOwner(this); 28 | t.setCycles(threadCycles / threads); 29 | t.start(); 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | return; 33 | } 34 | 35 | for (int i = 0; i < threads; ++i) { 36 | ts[i].join(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /commons/src/test/java/com/orientechnologies/common/test/SpeedTestThread.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.common.test; 2 | 3 | public abstract class SpeedTestThread extends Thread implements SpeedTest { 4 | protected SpeedTestData data; 5 | protected SpeedTestMultiThreads owner; 6 | 7 | protected SpeedTestThread() { 8 | data = new SpeedTestData(); 9 | } 10 | 11 | protected SpeedTestThread(long iCycles) { 12 | data = new SpeedTestData(iCycles); 13 | } 14 | 15 | public void setCycles(long iCycles) { 16 | data.cycles = iCycles; 17 | } 18 | 19 | public void setOwner(SpeedTestMultiThreads iOwner) { 20 | owner = iOwner; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | data.printResults = false; 26 | data.go(this); 27 | } 28 | 29 | public void init() throws Exception { 30 | } 31 | 32 | public void deinit() throws Exception { 33 | } 34 | 35 | public void afterCycle() throws Exception { 36 | } 37 | 38 | public void beforeCycle() throws Exception { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | com.wu-man 8 | orientdb-android-parent 9 | 1.1.0.2-SNAPSHOT 10 | ../ 11 | 12 | 13 | orientdb-android-core 14 | 15 | OrientDB Core 16 | 17 | 18 | * 19 | com.orientechnologies.orient.core.* 20 | 21 | 22 | 23 | 24 | com.wu-man 25 | orient-android-commons 26 | ${project.version} 27 | 28 | 29 | 30 | org.testng 31 | testng 32 | 5.14.1 33 | test 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/OConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core; 17 | 18 | public class OConstants { 19 | public static final String ORIENT_VERSION = "1.1.0"; 20 | public static final String ORIENT_URL = "www.orientechnologies.com"; 21 | 22 | public static String getVersion() { 23 | final StringBuilder buffer = new StringBuilder(); 24 | buffer.append(OConstants.ORIENT_VERSION); 25 | 26 | final String buildNumber = System.getProperty("orientdb.build.number"); 27 | 28 | if (buildNumber != null) { 29 | buffer.append(" (build "); 30 | buffer.append(buildNumber); 31 | buffer.append(")"); 32 | } 33 | 34 | return buffer.toString(); 35 | } 36 | 37 | public static String getBuildNumber() { 38 | final String buildNumber = System.getProperty("orientdb.build.number"); 39 | if (buildNumber == null) 40 | return null; 41 | 42 | return buildNumber; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/OOrientListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core; 17 | 18 | import com.orientechnologies.orient.core.storage.OStorage; 19 | 20 | /** 21 | * Listener Interface for basic Orient events. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public interface OOrientListener { 27 | 28 | public void onStorageRegistered(final OStorage iStorage); 29 | 30 | public void onStorageUnregistered(final OStorage iStorage); 31 | 32 | public void onShutdown(); 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/OrientShutdownHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core; 17 | 18 | public class OrientShutdownHook extends Thread { 19 | protected OrientShutdownHook() { 20 | Runtime.getRuntime().addShutdownHook(this); 21 | } 22 | 23 | /** 24 | * Shutdown Orient engine. 25 | */ 26 | @Override 27 | public void run() { 28 | Orient.instance().shutdown(); 29 | } 30 | 31 | public void cancel() { 32 | try { 33 | Runtime.getRuntime().removeShutdownHook(this); 34 | } catch (IllegalStateException e) { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Tells the way OrientDB should bind the field. By default OrientDB searches for getter and setter. If they are not present, then 26 | * the field is accessed directly. Using this annotation, instead, forces the field level access. Use this if you want by-pass 27 | * getter and setter methods. 28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.FIELD) 32 | public @interface OAccess { 33 | public enum OAccessType { 34 | FIELD, PROPERTY 35 | } 36 | 37 | public OAccessType value() default OAccessType.PROPERTY; 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OAfterDeserialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Documented 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target(ElementType.METHOD) 27 | /** 28 | * Tells to OrientDB to call the method AFTER the record is read and unmarshalled from database. 29 | * Applies only to the entity Objects reachable by the OrientDB engine after have registered them. 30 | */ 31 | public @interface OAfterDeserialization { 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OAfterSerialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Documented 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target(ElementType.METHOD) 27 | /** 28 | * Tells to OrientDB to call the method AFTER the record is marshalled and written to the database. 29 | * Applies only to the entity Objects reachable by the OrientDB engine after have registered them. 30 | */ 31 | public @interface OAfterSerialization { 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OBeforeDeserialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Documented 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target(ElementType.METHOD) 27 | /** 28 | * Tells to OrientDB to call the method BEFORE the record is read and unmarshalled from database. 29 | * Applies only to the entity Objects reachable by the OrientDB engine after have registered them. 30 | */ 31 | public @interface OBeforeDeserialization { 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OBeforeSerialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Documented 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target(ElementType.METHOD) 27 | /** 28 | * Tells to OrientDB to call the method BEFORE the record is marshalled and written to the database. 29 | * Applies only to the entity Objects reachable by the OrientDB engine after have registered them. 30 | */ 31 | public @interface OBeforeSerialization { 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/ODocumentInstance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Tells that the field contains the embedded document bound to the POJO. Default is FALSE. 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.FIELD) 30 | public @interface ODocumentInstance { 31 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Tells that the field contains the RecordID. This is needed when you work with detached object graph. OrientDb will use this field 26 | * to know the Document bound across different database instances. 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.FIELD) 31 | public @interface OId { 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/annotation/OVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Tells that the field contains the Document version. This is needed when you work with detached object graph and transactions. 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.FIELD) 30 | public @interface OVersion { 31 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | 19 | /** 20 | * Generic GOF command pattern implementation. 21 | * 22 | * @author Luca Garulli 23 | * 24 | * @param 25 | */ 26 | public interface OCommand { 27 | /** 28 | * Executes command. 29 | * 30 | * @return The result of command if any, otherwise null 31 | */ 32 | public Object execute(); 33 | 34 | public OCommandContext getContext(); 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Basic interface for commands. Manages the context variables during execution. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public interface OCommandContext { 27 | public Object getVariable(final String iName); 28 | 29 | public void setVariable(final String iName, final Object iValue); 30 | 31 | public Map getVariables(); 32 | 33 | public void merge(OCommandContext context); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandDistributedConditionalReplicateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | /** 19 | * Generic tagged interface to determine at runtime if the command must be replicated among all the servers. 20 | * 21 | * @author Luca Garulli 22 | */ 23 | public interface OCommandDistributedConditionalReplicateRequest extends OCommandDistributedReplicateRequest { 24 | 25 | public boolean isReplicated(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandDistributedReplicateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | /** 19 | * Generic tagged interface to know if the command must be distributed in clustered scenario. 20 | * 21 | * @author Luca Garulli 22 | */ 23 | public interface OCommandDistributedReplicateRequest { 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandOutputListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | /** 19 | * Receives callback from a command as output. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OCommandOutputListener { 25 | public void onMessage(String iText); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orientechnologies.orient.core.command; 18 | 19 | import com.orientechnologies.orient.core.record.ORecord; 20 | 21 | /** 22 | * Command predicate to be evaluated against a record and a context. 23 | * 24 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 25 | * 26 | */ 27 | public interface OCommandPredicate { 28 | /** 29 | * Evaluates the predicate. 30 | * 31 | * @param iRecord 32 | * Target record 33 | * @param iContext 34 | * Context of execution 35 | * @return true or false 36 | */ 37 | public boolean evaluate(final ORecord iRecord, final OCommandContext iContext); 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.orientechnologies.orient.core.command; 18 | 19 | /** 20 | * Base command processing class. 21 | * 22 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 23 | * 24 | */ 25 | public abstract class OCommandProcess { 26 | protected final C command; 27 | protected final T target; 28 | 29 | /** 30 | * Create the process defining command and target. 31 | */ 32 | public OCommandProcess(final C iCommand, final T iTarget) { 33 | command = iCommand; 34 | target = iTarget; 35 | } 36 | 37 | public abstract R process(); 38 | 39 | public T getTarget() { 40 | return target; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return target.toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandRequestAsynch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | public interface OCommandRequestAsynch { 19 | public OCommandResultListener getResultListener(); 20 | 21 | public void setResultListener(OCommandResultListener iListener); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandRequestText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | import com.orientechnologies.orient.core.serialization.OSerializableStream; 19 | 20 | /** 21 | * Internal specialization of generic OCommand interface. 22 | * 23 | * @author Luca Garulli 24 | * 25 | * @param 26 | */ 27 | public interface OCommandRequestText extends OCommandRequestInternal, OSerializableStream { 28 | public String getText(); 29 | 30 | public OCommandRequestText setText(String iText); 31 | 32 | public OCommandContext getContext(); 33 | 34 | public OCommandRequestText setContext(final OCommandContext iContext); 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/OCommandResultListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command; 17 | 18 | /** 19 | * Callback interface called when the command returns results. 20 | * 21 | * @author Luca Garulli 22 | * 23 | */ 24 | public interface OCommandResultListener { 25 | public boolean result(Object iRecord); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraverseAbstractProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.command.traverse; 17 | 18 | import com.orientechnologies.orient.core.command.OCommandProcess; 19 | import com.orientechnologies.orient.core.db.record.OIdentifiable; 20 | 21 | public abstract class OTraverseAbstractProcess extends OCommandProcess { 22 | public OTraverseAbstractProcess(final OTraverse iCommand, final T iTarget) { 23 | super(iCommand, iTarget); 24 | command.getContext().push(this); 25 | } 26 | 27 | public abstract String getStatus(); 28 | 29 | public OIdentifiable drop() { 30 | command.getContext().pop(); 31 | return null; 32 | } 33 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OAbstractStorageClusterConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | public abstract class OAbstractStorageClusterConfiguration implements OStorageClusterConfiguration { 19 | public int id; 20 | public String name; 21 | public String location; 22 | protected int dataSegmentId; 23 | 24 | public OAbstractStorageClusterConfiguration(final String name, final int id, final int iDataSegmentId) { 25 | this.name = name; 26 | this.id = id; 27 | this.dataSegmentId = iDataSegmentId; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | public void setId(final int iId) { 39 | id = iId; 40 | } 41 | 42 | public int getDataSegmentId() { 43 | return dataSegmentId; 44 | } 45 | 46 | public String getLocation() { 47 | return location; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OConfigurationChangeCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | /** 19 | * Interface of actions to call in case of change of the configuration. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface OConfigurationChangeCallback { 25 | public void change(final Object iCurrentValue, final Object iNewValue); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OStorageClusterConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | public interface OStorageClusterConfiguration { 19 | 20 | public int getId(); 21 | 22 | public String getName(); 23 | 24 | public String getLocation(); 25 | 26 | public int getDataSegmentId(); 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OStorageClusterHoleConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | public class OStorageClusterHoleConfiguration extends OStorageFileConfiguration { 19 | private static final long serialVersionUID = 1L; 20 | 21 | private static final String DEF_EXTENSION = ".och"; 22 | private static final String DEF_INCREMENT_SIZE = "50%"; 23 | 24 | public OStorageClusterHoleConfiguration() { 25 | super(); 26 | } 27 | 28 | public OStorageClusterHoleConfiguration(OStorageSegmentConfiguration iParent, String iPath, String iType, String iMaxSize) { 29 | super(iParent, iPath + DEF_EXTENSION, iType, iMaxSize, DEF_INCREMENT_SIZE); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OStorageDataHoleConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | public class OStorageDataHoleConfiguration extends OStorageFileConfiguration { 19 | private static final long serialVersionUID = 1L; 20 | 21 | private static final String DEF_EXTENSION = ".odh"; 22 | private static final String DEF_INCREMENT_SIZE = "50%"; 23 | 24 | public OStorageDataHoleConfiguration() { 25 | } 26 | 27 | public OStorageDataHoleConfiguration(OStorageSegmentConfiguration iParent, String iPath, String iType, String iMaxSize) { 28 | super(iParent, iPath + DEF_EXTENSION, iType, iMaxSize, DEF_INCREMENT_SIZE); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OStorageEntryConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | import java.io.Serializable; 19 | 20 | @SuppressWarnings("serial") 21 | public class OStorageEntryConfiguration implements Serializable { 22 | public String name; 23 | public String value; 24 | 25 | public OStorageEntryConfiguration() { 26 | } 27 | 28 | public OStorageEntryConfiguration(final String iName, final String iValue) { 29 | name = iName; 30 | value = iValue; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/config/OStorageMemoryClusterConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.config; 17 | 18 | public class OStorageMemoryClusterConfiguration extends OAbstractStorageClusterConfiguration { 19 | public OStorageMemoryClusterConfiguration(final String name, final int id, final int iDataSegmentId) { 20 | super(name, id, iDataSegmentId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/ODataSegmentStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db; 17 | 18 | import com.orientechnologies.orient.core.record.ORecord; 19 | 20 | /** 21 | * Strategy interface to assign a data-segment to a new record. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public interface ODataSegmentStrategy { 27 | 28 | /** 29 | * Tells to the database in what data segment put the new record. Default strategy always use data segment 0 (default). 30 | * 31 | * @param iDatabase 32 | * Database instance 33 | * @param iRecord 34 | * Record istance 35 | * @return The data segment id 36 | */ 37 | public int assignDataSegmentId(ODatabase iDatabase, ORecord iRecord); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseLifecycleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db; 17 | 18 | /** 19 | * Listener Interface to receive callbacks on database usage. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface ODatabaseLifecycleListener { 25 | 26 | public void onOpen(ODatabase iDatabase); 27 | 28 | public void onClose(ODatabase iDatabase); 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/ODatabasePooled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db; 17 | 18 | /** 19 | * Basic interface for pooled database implementations. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface ODatabasePooled { 25 | 26 | /** 27 | * Reuses current instance. 28 | * 29 | * @param iOwner 30 | * @param iAdditionalArgs 31 | */ 32 | public void reuse(final Object iOwner, final Object[] iAdditionalArgs); 33 | 34 | /** 35 | * Tells if the underlying database is closed. 36 | */ 37 | public boolean isUnderlyingOpen(); 38 | 39 | /** 40 | * Force closing the current instance avoiding to being reused. 41 | */ 42 | public void forceClose(); 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseSchemaAware.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db; 17 | 18 | /** 19 | * Generic interface for record based Database implementations with schema concept. 20 | * 21 | * @author Luca Garulli 22 | * 23 | */ 24 | public interface ODatabaseSchemaAware extends ODatabaseComplex { 25 | /** 26 | * Creates a new entity instance. Each database implementation will return the right type. 27 | * 28 | * @return The new instance. 29 | */ 30 | public RET newInstance(String iClassName); 31 | 32 | /** 33 | * Counts the entities contained in the specified class. 34 | * 35 | * @param iClassName 36 | * Class name 37 | * @return Total entities 38 | */ 39 | public long countClass(String iClassName); 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectListInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.db.object; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OLazyObjectListInterface extends List { 26 | 27 | public void setConvertToRecord(boolean convertToRecord); 28 | 29 | public boolean isConverted(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMapInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.db.object; 18 | 19 | import java.util.Map; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OLazyObjectMapInterface extends Map { 26 | 27 | public void setConvertToRecord(boolean convertToRecord); 28 | 29 | public boolean isConverted(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMultivalueElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.db.object; 18 | 19 | /** 20 | * @author luca.molino 21 | * 22 | */ 23 | public interface OLazyObjectMultivalueElement { 24 | 25 | public void detach(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectSetInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.db.object; 18 | 19 | import java.util.Set; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OLazyObjectSetInterface extends Set { 26 | 27 | public void setConvertToRecord(boolean convertToRecord); 28 | 29 | public boolean isConverted(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseBinary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | import com.orientechnologies.orient.core.record.impl.ORecordBytes; 19 | 20 | /** 21 | * Binary specialization of transactional database. 22 | * 23 | */ 24 | public class ODatabaseBinary extends ODatabaseRecordTx { 25 | 26 | public ODatabaseBinary(String iURL) { 27 | super(iURL, ORecordBytes.RECORD_TYPE); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/ODetachable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | /** 19 | * Objects of this class can be detached. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface ODetachable { 25 | /** 26 | * Detaches the object. 27 | * 28 | * @return true if the object has been fully detached, otherwise false 29 | */ 30 | public boolean detach(); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/OIdentifiable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | import java.util.Comparator; 19 | 20 | import com.orientechnologies.orient.core.id.ORID; 21 | import com.orientechnologies.orient.core.record.ORecord; 22 | 23 | /** 24 | * Base interface for identifiable objects. This abstraction is required to use ORID and ORecord in many points. 25 | * 26 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 27 | * 28 | */ 29 | public interface OIdentifiable extends Comparable, Comparator { 30 | /** 31 | * Returns the record identity. 32 | * 33 | * @return ORID instance 34 | */ 35 | public ORID getIdentity(); 36 | 37 | /** 38 | * Returns the record instance. 39 | * 40 | * @return ORecord instance 41 | */ 42 | public > T getRecord(); 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/OMultiValueChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | /** 19 | * Listen operations that are performed on tracked collection. 20 | * 21 | * @param Value that indicates position of item inside collection. 22 | * @param Item value. 23 | */ 24 | public interface OMultiValueChangeListener { 25 | /** 26 | * Called when operation on collection is completed. 27 | * 28 | * @param event Operation description. 29 | */ 30 | public void onAfterRecordChanged(OMultiValueChangeEvent event); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/OProxedResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal; 19 | 20 | /** 21 | * Generic proxy abstratc class. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | public abstract class OProxedResource { 27 | protected T delegate; 28 | protected ODatabaseRecord database; 29 | 30 | public OProxedResource(final T iDelegate, final ODatabaseRecord iDatabase) { 31 | this.delegate = iDelegate; 32 | this.database = iDatabase; 33 | } 34 | 35 | protected void setCurrentDatabaseInThreadLocal() { 36 | ODatabaseRecordThreadLocal.INSTANCE.set(database); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | /** 19 | * 20 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 21 | * 22 | */ 23 | public interface ORecordLazyListener { 24 | public void onLazyLoad(); 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyMultiValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.db.record; 17 | 18 | import java.util.Iterator; 19 | 20 | public interface ORecordLazyMultiValue extends ODetachable { 21 | public Iterator rawIterator(); 22 | 23 | /** 24 | * Browse all the set to convert all the items into records. 25 | */ 26 | public void convertLinks2Records(); 27 | 28 | /** 29 | * Browse all the set to convert all the items into links. 30 | * 31 | * @return 32 | */ 33 | public boolean convertRecords2Links(); 34 | 35 | public boolean isAutoConvertToRecord(); 36 | 37 | public void setAutoConvertToRecord(boolean convertToRecord); 38 | 39 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExportException.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.core.db.tool; 2 | 3 | @SuppressWarnings("serial") 4 | public class ODatabaseExportException extends RuntimeException { 5 | 6 | public ODatabaseExportException() { 7 | super(); 8 | } 9 | 10 | public ODatabaseExportException(String message, Throwable cause) { 11 | super(message, cause); 12 | } 13 | 14 | public ODatabaseExportException(String message) { 15 | super(message); 16 | } 17 | 18 | public ODatabaseExportException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseImportException.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.core.db.tool; 2 | 3 | @SuppressWarnings("serial") 4 | public class ODatabaseImportException extends RuntimeException { 5 | 6 | public ODatabaseImportException() { 7 | super(); 8 | } 9 | 10 | public ODatabaseImportException(String message, Throwable cause) { 11 | super(message, cause); 12 | } 13 | 14 | public ODatabaseImportException(String message) { 15 | super(message); 16 | } 17 | 18 | public ODatabaseImportException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/engine/OEngine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.engine; 17 | 18 | import java.util.Map; 19 | 20 | import com.orientechnologies.orient.core.storage.OStorage; 21 | 22 | public interface OEngine { 23 | 24 | public String getName(); 25 | 26 | public OStorage createStorage(String iURL, Map parameters); 27 | 28 | public void removeStorage(OStorage iStorage); 29 | 30 | public boolean isShared(); 31 | 32 | public void shutdown(); 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/engine/OEngineAbstract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.engine; 17 | 18 | import java.util.Map; 19 | 20 | import com.orientechnologies.orient.core.storage.OStorage; 21 | 22 | public abstract class OEngineAbstract implements OEngine { 23 | 24 | protected String getMode(Map iConfiguration) { 25 | String dbMode = null; 26 | if (iConfiguration != null) 27 | dbMode = iConfiguration.get("mode"); 28 | 29 | if (dbMode == null) 30 | dbMode = "rw"; 31 | return dbMode; 32 | } 33 | 34 | public void shutdown() { 35 | } 36 | 37 | public void removeStorage(final OStorage iStorage) { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/entity/OEntityManagerInternal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.entity; 17 | 18 | public class OEntityManagerInternal extends OEntityManager { 19 | public static final OEntityManagerInternal INSTANCE = new OEntityManagerInternal(); 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OCommandExecutionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OCommandExecutionException extends OException { 21 | 22 | private static final long serialVersionUID = -7430575036316163711L; 23 | 24 | public OCommandExecutionException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public OCommandExecutionException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OConfigurationException extends OException { 21 | 22 | private static final long serialVersionUID = -8486291378415776372L; 23 | 24 | public OConfigurationException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public OConfigurationException(String message) { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/ODatabaseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class ODatabaseException extends OException { 21 | 22 | private static final long serialVersionUID = -2655748565531836968L; 23 | 24 | public ODatabaseException(String string) { 25 | super(string); 26 | } 27 | 28 | public ODatabaseException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OFetchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.exception; 18 | 19 | import com.orientechnologies.common.exception.OException; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public class OFetchException extends OException { 26 | private static final long serialVersionUID = 7247597939953323863L; 27 | 28 | public OFetchException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | public OFetchException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OGraphException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OGraphException extends OException { 21 | 22 | private static final long serialVersionUID = -2655748565531836968L; 23 | 24 | public OGraphException(String string) { 25 | super(string); 26 | } 27 | 28 | public OGraphException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/ORecordNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class ORecordNotFoundException extends OException { 21 | 22 | private static final long serialVersionUID = -265573123216968L; 23 | 24 | public ORecordNotFoundException(final String string) { 25 | super(string); 26 | } 27 | 28 | public ORecordNotFoundException(final String message, final Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OSchemaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OSchemaException extends OException { 21 | 22 | private static final long serialVersionUID = -8486291378415776372L; 23 | 24 | public OSchemaException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public OSchemaException(String message) { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OSecurityAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | 19 | public class OSecurityAccessException extends OSecurityException { 20 | 21 | private static final long serialVersionUID = -8486291378415776372L; 22 | private String databaseName; 23 | 24 | public OSecurityAccessException(final String iDatabasename, final String message, final Throwable cause) { 25 | super(message, cause); 26 | databaseName = iDatabasename; 27 | } 28 | 29 | public OSecurityAccessException(final String iDatabasename, final String message) { 30 | super(message); 31 | databaseName = iDatabasename; 32 | } 33 | 34 | public OSecurityAccessException(final String message) { 35 | super(message); 36 | } 37 | 38 | public String getDatabaseName() { 39 | return databaseName; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OSecurityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | /** 21 | * Generic Security exception. Used in cryptography. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | * 25 | */ 26 | @SuppressWarnings("serial") 27 | public class OSecurityException extends OException { 28 | 29 | public OSecurityException(final String message, final Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | public OSecurityException(final String message) { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OSerializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OSerializationException extends OException { 21 | 22 | private static final long serialVersionUID = -3003977236233691448L; 23 | 24 | public OSerializationException(String string) { 25 | super(string); 26 | } 27 | 28 | public OSerializationException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OStorageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OStorageException extends OException { 21 | 22 | private static final long serialVersionUID = -2655748565531836968L; 23 | 24 | public OStorageException(String string) { 25 | super(string); 26 | } 27 | 28 | public OStorageException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OTransactionAbortedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | public class OTransactionAbortedException extends OTransactionException { 19 | 20 | private static final long serialVersionUID = 2347493191705052402L; 21 | 22 | public OTransactionAbortedException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public OTransactionAbortedException(String message) { 27 | super(message); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OTransactionBlockedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | public class OTransactionBlockedException extends OTransactionException { 19 | 20 | private static final long serialVersionUID = 2347493191705052402L; 21 | 22 | public OTransactionBlockedException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public OTransactionBlockedException(String message) { 27 | super(message); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OTransactionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OTransactionException extends OException { 21 | 22 | private static final long serialVersionUID = 2347493191705052402L; 23 | 24 | public OTransactionException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public OTransactionException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/exception/OValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.exception; 17 | 18 | @SuppressWarnings("serial") 19 | public class OValidationException extends RuntimeException { 20 | 21 | public OValidationException(String string) { 22 | super(string); 23 | } 24 | 25 | public OValidationException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/hook/ORecordHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.hook; 17 | 18 | import com.orientechnologies.orient.core.record.ORecord; 19 | 20 | /** 21 | * Hook interface to catch all events regarding records. 22 | * 23 | * @author Luca Garulli 24 | * @see ORecordHookAbstract 25 | * 26 | */ 27 | public interface ORecordHook { 28 | public enum TYPE { 29 | ANY, BEFORE_CREATE, BEFORE_READ, BEFORE_UPDATE, BEFORE_DELETE, AFTER_CREATE, AFTER_READ, AFTER_UPDATE, AFTER_DELETE, UPDATE_FAILED, CREATE_FAILED, DELETE_FAILED 30 | }; 31 | 32 | public boolean onTrigger(TYPE iType, ORecord iRecord); 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/index/OIndexCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.index; 17 | 18 | import com.orientechnologies.orient.core.record.impl.ODocument; 19 | 20 | public interface OIndexCallback { 21 | Object getDocumentValueToIndex(ODocument iDocument); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/index/OIndexException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.index; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OIndexException extends OException { 21 | 22 | private static final long serialVersionUID = -2655748565531836968L; 23 | 24 | public OIndexException(final String string) { 25 | super(string); 26 | } 27 | 28 | public OIndexException(final String message, final Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/index/OIndexFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.index; 17 | 18 | import java.util.Set; 19 | 20 | import com.orientechnologies.orient.core.db.record.ODatabaseRecord; 21 | import com.orientechnologies.orient.core.exception.OConfigurationException; 22 | 23 | public interface OIndexFactory { 24 | 25 | /** 26 | * @return List of supported indexes of this factory 27 | */ 28 | Set getTypes(); 29 | 30 | /** 31 | * 32 | * @param iDatabase 33 | * @param iIndexType 34 | * index type 35 | * @return OIndexInternal 36 | * @throws OConfigurationException 37 | * if index creation failed 38 | */ 39 | OIndexInternal createIndex(ODatabaseRecord iDatabase, String iIndexType) throws OConfigurationException; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/index/OIndexNotUnique.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.index; 17 | 18 | import com.orientechnologies.orient.core.metadata.schema.OClass; 19 | 20 | /** 21 | * Index implementation that allows multiple values for the same key. 22 | * 23 | * @author Luca Garulli 24 | * 25 | */ 26 | public class OIndexNotUnique extends OIndexMultiValues { 27 | 28 | public static final String TYPE_ID = OClass.INDEX_TYPE.NOTUNIQUE.toString(); 29 | 30 | public OIndexNotUnique() { 31 | super(TYPE_ID); 32 | } 33 | 34 | public boolean canBeUsedInEqualityOperators() { 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/index/OIndexTxAwareDictionary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.index; 17 | 18 | import com.orientechnologies.orient.core.db.record.ODatabaseRecord; 19 | import com.orientechnologies.orient.core.db.record.OIdentifiable; 20 | 21 | /** 22 | * Transactional wrapper for dictionary index. Stores changes locally to the transaction until tx.commit(). All the other operations 23 | * are delegated to the wrapped OIndex instance. 24 | * 25 | * @author Luca Garulli 26 | * 27 | */ 28 | public class OIndexTxAwareDictionary extends OIndexTxAwareOneValue { 29 | public OIndexTxAwareDictionary(ODatabaseRecord iDatabase, OIndex iDelegate) { 30 | super(iDatabase, iDelegate); 31 | } 32 | 33 | @Override 34 | public void checkEntry(final OIdentifiable iRecord, final Object iKey) { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/intent/OIntent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.intent; 17 | 18 | import com.orientechnologies.orient.core.db.raw.ODatabaseRaw; 19 | 20 | /** 21 | * Intents aim to define common use case in order to optimize the execution. 22 | * 23 | * @author Luca Garulli 24 | * 25 | */ 26 | public interface OIntent { 27 | /** 28 | * Activate the intent. 29 | * 30 | * @param iDatabase 31 | * Database where to activate it 32 | * @param iArgs 33 | * Additional, optional arguments 34 | */ 35 | public void begin(ODatabaseRaw iDatabase, Object... iArgs); 36 | 37 | /** 38 | * Activate the intent. 39 | * 40 | * @param iDatabase 41 | * Database where to activate it 42 | * @param iArgs 43 | * Additional, optional arguments 44 | */ 45 | public void end(ODatabaseRaw iDatabase); 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/intent/OIntentMassiveRead.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.core.intent; 2 | 3 | import com.orientechnologies.orient.core.db.raw.ODatabaseRaw; 4 | 5 | public class OIntentMassiveRead implements OIntent { 6 | public void begin(final ODatabaseRaw iDatabase, final Object... iArgs) { 7 | } 8 | 9 | public void end(final ODatabaseRaw iDatabase) { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/iterator/OEmptyIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.iterator; 17 | 18 | import java.util.Iterator; 19 | import java.util.Map; 20 | 21 | public class OEmptyIterator implements Iterator> { 22 | public static final OEmptyIterator INSTANCE = new OEmptyIterator(); 23 | 24 | public boolean hasNext() { 25 | return false; 26 | } 27 | 28 | public Map.Entry next() { 29 | return null; 30 | } 31 | 32 | public void remove() { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/iterator/OIterationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.iterator; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class OIterationException extends OException { 21 | 22 | private static final long serialVersionUID = 2347493191705052402L; 23 | 24 | public OIterationException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public OIterationException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClassInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.iterator.object; 18 | 19 | import java.util.Iterator; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OObjectIteratorClassInterface extends Iterator, Iterable { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClusterInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.core.iterator.object; 18 | 19 | import java.util.Iterator; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OObjectIteratorClusterInterface extends Iterator, Iterable { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/memory/OLowMemoryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.memory; 17 | 18 | /** 19 | * Exception to signal a low memory condition on classes able to handle it. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public class OLowMemoryException extends RuntimeException { 25 | private static final long serialVersionUID = 1L; 26 | 27 | public OLowMemoryException() { 28 | super(); 29 | } 30 | 31 | public OLowMemoryException(final String message) { 32 | super(message); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Core package. 4 | 5 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/query/OQueryContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.query; 17 | 18 | import com.orientechnologies.orient.core.record.impl.ODocument; 19 | 20 | public class OQueryContext { 21 | protected ODocument initialRecord; 22 | protected OQuery sourceQuery; 23 | 24 | public void setRecord(final ODocument iRecord) { 25 | this.initialRecord = iRecord; 26 | } 27 | 28 | public void setSourceQuery(final OQuery sourceQuery) { 29 | this.sourceQuery = sourceQuery; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/record/ORecordListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.record; 17 | 18 | /** 19 | * Listener interface to catch all the record events. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface ORecordListener { 25 | public enum EVENT { 26 | CLEAR, RESET, MARSHALL, UNMARSHALL, UNLOAD, IDENTITY_CHANGED 27 | } 28 | 29 | public void onEvent(ORecord iDocument, EVENT iEvent); 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/record/ORecordPositional.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.record; 17 | 18 | import java.util.Iterator; 19 | 20 | /** 21 | * Generic record representation without a schema definition. The object can be reused across call to the database. 22 | */ 23 | public interface ORecordPositional extends ORecordInternal, Iterator { 24 | public E field(int iIndex); 25 | 26 | public ORecordPositional field(int iIndex, Object iValue); 27 | 28 | public int size(); 29 | 30 | public ORecordPositional add(Object iValue); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/record/ORecordStringable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.record; 17 | 18 | /** 19 | * Generic record representation without a schema definition. The object can be reused across call to the database. 20 | */ 21 | public interface ORecordStringable { 22 | 23 | public String value(); 24 | 25 | public ORecordStringable value(String iValue); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/object/OObjectSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.object; 17 | 18 | public interface OObjectSerializer { 19 | public Object serializeFieldValue(Class iClass, LOCAL_TYPE iFieldValue); 20 | 21 | public Object unserializeFieldValue(Class iClass, DB_TYPE iFieldValue); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/OSerializableRecordPositional.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.record; 17 | 18 | import com.orientechnologies.orient.core.record.ORecordPositional; 19 | 20 | public interface OSerializableRecordPositional { 21 | public void toStream(ORecordPositional iRecord); 22 | 23 | public void fromStream(ORecordPositional iRecord); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/OSerializationThreadLocal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.record; 17 | 18 | import java.util.HashSet; 19 | import java.util.Set; 20 | 21 | public class OSerializationThreadLocal extends ThreadLocal> { 22 | public static OSerializationThreadLocal INSTANCE = new OSerializationThreadLocal(); 23 | 24 | @Override 25 | protected Set initialValue() { 26 | return new HashSet(); 27 | } 28 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.stream; 17 | 18 | import java.io.IOException; 19 | 20 | public interface OStreamSerializer { 21 | public byte[] toStream(Object iObject) throws IOException; 22 | 23 | public Object fromStream(byte[] iStream) throws IOException; 24 | 25 | public String getName(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerInteger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.stream; 17 | 18 | import java.io.IOException; 19 | 20 | import com.orientechnologies.orient.core.serialization.OBinaryProtocol; 21 | 22 | public class OStreamSerializerInteger implements OStreamSerializer { 23 | public static final String NAME = "i"; 24 | 25 | public static final OStreamSerializerInteger INSTANCE = new OStreamSerializerInteger(); 26 | 27 | public String getName() { 28 | return NAME; 29 | } 30 | 31 | public Object fromStream(final byte[] iStream) throws IOException { 32 | return OBinaryProtocol.bytes2int(iStream); 33 | } 34 | 35 | public byte[] toStream(final Object iObject) throws IOException { 36 | return OBinaryProtocol.int2bytes((Integer) iObject); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerLong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.stream; 17 | 18 | import java.io.IOException; 19 | 20 | import com.orientechnologies.orient.core.serialization.OBinaryProtocol; 21 | 22 | public class OStreamSerializerLong implements OStreamSerializer { 23 | public static final String NAME = "lo"; 24 | 25 | public static final OStreamSerializerLong INSTANCE = new OStreamSerializerLong(); 26 | 27 | public String getName() { 28 | return NAME; 29 | } 30 | 31 | public Object fromStream(final byte[] iStream) throws IOException { 32 | return OBinaryProtocol.bytes2long(iStream); 33 | } 34 | 35 | public byte[] toStream(final Object iObject) throws IOException { 36 | return OBinaryProtocol.long2bytes((Long) iObject); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.stream; 17 | 18 | import java.io.IOException; 19 | 20 | import com.orientechnologies.orient.core.serialization.OBinaryProtocol; 21 | 22 | public class OStreamSerializerString implements OStreamSerializer { 23 | public static final String NAME = "s"; 24 | 25 | public static final OStreamSerializerString INSTANCE = new OStreamSerializerString(); 26 | 27 | public String getName() { 28 | return NAME; 29 | } 30 | 31 | public Object fromStream(final byte[] iStream) throws IOException { 32 | return OBinaryProtocol.bytes2string(iStream); 33 | } 34 | 35 | public byte[] toStream(final Object iObject) throws IOException { 36 | return OBinaryProtocol.string2bytes((String) iObject); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringBuilderSerializable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.string; 17 | 18 | import com.orientechnologies.orient.core.exception.OSerializationException; 19 | 20 | public interface OStringBuilderSerializable { 21 | public OStringBuilderSerializable toStream(StringBuilder iOutput) throws OSerializationException; 22 | 23 | public OStringBuilderSerializable fromStream(StringBuilder iInput) throws OSerializationException; 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.serialization.serializer.string; 17 | 18 | public interface OStringSerializer { 19 | public StringBuilder toStream(StringBuilder iOutput, Object iSource); 20 | 21 | public Object fromStream(String iSource); 22 | 23 | public String getName(); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Orient Technologies. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql; 17 | 18 | import java.util.Set; 19 | 20 | import com.orientechnologies.orient.core.exception.OCommandExecutionException; 21 | 22 | /** 23 | * Factory to register new OCommandExecutorSQL. 24 | * 25 | * @author Johann Sorel (Geomatys) 26 | */ 27 | public interface OCommandExecutorSQLFactory { 28 | 29 | /** 30 | * @return Set of supported command names of this factory 31 | */ 32 | public Set getCommandNames(); 33 | 34 | /** 35 | * Create command for the given name. returned command may be a new instance each time or a constant. 36 | * 37 | * @param name 38 | * @return OCommandExecutorSQLAbstract : created command 39 | * @throws OCommandExecutionException 40 | * : when command creation fail 41 | */ 42 | public OCommandExecutorSQLAbstract createCommand(String name) throws OCommandExecutionException; 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLResultsetDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql; 17 | 18 | import java.util.Iterator; 19 | 20 | import com.orientechnologies.orient.core.db.record.OIdentifiable; 21 | 22 | /** 23 | * SQL UPDATE command. 24 | * 25 | * @author Luca Garulli 26 | * 27 | */ 28 | @SuppressWarnings("unchecked") 29 | public class OCommandExecutorSQLResultsetDelegate extends OCommandExecutorSQLDelegate implements Iterable { 30 | 31 | public Iterator iterator() { 32 | return ((OCommandExecutorSQLResultsetAbstract) delegate).iterator(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/OCommandSQL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql; 17 | 18 | import com.orientechnologies.orient.core.command.OCommandRequestTextAbstract; 19 | 20 | /** 21 | * SQL command request implementation. It just stores the request and delegated the execution to the configured OCommandExecutor. 22 | * 23 | * @author Luca Garulli 24 | * 25 | */ 26 | @SuppressWarnings("serial") 27 | public class OCommandSQL extends OCommandRequestTextAbstract { 28 | public OCommandSQL() { 29 | } 30 | 31 | public OCommandSQL(final String iText) { 32 | super(iText); 33 | } 34 | 35 | public boolean isIdempotent() { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/OCommandSQLResultset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql; 17 | 18 | /** 19 | * Iterable SQL command request implementation. 20 | * 21 | * @author Luca Garulli 22 | * 23 | */ 24 | @SuppressWarnings("serial") 25 | public class OCommandSQLResultset extends OCommandSQL { 26 | public OCommandSQLResultset() { 27 | } 28 | 29 | public OCommandSQLResultset(final String iText) { 30 | super(iText); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLFilterItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql.filter; 17 | 18 | import com.orientechnologies.orient.core.command.OCommandContext; 19 | import com.orientechnologies.orient.core.db.record.OIdentifiable; 20 | 21 | /** 22 | * Represent a value inside a query condition. 23 | * 24 | * @author Luca Garulli 25 | * 26 | */ 27 | public interface OSQLFilterItem { 28 | 29 | public Object getValue(OIdentifiable iRecord, OCommandContext iContetx); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Geomatys. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql.functions; 17 | 18 | import com.orientechnologies.orient.core.exception.OCommandExecutionException; 19 | import java.util.Set; 20 | 21 | /** 22 | * 23 | * @author Johann Sorel (Geomatys) 24 | */ 25 | public interface OSQLFunctionFactory { 26 | 27 | /** 28 | * @return Set of supported function names of this factory 29 | */ 30 | Set getFunctionNames(); 31 | 32 | /** 33 | * Create function for the given name. 34 | * returned function may be a new instance each time or a constant. 35 | * @param name 36 | * @return OSQLFunction : created function 37 | * @throws OCommandExecutionException : when function creation fail 38 | */ 39 | OSQLFunction createFunction(String name) throws OCommandExecutionException; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Orient Technologies. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.sql.operator; 17 | 18 | import java.util.Set; 19 | 20 | /** 21 | * Factory to register new OqueryOperators. 22 | * 23 | * @author Johann Sorel (Geomatys) 24 | */ 25 | public interface OQueryOperatorFactory { 26 | 27 | /** 28 | * @return set of operators 29 | */ 30 | Set getOperators(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/OClusterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage; 17 | 18 | import com.orientechnologies.orient.core.config.OStorageClusterConfiguration; 19 | 20 | public interface OClusterFactory { 21 | OCluster createCluster(String iType); 22 | 23 | OCluster createCluster(OStorageClusterConfiguration iConfig); 24 | 25 | String[] getSupported(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/ODataSegment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage; 17 | 18 | import java.io.IOException; 19 | 20 | /** 21 | * Stores the record content. 22 | * 23 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 24 | */ 25 | public interface ODataSegment { 26 | public String getName(); 27 | 28 | public int getId(); 29 | 30 | /** 31 | * Returns the size of the cluster in bytes. 32 | * 33 | * @return 34 | */ 35 | public long getSize(); 36 | 37 | public void drop() throws IOException; 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/ORecordCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage; 17 | 18 | import com.orientechnologies.orient.core.id.ORecordId; 19 | 20 | /** 21 | * Callback to handle response against record operations. 22 | * 23 | * @author Luca Garulli 24 | * 25 | */ 26 | public interface ORecordCallback { 27 | public enum OPERATION { 28 | CREATE, READ, UPDATE, DELETE 29 | } 30 | 31 | public void call(ORecordId iRID, T iParameter); 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/ORecordLockManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage; 17 | 18 | import com.orientechnologies.common.concur.lock.OLockManager; 19 | import com.orientechnologies.orient.core.config.OGlobalConfiguration; 20 | import com.orientechnologies.orient.core.id.ORID; 21 | 22 | /** 23 | * Record lock manager. 24 | * 25 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 26 | * 27 | */ 28 | public class ORecordLockManager extends OLockManager { 29 | 30 | public ORecordLockManager(final int iAcquireTimeout) { 31 | super(OGlobalConfiguration.ENVIRONMENT_CONCURRENT.getValueAsBoolean(), iAcquireTimeout); 32 | } 33 | 34 | @Override 35 | protected ORID getImmutableResourceId(ORID iResourceId) { 36 | return iResourceId.copy(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/OStorageProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage; 17 | 18 | /** 19 | * Tagged interface for proxy storage implementation 20 | * 21 | * @author Luca Garulli 22 | * 23 | */ 24 | public interface OStorageProxy extends OStorage { 25 | } -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerAbstract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage.fs; 17 | 18 | /** 19 | * @author Artem Loginov (logart) logart2007@gmail.com Date: 6/4/12 Time: 2:05 PM 20 | *

21 | * This class contains some basic method for all mmap managers. For example release mapped buffers. 22 | */ 23 | public abstract class OMMapManagerAbstract implements OMMapManager { 24 | /** 25 | * {@inheritDoc} 26 | */ 27 | public void release(OMMapBufferEntry[] entries, OPERATION_TYPE operationType) { 28 | for (int i = entries.length - 1; i >= 0; --i) { 29 | if (OPERATION_TYPE.WRITE.equals(operationType)) 30 | entries[i].releaseWriteLock(); 31 | else 32 | entries[i].releaseReadLock(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OSegment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.storage.impl.local; 17 | 18 | 19 | public abstract class OSegment { 20 | protected OStorageLocal storage; 21 | protected String name; 22 | 23 | public OSegment(final OStorageLocal iStorage, final String iName) { 24 | storage = iStorage; 25 | name = iName; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/TestSimulateError.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.core.storage.impl.local; 2 | 3 | public class TestSimulateError { 4 | 5 | public static TestSimulateError onDataLocalWriteRecord; 6 | 7 | public static boolean onDataLocalWriteRecord(ODataLocal iODataLocal, long[] iFilePosition, int iClusterSegment, 8 | long iClusterPosition, byte[] iContent) { 9 | if (onDataLocalWriteRecord != null) 10 | return onDataLocalWriteRecord.checkDataLocalWriteRecord(iODataLocal, iFilePosition, iClusterSegment, iClusterPosition, 11 | iContent); 12 | return true; 13 | } 14 | 15 | public boolean checkDataLocalWriteRecord(ODataLocal iODataLocal, long[] iFilePosition, int iClusterSegment, 16 | long iClusterPosition, byte[] iContent) { 17 | return true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains all the class involved on the "local" implementation of the OStorage interface. The OStorageLocal store record into the disk 4 | using OClusterLocal and ODataLocal classes. Physical clusters need separate files. Access is faster than the logical cluster but the database size is 5 | higher and more files are requires. This matters in some OS where a single process has limitation for the number of files can open. Most accessed 6 | entities should be stored inside a physical cluster. 7 | 8 | 9 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/storage/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains the Storage interface and the basic implementations. 4 | 5 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/tx/OTxListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.tx; 17 | 18 | import com.orientechnologies.orient.core.db.record.ORecordOperation; 19 | 20 | 21 | /** 22 | * Listener interface to catch events during transactions phases. 23 | * 24 | * @author Luca Garulli 25 | * 26 | */ 27 | public interface OTxListener { 28 | public enum EVENT { 29 | BEFORE_COMMIT, AFTER_COMMIT, BEFORE_ROLLBACK, AFTER_ROLLBACK 30 | } 31 | 32 | public void onEvent(ORecordOperation iTxEntry, EVENT iEvent); 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/orientechnologies/orient/core/type/tree/provider/OIdentityChangedListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.core.type.tree.provider; 17 | 18 | import com.orientechnologies.orient.core.id.ORID; 19 | 20 | /** 21 | * Listener that is called when identity of the {@link OMVRBTreeEntryDataProvider} was changed. 22 | */ 23 | public interface OIdentityChangedListener { 24 | public void onIdentityChanged(ORID rid); 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: orient-common.jar -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/com.orientechnologies.orient.core.index.OIndexFactory: -------------------------------------------------------------------------------- 1 | com.orientechnologies.orient.core.index.OMVRBIndexFactory -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/com.orientechnologies.orient.core.sql.OCommandExecutorSQLFactory: -------------------------------------------------------------------------------- 1 | com.orientechnologies.orient.core.sql.ODefaultCommandExecutorSQLFactory 2 | com.orientechnologies.orient.core.sql.ODynamicSQLElementFactory -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/com.orientechnologies.orient.core.sql.functions.OSQLFunctionFactory: -------------------------------------------------------------------------------- 1 | com.orientechnologies.orient.core.sql.functions.ODefaultSQLFunctionFactory 2 | com.orientechnologies.orient.core.sql.ODynamicSQLElementFactory -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/com.orientechnologies.orient.core.sql.operator.OQueryOperatorFactory: -------------------------------------------------------------------------------- 1 | com.orientechnologies.orient.core.sql.operator.ODefaultQueryOperatorFactory 2 | com.orientechnologies.orient.core.sql.ODynamicSQLElementFactory -------------------------------------------------------------------------------- /doc/images/orientdb-android-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/doc/images/orientdb-android-logo.png -------------------------------------------------------------------------------- /enterprise/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | com.wu-man 8 | orientdb-android-parent 9 | 1.1.0.2-SNAPSHOT 10 | 11 | 12 | orientdb-android-enterprise 13 | 14 | OrientDB Enterprise 15 | 16 | 17 | * 18 | com.orientechnologies.orient.enterprise.* 19 | 20 | 21 | 22 | 23 | com.wu-man 24 | orientdb-android-core 25 | ${project.version} 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /enterprise/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinaryClientSynch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.enterprise.channel.binary; 17 | 18 | import java.io.IOException; 19 | 20 | import com.orientechnologies.orient.core.config.OContextConfiguration; 21 | 22 | /** 23 | * Single requester client implementation. 24 | * 25 | * @author Luca 26 | * 27 | */ 28 | public class OChannelBinaryClientSynch extends OChannelBinaryClient { 29 | 30 | public OChannelBinaryClientSynch(final String remoteHost, final int remotePort, final OContextConfiguration iConfig) 31 | throws IOException { 32 | super(remoteHost, remotePort, iConfig, OChannelBinaryProtocol.CURRENT_PROTOCOL_VERSION); 33 | } 34 | } -------------------------------------------------------------------------------- /enterprise/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/ONetworkProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.enterprise.channel.binary; 17 | 18 | import com.orientechnologies.common.exception.OException; 19 | 20 | public class ONetworkProtocolException extends OException { 21 | 22 | private static final long serialVersionUID = -2655748565531836968L; 23 | 24 | public ONetworkProtocolException(String string) { 25 | super(string); 26 | } 27 | 28 | public ONetworkProtocolException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /enterprise/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/ORemoteServerEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.enterprise.channel.binary; 17 | 18 | /** 19 | * Listener Interface to get called when asynchronous events are received from the remote server. 20 | * 21 | * @author Luca Garulli (l.garulli--at--orientechnologies.com) 22 | * 23 | */ 24 | public interface ORemoteServerEventListener { 25 | public void onRequest(final byte iRequestCode, Object obj); 26 | } 27 | -------------------------------------------------------------------------------- /enterprise/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: orient-database-core.jar -------------------------------------------------------------------------------- /nativeos/lib/jna-3.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/nativeos/lib/jna-3.4.0.jar -------------------------------------------------------------------------------- /nativeos/lib/platform.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/nativeos/lib/platform.jar -------------------------------------------------------------------------------- /object/.gitignore: -------------------------------------------------------------------------------- 1 | *.svn 2 | *.class 3 | 4 | # Logs and databases # 5 | ###################### 6 | *.log 7 | 8 | # OS generated files # 9 | ###################### 10 | .DS_Store? 11 | ehthumbs.db 12 | Icon? 13 | Thumbs.db 14 | /target -------------------------------------------------------------------------------- /object/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/object/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar -------------------------------------------------------------------------------- /object/lib/javassist.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuman/orientdb-android/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/object/lib/javassist.jar -------------------------------------------------------------------------------- /object/script/console.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem Copyright (c) 1999-2011 Luca Garulli @www.orientechnologies.com 4 | rem 5 | rem Guess ORIENTDB_HOME if not defined 6 | set CURRENT_DIR=%cd% 7 | 8 | if exist "%JAVA_HOME%\bin\java.exe" goto setJavaHome 9 | set JAVA="java" 10 | goto okJava 11 | 12 | :setJavaHome 13 | set JAVA="%JAVA_HOME%\bin\java" 14 | 15 | :okJava 16 | if not "%ORIENTDB_HOME%" == "" goto gotHome 17 | set ORIENTDB_HOME=%CURRENT_DIR% 18 | if exist "%ORIENTDB_HOME%\bin\console.bat" goto okHome 19 | cd .. 20 | set ORIENTDB_HOME=%cd% 21 | cd %CURRENT_DIR% 22 | 23 | :gotHome 24 | if exist "%ORIENTDB_HOME%\bin\console.bat" goto okHome 25 | echo The ORIENTDB_HOME environment variable is not defined correctly 26 | echo This environment variable is needed to run this program 27 | goto end 28 | 29 | :okHome 30 | rem Get remaining unshifted command line arguments and save them in the 31 | set CMD_LINE_ARGS= 32 | 33 | :setArgs 34 | if ""%1""=="""" goto doneSetArgs 35 | set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 36 | shift 37 | goto setArgs 38 | 39 | :doneSetArgs 40 | 41 | call %JAVA% -client -Dfile.encoding=utf-8 -Dorientdb.build.number=@BUILD@ -jar "%ORIENTDB_HOME%\lib\orientdb-tools-@VERSION@.jar" %CMD_LINE_ARGS% 42 | 43 | :end 44 | -------------------------------------------------------------------------------- /object/script/console.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 1999-2010 Luca Garulli 4 | # 5 | 6 | # resolve links - $0 may be a softlink 7 | PRG="$0" 8 | 9 | while [ -h "$PRG" ]; do 10 | ls=`ls -ld "$PRG"` 11 | link=`expr "$ls" : '.*-> \(.*\)$'` 12 | if expr "$link" : '/.*' > /dev/null; then 13 | PRG="$link" 14 | else 15 | PRG=`dirname "$PRG"`/"$link" 16 | fi 17 | done 18 | 19 | # Get standard environment variables 20 | PRGDIR=`dirname "$PRG"` 21 | 22 | # Only set ORIENTDB_HOME if not already set 23 | [ -f "$ORIENTDB_HOME"/lib/orientdb-tools-@VERSION@.jar ] || ORIENTDB_HOME=`cd "$PRGDIR/.." ; pwd` 24 | export ORIENTDB_HOME 25 | 26 | # Only set ORIENTDB_HOME if not already set correctly 27 | 28 | java -client -Dfile.encoding=utf-8 -Dorientdb.build.number=@BUILD@ -jar $ORIENTDB_HOME/lib/orientdb-tools-@VERSION@.jar $* 29 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/db/OObjectNotDetachedException.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.object.db; 2 | 3 | @SuppressWarnings("serial") 4 | public class OObjectNotDetachedException extends RuntimeException { 5 | 6 | public OObjectNotDetachedException() { 7 | super(); 8 | } 9 | 10 | public OObjectNotDetachedException(String message, Throwable cause) { 11 | super(message, cause); 12 | } 13 | 14 | public OObjectNotDetachedException(String message) { 15 | super(message); 16 | } 17 | 18 | public OObjectNotDetachedException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/db/OObjectNotManagedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.object.db; 17 | 18 | @SuppressWarnings("serial") 19 | public class OObjectNotManagedException extends RuntimeException { 20 | 21 | public OObjectNotManagedException() { 22 | super(); 23 | } 24 | 25 | public OObjectNotManagedException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | public OObjectNotManagedException(String message) { 30 | super(message); 31 | } 32 | 33 | public OObjectNotManagedException(Throwable cause) { 34 | super(cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/enumerations/OLazyObjectEnumSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.object.enumerations; 18 | 19 | import com.orientechnologies.orient.core.db.object.OLazyObjectMultivalueElement; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OLazyObjectEnumSerializer extends OLazyObjectMultivalueElement { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAPersistenceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.object.jpa; 17 | 18 | import java.util.Map; 19 | 20 | import javax.persistence.EntityManagerFactory; 21 | import javax.persistence.spi.PersistenceProvider; 22 | import javax.persistence.spi.PersistenceUnitInfo; 23 | import javax.persistence.spi.ProviderUtil; 24 | 25 | @SuppressWarnings("rawtypes") 26 | public class OJPAPersistenceProvider implements PersistenceProvider { 27 | 28 | public EntityManagerFactory createEntityManagerFactory(String emName, Map map) { 29 | return OJPAEntityManagerFactory.getInstance(); 30 | } 31 | 32 | public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) { 33 | return OJPAEntityManagerFactory.getInstance(); 34 | } 35 | 36 | public ProviderUtil getProviderUtil() { 37 | throw new UnsupportedOperationException("getProviderUtil"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/serialization/OLazyObjectCustomSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2012 Luca Molino (molino.luca--AT--gmail.com) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.orientechnologies.orient.object.serialization; 18 | 19 | import com.orientechnologies.orient.core.db.object.OLazyObjectMultivalueElement; 20 | 21 | /** 22 | * @author luca.molino 23 | * 24 | */ 25 | public interface OLazyObjectCustomSerializer extends OLazyObjectMultivalueElement { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectSerializationThreadLocal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.orientechnologies.orient.object.serialization; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public class OObjectSerializationThreadLocal extends ThreadLocal> { 22 | public static OObjectSerializationThreadLocal INSTANCE = new OObjectSerializationThreadLocal(); 23 | 24 | @Override 25 | protected Map initialValue() { 26 | return new HashMap(); 27 | } 28 | } -------------------------------------------------------------------------------- /object/src/test/java/com/orientechnologies/orient/object/enhancement/AbstractEntity.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.object.enhancement; 2 | 3 | import com.orientechnologies.orient.core.annotation.OBeforeSerialization; 4 | 5 | /** 6 | * @author LomakiA Andrey Lomakin 7 | * @since 18.05.12 8 | */ 9 | public class AbstractEntity { 10 | private boolean before1Called = false; 11 | private boolean before2Called = false; 12 | 13 | public void reset() { 14 | before1Called = false; 15 | before2Called = false; 16 | } 17 | 18 | @OBeforeSerialization 19 | public void before1() { 20 | before1Called = true; 21 | } 22 | 23 | @OBeforeSerialization 24 | public void before2() { 25 | before2Called = true; 26 | } 27 | 28 | public boolean callbackExecuted() { 29 | return before1Called && before2Called; 30 | } 31 | } -------------------------------------------------------------------------------- /object/src/test/java/com/orientechnologies/orient/object/enhancement/ExactEntity.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.object.enhancement; 2 | 3 | import com.orientechnologies.orient.core.annotation.OBeforeSerialization; 4 | 5 | /** 6 | * @author LomakiA Andrey Lomakin 7 | * @since 18.05.12 8 | */ 9 | public class ExactEntity extends AbstractEntity { 10 | private boolean before3Called = false; 11 | 12 | public void reset() { 13 | super.reset(); 14 | before3Called = false; 15 | } 16 | 17 | @OBeforeSerialization 18 | public void before3() { 19 | before3Called = true; 20 | } 21 | 22 | @Override 23 | public boolean callbackExecuted() { 24 | return super.callbackExecuted() && before3Called; 25 | } 26 | } -------------------------------------------------------------------------------- /object/src/test/java/com/orientechnologies/orient/object/enhancement/OObjectEntitySerializerTest.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.object.enhancement; 2 | 3 | import com.orientechnologies.orient.object.db.OObjectDatabaseTx; 4 | import org.testng.annotations.*; 5 | 6 | import static org.testng.Assert.assertTrue; 7 | 8 | /** 9 | * @author LomakiA Andrey Lomakin 10 | * @since 18.05.12 11 | */ 12 | public class OObjectEntitySerializerTest { 13 | 14 | private OObjectDatabaseTx databaseTx; 15 | 16 | @BeforeClass 17 | protected void setUp() throws Exception { 18 | databaseTx = new OObjectDatabaseTx("memory:OObjectEntitySerializerTest"); 19 | databaseTx.create(); 20 | 21 | databaseTx.getEntityManager().registerEntityClass(ExactEntity.class); 22 | 23 | } 24 | 25 | @AfterClass 26 | protected void tearDown() { 27 | databaseTx.close(); 28 | } 29 | 30 | @Test 31 | public void testCallbacksHierarchy() { 32 | ExactEntity entity = new ExactEntity(); 33 | databaseTx.save(entity); 34 | 35 | assertTrue(entity.callbackExecuted()); 36 | } 37 | 38 | @Test 39 | public void testCallbacksHierarchyUpdate() { 40 | ExactEntity entity = new ExactEntity(); 41 | entity = databaseTx.save(entity); 42 | 43 | entity.reset(); 44 | databaseTx.save(entity); 45 | assertTrue(entity.callbackExecuted()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tools/script/console.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem Copyright (c) 1999-2011 Luca Garulli @www.orientechnologies.com 4 | rem 5 | rem Guess ORIENTDB_HOME if not defined 6 | set CURRENT_DIR=%cd% 7 | 8 | if exist "%JAVA_HOME%\bin\java.exe" goto setJavaHome 9 | set JAVA="java" 10 | goto okJava 11 | 12 | :setJavaHome 13 | set JAVA="%JAVA_HOME%\bin\java" 14 | 15 | :okJava 16 | if not "%ORIENTDB_HOME%" == "" goto gotHome 17 | set ORIENTDB_HOME=%CURRENT_DIR% 18 | if exist "%ORIENTDB_HOME%\bin\console.bat" goto okHome 19 | cd .. 20 | set ORIENTDB_HOME=%cd% 21 | cd %CURRENT_DIR% 22 | 23 | :gotHome 24 | if exist "%ORIENTDB_HOME%\bin\console.bat" goto okHome 25 | echo The ORIENTDB_HOME environment variable is not defined correctly 26 | echo This environment variable is needed to run this program 27 | goto end 28 | 29 | :okHome 30 | rem Get remaining unshifted command line arguments and save them in the 31 | set CMD_LINE_ARGS= 32 | 33 | :setArgs 34 | if ""%1""=="""" goto doneSetArgs 35 | set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 36 | shift 37 | goto setArgs 38 | 39 | :doneSetArgs 40 | 41 | set ORIENTDB_SETTINGS=-Dcache.level1.enabled=false -Dcache.level2.enabled=false 42 | call %JAVA% -client %ORIENTDB_SETTINGS% -Dfile.encoding=utf-8 -Dorientdb.build.number="@BUILD@" -cp "%ORIENTDB_HOME%\lib\*;" com.orientechnologies.orient.console.OConsoleDatabaseApp %CMD_LINE_ARGS% 43 | 44 | :end 45 | -------------------------------------------------------------------------------- /tools/script/console.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 1999-2010 Luca Garulli 4 | # 5 | 6 | # resolve links - $0 may be a softlink 7 | PRG="$0" 8 | 9 | while [ -h "$PRG" ]; do 10 | ls=`ls -ld "$PRG"` 11 | link=`expr "$ls" : '.*-> \(.*\)$'` 12 | if expr "$link" : '/.*' > /dev/null; then 13 | PRG="$link" 14 | else 15 | PRG=`dirname "$PRG"`/"$link" 16 | fi 17 | done 18 | 19 | # Get standard environment variables 20 | PRGDIR=`dirname "$PRG"` 21 | 22 | # Only set ORIENTDB_HOME if not already set 23 | [ -f "$ORIENTDB_HOME"/lib/orientdb-tools-@VERSION@.jar ] || ORIENTDB_HOME=`cd "$PRGDIR/.." ; pwd` 24 | export ORIENTDB_HOME 25 | 26 | ORIENTDB_SETTINGS="-Dcache.level1.enabled=false -Dcache.level2.enabled=false" 27 | #JAVA_OPTS=-Xmx1024m 28 | 29 | java -client $JAVA_OPTS $ORIENTDB_SETTINGS -Dfile.encoding=utf-8 -Dorientdb.build.number="@BUILD@" -cp "$ORIENTDB_HOME/lib/orientdb-tools-@VERSION@.jar:$ORIENTDB_HOME/lib/*" com.orientechnologies.orient.console.OConsoleDatabaseApp $* 30 | -------------------------------------------------------------------------------- /tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseListener.java: -------------------------------------------------------------------------------- 1 | package com.orientechnologies.orient.console; 2 | 3 | import com.orientechnologies.orient.core.db.ODatabase; 4 | import com.orientechnologies.orient.core.db.ODatabaseListener; 5 | 6 | public class OConsoleDatabaseListener implements ODatabaseListener { 7 | OConsoleDatabaseApp console; 8 | 9 | public OConsoleDatabaseListener(OConsoleDatabaseApp console) { 10 | this.console = console; 11 | } 12 | 13 | public void onCreate(ODatabase iDatabase) { 14 | } 15 | 16 | public void onDelete(ODatabase iDatabase) { 17 | } 18 | 19 | public void onOpen(ODatabase iDatabase) { 20 | } 21 | 22 | public void onBeforeTxBegin(ODatabase iDatabase) { 23 | } 24 | 25 | public void onBeforeTxRollback(ODatabase iDatabase) { 26 | } 27 | 28 | public void onAfterTxRollback(ODatabase iDatabase) { 29 | } 30 | 31 | public void onBeforeTxCommit(ODatabase iDatabase) { 32 | } 33 | 34 | public void onAfterTxCommit(ODatabase iDatabase) { 35 | } 36 | 37 | public void onClose(ODatabase iDatabase) { 38 | } 39 | 40 | public boolean onCorruptionRepairDatabase(ODatabase iDatabase, final String iProblem, String iWhatWillbeFixed) { 41 | final String answer = console.ask("\nDatabase seems corrupted:\n> " + iProblem + "\nAuto-repair will execute this action:\n> " 42 | + iWhatWillbeFixed + "\n\nDo you want to repair it (Y/n)? "); 43 | return answer.length() == 0 || answer.equalsIgnoreCase("Y") || answer.equalsIgnoreCase("Yes"); 44 | } 45 | } 46 | --------------------------------------------------------------------------------