コード例 #1
0
ファイル: Program.cs プロジェクト: politician/fallen-8
        public static void Main(string[] args)
        {
            var shutdown = false;

            #region Fallen-8 startup

            var fallen8 = new Fallen8 ();

            #endregion

            #region services

            #region Fallen-8 REST API

            fallen8.ServiceFactory.StartGraphService ();
            fallen8.ServiceFactory.StartAdminService ();

            #endregion

            #region benchmark api

            IService introService;
            if (fallen8.ServiceFactory.TryAddService (out introService, "Fallen-8_Benchmark_Service", "Benchmark API", null)) {
                introService.TryStart ();
            }

            #endregion

            #endregion

            #region shutdown

            Console.WriteLine ("Enter 'shutdown' to initiate the shutdown of this instance.");

            while (!shutdown) {
                var command = Console.ReadLine ();

                if (command == null)
                    continue;

                if (command.ToUpper () == "SHUTDOWN")
                    shutdown = true;
            }

            Console.WriteLine ("Shutting down Fallen-8 startup");
            fallen8.Shutdown ();
            Console.WriteLine ("Shutdown complete");

            #endregion
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: kuba85/fallen-8
        static void Main(string[] args)
        {
            var shutdown = false;

            #region Fallen-8 startup

            var fallen8 = new Fallen8();

            #endregion

            #region services

            #region Fallen-8 REST API

            fallen8.ServiceFactory.StartGraphService();
            fallen8.ServiceFactory.StartAdminService();

            #endregion

            #endregion

            #region shutdown

            Console.WriteLine("Enter 'shutdown' to initiate the shutdown of this instance.");

            while (!shutdown)
            {
                var command = Console.ReadLine();

                if (command == null) continue;

                if (command.ToUpper() == "SHUTDOWN")
                    shutdown = true;
            }

            Console.WriteLine("Shutting down Fallen-8 startup");
            fallen8.Shutdown();
            Console.WriteLine("Shutdown complete");

            #endregion
        }
コード例 #3
0
 public void Load(Framework.Serialization.SerializationReader reader, NoSQL.GraphDB.Fallen8 fallen8)
 {
     //nothing to do
 }
コード例 #4
0
 public BenchmarkProvider(Fallen8 _fallen8)
 {
     this._f8 = _fallen8;
 }
コード例 #5
0
ファイル: IntroService.cs プロジェクト: cosh/Fallen-8-Intro
 /// <summary>
 /// Creates a new import service
 /// </summary>
 /// <param name="fallen8"></param>
 public IntroService(Fallen8 fallen8)
 {
     _fallen8 = fallen8;
     _introProvider = new IntroProvider (fallen8);
 }
コード例 #6
0
ファイル: IntroProvider.cs プロジェクト: cosh/Fallen-8-Intro
 public IntroProvider(Fallen8 fallen8)
 {
     _f8 = fallen8;
 }
コード例 #7
0
 public override IRESTService LoadServiceFromSerialization(SerializationReader reader, Fallen8 fallen8)
 {
     return new HelloService ();
 }
コード例 #8
0
 public override IRESTService CreateService(Fallen8 fallen8, IDictionary<string, object> parameter)
 {
     return new HelloService ();
 }
コード例 #9
0
        /// <summary>
        ///   Start the intro service
        /// </summary>
        /// <param name="fallen8"> Fallen-8 instance </param>
        private void StartService(Fallen8 fallen8)
        {
            _uri = new Uri("http://" + _address + ":" + _port + "/" + _uriPattern);

            if (!_uri.IsWellFormedOriginalString())
                throw new Exception("The URI Pattern is not well formed!");

            _service = new IntroService(fallen8);

            _host = new ServiceHost(_service, _uri)
                        {
                            CloseTimeout = new TimeSpan(0, 0, 0, 0, 50)
                        };
            _restServiceAddress = "REST";

            try
            {
                var binding = new WebHttpBinding
                {
                    MaxBufferSize = 268435456,
                    MaxReceivedMessageSize = 268435456,
                    SendTimeout = new TimeSpan(1, 0, 0),
                    ReceiveTimeout = new TimeSpan(1, 0, 0)
                };

                var readerQuotas = new XmlDictionaryReaderQuotas
                {
                    MaxDepth = 2147483647,
                    MaxStringContentLength = 2147483647,
                    MaxBytesPerRead = 2147483647,
                    MaxNameTableCharCount = 2147483647,
                    MaxArrayLength = 2147483647
                };

                binding.ReaderQuotas = readerQuotas;

                var se = _host.AddServiceEndpoint(typeof(IIntroService), binding, _restServiceAddress);
                var webBehav = new WebHttpBehavior
                {
                    HelpEnabled = true
                };
                se.Behaviors.Add(webBehav);

                ((ServiceBehaviorAttribute)_host.Description.Behaviors[typeof(ServiceBehaviorAttribute)]).
                    InstanceContextMode = InstanceContextMode.Single;
            }
            catch (CommunicationException)
            {
                _host.Abort();
                throw;
            }
        }
コード例 #10
0
        public void Load(SerializationReader reader, Fallen8 fallen8)
        {
            _uriPattern = reader.ReadString();
            _address = IPAddress.Parse(reader.ReadString());
            _port = reader.ReadUInt16();

            StartService(fallen8);
        }
コード例 #11
0
        public void Initialize(Fallen8 fallen8, IDictionary<string, object> parameter)
        {
            _uriPattern = "Intro";
            if (parameter != null && parameter.ContainsKey("URIPattern"))
                _uriPattern = (String)Convert.ChangeType(parameter["URIPattern"], typeof(String));

            _address = IPAddress.Any;
            if (parameter != null && parameter.ContainsKey("IPAddress"))
                _address = (IPAddress)Convert.ChangeType(parameter["IPAddress"], typeof(IPAddress));

            _port = 2323;
            if (parameter != null && parameter.ContainsKey("Port"))
                _port = (ushort)Convert.ChangeType(parameter["Port"], typeof(ushort));

            StartService(fallen8);
        }
コード例 #12
0
 public override IRESTService LoadServiceFromSerialization(SerializationReader reader, Fallen8 fallen8)
 {
     return new BenchmarkService (fallen8);
 }
コード例 #13
0
 public override IRESTService CreateService(Fallen8 fallen8, IDictionary<string, object> parameter)
 {
     return new BenchmarkService (fallen8);
 }