| 1 |
/* |
| 2 |
* |
| 3 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 4 |
* or more contributor license agreements. See the NOTICE file |
| 5 |
* distributed with this work for additional information |
| 6 |
* regarding copyright ownership. The ASF licenses this file |
| 7 |
* to you under the Apache License, Version 2.0 (the |
| 8 |
* "License"); you may not use this file except in compliance |
| 9 |
* with the License. You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* |
| 13 |
* Unless required by applicable law or agreed to in writing, |
| 14 |
* software distributed under the License is distributed on an |
| 15 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 |
* KIND, either express or implied. See the License for the |
| 17 |
* specific language governing permissions and limitations |
| 18 |
* under the License. |
| 19 |
* |
| 20 |
*/ |
| 21 |
package org.apache.qpid.proton.amqp.messaging; |
| 22 |
|
| 23 |
import java.util.HashMap; |
| 24 |
import java.util.Map; |
| 25 |
|
| 26 |
import org.apache.qpid.proton.amqp.Symbol; |
| 27 |
import org.apache.qpid.proton.amqp.UnsignedInteger; |
| 28 |
|
| 29 |
public abstract class Terminus |
| 30 |
{ |
| 31 |
private String _address; |
| 32 |
private TerminusDurability _durable = TerminusDurability.NONE; |
| 33 |
private TerminusExpiryPolicy _expiryPolicy = TerminusExpiryPolicy.SESSION_END; |
| 34 |
private UnsignedInteger _timeout = UnsignedInteger.valueOf(0); |
| 35 |
private boolean _dynamic; |
| 36 |
private Map _dynamicNodeProperties; |
| 37 |
private Symbol[] _capabilities; |
| 38 |
|
| 39 |
Terminus() |
| 40 |
{ |
| 41 |
} |
| 42 |
|
| 43 |
protected Terminus(Terminus other) { |
| 44 |
_address = other._address; |
| 45 |
_durable = other._durable; |
| 46 |
_expiryPolicy = other._expiryPolicy; |
| 47 |
_timeout = other._timeout; |
| 48 |
_dynamic = other._dynamic; |
| 49 |
if (other._dynamicNodeProperties != null) { |
| 50 |
// TODO: Do we need to copy or can we make a simple reference? |
| 51 |
_dynamicNodeProperties = new HashMap(other._dynamicNodeProperties); |
| 52 |
} |
| 53 |
if (other._capabilities != null) { |
| 54 |
_capabilities = other._capabilities.clone(); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
public final String getAddress() |
| 59 |
{ |
| 60 |
return _address; |
| 61 |
} |
| 62 |
|
| 63 |
public final void setAddress(String address) |
| 64 |
{ |
| 65 |
_address = address; |
| 66 |
} |
| 67 |
|
| 68 |
public final TerminusDurability getDurable() |
| 69 |
{ |
| 70 |
return _durable; |
| 71 |
} |
| 72 |
|
| 73 |
public final void setDurable(TerminusDurability durable) |
| 74 |
{ |
| 75 |
_durable = durable == null ? TerminusDurability.NONE : durable; |
| 76 |
} |
| 77 |
|
| 78 |
public final TerminusExpiryPolicy getExpiryPolicy() |
| 79 |
{ |
| 80 |
return _expiryPolicy; |
| 81 |
} |
| 82 |
|
| 83 |
public final void setExpiryPolicy(TerminusExpiryPolicy expiryPolicy) |
| 84 |
{ |
| 85 |
_expiryPolicy = expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : expiryPolicy; |
| 86 |
} |
| 87 |
|
| 88 |
public final UnsignedInteger getTimeout() |
| 89 |
{ |
| 90 |
return _timeout; |
| 91 |
} |
| 92 |
|
| 93 |
public final void setTimeout(UnsignedInteger timeout) |
| 94 |
{ |
| 95 |
_timeout = timeout; |
| 96 |
} |
| 97 |
|
| 98 |
public final boolean getDynamic() |
| 99 |
{ |
| 100 |
return _dynamic; |
| 101 |
} |
| 102 |
|
| 103 |
public final void setDynamic(boolean dynamic) |
| 104 |
{ |
| 105 |
_dynamic = dynamic; |
| 106 |
} |
| 107 |
|
| 108 |
public final Map getDynamicNodeProperties() |
| 109 |
{ |
| 110 |
return _dynamicNodeProperties; |
| 111 |
} |
| 112 |
|
| 113 |
public final void setDynamicNodeProperties(Map dynamicNodeProperties) |
| 114 |
{ |
| 115 |
_dynamicNodeProperties = dynamicNodeProperties; |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
public final Symbol[] getCapabilities() |
| 120 |
{ |
| 121 |
return _capabilities; |
| 122 |
} |
| 123 |
|
| 124 |
public final void setCapabilities(Symbol... capabilities) |
| 125 |
{ |
| 126 |
_capabilities = capabilities; |
| 127 |
} |
| 128 |
|
| 129 |
} |