| 1 | // Copyright 2004-2007 Jean-Francois Poilpret |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package net.sourceforge.hiveremoting.caucho; |
| 16 | |
| 17 | import org.apache.hivemind.impl.BaseLocatable; |
| 18 | import org.apache.hivemind.util.ToStringBuilder; |
| 19 | |
| 20 | /** |
| 21 | * Contribution class for <code>CauchoProxyFactory</code> parameters. |
| 22 | * @author Jean-Francois Poilpret |
| 23 | */ |
| 24 | public class CauchoProxyContribution extends BaseLocatable |
| 25 | { |
| 26 | public void setUrl(String url) |
| 27 | { |
| 28 | _url = url; |
| 29 | } |
| 30 | |
| 31 | public String getUrl() |
| 32 | { |
| 33 | return _url; |
| 34 | } |
| 35 | |
| 36 | public void setProtocol(Protocol protocol) |
| 37 | { |
| 38 | _protocol = protocol; |
| 39 | } |
| 40 | |
| 41 | public Protocol getProtocol() |
| 42 | { |
| 43 | return _protocol; |
| 44 | } |
| 45 | |
| 46 | public void setProtocolVersion(int protocolVersion) |
| 47 | { |
| 48 | _protocolVersion = protocolVersion; |
| 49 | } |
| 50 | |
| 51 | public int getProtocolVersion() |
| 52 | { |
| 53 | return _protocolVersion; |
| 54 | } |
| 55 | |
| 56 | public void setUser(String user) |
| 57 | { |
| 58 | _user = user; |
| 59 | } |
| 60 | |
| 61 | public String getUser() |
| 62 | { |
| 63 | return _user; |
| 64 | } |
| 65 | |
| 66 | public void setPassword(String password) |
| 67 | { |
| 68 | _password = password; |
| 69 | } |
| 70 | |
| 71 | public String getPassword() |
| 72 | { |
| 73 | return _password; |
| 74 | } |
| 75 | |
| 76 | public void setOverloadEnabled(boolean overloadEnabled) |
| 77 | { |
| 78 | _overloadEnabled = overloadEnabled; |
| 79 | } |
| 80 | |
| 81 | public boolean getOverloadEnabled() |
| 82 | { |
| 83 | return _overloadEnabled; |
| 84 | } |
| 85 | |
| 86 | public void setGzipThreshold(int gzipThreshold) |
| 87 | { |
| 88 | _gzipThreshold = gzipThreshold; |
| 89 | } |
| 90 | |
| 91 | public int getGzipThreshold() |
| 92 | { |
| 93 | return _gzipThreshold; |
| 94 | } |
| 95 | |
| 96 | public void setGzipInBufferSize(int gzipInBufferSize) |
| 97 | { |
| 98 | _gzipInBufferSize = gzipInBufferSize; |
| 99 | } |
| 100 | |
| 101 | public int getGzipInBufferSize() |
| 102 | { |
| 103 | return _gzipInBufferSize; |
| 104 | } |
| 105 | |
| 106 | public void setContextHandler(RemoteContextHandler handler) |
| 107 | { |
| 108 | _handler = handler; |
| 109 | } |
| 110 | |
| 111 | public RemoteContextHandler getContextHandler() |
| 112 | { |
| 113 | return _handler; |
| 114 | } |
| 115 | |
| 116 | public void setCallContextHandlerOnError(boolean callContextHandlerOnError) |
| 117 | { |
| 118 | _callContextHandlerOnError = callContextHandlerOnError; |
| 119 | } |
| 120 | |
| 121 | public boolean getCallContextHandlerOnError() |
| 122 | { |
| 123 | return _callContextHandlerOnError; |
| 124 | } |
| 125 | |
| 126 | @Override public String toString() |
| 127 | { |
| 128 | ToStringBuilder builder = new ToStringBuilder(this); |
| 129 | builder.append("url", _url); |
| 130 | builder.append("protocol", _protocol); |
| 131 | builder.append("user", _user); |
| 132 | builder.append("password", _password); |
| 133 | builder.append("overloadEnabled", _overloadEnabled); |
| 134 | return builder.toString(); |
| 135 | } |
| 136 | |
| 137 | static private final int DEFAULT_BUFFER_SIZE = 512; |
| 138 | private String _url; |
| 139 | private Protocol _protocol; |
| 140 | private int _protocolVersion = 1; |
| 141 | private String _user; |
| 142 | private String _password; |
| 143 | private boolean _overloadEnabled; |
| 144 | private int _gzipThreshold = -1; |
| 145 | private int _gzipInBufferSize = DEFAULT_BUFFER_SIZE; |
| 146 | private RemoteContextHandler _handler; |
| 147 | private boolean _callContextHandlerOnError; |
| 148 | } |