diff --git a/assemblies/src/main/resources/assemblies/package-descriptor.xml b/assemblies/src/main/resources/assemblies/package-descriptor.xml
index f919a7d7cf..b27ad79fda 100644
--- a/assemblies/src/main/resources/assemblies/package-descriptor.xml
+++ b/assemblies/src/main/resources/assemblies/package-descriptor.xml
@@ -1,666 +1,666 @@
-
-
-
- package
-
- zip
-
-
-
-
-
-
-
- README.txt
-
- true
-
-
- project
-
- LICENSE.txt
-
- true
-
-
-
-
- core/target
-
- jclouds-core-${project.version}-jar-with-dependencies.jar
-
- core/lib
-
-
- blobstore/target
-
- jclouds-blobstore-${project.version}.jar
-
- core/lib
-
-
- compute/target
-
- jclouds-compute-${project.version}.jar
-
- core/lib
-
-
- core/target
-
- jclouds-core-${project.version}-sources.jar
-
- core/src
-
-
- blobstore/target
-
- jclouds-blobstore-${project.version}-sources.jar
-
- core/src
-
-
- compute/target
-
- jclouds-compute-${project.version}-sources.jar
-
- core/src
-
-
- core/target/apidocs
- core/docs
-
-
- blobstore/target/apidocs
- core/docs
-
-
- compute/target/apidocs
- core/docs
-
-
-
-
- atmos/target
-
- jclouds-atmos-${project.version}.jar
-
- providers/atmos/lib
-
-
- atmos/target
-
- jclouds-atmos-${project.version}-sources.jar
-
- providers/atmos/src
-
-
- atmos/target/apidocs
- providers/atmos/docs
-
-
- atmos
-
- README.txt
-
- providers/atmos
-
-
-
-
- aws/core/target
-
- jclouds-aws-${project.version}.jar
-
- providers/aws/lib
-
-
- aws/core/target
-
- jclouds-aws-${project.version}-sources.jar
-
- providers/aws/src
-
-
- aws/core/target/apidocs
- providers/aws/docs
-
-
- aws/core
-
- README.txt
-
- providers/aws
-
-
-
-
- azure/target
-
- jclouds-azure-${project.version}.jar
-
- providers/azure/lib
-
-
- azure/target
-
- jclouds-azure-${project.version}-sources.jar
-
- providers/azure/src
-
-
- azure/target/apidocs
- providers/azure/docs
-
-
- azure
-
- README.txt
-
- providers/azure
-
-
-
-
- slicehost/target
-
- jclouds-slicehost-${project.version}.jar
-
- providers/slicehost/lib
-
-
- slicehost/target
-
- jclouds-slicehost-${project.version}-sources.jar
-
- providers/slicehost/src
-
-
- slicehost/target/apidocs
- providers/slicehost/docs
-
-
- slicehost
-
- README.txt
-
- providers/slicehost
-
-
-
-
- rackspace/target
-
- jclouds-rackspace-${project.version}.jar
-
- providers/rackspace/lib
-
-
- rackspace/target
-
- jclouds-rackspace-${project.version}-sources.jar
-
- providers/rackspace/src
-
-
- rackspace/target/apidocs
- providers/rackspace/docs
-
-
- rackspace
-
- README.txt
-
- providers/rackspace
-
-
-
-
- gogrid/target
-
- jclouds-gogrid-${project.version}.jar
-
- providers/gogrid/lib
-
-
- gogrid/target
-
- jclouds-gogrid-${project.version}-sources.jar
-
- providers/gogrid/src
-
-
- gogrid/target/apidocs
- providers/gogrid/docs
-
-
- gogrid
-
- README.txt
-
- providers/gogrid
-
-
-
-
- rimuhosting/target
-
- jclouds-rimuhosting-${project.version}.jar
-
- providers/rimuhosting/lib
-
-
- rimuhosting/target
-
- jclouds-rimuhosting-${project.version}-sources.jar
-
- providers/rimuhosting/src
-
-
- rimuhosting/target/apidocs
- providers/rimuhosting/docs
-
-
- rimuhosting
-
- README.txt
-
- providers/rimuhosting
-
-
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}.jar
-
- providers/vcloud/lib
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}-sources.jar
-
- providers/vcloud/src
-
-
- vcloud/vcloud/target/apidocs
- providers/vcloud/docs
-
-
- vcloud/core
-
- README.txt
-
- providers/vcloud
-
-
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}.jar
-
- providers/bluelock/lib
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}-sources.jar
-
- providers/bluelock/src
-
-
- vcloud/bluelock/target
-
- jclouds-bluelock-${project.version}.jar
-
- providers/bluelock/lib
-
-
- vcloud/bluelock/target
-
- jclouds-bluelock-${project.version}-sources.jar
-
- providers/bluelock/src
-
-
- vcloud/bluelock/target/apidocs
- providers/bluelock/docs
-
-
- vcloud/bluelock
-
- README.txt
-
- providers/bluelock
-
-
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}.jar
-
- providers/terremark/lib
-
-
- vcloud/core/target
-
- jclouds-vcloud-${project.version}-sources.jar
-
- providers/terremark/src
-
-
- vcloud/terremark/target
-
- jclouds-terremark-${project.version}.jar
-
- providers/terremark/lib
-
-
- vcloud/terremark/target
-
- jclouds-terremark-${project.version}-sources.jar
-
- providers/terremark/src
-
-
- vcloud/terremark/target/apidocs
- providers/terremark/docs
-
-
- vcloud/terremark
-
- README.txt
-
- providers/terremark
-
-
-
-
- extensions/bouncycastle/target
-
- jclouds-bouncycastle-${project.version}-jar-with-dependencies.jar
-
- extensions/bouncycastle/lib
-
-
- extensions/bouncycastle/target
-
- jclouds-bouncycastle-${project.version}-sources.jar
-
- extensions/bouncycastle/src
-
-
- extensions/bouncycastle/target/apidocs
- extensions/bouncycastle/docs
-
-
- extensions/bouncycastle
-
- README.txt
-
- extensions/bouncycastle
-
-
-
-
- extensions/enterprise/target
-
- jclouds-enterprise-${project.version}-jar-with-dependencies.jar
-
- extensions/enterprise/lib
-
-
- extensions/enterprise/target
-
- jclouds-enterprise-${project.version}-sources.jar
-
- extensions/enterprise/src
-
-
- extensions/enterprise/target/apidocs
- extensions/enterprise/docs
-
-
- extensions/enterprise
-
- README.txt
-
- extensions/enterprise
-
-
-
-
- extensions/gae/target
-
- jclouds-gae-${project.version}.jar
-
- extensions/gae/lib
-
-
- extensions/gae/target
-
- jclouds-gae-${project.version}-sources.jar
-
- extensions/gae/src
-
-
- extensions/gae/target/apidocs
- extensions/gae/docs
-
-
- extensions/gae
-
- README.txt
-
- extensions/gae
-
-
-
-
- extensions/joda/target
-
- jclouds-joda-${project.version}-jar-with-dependencies.jar
-
- extensions/joda/lib
-
-
- extensions/joda/target
-
- jclouds-joda-${project.version}-sources.jar
-
- extensions/joda/src
-
-
- extensions/joda/target/apidocs
- extensions/joda/docs
-
-
- extensions/joda
-
- README.txt
-
- extensions/joda
-
-
-
-
- extensions/apachehc/target
-
- jclouds-apachehc-${project.version}.jar
-
- extensions/apachehc/lib
-
-
- extensions/apachehc/target
-
- jclouds-apachehc-${project.version}-sources.jar
-
- extensions/apachehc/src
-
-
- extensions/apachehc/target/apidocs
- extensions/apachehc/docs
-
-
- extensions/apachehc
-
- README.txt
-
- extensions/apachehc
-
-
-
-
- extensions/ssh/jsch/target
-
- jclouds-jsch-${project.version}.jar
-
- extensions/jsch/lib
-
-
- extensions/ssh/jsch/target
-
- jclouds-jsch-${project.version}-sources.jar
-
- extensions/jsch/src
-
-
- extensions/ssh/jsch/target/apidocs
- extensions/jsch/docs
-
-
- extensions/ssh/jsch
-
- README.txt
-
- extensions/jsch
-
-
-
-
- extensions/log4j/target
-
- jclouds-log4j-${project.version}.jar
-
- extensions/log4j/lib
-
-
- extensions/log4j/target
-
- jclouds-log4j-${project.version}-sources.jar
-
- extensions/log4j/src
-
-
- extensions/log4j/target/apidocs
- extensions/log4j/docs
-
-
- extensions/log4j
-
- README.txt
-
- extensions/log4j
-
-
-
-
- tools/antcontrib/target
-
- jclouds-antcontrib-${project.version}-jar-with-dependencies.jar
-
- tools/antcontrib/lib
-
-
- tools/antcontrib/target
-
- jclouds-antcontrib-${project.version}-sources.jar
-
- tools/antcontrib/src
-
-
- tools/antcontrib/target/apidocs
- tools/antcontrib/docs
-
-
- tools/antcontrib
-
- README.txt
-
- tools/antcontrib
-
-
-
-
- demos/gae-tweetstore/target/jclouds-demo-gae-tweetstore
- samples/gae-tweetstore
-
-
- aws/demos/createandlistbuckets/target/jclouds-aws-demo-createandlistbuckets-src
- samples/aws/createandlistbuckes
-
-
- aws/demos/googleappengine/target/jclouds-aws-demo-googleappengine-src
- samples/aws/googleappengine
-
-
-
+
+
+
+ package
+
+ zip
+
+
+
+
+
+
+
+ README.txt
+
+ true
+
+
+ project
+
+ LICENSE.txt
+
+ true
+
+
+
+
+ core/target
+
+ jclouds-core-${project.version}-jar-with-dependencies.jar
+
+ core/lib
+
+
+ blobstore/target
+
+ jclouds-blobstore-${project.version}.jar
+
+ core/lib
+
+
+ compute/target
+
+ jclouds-compute-${project.version}.jar
+
+ core/lib
+
+
+ core/target
+
+ jclouds-core-${project.version}-sources.jar
+
+ core/src
+
+
+ blobstore/target
+
+ jclouds-blobstore-${project.version}-sources.jar
+
+ core/src
+
+
+ compute/target
+
+ jclouds-compute-${project.version}-sources.jar
+
+ core/src
+
+
+ core/target/apidocs
+ core/docs
+
+
+ blobstore/target/apidocs
+ core/docs
+
+
+ compute/target/apidocs
+ core/docs
+
+
+
+
+ atmos/target
+
+ jclouds-atmos-${project.version}.jar
+
+ providers/atmos/lib
+
+
+ atmos/target
+
+ jclouds-atmos-${project.version}-sources.jar
+
+ providers/atmos/src
+
+
+ atmos/target/apidocs
+ providers/atmos/docs
+
+
+ atmos
+
+ README.txt
+
+ providers/atmos
+
+
+
+
+ aws/core/target
+
+ jclouds-aws-${project.version}.jar
+
+ providers/aws/lib
+
+
+ aws/core/target
+
+ jclouds-aws-${project.version}-sources.jar
+
+ providers/aws/src
+
+
+ aws/core/target/apidocs
+ providers/aws/docs
+
+
+ aws/core
+
+ README.txt
+
+ providers/aws
+
+
+
+
+ azure/target
+
+ jclouds-azure-${project.version}.jar
+
+ providers/azure/lib
+
+
+ azure/target
+
+ jclouds-azure-${project.version}-sources.jar
+
+ providers/azure/src
+
+
+ azure/target/apidocs
+ providers/azure/docs
+
+
+ azure
+
+ README.txt
+
+ providers/azure
+
+
+
+
+ slicehost/target
+
+ jclouds-slicehost-${project.version}.jar
+
+ providers/slicehost/lib
+
+
+ slicehost/target
+
+ jclouds-slicehost-${project.version}-sources.jar
+
+ providers/slicehost/src
+
+
+ slicehost/target/apidocs
+ providers/slicehost/docs
+
+
+ slicehost
+
+ README.txt
+
+ providers/slicehost
+
+
+
+
+ rackspace/target
+
+ jclouds-rackspace-${project.version}.jar
+
+ providers/rackspace/lib
+
+
+ rackspace/target
+
+ jclouds-rackspace-${project.version}-sources.jar
+
+ providers/rackspace/src
+
+
+ rackspace/target/apidocs
+ providers/rackspace/docs
+
+
+ rackspace
+
+ README.txt
+
+ providers/rackspace
+
+
+
+
+ gogrid/target
+
+ jclouds-gogrid-${project.version}.jar
+
+ providers/gogrid/lib
+
+
+ gogrid/target
+
+ jclouds-gogrid-${project.version}-sources.jar
+
+ providers/gogrid/src
+
+
+ gogrid/target/apidocs
+ providers/gogrid/docs
+
+
+ gogrid
+
+ README.txt
+
+ providers/gogrid
+
+
+
+
+ rimuhosting/target
+
+ jclouds-rimuhosting-${project.version}.jar
+
+ providers/rimuhosting/lib
+
+
+ rimuhosting/target
+
+ jclouds-rimuhosting-${project.version}-sources.jar
+
+ providers/rimuhosting/src
+
+
+ rimuhosting/target/apidocs
+ providers/rimuhosting/docs
+
+
+ rimuhosting
+
+ README.txt
+
+ providers/rimuhosting
+
+
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}.jar
+
+ providers/vcloud/lib
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}-sources.jar
+
+ providers/vcloud/src
+
+
+ vcloud/vcloud/target/apidocs
+ providers/vcloud/docs
+
+
+ vcloud/core
+
+ README.txt
+
+ providers/vcloud
+
+
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}.jar
+
+ providers/bluelock/lib
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}-sources.jar
+
+ providers/bluelock/src
+
+
+ vcloud/bluelock/target
+
+ jclouds-bluelock-${project.version}.jar
+
+ providers/bluelock/lib
+
+
+ vcloud/bluelock/target
+
+ jclouds-bluelock-${project.version}-sources.jar
+
+ providers/bluelock/src
+
+
+ vcloud/bluelock/target/apidocs
+ providers/bluelock/docs
+
+
+ vcloud/bluelock
+
+ README.txt
+
+ providers/bluelock
+
+
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}.jar
+
+ providers/terremark/lib
+
+
+ vcloud/core/target
+
+ jclouds-vcloud-${project.version}-sources.jar
+
+ providers/terremark/src
+
+
+ vcloud/terremark/target
+
+ jclouds-terremark-${project.version}.jar
+
+ providers/terremark/lib
+
+
+ vcloud/terremark/target
+
+ jclouds-terremark-${project.version}-sources.jar
+
+ providers/terremark/src
+
+
+ vcloud/terremark/target/apidocs
+ providers/terremark/docs
+
+
+ vcloud/terremark
+
+ README.txt
+
+ providers/terremark
+
+
+
+
+ extensions/bouncycastle/target
+
+ jclouds-bouncycastle-${project.version}-jar-with-dependencies.jar
+
+ extensions/bouncycastle/lib
+
+
+ extensions/bouncycastle/target
+
+ jclouds-bouncycastle-${project.version}-sources.jar
+
+ extensions/bouncycastle/src
+
+
+ extensions/bouncycastle/target/apidocs
+ extensions/bouncycastle/docs
+
+
+ extensions/bouncycastle
+
+ README.txt
+
+ extensions/bouncycastle
+
+
+
+
+ extensions/enterprise/target
+
+ jclouds-enterprise-${project.version}-jar-with-dependencies.jar
+
+ extensions/enterprise/lib
+
+
+ extensions/enterprise/target
+
+ jclouds-enterprise-${project.version}-sources.jar
+
+ extensions/enterprise/src
+
+
+ extensions/enterprise/target/apidocs
+ extensions/enterprise/docs
+
+
+ extensions/enterprise
+
+ README.txt
+
+ extensions/enterprise
+
+
+
+
+ extensions/gae/target
+
+ jclouds-gae-${project.version}.jar
+
+ extensions/gae/lib
+
+
+ extensions/gae/target
+
+ jclouds-gae-${project.version}-sources.jar
+
+ extensions/gae/src
+
+
+ extensions/gae/target/apidocs
+ extensions/gae/docs
+
+
+ extensions/gae
+
+ README.txt
+
+ extensions/gae
+
+
+
+
+ extensions/joda/target
+
+ jclouds-joda-${project.version}-jar-with-dependencies.jar
+
+ extensions/joda/lib
+
+
+ extensions/joda/target
+
+ jclouds-joda-${project.version}-sources.jar
+
+ extensions/joda/src
+
+
+ extensions/joda/target/apidocs
+ extensions/joda/docs
+
+
+ extensions/joda
+
+ README.txt
+
+ extensions/joda
+
+
+
+
+ extensions/apachehc/target
+
+ jclouds-apachehc-${project.version}.jar
+
+ extensions/apachehc/lib
+
+
+ extensions/apachehc/target
+
+ jclouds-apachehc-${project.version}-sources.jar
+
+ extensions/apachehc/src
+
+
+ extensions/apachehc/target/apidocs
+ extensions/apachehc/docs
+
+
+ extensions/apachehc
+
+ README.txt
+
+ extensions/apachehc
+
+
+
+
+ extensions/ssh/jsch/target
+
+ jclouds-jsch-${project.version}.jar
+
+ extensions/jsch/lib
+
+
+ extensions/ssh/jsch/target
+
+ jclouds-jsch-${project.version}-sources.jar
+
+ extensions/jsch/src
+
+
+ extensions/ssh/jsch/target/apidocs
+ extensions/jsch/docs
+
+
+ extensions/ssh/jsch
+
+ README.txt
+
+ extensions/jsch
+
+
+
+
+ extensions/log4j/target
+
+ jclouds-log4j-${project.version}.jar
+
+ extensions/log4j/lib
+
+
+ extensions/log4j/target
+
+ jclouds-log4j-${project.version}-sources.jar
+
+ extensions/log4j/src
+
+
+ extensions/log4j/target/apidocs
+ extensions/log4j/docs
+
+
+ extensions/log4j
+
+ README.txt
+
+ extensions/log4j
+
+
+
+
+ tools/antcontrib/target
+
+ jclouds-antcontrib-${project.version}-jar-with-dependencies.jar
+
+ tools/antcontrib/lib
+
+
+ tools/antcontrib/target
+
+ jclouds-antcontrib-${project.version}-sources.jar
+
+ tools/antcontrib/src
+
+
+ tools/antcontrib/target/apidocs
+ tools/antcontrib/docs
+
+
+ tools/antcontrib
+
+ README.txt
+
+ tools/antcontrib
+
+
+
+
+ demos/gae-tweetstore/target/jclouds-demo-gae-tweetstore
+ samples/gae-tweetstore
+
+
+ aws/demos/createandlistbuckets/target/jclouds-aws-demo-createandlistbuckets-src
+ samples/aws/createandlistbuckes
+
+
+ aws/demos/googleappengine/target/jclouds-aws-demo-googleappengine-src
+ samples/aws/googleappengine
+
+
+
diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties
index 7fb01d36cc..9108d8ad63 100644
--- a/core/src/main/resources/rest.properties
+++ b/core/src/main/resources/rest.properties
@@ -1,127 +1,126 @@
-#
-#
-# Copyright (C) 2009 Cloud Conscious, LLC.
-#
-# ====================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ====================================================================
-#
-azurequeue.contextbuilder=org.jclouds.azure.storage.AzureStorageContextBuilder
-azurequeue.sync=org.jclouds.azure.storage.queue.AzureQueueClient
-azurequeue.async=org.jclouds.azure.storage.queue.AzureQueueAsyncClient
-azurequeue.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
-azurequeue.endpoint=https://{identity}.queue.core.windows.net
-
-azureblob.contextbuilder=org.jclouds.azure.storage.blob.AzureBlobContextBuilder
-azureblob.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
-azureblob.endpoint=https://{identity}.blob.core.windows.net
-
-pcs.contextbuilder=org.jclouds.mezeo.pcs2.PCSContextBuilder
-pcs.apiVersion=unknown
-
-sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder
-sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder
-
-sqs.contextbuilder=org.jclouds.aws.sqs.SQSContextBuilder
-sqs.propertiesbuilder=org.jclouds.aws.sqs.SQSPropertiesBuilder
-
-elb.contextbuilder=org.jclouds.aws.elb.ELBContextBuilder
-elb.propertiesbuilder=org.jclouds.aws.elb.ELBPropertiesBuilder
-
-cloudwatch.contextbuilder=org.jclouds.aws.cloudwatch.CloudWatchContextBuilder
-cloudwatch.propertiesbuilder=org.jclouds.aws.cloudwatch.CloudWatchPropertiesBuilder
-
-s3.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
-s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder
-
-ec2.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
-ec2.propertiesbuilder=org.jclouds.aws.ec2.EC2PropertiesBuilder
-
-rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder
-rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder
-
-slicehost.contextbuilder=org.jclouds.slicehost.SlicehostContextBuilder
-slicehost.propertiesbuilder=org.jclouds.slicehost.SlicehostPropertiesBuilder
-
-trmk-vcloudexpress.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressContextBuilder
-trmk-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder
-
-trmk-ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder
-trmk-ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder
-
-chef.contextbuilder=org.jclouds.chef.ChefContextBuilder
-chef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
-
-transientchef.contextbuilder=org.jclouds.chef.test.TransientChefContextBuilder
-transientchef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
-
-opscodeplatform.contextbuilder=org.jclouds.opscodeplatform.OpscodePlatformContextBuilder
-opscodeplatform.propertiesbuilder=org.jclouds.opscodeplatform.OpscodePlatformPropertiesBuilder
-
-vcloud.contextbuilder=org.jclouds.vcloud.VCloudContextBuilder
-vcloud.propertiesbuilder=org.jclouds.vcloud.VCloudPropertiesBuilder
-
-vcloudexpress.contextbuilder=org.jclouds.vcloud.VCloudExpressContextBuilder
-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.VCloudExpressPropertiesBuilder
-
-eucalyptus.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
-eucalyptus.propertiesbuilder=org.jclouds.aws.ec2.EucalyptusPropertiesBuilder
-
-nova.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
-nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder
-
-cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
-cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
-
-bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
-bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
-
-gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
-gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
-
-ibmdev.propertiesbuilder=org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder
-ibmdev.contextbuilder=org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder
-
-stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder
-# example of where to change your endpoint
-# bluelock.endpoint=https://express3.bluelock.com/api
-
-atmosonline.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
-atmosonline.endpoint=https://accesspoint.atmosonline.com
-atmosonline.apiversion=1.3.0
-
-synaptic.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
-synaptic.endpoint=https://storage.synaptic.att.com
-synaptic.apiversion=1.3.0
-
-peer1-storage.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
-peer1-storage.endpoint=https://storage.synaptic.att.com
-peer1-storage.apiversion=1.3.0
-
-# TODO hostedsolutions use atmos
-
-cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder
-cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder
-
-walrus.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
-walrus.propertiesbuilder=org.jclouds.aws.s3.WalrusPropertiesBuilder
-
-googlestorage.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
-googlestorage.propertiesbuilder=org.jclouds.aws.s3.GoogleStoragePropertiesBuilder
-
-transient.contextbuilder=org.jclouds.blobstore.TransientBlobStoreContextBuilder
-transient.propertiesbuilder=org.jclouds.blobstore.TransientBlobStorePropertiesBuilder
-
-filesystem.contextbuilder=org.jclouds.filesystem.FilesystemBlobStoreContextBuilder
-filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertiesBuilder
-
+#
+#
+# Copyright (C) 2009 Cloud Conscious, LLC.
+#
+# ====================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ====================================================================
+#
+azurequeue.contextbuilder=org.jclouds.azure.storage.AzureStorageContextBuilder
+azurequeue.sync=org.jclouds.azure.storage.queue.AzureQueueClient
+azurequeue.async=org.jclouds.azure.storage.queue.AzureQueueAsyncClient
+azurequeue.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
+azurequeue.endpoint=https://{identity}.queue.core.windows.net
+
+azureblob.contextbuilder=org.jclouds.azure.storage.blob.AzureBlobContextBuilder
+azureblob.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
+azureblob.endpoint=https://{identity}.blob.core.windows.net
+
+pcs.contextbuilder=org.jclouds.mezeo.pcs2.PCSContextBuilder
+pcs.apiVersion=unknown
+
+sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder
+sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder
+
+sqs.contextbuilder=org.jclouds.aws.sqs.SQSContextBuilder
+sqs.propertiesbuilder=org.jclouds.aws.sqs.SQSPropertiesBuilder
+
+elb.contextbuilder=org.jclouds.aws.elb.ELBContextBuilder
+elb.propertiesbuilder=org.jclouds.aws.elb.ELBPropertiesBuilder
+
+cloudwatch.contextbuilder=org.jclouds.aws.cloudwatch.CloudWatchContextBuilder
+cloudwatch.propertiesbuilder=org.jclouds.aws.cloudwatch.CloudWatchPropertiesBuilder
+
+s3.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
+s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder
+
+ec2.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
+ec2.propertiesbuilder=org.jclouds.aws.ec2.EC2PropertiesBuilder
+
+rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder
+rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder
+
+slicehost.contextbuilder=org.jclouds.slicehost.SlicehostContextBuilder
+slicehost.propertiesbuilder=org.jclouds.slicehost.SlicehostPropertiesBuilder
+
+trmk-vcloudexpress.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressContextBuilder
+trmk-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder
+
+trmk-ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder
+trmk-ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder
+
+chef.contextbuilder=org.jclouds.chef.ChefContextBuilder
+chef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
+
+transientchef.contextbuilder=org.jclouds.chef.test.TransientChefContextBuilder
+transientchef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
+
+opscodeplatform.contextbuilder=org.jclouds.opscodeplatform.OpscodePlatformContextBuilder
+opscodeplatform.propertiesbuilder=org.jclouds.opscodeplatform.OpscodePlatformPropertiesBuilder
+
+vcloud.contextbuilder=org.jclouds.vcloud.VCloudContextBuilder
+vcloud.propertiesbuilder=org.jclouds.vcloud.VCloudPropertiesBuilder
+
+vcloudexpress.contextbuilder=org.jclouds.vcloud.VCloudExpressContextBuilder
+vcloudexpress.propertiesbuilder=org.jclouds.vcloud.VCloudExpressPropertiesBuilder
+
+eucalyptus.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
+eucalyptus.propertiesbuilder=org.jclouds.aws.ec2.EucalyptusPropertiesBuilder
+
+nova.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
+nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder
+
+cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
+cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
+
+bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
+bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
+
+gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
+gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
+
+ibmdev.propertiesbuilder=org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder
+ibmdev.contextbuilder=org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder
+
+stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder
+# example of where to change your endpoint
+# bluelock.endpoint=https://express3.bluelock.com/api
+
+atmosonline.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
+atmosonline.endpoint=https://accesspoint.atmosonline.com
+atmosonline.apiversion=1.3.0
+
+synaptic.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
+synaptic.endpoint=https://storage.synaptic.att.com
+synaptic.apiversion=1.3.0
+
+peer1-storage.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
+peer1-storage.endpoint=https://storage.synaptic.att.com
+peer1-storage.apiversion=1.3.0
+
+# TODO hostedsolutions use atmos
+
+cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder
+cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder
+
+walrus.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
+walrus.propertiesbuilder=org.jclouds.aws.s3.WalrusPropertiesBuilder
+
+googlestorage.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
+googlestorage.propertiesbuilder=org.jclouds.aws.s3.GoogleStoragePropertiesBuilder
+
+transient.contextbuilder=org.jclouds.blobstore.TransientBlobStoreContextBuilder
+transient.propertiesbuilder=org.jclouds.blobstore.TransientBlobStorePropertiesBuilder
+
+filesystem.contextbuilder=org.jclouds.filesystem.FilesystemBlobStoreContextBuilder
+filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertiesBuilder
\ No newline at end of file
diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
index fb11dccccd..b764f03936 100644
--- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
+++ b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
@@ -1,202 +1,202 @@
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- */
-
-package org.jclouds.demo.tweetstore.config;
-
-import static com.google.appengine.api.labs.taskqueue.TaskOptions.Builder.url;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.BlobStoreContextFactory;
-import org.jclouds.demo.tweetstore.controller.AddTweetsController;
-import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
-import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
-import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.context.ServletConfigAware;
-import org.springframework.web.servlet.HandlerAdapter;
-import org.springframework.web.servlet.HandlerMapping;
-import org.springframework.web.servlet.handler.SimpleServletHandlerAdapter;
-import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
-
-import twitter4j.Twitter;
-import twitter4j.TwitterFactory;
-
-import com.google.appengine.api.labs.taskqueue.Queue;
-import com.google.appengine.api.labs.taskqueue.QueueFactory;
-import com.google.appengine.api.labs.taskqueue.TaskOptions.Method;
-import com.google.appengine.repackaged.com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.io.Closeables;
-import com.google.inject.Module;
-
-/**
- * Creates servlets (using resources from the {@link SpringAppConfig}) and mappings.
- *
- * @author Andrew Phillips
- * @see SpringAppConfig
- */
-@Configuration
-public class SpringServletConfig extends LoggingConfig implements ServletConfigAware {
- public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts";
-
- private ServletConfig servletConfig;
-
- private Map providerTypeToBlobStoreMap;
- private Twitter twitterClient;
- private String container;
-
- @PostConstruct
- public void initialize() throws IOException {
- BlobStoreContextFactory blobStoreContextFactory = new BlobStoreContextFactory();
-
- Properties props = loadJCloudsProperties();
- logger.trace("About to initialize members.");
-
- Module googleModule = new GoogleAppEngineConfigurationModule();
- Set modules = ImmutableSet. of(googleModule);
- // shared across all blobstores and used to retrieve tweets
- try {
- twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"),
- props.getProperty("twitter.credential"));
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e);
- }
- // common namespace for storing tweets
- container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER);
-
- // instantiate and store references to all blobstores by provider name
- providerTypeToBlobStoreMap = Maps.newHashMap();
- for (String hint : Splitter.on(',').split(
- checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) {
- providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props));
- }
-
- // get a queue for submitting store tweet requests
- Queue queue = QueueFactory.getQueue("twitter");
- // submit a job to store tweets for each configured blobstore
- for (String name : providerTypeToBlobStoreMap.keySet()) {
- queue.add(url("/store/do").header("context", name).method(Method.GET));
- }
- logger.trace("Members initialized. Twitter: '%s', container: '%s', provider types: '%s'", twitterClient,
- container, providerTypeToBlobStoreMap.keySet());
- }
-
- private Properties loadJCloudsProperties() {
- logger.trace("About to read properties from '%s'", "/WEB-INF/jclouds.properties");
- Properties props = new Properties();
- InputStream input = servletConfig.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties");
- try {
- props.load(input);
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- Closeables.closeQuietly(input);
- }
- logger.trace("Properties successfully read.");
- return props;
- }
-
- @Bean
- public StoreTweetsController storeTweetsController() {
- StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap, container, twitterClient);
- injectServletConfig(controller);
- return controller;
- }
-
- @Bean
- public AddTweetsController addTweetsController() {
- AddTweetsController controller = new AddTweetsController(providerTypeToBlobStoreMap,
- serviceToStoredTweetStatuses());
- injectServletConfig(controller);
- return controller;
- }
-
- private void injectServletConfig(Servlet servlet) {
- logger.trace("About to inject servlet config '%s'", servletConfig);
- try {
- servlet.init(checkNotNull(servletConfig));
- } catch (ServletException exception) {
- throw new BeanCreationException("Unable to instantiate " + servlet, exception);
- }
- logger.trace("Successfully injected servlet config.");
- }
-
- @Bean
- ServiceToStoredTweetStatuses serviceToStoredTweetStatuses() {
- return new ServiceToStoredTweetStatuses(providerTypeToBlobStoreMap, container);
- }
-
- @Bean
- public HandlerMapping handlerMapping() {
- SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
- Map urlMap = Maps.newHashMapWithExpectedSize(2);
- urlMap.put("/store/*", storeTweetsController());
- urlMap.put("/tweets/*", addTweetsController());
- mapping.setUrlMap(urlMap);
- /*
- * "/store" and "/tweets" are part of the servlet mapping and thus stripped by the mapping if
- * using default settings.
- */
- mapping.setAlwaysUseFullPath(true);
- return mapping;
- }
-
- @Bean
- public HandlerAdapter servletHandlerAdapter() {
- return new SimpleServletHandlerAdapter();
- }
-
- @PreDestroy
- public void destroy() throws Exception {
- logger.trace("About to close contexts.");
- for (BlobStoreContext context : providerTypeToBlobStoreMap.values()) {
- context.close();
- }
- logger.trace("Contexts closed.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.springframework.web.context.ServletConfigAware#setServletConfig(javax.servlet.ServletConfig
- * )
- */
- @Override
- public void setServletConfig(ServletConfig servletConfig) {
- this.servletConfig = servletConfig;
- }
-}
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.jclouds.demo.tweetstore.config;
+
+import static com.google.appengine.api.labs.taskqueue.TaskOptions.Builder.url;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.blobstore.BlobStoreContextFactory;
+import org.jclouds.demo.tweetstore.controller.AddTweetsController;
+import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
+import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
+import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.context.ServletConfigAware;
+import org.springframework.web.servlet.HandlerAdapter;
+import org.springframework.web.servlet.HandlerMapping;
+import org.springframework.web.servlet.handler.SimpleServletHandlerAdapter;
+import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
+
+import twitter4j.Twitter;
+import twitter4j.TwitterFactory;
+
+import com.google.appengine.api.labs.taskqueue.Queue;
+import com.google.appengine.api.labs.taskqueue.QueueFactory;
+import com.google.appengine.api.labs.taskqueue.TaskOptions.Method;
+import com.google.appengine.repackaged.com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.common.io.Closeables;
+import com.google.inject.Module;
+
+/**
+ * Creates servlets (using resources from the {@link SpringAppConfig}) and mappings.
+ *
+ * @author Andrew Phillips
+ * @see SpringAppConfig
+ */
+@Configuration
+public class SpringServletConfig extends LoggingConfig implements ServletConfigAware {
+ public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts";
+
+ private ServletConfig servletConfig;
+
+ private Map providerTypeToBlobStoreMap;
+ private Twitter twitterClient;
+ private String container;
+
+ @PostConstruct
+ public void initialize() throws IOException {
+ BlobStoreContextFactory blobStoreContextFactory = new BlobStoreContextFactory();
+
+ Properties props = loadJCloudsProperties();
+ logger.trace("About to initialize members.");
+
+ Module googleModule = new GoogleAppEngineConfigurationModule();
+ Set modules = ImmutableSet. of(googleModule);
+ // shared across all blobstores and used to retrieve tweets
+ try {
+ twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"),
+ props.getProperty("twitter.credential"));
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e);
+ }
+ // common namespace for storing tweets
+ container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER);
+
+ // instantiate and store references to all blobstores by provider name
+ providerTypeToBlobStoreMap = Maps.newHashMap();
+ for (String hint : Splitter.on(',').split(
+ checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) {
+ providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props));
+ }
+
+ // get a queue for submitting store tweet requests
+ Queue queue = QueueFactory.getQueue("twitter");
+ // submit a job to store tweets for each configured blobstore
+ for (String name : providerTypeToBlobStoreMap.keySet()) {
+ queue.add(url("/store/do").header("context", name).method(Method.GET));
+ }
+ logger.trace("Members initialized. Twitter: '%s', container: '%s', provider types: '%s'", twitterClient,
+ container, providerTypeToBlobStoreMap.keySet());
+ }
+
+ private Properties loadJCloudsProperties() {
+ logger.trace("About to read properties from '%s'", "/WEB-INF/jclouds.properties");
+ Properties props = new Properties();
+ InputStream input = servletConfig.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties");
+ try {
+ props.load(input);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ Closeables.closeQuietly(input);
+ }
+ logger.trace("Properties successfully read.");
+ return props;
+ }
+
+ @Bean
+ public StoreTweetsController storeTweetsController() {
+ StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap, container, twitterClient);
+ injectServletConfig(controller);
+ return controller;
+ }
+
+ @Bean
+ public AddTweetsController addTweetsController() {
+ AddTweetsController controller = new AddTweetsController(providerTypeToBlobStoreMap,
+ serviceToStoredTweetStatuses());
+ injectServletConfig(controller);
+ return controller;
+ }
+
+ private void injectServletConfig(Servlet servlet) {
+ logger.trace("About to inject servlet config '%s'", servletConfig);
+ try {
+ servlet.init(checkNotNull(servletConfig));
+ } catch (ServletException exception) {
+ throw new BeanCreationException("Unable to instantiate " + servlet, exception);
+ }
+ logger.trace("Successfully injected servlet config.");
+ }
+
+ @Bean
+ ServiceToStoredTweetStatuses serviceToStoredTweetStatuses() {
+ return new ServiceToStoredTweetStatuses(providerTypeToBlobStoreMap, container);
+ }
+
+ @Bean
+ public HandlerMapping handlerMapping() {
+ SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
+ Map urlMap = Maps.newHashMapWithExpectedSize(2);
+ urlMap.put("/store/*", storeTweetsController());
+ urlMap.put("/tweets/*", addTweetsController());
+ mapping.setUrlMap(urlMap);
+ /*
+ * "/store" and "/tweets" are part of the servlet mapping and thus stripped by the mapping if
+ * using default settings.
+ */
+ mapping.setAlwaysUseFullPath(true);
+ return mapping;
+ }
+
+ @Bean
+ public HandlerAdapter servletHandlerAdapter() {
+ return new SimpleServletHandlerAdapter();
+ }
+
+ @PreDestroy
+ public void destroy() throws Exception {
+ logger.trace("About to close contexts.");
+ for (BlobStoreContext context : providerTypeToBlobStoreMap.values()) {
+ context.close();
+ }
+ logger.trace("Contexts closed.");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.springframework.web.context.ServletConfigAware#setServletConfig(javax.servlet.ServletConfig
+ * )
+ */
+ @Override
+ public void setServletConfig(ServletConfig servletConfig) {
+ this.servletConfig = servletConfig;
+ }
+}
\ No newline at end of file
diff --git a/project/pom.xml b/project/pom.xml
index 87b3db4084..c81667fd16 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -521,6 +521,10 @@ pageTracker._trackPageview();
maven-install-plugin
2.3
+
+ maven-release-plugin
+ 2.1
+
diff --git a/rimuhosting/pom.xml b/rimuhosting/pom.xml
index 8915c0eed5..6ea3e1ecb8 100644
--- a/rimuhosting/pom.xml
+++ b/rimuhosting/pom.xml
@@ -1,129 +1,129 @@
-
-
-
-
- 4.0.0
-
- org.jclouds
- jclouds-project
- 1.0-SNAPSHOT
- ../project/pom.xml
-
- jclouds-rimuhosting
- jclouds RimuHosting core
- jclouds components to access RimuHosting
-
-
- scm:svn:http://jclouds.googlecode.com/svn/trunk/rimuhosting
- scm:svn:https://jclouds.googlecode.com/svn/trunk/rimuhosting
- http://jclouds.googlecode.com/svn/trunk/rimuhosting
-
-
-
- trmkrun-ccc,test.trmk-924
- https://api.rimuhosting.com/r
- 1.0
- FIXME
-
-
-
- ${project.groupId}
- jclouds-jsch
- ${project.version}
- test
-
-
- ${project.groupId}
- jclouds-core
- ${project.version}
- test-jar
- test
-
-
- ${project.groupId}
- jclouds-compute
- ${project.version}
-
-
- ${project.groupId}
- jclouds-compute
- ${project.version}
- test-jar
- test
-
-
- log4j
- log4j
- 1.2.14
- test
-
-
- ${project.groupId}
- jclouds-log4j
- ${project.version}
- test
-
-
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration
- integration-test
-
- test
-
-
-
-
- test.rimuhosting.endpoint
- ${test.rimuhosting.endpoint}
-
-
- test.rimuhosting.apiversion
- ${test.rimuhosting.apiversion}
-
-
- test.rimuhosting.identity
- ${test.rimuhosting.identity}
-
-
- jclouds.compute.blacklist-nodes
- ${jclouds.compute.blacklist-nodes}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 4.0.0
+
+ org.jclouds
+ jclouds-project
+ 1.0-SNAPSHOT
+ ../project/pom.xml
+
+ jclouds-rimuhosting
+ jclouds RimuHosting core
+ jclouds components to access RimuHosting
+
+
+ scm:svn:http://jclouds.googlecode.com/svn/trunk/rimuhosting
+ scm:svn:https://jclouds.googlecode.com/svn/trunk/rimuhosting
+ http://jclouds.googlecode.com/svn/trunk/rimuhosting
+
+
+
+ trmkrun-ccc,test.trmk-924
+ https://api.rimuhosting.com/r
+ 1.0
+ FIXME
+
+
+
+ ${project.groupId}
+ jclouds-jsch
+ ${project.version}
+ test
+
+
+ ${project.groupId}
+ jclouds-core
+ ${project.version}
+ test-jar
+ test
+
+
+ ${project.groupId}
+ jclouds-compute
+ ${project.version}
+
+
+ ${project.groupId}
+ jclouds-compute
+ ${project.version}
+ test-jar
+ test
+
+
+ log4j
+ log4j
+ 1.2.14
+ test
+
+
+ ${project.groupId}
+ jclouds-log4j
+ ${project.version}
+ test
+
+
+
+
+ live
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration
+ integration-test
+
+ test
+
+
+
+
+ test.rimuhosting.endpoint
+ ${test.rimuhosting.endpoint}
+
+
+ test.rimuhosting.apiversion
+ ${test.rimuhosting.apiversion}
+
+
+ test.rimuhosting.identity
+ ${test.rimuhosting.identity}
+
+
+ jclouds.compute.blacklist-nodes
+ ${jclouds.compute.blacklist-nodes}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sandbox/vfs/samples/vfs-ant/build.xml b/sandbox/vfs/samples/vfs-ant/build.xml
index 7bf3be03bc..904a506a24 100644
--- a/sandbox/vfs/samples/vfs-ant/build.xml
+++ b/sandbox/vfs/samples/vfs-ant/build.xml
@@ -1,39 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scriptbuilder/src/test/resources/client_rb.cmd b/scriptbuilder/src/test/resources/client_rb.cmd
index d7bd4e6ddf..4f74c24cac 100644
--- a/scriptbuilder/src/test/resources/client_rb.cmd
+++ b/scriptbuilder/src/test/resources/client_rb.cmd
@@ -1,3 +1,3 @@
-echo log_level :info>>c:\etc\chef\client.rb
-echo log_location STDOUT>>c:\etc\chef\client.rb
-echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb
+echo log_level :info>>c:\etc\chef\client.rb
+echo log_location STDOUT>>c:\etc\chef\client.rb
+echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb
diff --git a/scriptbuilder/src/test/resources/test_init.cmd b/scriptbuilder/src/test/resources/test_init.cmd
index f7cc2709c3..283ea07881 100644
--- a/scriptbuilder/src/test/resources/test_init.cmd
+++ b/scriptbuilder/src/test/resources/test_init.cmd
@@ -1,134 +1,134 @@
-@echo off
-set PATH=
-set JAVA_HOME=
-set PATH=
-GOTO FUNCTION_END
-:abort
- echo aborting: %EXCEPTION%
- exit /b 1
-:default
- set INSTANCE_NAME=mkebsboot
-set INSTANCE_HOME=/mnt/tmp
-set LOG_DIR=/mnt/tmp
- exit /b 0
-:mkebsboot
- set TMP_DIR=/mnt/tmp
- exit /b 0
-:findPid
- set FOUND_PID=
- set _expression=%1
- shift
- set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
- FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
- SET FOUND_PID=%%A
- )
- if defined FOUND_PID (
- exit /b 0
- ) else (
- set EXCEPTION=%_expression% not found
- exit /b 1
- )
-:forget
- SETLOCAL
- set FOUND_PID=
- set NEXT_MINUTE=
- set INSTANCE_NAME=%1
- shift
- set SCRIPT=%1
- shift
- set LOG_DIR=%1
- shift
- CALL :findProcess %INSTANCE_NAME%
- if defined FOUND_PID (
- echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
- ) else (
- CALL :nextMinute
- set _DATE=%DATE:~4%
- set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
- echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
- set SECONDS=%TIME:~6,2%
- set /a SECOND=60-SECONDS
- %CMD% >NUL
- ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
- CALL :findProcess %INSTANCE_NAME%
- if not defined FOUND_PID (
- set EXCEPTION=%INSTANCE_NAME% did not start
- abort
- )
- )
- exit /b 0
-:FUNCTION_END
-set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
-if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
- set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
- goto abort
-)
-goto CASE_%1
-:CASE_init
- call :default
- if errorlevel 1 goto abort
- call :mkebsboot
- if errorlevel 1 goto abort
- md %INSTANCE_HOME%
- del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
- echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
- echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
- md %INSTANCE_HOME%
- del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
- echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
- echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
- echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
- GOTO END_SWITCH
-:CASE_status
- call :default
- if errorlevel 1 goto abort
- call :findPid %INSTANCE_NAME%
- if errorlevel 1 goto abort
- echo [%FOUND_PID%]
- GOTO END_SWITCH
-:CASE_stop
- call :default
- if errorlevel 1 goto abort
- call :findPid %INSTANCE_NAME%
- if errorlevel 1 goto abort
- if defined FOUND_PID (
- TASKKILL /F /T /PID %FOUND_PID% >NUL
- )
- GOTO END_SWITCH
-:CASE_start
- call :default
- if errorlevel 1 goto abort
- call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
- if errorlevel 1 goto abort
- GOTO END_SWITCH
-:CASE_tail
- call :default
- if errorlevel 1 goto abort
- tail %LOG_DIR%\stdout.log
- GOTO END_SWITCH
-:CASE_tailerr
- call :default
- if errorlevel 1 goto abort
- tail %LOG_DIR%\stderr.log
- GOTO END_SWITCH
-:CASE_run
- call :default
- if errorlevel 1 goto abort
- %INSTANCE_HOME%\%INSTANCE_NAME%.cmd
- GOTO END_SWITCH
-:END_SWITCH
-exit /b 0
+@echo off
+set PATH=
+set JAVA_HOME=
+set PATH=
+GOTO FUNCTION_END
+:abort
+ echo aborting: %EXCEPTION%
+ exit /b 1
+:default
+ set INSTANCE_NAME=mkebsboot
+set INSTANCE_HOME=/mnt/tmp
+set LOG_DIR=/mnt/tmp
+ exit /b 0
+:mkebsboot
+ set TMP_DIR=/mnt/tmp
+ exit /b 0
+:findPid
+ set FOUND_PID=
+ set _expression=%1
+ shift
+ set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
+ FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
+ SET FOUND_PID=%%A
+ )
+ if defined FOUND_PID (
+ exit /b 0
+ ) else (
+ set EXCEPTION=%_expression% not found
+ exit /b 1
+ )
+:forget
+ SETLOCAL
+ set FOUND_PID=
+ set NEXT_MINUTE=
+ set INSTANCE_NAME=%1
+ shift
+ set SCRIPT=%1
+ shift
+ set LOG_DIR=%1
+ shift
+ CALL :findProcess %INSTANCE_NAME%
+ if defined FOUND_PID (
+ echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
+ ) else (
+ CALL :nextMinute
+ set _DATE=%DATE:~4%
+ set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
+ echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
+ set SECONDS=%TIME:~6,2%
+ set /a SECOND=60-SECONDS
+ %CMD% >NUL
+ ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
+ CALL :findProcess %INSTANCE_NAME%
+ if not defined FOUND_PID (
+ set EXCEPTION=%INSTANCE_NAME% did not start
+ abort
+ )
+ )
+ exit /b 0
+:FUNCTION_END
+set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
+if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
+ set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
+ goto abort
+)
+goto CASE_%1
+:CASE_init
+ call :default
+ if errorlevel 1 goto abort
+ call :mkebsboot
+ if errorlevel 1 goto abort
+ md %INSTANCE_HOME%
+ del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
+ echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
+ md %INSTANCE_HOME%
+ del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
+ echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
+ echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
+ GOTO END_SWITCH
+:CASE_status
+ call :default
+ if errorlevel 1 goto abort
+ call :findPid %INSTANCE_NAME%
+ if errorlevel 1 goto abort
+ echo [%FOUND_PID%]
+ GOTO END_SWITCH
+:CASE_stop
+ call :default
+ if errorlevel 1 goto abort
+ call :findPid %INSTANCE_NAME%
+ if errorlevel 1 goto abort
+ if defined FOUND_PID (
+ TASKKILL /F /T /PID %FOUND_PID% >NUL
+ )
+ GOTO END_SWITCH
+:CASE_start
+ call :default
+ if errorlevel 1 goto abort
+ call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
+ if errorlevel 1 goto abort
+ GOTO END_SWITCH
+:CASE_tail
+ call :default
+ if errorlevel 1 goto abort
+ tail %LOG_DIR%\stdout.log
+ GOTO END_SWITCH
+:CASE_tailerr
+ call :default
+ if errorlevel 1 goto abort
+ tail %LOG_DIR%\stderr.log
+ GOTO END_SWITCH
+:CASE_run
+ call :default
+ if errorlevel 1 goto abort
+ %INSTANCE_HOME%\%INSTANCE_NAME%.cmd
+ GOTO END_SWITCH
+:END_SWITCH
+exit /b 0
diff --git a/scriptbuilder/src/test/resources/test_runrun.cmd b/scriptbuilder/src/test/resources/test_runrun.cmd
index ab5cf7c7bd..45fab930e4 100644
--- a/scriptbuilder/src/test/resources/test_runrun.cmd
+++ b/scriptbuilder/src/test/resources/test_runrun.cmd
@@ -1,17 +1,17 @@
-md %TEMP%\%USERNAME%\scripttest
-del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
-echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-md %TEMP%\%USERNAME%\scripttest
-del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
-echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
-echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+md %TEMP%\%USERNAME%\scripttest
+del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
+echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+md %TEMP%\%USERNAME%\scripttest
+del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
+echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
+echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
diff --git a/scriptbuilder/src/test/resources/test_script.cmd b/scriptbuilder/src/test/resources/test_script.cmd
index 0c20094c76..9f70acf13b 100644
--- a/scriptbuilder/src/test/resources/test_script.cmd
+++ b/scriptbuilder/src/test/resources/test_script.cmd
@@ -1,35 +1,35 @@
-@echo off
-set PATH=
-set JAVA_HOME=
-set PATH=
-set RUNTIME=
-GOTO FUNCTION_END
-:abort
- echo aborting: %EXCEPTION%
- exit /b 1
-:default
- set RUNTIME=Moo
- exit /b 0
-:FUNCTION_END
-set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
-if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
- set EXCEPTION=bad argument: %1 not in start stop status
- goto abort
-)
-goto CASE_%1
-:CASE_start
- call :default
- if errorlevel 1 goto abort
- echo start %RUNTIME%
- GOTO END_SWITCH
-:CASE_stop
- call :default
- if errorlevel 1 goto abort
- echo stop %RUNTIME%
- GOTO END_SWITCH
-:CASE_status
- echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
- echo the following should be []: [%RUNTIME%]
- GOTO END_SWITCH
-:END_SWITCH
-exit /b 0
+@echo off
+set PATH=
+set JAVA_HOME=
+set PATH=
+set RUNTIME=
+GOTO FUNCTION_END
+:abort
+ echo aborting: %EXCEPTION%
+ exit /b 1
+:default
+ set RUNTIME=Moo
+ exit /b 0
+:FUNCTION_END
+set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
+if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
+ set EXCEPTION=bad argument: %1 not in start stop status
+ goto abort
+)
+goto CASE_%1
+:CASE_start
+ call :default
+ if errorlevel 1 goto abort
+ echo start %RUNTIME%
+ GOTO END_SWITCH
+:CASE_stop
+ call :default
+ if errorlevel 1 goto abort
+ echo stop %RUNTIME%
+ GOTO END_SWITCH
+:CASE_status
+ echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
+ echo the following should be []: [%RUNTIME%]
+ GOTO END_SWITCH
+:END_SWITCH
+exit /b 0
diff --git a/tools/antcontrib/samples/compute/build.xml b/tools/antcontrib/samples/compute/build.xml
index c64cf06949..b4a1dab680 100644
--- a/tools/antcontrib/samples/compute/build.xml
+++ b/tools/antcontrib/samples/compute/build.xml
@@ -1,192 +1,192 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/sshjava/SSHJava.java b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/sshjava/SSHJava.java
index aaaced9c3a..1faf3ee418 100644
--- a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/sshjava/SSHJava.java
+++ b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/sshjava/SSHJava.java
@@ -1,588 +1,588 @@
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- */
-
-package org.jclouds.tools.ant.taskdefs.sshjava;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.scriptbuilder.domain.Statements.exec;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.security.SecureRandom;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Target;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Java;
-import org.apache.tools.ant.taskdefs.Replace;
-import org.apache.tools.ant.taskdefs.Replace.Replacefilter;
-import org.apache.tools.ant.taskdefs.optional.ssh.SSHUserInfo;
-import org.apache.tools.ant.taskdefs.optional.ssh.Scp;
-import org.apache.tools.ant.types.CommandlineJava;
-import org.apache.tools.ant.types.Environment;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Environment.Variable;
-import org.jclouds.scriptbuilder.InitBuilder;
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.ShellToken;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.StatementList;
-import org.jclouds.scriptbuilder.domain.Statements;
-import org.jclouds.tools.ant.util.SSHExecute;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.jcraft.jsch.JSchException;
-
-/**
- * Version of the Java task that executes over ssh.
- *
- * @author Adrian Cole
- */
-public class SSHJava extends Java {
- private final SSHExecute exec;
- private final Scp scp;
- private final SSHUserInfo userInfo;
- private File localDirectory;
- File remotebase;
- @VisibleForTesting
- File remotedir;
- @VisibleForTesting
- Environment env = new Environment();
-
- private OsFamily osFamily = OsFamily.UNIX;
- private File errorFile;
- private String errorProperty;
- private File outputFile;
- private String outputProperty;
- String id = "sshjava" + new SecureRandom().nextLong();
- private boolean append;
-
- @VisibleForTesting
- final LinkedHashMap shiftMap = Maps.newLinkedHashMap();
- @VisibleForTesting
- final LinkedHashMap replace = Maps.newLinkedHashMap();
-
- public SSHJava() {
- super();
- exec = new SSHExecute();
- exec.setProject(getProject());
- scp = new Scp();
- userInfo = new SSHUserInfo();
- scp.init();
- setFork(true);
- setTrust(true);
- }
-
- public SSHJava(Task owner) {
- this();
- bindToOwner(owner);
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int executeJava() throws BuildException {
- checkNotNull(remotebase, "remotebase must be set");
-
- if (localDirectory == null) {
- try {
- localDirectory = File.createTempFile("sshjava", "dir");
- localDirectory.delete();
- localDirectory.mkdirs();
- } catch (IOException e) {
- throw new BuildException(e);
- }
- }
-
- if (remotedir == null)
- remotedir = new File(remotebase, id);
-
- String command = createInitScript(osFamily, id, remotedir.getAbsolutePath(), env, getCommandLine());
-
- try {
- BufferedWriter out = new BufferedWriter(new FileWriter(new File(localDirectory, "init."
- + ShellToken.SH.to(osFamily))));
- out.write(command);
- out.close();
- } catch (IOException e) {
- throw new BuildException(e);
- }
-
- replaceAllTokensIn(localDirectory);
-
- FileSet cwd = new FileSet();
- cwd.setDir(localDirectory);
- if (osFamily == OsFamily.UNIX) {
- log("removing old contents: " + remotedir.getAbsolutePath(), Project.MSG_VERBOSE);
- sshexec(exec("rm -rf " + remotedir.getAbsolutePath()).render(osFamily));
- } else {
- // TODO need recursive remove on windows
- }
- mkdirAndCopyTo(remotedir.getAbsolutePath(), ImmutableList.of(cwd));
-
- for (Entry entry : shiftMap.entrySet()) {
- FileSet set = new FileSet();
- File source = new File(entry.getKey());
- if (source.isDirectory()) {
- set.setDir(new File(entry.getKey()));
- mkdirAndCopyTo(remotebase.getAbsolutePath() + ShellToken.FS.to(osFamily) + entry.getValue(), ImmutableList
- .of(set));
- } else {
- String destination = remotebase.getAbsolutePath() + ShellToken.FS.to(osFamily)
- + new File(entry.getValue()).getParent();
- sshexec(exec("{md} " + destination).render(osFamily));
- scp.init();
- String scpDestination = getScpDir(destination);
- log("staging: " + scpDestination, Project.MSG_VERBOSE);
- scp.setFile(source.getAbsolutePath());
- scp.setTodir(scpDestination);
- scp.execute();
- }
- }
-
- if (getCommandLine().getClasspath() != null) {
- copyPathTo(getCommandLine().getClasspath(), remotedir.getAbsolutePath() + "/classpath");
- }
-
- if (getCommandLine().getBootclasspath() != null) {
- copyPathTo(getCommandLine().getBootclasspath(), remotedir.getAbsolutePath() + "/bootclasspath");
- }
-
- if (osFamily == OsFamily.UNIX) {
- sshexec(exec("chmod 755 " + remotedir.getAbsolutePath() + "{fs}init.{sh}").render(osFamily));
- }
-
- Statement statement = new StatementList(exec("{cd} " + remotedir.getAbsolutePath()), exec(remotedir
- .getAbsolutePath()
- + "{fs}init.{sh} init"), exec(remotedir.getAbsolutePath() + "{fs}init.{sh} run"));
- try {
- return sshexecRedirectStreams(statement);
- } catch (IOException e) {
- throw new BuildException(e, getLocation());
- }
- }
-
- void replaceAllTokensIn(File directory) {
- Replace replacer = new Replace();
- replacer.setProject(getProject());
- replacer.setDir(directory);
-
- Map map = Maps.newLinkedHashMap();
- // this has to go first
- map.put(directory.getAbsolutePath(), remotedir.getAbsolutePath());
-
- map.putAll(Maps.transformValues(shiftMap, new Function() {
-
- @Override
- public String apply(String in) {
- return remotebase + ShellToken.FS.to(osFamily) + in;
- }
-
- }));
- map.putAll(replace);
-
- for (Entry entry : map.entrySet()) {
- Replacefilter filter = replacer.createReplacefilter();
- filter.setToken(entry.getKey());
- filter.setValue(entry.getValue());
- }
- replacer.execute();
- }
-
- private int sshexec(String command) {
- try {
- return exec.execute(command);
- } catch (JSchException e) {
- throw new BuildException(e, getLocation());
- } catch (IOException e) {
- throw new BuildException(e, getLocation());
- } catch (TimeoutException e) {
- throw new BuildException(e, getLocation());
- }
- }
-
- private int sshexecRedirectStreams(Statement statement) throws IOException {
- exec.setStreamHandler(redirector.createHandler());
- log("starting java as:\n" + statement.render(osFamily), Project.MSG_VERBOSE);
- int rc;
- try {
- rc = sshexec(statement.render(osFamily));
- } finally {
- redirector.complete();
- }
- return rc;
- }
-
- private void mkdirAndCopyTo(String destination, Iterable sets) {
- if (Iterables.size(sets) == 0) {
- log("no content: " + destination, Project.MSG_DEBUG);
- return;
- }
- if (sshexec(exec("test -d " + destination).render(osFamily)) == 0) {// TODO windows
- log("already created: " + destination, Project.MSG_VERBOSE);
- return;
- }
- sshexec(exec("{md} " + destination).render(osFamily));
- scp.init();
- String scpDestination = getScpDir(destination);
- log("staging: " + scpDestination, Project.MSG_VERBOSE);
- for (FileSet set : sets)
- scp.addFileset(set);
- scp.setTodir(scpDestination);
- scp.execute();
- }
-
- private String getScpDir(String path) {
- return String.format("%s:%s@%s:%s", userInfo.getName(), userInfo.getKeyfile() == null ? userInfo.getPassword()
- : userInfo.getPassphrase(), scp.getHost(), path);
- }
-
- void resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(Path path, String prefix, StringBuilder destination) {
- if (path == null)
- return;
- String[] paths = path.list();
- if (paths != null && paths.length > 0) {
- for (int i = 0; i < paths.length; i++) {
- log("converting: " + paths[i], Project.MSG_DEBUG);
- File file = new File(reprefix(paths[i]));
- if (file.getAbsolutePath().equals(paths[i]) && file.exists() && file.isFile()) {
- String newPath = prefix + "{fs}" + file.getName();
- log("adding new: " + newPath, Project.MSG_DEBUG);
- destination.append("{ps}").append(prefix + "{fs}" + file.getName());
- } else {
- // if the file doesn't exist, it is probably a "forward reference" to something that
- // is already on the remote machine
- destination.append("{ps}").append(file.getAbsolutePath());
- log("adding existing: " + file.getAbsolutePath(), Project.MSG_DEBUG);
- }
- }
- }
- }
-
- void copyPathTo(Path path, String destination) {
- List filesets = Lists.newArrayList();
- if (path.list() != null && path.list().length > 0) {
- for (String filepath : path.list()) {
- if (!filepath.equals(reprefix(filepath)))
- continue;// we've already copied
- File file = new File(filepath);
- if (file.exists()) {
- FileSet fileset = new FileSet();
- if (file.isFile()) {
- fileset.setFile(file);
- } else {
- fileset.setDir(file);
- }
- filesets.add(fileset);
- }
- }
- }
- mkdirAndCopyTo(destination, filesets);
- }
-
- String reprefix(String in) {
- log("comparing: " + in, Project.MSG_DEBUG);
- for (Entry entry : shiftMap.entrySet()) {
- if (in.startsWith(entry.getKey())) {
- log("match shift map: " + entry.getKey(), Project.MSG_DEBUG);
- in = remotebase + ShellToken.FS.to(osFamily) + entry.getValue() + in.substring(entry.getKey().length());
- }
- }
- for (Entry entry : replace.entrySet()) {
- if (in.startsWith(entry.getKey())) {
- log("match replaceMap: " + entry.getKey(), Project.MSG_DEBUG);
- in = entry.getValue() + in.substring(entry.getKey().length());
- }
- }
- log("now: " + in, Project.MSG_DEBUG);
- return in;
- }
-
- String createInitScript(OsFamily osFamily, String id, String basedir, Environment env,
- CommandlineJava commandLine) {
- Map envVariables = Maps.newHashMap();
- String[] environment = env.getVariables();
- if (environment != null) {
- for (int i = 0; i < environment.length; i++) {
- log("Setting environment variable: " + environment[i], Project.MSG_DEBUG);
- String[] keyValue = environment[i].split("=");
- envVariables.put(keyValue[0], keyValue[1]);
- }
- }
- StringBuilder commandBuilder = new StringBuilder(commandLine.getVmCommand().getExecutable());
- if (commandLine.getBootclasspath() != null) {
- commandBuilder.append(" -Xbootclasspath:bootclasspath");
- resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(commandLine.getBootclasspath(),
- "bootclasspath", commandBuilder);
- }
-
- if (commandLine.getVmCommand().getArguments() != null
- && commandLine.getVmCommand().getArguments().length > 0) {
- commandBuilder.append(" ").append(
- Joiner.on(' ').join(commandLine.getVmCommand().getArguments()));
- }
- commandBuilder.append(" -cp classpath");
- resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(commandLine.getClasspath(),
- "classpath", commandBuilder);
-
- if (commandLine.getSystemProperties() != null
- && commandLine.getSystemProperties().getVariables() != null
- && commandLine.getSystemProperties().getVariables().length > 0) {
- commandBuilder.append(" ").append(
- Joiner.on(' ').join(commandLine.getSystemProperties().getVariables()));
- }
-
- commandBuilder.append(" ").append(commandLine.getClassname());
-
- if (commandLine.getJavaCommand().getArguments() != null
- && commandLine.getJavaCommand().getArguments().length > 0) {
- commandBuilder.append(" ").append(
- Joiner.on(' ').join(commandLine.getJavaCommand().getArguments()));
- }
-
- InitBuilder testInitBuilder = new InitBuilder(id, basedir, basedir, envVariables,
- ImmutableList. of(Statements.interpret( commandBuilder.toString())));
- return testInitBuilder.render(osFamily);
- }
-
- @Override
- public void addEnv(Environment.Variable var) {
- env.addVariable(var);
- }
-
- /**
- * Note that if the {@code dir} property is set, this will be copied recursively to the remote
- * host.
- */
- @Override
- public void setDir(File localDir) {
- this.localDirectory = checkNotNull(localDir, "dir");
- }
-
- /**
- * All files transfered to the host will be relative to this. The java process itself will be at
- * this path/{@code id}.
- */
- public void setRemotebase(File remotebase) {
- this.remotebase = checkNotNull(remotebase, "remotebase");
- }
-
- @Override
- public void setFork(boolean fork) {
- if (!fork)
- throw new IllegalArgumentException("this only operates when fork is set");
- }
-
- /**
- * Remote host, either DNS name or IP.
- *
- * @param host
- * The new host value
- */
- public void setHost(String host) {
- exec.setHost(host);
- scp.setHost(host);
- }
-
- /**
- * Username known to remote host.
- *
- * @param username
- * The new username value
- */
- public void setUsername(String username) {
- exec.setUsername(username);
- scp.setUsername(username);
- userInfo.setName(username);
- }
-
- /**
- * Sets the password for the user.
- *
- * @param password
- * The new password value
- */
- public void setPassword(String password) {
- exec.setPassword(password);
- scp.setPassword(password);
- userInfo.setPassword(password);
- }
-
- /**
- * Sets the keyfile for the user.
- *
- * @param keyfile
- * The new keyfile value
- */
- public void setKeyfile(String keyfile) {
- exec.setKeyfile(keyfile);
- scp.setKeyfile(keyfile);
- userInfo.setKeyfile(keyfile);
- if (userInfo.getPassphrase() == null)
- userInfo.setPassphrase("");
- }
-
- /**
- * Sets the passphrase for the users key.
- *
- * @param passphrase
- * The new passphrase value
- */
- public void setPassphrase(String passphrase) {
- exec.setPassphrase(passphrase);
- scp.setPassphrase(passphrase);
- userInfo.setPassphrase(passphrase);
- }
-
- /**
- * Sets the path to the file that has the identities of all known hosts. This is used by SSH
- * protocol to validate the identity of the host. The default is
- * ${user.home}/.ssh/known_hosts.
- *
- * @param knownHosts
- * a path to the known hosts file.
- */
- public void setKnownhosts(String knownHosts) {
- exec.setKnownhosts(knownHosts);
- scp.setKnownhosts(knownHosts);
- }
-
- /**
- * Setting this to true trusts hosts whose identity is unknown.
- *
- * @param yesOrNo
- * if true trust the identity of unknown hosts.
- */
- public void setTrust(boolean yesOrNo) {
- exec.setTrust(yesOrNo);
- scp.setTrust(yesOrNo);
- userInfo.setTrust(yesOrNo);
- }
-
- /**
- * Changes the port used to connect to the remote host.
- *
- * @param port
- * port number of remote host.
- */
- public void setPort(int port) {
- exec.setPort(port);
- scp.setPort(port);
- }
-
- /**
- * The connection can be dropped after a specified number of milliseconds. This is sometimes
- * useful when a connection may be flaky. Default is 0, which means "wait forever".
- *
- * @param timeout
- * The new timeout value in seconds
- */
- public void setTimeout(long timeout) {
- exec.setTimeout(timeout);
- }
-
- @Override
- public void setProject(Project project) {
- super.setProject(project);
- exec.setProject(project);
- scp.setProject(project);
- }
-
- @Override
- public void setOwningTarget(Target target) {
- super.setOwningTarget(target);
- scp.setOwningTarget(target);
- }
-
- @Override
- public void setTaskName(String taskName) {
- super.setTaskName(taskName);
- scp.setTaskName(taskName);
- }
-
- @Override
- public void setDescription(String description) {
- super.setDescription(description);
- scp.setDescription(description);
- }
-
- @Override
- public void setLocation(Location location) {
- super.setLocation(location);
- scp.setLocation(location);
- }
-
- @Override
- public void setTaskType(String type) {
- super.setTaskType(type);
- scp.setTaskType(type);
- }
-
- @Override
- public String toString() {
- return "SSHJava [append=" + append + ", env=" + env + ", errorFile=" + errorFile + ", errorProperty="
- + errorProperty + ", localDirectory=" + localDirectory + ", osFamily=" + osFamily + ", outputFile="
- + outputFile + ", outputProperty=" + outputProperty + ", remoteDirectory=" + remotebase + ", userInfo="
- + userInfo + "]";
- }
-
- @Override
- public void addSysproperty(Variable sysp) {
- if (sysp.getKey().startsWith("sshjava.shift.")) {
- shiftMap.put(sysp.getKey().replaceFirst("sshjava.shift.", ""), sysp.getValue());
- } else if (sysp.getKey().startsWith("sshjava.replace.")) {
- replace.put(sysp.getKey().replaceFirst("sshjava.replace.", ""), sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.id")) {
- setId(sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.host")) {
- setHost(sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.port") && !sysp.getValue().equals("")) {
- setPort(Integer.parseInt(sysp.getValue()));
- } else if (sysp.getKey().equals("sshjava.username")) {
- setUsername(sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.password") && !sysp.getValue().equals("")) {
- setPassword(sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.keyfile") && !sysp.getValue().equals("")) {
- setKeyfile(sysp.getValue());
- } else if (sysp.getKey().equals("sshjava.remotebase")) {
- setRemotebase(new File(sysp.getValue()));
- } else {
- super.addSysproperty(sysp);
- }
- }
-
-}
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.jclouds.tools.ant.taskdefs.sshjava;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.scriptbuilder.domain.Statements.exec;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.security.SecureRandom;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Java;
+import org.apache.tools.ant.taskdefs.Replace;
+import org.apache.tools.ant.taskdefs.Replace.Replacefilter;
+import org.apache.tools.ant.taskdefs.optional.ssh.SSHUserInfo;
+import org.apache.tools.ant.taskdefs.optional.ssh.Scp;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.Environment;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Environment.Variable;
+import org.jclouds.scriptbuilder.InitBuilder;
+import org.jclouds.scriptbuilder.domain.OsFamily;
+import org.jclouds.scriptbuilder.domain.ShellToken;
+import org.jclouds.scriptbuilder.domain.Statement;
+import org.jclouds.scriptbuilder.domain.StatementList;
+import org.jclouds.scriptbuilder.domain.Statements;
+import org.jclouds.tools.ant.util.SSHExecute;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jcraft.jsch.JSchException;
+
+/**
+ * Version of the Java task that executes over ssh.
+ *
+ * @author Adrian Cole
+ */
+public class SSHJava extends Java {
+ private final SSHExecute exec;
+ private final Scp scp;
+ private final SSHUserInfo userInfo;
+ private File localDirectory;
+ File remotebase;
+ @VisibleForTesting
+ File remotedir;
+ @VisibleForTesting
+ Environment env = new Environment();
+
+ private OsFamily osFamily = OsFamily.UNIX;
+ private File errorFile;
+ private String errorProperty;
+ private File outputFile;
+ private String outputProperty;
+ String id = "sshjava" + new SecureRandom().nextLong();
+ private boolean append;
+
+ @VisibleForTesting
+ final LinkedHashMap shiftMap = Maps.newLinkedHashMap();
+ @VisibleForTesting
+ final LinkedHashMap replace = Maps.newLinkedHashMap();
+
+ public SSHJava() {
+ super();
+ exec = new SSHExecute();
+ exec.setProject(getProject());
+ scp = new Scp();
+ userInfo = new SSHUserInfo();
+ scp.init();
+ setFork(true);
+ setTrust(true);
+ }
+
+ public SSHJava(Task owner) {
+ this();
+ bindToOwner(owner);
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int executeJava() throws BuildException {
+ checkNotNull(remotebase, "remotebase must be set");
+
+ if (localDirectory == null) {
+ try {
+ localDirectory = File.createTempFile("sshjava", "dir");
+ localDirectory.delete();
+ localDirectory.mkdirs();
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ if (remotedir == null)
+ remotedir = new File(remotebase, id);
+
+ String command = createInitScript(osFamily, id, remotedir.getAbsolutePath(), env, getCommandLine());
+
+ try {
+ BufferedWriter out = new BufferedWriter(new FileWriter(new File(localDirectory, "init."
+ + ShellToken.SH.to(osFamily))));
+ out.write(command);
+ out.close();
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+
+ replaceAllTokensIn(localDirectory);
+
+ FileSet cwd = new FileSet();
+ cwd.setDir(localDirectory);
+ if (osFamily == OsFamily.UNIX) {
+ log("removing old contents: " + remotedir.getAbsolutePath(), Project.MSG_VERBOSE);
+ sshexec(exec("rm -rf " + remotedir.getAbsolutePath()).render(osFamily));
+ } else {
+ // TODO need recursive remove on windows
+ }
+ mkdirAndCopyTo(remotedir.getAbsolutePath(), ImmutableList.of(cwd));
+
+ for (Entry entry : shiftMap.entrySet()) {
+ FileSet set = new FileSet();
+ File source = new File(entry.getKey());
+ if (source.isDirectory()) {
+ set.setDir(new File(entry.getKey()));
+ mkdirAndCopyTo(remotebase.getAbsolutePath() + ShellToken.FS.to(osFamily) + entry.getValue(), ImmutableList
+ .of(set));
+ } else {
+ String destination = remotebase.getAbsolutePath() + ShellToken.FS.to(osFamily)
+ + new File(entry.getValue()).getParent();
+ sshexec(exec("{md} " + destination).render(osFamily));
+ scp.init();
+ String scpDestination = getScpDir(destination);
+ log("staging: " + scpDestination, Project.MSG_VERBOSE);
+ scp.setFile(source.getAbsolutePath());
+ scp.setTodir(scpDestination);
+ scp.execute();
+ }
+ }
+
+ if (getCommandLine().getClasspath() != null) {
+ copyPathTo(getCommandLine().getClasspath(), remotedir.getAbsolutePath() + "/classpath");
+ }
+
+ if (getCommandLine().getBootclasspath() != null) {
+ copyPathTo(getCommandLine().getBootclasspath(), remotedir.getAbsolutePath() + "/bootclasspath");
+ }
+
+ if (osFamily == OsFamily.UNIX) {
+ sshexec(exec("chmod 755 " + remotedir.getAbsolutePath() + "{fs}init.{sh}").render(osFamily));
+ }
+
+ Statement statement = new StatementList(exec("{cd} " + remotedir.getAbsolutePath()), exec(remotedir
+ .getAbsolutePath()
+ + "{fs}init.{sh} init"), exec(remotedir.getAbsolutePath() + "{fs}init.{sh} run"));
+ try {
+ return sshexecRedirectStreams(statement);
+ } catch (IOException e) {
+ throw new BuildException(e, getLocation());
+ }
+ }
+
+ void replaceAllTokensIn(File directory) {
+ Replace replacer = new Replace();
+ replacer.setProject(getProject());
+ replacer.setDir(directory);
+
+ Map map = Maps.newLinkedHashMap();
+ // this has to go first
+ map.put(directory.getAbsolutePath(), remotedir.getAbsolutePath());
+
+ map.putAll(Maps.transformValues(shiftMap, new Function() {
+
+ @Override
+ public String apply(String in) {
+ return remotebase + ShellToken.FS.to(osFamily) + in;
+ }
+
+ }));
+ map.putAll(replace);
+
+ for (Entry entry : map.entrySet()) {
+ Replacefilter filter = replacer.createReplacefilter();
+ filter.setToken(entry.getKey());
+ filter.setValue(entry.getValue());
+ }
+ replacer.execute();
+ }
+
+ private int sshexec(String command) {
+ try {
+ return exec.execute(command);
+ } catch (JSchException e) {
+ throw new BuildException(e, getLocation());
+ } catch (IOException e) {
+ throw new BuildException(e, getLocation());
+ } catch (TimeoutException e) {
+ throw new BuildException(e, getLocation());
+ }
+ }
+
+ private int sshexecRedirectStreams(Statement statement) throws IOException {
+ exec.setStreamHandler(redirector.createHandler());
+ log("starting java as:\n" + statement.render(osFamily), Project.MSG_VERBOSE);
+ int rc;
+ try {
+ rc = sshexec(statement.render(osFamily));
+ } finally {
+ redirector.complete();
+ }
+ return rc;
+ }
+
+ private void mkdirAndCopyTo(String destination, Iterable sets) {
+ if (Iterables.size(sets) == 0) {
+ log("no content: " + destination, Project.MSG_DEBUG);
+ return;
+ }
+ if (sshexec(exec("test -d " + destination).render(osFamily)) == 0) {// TODO windows
+ log("already created: " + destination, Project.MSG_VERBOSE);
+ return;
+ }
+ sshexec(exec("{md} " + destination).render(osFamily));
+ scp.init();
+ String scpDestination = getScpDir(destination);
+ log("staging: " + scpDestination, Project.MSG_VERBOSE);
+ for (FileSet set : sets)
+ scp.addFileset(set);
+ scp.setTodir(scpDestination);
+ scp.execute();
+ }
+
+ private String getScpDir(String path) {
+ return String.format("%s:%s@%s:%s", userInfo.getName(), userInfo.getKeyfile() == null ? userInfo.getPassword()
+ : userInfo.getPassphrase(), scp.getHost(), path);
+ }
+
+ void resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(Path path, String prefix, StringBuilder destination) {
+ if (path == null)
+ return;
+ String[] paths = path.list();
+ if (paths != null && paths.length > 0) {
+ for (int i = 0; i < paths.length; i++) {
+ log("converting: " + paths[i], Project.MSG_DEBUG);
+ File file = new File(reprefix(paths[i]));
+ if (file.getAbsolutePath().equals(paths[i]) && file.exists() && file.isFile()) {
+ String newPath = prefix + "{fs}" + file.getName();
+ log("adding new: " + newPath, Project.MSG_DEBUG);
+ destination.append("{ps}").append(prefix + "{fs}" + file.getName());
+ } else {
+ // if the file doesn't exist, it is probably a "forward reference" to something that
+ // is already on the remote machine
+ destination.append("{ps}").append(file.getAbsolutePath());
+ log("adding existing: " + file.getAbsolutePath(), Project.MSG_DEBUG);
+ }
+ }
+ }
+ }
+
+ void copyPathTo(Path path, String destination) {
+ List filesets = Lists.newArrayList();
+ if (path.list() != null && path.list().length > 0) {
+ for (String filepath : path.list()) {
+ if (!filepath.equals(reprefix(filepath)))
+ continue;// we've already copied
+ File file = new File(filepath);
+ if (file.exists()) {
+ FileSet fileset = new FileSet();
+ if (file.isFile()) {
+ fileset.setFile(file);
+ } else {
+ fileset.setDir(file);
+ }
+ filesets.add(fileset);
+ }
+ }
+ }
+ mkdirAndCopyTo(destination, filesets);
+ }
+
+ String reprefix(String in) {
+ log("comparing: " + in, Project.MSG_DEBUG);
+ for (Entry entry : shiftMap.entrySet()) {
+ if (in.startsWith(entry.getKey())) {
+ log("match shift map: " + entry.getKey(), Project.MSG_DEBUG);
+ in = remotebase + ShellToken.FS.to(osFamily) + entry.getValue() + in.substring(entry.getKey().length());
+ }
+ }
+ for (Entry entry : replace.entrySet()) {
+ if (in.startsWith(entry.getKey())) {
+ log("match replaceMap: " + entry.getKey(), Project.MSG_DEBUG);
+ in = entry.getValue() + in.substring(entry.getKey().length());
+ }
+ }
+ log("now: " + in, Project.MSG_DEBUG);
+ return in;
+ }
+
+ String createInitScript(OsFamily osFamily, String id, String basedir, Environment env,
+ CommandlineJava commandLine) {
+ Map envVariables = Maps.newHashMap();
+ String[] environment = env.getVariables();
+ if (environment != null) {
+ for (int i = 0; i < environment.length; i++) {
+ log("Setting environment variable: " + environment[i], Project.MSG_DEBUG);
+ String[] keyValue = environment[i].split("=");
+ envVariables.put(keyValue[0], keyValue[1]);
+ }
+ }
+ StringBuilder commandBuilder = new StringBuilder(commandLine.getVmCommand().getExecutable());
+ if (commandLine.getBootclasspath() != null) {
+ commandBuilder.append(" -Xbootclasspath:bootclasspath");
+ resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(commandLine.getBootclasspath(),
+ "bootclasspath", commandBuilder);
+ }
+
+ if (commandLine.getVmCommand().getArguments() != null
+ && commandLine.getVmCommand().getArguments().length > 0) {
+ commandBuilder.append(" ").append(
+ Joiner.on(' ').join(commandLine.getVmCommand().getArguments()));
+ }
+ commandBuilder.append(" -cp classpath");
+ resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(commandLine.getClasspath(),
+ "classpath", commandBuilder);
+
+ if (commandLine.getSystemProperties() != null
+ && commandLine.getSystemProperties().getVariables() != null
+ && commandLine.getSystemProperties().getVariables().length > 0) {
+ commandBuilder.append(" ").append(
+ Joiner.on(' ').join(commandLine.getSystemProperties().getVariables()));
+ }
+
+ commandBuilder.append(" ").append(commandLine.getClassname());
+
+ if (commandLine.getJavaCommand().getArguments() != null
+ && commandLine.getJavaCommand().getArguments().length > 0) {
+ commandBuilder.append(" ").append(
+ Joiner.on(' ').join(commandLine.getJavaCommand().getArguments()));
+ }
+
+ InitBuilder testInitBuilder = new InitBuilder(id, basedir, basedir, envVariables,
+ ImmutableList. of(Statements.interpret( commandBuilder.toString())));
+ return testInitBuilder.render(osFamily);
+ }
+
+ @Override
+ public void addEnv(Environment.Variable var) {
+ env.addVariable(var);
+ }
+
+ /**
+ * Note that if the {@code dir} property is set, this will be copied recursively to the remote
+ * host.
+ */
+ @Override
+ public void setDir(File localDir) {
+ this.localDirectory = checkNotNull(localDir, "dir");
+ }
+
+ /**
+ * All files transfered to the host will be relative to this. The java process itself will be at
+ * this path/{@code id}.
+ */
+ public void setRemotebase(File remotebase) {
+ this.remotebase = checkNotNull(remotebase, "remotebase");
+ }
+
+ @Override
+ public void setFork(boolean fork) {
+ if (!fork)
+ throw new IllegalArgumentException("this only operates when fork is set");
+ }
+
+ /**
+ * Remote host, either DNS name or IP.
+ *
+ * @param host
+ * The new host value
+ */
+ public void setHost(String host) {
+ exec.setHost(host);
+ scp.setHost(host);
+ }
+
+ /**
+ * Username known to remote host.
+ *
+ * @param username
+ * The new username value
+ */
+ public void setUsername(String username) {
+ exec.setUsername(username);
+ scp.setUsername(username);
+ userInfo.setName(username);
+ }
+
+ /**
+ * Sets the password for the user.
+ *
+ * @param password
+ * The new password value
+ */
+ public void setPassword(String password) {
+ exec.setPassword(password);
+ scp.setPassword(password);
+ userInfo.setPassword(password);
+ }
+
+ /**
+ * Sets the keyfile for the user.
+ *
+ * @param keyfile
+ * The new keyfile value
+ */
+ public void setKeyfile(String keyfile) {
+ exec.setKeyfile(keyfile);
+ scp.setKeyfile(keyfile);
+ userInfo.setKeyfile(keyfile);
+ if (userInfo.getPassphrase() == null)
+ userInfo.setPassphrase("");
+ }
+
+ /**
+ * Sets the passphrase for the users key.
+ *
+ * @param passphrase
+ * The new passphrase value
+ */
+ public void setPassphrase(String passphrase) {
+ exec.setPassphrase(passphrase);
+ scp.setPassphrase(passphrase);
+ userInfo.setPassphrase(passphrase);
+ }
+
+ /**
+ * Sets the path to the file that has the identities of all known hosts. This is used by SSH
+ * protocol to validate the identity of the host. The default is
+ * ${user.home}/.ssh/known_hosts.
+ *
+ * @param knownHosts
+ * a path to the known hosts file.
+ */
+ public void setKnownhosts(String knownHosts) {
+ exec.setKnownhosts(knownHosts);
+ scp.setKnownhosts(knownHosts);
+ }
+
+ /**
+ * Setting this to true trusts hosts whose identity is unknown.
+ *
+ * @param yesOrNo
+ * if true trust the identity of unknown hosts.
+ */
+ public void setTrust(boolean yesOrNo) {
+ exec.setTrust(yesOrNo);
+ scp.setTrust(yesOrNo);
+ userInfo.setTrust(yesOrNo);
+ }
+
+ /**
+ * Changes the port used to connect to the remote host.
+ *
+ * @param port
+ * port number of remote host.
+ */
+ public void setPort(int port) {
+ exec.setPort(port);
+ scp.setPort(port);
+ }
+
+ /**
+ * The connection can be dropped after a specified number of milliseconds. This is sometimes
+ * useful when a connection may be flaky. Default is 0, which means "wait forever".
+ *
+ * @param timeout
+ * The new timeout value in seconds
+ */
+ public void setTimeout(long timeout) {
+ exec.setTimeout(timeout);
+ }
+
+ @Override
+ public void setProject(Project project) {
+ super.setProject(project);
+ exec.setProject(project);
+ scp.setProject(project);
+ }
+
+ @Override
+ public void setOwningTarget(Target target) {
+ super.setOwningTarget(target);
+ scp.setOwningTarget(target);
+ }
+
+ @Override
+ public void setTaskName(String taskName) {
+ super.setTaskName(taskName);
+ scp.setTaskName(taskName);
+ }
+
+ @Override
+ public void setDescription(String description) {
+ super.setDescription(description);
+ scp.setDescription(description);
+ }
+
+ @Override
+ public void setLocation(Location location) {
+ super.setLocation(location);
+ scp.setLocation(location);
+ }
+
+ @Override
+ public void setTaskType(String type) {
+ super.setTaskType(type);
+ scp.setTaskType(type);
+ }
+
+ @Override
+ public String toString() {
+ return "SSHJava [append=" + append + ", env=" + env + ", errorFile=" + errorFile + ", errorProperty="
+ + errorProperty + ", localDirectory=" + localDirectory + ", osFamily=" + osFamily + ", outputFile="
+ + outputFile + ", outputProperty=" + outputProperty + ", remoteDirectory=" + remotebase + ", userInfo="
+ + userInfo + "]";
+ }
+
+ @Override
+ public void addSysproperty(Variable sysp) {
+ if (sysp.getKey().startsWith("sshjava.shift.")) {
+ shiftMap.put(sysp.getKey().replaceFirst("sshjava.shift.", ""), sysp.getValue());
+ } else if (sysp.getKey().startsWith("sshjava.replace.")) {
+ replace.put(sysp.getKey().replaceFirst("sshjava.replace.", ""), sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.id")) {
+ setId(sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.host")) {
+ setHost(sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.port") && !sysp.getValue().equals("")) {
+ setPort(Integer.parseInt(sysp.getValue()));
+ } else if (sysp.getKey().equals("sshjava.username")) {
+ setUsername(sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.password") && !sysp.getValue().equals("")) {
+ setPassword(sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.keyfile") && !sysp.getValue().equals("")) {
+ setKeyfile(sysp.getValue());
+ } else if (sysp.getKey().equals("sshjava.remotebase")) {
+ setRemotebase(new File(sysp.getValue()));
+ } else {
+ super.addSysproperty(sysp);
+ }
+ }
+
+}
\ No newline at end of file