static public ResourceState replicatorStateToResourceState(String state){
  if (state.startsWith(SERVICE_STATE_ONLINE))   return ResourceState.ONLINE;
 else   if (state.startsWith(SERVICE_STATE_OFFLINE)) {
    if (state.equals(SERVICE_STATE_ERROR)) {
      return ResourceState.SUSPECT;
    }
 else     if (state.equals(SERVICE_STATE_BACKUP)) {
      return ResourceState.BACKUP;
    }
 else {
      return ResourceState.OFFLINE;
    }
  }
 else   if (state.contains(SERVICE_STATE_SYNCHRONIZING)) {
    return ResourceState.SYNCHRONIZING;
  }
 else   if (state.startsWith(SERVICE_STATE_GOING_ONLINE)) {
    if (state.contains(SERVICE_STATE_RESTORING)) {
      return ResourceState.RESTORING;
    }
 else {
      return ResourceState.UNKNOWN;
    }
  }
 else   return ResourceState.UNKNOWN;
}

static public ResourceState replicatorStateToResourceState ( String state ) { if ( state . startsWith ( SERVICE_STATE_ONLINE ) ) return ResourceState . ONLINE ; else if ( state . startsWith ( SERVICE_STATE_OFFLINE ) ) { if ( state . equals ( SERVICE_STATE_ERROR ) ) { return ResourceState . SUSPECT ; } else if ( state . equals ( SERVICE_STATE_BACKUP ) ) { return ResourceState . BACKUP ; } else { return ResourceState . OFFLINE ; } } else if ( state . contains ( SERVICE_STATE_SYNCHRONIZING ) ) { return ResourceState . SYNCHRONIZING ; } else if ( state . startsWith ( SERVICE_STATE_GOING_ONLINE ) ) { if ( state . contains ( SERVICE_STATE_RESTORING ) ) { return ResourceState . RESTORING ; } else { return ResourceState . UNKNOWN ; } } else return ResourceState . UNKNOWN ; }
parses the given state provided by the replicator and guess a generic resourcestate from it
