Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 1 | package net.onrc.onos.datastore; |
| 2 | |
| 3 | import net.onrc.onos.datastore.utils.ByteArrayUtil; |
| 4 | |
| 5 | /** |
| 6 | * Exception thrown when object was not expected to be in data store. |
| 7 | */ |
| 8 | public class ObjectExistsException extends RejectRulesException { |
| 9 | private static final long serialVersionUID = -1488647215779909457L; |
| 10 | |
| 11 | public ObjectExistsException(final String message) { |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 12 | super(message); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | public ObjectExistsException(final IKVTableID tableID, final byte[] key, |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 16 | final Throwable cause) { |
| 17 | super(ByteArrayUtil.toHexStringBuffer(key, ":") |
| 18 | + " already exist on table:" + tableID, cause); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | public ObjectExistsException(final IKVTableID tableID, final byte[] key) { |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 22 | super(ByteArrayUtil.toHexStringBuffer(key, ":") |
| 23 | + " already exist on table:" + tableID); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 24 | } |
| 25 | } |