- '''
- Check if the connection is valide or not, depending on the list povided in the parameter
- _authorized_connection described above
- '''
+ """
+ Checks whether the RMClass instance can be connected to the
+ other RM corresponding to the given guid.
+ """
+
+ rm = self.ec.get_resource(guid)
+
+ if rm.get_rtype() not in self._authorized_connections:
+ msg = ("Connection between %s %s and %s %s refused: "
+ "An Application can be connected only to a Node" ) % \
+ (self.get_rtype(), self._guid, rm.get_rtype(), guid)
+
+ return False
+
+ elif len(self.connections) != 0 :
+ msg = ("Connection between %s %s and %s %s refused: "
+ "This Application is already connected" ) % \
+ (self.get_rtype(), self._guid, rm.get_rtype(), guid)
+ self.debug(msg)
+
+ return False
+