Reorganization

This commit is contained in:
watsonb8
2019-07-05 14:17:09 -04:00
parent a01d399a1f
commit ec6a7586c7
76 changed files with 475 additions and 296 deletions

View File

@ -0,0 +1,57 @@
using System;
using System.Reflection;
using System.Linq;
namespace Aurora.Executors
{
public abstract class BaseExecutor
{
protected BaseExecutor()
{
}
public Type ExecutorType { get; protected set; }
public static BaseExecutor CreateExecutor<T>()
{
BaseExecutor executor = null;
if (typeof(T) == typeof(HostExecutor))
{
executor = new HostExecutor();
executor.ExecutorType = typeof(HostExecutor);
}
else if (typeof(T) == typeof(ClientExecutor))
{
executor = new ClientExecutor();
executor.ExecutorType = typeof(ClientExecutor);
}
else
{
throw new InvalidOperationException("Cannot create an executor of type: " + nameof(T));
}
return executor;
}
public abstract void Initialize();
public abstract void Run();
public abstract void Close();
public abstract void GetMembers();
public abstract void GetQueue();
public abstract void AddToQueue();
public abstract void RemoveFromQueue();
}
public enum ExecutorType
{
Server,
Client
}
}

View File

@ -0,0 +1,48 @@
using System;
using Aurora.Executors;
namespace Aurora.Executors
{
public class ClientExecutor : BaseExecutor
{
public ClientExecutor()
{
}
public override void AddToQueue()
{
throw new NotImplementedException();
}
public override void Close()
{
throw new NotImplementedException();
}
public override void GetMembers()
{
throw new NotImplementedException();
}
public override void GetQueue()
{
throw new NotImplementedException();
}
public override void Initialize()
{
throw new NotImplementedException();
}
public override void RemoveFromQueue()
{
throw new NotImplementedException();
}
public override void Run()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Threading.Tasks;
using Aurora.Executors;
using Aurora.Services;
using Aurora.Proto;
using Aurora.RemoteImpl;
namespace Aurora.Executors
{
public class HostExecutor : BaseExecutor
{
RemotePartyServiceImpl _remoteServiceImpl;
RemotePlaybackServiceImpl _remotePlaybackImpl;
public HostExecutor()
{
_remoteServiceImpl = new RemotePartyServiceImpl();
_remotePlaybackImpl = new RemotePlaybackServiceImpl();
}
public override void Initialize()
{
//Register grpc RemoteService with singleton server service
ServerService.Instance.RegisterService(RemotePartyService.BindService(_remoteServiceImpl));
ServerService.Instance.RegisterService(RemotePlaybackService.BindService(_remotePlaybackImpl));
}
public override async void Close()
{
await ServerService.Instance.Stop();
}
public override void AddToQueue()
{
throw new NotImplementedException();
}
public override void GetMembers()
{
throw new NotImplementedException();
}
public override void GetQueue()
{
throw new NotImplementedException();
}
public override void RemoveFromQueue()
{
throw new NotImplementedException();
}
public override void Run()
{
throw new NotImplementedException();
}
}
}