A Mattapan man with an extensive criminal record was sentenced to life in prison yesterday for shooting a drug dealer and beating a witness during a robbery inside an Uphams Corner rooming house, Suffolk District Attorney Daniel F. Conley said in a statement. Shaheed Abdullah, 44, was convicted last fall on charges relating to an attack in Dorchester on Aug. 25, 2008. He robbed a drug dealer of $400 in cash, a Rolex watch, and five bags of crack cocaine at the point of a semiautomatic handgun, prosecutors said. He then shot the dealer, injuring him in the hand and leg, they said. Because of prior convictions for armed robbery in 1987, 1993, and 1999, Abdullah was sentenced as a habitual offender in Suffolk Superior Court. “This defendant has been destabilizing the community for decades,’’ Conley said.