diff --git a/src/main/java/com/amihaiemil/charles/aws/AbstractSystemProperty.java b/src/main/java/com/amihaiemil/charles/aws/AbstractSystemProperty.java new file mode 100644 index 0000000..7bff77e --- /dev/null +++ b/src/main/java/com/amihaiemil/charles/aws/AbstractSystemProperty.java @@ -0,0 +1,56 @@ +/**@g + * Copyright (c) 2016-2017, Mihai Emil Andronache + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1)Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2)Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3)Neither the name of charles-rest nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.amihaiemil.charles.aws; + +/** + * AbstractSystemProperty implementing methods that should be the same + * accross all final implementations of {@link SystemProperty}. + * @author Sherif Waly (sherifwaly@gmail.com) + * @version $Id$ + * @since 1.0.0 + * @todo #201:15m/DEV Add fake implementation for the 4 SystemProperty + * interfaces to use them in testing. + */ +abstract class AbstractSystemProperty implements SystemProperty { + + /** + * Name of the system Property. + */ + private String name; + + /** + * Ctor + * @param String name. + */ + public AbstractSystemProperty(String name) { + this.name = name; + } + + @Override + public String read() { + return System.getProperty(this.name); + } +} diff --git a/src/main/java/com/amihaiemil/charles/aws/StAccessKeyId.java b/src/main/java/com/amihaiemil/charles/aws/StAccessKeyId.java new file mode 100644 index 0000000..a1e5d5a --- /dev/null +++ b/src/main/java/com/amihaiemil/charles/aws/StAccessKeyId.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2016-2017, Mihai Emil Andronache + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1)Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2)Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3)Neither the name of charles-rest nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.amihaiemil.charles.aws; + +/** + * Implementation for {@link AccessKeyId} interface. + * @author Sherif Waly (sherifwaly95@gmail.com) + * @version $Id$ + * @since 1.0.0 + */ +public final class StAccessKeyId extends AbstractSystemProperty implements SecretKey { + + /** + * Ctor. + * @param String name + */ + public StAccessKeyId(final String name) { + super(name); + } + +} diff --git a/src/main/java/com/amihaiemil/charles/aws/StEsEndPoint.java b/src/main/java/com/amihaiemil/charles/aws/StEsEndPoint.java new file mode 100644 index 0000000..0c75a2c --- /dev/null +++ b/src/main/java/com/amihaiemil/charles/aws/StEsEndPoint.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2016-2017, Mihai Emil Andronache + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1)Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2)Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3)Neither the name of charles-rest nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.amihaiemil.charles.aws; + +/** + * Implementation for {@link EsEndPoint} interface. + * @author Sherif Waly (sherifwaly95@gmail.com) + * @version $Id$ + * @since 1.0.0 + */ +public final class StEsEndPoint extends AbstractSystemProperty implements EsEndPoint { + + /** + * Ctor. + * @param String name + */ + public StEsEndPoint(final String name) { + super(name); + } + +} diff --git a/src/main/java/com/amihaiemil/charles/aws/StRegion.java b/src/main/java/com/amihaiemil/charles/aws/StRegion.java new file mode 100644 index 0000000..8261396 --- /dev/null +++ b/src/main/java/com/amihaiemil/charles/aws/StRegion.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2016-2017, Mihai Emil Andronache + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1)Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2)Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3)Neither the name of charles-rest nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.amihaiemil.charles.aws; + +/** + * Implementation for {@link SecretKey} interface. + * @author Sherif Waly (sherifwaly95@gmail.com) + * @version $Id$ + * @since 1.0.0 + */ +public final class StRegion extends AbstractSystemProperty implements SecretKey { + + /** + * Ctor. + * @param String name + */ + public StRegion(final String name) { + super(name); + } + +} diff --git a/src/main/java/com/amihaiemil/charles/aws/StSecretKey.java b/src/main/java/com/amihaiemil/charles/aws/StSecretKey.java new file mode 100644 index 0000000..f36a0c6 --- /dev/null +++ b/src/main/java/com/amihaiemil/charles/aws/StSecretKey.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2016-2017, Mihai Emil Andronache + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1)Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2)Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3)Neither the name of charles-rest nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.amihaiemil.charles.aws; + +/** + * Implementation for {@link SecretKey} interface. + * @author Sherif Waly (sherifwaly95@gmail.com) + * @version $Id$ + * @since 1.0.0 + */ +public final class StSecretKey extends AbstractSystemProperty implements SecretKey { + + /** + * Ctor. + * @param String name + */ + public StSecretKey(final String name) { + super(name); + } + +} diff --git a/src/main/java/com/amihaiemil/charles/aws/SystemProperty.java b/src/main/java/com/amihaiemil/charles/aws/SystemProperty.java index 982cbb5..c8e5cb3 100644 --- a/src/main/java/com/amihaiemil/charles/aws/SystemProperty.java +++ b/src/main/java/com/amihaiemil/charles/aws/SystemProperty.java @@ -30,9 +30,6 @@ * @author Sherif Waly (sherifwaly95@gmail.com) * @version $Id$ * @since 1.0.0 - * @todo #199:30m/DEV Implement and Unit test 4 system properties - * SecretKey, Region, EsEndPoint and AccessKeyId. Also add fake - * implementation for the interfaces to use them in testing. */ public interface SystemProperty {