Beispiel #1
0
        public static void Construct()
        {
            try
            {
                ModuleN.InitN();

                JNIEnv          env        = JNIEnv.ThreadEnv;
                JniGlobalHandle hmHandle   = env.NewGlobalRef((JniHandle)domain.GetData("hostManager"));
                JniGlobalHandle peerHandle = env.NewGlobalRef((JniHandle)domain.GetData("peer"));
                JniGlobalHandle itemHandle = env.NewGlobalRef((JniHandle)domain.GetData("item"));
                hostManager   = Bridge.CreateProxy <IHostManager>(hmHandle);
                robotPeer     = Bridge.CreateProxy <IRobotPeer>(peerHandle);
                specification = Bridge.CreateProxy <IRobotItem>(itemHandle);

                statics = ((RobotStatics)domain.GetData("statics"));
                CreateProxy();

                Assembly assembly = Assembly.LoadFrom(robotAssemblyShadowFileName);
                Reflection.CheckAssembly(assembly);
                string robotFullName = specification.getFullClassName();
                robotType = assembly.GetType(robotFullName, false);
                robotProxy.setRobotType(robotType);
            }
            catch (Exception ex)
            {
                LoggerN.logError(ex);
                throw;
            }
        }
Beispiel #2
0
        public HostingShell(IRobotItem itemSpecification,
                            IHostManager hostManager, IRobotPeer peer,
                            IRobotStatics jstatics, string dllFileName)
        {
            robotPeer = peer;

            Init(true);
            Open(dllFileName);
            JniGlobalHandle hmHandle = ((IJvmProxy) hostManager).JvmHandle;
            JniGlobalHandle peerhandle = ((IJvmProxy)peer).JvmHandle;
            JniGlobalHandle itemHandle = ((IJvmProxy)itemSpecification).JvmHandle;

            domain.SetData("hostManager", hmHandle.DangerousGetHandle());
            domain.SetData("peer", peerhandle.DangerousGetHandle());
            domain.SetData("item", itemHandle.DangerousGetHandle());

            var statics = serializer.ConvertJ2C<RobotStatics>(RbSerializerN.RobotStatics_TYPE, (Object) jstatics);
            domain.SetData("statics", statics);
            domain.SetData("robotName", statics.getName());
            try
            {
                domain.DoCallBack(HostingSeed.Construct);
            }
            catch (Exception)
            {
                robotPeer.punishBadBehavior(BadBehavior.SECURITY_VIOLATION);
            }

            hmHandle.HoldThisHandle();
            peerhandle.HoldThisHandle();
            itemHandle.HoldThisHandle();
        }
Beispiel #3
0
        public HostingShell(IRobotItem itemSpecification,
                            IHostManager hostManager, IRobotPeer peer,
                            IRobotStatics jstatics, string dllFileName)
        {
            robotPeer = peer;

            Init(true);
            Open(dllFileName);
            JniGlobalHandle hmHandle   = ((IJvmProxy)hostManager).JvmHandle;
            JniGlobalHandle peerhandle = ((IJvmProxy)peer).JvmHandle;
            JniGlobalHandle itemHandle = ((IJvmProxy)itemSpecification).JvmHandle;

            domain.SetData("hostManager", hmHandle.DangerousGetHandle());
            domain.SetData("peer", peerhandle.DangerousGetHandle());
            domain.SetData("item", itemHandle.DangerousGetHandle());

            var statics = serializer.ConvertJ2C <RobotStatics>(RbSerializerN.RobotStatics_TYPE, (Object)jstatics);

            domain.SetData("statics", statics);
            domain.SetData("robotName", statics.getName());
            try
            {
                domain.DoCallBack(HostingSeed.Construct);
            }
            catch (Exception)
            {
                robotPeer.punishBadBehavior(BadBehavior.SECURITY_VIOLATION);
            }

            hmHandle.HoldThisHandle();
            peerhandle.HoldThisHandle();
            itemHandle.HoldThisHandle();
        }
        public bool Start()
        {
            hostManager = configuration.AutoDiscovery?.On == true ?
                          new DynamicHostManager(configuration, new NetworkScanner(TaskPoolScheduler.Default), scheduler) :
                          (IHostManager) new StaticHostManager(configuration.Known);
            if (configuration.Archive.HasValue)
            {
                var archivingObservable = Observable.Empty <bool>()
                                          .Delay(TimeSpan.FromDays(1), scheduler)
                                          .Concat(Observable.FromAsync(Archiving, scheduler))
                                          .Repeat()
                                          .SubscribeOn(scheduler)
                                          .Subscribe();
                connections.Add(archivingObservable);
            }

            if (configuration.Server != null)
            {
                log.Info("Setting FTP server");
                server = new ServerManager(configuration.Server);
                server.Start();
            }

            var observableMonitor = Observable.Empty <bool>()
                                    .Delay(TimeSpan.FromSeconds(configuration.Scan), scheduler)
                                    .Concat(Observable.FromAsync(Download, scheduler))
                                    .Repeat()
                                    .SubscribeOn(scheduler)
                                    .Subscribe();

            connections.Add(observableMonitor);
            return(true);
        }
 public VirtualMachineController(IUnitManager _unitManager, IInventoryManager _InventoryManager, ILocationManager _locationManager, IHostManager _hostManager)
 {
     this._InventoryManager = _InventoryManager;
     this._unitManager      = _unitManager;
     this._locationManager  = _locationManager;
     this._hostManager      = _hostManager;
 }
Beispiel #6
0
        public static void Construct()
        {
            try
            {
                ModuleN.InitN();

                JNIEnv env = JNIEnv.ThreadEnv;
                JniGlobalHandle hmHandle = env.NewGlobalRef((JniHandle)domain.GetData("hostManager"));
                JniGlobalHandle peerHandle = env.NewGlobalRef((JniHandle)domain.GetData("peer"));
                JniGlobalHandle itemHandle = env.NewGlobalRef((JniHandle)domain.GetData("item"));
                hostManager = Bridge.CreateProxy<IHostManager>(hmHandle);
                robotPeer = Bridge.CreateProxy<IRobotPeer>(peerHandle);
                specification = Bridge.CreateProxy<IRobotItem>(itemHandle);

                statics = ((RobotStatics)domain.GetData("statics"));
                CreateProxy();

                Assembly assembly = Assembly.LoadFrom(robotAssemblyShadowFileName);
                Reflection.CheckAssembly(assembly);
                string robotFullName = specification.getFullClassName();
                robotType = assembly.GetType(robotFullName, false);
                robotProxy.setRobotType(robotType);
            }
            catch (Exception ex)
            {
                LoggerN.logError(ex);
                throw;
            }
        }
 public IHostingRobotProxy createRobotProxy(IHostManager hostManager, Object robotSpecification, IRobotStatics statics, IRobotPeer peer)
 {
     Object s = HiddenAccess.getFileSpecification(robotSpecification);
     var itemSpecification = Bridge.Cast<IRobotItem>(s);
     string file = DllRootHelper.GetDllFileName(itemSpecification);
     HostingShell hostingShell = new HostingShell(itemSpecification, hostManager, peer, statics, file);
     return hostingShell;
 }
Beispiel #8
0
 public IHostingRobotProxy createRobotProxy(IHostManager hostManager, Object robotSpecification, IRobotStatics statics, IRobotPeer peer)
 {
     Object s = HiddenAccess.getFileSpecification(robotSpecification);
     var itemSpecification = Bridge.Cast<IRobotRepositoryItem>(s);
     string file = DllRootHelper.GetDllFileName(itemSpecification);
     HostingShell hostingShell = new HostingShell(itemSpecification, hostManager, peer, statics, file);
     return hostingShell;
 }
        public void GetInstanceTest()
        {
            IHostManager manager = HostManagerFactory.GetInstance();

            Assert.IsNotNull(manager);
            Assert.IsTrue(manager is HostManager);

            manager = HostManagerFactory.GetInstance(new HostSwitchConfig());
            Assert.IsNotNull(manager);
            Assert.IsTrue(manager is HostManager);
        }
        protected HostingRobotProxy(IRobotRepositoryItem robotSpecification, IHostManager hostManager, IRobotPeer peer,
                                    RobotStatics statics)
        {
            this.peer = peer;
            this.statics = statics;
            this.hostManager = hostManager;
            this.robotSpecification = robotSpecification;
            outputSb = new StringBuilder(5000);
            output = TextWriter.Synchronized(new StringWriter(outputSb));
            LoggerN.robotOut = output;

            robotFileSystemManager = new RobotFileSystemManager(this, (int) hostManager.getRobotFilesystemQuota(),
                                                                robotSpecification.getWritableDirectory(),
                                                                robotSpecification.getReadableDirectory());
        }
Beispiel #11
0
        protected HostingRobotProxy(IRobotItem robotSpecification, IHostManager hostManager, IRobotPeer peer,
                                    RobotStatics statics)
        {
            this.peer               = peer;
            this.statics            = statics;
            this.hostManager        = hostManager;
            this.robotSpecification = robotSpecification;

            outputSb         = new StringBuilder(5000);
            output           = TextWriter.Synchronized(new StringWriter(outputSb));
            LoggerN.robotOut = output;

            robotFileSystemManager = new RobotFileSystemManager(this, (int)hostManager.getRobotFilesystemQuota(),
                                                                robotSpecification.getWritableDirectory(),
                                                                robotSpecification.getReadableDirectory());
        }
Beispiel #12
0
        public BasicRobotProxy(IRobotItem specification, IHostManager hostManager, IRobotPeer peer, RobotStatics statics)
            : base(specification, hostManager, peer, statics)
        {
            eventManager = new EventManager(this);

            graphicsProxy = new GraphicsProxy();

            // dummy
            execResults = new ExecResults(null, null, null, null, null, false, false, false);

            setSetCallCount(0);
            setGetCallCount(0);

            var sharedBuffer = new byte[10*1024*100];
            execJavaBuffer = new DirectByteBuffer(sharedBuffer);
            execNetBuffer = ByteBuffer.wrap(sharedBuffer);
            rbSerializerN = new RbSerializerN();
            this.peer.setupBuffer(execJavaBuffer);
        }
Beispiel #13
0
        public BasicRobotProxy(IRobotItem specification, IHostManager hostManager, IRobotPeer peer, RobotStatics statics)
            : base(specification, hostManager, peer, statics)
        {
            eventManager = new EventManager(this);

            graphicsProxy = new GraphicsProxy();

            // dummy
            execResults = new ExecResults(null, null, null, null, null, false, false, false);

            setSetCallCount(0);
            setGetCallCount(0);

            var sharedBuffer = new byte[10 * 1024 * 100];

            execJavaBuffer = new DirectByteBuffer(sharedBuffer);
            execNetBuffer  = ByteBuffer.wrap(sharedBuffer);
            rbSerializerN  = new RbSerializerN();
            this.peer.setupBuffer(execJavaBuffer);
        }
 public TeamRobotProxy(IRobotRepositoryItem specification, IHostManager hostManager, IRobotPeer peer,
                       RobotStatics statics)
     : base(specification, hostManager, peer, statics)
 {
 }
Beispiel #15
0
 public JuniorRobotProxy(IRobotRepositoryItem specification, IHostManager hostManager, IRobotPeer peer,
                         RobotStatics statics)
     : base(specification, hostManager, peer, statics)
 {
 }
Beispiel #16
0
 public IEnumerable <IDownloader> GetSources(IHostManager manager)
 {
     log.Info("Downloading...");
     return(fixedDownloaders.Union(manager.GetHosts().Select(item => ConstructDownloader(item, destination))));
 }
Beispiel #17
0
 public HostsController(IHostManager hostManager, UserManager <User> userManager)
 {
     _userManager = userManager;
     _hostManager = hostManager;
 }
Beispiel #18
0
 public CredentialController(ICredManager _cred, IInventoryManager InventoryManager, IHostManager hostManager)
 {
     this._cred            = _cred;
     this.InventoryManager = InventoryManager;
     this.hostManager      = hostManager;
 }
 public JuniorRobotProxy(IRobotItem specification, IHostManager hostManager, IRobotPeer peer,
                         RobotStatics statics)
     : base(specification, hostManager, peer, statics)
 {
 }
 public RuntimeHostingWorker(IApplicationService service, IHostManager <Application> manager, ILogger <RuntimeHostingWorker> logger)
 {
     this.logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     this.service = service ?? throw new ArgumentNullException(nameof(service));
     this.manager = manager ?? throw new ArgumentNullException(nameof(manager));
 }
Beispiel #21
0
 public StandardRobotProxy(IRobotItem specification, IHostManager hostManager, IRobotPeer peer,
                           RobotStatics statics)
     : base(specification, hostManager, peer, statics)
 {
 }
Beispiel #22
0
 public HostController(IHostManager _host, IInventoryManager _InventoryManager)
 {
     this._host             = _host;
     this._InventoryManager = _InventoryManager;
 }