예제 #1
0
 /// <summary>
 /// Testing constructor Only
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="inPipe"></param>
 /// <param name="dataObj"></param>
 /// <param name="isValid"></param>
 public DummyInputDataPort(IElement parent, IDataPipe inPipe, IFrame dataObj, bool isValid)
 {
     _parent = parent;
     _inPipe = inPipe;
     _dataObj = dataObj;
     _IsValid = isValid;
 }
예제 #2
0
        private static Func <Version, Tuple <Type, IDataPipe> > BuildDataPipeSelector(IComponentContext context)
        {
            Func <Version, Tuple <Type, IDataPipe> > result =
                version =>
            {
                var allPipesLazy = context.Resolve <IEnumerable <Meta <IDataPipe> > >();

                Type      selectedType = null;
                IDataPipe selectedPipe = null;
                foreach (var pipe in allPipesLazy)
                {
                    var storedVersion = pipe.Metadata["Version"] as Version;
                    var storedType    = pipe.Metadata["RegisteredType"] as Type;
                    if (storedVersion.Equals(version))
                    {
                        selectedPipe = pipe.Value;
                        selectedType = storedType;
                    }
                }

                return(new Tuple <Type, IDataPipe>(selectedType, selectedPipe));
            };

            return(result);
        }
예제 #3
0
 public IDataPipePresenter Create(IDataPipe pipe, IDataPipeView view)
 {
     DataPipePresenter pres = null;
     if (pipe != null && view != null)
     {
         pres = new DataPipePresenter(pipe, view);
     }
     return pres;
 }
예제 #4
0
        public bool Ok(IDataPipe pipe, string password, string confirmation)
        {
            var success = true;

            if (password != confirmation)
            {
                pipe.WriteLine("The passwords don't match");
                success = false;
            }
            if (password.Length < 8)
            {
                pipe.WriteLine("Password must be at least 8 characters in length");
                success = false;
            }
            return(success);
        }
예제 #5
0
        internal void LoadDataPipeIntoView(IDataPipe pipe, IPipeTicket ticket)
        {
            // get the element presenters for the source and target elements.
            IElementPresenter srcElPresenter = ElementPresenters[ticket.SrcElementId];
            IElementPresenter destElPresenter = ElementPresenters[ticket.DestElementId];

            // get the elements
            IElement srcEl = srcElPresenter.Element;
            IElement destEl = destElPresenter.Element;

            // get the port indices
            int srcPortIndex = -1;
            int destPortIndex = -1;
            GetPortIndices(ticket, srcEl, destEl, out srcPortIndex, out destPortIndex);

            if (destEl.InPortMgr.IsPortConnected(destPortIndex))
            {
                // TODO
                throw new InvalidOperationException("Input ports can only have 1 pipe connected to them.");
            }

            // get the element views
            IElementView srcElView = srcElPresenter.View;
            IElementView destElView = destElPresenter.View;

            // create the instance of the view
            IDataPipeView pipeView = CreateDataPipeView();

            LoadDataPipePresenterAndModel(pipe, pipeView, srcElView, destElView, srcPortIndex, destPortIndex);
        }
예제 #6
0
        internal IDataPipePresenter CreateDataPipePresenter(IDataPipe pipe, IDataPipeView view)
        {
            IDataPipePresenter pesenter = null;
            if (pipe != null && view != null)
            {
                // create the instance of the element presenter with the element and the view
                using (PipePresenterFactory fac = new PipePresenterFactory())
                {
                    pesenter = fac.Create(pipe, view);
                }
            }

            return pesenter;
        }
예제 #7
0
        internal void ConnectPipeModel(IDataPipe pipe, IOutputDataPort srcPort, IInputDataPort destPort)
        {
            IDataPlumber plumber = null;
            using (PlumberFactory pf = new PlumberFactory())
            {
                plumber = pf.CreateDataPlumber();
            }

            plumber.DataPipe = pipe;
            plumber.SetInitialPort(srcPort);
            plumber.SetFinalPort(destPort);
            bool result = plumber.Connect();

            // TODO log connection results.
            if (!result)
            {
                throw new InvalidOperationException("The pipe could not be connected");
            }
        }
예제 #8
0
 public void Reset()
 {
     _outputPort = null;
     _inputPort = null;
     _pipe = null;
 }
예제 #9
0
 public SecurityManager(IDataPipe pipe, IPasswordValidator validator, ICypher cypher)
 {
     _pipe      = pipe;
     _validator = validator;
     _cypher    = cypher;
 }
예제 #10
0
 public bool Remove(IDataPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #11
0
 public void Insert(int index, IDataPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #12
0
 public int IndexOf(IDataPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #13
0
 public void CopyTo(IDataPipe[] array, int arrayIndex)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #14
0
 public bool Contains(IDataPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #15
0
 public void Add(IDataPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
예제 #16
0
        internal void LoadDataPipePresenterAndModel(IDataPipe pipe, IDataPipeView pipeView, IElementView srcElView, IElementView destElView, int srcPortIndex, int destPortIndex)
        {
            Guid srcElId = srcElView.Id;
            Guid destElId = destElView.Id;

            // connect the pipe to the elements, at the model (biz) level.
            IOutputDataPort srcPort = GetSourceDataPort(srcElId, srcPortIndex);
            IInputDataPort destPort = GetDestinationDataPort(destElId, destPortIndex);
            ConnectPipeModel(pipe, srcPort, destPort);

            // set the id of the pipeView to the id of the pipe model
            pipeView.Id = pipe.Id;

            // create the instance of the presenter with the model and the view
            IDataPipePresenter presenter = CreateDataPipePresenter(pipe, pipeView);

            // Add the pipe presenter to the presenter mgr,and the view to the workspace view.
            // Pipe model has already been added to workspace during unpersisting.
            if (presenter != null)
            {
                View.Add(pipeView, srcElView, destElView, srcPortIndex, destPortIndex);
                PipePresenters.Add(pipe.Id, presenter);
            }
        }
예제 #17
0
        internal void UnSubscribeFromPipeEvents(IDataPipe pipe)
        {
            if (pipe == null)
                return;

            pipe.StatusChanged -= new StatusChangeEventHandler<IPipe, PipeStatusChangeEventArgs>(_inPipe_ContentStatusChanged);
        }
예제 #18
0
 public DataPipePresenter(IDataPipe pipe, IDataPipeView view)
 {
     DataPipe = pipe;
     DataPipeView = view;
 }