Package org.openxri.store

Examples of org.openxri.store.StoreException


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

    // check authority

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

    // recursively get full names for the authority;

    List<String> result = this.getAuthorityQxris(session, (DbAuthority) authority, 1);
View Full Code Here


      if (qxris.equals("")) qxris.add("");
    } catch (Exception ex) {

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

    // done

    return(qxris);
View Full Code Here

        authorityPath = authorityPath.getParent();
      }

      if (authority == null) {

        throw new StoreException(StoreException.KEY_NOTFOUND, "No root namespace found in store.");
      }

      // now iterate through the remaining subsegments to resolve the final authority.
      // from now on, we require that all subsegments are present in the store.
      // if we have no remaining subsegments at this point, we were given a root namespace in the first place; which is also ok

      for (String subSegmentName : subSegmentNames) {

        // using the parent authority and subsegment name, find the next authority

        DbSubSegment subSegment;

        subSegment = DbSubSegment.ByParentAndName(session, authority, subSegmentName);
        if (subSegment == null) {

          throw new StoreException(StoreException.KEY_NOTFOUND, "Subsegment " + subSegmentName + " not found in store.");
        }

        authority = subSegment.getAuthority();
      }

      Hibernate.initialize(authority);
      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 authority

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

    // update authority

    try {

      reattach(session, authority);
      ((DbAuthority) authority).setContext(context);

      session.flush();
      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

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

    // check authority

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

    // get context from authority

    String context;

    try {

      context = ((DbAuthority) authority).getContext();
      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

    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.");

    // update subsegment

    try {

      reattach(session, subSegment);
      ((DbSubSegment)subSegment).setContext(context);

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

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

    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 context from subsegment

    String context;

    try {

      context = ((DbSubSegment)subSegment).getContext();
      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

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

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

    // build result list, using the context selector

    List<Authority> selectedAuthorities = new ArrayList<Authority> ();
View Full Code Here

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

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

    // build result list, using the context selector

    List<SubSegment> selectedSubSegments = new ArrayList<SubSegment> ();
View Full Code Here

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

    // check authority

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

    // add service

    try {

      reattach(session, authority);
      Collection<Service> services = ((DbAuthority) authority).getServices();
      services.add(service);

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

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

    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.