Skip to content

Commit

Permalink
Merge pull request #7 from msimonin/master
Browse files Browse the repository at this point in the history
fix checkstyle.
  • Loading branch information
msimonin committed Nov 22, 2013
2 parents d1403ac + c3b1175 commit 2395dee
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 47 deletions.
32 changes: 17 additions & 15 deletions src/main/java/org/inria/myriads/snoozeec2/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@ public static void main(String[] args)
}

LoggerUtils.configureLogger(logFile);
EC2Configuration EC2Configuration = null;
EC2Instances EC2Instances = null;
EC2Configuration ec2Configuration = null;
EC2Instances ec2Instances = null;
try
{
EC2Configurator imageServiceConfigurator =
EC2ConfiguratorFactory.newNodeConfigurator(configurationFile);
EC2Configuration = imageServiceConfigurator.getImageServiceConfiguration();
ec2Configuration = imageServiceConfigurator.getImageServiceConfiguration();


EC2InstancesGenerator instancesGenerator =
EC2InstancesGeneratorFactory.newInstancesGenerator(instancesFile);

EC2Instances = instancesGenerator.generate();
ec2Instances = instancesGenerator.generate();

startNode(EC2Configuration, EC2Instances);
startNode(ec2Configuration, ec2Instances);
}
catch (EC2ConfiguratorException exception)
{
Expand Down Expand Up @@ -140,29 +140,31 @@ private static void initializeRESTletComponent(Component component,
component.getServers().add(jettyServer);
}

/**
* Main routine to start the node.
*
* @param EC2Configuration The node configuration
* @param eC2Instances
* @throws Exception

/**
*
* Main routine to start the ec2 service.
*
* @param ec2Configuration EC2 Configuration
* @param ec2Instances EC2 instances file
* @throws Exception Exception
*/
private static void startNode(EC2Configuration EC2Configuration, EC2Instances ec2Instances)
private static void startNode(EC2Configuration ec2Configuration, EC2Instances ec2Instances)
throws Exception
{
Guard.check(EC2Configuration);
Guard.check(ec2Configuration);
log_.debug("Starting the node initialization");

Component component = new Component();
Context context = component.getContext().createChildContext();
initializeRESTletComponent(component, context, EC2Configuration);
initializeRESTletComponent(component, context, ec2Configuration);

Application application = null;

log_.debug("Starting the ec2 API");
application = new EC2Application(context);
attachApplication(component, application);
SnoozeEC2Backend backend = new SnoozeEC2Backend(EC2Configuration, ec2Instances);
SnoozeEC2Backend backend = new SnoozeEC2Backend(ec2Configuration, ec2Instances);
context.getAttributes().put("backend", backend);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public class SnoozeEC2Backend
private static final Logger log_ = LoggerFactory.getLogger(SnoozeEC2Backend.class);

/** Image repository settings. */
private EC2Configuration EC2Configuration_;
private EC2Configuration ec2Configuration_;

/** Instances.*/
private EC2Instances EC2Instances_;
private EC2Instances ec2Instances_;

/**
*
Expand All @@ -57,8 +57,8 @@ public class SnoozeEC2Backend
*/
public SnoozeEC2Backend(EC2Configuration imageServiceConfiguration, EC2Instances ec2Instances)
{
EC2Configuration_ = imageServiceConfiguration;
EC2Instances_ = ec2Instances;
ec2Configuration_ = imageServiceConfiguration;
ec2Instances_ = ec2Instances;
}

/**
Expand All @@ -70,7 +70,7 @@ public SnoozeEC2Backend(EC2Configuration imageServiceConfiguration, EC2Instances
public List<VirtualMachineMetaData> describeInstances()
{
log_.debug("Describe instances");
NetworkAddress bootstrapAddress = EC2Configuration_.getBootstrapSettings();
NetworkAddress bootstrapAddress = ec2Configuration_.getBootstrapSettings();
BootstrapAPI bootstrapCommunicator =
org.inria.myriads.snoozecommon.communication.rest.CommunicatorFactory
.newBootstrapCommunicator(bootstrapAddress);
Expand All @@ -91,7 +91,7 @@ public List<VirtualMachineMetaData> describeInstances()
public ArrayList<VirtualMachineImage> describeImages()
{
log_.debug("Getting the images from the image repository");
NetworkAddress imageRepositoryAddress = EC2Configuration_.getImageRepositorySettings();
NetworkAddress imageRepositoryAddress = ec2Configuration_.getImageRepositorySettings();

ImagesRepositoryAPI imagesRepositoryCommunicator =
org.inria.myriads.snoozeimages.communication.rest.CommunicatorFactory
Expand All @@ -118,7 +118,7 @@ public ArrayList<VirtualMachineImage> describeImages()
public String runInstances(VirtualClusterSubmissionRequest submissionRequest)
{
log_.debug("Starting instances");
NetworkAddress bootstrapAddress = EC2Configuration_.getBootstrapSettings();
NetworkAddress bootstrapAddress = ec2Configuration_.getBootstrapSettings();
BootstrapAPI bootstrapCommunicator =
org.inria.myriads.snoozecommon.communication.rest.CommunicatorFactory
.newBootstrapCommunicator(bootstrapAddress);
Expand All @@ -131,31 +131,31 @@ public String runInstances(VirtualClusterSubmissionRequest submissionRequest)
*/
public EC2Configuration getEC2Configuration()
{
return EC2Configuration_;
return ec2Configuration_;
}

/**
* @param eC2Configuration the eC2Configuration to set
*/
public void setEC2Configuration(EC2Configuration eC2Configuration)
{
EC2Configuration_ = eC2Configuration;
ec2Configuration_ = eC2Configuration;
}

/**
* @return the eC2Instances
*/
public EC2Instances getEC2Instances()
{
return EC2Instances_;
return ec2Instances_;
}

/**
* @param eC2Instances the eC2Instances to set
*/
public void setEC2Instances(EC2Instances eC2Instances)
{
EC2Instances_ = eC2Instances;
ec2Instances_ = eC2Instances;
}

/**
Expand All @@ -168,7 +168,7 @@ public void setEC2Instances(EC2Instances eC2Instances)
public boolean rebootInstances(List<String> listInstances)
{
log_.debug("Rebooting instances");
NetworkAddress bootstrapAddress = EC2Configuration_.getBootstrapSettings();
NetworkAddress bootstrapAddress = ec2Configuration_.getBootstrapSettings();
BootstrapAPI bootstrapCommunicator =
org.inria.myriads.snoozecommon.communication.rest.CommunicatorFactory
.newBootstrapCommunicator(bootstrapAddress);
Expand All @@ -191,7 +191,7 @@ public boolean rebootInstances(List<String> listInstances)
public InstanceStateChangeSetType terminateInstances(List<String> listInstances)
{
log_.debug("Terminating instances");
NetworkAddress bootstrapAddress = EC2Configuration_.getBootstrapSettings();
NetworkAddress bootstrapAddress = ec2Configuration_.getBootstrapSettings();
BootstrapAPI bootstrapCommunicator =
org.inria.myriads.snoozecommon.communication.rest.CommunicatorFactory
.newBootstrapCommunicator(bootstrapAddress);
Expand Down Expand Up @@ -247,7 +247,7 @@ public int getPollingInterval()
public VirtualClusterSubmissionResponse getVirtualClusterResponse(String taskIdentifier)
{
log_.debug("Describe instances");
NetworkAddress bootstrapAddress = EC2Configuration_.getBootstrapSettings();
NetworkAddress bootstrapAddress = ec2Configuration_.getBootstrapSettings();
BootstrapAPI bootstrapCommunicator =
org.inria.myriads.snoozecommon.communication.rest.CommunicatorFactory
.newBootstrapCommunicator(bootstrapAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.Serializable;

import org.inria.myriads.snoozecommon.communication.NetworkAddress;
import org.inria.myriads.snoozeec2.configurator.networking.NetworkingSettings;



Expand All @@ -40,10 +39,10 @@ public class EC2Configuration
/** Networking settings.*/
private NetworkAddress networkingSettings_;

/** Image repository address */;
/** Image repository address. */;
private NetworkAddress imageRepositorySettings_;

/** bootstrap repository address */;
/** bootstrap repository address. */;
private NetworkAddress bootstrapSettings_;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.inria.myriads.snoozecommon.util.NetworkUtils;
import org.inria.myriads.snoozeec2.configurator.api.EC2Configuration;
import org.inria.myriads.snoozeec2.configurator.api.EC2Configurator;
import org.inria.myriads.snoozeec2.configurator.networking.NetworkingSettings;
import org.inria.myriads.snoozeec2.exception.EC2ConfiguratorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -51,7 +50,7 @@ public final class JavaPropertyEC2Configurator
private static final Logger log_ = LoggerFactory.getLogger(JavaPropertyEC2Configurator.class);

/** NodeParams. */
private EC2Configuration EC2Configuration_;
private EC2Configuration ec2Configuration_;

/** Properties. */
private Properties properties_;
Expand All @@ -67,7 +66,7 @@ public JavaPropertyEC2Configurator(String configurationFile)
throws EC2ConfiguratorException, IOException
{
Guard.check(configurationFile);
EC2Configuration_ = new EC2Configuration();
ec2Configuration_ = new EC2Configuration();

properties_ = new Properties();
FileInputStream fileInput = new FileInputStream(configurationFile);
Expand All @@ -93,7 +92,7 @@ private void setContextPath() throws EC2ConfiguratorException
String contextPath = properties_.getProperty("config.ec2.package.contextpath");
if (!StringUtils.isBlank(contextPath))
{
EC2Configuration_.setContextPath(contextPath);
ec2Configuration_.setContextPath(contextPath);
}
else
{
Expand Down Expand Up @@ -130,7 +129,7 @@ private void setBootstrapSettings() throws EC2ConfiguratorException
int controlDataPort = Integer.valueOf(getProperty("bootstrap.port"));
NetworkAddress controlDataAddress =
NetworkUtils.createNetworkAddress(listenAddress, controlDataPort);
EC2Configuration_.setBootstrapSettings(controlDataAddress);
ec2Configuration_.setBootstrapSettings(controlDataAddress);
log_.debug("bootstrap setting set");
}
catch (Exception exception)
Expand Down Expand Up @@ -164,9 +163,9 @@ private void setImageRepositorySettings() throws EC2ConfiguratorException
int controlDataPort = Integer.valueOf(getProperty("imageRepository.port"));
NetworkAddress controlDataAddress =
NetworkUtils.createNetworkAddress(listenAddress, controlDataPort);
EC2Configuration_.setImageRepositorySettings(controlDataAddress);
ec2Configuration_.setImageRepositorySettings(controlDataAddress);
}
catch( Exception exception)
catch (Exception exception)
{
log_.debug("Unable to set the image reposirory settings : " + exception.getMessage());
throw new EC2ConfiguratorException(exception.getMessage());
Expand All @@ -179,7 +178,7 @@ private void setImageRepositorySettings() throws EC2ConfiguratorException
@Override
public EC2Configuration getImageServiceConfiguration()
{
return EC2Configuration_;
return ec2Configuration_;
}

/**
Expand All @@ -205,7 +204,7 @@ private void setNetworkingSettings()
int controlDataPort = Integer.valueOf(getProperty("network.listen.port"));
NetworkAddress controlDataAddress =
NetworkUtils.createNetworkAddress(listenAddress, controlDataPort);
EC2Configuration_.setNetworkingSettings(controlDataAddress);
ec2Configuration_.setNetworkingSettings(controlDataAddress);
}
catch (Exception exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;







/**
*
* Snooze EC2 resource.
*
* @author msimonin
*
*/
Expand Down

0 comments on commit 2395dee

Please sign in to comment.