Package org.openxri.store

Examples of org.openxri.store.StoreException


    File namespaceFile = this.getNamespaceFile(namespace);
    String authorityId;

    if (! namespaceFile.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Namespace does not exist.");
    }

    try {

      authorityId = FileStore.readLine(namespaceFile);
    } catch (Exception ex) {

      throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot find namespace.");
    }

    File authorityDir = this.getAuthorityDir(authorityId);

    if (! authorityDir.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Authority does not exist.");
    }

    FileAuthority authority = new FileAuthority(authorityDir);

    // done
View Full Code Here


    File authorityDir = this.getAuthorityDir(authority.getAuthorityId());

    if (! authorityDir.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Authority does not exist.");
    }

    File subSegmentDir = this.getSubSegmentDir(authorityDir, subSegmentName);

    if (! subSegmentDir.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Subsegment does not exist.");
    }

    SubSegment subSegment = new FileSubSegment(subSegmentDir);

    // done
View Full Code Here

      authority = DbAuthority.ByAuthorityId(session, authorityId);

      if (authority == null) {

        throw new StoreException(StoreException.KEY_NOTFOUND, "Authority does not exist.");
      }

      session.getTransaction().commit();
    } catch (StoreException ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw(ex);
    } catch (Exception ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot access database.");
    }

    // done

    log.trace("Done.");
View Full Code Here

    File authorityDir = this.getAuthorityDir(((FileSubSegment)subSegment).getAuthorityId());

    if (! authorityDir.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Authority does not exist.");
    }

    FileAuthority authority = new FileAuthority(authorityDir);

    // done
View Full Code Here

    File parentAuthorityDir = this.getAuthorityDir(((FileSubSegment)subSegment).getParentAuthorityId());

    if (! parentAuthorityDir.exists()) {

      throw new StoreException(StoreException.KEY_NOTFOUND, "Parent authority does not exist.");
    }

    FileAuthority parent = new FileAuthority(parentAuthorityDir);

    // done
View Full Code Here

    Session session = this.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    // check parent authority

    if (! (parentAuthority instanceof DbAuthority)) throw new StoreException(StoreException.KEY_NOTFOUND, "Parent authority is not from this store.");

    // find subsegment

    DbSubSegment subSegment;

    try {

      subSegment = DbSubSegment.ByParentAndName(session, (DbAuthority) parentAuthority, name);

      session.getTransaction().commit();
    } catch (Exception ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot access database.");
    }

    // done

    log.trace("Done.");
View Full Code Here

    try {

      refs = ((FileAuthority) authority).getRefs();
    } catch (Exception ex) {

      throw new StoreException(StoreException.KEY_DBERR, "Cannot read Refs.");
    }

    return(refs.toArray(new Ref[refs.size()]));
  }
View Full Code Here

    try {

      services = ((FileAuthority) authority).getServices();
    } catch (Exception ex) {

      throw new StoreException(StoreException.KEY_DBERR, "Cannot read Services.");
    }

    return(services.toArray(new Service[services.size()]));
  }
View Full Code Here

    Session session = this.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    // check subsegment

    if (! (subSegment instanceof DbSubSegment)) throw new StoreException(StoreException.KEY_NOTFOUND, "Subsegment is not from this store.");

    // get parent authority

    DbAuthority parentAuthority;

    try {

      reattach(session, subSegment);
      parentAuthority = ((DbSubSegment)subSegment).getParent();
      Hibernate.initialize(parentAuthority);

      if (parentAuthority == null) {

        throw new StoreException(StoreException.KEY_NOTFOUND, "Parent authority does not exist.");
      }

      session.getTransaction().commit();
    } catch (StoreException ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw(ex);
    } catch (Exception ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot access database.");
    }

    // done

    log.trace("Done.");
View Full Code Here

    Session session = this.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    // check subsegment

    if (! (subSegment instanceof DbSubSegment)) throw new StoreException(StoreException.KEY_NOTFOUND, "Subsegment is not from this store.");

    // get authority

    DbAuthority authority;

    try {

      reattach(session, subSegment);
      authority = ((DbSubSegment)subSegment).getAuthority();
      Hibernate.initialize(authority);

      if (authority == null) {

        throw new StoreException(StoreException.KEY_NOTFOUND, "Authority does not exist.");
      }

      session.getTransaction().commit();
    } catch (StoreException ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw(ex);
    } catch (Exception ex) {

      session.getTransaction().rollback();
      log.error(ex);
      throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot access database.");
    }

    // done

    log.trace("Done.");
View Full Code Here

TOP

Related Classes of org.openxri.store.StoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.