Examples of ReferenceLink


Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

      ReferenceLinkGarbageException {
    for (int[] numberOfRefDef : numberOfReferencingList) {
      final DataRecordIdentifier referencedDataRecordIdentifier =
      /**/newDataRecordIdentifier(numberOfRefDef[0]);
      final int expectedNumberOfReferencing = numberOfRefDef[1];
      final ReferenceLink referenceLink = linkRecordManager
          .searchByReferenced(referencedDataRecordIdentifier);
      assertNotNull("reference link must exist for "
          + referencedDataRecordIdentifier, referenceLink);
      final int numberOfReferencing = referenceLink
          .getNumberOfReferencing();
      assertEquals("bad number of referencing",
          expectedNumberOfReferencing, numberOfReferencing);
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

        .getReferencingForReferenced(referencedDataRecordIdentifier);

    assertEquals(BAD_SIZE, 1, list.size());
    assertEquals("bad value", referencingDataRecordIdentifier, list.get(0));

    ReferenceLink referenceLink = linkRecordManager
        .searchByReferenced(referencedDataRecordIdentifier);
    int linkCount = referenceLink
        .getLinkCount(referencingDataRecordIdentifier);
    assertEquals("bad link count", 2, linkCount);

    removeReferenceLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);

    list = linkRecordManager
        .getReferencingForReferenced(referencedDataRecordIdentifier);

    assertEquals(BAD_SIZE, 1, list.size());

    referenceLink = linkRecordManager
        .searchByReferenced(referencedDataRecordIdentifier);
    linkCount = referenceLink.getLinkCount(referencingDataRecordIdentifier);
    assertEquals("bad link count", 1, linkCount);

  }
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

   */
  private void appendOrUpdateReferenceLink(
      final DataRecordIdentifier referencingDataRecordIdentifier,
      final DataRecordIdentifier referencedDataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final ReferenceLink referenceLink = linkRecordManager
        .searchByReferenced(referencedDataRecordIdentifier);
    if (referenceLink == null) {
      final ReferenceLink newReferenceLink = new ReferenceLink(
          referencedDataRecordIdentifier);
      newReferenceLink
          .updateLinkCount(referencingDataRecordIdentifier, 1);
      linkRecordManager.appendNewReferenceLink(newReferenceLink);
    } else {
      referenceLink.updateLinkCount(referencingDataRecordIdentifier, 1);
      linkRecordManager.updateReferenceLink(referenceLink);
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

  private boolean removeReferenceLink(
      final DataRecordIdentifier referencingDataRecordIdentifier,
      final DataRecordIdentifier referencedDataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final boolean removed;
    final ReferenceLink referenceLink = linkRecordManager
        .searchByReferenced(referencedDataRecordIdentifier);
    if (referenceLink.getNode() == null) {
      removed = false;
    } else {
      referenceLink.updateLinkCount(referencingDataRecordIdentifier, -1);
      if (referenceLink.getNumberOfReferencing() == 0) {
        linkRecordManager.deleteReferenceLink(referenceLink);
      }
      removed = true;
    }
    return removed;
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

  private void unlinkToReferenced(
      final DataRecordIdentifier referencingDataRecordIdentifier,
      final DataRecordIdentifier[] referencedList)
      throws GarbageException, ReferenceLinkGarbageException {
    for (DataRecordIdentifier referencedDataRecordIdentifier : referencedList) {
      final ReferenceLink referenceLink = linkRecordManager
          .searchByReferenced(referencedDataRecordIdentifier);
      if (referenceLink != null) {
        referenceLink.updateLinkCount(referencingDataRecordIdentifier,
            -1);
        if (referenceLink.getNumberOfReferencing() == 0) {
          /* if number of link is zero then it is to garbage */
          linkRecordManager.deleteReferenceLink(referenceLink);
          garbageCandidateRecordManager
              .removeCandidate(referencedDataRecordIdentifier);
          addToGarbage(referencedDataRecordIdentifier);
 
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

  }

  private void removeLink(final DataRecordIdentifier referencing,
      final DataRecordIdentifier referenced) throws GarbageException,
      ReferenceLinkGarbageException {
    final ReferenceLink referenceLink = linkRecordManager
        .searchByReferenced(referenced);
    if (referenceLink != null) {
      referenceLink.decrementLinkCount(referencing);
      linkRecordManager.updateReferenceLink(referenceLink);
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

   * @throws ReferenceLinkGarbageException
   */
  public ReferenceLink searchByReferenced(
      final DataRecordIdentifier referencedDataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final ReferenceLink referenceLink = new ReferenceLink(
        referencedDataRecordIdentifier);
    final GarbageReferenceLinkRBTNode node;
    final ReferenceLink foundReferenceLink;
    try {
      node = /**/(GarbageReferenceLinkRBTNode) garbageReferenceLinkTree
          .search(referenceLink);
      if (node == null) {
        foundReferenceLink = null;
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

   * @throws ReferenceLinkGarbageException
   */
  public void removeLink(
      final DataRecordIdentifier referencedDataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final ReferenceLink referenceLink =
    /**/searchByReferenced(referencedDataRecordIdentifier);
    /* can be already erased for to garbage */
    if (referenceLink.getNode() != null) {
      deleteReferenceLink(referenceLink);
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

   * @throws ReferenceLinkGarbageException
   */
  public void removeLinkIfExist(
      final DataRecordIdentifier referencedDataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final ReferenceLink referenceLink =
    /**/searchByReferenced(referencedDataRecordIdentifier);
    if (referenceLink != null) {
      deleteReferenceLink(referenceLink);
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.entity.garbage.ReferenceLink

   * @throws ReferenceLinkGarbageException
   */
  public boolean isReferenced(final DataRecordIdentifier dataRecordIdentifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final boolean isReferenced;
    final ReferenceLink referenceLink = new ReferenceLink(
        dataRecordIdentifier);
    try {
      isReferenced = (GarbageReferenceLinkRBTNode) garbageReferenceLinkTree
          .search(referenceLink) != null;
    } catch (RBTException exception) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.