Reorganization
This commit is contained in:
57
Aurora/Executors/BaseExecutor.cs
Normal file
57
Aurora/Executors/BaseExecutor.cs
Normal 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
|
||||
}
|
||||
}
|
48
Aurora/Executors/ClientExecutor.cs
Normal file
48
Aurora/Executors/ClientExecutor.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
57
Aurora/Executors/HostExecutor.cs
Normal file
57
Aurora/Executors/HostExecutor.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user