public ProjectionConfig(
     ProjectionMode mode, int checkpointHandledThreshold, int checkpointUnhandledBytesThreshold, int pendingEventsThreshold, int maxWriteBatchLength,
     bool publishStateUpdates, bool emitEventEnabled, bool checkpointsEnabled)
 {
     _mode = mode;
     if (checkpointsEnabled)
     {
         if (checkpointHandledThreshold <= 0)
             throw new ArgumentOutOfRangeException("checkpointHandledThreshold");
         if (checkpointUnhandledBytesThreshold < checkpointHandledThreshold)
             throw new ArgumentException("Checkpoint threshold cannot be less than checkpoint handled threshold");
     }
     else
     {
         if (checkpointHandledThreshold != 0)
             throw new ArgumentOutOfRangeException("checkpointHandledThreshold must be 0");
         if (checkpointUnhandledBytesThreshold != 0)
             throw new ArgumentException("checkpointUnhandledBytesThreshold must be 0");
     }
     _checkpointHandledThreshold = checkpointHandledThreshold;
     _checkpointUnhandledBytesThreshold = checkpointUnhandledBytesThreshold;
     _pendingEventsThreshold = pendingEventsThreshold;
     _maxWriteBatchLength = maxWriteBatchLength;
     _publishStateUpdates = publishStateUpdates;
     _emitEventEnabled = emitEventEnabled;
     _checkpointsEnabled = checkpointsEnabled;
 }
Beispiel #2
0
 public void SetProjectionMode(ProjectionMode mode)
 {
     Interop.CameraActor.SetProjectionMode(swigCPtr, (int)mode);
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #3
0
        public void SetDefaultValues()
        {
            m_ProjectionMode    = ProjectionMode.Perspective;
            m_NearClippingPlane = 0.03f;
            m_FarClippingPlane  = 1000f;

            Body.SetupDefaultValues();
            Lens.SetupDefaultValues();
        }
Beispiel #4
0
 void IContentUpdatableFromMediaEngine.SetProjection(ProjectionMode projection)
 {
     lock (localCritical)
     {
         primitive?.Dispose();
         primitive      = GraphicTools.CreateGeometry(projection, graphicsDevice);
         projectionMode = projection;
     };
 }
 // shortcut for posting ad-hoc JS queries
 public Post(IEnvelope envelope, string query, bool enabled)
 {
     _envelope    = envelope;
     _name        = Guid.NewGuid().ToString("D");
     _handlerType = "JS";
     _mode        = ProjectionMode.OneTime;
     _query       = query;
     _enabled     = enabled;
 }
 public Post(IEnvelope envelope, ProjectionMode mode, string name, string handlerType, string query, bool enabled)
 {
     _envelope    = envelope;
     _name        = name;
     _handlerType = handlerType;
     _mode        = mode;
     _query       = query;
     _enabled     = enabled;
 }
Beispiel #7
0
 /// <summary>
 /// Set ProjectionMode for ALL CamGroups.
 /// </summary>
 /// <param name="mode">
 /// A <see cref="System.Int32"/>
 /// </param>
 public void SwitchProjectionMode(int mode)
 {
     projectionMode = (ProjectionMode)mode;
     CamGroup[] groups = GetComponentsInChildren <CamGroup>();
     foreach (CamGroup group in groups)
     {
         group.ProjectionMode = projectionMode;
     }
 }
Beispiel #8
0
        private static ProjectionConfig CreateDefaultProjectionConfiguration(ProjectionMode mode)
        {
            var projectionConfig = new ProjectionConfig(
                mode, mode > ProjectionMode.AdHoc ? 2000 : 0, mode > ProjectionMode.AdHoc ? 10 * 1000 * 1000 : 0, 1000, 500,
                publishStateUpdates: mode == ProjectionMode.Persistent, checkpointsEnabled: mode > ProjectionMode.AdHoc,
                emitEventEnabled: mode == ProjectionMode.Persistent);  //TODO: allow emit in continuous

            return(projectionConfig);
        }
 public Post(IEnvelope envelope, ProjectionMode mode, string name, string handlerType, string query, bool enabled)
 {
     _envelope = envelope;
     _name = name;
     _handlerType = handlerType;
     _mode = mode;
     _query = query;
     _enabled = enabled;
 }
 public View(int x, int y, int width, int height, ProjectionMode mode = ProjectionMode.Perspective, Camera camera = null)
 {
     X              = x;
     Y              = y;
     Width          = width;
     Height         = height;
     ProjectionMode = mode;
     Camera         = camera ?? new Camera();
 }
 // shortcut for posting ad-hoc JS queries
 public Post(IEnvelope envelope, string query, bool enabled)
 {
     _envelope = envelope;
     _name = Guid.NewGuid().ToString("D");
     _handlerType = "JS";
     _mode = ProjectionMode.OneTime;
     _query = query;
     _enabled = enabled;
 }
Beispiel #12
0
        protected override IEnumerable <WhenStep> When()
        {
            _projectionId       = Guid.NewGuid();
            _bufferedEvents     = 100;
            _checkpointStatus   = "checkpoint-status";
            _coreProcessingTime = 10;
            _resultStreamName   = "result-stream";
            _effectiveName      = "effective-name";
            _enabled            = true;
            _epoch = 10;
            _eventsProcessedAfterRestart = 12345;
            _lastCheckpoint   = "last-chgeckpoint";
            _masterStatus     = ManagedProjectionState.Completed;
            _mode             = ProjectionMode.OneTime;
            _partitionsCached = 123;
            _name             = "name";
            _position         = CheckpointTag.FromPosition(0, 1000, 900).ToString();
            _progress         = 100;
            _projectionIdNum  = 1234;
            _readsInProgress  = 2;
            _stateReason      = "reason";
            _status           = "status";
            _version          = 1;
            _writePendingEventsAfterCheckpoint  = 3;
            _writePendingEventsBeforeCheckpoint = 4;
            _writesInProgress = 5;

            yield return(CreateWriteEvent("$projections-$master", "$statistics-report", @"{
                ""id"":""" + _projectionId.ToString("N") + @""",
                ""statistics"":{
                        ""bufferedEvents"":""" + _bufferedEvents + @""",
                        ""checkpointStatus"":""" + _checkpointStatus + @""",
                        ""coreProcessingTime"":""" + _coreProcessingTime + @""",
                        ""resultStreamName"":""" + _resultStreamName + @""",
                        ""effectiveName"":""" + _effectiveName + @""",
                        ""enabled"":""" + _enabled + @""",
                        ""epoch"":""" + _epoch + @""",
                        ""eventsProcessedAfterRestart"":""" + _eventsProcessedAfterRestart + @""",
                        ""lastCheckpoint"":""" + _lastCheckpoint + @""",
                        ""masterStatus"":""" + _masterStatus + @""",
                        ""mode"":""" + _mode + @""",
                        ""partitionsCached"":""" + _partitionsCached + @""",
                        ""name"":""" + _name + @""",
                        ""position"":""" + _position + @""",
                        ""progress"":""" + _progress + @""",
                        ""projectionId"":""" + _projectionIdNum + @""",
                        ""readsInProgress"":""" + _readsInProgress + @""",
                        ""stateReason"":""" + _stateReason + @""",
                        ""status"":""" + _status + @""",
                        ""version"":""" + _version + @""",
                        ""writePendingEventsAfterCheckpoint"":""" + _writePendingEventsAfterCheckpoint + @""",
                        ""writePendingEventsBeforeCheckpoint"":""" + _writePendingEventsBeforeCheckpoint + @""",
                        ""writesInProgress"":""" + _writesInProgress + @""",
                }
            }", null, true));
        }
        protected override IEnumerable<WhenStep> When()
        {
            _projectionId = Guid.NewGuid();
            _bufferedEvents = 100;
            _checkpointStatus = "checkpoint-status";
            _coreProcessingTime = 10;
            _resultStreamName = "result-stream";
            _effectiveName = "effective-name";
            _enabled = true;
            _epoch = 10;
            _eventsProcessedAfterRestart = 12345;
            _lastCheckpoint = "last-chgeckpoint";
            _masterStatus = ManagedProjectionState.Completed;
            _mode = ProjectionMode.OneTime;
            _partitionsCached = 123;
            _name = "name";
            _position = CheckpointTag.FromPosition(0, 1000, 900).ToString();
            _progress = 100;
            _projectionIdNum = 1234;
            _readsInProgress = 2;
            _stateReason = "reason";
            _status = "status";
            _version = 1;
            _writePendingEventsAfterCheckpoint = 3;
            _writePendingEventsBeforeCheckpoint = 4;
            _writesInProgress = 5;

            yield return CreateWriteEvent("$projections-$master", "$statistics-report", @"{
                ""id"":""" + _projectionId.ToString("N") + @""",
                ""statistics"":{
                        ""bufferedEvents"":""" + _bufferedEvents + @""",
                        ""checkpointStatus"":""" + _checkpointStatus + @""",
                        ""coreProcessingTime"":""" + _coreProcessingTime + @""",
                        ""resultStreamName"":""" + _resultStreamName + @""",
                        ""effectiveName"":""" + _effectiveName + @""",
                        ""enabled"":""" + _enabled + @""",
                        ""epoch"":""" + _epoch + @""",
                        ""eventsProcessedAfterRestart"":""" + _eventsProcessedAfterRestart + @""",
                        ""lastCheckpoint"":""" + _lastCheckpoint + @""",
                        ""masterStatus"":""" + _masterStatus + @""",
                        ""mode"":""" + _mode + @""",
                        ""partitionsCached"":""" + _partitionsCached + @""",
                        ""name"":""" + _name + @""",
                        ""position"":""" + _position + @""",
                        ""progress"":""" + _progress + @""",
                        ""projectionId"":""" + _projectionIdNum + @""",
                        ""readsInProgress"":""" + _readsInProgress + @""",
                        ""stateReason"":""" + _stateReason + @""",
                        ""status"":""" + _status + @""",
                        ""version"":""" + _version + @""",
                        ""writePendingEventsAfterCheckpoint"":""" + _writePendingEventsAfterCheckpoint + @""",
                        ""writePendingEventsBeforeCheckpoint"":""" + _writePendingEventsBeforeCheckpoint + @""",
                        ""writesInProgress"":""" + _writesInProgress + @""",
                }
            }", null, true);
        }
Beispiel #14
0
        public ProjectionMode GetProjectionMode()
        {
            ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
            protected override void Given()
            {
                base.Given();

                _projectionName = "test-projection";
                _projectionSource = @"";
                _fakeProjectionType = typeof (FakeProjection);
                _projectionMode = ProjectionMode.Transient;
                _checkpointsEnabled = false;
                _emitEnabled = false;
            }
Beispiel #16
0
            protected override void Given()
            {
                base.Given();

                _projectionName     = "test-projection";
                _projectionSource   = @"";
                _fakeProjectionType = typeof(FakeProjection);
                _projectionMode     = ProjectionMode.Transient;
                _checkpointsEnabled = false;
                _emitEnabled        = false;
            }
 // shortcut for posting ad-hoc JS queries
 public Post(IEnvelope envelope, RunAs runAs, string query, bool enabled)
     : base(envelope, runAs)
 {
     _name               = Guid.NewGuid().ToString("D");
     _handlerType        = "JS";
     _mode               = ProjectionMode.Transient;
     _query              = query;
     _enabled            = enabled;
     _checkpointsEnabled = false;
     _emitEnabled        = false;
 }
 // shortcut for posting ad-hoc JS queries
 public Post(IEnvelope envelope, RunAs runAs, string query, bool enabled)
     : base(envelope, runAs)
 {
     _name = Guid.NewGuid().ToString("D");
     _handlerType = "JS";
     _mode = ProjectionMode.Transient;
     _query = query;
     _enabled = enabled;
     _checkpointsEnabled = false;
     _emitEnabled = false;
 }
Beispiel #19
0
 /// <summary>
 /// Instantiates a new camera with the associated viewport and name.
 /// </summary>
 /// <param name="name">Name of the camera</param>
 /// <param name="viewport">Viewport to bind to the camera</param>
 public Camera(String name, Viewport viewport)
 {
     _name           = name;
     _viewport       = viewport;
     _position       = new Vector3(0, 0, 0);
     _right          = Vector3.Right;
     _up             = Vector3.Up;
     _direction      = Vector3.Forward;
     _projectionMode = ProjectionMode.Perspective;
     _frustum        = new BoundingFrustum(Matrix.Identity);
 }
Beispiel #20
0
        public Vector3 ProjectToMyWorld(Vector4 worldPos, ProjectionMode mode)
        {
            switch (mode)
            {
            case ProjectionMode.Orthogonal:
                return(Position4DToMyWorld(worldPos));

            default:
                return(Vector3.zero);
            }
        }
Beispiel #21
0
 protected override void Given()
 {
     _name               = "name";
     _runAs              = ProjectionManagementMessage.RunAs.System;
     _mode               = ProjectionMode.Continuous;
     _handlerType        = "JS";
     _query              = "fromAll();";
     _enabled            = true;
     _checkpointsEnabled = true;
     _emitEnabled        = true;
     _enableRunAs        = true;
 }
 public Material(float kreflection = 0, int specularK = 10, float kdiffuse = 2f, float kspecular = 0.5f, float emission = 0f)
 {
     UvProjection = ProjectionMode.SolidColor;
     Color        = Colors.White.ToVector3();
     SpecularK    = specularK;
     Kreflection  = kreflection;
     Kdiffuse     = kdiffuse;
     Kspecular    = kspecular;
     Tiling       = new Tiling();
     HdrImage     = null;
     Emission     = emission;
 }
Beispiel #23
0
 /// <summary>
 /// Sets the camera's projection, either an orthographic camera or a perspective camera.
 /// </summary>
 /// <param name="mode">Projection mode, perspective or orthographic</param>
 /// <param name="left">Minimum x value of the view volume at the near view plane</param>
 /// <param name="right">Maximum x value of the view volume at the near view plane</param>
 /// <param name="bottom">Minimum y value of the view volume at the near view plane</param>
 /// <param name="top">Maximum y value of the view volume at the near view plane</param>
 /// <param name="near">Distance to the near view plane (or min-Z value if ortho)</param>
 /// <param name="far">Distance to the far view plane (or max-Z value if ortho)</param>
 public void SetProjection(ProjectionMode mode, float left, float right, float bottom, float top, float near, float far)
 {
     if (mode == ProjectionMode.Perspective)
     {
         _proj = Matrix.CreatePerspectiveMatrix(left, right, bottom, top, near, far);
     }
     else
     {
         _proj = Matrix.CreateOrthoMatrix(left, right, bottom, top, near, far);
     }
     _projectionMode = mode;
 }
 protected override void Given()
 {
     base.Given();
     AllWritesSucceed();
     NoOtherStreams();
     GivenEvents();
     _projectionName = "query";
     _projectionSource = GivenQuery();
     _projectionMode = ProjectionMode.Transient;
     _checkpointsEnabled = false;
     _emitEnabled = false;
 }
Beispiel #25
0
 /// <summary>
 /// Set the camera's projection, either an orthographic camera or a perspective camera.
 /// </summary>
 /// <param name="mode">Projection mode, perspective or orthographic</param>
 /// <param name="width">Width of the view volume at the near view plane</param>
 /// <param name="height">Height of the view volume at the near view plane</param>
 /// <param name="near">Distance to the near view plane (or min-Z value if ortho)</param>
 /// <param name="far">Distance to the far view plane (or max-Z value if ortho)</param>
 public void SetProjection(ProjectionMode mode, float width, float height, float near, float far)
 {
     if (mode == ProjectionMode.Perspective)
     {
         _proj = Matrix.CreatePerspectiveMatrix(width, height, near, far);
     }
     else
     {
         _proj = Matrix.CreateOrthoMatrix(width, height, near, far);
     }
     _projectionMode = mode;
 }
 protected override void Given()
 {
     _name = "name";
     _runAs = ProjectionManagementMessage.RunAs.System;
     _mode = ProjectionMode.Continuous;
     _handlerType = "JS";
     _query = "fromAll();";
     _enabled = true;
     _checkpointsEnabled = true;
     _emitEnabled = true;
     _enableRunAs = true;
 }
Beispiel #27
0
 protected override void Given()
 {
     base.Given();
     AllWritesSucceed();
     NoOtherStreams();
     GivenEvents();
     _projectionName     = "query";
     _projectionSource   = GivenQuery();
     _projectionMode     = ProjectionMode.Transient;
     _checkpointsEnabled = false;
     _emitEnabled        = false;
 }
Beispiel #28
0
 /// <summary>
 /// Sets this camera to match the values of the source camera.
 /// </summary>
 /// <param name="source">Source camera to copy from</param>
 public virtual void Set(ICamera source)
 {
     _name           = source.Name;
     _viewport       = source.Viewport;
     _position       = source.Position;
     _right          = source.Right;
     _up             = source.Up;
     _direction      = source.Direction;
     _projectionMode = source.ProjectionMode;
     _proj           = source.ProjectionMatrix;
     _view           = source.ViewMatrix;
     Update();
 }
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                NoOtherStreams();

                _projectionName = "test-projection";
                _projectionSource = @"";
                _fakeProjectionType = typeof (FakeBiStateProjection);
                _projectionMode = ProjectionMode.Continuous;
                _checkpointsEnabled = true;
                _emitEnabled = false;
            }
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                NoOtherStreams();

                _projectionName     = "test-projection";
                _projectionSource   = @"";
                _fakeProjectionType = typeof(FakeBiStateProjection);
                _projectionMode     = ProjectionMode.Continuous;
                _checkpointsEnabled = true;
                _emitEnabled        = false;
            }
 public Post(
     IEnvelope envelope, ProjectionMode mode, string name, RunAs runAs, Type handlerType, string query,
     bool enabled, bool checkpointsEnabled, bool emitEnabled, bool enableRunAs = false)
     : base(envelope, runAs)
 {
     _name = name;
     _handlerType = "native:" + handlerType.Namespace + "." + handlerType.Name;
     _mode = mode;
     _query = query;
     _enabled = enabled;
     _checkpointsEnabled = checkpointsEnabled;
     _emitEnabled = emitEnabled;
     _enableRunAs = enableRunAs;
 }
Beispiel #32
0
        public void OnEnable()
        {
            MicroLightManager manager = (MicroLightManager)target;

            EmRenderType                  = manager.mRenderType;
            EmProjectionMode              = manager.mProjectionMode;
            EmRenderMode                  = manager.mRenderMode;
            EmPlayAeraSize                = manager.mPlayAeraSize;
            EPlayAeraDrawGridColor        = manager.PlayAeraDrawGridColor;
            EPlayAeraDrawGridOutlineColor = manager.PlayAeraDrawGridOutlineColor;
            EPlayAeraEditorDrawGrid       = manager.PlayAeraEditorDrawGrid;
            manager.TempmProjectionMode   = manager.mProjectionMode;
            EPDI = manager.PDI;
        }
 public Post(
     IEnvelope envelope, ProjectionMode mode, string name, RunAs runAs, string handlerType, string query,
     bool enabled, bool checkpointsEnabled, bool emitEnabled, bool enableRunAs = false)
     : base(envelope, runAs)
 {
     _name               = name;
     _handlerType        = handlerType;
     _mode               = mode;
     _query              = query;
     _enabled            = enabled;
     _checkpointsEnabled = checkpointsEnabled;
     _emitEnabled        = emitEnabled;
     _enableRunAs        = enableRunAs;
 }
 public Definition(
     string name, string handlerType, string query, SlaveProjectionRequestedNumber requestedNumber,
     ProjectionMode mode, bool emitEnabled, bool checkpointsEnabled, bool enableRunAs,
     SerializedRunAs runAs1)
 {
     Name = name;
     HandlerType = handlerType;
     Query = query;
     RequestedNumber = requestedNumber;
     RunAs1 = runAs1;
     EnableRunAs = enableRunAs;
     CheckpointsEnabled = checkpointsEnabled;
     EmitEnabled = emitEnabled;
     Mode = mode;
 }
 protected new virtual void Given()
 {
     _projectionCheckpointStreamId = "$projections-projection-checkpoint";
     _projectionCorrelationId      = Guid.NewGuid();
     _projection                        = new FakeCoreProjection();
     _projectionMode                    = ProjectionMode.Persistent;
     _checkpointHandledThreshold        = 2;
     _checkpointUnhandledBytesThreshold = 5;
     _pendingEventsThreshold            = 5;
     _maxWriteBatchLength               = 5;
     _publishStateUpdates               = true;
     _emitEventEnabled                  = true;
     _checkpointsEnabled                = true;
     NoStream(_projectionCheckpointStreamId);
 }
 public Definition(
     string name, string handlerType, string query, SlaveProjectionRequestedNumber requestedNumber,
     ProjectionMode mode, bool emitEnabled, bool checkpointsEnabled, bool enableRunAs,
     ProjectionManagementMessage.RunAs runAs)
 {
     _name = name;
     _handlerType = handlerType;
     _query = query;
     _requestedNumber = requestedNumber;
     _runAs = runAs;
     _enableRunAs = enableRunAs;
     _checkpointsEnabled = checkpointsEnabled;
     _emitEnabled = emitEnabled;
     _mode = mode;
 }
Beispiel #37
0
 public Definition(
     string name, string handlerType, string query, SlaveProjectionRequestedNumber requestedNumber,
     ProjectionMode mode, bool emitEnabled, bool checkpointsEnabled, bool enableRunAs,
     ProjectionManagementMessage.RunAs runAs)
 {
     _name               = name;
     _handlerType        = handlerType;
     _query              = query;
     _requestedNumber    = requestedNumber;
     _runAs              = runAs;
     _enableRunAs        = enableRunAs;
     _checkpointsEnabled = checkpointsEnabled;
     _emitEnabled        = emitEnabled;
     _mode               = mode;
 }
 protected override void Given()
 {
     base.Given();
     AllWritesSucceed();
     NoOtherStreams();
     GivenEvents();
     EnableReadAll();
     _projectionName = "query";
     _projectionSource = GivenQuery();
     _projectionMode = ProjectionMode.Transient;
     _checkpointsEnabled = false;
     _trackEmittedStreams = false;
     _emitEnabled = false;
     _startSystemProjections = GivenStartSystemProjections();
 }
 public Post(
     IEnvelope envelope, ProjectionMode mode, string name, RunAs runAs, Type handlerType, string query,
     bool enabled, bool checkpointsEnabled, bool emitEnabled, bool trackEmittedStreams, bool enableRunAs = false)
     : base(envelope, runAs)
 {
     _name                = name;
     _handlerType         = "native:" + handlerType.Namespace + "." + handlerType.Name;
     _mode                = mode;
     _query               = query;
     _enabled             = enabled;
     _checkpointsEnabled  = checkpointsEnabled;
     _emitEnabled         = emitEnabled;
     _trackEmittedStreams = trackEmittedStreams;
     _enableRunAs         = enableRunAs;
 }
 public void Validate(ProjectionMode mode)
 {
     if (!_allStreams && _categories == null && _streams == null)
         throw new InvalidOperationException("None of streams and categories are included");
     if (!_allEvents && _events == null)
         throw new InvalidOperationException("None of events are included");
     if (_streams != null && _categories != null)
         throw new InvalidOperationException("Streams and categories cannot be included in a filter at the same time");
     if (_allStreams && (_categories != null || _streams != null))
         throw new InvalidOperationException("Both FromAll and specific categories/streams cannot be set");
     if (_allEvents && _events != null)
         throw new InvalidOperationException("Both AllEvents and specific event filters cannot be set");
     if (_byStream && mode < ProjectionMode.Persistent)
         throw new InvalidOperationException("Partitioned (foreachStream) projections require Persistent mode");
 }
Beispiel #41
0
 protected override void Given()
 {
     base.Given();
     AllWritesSucceed();
     NoOtherStreams();
     GivenEvents();
     EnableReadAll();
     _projectionName         = "query";
     _projectionSource       = GivenQuery();
     _projectionMode         = ProjectionMode.Transient;
     _checkpointsEnabled     = false;
     _trackEmittedStreams    = false;
     _emitEnabled            = false;
     _startSystemProjections = GivenStartSystemProjections();
 }
 public Post(
     IEnvelope envelope, ProjectionMode mode, string name, RunAs runAs, string handlerType, string query,
     bool enabled, bool checkpointsEnabled, bool emitEnabled, bool trackEmittedStreams, bool enableRunAs = false)
     : base(envelope, runAs)
 {
     _name = name;
     _handlerType = handlerType;
     _mode = mode;
     _query = query;
     _enabled = enabled;
     _checkpointsEnabled = checkpointsEnabled;
     _emitEnabled = emitEnabled;
     _trackEmittedStreams = trackEmittedStreams;
     _enableRunAs = enableRunAs;
 }
Beispiel #43
0
 public Definition(
     string name, string handlerType, string query, SlaveProjectionRequestedNumber requestedNumber,
     ProjectionMode mode, bool emitEnabled, bool checkpointsEnabled, bool enableRunAs,
     SerializedRunAs runAs1)
 {
     Name               = name;
     HandlerType        = handlerType;
     Query              = query;
     RequestedNumber    = requestedNumber;
     RunAs1             = runAs1;
     EnableRunAs        = enableRunAs;
     CheckpointsEnabled = checkpointsEnabled;
     EmitEnabled        = emitEnabled;
     Mode               = mode;
 }
 protected new virtual void Given()
 {
     _projectionStateUpdatesStreamId = "$projections-projection-state";
     _projectionCorrelationId = Guid.NewGuid();
     _projection = new FakeCoreProjection();
     _projectionMode = ProjectionMode.Persistent;
     _checkpointHandledThreshold = 2;
     _checkpointUnhandledBytesThreshold = 5;
     _pendingEventsThreshold = 5;
     _maxWriteBatchLength = 5;
     _publishStateUpdates = true;
     _emitEventEnabled = true;
     _checkpointsEnabled = true;
     NoStream(_projectionStateUpdatesStreamId);
 }
Beispiel #45
0
        protected override void Given()
        {
            base.Given();

            _projectionName     = "test-projection";
            _projectionSource   = @"";
            _fakeProjectionType = typeof(FakeProjection);
            _projectionMode     = ProjectionMode.Continuous;
            _checkpointsEnabled = true;
            _emitEnabled        = true;
            _projectionEnabled  = true;

            NoStream("$projections-" + _projectionName + "-checkpoint");
            NoStream("$projections-" + _projectionName + "-order");
            AllWritesSucceed();
        }
        protected override void Given()
        {
            base.Given();

            _projectionName = "test-projection";
            _projectionSource = @"";
            _fakeProjectionType = typeof (FakeProjection);
            _projectionMode = ProjectionMode.Continuous;
            _checkpointsEnabled = true;
            _emitEnabled = true;
            _projectionEnabled = true;

            NoStream("$projections-" + _projectionName + "-checkpoint");
            NoStream("$projections-" + _projectionName + "-order");
            AllWritesSucceed();
        }
 public ProjectionPost(
     ProjectionMode mode, RunAs runAs, string name, string handlerType, string query,
     bool enabled, bool checkpointsEnabled, bool emitEnabled, bool enableRunAs,
     bool trackEmittedStreams)
 {
     Mode                = mode;
     RunAs               = runAs;
     Name                = name;
     HandlerType         = handlerType;
     Query               = query;
     Enabled             = enabled;
     CheckpointsEnabled  = checkpointsEnabled;
     EmitEnabled         = emitEnabled;
     EnableRunAs         = enableRunAs;
     TrackEmittedStreams = trackEmittedStreams;
 }
        /// <summary>
        /// Creates BitmapProjection instances.
        /// </summary>
        /// <param name="mode">
        /// The <see cref="ProjectionMode"/> used for the projection.
        /// </param>
        /// <param name="mtb">
        /// The <see cref="MathTextBitmap"/> to be projected.
        /// </param>
        /// <returns>
        /// The <see cref="BitmapProjection"/> created.
        /// </returns>
		public static BitmapProjection CreateProjection(ProjectionMode mode, 
                                                        MathTextBitmap mtb)
		{
			BitmapProjection res=null;
			
			switch(mode)
			{
				case(ProjectionMode.Horizontal):
					res=new HorizontalBitmapProjection(mtb);
					break;
				case(ProjectionMode.Vertical):
					res=new VerticalBitmapProjection(mtb);
					break;
				default:
					throw new ArgumentException(
						"No puede usar None para crear una nueva projección");				
			}
			return res;
		}
		/// <summary>
		/// Constructor de la clase <code>ProjectionBitmapSegmenter</code>.
		/// </summary>
		/// <param name="mode">El modo que se usara para obtener la proyeccion (horizontal,vertical).</param>
		public ProjectionSegmenter(ProjectionMode mode)
		{
			this.mode=mode;		
		}
 public GetStatistics(IEnvelope envelope, ProjectionMode? mode, string name, bool includeDeleted)
 {
     _envelope = envelope;
     _mode = mode;
     _name = name;
     _includeDeleted = includeDeleted;
 }
            public static bool ValidateRunAs(ProjectionMode mode, ReadWrite readWrite, IPrincipal existingRunAs, Command.ControlMessage message, bool replace = false)
            {
                if (mode > ProjectionMode.Transient && readWrite == ReadWrite.Write
                    && (message.RunAs == null || message.RunAs.Principal == null
                        || !message.RunAs.Principal.IsInRole(SystemRoles.Admins)))
                {
                    message.Envelope.ReplyWith(new NotAuthorized());
                    return false;
                }

                if (replace && message.RunAs.Principal == null)
                {
                    message.Envelope.ReplyWith(new NotAuthorized());
                    return false;
                }
                if (replace && message.RunAs.Principal != null)
                    return true; // enable this operation while no projection permissions are defined

                return true;

                //if (existingRunAs == null)
                //    return true;
                //if (message.RunAs1.Principal == null
                //    || !string.Equals(
                //        existingRunAs.Identity.Name, message.RunAs1.Principal.Identity.Name,
                //        StringComparison.OrdinalIgnoreCase))
                //{
                //    message.Envelope.ReplyWith(new NotAuthorized());
                //    return false;
                //}
                //return true;
            }
		public MostFrequentHoleProjectionSegmenter(ProjectionMode mode)
			:base(mode){}
Beispiel #53
0
 /// <summary>
 /// Set ProjectionMode for ALL CamGroups.
 /// </summary>
 /// <param name="mode">
 /// A <see cref="System.Int32"/>
 /// </param>
 public void SwitchProjectionMode(int mode)
 {
     projectionMode = (ProjectionMode)mode;
     CamGroup[] groups = GetComponentsInChildren<CamGroup>();
     foreach (CamGroup group in groups)
     {
         group.ProjectionMode = projectionMode;
     }
 }
		public AllHolesProjectionSegmenter(ProjectionMode mode):base(mode)
		{
		
		}
 private static ProjectionConfig CreateDefaultProjectionConfiguration(ProjectionMode mode)
 {
     var projectionConfig = new ProjectionConfig(
         mode, mode > ProjectionMode.AdHoc ? 2000 : 0, mode > ProjectionMode.AdHoc ? 10*1000*1000 : 0, 1000, 500,
         publishStateUpdates: mode == ProjectionMode.Persistent, checkpointsEnabled: mode > ProjectionMode.AdHoc,
         emitEventEnabled: mode == ProjectionMode.Persistent); //TODO: allow emit in continuous
     return projectionConfig;
 }
 public CheckpointStrategy Build(ProjectionMode mode)
 {
     base.Validate(mode);
     return new CheckpointStrategy(
         _allStreams, ToSet(_categories), ToSet(_streams), _allEvents, ToSet(_events), _byStream);
 }