question: public void addRule ( Rule rule ) throws NameAlreadyExistsException , InvalidNameException { if ( rule . getName ( ) == null ) { rule . setName ( "rule" + ServiceTypeManager . generateRandomName ( ) ) ; } if ( rules . containsKey ( rule . getName ( ) ) ) { throw ( new NameAlreadyExistsException ( ResBundleUtils . rbName , "rule_name_already_present" , null , rule . getName ( ) , PolicyException . RULE ) ) ; } else if ( rules . containsValue ( rule ) ) { throw ( new NameAlreadyExistsException ( ResBundleUtils . rbName , "rule_already_present" , null , rule . getName ( ) , PolicyException . RULE ) ) ; } rules . put ( rule . getName ( ) , rule ) ; }
target:  Adds a new policy rule.