A General Framework for Analyzing Sustainability of Social-Ecological Systems