Ejemplo n.º 1
0
 public LockController( RpcController rpc )
 {
     if (instance != null)
     {
         this.rpc = rpc;
         instance = this;
     }
 }
Ejemplo n.º 2
0
 public void Init()
 {
     controller = new RpcController();
     client = new Mock<RpcClient>(new object[] { controller });
     server = new Mock<RpcServer>(new object[] { controller });
     channel = new Mock<RpcChannel>(new object[] { controller });
     controller.Client = client.Object;
     controller.Server = server.Object;
     controller.Channel = channel.Object;
 }
        public void Init()
        {
            var controller = new RpcController();
            client = new RpcClient(controller);
            server = new RpcServer(controller);
            server.RegisterService(new SampleService());
            var channel = new LoopbackRpcChannel(controller);
            channel.Start();

            dynProxy = client.GetProxy("ISampleService");
        }
Ejemplo n.º 4
0
 public DirtyObjectController( NetReplicationController netreplicationcontroller, NetworkLevel2Controller network, RpcController rpc )
 {
     if (!network.IsServer)
     {
         throw new Exception( "Shouldnt be instantiating dirtyobjectcontroller on client" );
     }
     this.netreplicationcontroller = netreplicationcontroller;
     this.rpc = rpc;
     this.network = network;
     //network = NetworkControllerFactory.GetInstance();
     network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
     network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);
 }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual DatanodeProtocolProtos.RegisterDatanodeResponseProto RegisterDatanode
            (RpcController controller, DatanodeProtocolProtos.RegisterDatanodeRequestProto request
            )
        {
            DatanodeRegistration registration = PBHelper.Convert(request.GetRegistration());
            DatanodeRegistration registrationResp;

            try
            {
                registrationResp = impl.RegisterDatanode(registration);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            return((DatanodeProtocolProtos.RegisterDatanodeResponseProto)DatanodeProtocolProtos.RegisterDatanodeResponseProto
                   .NewBuilder().SetRegistration(PBHelper.Convert(registrationResp)).Build());
        }
 /// <exception cref="Com.Google.Protobuf.ServiceException"/>
 public virtual QJournalProtocolProtos.CanRollBackResponseProto CanRollBack(RpcController
                                                                            controller, QJournalProtocolProtos.CanRollBackRequestProto request)
 {
     try
     {
         StorageInfo si = PBHelper.Convert(request.GetStorage(), HdfsServerConstants.NodeType
                                           .JournalNode);
         bool result = impl.CanRollBack(Convert(request.GetJid()), si, PBHelper.Convert(request
                                                                                        .GetPrevStorage(), HdfsServerConstants.NodeType.JournalNode), request.GetTargetLayoutVersion
                                            ());
         return((QJournalProtocolProtos.CanRollBackResponseProto)QJournalProtocolProtos.CanRollBackResponseProto
                .NewBuilder().SetCanRollBack(result).Build());
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
 }
Ejemplo n.º 7
0
        public SignalsClient(string url)
        {
            mUrl = url;

            if (mRpcController == null)
            {
                mRpcController = new RpcController();
                mRpcClient     = new RpcClient(mRpcController, 2500)
                {
                    ResponseTimeout = TimeSpan.FromMilliseconds(10000)
                };

                mSignalsClient = mRpcClient.GetProxy <ISignalsClient>();
            }

            mThread = new Thread(ChannelChecker);
            mThread.Start();
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual MRServiceProtos.GetTaskAttemptCompletionEventsResponseProto GetTaskAttemptCompletionEvents
            (RpcController controller, MRServiceProtos.GetTaskAttemptCompletionEventsRequestProto
            proto)
        {
            GetTaskAttemptCompletionEventsRequest request = new GetTaskAttemptCompletionEventsRequestPBImpl
                                                                (proto);

            try
            {
                GetTaskAttemptCompletionEventsResponse response = real.GetTaskAttemptCompletionEvents
                                                                      (request);
                return(((GetTaskAttemptCompletionEventsResponsePBImpl)response).GetProto());
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Ejemplo n.º 9
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual ProtocolInfoProtos.GetProtocolSignatureResponseProto GetProtocolSignature
            (RpcController controller, ProtocolInfoProtos.GetProtocolSignatureRequestProto request
            )
        {
            ProtocolInfoProtos.GetProtocolSignatureResponseProto.Builder builder = ProtocolInfoProtos.GetProtocolSignatureResponseProto
                                                                                   .NewBuilder();
            string protocol = request.GetProtocol();
            string rpcKind  = request.GetRpcKind();

            long[] versions;
            try
            {
                versions = GetProtocolVersionForRpcKind(RPC.RpcKind.ValueOf(rpcKind), protocol);
            }
            catch (TypeLoadException e1)
            {
                throw new ServiceException(e1);
            }
            if (versions == null)
            {
                return((ProtocolInfoProtos.GetProtocolSignatureResponseProto)builder.Build());
            }
            foreach (long v in versions)
            {
                ProtocolInfoProtos.ProtocolSignatureProto.Builder sigBuilder = ProtocolInfoProtos.ProtocolSignatureProto
                                                                               .NewBuilder();
                sigBuilder.SetVersion(v);
                try
                {
                    ProtocolSignature signature = ProtocolSignature.GetProtocolSignature(protocol, v);
                    foreach (int m in signature.GetMethods())
                    {
                        sigBuilder.AddMethods(m);
                    }
                }
                catch (TypeLoadException e)
                {
                    throw new ServiceException(e);
                }
                builder.AddProtocolSignature(((ProtocolInfoProtos.ProtocolSignatureProto)sigBuilder
                                              .Build()));
            }
            return((ProtocolInfoProtos.GetProtocolSignatureResponseProto)builder.Build());
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.GetContainersResponseProto GetContainers(RpcController
                                                                                  controller, YarnServiceProtos.GetContainersRequestProto proto)
        {
            GetContainersRequestPBImpl request = new GetContainersRequestPBImpl(proto);

            try
            {
                GetContainersResponse response = real.GetContainers(request);
                return(((GetContainersResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Ejemplo n.º 11
0
 GetReconfigurationStatus(RpcController unused, ClientDatanodeProtocolProtos.GetReconfigurationStatusRequestProto
                          request)
 {
     ClientDatanodeProtocolProtos.GetReconfigurationStatusResponseProto.Builder builder
         = ClientDatanodeProtocolProtos.GetReconfigurationStatusResponseProto.NewBuilder
               ();
     try
     {
         ReconfigurationTaskStatus status = impl.GetReconfigurationStatus();
         builder.SetStartTime(status.GetStartTime());
         if (status.Stopped())
         {
             builder.SetEndTime(status.GetEndTime());
             System.Diagnostics.Debug.Assert(status.GetStatus() != null);
             foreach (KeyValuePair <ReconfigurationUtil.PropertyChange, Optional <string> > result
                      in status.GetStatus())
             {
                 ClientDatanodeProtocolProtos.GetReconfigurationStatusConfigChangeProto.Builder changeBuilder
                     = ClientDatanodeProtocolProtos.GetReconfigurationStatusConfigChangeProto.NewBuilder
                           ();
                 ReconfigurationUtil.PropertyChange change = result.Key;
                 changeBuilder.SetName(change.prop);
                 changeBuilder.SetOldValue(change.oldVal != null ? change.oldVal : string.Empty);
                 if (change.newVal != null)
                 {
                     changeBuilder.SetNewValue(change.newVal);
                 }
                 if (result.Value.IsPresent())
                 {
                     // Get full stack trace.
                     changeBuilder.SetErrorMessage(result.Value.Get());
                 }
                 builder.AddChanges(changeBuilder);
             }
         }
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
     return((ClientDatanodeProtocolProtos.GetReconfigurationStatusResponseProto)builder
            .Build());
 }
Ejemplo n.º 12
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual ClientDatanodeProtocolProtos.GetBlockLocalPathInfoResponseProto GetBlockLocalPathInfo
            (RpcController unused, ClientDatanodeProtocolProtos.GetBlockLocalPathInfoRequestProto
            request)
        {
            BlockLocalPathInfo resp;

            try
            {
                resp = impl.GetBlockLocalPathInfo(PBHelper.Convert(request.GetBlock()), PBHelper.
                                                  Convert(request.GetToken()));
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            return((ClientDatanodeProtocolProtos.GetBlockLocalPathInfoResponseProto)ClientDatanodeProtocolProtos.GetBlockLocalPathInfoResponseProto
                   .NewBuilder().SetBlock(PBHelper.Convert(resp.GetBlock())).SetLocalPath(resp.GetBlockPath
                                                                                              ()).SetLocalMetaPath(resp.GetMetaPath()).Build());
        }
        Heartbeat(RpcController controller, YarnServerNodemanagerServiceProtos.LocalizerStatusProto
                  proto)
        {
            LocalizerStatusPBImpl request = new LocalizerStatusPBImpl(proto);

            try
            {
                LocalizerHeartbeatResponse response = real.Heartbeat(request);
                return(((LocalizerHeartbeatResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.KillApplicationResponseProto ForceKillApplication
            (RpcController arg0, YarnServiceProtos.KillApplicationRequestProto proto)
        {
            KillApplicationRequestPBImpl request = new KillApplicationRequestPBImpl(proto);

            try
            {
                KillApplicationResponse response = real.ForceKillApplication(request);
                return(((KillApplicationResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        RefreshAdminAcls(RpcController controller, YarnServerResourceManagerServiceProtos.RefreshAdminAclsRequestProto
                         proto)
        {
            RefreshAdminAclsRequestPBImpl request = new RefreshAdminAclsRequestPBImpl(proto);

            try
            {
                RefreshAdminAclsResponse response = real.RefreshAdminAcls(request);
                return(((RefreshAdminAclsResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
 /// <exception cref="Com.Google.Protobuf.ServiceException"/>
 public virtual TraceAdminPB.AddSpanReceiverResponseProto AddSpanReceiver(RpcController
                                                                          controller, TraceAdminPB.AddSpanReceiverRequestProto req)
 {
     try
     {
         SpanReceiverInfoBuilder factory = new SpanReceiverInfoBuilder(req.GetClassName());
         foreach (TraceAdminPB.ConfigPair config in req.GetConfigList())
         {
             factory.AddConfigurationPair(config.GetKey(), config.GetValue());
         }
         long id = server.AddSpanReceiver(factory.Build());
         return((TraceAdminPB.AddSpanReceiverResponseProto)TraceAdminPB.AddSpanReceiverResponseProto
                .NewBuilder().SetId(id).Build());
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
 }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.AllocateResponseProto Allocate(RpcController arg0
                                                                        , YarnServiceProtos.AllocateRequestProto proto)
        {
            AllocateRequestPBImpl request = new AllocateRequestPBImpl(proto);

            try
            {
                AllocateResponse response = real.Allocate(request);
                return(((AllocateResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        UpdateNodeResource(RpcController controller, YarnServerResourceManagerServiceProtos.UpdateNodeResourceRequestProto
                           proto)
        {
            UpdateNodeResourceRequestPBImpl request = new UpdateNodeResourceRequestPBImpl(proto
                                                                                          );

            try
            {
                UpdateNodeResourceResponse response = real.UpdateNodeResource(request);
                return(((UpdateNodeResourceResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.UseSharedCacheResourceResponseProto Use(RpcController
                                                                                 controller, YarnServiceProtos.UseSharedCacheResourceRequestProto proto)
        {
            UseSharedCacheResourceRequestPBImpl request = new UseSharedCacheResourceRequestPBImpl
                                                              (proto);

            try
            {
                UseSharedCacheResourceResponse response = real.Use(request);
                return(((UseSharedCacheResourceResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual SecurityProtos.GetDelegationTokenResponseProto GetDelegationToken(
            RpcController controller, SecurityProtos.GetDelegationTokenRequestProto proto)
        {
            GetDelegationTokenRequestPBImpl request = new GetDelegationTokenRequestPBImpl(proto
                                                                                          );

            try
            {
                GetDelegationTokenResponse response = real.GetDelegationToken(request);
                return(((GetDelegationTokenResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
 Refresh(RpcController controller, GenericRefreshProtocolProtos.GenericRefreshRequestProto
         request)
 {
     try
     {
         IList <string> argList = request.GetArgsList();
         string[]       args    = Collections.ToArray(argList, new string[argList.Count]);
         if (!request.HasIdentifier())
         {
             throw new ServiceException("Request must contain identifier");
         }
         ICollection <RefreshResponse> results = impl.Refresh(request.GetIdentifier(), args
                                                              );
         return(Pack(results));
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
 }
Ejemplo n.º 22
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServerCommonServiceProtos.NodeHeartbeatResponseProto NodeHeartbeat
            (RpcController controller, YarnServerCommonServiceProtos.NodeHeartbeatRequestProto
            proto)
        {
            NodeHeartbeatRequestPBImpl request = new NodeHeartbeatRequestPBImpl(proto);

            try
            {
                NodeHeartbeatResponse response = real.NodeHeartbeat(request);
                return(((NodeHeartbeatResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        AddToClusterNodeLabels(RpcController controller, YarnServerResourceManagerServiceProtos.AddToClusterNodeLabelsRequestProto
                               proto)
        {
            AddToClusterNodeLabelsRequestPBImpl request = new AddToClusterNodeLabelsRequestPBImpl
                                                              (proto);

            try
            {
                AddToClusterNodeLabelsResponse response = real.AddToClusterNodeLabels(request);
                return(((AddToClusterNodeLabelsResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
 /// <exception cref="Com.Google.Protobuf.ServiceException"/>
 public virtual TraceAdminPB.ListSpanReceiversResponseProto ListSpanReceivers(RpcController
                                                                              controller, TraceAdminPB.ListSpanReceiversRequestProto req)
 {
     try
     {
         SpanReceiverInfo[] descs = server.ListSpanReceivers();
         TraceAdminPB.ListSpanReceiversResponseProto.Builder bld = TraceAdminPB.ListSpanReceiversResponseProto
                                                                   .NewBuilder();
         for (int i = 0; i < descs.Length; ++i)
         {
             bld.AddDescriptions(((TraceAdminPB.SpanReceiverListInfo)TraceAdminPB.SpanReceiverListInfo
                                  .NewBuilder().SetId(descs[i].GetId()).SetClassName(descs[i].GetClassName()).Build
                                      ()));
         }
         return((TraceAdminPB.ListSpanReceiversResponseProto)bld.Build());
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
 }
Ejemplo n.º 25
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServerCommonServiceProtos.RegisterNodeManagerResponseProto RegisterNodeManager
            (RpcController controller, YarnServerCommonServiceProtos.RegisterNodeManagerRequestProto
            proto)
        {
            RegisterNodeManagerRequestPBImpl request = new RegisterNodeManagerRequestPBImpl(proto
                                                                                            );

            try
            {
                RegisterNodeManagerResponse response = real.RegisterNodeManager(request);
                return(((RegisterNodeManagerResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Ejemplo n.º 26
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual NamenodeProtocolProtos.GetBlockKeysResponseProto GetBlockKeys(RpcController
                                                                                     unused, NamenodeProtocolProtos.GetBlockKeysRequestProto request)
        {
            ExportedBlockKeys keys;

            try
            {
                keys = impl.GetBlockKeys();
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            NamenodeProtocolProtos.GetBlockKeysResponseProto.Builder builder = NamenodeProtocolProtos.GetBlockKeysResponseProto
                                                                               .NewBuilder();
            if (keys != null)
            {
                builder.SetKeys(PBHelper.Convert(keys));
            }
            return((NamenodeProtocolProtos.GetBlockKeysResponseProto)builder.Build());
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.ReservationDeleteResponseProto DeleteReservation
            (RpcController controller, YarnServiceProtos.ReservationDeleteRequestProto requestProto
            )
        {
            ReservationDeleteRequestPBImpl request = new ReservationDeleteRequestPBImpl(requestProto
                                                                                        );

            try
            {
                ReservationDeleteResponse response = real.DeleteReservation(request);
                return(((ReservationDeleteResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.FinishApplicationMasterResponseProto FinishApplicationMaster
            (RpcController arg0, YarnServiceProtos.FinishApplicationMasterRequestProto proto
            )
        {
            FinishApplicationMasterRequestPBImpl request = new FinishApplicationMasterRequestPBImpl
                                                               (proto);

            try
            {
                FinishApplicationMasterResponse response = real.FinishApplicationMaster(request);
                return(((FinishApplicationMasterResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Ejemplo n.º 29
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.RunSharedCacheCleanerTaskResponseProto RunCleanerTask
            (RpcController controller, YarnServiceProtos.RunSharedCacheCleanerTaskRequestProto
            proto)
        {
            RunSharedCacheCleanerTaskRequestPBImpl request = new RunSharedCacheCleanerTaskRequestPBImpl
                                                                 (proto);

            try
            {
                RunSharedCacheCleanerTaskResponse response = real.RunCleanerTask(request);
                return(((RunSharedCacheCleanerTaskResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual DatanodeProtocolProtos.ReportBadBlocksResponseProto ReportBadBlocks
            (RpcController controller, DatanodeProtocolProtos.ReportBadBlocksRequestProto request
            )
        {
            IList <HdfsProtos.LocatedBlockProto> lbps = request.GetBlocksList();

            LocatedBlock[] blocks = new LocatedBlock[lbps.Count];
            for (int i = 0; i < lbps.Count; i++)
            {
                blocks[i] = PBHelper.Convert(lbps[i]);
            }
            try
            {
                impl.ReportBadBlocks(blocks);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            return(VoidReportBadBlockResponse);
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServerCommonServiceProtos.SCMUploaderCanUploadResponseProto CanUpload
            (RpcController controller, YarnServerCommonServiceProtos.SCMUploaderCanUploadRequestProto
            proto)
        {
            SCMUploaderCanUploadRequestPBImpl request = new SCMUploaderCanUploadRequestPBImpl
                                                            (proto);

            try
            {
                SCMUploaderCanUploadResponse response = real.CanUpload(request);
                return(((SCMUploaderCanUploadResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual DatanodeProtocolProtos.BlockReceivedAndDeletedResponseProto BlockReceivedAndDeleted
            (RpcController controller, DatanodeProtocolProtos.BlockReceivedAndDeletedRequestProto
            request)
        {
            IList <DatanodeProtocolProtos.StorageReceivedDeletedBlocksProto> sBlocks = request
                                                                                       .GetBlocksList();

            StorageReceivedDeletedBlocks[] info = new StorageReceivedDeletedBlocks[sBlocks.Count
                                                  ];
            for (int i = 0; i < sBlocks.Count; i++)
            {
                DatanodeProtocolProtos.StorageReceivedDeletedBlocksProto     sBlock = sBlocks[i];
                IList <DatanodeProtocolProtos.ReceivedDeletedBlockInfoProto> list   = sBlock.GetBlocksList
                                                                                          ();
                ReceivedDeletedBlockInfo[] rdBlocks = new ReceivedDeletedBlockInfo[list.Count];
                for (int j = 0; j < list.Count; j++)
                {
                    rdBlocks[j] = PBHelper.Convert(list[j]);
                }
                if (sBlock.HasStorage())
                {
                    info[i] = new StorageReceivedDeletedBlocks(PBHelper.Convert(sBlock.GetStorage()),
                                                               rdBlocks);
                }
                else
                {
                    info[i] = new StorageReceivedDeletedBlocks(sBlock.GetStorageUuid(), rdBlocks);
                }
            }
            try
            {
                impl.BlockReceivedAndDeleted(PBHelper.Convert(request.GetRegistration()), request
                                             .GetBlockPoolId(), info);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            return(VoidBlockReceivedAndDeleteResponse);
        }
 /// <exception cref="Com.Google.Protobuf.ServiceException"/>
 public virtual GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto GetGroupsForUser
     (RpcController controller, GetUserMappingsProtocolProtos.GetGroupsForUserRequestProto
     request)
 {
     string[] groups;
     try
     {
         groups = impl.GetGroupsForUser(request.GetUser());
     }
     catch (IOException e)
     {
         throw new ServiceException(e);
     }
     GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto.Builder builder = GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto
                                                                                   .NewBuilder();
     foreach (string g in groups)
     {
         builder.AddGroups(g);
     }
     return((GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto)builder.Build
                ());
 }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual DatanodeProtocolProtos.CacheReportResponseProto CacheReport(RpcController
                                                                                   controller, DatanodeProtocolProtos.CacheReportRequestProto request)
        {
            DatanodeCommand cmd = null;

            try
            {
                cmd = impl.CacheReport(PBHelper.Convert(request.GetRegistration()), request.GetBlockPoolId
                                           (), request.GetBlocksList());
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            DatanodeProtocolProtos.CacheReportResponseProto.Builder builder = DatanodeProtocolProtos.CacheReportResponseProto
                                                                              .NewBuilder();
            if (cmd != null)
            {
                builder.SetCmd(PBHelper.Convert(cmd));
            }
            return((DatanodeProtocolProtos.CacheReportResponseProto)builder.Build());
        }
 public ObjectReplicationServerToClient_ClientProxy( RpcController rpc, IPEndPoint connection )
 {
     this.rpc = rpc;
       this.connection = connection;
 }
Ejemplo n.º 36
0
 protected RpcChannel(RpcController controller)
 {
     this.controller = controller;
     controller.Channel = this;
 }
Ejemplo n.º 37
0
 void network_NewConnection(NetworkLevel2Connection net2con, ConnectionInfo connectioninfo)
 {
     LogFile.WriteLine("Testnetrpc , new connection " + connectioninfo);
     RpcController rpc = new RpcController(network);
     TestController.GetInstance().rpc = rpc;
     Testing.TestInterface_ClientProxy testinterface_clientproxy = new OSMP.Testing.TestInterface_ClientProxy(rpc, null);
     testinterface_clientproxy.SayHello();
 }
Ejemplo n.º 38
0
            public void Go()
            {
                network = new NetworkLevel2Controller();
                network.ListenAsServer(serverport);
                network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

                RpcController rpc = new RpcController(network);
                TestController.GetInstance().rpc = rpc;

                while (true)
                {
                    network.Tick();
                    Thread.Sleep(50);
                }
                    //Testing.TestInterface_ClientProxy testinterface_clientproxy = new OSMP.Testing.TestInterface_ClientProxy( rpc,
            }
Ejemplo n.º 39
0
 public LoopbackRpcChannel(RpcController controller)
     : base(controller)
 {
 }
Ejemplo n.º 40
0
 //static NetReplicationController instance = new NetReplicationController();
 //public static NetReplicationController GetInstance(){ return instance; }
 public NetReplicationController( RpcController rpc )
 {
     this.rpc = rpc;
     referencecontroller = new NetObjectReferenceController();
     if (rpc.isserver)
     {
         dirtyobjectcontroller = new DirtyObjectController( this, rpc.network, rpc );
     }
 }
Ejemplo n.º 41
0
        public int Init( IConfigSource commandlineConfig, IClientControllers controllers )
        {
            Type type = Type.GetType( "OSMP.ObjectReplicationClientToServer" );
            LogFile.WriteLine( "type: [" + type + "] " + type.AssemblyQualifiedName );
            //System.Environment.Exit( 0 );

            Tao.DevIl.Il.ilInit();
               	Tao.DevIl.Ilu.iluInit();

            config = Config.GetInstance();

            string serverip = commandlineConfig.Configs["CommandLineArgs"].GetString( "serverip", config.ServerIPAddress );
            int port = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );

            network = new NetworkLevel2Controller();
            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

            network.ConnectAsClient(serverip, port);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);

            renderer = RendererFactory.GetInstance();
            renderer.Tick += new OSMP.TickHandler( MainLoop );
            renderer.Init();

            worldstorage = new WorldModel(netreplicationcontroller);
            worldview = new WorldView( worldstorage );
            playermovement = PlayerMovement.GetInstance();

            InitializePlayermovement();

            myavatar = new Avatar();
            worldstorage.AddEntity(myavatar);

               controllers.Plugin.LoadClientPlugins();
            if (!commandlineConfig.Configs["CommandLineArgs"].Contains("nochat" ))
            {
                LoadChat();
            }

            if( commandlineConfig.Configs["CommandLineArgs"].Contains("url" ) )
            {
            string url = commandlineConfig.Configs["CommandLineArgs"].GetString("url" );
                LogFile.WriteLine( "url: " +  url);

                if (url.StartsWith( "osmp://" ))
                {
                    targettoload = "http://" + url.Substring( "osmp://".Length );
                    LogFile.WriteLine( "target: " + targettoload );
                }
                else
                {
                    targettoload = url;
                }
            }

            renderer.StartMainLoop();

            return 0;
        }
 public LockRpcToClient_ClientProxy( RpcController rpc, IPEndPoint connection )
 {
     this.rpc = rpc;
       this.connection = connection;
 }
Ejemplo n.º 43
0
        //! metaverseserver entry point.  Processes commandline arguments; starts dbinterface and serverfileagent components; handles initialization
        public void Init( IConfigSource commandlineConfig, IServerControllers controllers )
        {
            config = Config.GetInstance();

            Test.Info("*** Server starting ***");

            Running = true;

            network = new NetworkLevel2Controller();

            ServerPort = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );
            Test.Debug("Creating Metaverse Client listener on port " + ServerPort );

            network.ListenAsServer(ServerPort);

            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
            network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController( rpc );
            World = new WorldModel(netreplicationcontroller);

            controllers.Plugin.LoadServerPlugins();

            Test.Info("*** Server initialization complete ***");
        }
 public WorldControl_ClientProxy( RpcController rpc, IPEndPoint connection )
 {
     this.rpc = rpc;
       this.connection = connection;
 }
 public TestInterface_ClientProxy( RpcController rpc, IPEndPoint connection )
 {
     this.rpc = rpc;
       this.connection = connection;
 }