Exemple #1
0
        public NcAddApplicationResponse AddApplication(NcAddApplicationRequest request)
        {
            Log.Info (this, "AddApplication()");

            try {
                Log.Info (this, "Application " + request.Application.Name + " received");
                if (!ControllerUtil.ApplicationExists (request.Application)) {
                    try {
                        Database.Applications.Add (request.Application);
                        Log.Debug (this, "Application added to the database");
                    }
                    catch (Exception) {
                        Log.Debug (this, "Application package not found");
                    }
                }
                else {
                    Log.Debug (this, "Application already exists in the database");
                }
                return new NcAddApplicationResponse ();
            }
            catch (Exception e) {
                Log.Error (this, e);
                throw e;
            }
        }
        private void UploadApplicationToNode(int applicationId, Node node)
        {
            Log.Debug(this, "Uploading application " + applicationId + " to node " + node.ToString());

            Application app = FindApplication(applicationId);
            if (app != null)
            {
                string filePath = Path.Combine(Settings.ApplicationStorePath, app.FileName);
                if (File.Exists(filePath))
                {
                    Log.Debug(this, "Transferring application package...");
                    NcFileTransferSocket socket = new NcFileTransferSocket(node.IpAddress_, Settings.NcFileTransferSocketPort);
                    socket.SendFile(filePath);

                    Log.Debug(this, "Transferring application data...");
                    NcAddApplicationRequest request = new NcAddApplicationRequest(Credentials);
                    request.Application = app;
                    EndPoints.GetNcApplicationGridService(node).AddApplication(request);
                }
                else
                {
                    throw new MonoscapeException("File not found: " + app.FileName);
                }
            }
            else
            {
                throw new MonoscapeException("Application not found: " + app.Name);
            }
        }
 public NcAddApplicationResponse AddApplication(NcAddApplicationRequest request)
 {
     throw new NotImplementedException();
 }