Example #1
0
        public static void InitContextTripleStore()
        {
            SemiodeskDiscovery.Discover();
            IStore _entityStore = StoreFactory.
                                  CreateStore("provider=stardog;host=http://localhost:5820;uid=admin;pw=admin;sid=DemoExample");

            context = _entityStore.GetModel(new Uri(ns));
        }
Example #2
0
        public static void InitContextInMemory()
        {
            SemiodeskDiscovery.Discover();
            //In memory store with an ontology
            IStore _entityStore =
                new dotNetRDFStore(new [] { "C:\\ExampleDemoOntology.owl" }); //Replace with your path

            // In memory Empty store
            //IStore _entityStore = StoreFactory.CreateStore("provider=dotnetrdf");
            context = _entityStore.GetModel(new Uri(ns));
        }
Example #3
0
        static void Main(string[] args)
        {
            SemiodeskDiscovery.Discover();

            Options options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            if (options.SingleUser)
            {
                Models.Agents        = new Uri("http://localhost:8890/artivity/1.0/agents");
                Models.Activities    = new Uri("http://localhost:8890/artivity/1.0/activities");
                Models.WebActivities = new Uri("http://localhost:8890/artivity/1.0/activities/web");
                Models.Monitoring    = new Uri("http://localhost:8890/artivity/1.0/monitoring");
            }

            if (!Setup.HasModels() && !Setup.InstallModels())
            {
                throw new Exception("Failed to setup the database.");
            }

            try
            {
                Application app = new Application();

                using (MainWindow window = new MainWindow())
                {
                    if (!Setup.CheckEnvironment())
                    {
                        using (SetupWizard setup = new SetupWizard())
                        {
                            setup.ShowModal();

                            if (setup.Result != DialogResult.Ok)
                            {
                                return;
                            }
                        }
                    }

                    app.Run(window);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #4
0
        public static void Main(string[] args)
        {
            SemiodeskDiscovery.Discover();

            Options options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            string version = typeof(HttpService).Assembly.GetName().Version.ToString();

            Console.WriteLine("Artivity Logging Service, Version {0}", version);
            Console.WriteLine();

            AutoResetEvent wait     = new AutoResetEvent(false);
            AutoResetEvent finalize = new AutoResetEvent(false);

            // Listen to SIGINT for cancelling the daemon.
            Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) =>
            {
                Logger.LogInfo("Received SIGINT. Shutting down.");

                wait.Set();
                finalize.WaitOne();
            };

            // Start the daemon in a new thread.
            Thread t = new Thread(() =>
            {
                // Make sure the models are all set up.
                InitializeModels(options);

                HostConfiguration config          = new HostConfiguration();
                config.RewriteLocalhost           = false;
                config.UnhandledExceptionCallback = new Action <Exception>((ex) => { Console.WriteLine(ex); });

                using (var host = new NancyHost(config, new Uri("http://localhost:" + Port)))
                {
                    try
                    {
                        host.Start();

                        Logger.LogInfo("Started listening on port {0}..", Port);

                        using (var monitor = FileSystemMonitor.Instance)
                        {
                            monitor.Initialize();
                            monitor.Start();

                            wait.WaitOne();
                        }
                    }
                    finally
                    {
                        Logger.LogInfo("Stopped listening on port {0}..", Port);
                    }
                }

                finalize.Set();
            });

            t.Start();
            t.Join();
        }