Thornton Hall in north Dublin will be turned into a prison and permanent asylum seeker accommodation under new plans.