1 /*
2  * hunt-proton: AMQP Protocol library for D programming language.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module hunt.proton.amqp.messaging.Terminus;
13 
14 import hunt.collection.HashMap;
15 import hunt.collection.Map;
16 
17 import hunt.proton.amqp.Symbol;
18 import hunt.proton.amqp.UnsignedInteger;
19 import hunt.Object;
20 import hunt.proton.amqp.messaging.TerminusDurability;
21 import hunt.proton.amqp.messaging.TerminusExpiryPolicy;
22 import hunt.String;
23 import hunt.Boolean;
24 
25 import hunt.collection.List;
26 import hunt.collection.ArrayList;
27 import std.conv:to;
28 abstract class Terminus
29 {
30     private String _address;
31     private TerminusDurability _durable ;//= TerminusDurability.NONE;
32     private TerminusExpiryPolicy _expiryPolicy ; //= TerminusExpiryPolicy.SESSION_END;
33     private UnsignedInteger _timeout ;// UnsignedInteger.valueOf(0);
34     private Boolean _dynamic;
35     private IObject _dynamicNodeProperties;
36     private List!Symbol _capabilities;
37 
38     this(Terminus other) {
39         _address = other._address;
40         _durable = other._durable;
41         _expiryPolicy = other._expiryPolicy;
42         _timeout = other._timeout;
43         _dynamic = other._dynamic;
44         if (other._dynamicNodeProperties !is null) {
45             // TODO: Do we need to copy or can we make a simple reference?
46             _dynamicNodeProperties = other._dynamicNodeProperties;
47         }
48         if (other._capabilities !is null) {
49             _capabilities = other._capabilities;
50         }
51     }
52 
53     this()
54     {
55         _durable = TerminusDurability.NONE;
56         _expiryPolicy = TerminusExpiryPolicy.SESSION_END;
57         _timeout = UnsignedInteger.valueOf(0);
58         _dynamic = new Boolean(false);
59     }
60 
61     public String getAddress()
62     {
63         return _address;
64     }
65 
66     public void setAddress(String address)
67     {
68         _address =  address;
69     }
70 
71     public TerminusDurability getDurable()
72     {
73         return _durable;
74     }
75 
76     public void setDurable(TerminusDurability durable)
77     {
78         _durable = durable is null ? TerminusDurability.NONE : durable;
79     }
80 
81     public TerminusExpiryPolicy getExpiryPolicy()
82     {
83         return _expiryPolicy;
84     }
85 
86     public void setExpiryPolicy(TerminusExpiryPolicy expiryPolicy)
87     {
88         _expiryPolicy = expiryPolicy is null ? TerminusExpiryPolicy.SESSION_END : expiryPolicy;
89     }
90 
91     public UnsignedInteger getTimeout()
92     {
93         return _timeout;
94     }
95 
96     public void setTimeout(UnsignedInteger timeout)
97     {
98         _timeout = timeout;
99     }
100 
101     public Boolean getDynamic()
102     {
103         return _dynamic;
104     }
105 
106     public void setDynamic(Boolean dynamic)
107     {
108         _dynamic = dynamic;
109     }
110 
111     public IObject getDynamicNodeProperties()
112     {
113         return _dynamicNodeProperties;
114     }
115 
116     public void setDynamicNodeProperties(IObject dynamicNodeProperties)
117     {
118         _dynamicNodeProperties = dynamicNodeProperties;
119     }
120 
121 
122     public List!Symbol getCapabilities()
123     {
124         return _capabilities;
125     }
126 
127     public void setCapabilities(List!Symbol capabilities)
128     {
129         _capabilities = capabilities;
130     }
131 
132 }