To get a community object from the repository, use RAMSession.getCommunity(String name) or RAMSession.getCommunity(int communityId).
//Fetch community by name
RAMCommunity community = session.getCommunity("My Community");
//Fetch community by database id
community = session.getCommunity(25);
//Fetch all communities
RAMCommunity[] communities = session.getAllCommunities();