Example #1
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();
        }
Example #2
0
        public void TypeCbyCLRProxy()
        {
            JInterfacesHelper  h               = new JInterfacesHelper();
            CWithJavaInterface cwc             = h.getCWithJavaInterfaceC(new CWithJavaInterface(0));
            Object             val             = Bridge.WrapCLR(cwc);
            JniGlobalHandle    jniGlobalHandle = ((IClrProxy)val).JvmHandle;
            RegistryRecord     record          = Registry.GetRecord(JNIEnv.ThreadEnv, jniGlobalHandle, val.getClass());

            Assert.IsNotNull(record);
            jniGlobalHandle.HoldThisHandle();
        }