Java tutorial
/** * Copyright (c) 2011, Pykl Studios <admin@pykl.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.tracermedia.maven.plugins; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalk; import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; import com.amazonaws.services.s3.AmazonS3Client; import org.apache.maven.plugin.AbstractMojo; /** * Common properties for the beanstalk mojos. * * @author jcook@tracermedia.com */ public abstract class AbstractBeanstalkMojo extends AbstractMojo { /** * The name of the application that contains the version to be deployed. * * @parameter expression="${applicationName}" * @required */ protected String applicationName; /** * Your Access Key ID identifies you as the party responsible for service requests. You include * it in each request, so it's not a secret. * * @parameter expression="${accessKey}" * @required */ protected String accessKey; /** * Each Access Key ID has a Secret Access Key associated with it. This key is just a long string * of characters (and not a file) that you use to calculate the digital signature that you * include in the request. Your Secret Access Key is a secret, and only you and AWS should have * it. For Maven purposes, the secretKey should be stored as a property in your settings.xml * file. * * @parameter expression="${secretKey}" * @required */ protected String secretKey; private AWSElasticBeanstalk _beanstalkClient; private AmazonS3Client _s3Client; protected AWSElasticBeanstalk getBeanstalkClient() { if (_beanstalkClient == null) { AWSCredentials cred = new BasicAWSCredentials(accessKey, secretKey); _beanstalkClient = new AWSElasticBeanstalkClient(cred); } return _beanstalkClient; } protected AmazonS3Client getS3Client() { if (_s3Client == null) { AWSCredentials cred = new BasicAWSCredentials(accessKey, secretKey); _s3Client = new AmazonS3Client(cred); } return _s3Client; } }