public void onSaveResource ( final AddressTemplate addressTemplate , final String name , Map < String , Object > changedValues , final Callback ... callback ) { final ResourceAddress address = addressTemplate . resolve ( statementContext , name ) ; final ModelNodeAdapter adapter = new ModelNodeAdapter ( ) ; ModelNode op = adapter . fromChangeSet ( address , changedValues ) ; dispatcher . execute ( new DMRAction ( op ) , new AsyncCallback < DMRResponse > ( ) { @ Override public void onFailure ( Throwable caught ) { for ( Callback cb : callback ) { cb . onFailure ( addressTemplate , name , caught ) ; } } @ Override public void onSuccess ( DMRResponse dmrResponse ) { ModelNode response = dmrResponse . get ( ) ; if ( response . isFailure ( ) ) { Console . error ( Console . MESSAGES . saveFailed ( name ) , response . getFailureDescription ( ) ) ; for ( Callback cb : callback ) { cb . onFailure ( addressTemplate , name , new RuntimeException ( Console . MESSAGES . saveFailed ( addressTemplate . replaceWildcards ( name ) . toString ( ) ) + ":" + response . getFailureDescription ( ) ) ) ; } } else { for ( Callback cb : callback ) { cb . onSuccess ( addressTemplate , name ) ; } } } } ) ; }
Updates an existing resource using the given address name and changed values .