1. A method for configuring constraints for a resource in an electronic device, the method comprising: identifying an existing work environment of a resource, by capturing information through an application program interface (API); identifying constraints for the resource with respect to the identified work environment from a constraint specification file for the resource, said file comprising constraint details with respect to predefined work environments; and performing one of: configuring the identified constraints for the resource; and modifying the identified work environment for the resource, and configuring a corresponding constraint for the resource.