Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Feed"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="feedType">Type of the feed.</param>
 /// <param name="title">The title.</param>
 /// <param name="license">The license.</param>
 public Feed(Name name, FeedType feedType = FeedType.Direct, Title title = null, Name license = null)
 {
     Type = feedType;
     Name = name;
     Title = title;
     License = license;
     Version = new AggregateVersion(0);
     Href = new Uri(string.Format(FEED_URI_FORMAT, Globals.HostName, Name.Value));
     Joins = new RoutingTable();
 }
        /// <summary>
        /// Retrieves the specified join name.
        /// </summary>
        /// <param name="joinName">Name of the join.</param>
        /// <returns>RestMSJoin.</returns>
        /// <exception cref="paramore.brighter.restms.core.Ports.Common.JoinDoesNotExistException"></exception>
        public RestMSJoin Retrieve(Name joinName)
        {
            var join = _joinRepository[new Identity(joinName.Value)];

            if (join == null)
            {
                throw new JoinDoesNotExistException(string.Format("There is no join with the name {0}", joinName));
            }

            return new RestMSJoin(join);
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 /// <param name="pipe">The Pipe this joins the feed to</param>
 /// <param name="feedHref">The feed href for identifying the feed</param>
 /// <param name="address">The address pattern to match this join against.</param>
 public Join(Pipe pipe, Uri feedHref, Address address)
 {
     Address = address;
     FeedHref = feedHref;
     Pipe = pipe;
     Type = JoinType.Default;
     Name = new Name(Guid.NewGuid().ToString());
     Href = new Uri(string.Format(JOIN_URI_FORMAT, Globals.HostName, Name.Value));
     Id = new Identity(Name.Value);
     Version = new AggregateVersion(0);
 }
        /// <summary>
        /// Retrieves the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>RestMSPipe.</returns>
        /// <exception cref="paramore.brighter.restms.core.Ports.Common.PipeDoesNotExistException"></exception>
        public RestMSPipe Retrieve(Name name)
        {
            var pipe = _pipeRepository[new Identity(name.Value)];

            if (pipe == null)
            {
                throw new PipeDoesNotExistException(string.Format("Cannot find pipe named {0}", name.Value));
            }

            return new RestMSPipe(pipe);
        }
        /// <summary>
        /// Retrieves the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>RestMSFeed.</returns>
        /// <exception cref="paramore.brighter.restms.core.Ports.Common.FeedDoesNotExistException"></exception>
        public RestMSFeed Retrieve(Name name)
        {
            var feed = _feedRepository[new Identity(name.Value)];

            if (feed == null)
            {
                throw new FeedDoesNotExistException();
            }

            return new RestMSFeed(feed);
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Message"/> class.
 /// </summary>
 /// <param name="address">The address.</param>
 /// <param name="headers"></param>
 /// <param name="attachment"></param>
 /// <param name="replyTo"></param>
 public Message(Address address, Uri feedHref, NameValueCollection headers, Attachment attachment, Uri replyTo = null)
 {
     Address = address;
     ReplyTo = replyTo;
     MessageId = Guid.NewGuid();
     Headers = new MessageHeaders();
     var keys = headers.AllKeys;
     keys.Each(key => Headers.AddHeader(key, headers[key]));
     Content = new MessageContent(attachment.ContentType, attachment.TransferEncoding, attachment.ContentStream);
     FeedHref = feedHref;
     Name = new Name(MessageId.ToString());
     ReplyTo = replyTo;
 }
        /// <summary>
        /// Retrieves the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>RestMSDomain.</returns>
        /// <exception cref="DomainDoesNotExistException"></exception>
        public RestMSDomain Retrieve(Name name)
        {
            var domain = _domainRepository[new Identity(name.Value)];

            if (domain == null)
            {
                throw new DomainDoesNotExistException(string.Format("Could not find domain {0}", name.Value));
            }

            var feeds = new List<Feed>();
            domain.Feeds.Each(feed => feeds.Add(_feedRepository[new Identity(feed.Value)]));

            var pipes = new List<Pipe>();
            domain.Pipes.Each(pipe => pipes.Add(_pipeRepository[new Identity(pipe.Value)]));

            return new RestMSDomain(domain, feeds, pipes);
        }
        /// <summary>
        /// Retrieves the specified pipe name.
        /// </summary>
        /// <param name="pipeName">Name of the pipe.</param>
        /// <param name="messageId">The message identifier.</param>
        /// <returns>RestMSMessage.</returns>
        /// <exception cref="paramore.brighter.restms.core.Ports.Common.PipeDoesNotExistException"></exception>
        /// <exception cref="paramore.brighter.restms.core.Ports.Common.MessageDoesNotExistException"></exception>
        public RestMSMessage Retrieve(Name pipeName, Guid messageId)
        {
            var pipe = _pipeRepository[new Identity(pipeName.Value)];
            if (pipe == null)
            {
                throw new PipeDoesNotExistException(string.Format("The message {0} does not exist", pipeName.Value));
            }

            var message = pipe.FindMessage(messageId);

            if (message == null)
            {
                throw new MessageDoesNotExistException(string.Format("Cannot find message {0} on pipe {1}", messageId, pipeName));
            }


            return new RestMSMessage(message);
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pipe"/> class.
 /// </summary>
 /// <param name="identity">The identity.</param>
 /// <param name="pipeType">Type of the pipe.</param>
 /// <param name="title">The title.</param>
 public Pipe(Identity identity, PipeType pipeType, Title title = null)
 {
     Id = identity;
     Title = title;
     Name = new Name(Id.Value);
     Type = pipeType;
     Href = new Uri(string.Format(PIPE_URI_FORMAT, Globals.HostName, identity.Value));
 }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Pipe"/> class.
        /// </summary>
        /// <param name="identity">The identity.</param>
        /// <param name="pipeType">Type of the pipe.</param>
        /// <param name="title">The title.</param>
        public Pipe(string identity, string pipeType, string title = null)
        {
            Id = new Identity(identity);
            Title = new Title(title);
            Name = new Name(Id.Value);
            if (!string.IsNullOrEmpty(pipeType))
                Type = (PipeType)Enum.Parse(typeof(PipeType), pipeType);
            else
                Type = PipeType.Default;

            Href = new Uri(string.Format(PIPE_URI_FORMAT, Globals.HostName, Name.Value));
        }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Feed"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="version">The version.</param>
 /// <param name="feedType">Type of the feed.</param>
 /// <param name="title">The title.</param>
 /// <param name="license">The license.</param>
 public Feed(Name name, AggregateVersion version, FeedType feedType = FeedType.Direct, Title title = null, Name license = null)
     : this(name, feedType, title, license)
 {
     Version = version;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Domain"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="title">The title.</param>
 /// <param name="profile">The profile.</param>
 /// <param name="version">The version.</param>
 public Domain(Name name, Title title, Profile profile, AggregateVersion version)
     : this(name, title, profile)
 {
     Version = version;
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Domain"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="title">The title.</param>
 /// <param name="profile">The profile.</param>
 public Domain(Name name, Title title, Profile profile)
 {
     Name = name;
     Title = title;
     Profile = profile;
     Version = new AggregateVersion(0);
     Href = new Uri(string.Format(DOMAIN_URI_FORMAT, Globals.HostName, Name.Value));
 }
Beispiel #14
0
 /// <summary>
 /// Copy constructor for the <see cref="Message"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public Message(Message message)
 {
     Address = new Address(message.Address.Value);
     ReplyTo = message.ReplyTo != null ? new Uri(message.ReplyTo.AbsoluteUri) : null;
     MessageId = new Guid(message.MessageId.ToString());
     Headers = message.Headers.Copy();
     FeedHref = new Uri(message.FeedHref.AbsoluteUri);
     Name = new Name(message.Name.Value);
     Content = message.Content.Copy();
 }