001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.net.s3;
020
021import lucee.commons.io.res.type.s3.S3;
022import lucee.commons.io.res.type.s3.S3Constants;
023import lucee.runtime.type.Struct;
024import lucee.runtime.type.StructImpl;
025
026
027public final class PropertiesImpl implements Properties {
028        private String accessKeyId;
029        private String secretAccessKey;
030        private int defaultLocation=S3Constants.STORAGE_UNKNOW;
031        private String host=S3.HOST;
032        
033        
034
035        public Struct toStruct() {
036                Struct sct=new StructImpl();
037
038                sct.setEL("accessKeyId", accessKeyId);
039                sct.setEL("awsSecretKey", secretAccessKey);
040                sct.setEL("defaultLocation", S3.toStringStorage(defaultLocation,""));
041                sct.setEL("host", host);
042                
043                
044                return sct;
045        }
046        
047        /**
048         * @return the accessKeyId
049         */
050        public String getAccessKeyId() {
051                return accessKeyId;
052        }
053        /**
054         * @return the host
055         */
056        public String getHost() {
057                return host;
058        }
059        /**
060         * @param host the host to set
061         */
062        public void setHost(String host) {
063                this.host = host;
064        }
065        /**
066         * @return the defaultLocation
067         */
068        public int getDefaultLocation() {
069                return defaultLocation;
070        }
071        /**
072         * @param defaultLocation the defaultLocation to set
073         */
074        public void setDefaultLocation(String defaultLocation) {
075                this.defaultLocation = S3.toIntStorage(defaultLocation,S3Constants.STORAGE_UNKNOW);
076        }
077        /**
078         * @param accessKeyId the accessKeyId to set
079         */
080        public void setAccessKeyId(String accessKeyId) {
081                this.accessKeyId = accessKeyId;
082        }
083        /**
084         * @return the secretAccessKey
085         */
086        public String getSecretAccessKey() {
087                return secretAccessKey;
088        }
089        /**
090         * @param secretAccessKey the secretAccessKey to set
091         */
092        public void setSecretAccessKey(String secretAccessKey) {
093                this.secretAccessKey = secretAccessKey;
094        }
095        
096        @Override
097        public String toString(){
098                return "accessKeyId:"+accessKeyId+";defaultLocation:"+defaultLocation+";host:"+host+";secretAccessKey:"+secretAccessKey;
099        }
100}