Esempio n. 1
0
        //The required initialization of domain application is peformed
        //inside this code, what we meant by intiailization is configuring
        //the services and assigning its reference back to domain application.
        public DomainApp CreateApplication(AppInfo appInfo, DomainApp serverApp)
        {
            DomainApp     newApp  = new DomainApp(appInfo);
            LogManagement logMgmt = new LogManagement(this, newApp);

            return(newApp);
        }
        public DomainApp CreateApplication(AppInfo appInfo, DomainApp serverApp)
        {
            Console.WriteLine("Creating Application : " + appInfo.Name);
            DomainApp     newApp  = new DomainApp(appInfo);
            AppManagement appMgmt = new AppManagement(this, newApp);

            newApp.Logger = serverApp.Logger;
            appCollections[appInfo.Name] = newApp;
            return(newApp);
        }
Esempio n. 3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            RafyEnvironment.Provider.IsDebuggingEnabled = HttpContext.Current.IsDebuggingEnabled;
            RafyEnvironment.Provider.DllRootDirectory   = Path.Combine(RafyEnvironment.Provider.RootDirectory, "Bin");

            RafyEnvironment.DomainPlugins.Add(new UnitTestPlugin());

            var app = new DomainApp();

            app.Startup();
        }
Esempio n. 4
0
        /// <summary>
        /// 把指定的领域应用程序启动。
        /// </summary>
        /// <param name="app">The application.</param>
        /// <exception cref="System.ArgumentNullException">app</exception>
        public void Start(DomainApp app)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            _app = app;

            //由于应用程序池会定时回收,所以需要在每个请求到来时都检测是否 WebApp 是否已经启动成功。
            _context.BeginRequest += OnBeginRequest;
        }
Esempio n. 5
0
        //In this section of code both primary controller and agent
        //creates an instance of domain applications and attach the
        //list of services applicable on their end. Again for sake
        //of simplicity we have hard-wired the application name,
        //application path and the assembly name inside the code
        //but the best approach is to separate out this information
        //in a configuration file and also assign the agent controlling
        //these applications. We will also notice a call to
        //CreateApplication method happening on both primary controller
        //and agent; this method invocation will ensure that both agent and
        //primary controller have performed the necessary required set-up.
        //Another important section of code to look is exchange of remote
        //references particularly instance of AppManagement class reference.
        //When we invoke CreateApplication method on an instance of agent we
        //also pass a reference to server-side domain application and on successful
        //execution of this method it returns a reference to agent-side domain
        //application which itself is a remote reference. We know that both
        //server-side and agent-side services are derived from common base class
        //Service, so by accessing the AppManagement property of remote instance of
        //domain applications we will be returned with proxy reference.
        public void InitializeApplications(AgentInfo agentInfo)
        {
            AppInfo appInfo = new AppInfo("Order Matching");

            appInfo.AssemblyName = "OrderMatching.exe";
            appInfo.AssemblyPath = @"C:\CodeExample\Chpt5\AppOperationEngine\OrderMatching\bin\Debug";
            DomainApp omeServer = this.CreateApplication(appInfo, null);
            DomainApp omeClient = agentInfo.Agent.CreateApplication(appInfo, omeServer);

            omeServer.AppManagement = omeClient.AppManagement;
            agentInfo.Applications.Add(omeServer.Info.Name, omeServer);
        }
Esempio n. 6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //PlatformEnvironment.Provider.IsDebuggingEnabled = ConfigurationHelper.GetAppSettingOrDefault("IsDebuggingEnabled", false);
     try
     {
         var app = new DomainApp();
         app.Startup();
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format("错误:{0} \n{1}", ex.Message));
     }
 }
        static void Main(string[] args)
        {
            //Start Primary Controller
            PrimaryController primaryController = new PrimaryController();

            RemotingConfiguration.Configure(@"AppController.exe.config");
            RemotingServices.Marshal(primaryController, "PrimaryController.ref", typeof(PrimaryController));
            primaryController.Start();
            Console.WriteLine("Primary Controller Started");
            //Access trading agent and invoke the application management service
            Console.WriteLine("Starting App Management Service..");
            AgentInfo agentInfo = primaryController["tcp://localhost:20001/TradingEngineAgent.rem"];
            DomainApp omeApp    = agentInfo.Applications["Order Matching"] as DomainApp;

            omeApp.AppManagement.Start();
            Console.ReadLine();
        }
Esempio n. 8
0
 public LogManagement(IController controller, DomainApp app)
     : base(controller, app)
 {
     app.Logger = this;
 }
 public AppManagement(IController controller, DomainApp app)
     : base(controller, app)
 {
     app.AppManagement = this;
     newThread         = new Thread(new ThreadStart(LaunchApp));
 }
Esempio n. 10
0
        public KitchenModel()
        {
            personnel = new List <Sprite>();
            objects   = new List <Sprite>();

            Desk                 kitchenDesk            = new Desk();
            Sink                 kitchenSink            = new Sink();
            HeatingPlate         plaque1                = new HeatingPlate();
            HeatingPlate         plaque2                = new HeatingPlate();
            HeatingPlate         plaque3                = new HeatingPlate();
            Dishwasher           laveVaisselle          = new Dishwasher();
            LaundryMachine       laveLinge              = new LaundryMachine();
            DishesStock          stockVaisselle         = new DishesStock();
            DirtyDishesStock     stockVaiselleSale      = new DirtyDishesStock();
            Fridge               kitchenFridge          = new Fridge();
            KitchenMaterialStock kitchenMaterialStock   = new KitchenMaterialStock();
            IngredientStock      kitchenIngredientStock = new IngredientStock();

            objects.Add(kitchenDesk.Sprite);
            objects.Add(kitchenSink.Sprite);
            objects.Add(plaque1.Sprite);
            objects.Add(plaque2.Sprite);
            objects.Add(plaque3.Sprite);
            objects.Add(laveVaisselle.Sprite);
            objects.Add(laveLinge.Sprite);
            objects.Add(stockVaisselle.Sprite);
            objects.Add(stockVaiselleSale.Sprite);
            objects.Add(kitchenFridge.Sprite);
            objects.Add(kitchenMaterialStock.Sprite);
            objects.Add(kitchenIngredientStock.Sprite);


            Plunger plongeur   = new Plunger(kitchenDesk, stockVaiselleSale, stockVaisselle, laveVaisselle, laveLinge, kitchenSink);
            Clerk   commis1    = new Clerk(kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, kitchenSink, "GabinCuisto");
            Clerk   commis2    = new Clerk(kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, kitchenSink, "MaxCuisto");
            Cooker  cuisinier1 = new Cooker(commis1, commis2, kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, "BenjaminCuisto");
            Cooker  cuisinier2 = new Cooker(commis1, commis2, kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, "PirminCuisto");
            Chef    chef       = new Chef(cuisinier1, cuisinier2, kitchenDesk);


            personnel.Add(chef.Sprite);
            personnel.Add(cuisinier1.Sprite);
            personnel.Add(cuisinier2.Sprite);
            personnel.Add(commis1.Sprite);
            personnel.Add(commis2.Sprite);
            personnel.Add(plongeur.Sprite);


            socket = new SocketApp();

            SocketListener.kitchenDesk = kitchenDesk;

            // Ajouter des abonnés observer à l'observable Comptoir
            kitchenDesk.AttachChef(chef);
            kitchenDesk.AttachPlunger(plongeur);
            kitchenDesk.AttachSocket(socket);



            //// Créations des Ingrédients
            //Ingredient steak = new Ingredient("Steak", "Viande");
            //Ingredient poulet = new Ingredient("Poulet", "Viande");
            //Ingredient poisson = new Ingredient("Poisson", "Poisson");
            //Ingredient pain = new Ingredient("Pain", "Pain");
            //Ingredient salade = new Ingredient("Salade", "Vegetables");
            //Ingredient tomate = new Ingredient("Tomate", "Vegetables");
            //Ingredient oignon = new Ingredient("Oignon", "Vegetables");
            //Ingredient cheddar = new Ingredient("Cheddar", "Frommage");
            //Ingredient raclette = new Ingredient("Raclette", "Fromage");
            //Ingredient sauce = new Ingredient("Sauce", "Sauce");

            //// Instanciation Object Cuisine Material
            //KitchenKnife kitchenKnife = new KitchenKnife();
            //Pans kitchenCasserolle = new Pans();
            //Stove kitchenPoêle = new Stove();
            //WoodenSpoon kitchenCuillière = new WoodenSpoon();
            //SaladBowl kitchenBolSalade = new SaladBowl();


            //// Creation des etapes des recettes
            //RecipeStep prepareSteak = new RecipeStep("Cuire le Steak", 10);
            //prepareSteak.IngredientQuantities.Add(new IngredientQuantity(1, steak));
            //prepareSteak.ListUstencils.Add(kitchenPoêle);

            //RecipeStep preparePoulet = new RecipeStep("Cuire le Poulet", 10);
            //preparePoulet.IngredientQuantities.Add(new IngredientQuantity(1, poulet));
            //preparePoulet.ListUstencils.Add(kitchenPoêle);

            //RecipeStep preparePoisson = new RecipeStep("Cuire le Poisson", 10);
            //preparePoisson.IngredientQuantities.Add(new IngredientQuantity(1, poisson));
            //preparePoisson.ListUstencils.Add(kitchenPoêle);

            //RecipeStep prepareVegetables = new RecipeStep("Preparer les légumes", 5);
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(1, salade));
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(2, tomate));
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(1, oignon));
            //prepareVegetables.ListUstencils.Add(kitchenBolSalade);
            //prepareVegetables.ListUstencils.Add(kitchenCuillière);
            //prepareVegetables.ListUstencils.Add(kitchenKnife);

            //RecipeStep prepareRaclette = new RecipeStep("Préparer le frommage à Raclette", 5);
            //prepareRaclette.IngredientQuantities.Add(new IngredientQuantity(2, raclette));
            //prepareRaclette.ListUstencils.Add(kitchenKnife);

            //RecipeStep prepareCheddar = new RecipeStep("Préparer le Cheddar", 5);
            //prepareCheddar.IngredientQuantities.Add(new IngredientQuantity(2, cheddar));
            //prepareCheddar.ListUstencils.Add(kitchenKnife);

            //RecipeStep assemblerBurger = new RecipeStep("Assembler le Burger", 5);
            //assemblerBurger.IngredientQuantities.Add(new IngredientQuantity(1, pain));
            //assemblerBurger.IngredientQuantities.Add(new IngredientQuantity(1, sauce));


            //// Creations des plats
            //Dish burgerClassic = new Dish(1, "Burger Classique");
            //burgerClassic.Recipe.Add(prepareSteak);
            //burgerClassic.Recipe.Add(prepareVegetables);
            //burgerClassic.Recipe.Add(prepareCheddar);
            //burgerClassic.Recipe.Add(assemblerBurger);

            //Dish burgerChicken = new Dish(2, "Burger Poulet");
            //burgerChicken.Recipe.Add(preparePoulet);
            //burgerChicken.Recipe.Add(prepareVegetables);
            //burgerChicken.Recipe.Add(prepareCheddar);
            //burgerChicken.Recipe.Add(assemblerBurger);

            //Dish burgerMountain = new Dish(3, "Burger Montagnard");
            //burgerMountain.Recipe.Add(prepareSteak);
            //burgerMountain.Recipe.Add(prepareVegetables);
            //burgerMountain.Recipe.Add(prepareCheddar);
            //burgerMountain.Recipe.Add(assemblerBurger);

            //Dish burgerVegan = new Dish(4, "Burger Vegan");
            //burgerVegan.Recipe.Add(preparePoisson);
            //burgerVegan.Recipe.Add(prepareVegetables);
            //burgerVegan.Recipe.Add(prepareCheddar);
            //burgerVegan.Recipe.Add(prepareRaclette);
            //burgerVegan.Recipe.Add(assemblerBurger);

            DomainApp domainApp = new DomainApp();

            Console.WriteLine("Instanciation du Controller sans problèmes");
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            DomainApp serviceApp = AppDomain.CurrentDomain.GetData("SERVICE_DOMAINAPP") as DomainApp;

            serviceApp.Logger.Log("Order Matching Started");
        }