Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGUnavailableException


            // conn.setAutoCommit(true); //Problematic with DBCP?
            session.setFlushMode(FlushMode.COMMIT);
            getSessionStatus().setSession(session);
           
            if (!session.isOpen()) {
                throw new WGUnavailableException(_db, "Unable to connect to hibernate session");
            }
           
          // special handling if loadbalancing is enabled
            if (hasFeature(WGDatabase.FEATURE_LOADBALANCE)) {
           
                // set all connections to readonly except master sessions and if
                // update is in progress
              boolean readOnly;             
              if (master) {
                readOnly = false;
              } else {
                readOnly = !isUpdateInProgress(authSession.getDistinguishedName());
              }
             
              try {
          session.connection().setReadOnly(readOnly);
                }
                catch (SQLException e) {
          throw new WGBackendException("Unable to set readonly flag on connection." , e);
        }
            }

            if (getTransactionMode() != WGSessionContext.TRANSACTION_MODE_MANUAL) {
                session.beginTransaction();
            }

            if (master) {
                // Master login always has manager access
                getSessionStatus().setUserDetails(new WGUserDetails(WGDatabase.ACCESSLEVEL_MANAGER, WGDatabase.MASTER_USERNAME ,"(None)", null, null, null, null, null, true, true));
                return new WGUserAccess(WGDatabase.MASTER_USERNAME, WGDatabase.ACCESSLEVEL_MANAGER);
            }

            // Determine access
            WGUserDetails userDetails;
            try {
                userDetails = _db.defaultBuildUserDetails(authSession);
            }
            catch (WGBackendException e) {
                try {
                    closeSession();
                }
                catch (WGBackendException e1) {
                    WGFactory.getLogger().error(e1);
                }
                throw e;
            }
            getSessionStatus().setUserDetails(userDetails);
            if (userDetails.getAccessLevel() <= WGDatabase.ACCESSLEVEL_NOACCESS) {
                try {
                    closeSession();
                }
                catch (WGBackendException e) {
                    WGFactory.getLogger().error(e);
                }
            }

            return userDetails;

        }
        catch (HibernateException e) {
            try {
                closeSession();
            }
            catch (WGBackendException e1) {
                WGFactory.getLogger().error(e1);
            }
            throw new WGUnavailableException(_db, "Error opening hibernate session", e);
        }

    }
View Full Code Here


            return db;
        }
       
        // If db is not ready throw an exception
        if (!db.isReady()) {
            throw new WGUnavailableException(db);
        }

        // Force master login
        if (useMaster) {
            db.openSession(null, null);
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGUnavailableException

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.