Package org.nimbustools.api.services.rm

Examples of org.nimbustools.api.services.rm.DoesNotExistException


        final InstanceResource[] resources =
                    this.ghome.findMembers(this.groupid);

        if (resources == null || resources.length == 0) {
            throw new DoesNotExistException("Cannot " + verb + ", there are " +
                    "no workspaces in group '" + this.groupid + "'");
        }

        boolean aProblem = false;
        final StringBuffer returnMsg = new StringBuffer();
View Full Code Here


                final Calendar currTime = Calendar.getInstance();
                final Calendar termTime = resource.getTerminationTime();
                if (termTime != null && termTime.before(currTime)) {
                    boolean destroyed = this.destroy(id);
                    if (destroyed) {
                      throw new DoesNotExistException(Lager.id(id) + " expired");
                    }
                }

            } else {
                resource = (InstanceResource) el.getObjectValue();
View Full Code Here

    public int[] findMemberIDs(String coschedid)

            throws ManageException, DoesNotExistException {

        if (coschedid == null || coschedid.trim().length() == 0) {
            throw new DoesNotExistException("coschedid is missing/empty");
        }
        return this.persistence.findVMsInEnsemble(coschedid);
    }
View Full Code Here

    public int[] findMemberIDs(String groupid)

            throws ManageException, DoesNotExistException {

        if (groupid == null || groupid.trim().length() == 0) {
            throw new DoesNotExistException("groupid is missing/empty");
        }
        return this.persistence.findVMsInGroup(groupid);
    }
View Full Code Here

        this.manager = manager;
        this.secDescPath = secDescPath;
        this.baseTranslate = baseTranslate;

        if (!this.manager.exists(idString, type)) {
            throw new DoesNotExistException();
        }

        initSecureResource();
    }
View Full Code Here

        //       parameters.  It could go faster if able to cut out early.
        final VM[] vms = this.manager.getAll(this.id, Manager.COSCHEDULED);

        if (vms == null || vms.length == 0) {
            // manager impl should throw this but in case it doesn't
            throw new DoesNotExistException(
                    "no VMs found in ensemble '" + this.id + "'");
        }

        final OneReport_Type[] reports =
                this.translate.getOneReport_Types(vms);
View Full Code Here

        }
        AsyncRequest request = this.asyncRequestMap.getByID(id);
        if(request != null){
            return request;
        } else {
            throw new DoesNotExistException("Asynchronous request with id " + id + " does not exist.");
        }
    }   
View Full Code Here

        }

        final CurrentState state = this.getCurrentState();
        if (state == null) {

            throw new DoesNotExistException("The instance is gone (highly " +
                    "unlikely destruction race)");

            // It does not matter if this happens, the layer below is
            // authoritative.
View Full Code Here

            logger.trace("load(): " + Lager.id(id) +
                                ", WorkspaceResource = " + resource);
        }

        if (id < 0) {
            throw new DoesNotExistException("id is less than zero");
        }

        Connection c = null;
        PreparedStatement pstmt = null;
        PreparedStatement[] pstmts = null;
        ResultSet rs = null;
        try {
            c = getConnection();

            pstmt = c.prepareStatement(SQL_LOAD_RESOURCE);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            if (rs == null || !rs.next()) {
                final String err = "resource with id = " + id + " not found";
                logger.debug(err);
                throw new DoesNotExistException(err);
            } else {
                final String name = rs.getString(1);
                resource.setName(name);
                final int state = rs.getInt(2);
                final int targetState = rs.getInt(3);
                resource.setInitialTargetState(targetState);
                final long t = rs.getLong(4);
                if (t == 0) {
                    resource.setTerminationTime(null);
                } else {
                    final Calendar term = Calendar.getInstance();
                    term.setTimeInMillis(t);
                    resource.setTerminationTime(term);
                }
                final boolean opsEnabled = rs.getBoolean(5);
                resource.setInitialOpsEnabled(opsEnabled);
               
                final String dn = rs.getString(6);
                resource.setCreatorID(dn);

                final long s = rs.getLong(7);
                if (s == 0) {
                    resource.setStartTime(null);
                } else {
                    final Calendar start = Calendar.getInstance();
                    start.setTimeInMillis(s);
                    resource.setStartTime(start);
                }
               
                final boolean vmmAccessOK = rs.getBoolean(8);
                resource.setInitialVMMaccessOK(vmmAccessOK);

                final String ensembleid = rs.getString(9);
                resource.setEnsembleId(ensembleid);

                final String groupid = rs.getString(10);
                resource.setGroupId(groupid);

                final int groupsize = rs.getInt(11);
                resource.setGroupSize(groupsize);

                final boolean isLastInGroup = rs.getBoolean(12);
                resource.setLastInGroup(isLastInGroup);

                final int launchIndex = rs.getInt(13);
                resource.setLaunchIndex(launchIndex);

                final Blob errBlob = rs.getBlob(14);
                if (errBlob != null) {
                    // getBytes requires int, cast from long
                    final int length = (int)errBlob.length();
                    final Throwable err =
                           ErrorUtil.getThrowable(errBlob.getBytes(1,length));
                    resource.setInitialState(state, err);
                } else {
                    resource.setInitialState(state, null);
                }

                final String clientToken = rs.getString(15);
                resource.setClientToken(clientToken);

                final double chargeRatio = rs.getDouble(16);
                resource.setChargeRatio(chargeRatio);

                if (this.dbTrace) {
                    logger.trace("found " + Lager.id(id) +
                             ": name = " + name +
                             ", state = " + state +
                             ", targetState = " + targetState +
                             ", termination time = " + t +
                             ", opsEnabled = " + opsEnabled +
                             ", creator ID = " + dn +
                             ", start time = " + s +
                             ", vmmAccessOK = " + vmmAccessOK +
                             ", ensembleid = " + ensembleid +
                             ", groupid = " + groupid +
                             ", groupsize = " + groupsize +
                             ", isLastInGroup = " + isLastInGroup +
                             ", launchIndex = " + launchIndex +
                             ", clientToken = " + clientToken +
                             ", chargeRatio = " + chargeRatio +
                             ", error present = " + (errBlob != null));
                }
               
                rs.close();

                if (resource instanceof VMPersistence) {
                    if (this.dbTrace) {
                        logger.trace(Lager.id(id) + ": load virtual machine");
                    }

                    pstmts = VirtualMachinePersistenceUtil.getVMQuery(id, c);

                    rs = pstmts[0].executeQuery();
                    if (rs == null || !rs.next()) {
                        logger.error("resource with id=" + id + " not found");
                        throw new DoesNotExistException();
                    }

                    final VirtualMachine vm =
                            VirtualMachinePersistenceUtil.newVM(id, rs);
View Full Code Here

        PreparedStatement[] pstmts = VirtualMachinePersistenceUtil.getVMQuery(id, c);
        ResultSet rs = pstmts[0].executeQuery();
        if (rs == null || !rs.next()) {
            logger.error("resource with id=" + id + " not found");
            throw new DoesNotExistException();
        }

        final VirtualMachine vm =
                VirtualMachinePersistenceUtil.newVM(id, rs);
View Full Code Here

TOP

Related Classes of org.nimbustools.api.services.rm.DoesNotExistException

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.