示例#1
0
        public NcDeployApplicationResponse DeployApplication(NcDeployApplicationRequest request)
        {
            Log.Info(this, "DeployApplication()");

            try {
                Application app = Database.Applications.Where(x => x.Id == request.ApplicationId).FirstOrDefault();
                if (app != null)
                {
                    NcDeployApplicationResponse response = new NcDeployApplicationResponse();
                    if ((app.Tenants != null) && (app.Tenants.Count > 0))
                    {
                        // Start application instance per tenant
                        foreach (Tenant tenant in app.Tenants)
                        {
                            int port = ExtractApplicationPackage(app, tenant.Name);
                            ApplicationInstance instance = StartWebServer(app, tenant, port);
                            if (instance != null)
                            {
                                response.Deployed = true;
                                response.Url      = instance.Url;
                            }
                        }
                    }
                    else
                    {
                        // No tenants found, start default
                        Tenant tenant = new Tenant();
                        tenant.Name = "Default";
                        int port = ExtractApplicationPackage(app, tenant.Name);
                        ApplicationInstance instance = StartWebServer(app, tenant, port);
                        if (instance != null)
                        {
                            response.Deployed = true;
                            response.Url      = instance.Url;
                        }
                    }
                    return(response);
                }
                else
                {
                    throw new MonoscapeException("Application not found");
                }
            }
            catch (Exception e) {
                Log.Error(this, e);
                throw e;
            }
        }
示例#2
0
        public NcDeployApplicationResponse DeployApplication(NcDeployApplicationRequest request)
        {
            Log.Info(this, "DeployApplication()");

            try
            {
                Authenticate(request);
                var handler = NodeCartridgeFactory.GetHandler(request.ApplicationType);
                return(handler.DeployApplication(request));
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }
示例#3
0
 public NcDeployApplicationResponse DeployApplication(NcDeployApplicationRequest request)
 {
     throw new NotImplementedException();
 }