| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| CdBucket |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure1 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure11 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure13 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure3 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure5 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure7 |
|
| 1.0;1 | ||||
| CdBucket$AjcClosure9 |
|
| 1.0;1 |
| 1 | 0 | /** |
| 2 | * Copyright (c) 2012-2015, jcabi.com | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: 1) Redistributions of source code must retain the above | |
| 8 | * copyright notice, this list of conditions and the following | |
| 9 | * disclaimer. 2) Redistributions in binary form must reproduce the above | |
| 10 | * copyright notice, this list of conditions and the following | |
| 11 | * disclaimer in the documentation and/or other materials provided | |
| 12 | * with the distribution. 3) Neither the name of the jcabi.com nor | |
| 13 | * the names of its contributors may be used to endorse or promote | |
| 14 | * products derived from this software without specific prior written | |
| 15 | * permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | |
| 19 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
| 21 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 26 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
| 28 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | */ | |
| 30 | package com.jcabi.s3.cached; | |
| 31 | ||
| 32 | import com.jcabi.aspects.Immutable; | |
| 33 | import com.jcabi.aspects.Loggable; | |
| 34 | import com.jcabi.s3.Bucket; | |
| 35 | import com.jcabi.s3.Ocket; | |
| 36 | import com.jcabi.s3.Region; | |
| 37 | import java.io.IOException; | |
| 38 | import lombok.EqualsAndHashCode; | |
| 39 | ||
| 40 | /** | |
| 41 | * Cached bucket. | |
| 42 | * | |
| 43 | * @author Yegor Bugayenko (yegor@tpc2.com) | |
| 44 | * @version $Id: 62f76d5fc7cfade1d918e9d32cba7dd9e7f206b7 $ | |
| 45 | * @since 0.8 | |
| 46 | */ | |
| 47 | 0 | @Immutable |
| 48 | 0 | @EqualsAndHashCode(of = "origin") |
| 49 | @Loggable(Loggable.DEBUG) | |
| 50 | public final class CdBucket implements Bucket { | |
| 51 | ||
| 52 | /** | |
| 53 | * Original bucket. | |
| 54 | */ | |
| 55 | private final transient Bucket origin; | |
| 56 | ||
| 57 | /** | |
| 58 | * Public ctor. | |
| 59 | * @param bkt Bucket original | |
| 60 | */ | |
| 61 | 0 | public CdBucket(final Bucket bkt) { |
| 62 | 0 | this.origin = bkt; |
| 63 | 0 | } |
| 64 | ||
| 65 | @Override | |
| 66 | public Region region() { | |
| 67 | 0 | return new CdRegion(this.origin.region()); |
| 68 | } | |
| 69 | ||
| 70 | @Override | |
| 71 | public String name() { | |
| 72 | 0 | return this.origin.name(); |
| 73 | } | |
| 74 | ||
| 75 | @Override | |
| 76 | public Ocket ocket(final String key) { | |
| 77 | 0 | return new CdOcket(this.origin.ocket(key)); |
| 78 | } | |
| 79 | ||
| 80 | @Override | |
| 81 | public boolean exists() throws IOException { | |
| 82 | 0 | return this.origin.exists(); |
| 83 | } | |
| 84 | ||
| 85 | @Override | |
| 86 | public void remove(final String key) throws IOException { | |
| 87 | 0 | this.origin.remove(key); |
| 88 | 0 | } |
| 89 | ||
| 90 | @Override | |
| 91 | public Iterable<String> list(final String pfx) throws IOException { | |
| 92 | 0 | return this.origin.list(pfx); |
| 93 | } | |
| 94 | ||
| 95 | @Override | |
| 96 | public int compareTo(final Bucket bucket) { | |
| 97 | 0 | return this.origin.compareTo(bucket); |
| 98 | } | |
| 99 | } |