Line endings

This commit is contained in:
Andrew Phillips 2010-09-27 11:11:58 +02:00
parent fc1782b536
commit c08b50e860
11 changed files with 2131 additions and 2131 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,124 +1,124 @@
# #
# #
# Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com> # Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
# #
# ==================================================================== # ====================================================================
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ==================================================================== # ====================================================================
# #
azurequeue.contextbuilder=org.jclouds.azure.storage.AzureStorageContextBuilder azurequeue.contextbuilder=org.jclouds.azure.storage.AzureStorageContextBuilder
azurequeue.sync=org.jclouds.azure.storage.queue.AzureQueueClient azurequeue.sync=org.jclouds.azure.storage.queue.AzureQueueClient
azurequeue.async=org.jclouds.azure.storage.queue.AzureQueueAsyncClient azurequeue.async=org.jclouds.azure.storage.queue.AzureQueueAsyncClient
azurequeue.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder azurequeue.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
azurequeue.endpoint=https://{identity}.queue.core.windows.net azurequeue.endpoint=https://{identity}.queue.core.windows.net
azureblob.contextbuilder=org.jclouds.azure.storage.blob.AzureBlobContextBuilder azureblob.contextbuilder=org.jclouds.azure.storage.blob.AzureBlobContextBuilder
azureblob.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder azureblob.propertiesbuilder=org.jclouds.azure.storage.AzureStoragePropertiesBuilder
azureblob.endpoint=https://{identity}.blob.core.windows.net azureblob.endpoint=https://{identity}.blob.core.windows.net
pcs.contextbuilder=org.jclouds.mezeo.pcs2.PCSContextBuilder pcs.contextbuilder=org.jclouds.mezeo.pcs2.PCSContextBuilder
pcs.apiVersion=unknown pcs.apiVersion=unknown
sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder sdn.contextbuilder=org.jclouds.nirvanix.sdn.SDNContextBuilder
sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder sdn.propertiesbuilder=org.jclouds.nirvanix.sdn.SDNPropertiesBuilder
sqs.contextbuilder=org.jclouds.aws.sqs.SQSContextBuilder sqs.contextbuilder=org.jclouds.aws.sqs.SQSContextBuilder
sqs.propertiesbuilder=org.jclouds.aws.sqs.SQSPropertiesBuilder sqs.propertiesbuilder=org.jclouds.aws.sqs.SQSPropertiesBuilder
elb.contextbuilder=org.jclouds.aws.elb.ELBContextBuilder elb.contextbuilder=org.jclouds.aws.elb.ELBContextBuilder
elb.propertiesbuilder=org.jclouds.aws.elb.ELBPropertiesBuilder elb.propertiesbuilder=org.jclouds.aws.elb.ELBPropertiesBuilder
cloudwatch.contextbuilder=org.jclouds.aws.cloudwatch.CloudWatchContextBuilder cloudwatch.contextbuilder=org.jclouds.aws.cloudwatch.CloudWatchContextBuilder
cloudwatch.propertiesbuilder=org.jclouds.aws.cloudwatch.CloudWatchPropertiesBuilder cloudwatch.propertiesbuilder=org.jclouds.aws.cloudwatch.CloudWatchPropertiesBuilder
s3.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder s3.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder
ec2.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder ec2.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
ec2.propertiesbuilder=org.jclouds.aws.ec2.EC2PropertiesBuilder ec2.propertiesbuilder=org.jclouds.aws.ec2.EC2PropertiesBuilder
rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder
rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder
slicehost.contextbuilder=org.jclouds.slicehost.SlicehostContextBuilder slicehost.contextbuilder=org.jclouds.slicehost.SlicehostContextBuilder
slicehost.propertiesbuilder=org.jclouds.slicehost.SlicehostPropertiesBuilder slicehost.propertiesbuilder=org.jclouds.slicehost.SlicehostPropertiesBuilder
trmk-vcloudexpress.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressContextBuilder trmk-vcloudexpress.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressContextBuilder
trmk-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder trmk-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder
trmk-ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder trmk-ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder
trmk-ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder trmk-ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder
chef.contextbuilder=org.jclouds.chef.ChefContextBuilder chef.contextbuilder=org.jclouds.chef.ChefContextBuilder
chef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder chef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
transientchef.contextbuilder=org.jclouds.chef.test.TransientChefContextBuilder transientchef.contextbuilder=org.jclouds.chef.test.TransientChefContextBuilder
transientchef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder transientchef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder
opscodeplatform.contextbuilder=org.jclouds.opscodeplatform.OpscodePlatformContextBuilder opscodeplatform.contextbuilder=org.jclouds.opscodeplatform.OpscodePlatformContextBuilder
opscodeplatform.propertiesbuilder=org.jclouds.opscodeplatform.OpscodePlatformPropertiesBuilder opscodeplatform.propertiesbuilder=org.jclouds.opscodeplatform.OpscodePlatformPropertiesBuilder
vcloud.contextbuilder=org.jclouds.vcloud.VCloudContextBuilder vcloud.contextbuilder=org.jclouds.vcloud.VCloudContextBuilder
vcloud.propertiesbuilder=org.jclouds.vcloud.VCloudPropertiesBuilder vcloud.propertiesbuilder=org.jclouds.vcloud.VCloudPropertiesBuilder
vcloudexpress.contextbuilder=org.jclouds.vcloud.VCloudExpressContextBuilder vcloudexpress.contextbuilder=org.jclouds.vcloud.VCloudExpressContextBuilder
vcloudexpress.propertiesbuilder=org.jclouds.vcloud.VCloudExpressPropertiesBuilder vcloudexpress.propertiesbuilder=org.jclouds.vcloud.VCloudExpressPropertiesBuilder
eucalyptus.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder eucalyptus.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
eucalyptus.propertiesbuilder=org.jclouds.aws.ec2.EucalyptusPropertiesBuilder eucalyptus.propertiesbuilder=org.jclouds.aws.ec2.EucalyptusPropertiesBuilder
nova.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder nova.contextbuilder=org.jclouds.aws.ec2.EC2ContextBuilder
nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder
cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
ibmdev.propertiesbuilder=org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder ibmdev.propertiesbuilder=org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder
ibmdev.contextbuilder=org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder ibmdev.contextbuilder=org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder
stub.propertiesbuilder=org.jclouds.compute.stub.StubComputeServicePropertiesBuilder stub.propertiesbuilder=org.jclouds.compute.stub.StubComputeServicePropertiesBuilder
stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder
# example of where to change your endpoint # example of where to change your endpoint
# bluelock.endpoint=https://express3.bluelock.com/api # bluelock.endpoint=https://express3.bluelock.com/api
atmosonline.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder atmosonline.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
atmosonline.endpoint=https://accesspoint.atmosonline.com atmosonline.endpoint=https://accesspoint.atmosonline.com
atmosonline.apiversion=1.3.0 atmosonline.apiversion=1.3.0
synaptic.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder synaptic.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder
synaptic.endpoint=https://storage.synaptic.att.com synaptic.endpoint=https://storage.synaptic.att.com
synaptic.apiversion=1.3.0 synaptic.apiversion=1.3.0
# TODO peer1 and hostedsolutions use atmos # TODO peer1 and hostedsolutions use atmos
cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder
cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder
walrus.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder walrus.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
walrus.propertiesbuilder=org.jclouds.aws.s3.WalrusPropertiesBuilder walrus.propertiesbuilder=org.jclouds.aws.s3.WalrusPropertiesBuilder
googlestorage.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder googlestorage.contextbuilder=org.jclouds.aws.s3.S3ContextBuilder
googlestorage.propertiesbuilder=org.jclouds.aws.s3.GoogleStoragePropertiesBuilder googlestorage.propertiesbuilder=org.jclouds.aws.s3.GoogleStoragePropertiesBuilder
transient.contextbuilder=org.jclouds.blobstore.TransientBlobStoreContextBuilder transient.contextbuilder=org.jclouds.blobstore.TransientBlobStoreContextBuilder
transient.propertiesbuilder=org.jclouds.blobstore.TransientBlobStorePropertiesBuilder transient.propertiesbuilder=org.jclouds.blobstore.TransientBlobStorePropertiesBuilder
filesystem.contextbuilder=org.jclouds.filesystem.FilesystemBlobStoreContextBuilder filesystem.contextbuilder=org.jclouds.filesystem.FilesystemBlobStoreContextBuilder
filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertiesBuilder filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertiesBuilder

View File

@ -1,202 +1,202 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.demo.tweetstore.config; package org.jclouds.demo.tweetstore.config;
import static com.google.appengine.api.labs.taskqueue.TaskOptions.Builder.url; import static com.google.appengine.api.labs.taskqueue.TaskOptions.Builder.url;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER; import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.demo.tweetstore.controller.AddTweetsController; import org.jclouds.demo.tweetstore.controller.AddTweetsController;
import org.jclouds.demo.tweetstore.controller.StoreTweetsController; import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses; import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule; import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.ServletConfigAware; import org.springframework.web.context.ServletConfigAware;
import org.springframework.web.servlet.HandlerAdapter; import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.SimpleServletHandlerAdapter; import org.springframework.web.servlet.handler.SimpleServletHandlerAdapter;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import twitter4j.Twitter; import twitter4j.Twitter;
import twitter4j.TwitterFactory; import twitter4j.TwitterFactory;
import com.google.appengine.api.labs.taskqueue.Queue; import com.google.appengine.api.labs.taskqueue.Queue;
import com.google.appengine.api.labs.taskqueue.QueueFactory; import com.google.appengine.api.labs.taskqueue.QueueFactory;
import com.google.appengine.api.labs.taskqueue.TaskOptions.Method; import com.google.appengine.api.labs.taskqueue.TaskOptions.Method;
import com.google.appengine.repackaged.com.google.common.base.Splitter; import com.google.appengine.repackaged.com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.io.Closeables; import com.google.common.io.Closeables;
import com.google.inject.Module; import com.google.inject.Module;
/** /**
* Creates servlets (using resources from the {@link SpringAppConfig}) and mappings. * Creates servlets (using resources from the {@link SpringAppConfig}) and mappings.
* *
* @author Andrew Phillips * @author Andrew Phillips
* @see SpringAppConfig * @see SpringAppConfig
*/ */
@Configuration @Configuration
public class SpringServletConfig extends LoggingConfig implements ServletConfigAware { public class SpringServletConfig extends LoggingConfig implements ServletConfigAware {
public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts"; public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts";
private ServletConfig servletConfig; private ServletConfig servletConfig;
private Map<String, BlobStoreContext> providerTypeToBlobStoreMap; private Map<String, BlobStoreContext> providerTypeToBlobStoreMap;
private Twitter twitterClient; private Twitter twitterClient;
private String container; private String container;
@PostConstruct @PostConstruct
public void initialize() throws IOException { public void initialize() throws IOException {
BlobStoreContextFactory blobStoreContextFactory = new BlobStoreContextFactory(); BlobStoreContextFactory blobStoreContextFactory = new BlobStoreContextFactory();
Properties props = loadJCloudsProperties(); Properties props = loadJCloudsProperties();
logger.trace("About to initialize members."); logger.trace("About to initialize members.");
Module googleModule = new GoogleAppEngineConfigurationModule(); Module googleModule = new GoogleAppEngineConfigurationModule();
Set<Module> modules = ImmutableSet.<Module> of(googleModule); Set<Module> modules = ImmutableSet.<Module> of(googleModule);
// shared across all blobstores and used to retrieve tweets // shared across all blobstores and used to retrieve tweets
try { try {
twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), props twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), props
.getProperty("credential")); .getProperty("credential"));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e); throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e);
} }
// common namespace for storing tweets // common namespace for storing tweets
container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER); container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER);
// instantiate and store references to all blobstores by provider name // instantiate and store references to all blobstores by provider name
providerTypeToBlobStoreMap = Maps.newHashMap(); providerTypeToBlobStoreMap = Maps.newHashMap();
for (String hint : Splitter.on(',').split( for (String hint : Splitter.on(',').split(
checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) { checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) {
providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props)); providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props));
} }
// get a queue for submitting store tweet requests // get a queue for submitting store tweet requests
Queue queue = QueueFactory.getQueue("twitter"); Queue queue = QueueFactory.getQueue("twitter");
// submit a job to store tweets for each configured blobstore // submit a job to store tweets for each configured blobstore
for (String name : providerTypeToBlobStoreMap.keySet()) { for (String name : providerTypeToBlobStoreMap.keySet()) {
queue.add(url("/store/do").header("context", name).method(Method.GET)); queue.add(url("/store/do").header("context", name).method(Method.GET));
} }
logger.trace("Members initialized. Twitter: '%s', container: '%s', provider types: '%s'", twitterClient, logger.trace("Members initialized. Twitter: '%s', container: '%s', provider types: '%s'", twitterClient,
container, providerTypeToBlobStoreMap.keySet()); container, providerTypeToBlobStoreMap.keySet());
} }
private Properties loadJCloudsProperties() { private Properties loadJCloudsProperties() {
logger.trace("About to read properties from '%s'", "/WEB-INF/jclouds.properties"); logger.trace("About to read properties from '%s'", "/WEB-INF/jclouds.properties");
Properties props = new Properties(); Properties props = new Properties();
InputStream input = servletConfig.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties"); InputStream input = servletConfig.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties");
try { try {
props.load(input); props.load(input);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
Closeables.closeQuietly(input); Closeables.closeQuietly(input);
} }
logger.trace("Properties successfully read."); logger.trace("Properties successfully read.");
return props; return props;
} }
@Bean @Bean
public StoreTweetsController storeTweetsController() { public StoreTweetsController storeTweetsController() {
StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap, container, twitterClient); StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap, container, twitterClient);
injectServletConfig(controller); injectServletConfig(controller);
return controller; return controller;
} }
@Bean @Bean
public AddTweetsController addTweetsController() { public AddTweetsController addTweetsController() {
AddTweetsController controller = new AddTweetsController(providerTypeToBlobStoreMap, AddTweetsController controller = new AddTweetsController(providerTypeToBlobStoreMap,
serviceToStoredTweetStatuses()); serviceToStoredTweetStatuses());
injectServletConfig(controller); injectServletConfig(controller);
return controller; return controller;
} }
private void injectServletConfig(Servlet servlet) { private void injectServletConfig(Servlet servlet) {
logger.trace("About to inject servlet config '%s'", servletConfig); logger.trace("About to inject servlet config '%s'", servletConfig);
try { try {
servlet.init(checkNotNull(servletConfig)); servlet.init(checkNotNull(servletConfig));
} catch (ServletException exception) { } catch (ServletException exception) {
throw new BeanCreationException("Unable to instantiate " + servlet, exception); throw new BeanCreationException("Unable to instantiate " + servlet, exception);
} }
logger.trace("Successfully injected servlet config."); logger.trace("Successfully injected servlet config.");
} }
@Bean @Bean
ServiceToStoredTweetStatuses serviceToStoredTweetStatuses() { ServiceToStoredTweetStatuses serviceToStoredTweetStatuses() {
return new ServiceToStoredTweetStatuses(providerTypeToBlobStoreMap, container); return new ServiceToStoredTweetStatuses(providerTypeToBlobStoreMap, container);
} }
@Bean @Bean
public HandlerMapping handlerMapping() { public HandlerMapping handlerMapping() {
SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
Map<String, Object> urlMap = Maps.newHashMapWithExpectedSize(2); Map<String, Object> urlMap = Maps.newHashMapWithExpectedSize(2);
urlMap.put("/store/*", storeTweetsController()); urlMap.put("/store/*", storeTweetsController());
urlMap.put("/tweets/*", addTweetsController()); urlMap.put("/tweets/*", addTweetsController());
mapping.setUrlMap(urlMap); mapping.setUrlMap(urlMap);
/* /*
* "/store" and "/tweets" are part of the servlet mapping and thus stripped by the mapping if * "/store" and "/tweets" are part of the servlet mapping and thus stripped by the mapping if
* using default settings. * using default settings.
*/ */
mapping.setAlwaysUseFullPath(true); mapping.setAlwaysUseFullPath(true);
return mapping; return mapping;
} }
@Bean @Bean
public HandlerAdapter servletHandlerAdapter() { public HandlerAdapter servletHandlerAdapter() {
return new SimpleServletHandlerAdapter(); return new SimpleServletHandlerAdapter();
} }
@PreDestroy @PreDestroy
public void destroy() throws Exception { public void destroy() throws Exception {
logger.trace("About to close contexts."); logger.trace("About to close contexts.");
for (BlobStoreContext context : providerTypeToBlobStoreMap.values()) { for (BlobStoreContext context : providerTypeToBlobStoreMap.values()) {
context.close(); context.close();
} }
logger.trace("Contexts closed."); logger.trace("Contexts closed.");
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* org.springframework.web.context.ServletConfigAware#setServletConfig(javax.servlet.ServletConfig * org.springframework.web.context.ServletConfigAware#setServletConfig(javax.servlet.ServletConfig
* ) * )
*/ */
@Override @Override
public void setServletConfig(ServletConfig servletConfig) { public void setServletConfig(ServletConfig servletConfig) {
this.servletConfig = servletConfig; this.servletConfig = servletConfig;
} }
} }

View File

@ -1,129 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== ====================================================================
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId> <artifactId>jclouds-project</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<relativePath>../project/pom.xml</relativePath> <relativePath>../project/pom.xml</relativePath>
</parent> </parent>
<artifactId>jclouds-rimuhosting</artifactId> <artifactId>jclouds-rimuhosting</artifactId>
<name>jclouds RimuHosting core</name> <name>jclouds RimuHosting core</name>
<description>jclouds components to access RimuHosting</description> <description>jclouds components to access RimuHosting</description>
<scm> <scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/rimuhosting</connection> <connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/rimuhosting</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/rimuhosting</developerConnection> <developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/rimuhosting</developerConnection>
<url>http://jclouds.googlecode.com/svn/trunk/rimuhosting</url> <url>http://jclouds.googlecode.com/svn/trunk/rimuhosting</url>
</scm> </scm>
<properties> <properties>
<!-- when instances are hung, open a ticket and add here --> <!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes> <jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.rimuhosting.endpoint>https://rimuhosting.com/r</test.rimuhosting.endpoint> <test.rimuhosting.endpoint>https://rimuhosting.com/r</test.rimuhosting.endpoint>
<test.rimuhosting.apiversion>1.0</test.rimuhosting.apiversion> <test.rimuhosting.apiversion>1.0</test.rimuhosting.apiversion>
<test.rimuhosting.identity>FIXME</test.rimuhosting.identity> <test.rimuhosting.identity>FIXME</test.rimuhosting.identity>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-jsch</artifactId> <artifactId>jclouds-jsch</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-core</artifactId> <artifactId>jclouds-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-compute</artifactId> <artifactId>jclouds-compute</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-compute</artifactId> <artifactId>jclouds-compute</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.14</version> <version>1.2.14</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-log4j</artifactId> <artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles> <profiles>
<profile> <profile>
<id>live</id> <id>live</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>integration</id> <id>integration</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>test</goal> <goal>test</goal>
</goals> </goals>
<configuration> <configuration>
<systemProperties> <systemProperties>
<property> <property>
<name>test.rimuhosting.endpoint</name> <name>test.rimuhosting.endpoint</name>
<value>${test.rimuhosting.endpoint}</value> <value>${test.rimuhosting.endpoint}</value>
</property> </property>
<property> <property>
<name>test.rimuhosting.apiversion</name> <name>test.rimuhosting.apiversion</name>
<value>${test.rimuhosting.apiversion}</value> <value>${test.rimuhosting.apiversion}</value>
</property> </property>
<property> <property>
<name>test.rimuhosting.identity</name> <name>test.rimuhosting.identity</name>
<value>${test.rimuhosting.identity}</value> <value>${test.rimuhosting.identity}</value>
</property> </property>
<property> <property>
<name>jclouds.compute.blacklist.nodes</name> <name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value> <value>${jclouds.compute.blacklist.nodes}</value>
</property> </property>
</systemProperties> </systemProperties>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
</profiles> </profiles>
</project> </project>

View File

@ -1,39 +1,39 @@
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== ====================================================================
--> -->
<project name="test-copy" default="copy" basedir="."> <project name="test-copy" default="copy" basedir=".">
<!-- Note you need to have a copy of jclouds-vfs-1.0-beta-3-jar-with-dependencies.jar in an ant lib directory <!-- Note you need to have a copy of jclouds-vfs-1.0-beta-3-jar-with-dependencies.jar in an ant lib directory
Due to weird classloading issues, vfs will not work dynamically loaded --> Due to weird classloading issues, vfs will not work dynamically loaded -->
<taskdef resource="org/apache/commons/vfs/tasks/tasks.properties" /> <taskdef resource="org/apache/commons/vfs/tasks/tasks.properties" />
<property name="jclouds.blobstore.url" value="blobstore://${jclouds.blobstore.account}:${jclouds.blobstore.key}@${jclouds.blobstore.provider}" /> <property name="jclouds.blobstore.url" value="blobstore://${jclouds.blobstore.account}:${jclouds.blobstore.key}@${jclouds.blobstore.provider}" />
<property name="jclouds.blobstore.container" value="jclouds-demo" /> <property name="jclouds.blobstore.container" value="jclouds-demo" />
<target name="copy"> <target name="copy">
<v-copy <v-copy
destdir="${jclouds.blobstore.url}/${jclouds.blobstore.container}" destdir="${jclouds.blobstore.url}/${jclouds.blobstore.container}"
src="http://mirror.cc.columbia.edu/pub/software/apache/maven/binaries/apache-maven-2.2.1-bin.zip" src="http://mirror.cc.columbia.edu/pub/software/apache/maven/binaries/apache-maven-2.2.1-bin.zip"
overwrite="true" overwrite="true"
preservelastmodified="false"/> preservelastmodified="false"/>
</target> </target>
</project> </project>

View File

@ -1,4 +1,4 @@
del c:\etc\chef\client.rb 2>NUL del c:\etc\chef\client.rb 2>NUL
echo log_level :info>>c:\etc\chef\client.rb echo log_level :info>>c:\etc\chef\client.rb
echo log_location STDOUT>>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 chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb

View File

@ -1,134 +1,134 @@
@echo off @echo off
set PATH= set PATH=
set JAVA_HOME= set JAVA_HOME=
set PATH= set PATH=
GOTO FUNCTION_END GOTO FUNCTION_END
:abort :abort
echo aborting: %EXCEPTION% echo aborting: %EXCEPTION%
exit /b 1 exit /b 1
:default :default
set INSTANCE_NAME=mkebsboot set INSTANCE_NAME=mkebsboot
set INSTANCE_HOME=/mnt/tmp set INSTANCE_HOME=/mnt/tmp
set LOG_DIR=/mnt/tmp set LOG_DIR=/mnt/tmp
exit /b 0 exit /b 0
:mkebsboot :mkebsboot
set TMP_DIR=/mnt/tmp set TMP_DIR=/mnt/tmp
exit /b 0 exit /b 0
:findPid :findPid
set FOUND_PID= set FOUND_PID=
set _expression=%1 set _expression=%1
shift shift
set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO ( FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
SET FOUND_PID=%%A SET FOUND_PID=%%A
) )
if defined FOUND_PID ( if defined FOUND_PID (
exit /b 0 exit /b 0
) else ( ) else (
set EXCEPTION=%_expression% not found set EXCEPTION=%_expression% not found
exit /b 1 exit /b 1
) )
:forget :forget
SETLOCAL SETLOCAL
set FOUND_PID= set FOUND_PID=
set NEXT_MINUTE= set NEXT_MINUTE=
set INSTANCE_NAME=%1 set INSTANCE_NAME=%1
shift shift
set SCRIPT=%1 set SCRIPT=%1
shift shift
set LOG_DIR=%1 set LOG_DIR=%1
shift shift
CALL :findProcess %INSTANCE_NAME% CALL :findProcess %INSTANCE_NAME%
if defined FOUND_PID ( if defined FOUND_PID (
echo %INSTANCE_NAME% already running pid [%FOUND_PID%] echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
) else ( ) else (
CALL :nextMinute CALL :nextMinute
set _DATE=%DATE:~4% 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% 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% echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
set SECONDS=%TIME:~6,2% set SECONDS=%TIME:~6,2%
set /a SECOND=60-SECONDS set /a SECOND=60-SECONDS
%CMD% >NUL %CMD% >NUL
ping -n %SECONDS% 127.0.0.1 > NUL 2>&1 ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
CALL :findProcess %INSTANCE_NAME% CALL :findProcess %INSTANCE_NAME%
if not defined FOUND_PID ( if not defined FOUND_PID (
set EXCEPTION=%INSTANCE_NAME% did not start set EXCEPTION=%INSTANCE_NAME% did not start
abort abort
) )
) )
exit /b 0 exit /b 0
:FUNCTION_END :FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem 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" ( 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 set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
goto abort goto abort
) )
goto CASE_%1 goto CASE_%1
:CASE_init :CASE_init
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
call :mkebsboot call :mkebsboot
if errorlevel 1 goto abort if errorlevel 1 goto abort
md %INSTANCE_HOME% md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%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 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 INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%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_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%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 set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
md %INSTANCE_HOME% md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%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 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 INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%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_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%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 set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
GOTO END_SWITCH GOTO END_SWITCH
:CASE_status :CASE_status
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME% call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort if errorlevel 1 goto abort
echo [%FOUND_PID%] echo [%FOUND_PID%]
GOTO END_SWITCH GOTO END_SWITCH
:CASE_stop :CASE_stop
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME% call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort if errorlevel 1 goto abort
if defined FOUND_PID ( if defined FOUND_PID (
TASKKILL /F /T /PID %FOUND_PID% >NUL TASKKILL /F /T /PID %FOUND_PID% >NUL
) )
GOTO END_SWITCH GOTO END_SWITCH
:CASE_start :CASE_start
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR% call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
if errorlevel 1 goto abort if errorlevel 1 goto abort
GOTO END_SWITCH GOTO END_SWITCH
:CASE_tail :CASE_tail
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
tail %LOG_DIR%\stdout.log tail %LOG_DIR%\stdout.log
GOTO END_SWITCH GOTO END_SWITCH
:CASE_tailerr :CASE_tailerr
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
tail %LOG_DIR%\stderr.log tail %LOG_DIR%\stderr.log
GOTO END_SWITCH GOTO END_SWITCH
:CASE_run :CASE_run
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
%INSTANCE_HOME%\%INSTANCE_NAME%.cmd %INSTANCE_HOME%\%INSTANCE_NAME%.cmd
GOTO END_SWITCH GOTO END_SWITCH
:END_SWITCH :END_SWITCH
exit /b 0 exit /b 0

View File

@ -1,17 +1,17 @@
md %TEMP%\%USERNAME%\scripttest md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%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 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 INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%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 cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
md %TEMP%\%USERNAME%\scripttest md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%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 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 INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%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 cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd

View File

@ -1,36 +1,36 @@
@echo off @echo off
set PATH= set PATH=
set JAVA_HOME= set JAVA_HOME=
set PATH= set PATH=
set RUNTIME= set RUNTIME=
GOTO FUNCTION_END GOTO FUNCTION_END
:abort :abort
echo aborting: %EXCEPTION% echo aborting: %EXCEPTION%
exit /b 1 exit /b 1
:default :default
set RUNTIME=Moo set RUNTIME=Moo
exit /b 0 exit /b 0
:FUNCTION_END :FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" ( if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
set EXCEPTION=bad argument: %1 not in start stop status set EXCEPTION=bad argument: %1 not in start stop status
goto abort goto abort
) )
goto CASE_%1 goto CASE_%1
:CASE_start :CASE_start
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
echo start %RUNTIME% echo start %RUNTIME%
GOTO END_SWITCH GOTO END_SWITCH
:CASE_stop :CASE_stop
call :default call :default
if errorlevel 1 goto abort if errorlevel 1 goto abort
echo stop %RUNTIME% echo stop %RUNTIME%
GOTO END_SWITCH GOTO END_SWITCH
:CASE_status :CASE_status
del %TEMP%\%USERNAME%\scripttest\temp.txt 2>NUL del %TEMP%\%USERNAME%\scripttest\temp.txt 2>NUL
echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
echo the following should be []: [%RUNTIME%] echo the following should be []: [%RUNTIME%]
GOTO END_SWITCH GOTO END_SWITCH
:END_SWITCH :END_SWITCH
exit /b 0 exit /b 0

View File

@ -1,192 +1,192 @@
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== ====================================================================
--> -->
<project name="compute" default="dump" basedir="." xmlns:artifact="urn:maven-artifact-ant"> <project name="compute" default="dump" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property file="build.properties" /> <property file="build.properties" />
<property name="jclouds.version" value="1.0-SNAPSHOT" /> <property name="jclouds.version" value="1.0-SNAPSHOT" />
<property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" /> <property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" />
<property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" /> <property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" />
<mkdir dir="build" /> <mkdir dir="build" />
<get src="http://opensource.become.com/apache//maven/binaries/maven-ant-tasks-2.1.1.jar" dest="build/maven-ant-tasks.jar"/> <get src="http://opensource.become.com/apache//maven/binaries/maven-ant-tasks-2.1.1.jar" dest="build/maven-ant-tasks.jar"/>
<input <input
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?" message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vcdirector,gogrid,rimuhosting" validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vcdirector,gogrid,rimuhosting"
addproperty="provider" addproperty="provider"
/> />
<input <input
message="Which driver does ${provider} use?" message="Which driver does ${provider} use?"
validargs="aws,rackspace,vcloud,bluelock,gogrid,terremark,ibmdev,rimuhosting" validargs="aws,rackspace,vcloud,bluelock,gogrid,terremark,ibmdev,rimuhosting"
addproperty="driver" addproperty="driver"
/> />
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks.jar" /> <path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" /> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" /> <artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
<artifact:remoteRepository id="jclouds.repository" url="http://jclouds.googlecode.com/svn/repo" /> <artifact:remoteRepository id="jclouds.repository" url="http://jclouds.googlecode.com/svn/repo" />
<artifact:remoteRepository id="jclouds-snapshot.repository" url="https://oss.sonatype.org/content/repositories/snapshots" /> <artifact:remoteRepository id="jclouds-snapshot.repository" url="https://oss.sonatype.org/content/repositories/snapshots" />
<artifact:dependencies pathId="jclouds.classpath"> <artifact:dependencies pathId="jclouds.classpath">
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="${jclouds.version}" /> <dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="${jclouds.version}" />
<dependency groupId="org.jclouds" artifactId="jclouds-${driver}" version="${jclouds.version}" /> <dependency groupId="org.jclouds" artifactId="jclouds-${driver}" version="${jclouds.version}" />
<localRepository refid="local.repository" /> <localRepository refid="local.repository" />
<remoteRepository refid="jclouds.repository" /> <remoteRepository refid="jclouds.repository" />
<remoteRepository refid="jclouds-snapshot.repository" /> <remoteRepository refid="jclouds-snapshot.repository" />
</artifact:dependencies> </artifact:dependencies>
<typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" /> <typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" />
<input <input
message="What is your identity on ${provider}?" message="What is your identity on ${provider}?"
addproperty="identity" addproperty="identity"
/> />
<input <input
message="What is the credential for ${identity}?" message="What is the credential for ${identity}?"
addproperty="credential" addproperty="credential"
/> />
<property name="jclouds.compute.url" value="compute://${identity}:${credential}@${provider}" /> <property name="jclouds.compute.url" value="compute://${identity}:${credential}@${provider}" />
<target name="list" description="list the identity of all nodes"> <target name="list" description="list the identity of all nodes">
<compute actions="list" provider="${jclouds.compute.url}" /> <compute actions="list" provider="${jclouds.compute.url}" />
</target> </target>
<target name="list-details" description="list the details of all nodes"> <target name="list-details" description="list the details of all nodes">
<compute actions="list-details" provider="${jclouds.compute.url}" /> <compute actions="list-details" provider="${jclouds.compute.url}" />
</target> </target>
<target name="list-images" description="list the images supported"> <target name="list-images" description="list the images supported">
<compute actions="list-images" provider="${jclouds.compute.url}" /> <compute actions="list-images" provider="${jclouds.compute.url}" />
</target> </target>
<target name="list-hardwares" description="list the hardwares supported"> <target name="list-hardwares" description="list the hardwares supported">
<compute actions="list-hardwares" provider="${jclouds.compute.url}" /> <compute actions="list-hardwares" provider="${jclouds.compute.url}" />
</target> </target>
<target name="list-locations" description="list the locations supported"> <target name="list-locations" description="list the locations supported">
<compute actions="list-locations" provider="${jclouds.compute.url}" /> <compute actions="list-locations" provider="${jclouds.compute.url}" />
</target> </target>
<target name="dump" description="list all information we can obtain about the cloud"> <target name="dump" description="list all information we can obtain about the cloud">
<compute actions="list-locations,list-hardwares,list-images,list-details" provider="${jclouds.compute.url}" /> <compute actions="list-locations,list-hardwares,list-images,list-details" provider="${jclouds.compute.url}" />
</target> </target>
<target name="reboot" depends="reboot-id,reboot-tag" /> <target name="reboot" depends="reboot-id,reboot-tag" />
<target name="reboot-id" description="reboot the node ${id}" unless="tag"> <target name="reboot-id" description="reboot the node ${id}" unless="tag">
<input <input
message="Which node do you wish to reboot" message="Which node do you wish to reboot"
addproperty="id" addproperty="id"
/> />
<compute actions="reboot" provider="${jclouds.compute.url}"> <compute actions="reboot" provider="${jclouds.compute.url}">
<nodes id="${id}" /> <nodes id="${id}" />
</compute> </compute>
</target> </target>
<target name="reboot-tag" description="reboot the nodes with tag ${tag}" unless="id" > <target name="reboot-tag" description="reboot the nodes with tag ${tag}" unless="id" >
<input <input
message="Which tag do you wish to reboot" message="Which tag do you wish to reboot"
addproperty="tag" addproperty="tag"
/> />
<compute actions="reboot" provider="${jclouds.compute.url}"> <compute actions="reboot" provider="${jclouds.compute.url}">
<nodes tag="${tag}" /> <nodes tag="${tag}" />
</compute> </compute>
</target> </target>
<target name="destroy" depends="destroy-id,destroy-tag" /> <target name="destroy" depends="destroy-id,destroy-tag" />
<target name="destroy-id" description="destroy the node ${id}" unless="tag"> <target name="destroy-id" description="destroy the node ${id}" unless="tag">
<input <input
message="Which node do you wish to destroy" message="Which node do you wish to destroy"
addproperty="id" addproperty="id"
/> />
<compute actions="destroy" provider="${jclouds.compute.url}"> <compute actions="destroy" provider="${jclouds.compute.url}">
<nodes id="${id}" /> <nodes id="${id}" />
</compute> </compute>
</target> </target>
<target name="destroy-tag" description="destroy the nodes with tag ${tag}" unless="id" > <target name="destroy-tag" description="destroy the nodes with tag ${tag}" unless="id" >
<input <input
message="Which tag do you wish to destroy" message="Which tag do you wish to destroy"
addproperty="tag" addproperty="tag"
/> />
<compute actions="destroy" provider="${jclouds.compute.url}"> <compute actions="destroy" provider="${jclouds.compute.url}">
<nodes tag="${tag}" /> <nodes tag="${tag}" />
</compute> </compute>
</target> </target>
<target name="get" depends="get-tag,get-id" /> <target name="get" depends="get-tag,get-id" />
<target name="get-id" description="get the node ${id}" unless="tag"> <target name="get-id" description="get the node ${id}" unless="tag">
<input <input
message="Which node do you wish to get" message="Which node do you wish to get"
addproperty="id" addproperty="id"
/> />
<compute actions="get" provider="${jclouds.compute.url}"> <compute actions="get" provider="${jclouds.compute.url}">
<nodes id="${id}" /> <nodes id="${id}" />
</compute> </compute>
</target> </target>
<target name="get-tag" description="get the nodes with tag ${tag}" unless="id" > <target name="get-tag" description="get the nodes with tag ${tag}" unless="id" >
<input <input
message="Which tag do you wish to get" message="Which tag do you wish to get"
addproperty="tag" addproperty="tag"
/> />
<compute actions="get" provider="${jclouds.compute.url}"> <compute actions="get" provider="${jclouds.compute.url}">
<nodes tag="${tag}" /> <nodes tag="${tag}" />
</compute> </compute>
</target> </target>
<property name="location" value="" /> <property name="location" value="" />
<target name="create" description="create the node ${tag}"> <target name="create" description="create the node ${tag}">
<property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" /> <property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" />
<property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" /> <property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" />
<property name="os" value="UBUNTU" /> <property name="os" value="UBUNTU" />
<property name="count" value="1" /> <property name="count" value="1" />
<input <input
message="What do you want to tag your nodes with?" message="What do you want to tag your nodes with?"
addproperty="tag" addproperty="tag"
/> />
<compute actions="create" provider="${jclouds.compute.url}"> <compute actions="create" provider="${jclouds.compute.url}">
<nodes privatekeyfile="${privatekeyfile}" publickeyfile="${publickeyfile}" tag="${tag}" count="${count}" os="${os}" hardware="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" /> <nodes privatekeyfile="${privatekeyfile}" publickeyfile="${publickeyfile}" tag="${tag}" count="${count}" os="${os}" hardware="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
</compute> </compute>
</target> </target>
</project> </project>