| 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.Arrays; |
| 24 |
import java.util.HashMap; |
| 25 |
import java.util.Map; |
| 26 |
|
| 27 |
import org.apache.qpid.proton.amqp.Symbol; |
| 28 |
|
| 29 |
public final class Source extends Terminus |
| 30 |
implements org.apache.qpid.proton.amqp.transport.Source |
| 31 |
{ |
| 32 |
private Symbol _distributionMode; |
| 33 |
private Map _filter; |
| 34 |
private Outcome _defaultOutcome; |
| 35 |
private Symbol[] _outcomes; |
| 36 |
|
| 37 |
private Source(Source other) { |
| 38 |
super(other); |
| 39 |
_distributionMode = other._distributionMode; |
| 40 |
if (other._filter != null) |
| 41 |
_filter = new HashMap(other._filter); |
| 42 |
_defaultOutcome = other._defaultOutcome; |
| 43 |
if (other._outcomes != null) |
| 44 |
_outcomes = other._outcomes.clone(); |
| 45 |
} |
| 46 |
|
| 47 |
public Source() {} |
| 48 |
|
| 49 |
public Symbol getDistributionMode() |
| 50 |
{ |
| 51 |
return _distributionMode; |
| 52 |
} |
| 53 |
|
| 54 |
public void setDistributionMode(Symbol distributionMode) |
| 55 |
{ |
| 56 |
_distributionMode = distributionMode; |
| 57 |
} |
| 58 |
|
| 59 |
public Map getFilter() |
| 60 |
{ |
| 61 |
return _filter; |
| 62 |
} |
| 63 |
|
| 64 |
public void setFilter(Map filter) |
| 65 |
{ |
| 66 |
_filter = filter; |
| 67 |
} |
| 68 |
|
| 69 |
public Outcome getDefaultOutcome() |
| 70 |
{ |
| 71 |
return _defaultOutcome; |
| 72 |
} |
| 73 |
|
| 74 |
public void setDefaultOutcome(Outcome defaultOutcome) |
| 75 |
{ |
| 76 |
_defaultOutcome = defaultOutcome; |
| 77 |
} |
| 78 |
|
| 79 |
public Symbol[] getOutcomes() |
| 80 |
{ |
| 81 |
return _outcomes; |
| 82 |
} |
| 83 |
|
| 84 |
public void setOutcomes(Symbol... outcomes) |
| 85 |
{ |
| 86 |
_outcomes = outcomes; |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
@Override |
| 91 |
public String toString() |
| 92 |
{ |
| 93 |
return "Source{" + |
| 94 |
"address='" + getAddress() + '\'' + |
| 95 |
", durable=" + getDurable() + |
| 96 |
", expiryPolicy=" + getExpiryPolicy() + |
| 97 |
", timeout=" + getTimeout() + |
| 98 |
", dynamic=" + getDynamic() + |
| 99 |
", dynamicNodeProperties=" + getDynamicNodeProperties() + |
| 100 |
", distributionMode=" + _distributionMode + |
| 101 |
", filter=" + _filter + |
| 102 |
", defaultOutcome=" + _defaultOutcome + |
| 103 |
", outcomes=" + (_outcomes == null ? null : Arrays.asList(_outcomes)) + |
| 104 |
", capabilities=" + (getCapabilities() == null ? null : Arrays.asList(getCapabilities())) + |
| 105 |
'}'; |
| 106 |
} |
| 107 |
|
| 108 |
@Override |
| 109 |
public org.apache.qpid.proton.amqp.transport.Source copy() { |
| 110 |
return new Source(this); |
| 111 |
} |
| 112 |
} |
| 113 |
|