コード例 #1
0
ファイル: TreeSet.java プロジェクト: virajb/datanucleus-core
  /**
   * Constructor, using the ObjectProvider of the "owner" and the field name.
   *
   * @param op The owner ObjectProvider
   * @param mmd Metadata for the member
   */
  public TreeSet(ObjectProvider op, AbstractMemberMetaData mmd) {
    super(op, mmd);

    ExecutionContext ec = op.getExecutionContext();
    allowNulls = SCOUtils.allowNullsInContainer(allowNulls, mmd);
    queued = ec.isDelayDatastoreOperationsEnabled();
    useCache = SCOUtils.useContainerCache(op, mmd);

    if (!SCOUtils.collectionHasSerialisedElements(mmd)
        && mmd.getPersistenceModifier() == FieldPersistenceModifier.PERSISTENT) {
      ClassLoaderResolver clr = ec.getClassLoaderResolver();
      this.backingStore =
          (SetStore)
              ((BackedSCOStoreManager) ec.getStoreManager())
                  .getBackingStoreForField(clr, mmd, java.util.TreeSet.class);
    }
    // Set up our delegate, using a suitable comparator
    Comparator comparator =
        SCOUtils.getComparator(mmd, op.getExecutionContext().getClassLoaderResolver());
    if (comparator != null) {
      this.delegate = new java.util.TreeSet(comparator);
    } else {
      this.delegate = new java.util.TreeSet();
    }

    if (NucleusLogger.PERSISTENCE.isDebugEnabled()) {
      NucleusLogger.PERSISTENCE.debug(
          SCOUtils.getContainerInfoMessage(
              op,
              ownerMmd.getName(),
              this,
              useCache,
              queued,
              allowNulls,
              SCOUtils.useCachedLazyLoading(op, ownerMmd)));
    }
  }
コード例 #2
0
 /**
  * Accessor for the current DatastoreService for this ExecutionContext. Each PM/EM has its own
  * DatastoreService.
  *
  * @param ec ExecutionContext
  * @return The DatastoreService
  */
 public DatastoreService getDatastoreService(ExecutionContext ec) {
   ManagedConnection mconn = ec.getStoreManager().getConnection(ec);
   return ((EmulatedXAResource) mconn.getXAResource()).getDatastoreService();
 }
コード例 #3
0
 /**
  * Accessor for the current DatastoreTransaction for this ExecutionContext. Each PM/EM has its own
  * DatastoreService, and consequently can have a current DatastoreTransaction.
  *
  * @param ec ExecutionContext
  * @return The DatastoreTransaction if active, or null
  */
 public DatastoreTransaction getDatastoreTransaction(ExecutionContext ec) {
   ManagedConnection mconn = ec.getStoreManager().getConnection(ec);
   return ((EmulatedXAResource) mconn.getXAResource()).getCurrentTransaction();
 }
コード例 #4
0
 public StoreManager getStoreManager() {
   return (myEC.getNucleusContext().isFederated()
       ? ((FederatedStoreManager) myEC.getStoreManager()).getStoreManagerForClass(cmd)
       : myEC.getStoreManager());
 }