private void casePull(Protocol.PullMessage pullMessage) { if (_group.AnswerPull()) { _logger.Info(string.Format("\"{0}\" received a pull request", getInstanceName())); try { send(_group.getModelService().getCurrentModel().getModel().serialize()); } catch { _logger.Warn(string.Format("\"{0}\" unable to serialize current model, pull aborted", getInstanceName())); } } else { _logger.Warn(string.Format("\"{}\" received a pull request, but 'answerPull' mode is false", getInstanceName())); } }
private void casePush(Protocol.PushMessage pushMessage) { var model = pushMessage.getModel(); if (model != null && model.Length != 0) { var models = _loader.loadModelFromString(model); if (models != null && model.Length > 0) { _group.getModelService().update(new ContainerRootMarshalled((ContainerRoot)models.get(0)), null); } else { _logger.Warn(string.Format("\"{0}\" received model is empty, push aborted", _group.getContext().getInstanceName())); } } else { _logger.Warn(string.Format("\"{0}\" push message does not contain a model, push aborted", getInstanceName())); } }