class OpenStackParser {

    public ComputeState fromOpenStackComputeState(String state)
    		                                           throws OCCIException {
    	if (state.equals(OSSTATE_ACTIVE)) {
    		return ComputeState.ACTIVE;
    	} else if (state.equals(OSSTATE_BUILDING)) {
    		return ComputeState.PENDING;
    	} else if (state.equals(OSSTATE_DELETED)) {
    		return ComputeState.DONE;
    	} else if (state.equals(OSSTATE_ERROR)) {
    		return ComputeState.FAILED;
    	} else if (state.equals(OSSTATE_HARD_REBOOT)) {
    		return ComputeState.RESET;
    	} else if (state.equals(OSSTATE_PASSWORD)) {
    		return ComputeState.RESET;
    	} else if (state.equals(OSSTATE_PAUSED)) {
    		return ComputeState.SUSPENDED;
    	} else if (state.equals(OSSTATE_REBOOT)) {
    		return ComputeState.REBOOT;
    	} else if (state.equals(OSSTATE_REBUILD)) {
    		return ComputeState.PENDING;
    	} else if (state.equals(OSSTATE_RESCUED)) {
    		return ComputeState.RESET;
    	} else if (state.equals(OSSTATE_RESIZED)) {
    		return ComputeState.RESET;
    	} else if (state.equals(OSSTATE_REVERT_RESIZE)) {
    		return ComputeState.RESET;
    	} else if (state.equals(OSSTATE_SHUTOFF)) {
    		return ComputeState.SHUTDOWN;
    	} else if (state.equals(OSSTATE_SOFT_DELETED)) {
    		return ComputeState.DONE;
    	} else if (state.equals(OSSTATE_STOPPED)) {
    		return ComputeState.STOPPED;
    	} else if (state.equals(OSSTATE_SUSPENDED)) {
    		return ComputeState.SUSPENDED;
    	} else if (state.equals(OSSTATE_UNKNOWN)) {
    		return ComputeState.FAILED;
    	} else if (state.equals(OSSTATE_VERIFY_RESIZE)) {
    		return ComputeState.RESET;
    	} else {
    		OCCIException exception = new OCCIException();
            exception.setMessage(String.format(BADSTATE, state));
            log.error(String.format(BADSTATE, state));
            throw exception;
    	}
    }

}