public static void Main(string[] args) { try { // Pre-parse the command line before initializing the ADK Adk.Debug = AdkDebugFlags.Moderate; AdkExamples.parseCL(null, args); // Initialize the ADK. Note even though this example uses raw XML, // it is still required that the appropriate SDO libraries be loaded Adk.Initialize(AdkExamples.Version, SIFVariant.SIF_US, (int)SdoLibraryType.Student); // Start agent... MappingsDemo agent; agent = new MappingsDemo(); agent.startAgent(args); // Wait for Ctrl-C to be pressed Console.WriteLine(); Console.WriteLine("Agent is running (Press Ctrl-C to stop)"); Console.WriteLine(); // Install a shutdown hook to cleanup when Ctrl+C is pressed new AdkConsoleWait().WaitForExit(); agent.Shutdown (AdkExamples.Unreg ? ProvisioningFlags.Unregister : ProvisioningFlags.None); } catch (Exception e) { Console.WriteLine(e); } }
/** * This method shows how to connect to zones and hook up a basic message handler * @param args */ private void startAgent(string[] args) { this.Initialize(); NameValueCollection parameters = AdkExamples.parseCL(this, args); string zoneId = parameters["zone"]; string url = parameters["url"]; if (zoneId == null || url == null) { Console.WriteLine("The /zone and /url parameters are required"); Console.Beep(); throw new ArgumentException("The /zone and /url parameters are required"); } // 1) Get an instance of the zone to connect to IZone zone = ZoneFactory.GetInstance(zoneId, url); // 2) Create an instance of the the LearnerPersonalHandler class // This class is responsible for dealing with events and responses // received that contain LearnerPersonal data objects LearnerPersonalHandler sdh = new LearnerPersonalHandler(); // The LearnerPersonalHandler is allowed to provision itself with the zone sdh.provision(zone); // Connect zone.Connect(AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None); // The LearnerPersonalHandler class has a sync() method, which it uses to // request data from the SIF zone sdh.sync(zone); }
private void StartAgent(String[] args) { this.Initialize(); NameValueCollection parameters = AdkExamples.parseCL(this, args); string zoneId = parameters["zone"]; string url = parameters["url"]; if( zoneId == null || url == null ) { Console.WriteLine("The /zone and /url parameters are required"); Environment.Exit(0); } // only for SIF_Register and versions in SIF_Request messages... // this.Properties.OverrideSifVersions = "2.3,2.*"; // only for SIF_Message Version attribute in SIF_Request messages // this.Properties.OverrideSifMessageVersionForSifRequests = "2.3"; // 1) Get an instance of the zone to connect to IZone zone = ZoneFactory.GetInstance(zoneId, url); zone.SetQueryResults( this ); // 2) Connect to zones zone.Connect( AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None ); }
public static int Main(string[] args) { SimpleProvider agent = null; try { if (args.Length < 2) { Console.WriteLine("Usage: SimpleProvider /zone zone /url url [/events] [options]"); Console.WriteLine(" /zone zone The name of the zone"); Console.WriteLine(" /url url The zone URL"); Console.WriteLine(" /events Periodically send change events"); AdkExamples.printHelp(); return(0); } Console.ForegroundColor = ConsoleColor.Green; // Pre-parse the command-line before initializing the ADK Adk.Debug = AdkDebugFlags.None; AdkExamples.parseCL(null, args); // Initialize the ADK with the specified version, loading only the Student SDO package Adk.Initialize(SifVersion.SIF23, SIFVariant.SIF_UK, (int)SdoLibraryType.All); // Start the agent... agent = new SimpleProvider(); // Call StartAgent. This method does not return until the agent shuts down agent.startAgent(args); // Wait for Ctrl-C to be pressed Console.WriteLine("Agent is running (Press Ctrl-C to stop)"); new AdkConsoleWait().WaitForExit(); } catch (Exception e) { Console.WriteLine(e); } finally { if (agent != null && agent.Initialized) { // Always shutdown the agent on exit try { agent.Shutdown (AdkExamples.Unreg ? ProvisioningFlags.Unregister : ProvisioningFlags.None); } catch (AdkException adkEx) { Console.WriteLine(adkEx); } } } return(0); }
/// <summary> /// Run the agent as an application /// </summary> /// <example> /// Pull mode ///Debug Command line arguments: /zone test /url http://127.0.0.1:7080/test /pull /events true</example> /// <example> Push mode /// /zone test /url http://127.0.0.1:7080/test /push /port 10000 /events true</example> /// <param name="args"></param> public static void Main(String[] args) { SimpleProvider agent = null; try { if (args.Length < 2) { Console.WriteLine ("Usage: SimpleSubscriber /zone zone /url url [/full] [options]"); AdkExamples.printHelp(); return; } // Pre-parse the command-line before initializing the Adk Adk.Debug = AdkDebugFlags.None; AdkExamples.parseCL(null, args); // Initialize the Adk with the specified version, loading only the learner SDO package Adk.Initialize(AdkExamples.Version, SIFVariant.SIF_AU, (int)SdoLibraryType.Student); // Start the agent... agent = new SimpleProvider(); // Call StartAgent. This method does not return until the agent shuts down agent.StartAgent(args); // Wait for Ctrl-C to be pressed Console.WriteLine("Agent is running (Press Ctrl-C to stop)"); new AdkConsoleWait().WaitForExit(); } catch (Exception e) { Console.WriteLine(e); } finally { if (agent != null && agent.Initialized) { // Always shutdown the agent on exit try { agent.Shutdown (AdkExamples.Unreg ? ProvisioningFlags.Unprovide : ProvisioningFlags.None); } catch (AdkException adkEx) { Console.WriteLine(adkEx); } } } }
public static void Main(string[] args) { try { if( args.Length < 2 ) { Console.WriteLine("Usage: SIFQuery /zone zone /url url [/events] [options]"); Console.WriteLine(" /zone zone The name of the zone"); Console.WriteLine(" /url url The zone URL"); AdkExamples.printHelp(); return; } // Pre-parse the command-line before initializing the ADK Adk.Debug = AdkDebugFlags.Moderate; AdkExamples.parseCL( null, args); // Initialize the ADK with the specified version, loading only the Student SDO package int sdoLibs; sdoLibs = (int)OpenADK.Library.us.SdoLibraryType.All; Adk.Initialize(SifVersion.SIF23,SIFVariant.SIF_US,sdoLibs); // Call StartAgent. _agent.StartAgent(args); // Turn down debugging Adk.Debug = AdkDebugFlags.None; // Call runConsole() This method does not return until the agent shuts down _agent.RunConsole(); // Wait for Ctrl-C to be pressed Console.WriteLine( "Agent is running (Press Ctrl-C to stop)" ); new AdkConsoleWait().WaitForExit(); } catch(Exception e) { Console.WriteLine(e); } finally { if( _agent != null && _agent.Initialized ){ // Always shutdown the agent on exit try { _agent.Shutdown( AdkExamples.Unreg ? ProvisioningFlags.Unprovide : ProvisioningFlags.None ); } catch( AdkException adkEx ){ Console.WriteLine( adkEx ); } } // set breakpoint here to prevent console from closing on errors Console.WriteLine(""); } }
/** * This method shows how to connect to zones and hook up a basic message handler * @param args */ private void startAgent(string[] args) { Initialize(); NameValueCollection parameters = AdkExamples.parseCL(this, args); string zoneId = parameters["zone"]; string url = parameters["url"]; if (zoneId == null || url == null) { Console.WriteLine("The /zone and /url parameters are required"); Console.Beep(); throw new ArgumentException("The /zone and /url parameters are required"); } // 1) Get an instance of the zone to connect to IZone zone = ZoneFactory.GetInstance(zoneId, url); // 2) Create an instance of the the LearnerPersonalProvider class // This class is responsible for publishing LearnerPersonal LearnerPersonalProvider lpp = new LearnerPersonalProvider(); // The LearnerPersonalProvider is allowed to provision itself with the zone lpp.provision(zone); // 2) Create an instance of the the LearnerPersonalProvider class // This class is responsible for publishing LearnerPersonal WorkforcePersonalProvider wpp = new WorkforcePersonalProvider(); // The LearnerPersonalProvider is allowed to provision itself with the zone wpp.provision(zone); // Connect zone.Connect(AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None); // The StudentPersonalProvider will periodically send changes to the StudentPersonal // objects if (parameters["events"] != null) { lpp.startEventProcessing(zone); } }
private void StartAgent(String[] args) { this.Initialize(); NameValueCollection parameters = AdkExamples.parseCL(this, args); string zoneId = parameters["zone"]; string url = parameters["url"]; if (zoneId == null || url == null) { Console.WriteLine("The /zone and /url parameters are required"); Environment.Exit(0); } // 1) Get an instance of the zone to connect to IZone zone = ZoneFactory.GetInstance(zoneId, url); zone.SetQueryResults(this); // 2) Connect to zones zone.Connect(AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None); }
/** * This method shows how to connect to zones and hook up a basic message handler * @param args */ private void StartAgent(String[] args) { this.Initialize(); NameValueCollection parameters = AdkExamples.parseCL(this, args); // /url http://127.0.0.1:7080/test /zone test /pull /sourceID SimpleProvider String zoneId = parameters["zone"]; String url = parameters["url"]; if (zoneId == null || url == null) { Console.WriteLine("The /zone and /url parameters are required"); Environment.Exit(0); } // 1) Get an instance of the zone to connect to IZone zone = ZoneFactory.GetInstance(zoneId, url); // 2) Create an instance of the the StudentPersonalProvider class // This class is responsible for publishing LearnerPersonal StudentPersonalProvider lpp = new StudentPersonalProvider(); // The StudentPersonalProvider is allowed to provision itself with the zone lpp.Provision(zone); // 3) Connect to zones zone.Connect(AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None); // The StudentPersonalProvider will periodically send changes to the StudentPersonal // objects if (parameters["events"] != null) { lpp.StartEventProcessing(zone); } }