@@ -137,6 +137,12 @@ private boolean validateSolution(ResolutionGraph rg) {
137137 } else {
138138 //TODO validate the instance of the remote am!
139139 //System.out.println("##### This instance "+related+" should be validated at a remote am!");
140+ String am_uri = getAutonomicManager ().getExternalInstancesHandler ().getAutonomicManagerOfExternalInstance (related );
141+ if (am_uri != null ) {
142+ refreshRemoteAM (am_uri );
143+ } else {
144+ System .out .println ("WARNING: remote instance referenced but no am uri is found in the local AM!" );
145+ }
140146 }
141147 }
142148 }
@@ -170,6 +176,19 @@ public boolean moveManagedElement(ManagedElement me, String am_uri){
170176 return true ;
171177 }
172178
179+ public void refreshRemoteAM (String am_uri ) {
180+ CMessage msg = new CMessage ();
181+ msg .setTo (am_uri );
182+ msg .setReplyTo (am .getUri ());
183+ msg .setFrom (am .getUri ());
184+ msg .setObject ("resolution" );
185+ msg .setBody ("refreshRemoteAM" );
186+ try {
187+ this .am .getCommunicator ().sendMessage (msg );
188+ } catch (Exception e ) {
189+ }
190+ }
191+
173192 public List <String > findFromRuntimeModel (ManagedElement description ) {
174193
175194 List <String > result = new ArrayList <String >();
@@ -467,6 +486,9 @@ protected void handleMessage(CMessage msg) throws Exception {
467486
468487 if (msg != null ) {
469488 if (msg .getBody () != null ) {
489+ if (msg .getBody ().toString ().equalsIgnoreCase ("refreshRemoteAM" )) {
490+ getAutonomicManager ().getRuntimeModelController ().getRuntimeModel ().refresh ();
491+ } else
470492 if (msg .getBody ().toString ().equalsIgnoreCase ("moveManagedElement" )) {
471493 ManagedElement me = msg .getAttachment ();
472494 if (me != null ) {
0 commit comments