Example #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<IRobotRepositoryItem>(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;
            }
        }
Example #2
0
        public HostingShell(IRobotRepositoryItem 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();
        }
Example #3
0
        public HostingShell(IRobotRepositoryItem 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();
        }
Example #4
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 <IRobotRepositoryItem>(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;
            }
        }
Example #5
0
        public static string GetDllFileName(IRobotRepositoryItem robotRepositoryItem)
        {
            string uriString = robotRepositoryItem.getClassPathURL().toURI().toString();
            string trim      = uriString.Substring(0, uriString.LastIndexOf(".dll!/") + 4);

            return(new Uri(trim).LocalPath);
        }
        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());
        }
Example #7
0
        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());
        }
 public static RobotType GetRobotType(IRobotRepositoryItem robotRepositoryItem)
 {
     string file = GetDllFileName(robotRepositoryItem);
     if (!File.Exists(file))
     {
         return RobotType.Invalid;
     }
     if (shell != null)
     {
         shell.Open(file);
         return shell.GetRobotType(robotRepositoryItem.getFullClassName());
     }
     using (AppDomainShell localshell = new AppDomainShell())
     {
         localshell.Init(false);
         localshell.Open(file);
         return localshell.GetRobotType(robotRepositoryItem.getFullClassName());
     }
 }
        public BasicRobotProxy(IRobotRepositoryItem 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);
        }
Example #10
0
        public static RobotType GetRobotType(IRobotRepositoryItem robotRepositoryItem)
        {
            string file = GetDllFileName(robotRepositoryItem);

            if (!File.Exists(file))
            {
                return(RobotType.Invalid);
            }
            if (shell != null)
            {
                shell.Open(file);
                return(shell.GetRobotType(robotRepositoryItem.getFullClassName()));
            }
            using (AppDomainShell localshell = new AppDomainShell())
            {
                localshell.Init(false);
                localshell.Open(file);
                return(localshell.GetRobotType(robotRepositoryItem.getFullClassName()));
            }
        }
Example #11
0
        public BasicRobotProxy(IRobotRepositoryItem 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)
 {
 }
Example #13
0
 public static string GetDllFileName(IRobotRepositoryItem robotRepositoryItem)
 {
     string uriString = robotRepositoryItem.getClassPathURL().toURI().toString();
     string trim = uriString.Substring(0, uriString.LastIndexOf(".dll!/") + 4);
     return new Uri(trim).LocalPath;
 }
Example #14
0
 public RobotType getRobotType(IRobotRepositoryItem robotRepositoryItem, bool resolve, bool message)
 {
     return DllRootHelper.GetRobotType(robotRepositoryItem);
 }
Example #15
0
 public String[] getReferencedClasses(IRobotRepositoryItem par0)
 {
     return new String[] {};
 }
Example #16
0
 public String[] getReferencedClasses(IRobotRepositoryItem par0)
 {
     return(new String[] {});
 }
Example #17
0
 public RobotType getRobotType(IRobotRepositoryItem robotRepositoryItem, bool resolve, bool message)
 {
     return(DllRootHelper.GetRobotType(robotRepositoryItem));
 }
Example #18
0
 public JuniorRobotProxy(IRobotRepositoryItem specification, IHostManager hostManager, IRobotPeer peer,
                         RobotStatics statics)
     : base(specification, hostManager, peer, statics)
 {
 }