示例#1
0
        public void InstantiateReceptor(string name)
        {
            IFlowSharpRestService restSvc = serviceManager.Get <IFlowSharpRestService>();

            // TODO: Fix the hardcoded "App." -- figure out some way of getting the namespace?
            restSvc.HttpGet(url + INSTANTIATE_RECEPTOR, "receptorTypeName=" + "App." + name);
        }
示例#2
0
        public List <ReceptorDescription> DescribeReceptor(string typeName)
        {
            IFlowSharpRestService restSvc = serviceManager.Get <IFlowSharpRestService>();
            // TODO: Fix the hardcoded "App." -- figure out some way of getting the namespace?
            string json = restSvc.HttpGet(url + DESCRIBE_RECEPTOR, "receptorName=" + "App." + typeName);
            var    ret  = JsonConvert.DeserializeObject <List <ReceptorDescription> >(json);

            return(ret);
        }
示例#3
0
        public void Publish(string typeName, string json)
        {
            IFlowSharpRestService       restSvc = serviceManager.Get <IFlowSharpRestService>();
            Dictionary <string, string> data    = new Dictionary <string, string>()
            {
                { "semanticTypeName", typeName },
                { "instanceJson", json },
            };

            restSvc.HttpGet(url + PUBLISH_SEMANTIC_TYPE, data);
        }
示例#4
0
 public void EnableDisableReceptor(string typeName, bool state)
 {
     // Loading an FSD or adding agents while the stand alone runner is running will immediately
     // instantiate the receptor.  In the former case, we don't really want this, as the the stand-alone runner
     // may not be instantiated yet.  In the latter case, the user has the choice to stop the stand-alone runner
     // before creating more agent receptors.
     if (loaded || externallyStarted)
     {
         IFlowSharpRestService restSvc = serviceManager.Get <IFlowSharpRestService>();
         // TODO: Membrane is also required so we manipulate the correct receptor.
         restSvc.HttpGet(url + ENABLE_DISABLE_RECEPTOR, "receptorTypeName=" + typeName + "&state=" + state);
     }
 }
示例#5
0
        /// <summary>
        /// An externally started runner will not be unloaded because the loaded flag is still false.
        /// </summary>
        public void Unload()
        {
            //IFlowSharpCodeService codeSvc = serviceManager.Get<IFlowSharpCodeService>();
            //codeSvc.TerminateProcess(process);
            if (loaded)
            {
                IFlowSharpRestService restSvc = serviceManager.Get <IFlowSharpRestService>();
                restSvc.HttpGet(url + CLOSE, "");
                process.WaitForExit();
            }

            process           = null;
            loaded            = false;
            externallyStarted = false;
        }
示例#6
0
        public PropertyContainer DescribeSemanticType(string typeName)
        {
            IFlowSharpRestService restSvc = serviceManager.Get <IFlowSharpRestService>();
            string json = restSvc.HttpGet(url + DESCRIBE_SEMANTIC_TYPE, "semanticTypeName=" + typeName);
            var    ret  = JsonConvert.DeserializeObject <PropertyContainer>(json);

            return(ret);

            // Amazing, but needs a bunch of type descriptor support to display and Expando object on a property grid.
            // See HopeShapesPublishSemanticType.cs for implementation.
            //         var converter = new Newtonsoft.Json.Converters.ExpandoObjectConverter();
            //dynamic inst = JsonConvert.DeserializeObject<ExpandoObject>(ret, converter);

            // return inst;
        }