Beispiel #1
0
 public RemoteServiceProxyFactoryImpl(ProxyGenerator proxyGenerator, PortableObjectBoxConverter portableObjectBoxConverter, RemoteServiceInvocationValidatorFactory validatorFactory, ClusteringPhaseManager clusteringPhaseManager)
 {
     this.proxyGenerator             = proxyGenerator;
     this.portableObjectBoxConverter = portableObjectBoxConverter;
     this.validatorFactory           = validatorFactory;
     this.clusteringPhaseManager     = clusteringPhaseManager;
 }
        public ServiceClient Construct(ClusteringConfiguration clusteringConfiguration)
        {
            if (clusteringConfiguration.ClusteringRole == ClusteringRole.HostOnly &&
                !IPAddress.IsLoopback(clusteringConfiguration.Address))
            {
                throw new InvalidOperationException("It is impossible host a Dargon Service cluster located at a remote address!");
            }

            LocalServiceContainer      localServiceContainer      = new LocalServiceContainerImpl(collectionFactory);
            ClusteringPhaseManager     clusteringPhaseManager     = new ClusteringPhaseManagerImpl();
            PortableObjectBoxConverter portableObjectBoxConverter = new PortableObjectBoxConverter(streamFactory, pofSerializer);
            HostSessionFactory         hostSessionFactory         = new HostSessionFactoryImpl(threadingProxy, collectionFactory, pofSerializer, pofStreamsFactory, portableObjectBoxConverter);
            ClusteringPhaseFactory     clusteringPhaseFactory     = new ClusteringPhaseFactoryImpl(collectionFactory, threadingProxy, networkingProxy, pofStreamsFactory, hostSessionFactory, clusteringConfiguration, portableObjectBoxConverter, clusteringPhaseManager);
            ClusteringPhase            initialClusteringPhase     = clusteringPhaseFactory.CreateIndeterminatePhase(localServiceContainer);

            clusteringPhaseManager.Transition(initialClusteringPhase);
            RemoteServiceInvocationValidatorFactory validatorFactory                  = new RemoteServiceInvocationValidatorFactoryImpl(collectionFactory);
            RemoteServiceProxyFactory      remoteServiceProxyFactory                  = new RemoteServiceProxyFactoryImpl(proxyGenerator, portableObjectBoxConverter, validatorFactory, clusteringPhaseManager);
            InvokableServiceContextFactory invokableServiceContextFactory             = new InvokableServiceContextFactoryImpl(collectionFactory, portableObjectBoxConverter);
            IConcurrentDictionary <Guid, InvokableServiceContext> serviceContextsById = new ConcurrentDictionary <Guid, InvokableServiceContext>();
            LocalServiceRegistry localServiceRegistry = new LocalServiceRegistryImpl(localServiceContainer, clusteringPhaseManager, invokableServiceContextFactory, serviceContextsById);
            IConcurrentDictionary <Type, object> serviceProxiesByInterface   = new ConcurrentDictionary <Type, object>();
            RemoteServiceProxyContainer          remoteServiceProxyContainer = new RemoteServiceProxyContainerImpl(remoteServiceProxyFactory, serviceProxiesByInterface);

            return(new ServiceClientProxyImpl(localServiceRegistry, remoteServiceProxyContainer));
        }
Beispiel #3
0
 public HostSessionFactoryImpl(IThreadingProxy threadingProxy, ICollectionFactory collectionFactory, IPofSerializer pofSerializer, PofStreamsFactory pofStreamsFactory, PortableObjectBoxConverter portableObjectBoxConverter)
 {
     this.threadingProxy             = threadingProxy;
     this.collectionFactory          = collectionFactory;
     this.pofSerializer              = pofSerializer;
     this.pofStreamsFactory          = pofStreamsFactory;
     this.portableObjectBoxConverter = portableObjectBoxConverter;
 }
 public InvokableServiceContextImpl(ICollectionFactory collectionFactory, PortableObjectBoxConverter portableObjectBoxConverter, object serviceImplementation, Type serviceInterface, Guid guid, IMultiValueDictionary <string, MethodDescriptor> methodDescriptorsByName)
 {
     this.collectionFactory          = collectionFactory;
     this.portableObjectBoxConverter = portableObjectBoxConverter;
     this.serviceImplementation      = serviceImplementation;
     this.serviceInterface           = serviceInterface;
     this.guid = guid;
     this.methodDescriptorsByName = methodDescriptorsByName;
 }
Beispiel #5
0
 public HostContextImpl(
     PortableObjectBoxConverter portableObjectBoxConverter,
     LocalServiceContainer localServiceContainer
     ) : this(
         portableObjectBoxConverter,
         localServiceContainer,
         new ConcurrentSet <RemoteInvokable>())
 {
 }
 public ClusteringPhaseFactoryImpl(ICollectionFactory collectionFactory, IThreadingProxy threadingProxy, INetworkingProxy networkingProxy, PofStreamsFactory pofStreamsFactory, HostSessionFactory hostSessionFactory, ClusteringConfiguration clusteringConfiguration, PortableObjectBoxConverter portableObjectBoxConverter, ClusteringPhaseManager clusteringPhaseManager)
 {
     this.collectionFactory          = collectionFactory;
     this.threadingProxy             = threadingProxy;
     this.networkingProxy            = networkingProxy;
     this.pofStreamsFactory          = pofStreamsFactory;
     this.hostSessionFactory         = hostSessionFactory;
     this.clusteringConfiguration    = clusteringConfiguration;
     this.portableObjectBoxConverter = portableObjectBoxConverter;
     this.clusteringPhaseManager     = clusteringPhaseManager;
 }
Beispiel #7
0
        private ServiceClientFactoryImpl CreateServiceClientFactory(params PofContext[] pofContexts)
        {
            var proxyGenerator = new ProxyGenerator();
            ICollectionFactory      collectionFactory            = new CollectionFactory();
            IThreadingFactory       threadingFactory             = new ThreadingFactory();
            ISynchronizationFactory synchronizationFactory       = new SynchronizationFactory();
            IThreadingProxy         threadingProxy               = new ThreadingProxy(threadingFactory, synchronizationFactory);
            IDnsProxy                  dnsProxy                  = new DnsProxy();
            ITcpEndPointFactory        tcpEndPointFactory        = new TcpEndPointFactory(dnsProxy);
            IStreamFactory             streamFactory             = new StreamFactory();
            INetworkingInternalFactory networkingInternalFactory = new NetworkingInternalFactory(threadingProxy, streamFactory);
            ISocketFactory             socketFactory             = new SocketFactory(tcpEndPointFactory, networkingInternalFactory);
            INetworkingProxy           networkingProxy           = new NetworkingProxy(socketFactory, tcpEndPointFactory);
            PofContext                 pofContext                = new DspPofContext();

            pofContexts.ForEach(pofContext.MergeContext);
            IPofSerializer                 pofSerializer                  = new PofSerializer(pofContext);
            PofStreamsFactory              pofStreamsFactory              = new PofStreamsFactoryImpl(threadingProxy, streamFactory, pofSerializer);
            PortableObjectBoxConverter     portableObjectBoxConverter     = new PortableObjectBoxConverter(streamFactory, pofSerializer);
            InvokableServiceContextFactory invokableServiceContextFactory = new InvokableServiceContextFactoryImpl(collectionFactory, portableObjectBoxConverter);

            return(new ServiceClientFactoryImpl(proxyGenerator, streamFactory, collectionFactory, threadingProxy, networkingProxy, pofSerializer, pofStreamsFactory));
        }
Beispiel #8
0
 public InvokableServiceContextFactoryImpl(ICollectionFactory collectionFactory, PortableObjectBoxConverter portableObjectBoxConverter)
 {
     this.collectionFactory          = collectionFactory;
     this.portableObjectBoxConverter = portableObjectBoxConverter;
 }
Beispiel #9
0
 public InvocationResultTranslatorImpl(PortableObjectBoxConverter portableObjectBoxConverter)
 {
     this.portableObjectBoxConverter = portableObjectBoxConverter;
 }
Beispiel #10
0
 public HostContextImpl(PortableObjectBoxConverter portableObjectBoxConverter, LocalServiceContainer localServiceContainer, IConcurrentSet <RemoteInvokable> remoteInvokables)
 {
     this.portableObjectBoxConverter = portableObjectBoxConverter;
     this.localServiceContainer      = localServiceContainer;
     this.remoteInvokables           = remoteInvokables;
 }