You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/10/01 20:35:22 UTC
svn commit: r1392503 [1/2] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-api/src/main/java/org/apache/ambari/api/controller/internal/
ambari-api/src/test/java/webserver/
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ ambari...
Author: hitesh
Date: Mon Oct 1 18:35:19 2012
New Revision: 1392503
URL: http://svn.apache.org/viewvc?rev=1392503&view=rev
Log:
AMBARI-780. Make FSM related changes for heartbeat handler. (Contributed by hitesh)
Added:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java (with props)
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-api/src/main/java/org/apache/ambari/api/controller/internal/ResourceProviderImpl.java
incubator/ambari/branches/AMBARI-666/ambari-api/src/test/java/webserver/StartServer.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBInMemoryImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostAction.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ActionQueue.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentCommand.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandReport.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ComponentStatus.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/Register.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationCommand.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/StatusCommand.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/rest/AgentResource.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/BootStrapResource.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/HealthCheck.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatus.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapStatus.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/FifoLinkedHashMap.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SecurityFilter.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SignCertResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateDownload.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateSign.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Clusters.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostStatusUpdatesReceivedEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHost.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyList.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMap.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyVal.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/security/CertGenerationTest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/TestClusterImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/TestClustersImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/host/TestHostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostImpl.java
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Mon Oct 1 18:35:19 2012
@@ -182,6 +182,8 @@ AMBARI-666 branch (unreleased changes)
BUG FIXES
+ AMBARI-780. Make FSM related changes for heartbeat handler. (hitesh)
+
AMBARI-774. Renable and fix AgentResourceTest. (mahadev)
AMBARI-773. Change Host FSM as per new requirements of heartbeat handler. (hitesh)
Modified: incubator/ambari/branches/AMBARI-666/ambari-api/src/main/java/org/apache/ambari/api/controller/internal/ResourceProviderImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-api/src/main/java/org/apache/ambari/api/controller/internal/ResourceProviderImpl.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-api/src/main/java/org/apache/ambari/api/controller/internal/ResourceProviderImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-api/src/main/java/org/apache/ambari/api/controller/internal/ResourceProviderImpl.java Mon Oct 1 18:35:19 2012
@@ -51,7 +51,7 @@ public abstract class ResourceProviderIm
}
public static ResourceProvider getResourceProvider(Resource.Type type, Set<PropertyId> propertyIds, ManagementController managementController) {
-
+
switch (type) {
case Cluster:
return new ClusterResourceProvider(propertyIds, managementController);
Modified: incubator/ambari/branches/AMBARI-666/ambari-api/src/test/java/webserver/StartServer.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-api/src/test/java/webserver/StartServer.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-api/src/test/java/webserver/StartServer.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-api/src/test/java/webserver/StartServer.java Mon Oct 1 18:35:19 2012
@@ -79,4 +79,4 @@ public class StartServer {
System.err.println("Usage: java StartServer [-p portNum] [-d abs path to ambari db file]");
System.err.println("Default Values: portNum=9998, ambariDb=/var/db/hmc/data/data.db");
}
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java Mon Oct 1 18:35:19 2012
@@ -55,4 +55,4 @@ public interface ActionDBAccessor {
public void persistActions(List<Stage> stages);
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java Mon Oct 1 18:35:19 2012
@@ -22,13 +22,13 @@ import java.util.List;
import org.apache.ambari.server.Role;
public class ActionDBAccessorImpl implements ActionDBAccessor {
-
+
private long stageId = 0;
-
+
public ActionDBAccessorImpl() {
//this.stageId = greatest stage id in the database + 1
}
-
+
/* (non-Javadoc)
* @see org.apache.ambari.server.actionmanager.ActionDBAccessor#persistAction(org.apache.ambari.server.actionmanager.HostAction)
*/
@@ -51,7 +51,7 @@ public class ActionDBAccessorImpl implem
public List<Stage> getAllStages(String requestId) {
return null;
}
-
+
/* (non-Javadoc)
* @see org.apache.ambari.server.actionmanager.ActionDBAccessor#getQueuedStages()
*/
@@ -59,7 +59,7 @@ public class ActionDBAccessorImpl implem
public List<Stage> getQueuedStages() {
return null;
}
-
+
/* (non-Javadoc)
* @see org.apache.ambari.server.actionmanager.ActionDBAccessor#getNotQueuedStages()
*/
@@ -67,7 +67,7 @@ public class ActionDBAccessorImpl implem
public List<Stage> getNotQueuedStages() {
return null;
}
-
+
/* (non-Javadoc)
* @see org.apache.ambari.server.actionmanager.ActionDBAccessor#getNextStageId()
*/
@@ -106,6 +106,6 @@ public class ActionDBAccessorImpl implem
@Override
public void persistActions(List<Stage> stages) {
// TODO Auto-generated method stub
-
+
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBInMemoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBInMemoryImpl.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBInMemoryImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBInMemoryImpl.java Mon Oct 1 18:35:19 2012
@@ -27,7 +27,7 @@ import org.apache.ambari.server.Role;
public class ActionDBInMemoryImpl implements ActionDBAccessor {
List<Stage> stageList = new ArrayList<Stage>();
-
+
@Override
public void persistAction(HostAction ha) {
// TODO Auto-generated method stub
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java Mon Oct 1 18:35:19 2012
@@ -46,15 +46,15 @@ public class ActionManager {
actionQueue, fsm, 2);
this.fsm = fsm;
}
-
+
public void initialize() {
scheduler.start();
}
-
+
public void shutdown() {
scheduler.stop();
}
-
+
public void sendActions(List<Stage> stages) {
db.persistActions(stages);
}
@@ -75,6 +75,6 @@ public class ActionManager {
public void handleLostHost(String host) {
// TODO Auto-generated method stub
-
+
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java Mon Oct 1 18:35:19 2012
@@ -31,11 +31,11 @@ import org.apache.ambari.server.state.li
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-//This class encapsulates the action scheduler thread.
+//This class encapsulates the action scheduler thread.
//Action schedule frequently looks at action database and determines if
//there is an action that can be scheduled.
class ActionScheduler implements Runnable {
-
+
private static Log LOG = LogFactory.getLog(ActionScheduler.class);
private final long actionTimeout;
private final long sleepTime;
@@ -45,7 +45,7 @@ class ActionScheduler implements Runnabl
private final short maxAttempts;
private final ActionQueue actionQueue;
private final Clusters fsmObject;
-
+
public ActionScheduler(long sleepTimeMilliSec, long actionTimeoutMilliSec,
ActionDBAccessor db, ActionQueue actionQueue, Clusters fsmObject,
int maxAttempts) {
@@ -56,12 +56,12 @@ class ActionScheduler implements Runnabl
this.fsmObject = fsmObject;
this.maxAttempts = (short) maxAttempts;
}
-
+
public void start() {
schedulerThread = new Thread(this);
schedulerThread.start();
}
-
+
public void stop() {
shouldRun = false;
schedulerThread.interrupt();
@@ -81,19 +81,19 @@ class ActionScheduler implements Runnabl
}
}
}
-
+
private void doWork() throws AmbariException {
List<Stage> stages = db.getPendingStages();
if (stages == null || stages.isEmpty()) {
//Nothing to do
return;
}
-
+
//First discover completions and timeouts.
boolean operationFailure = false;
for (Stage s : stages) {
Map<Role, Map<String, HostRoleCommand>> roleToHrcMap = getInvertedRoleMap(s);
-
+
//Iterate for completion
boolean moveToNextStage = true;
for (Role r: roleToHrcMap.keySet()) {
@@ -223,7 +223,7 @@ class ActionScheduler implements Runnabl
}
return roleToHrcMap;
}
-
+
static class RoleStatus {
int numQueued = 0;
int numSucceeded = 0;
@@ -233,12 +233,12 @@ class ActionScheduler implements Runnabl
int numAborted = 0;
final int totalHosts;
final float successFactor;
-
+
RoleStatus(int total, float successFactor) {
this.totalHosts = total;
this.successFactor = successFactor;
}
-
+
boolean isRoleSuccessful() {
if (successFactor <= (1.0*numSucceeded)/totalHosts) {
return true;
@@ -246,11 +246,11 @@ class ActionScheduler implements Runnabl
return false;
}
}
-
+
boolean isRoleInProgress() {
return (numPending+numQueued > 0);
}
-
+
boolean isRoleFailed() {
if ((!isRoleInProgress()) && (!isRoleSuccessful())) {
return false;
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostAction.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostAction.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostAction.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostAction.java Mon Oct 1 18:35:19 2012
@@ -26,7 +26,7 @@ import org.apache.ambari.server.agent.Ex
/**
* Encapsulates entire task for a host for a stage or action. This class
* contains all the information to generate an
- * {@link org.apache.ambari.server.agent.ExecutionCommand} that will be
+ * {@link org.apache.ambari.server.agent.ExecutionCommand} that will be
* scheduled for a host.
*/
public class HostAction {
@@ -35,7 +35,7 @@ public class HostAction {
private long startTime = -1;
private long lastAttemptTime = -1;
private short attemptCount = 0;
-
+
/**
* This object will be serialized and sent to the agent.
*/
@@ -45,14 +45,14 @@ public class HostAction {
//generate manifest
return null;
}
-
+
public HostAction(String host) {
this.host = host;
roles = new ArrayList<HostRoleCommand>();
commandToHost = new ExecutionCommand();
commandToHost.setHostName(host);
}
-
+
public HostAction(HostAction ha) {
this.host = ha.host;
this.roles = ha.roles;
@@ -61,31 +61,31 @@ public class HostAction {
this.attemptCount = ha.attemptCount;
this.commandToHost = ha.commandToHost;
}
-
+
public void addHostRoleCommand(HostRoleCommand cmd) {
roles.add(cmd);
}
-
+
public List<HostRoleCommand> getRoleCommands() {
return roles;
}
-
+
public long getStartTime() {
return startTime;
}
-
+
public long getLastAttemptTime() {
return this.lastAttemptTime;
}
-
+
public void setLastAttemptTime(long t) {
this.lastAttemptTime = t;
}
-
+
public void incrementAttemptCount() {
this.attemptCount ++;
}
-
+
public short getAttemptCount() {
return this.attemptCount;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java Mon Oct 1 18:35:19 2012
@@ -44,11 +44,11 @@ public class HostRoleCommand {
public HostRoleStatus getStatus() {
return status;
}
-
+
public ServiceComponentHostEvent getEvent() {
return event;
}
-
+
void setStatus(HostRoleStatus status) {
this.status = status;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java Mon Oct 1 18:35:19 2012
@@ -30,20 +30,20 @@ public class Stage {
private final long requestId;
private final String clusterName;
private long stageId = -1;
-
+
//Map of roles to successFactors for this stage. Default is 1 i.e. 100%
private Map<Role, Float> successFactors = new HashMap<Role, Float>();
//Map of host to host-roles
private Map<String, HostAction> hostActions = new TreeMap<String, HostAction>();
private final String logDir;
-
+
public Stage(long requestId, String logDir, String clusterName) {
this.requestId = requestId;
this.logDir = logDir;
this.clusterName = clusterName;
}
-
+
public synchronized void setStageId(long stageId) {
if (this.stageId != -1) {
throw new RuntimeException("Attempt to set stageId again! Not allowed.");
@@ -53,24 +53,24 @@ public class Stage {
this.hostActions.get(host).setCommandId(this.requestId, this.stageId);
}
}
-
+
public synchronized long getStageId() {
return stageId;
}
-
+
public String getActionId() {
return "" + requestId + "-" + stageId;
}
-
+
synchronized void addHostAction(String host, HostAction ha) {
ha.setCommandId(requestId, stageId);
hostActions.put(host, ha);
}
-
+
synchronized HostAction getHostAction(String host) {
return hostActions.get(host);
}
-
+
/**
* Returns an internal data structure, please don't modify it.
* TODO: Ideally should return an iterator.
@@ -78,7 +78,7 @@ public class Stage {
synchronized Map<String, HostAction> getHostActions() {
return hostActions;
}
-
+
synchronized float getSuccessFactor(Role r) {
Float f = successFactors.get(r);
if (f == null) {
@@ -96,7 +96,7 @@ public class Stage {
// TODO Auto-generated method stub
return getHostAction(hostName).getManifest();
}
-
+
public String getClusterName() {
return clusterName;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ActionQueue.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ActionQueue.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ActionQueue.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ActionQueue.java Mon Oct 1 18:35:19 2012
@@ -29,15 +29,15 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ActionQueue {
-
+
private static Log LOG = LogFactory.getLog(ActionQueue.class);
-
+
Map<String, Queue<AgentCommand>> hostQueues;
public ActionQueue() {
hostQueues = new TreeMap<String, Queue<AgentCommand>>();
}
-
+
private synchronized Queue<AgentCommand> getQueue(String hostname) {
return hostQueues.get(hostname);
}
@@ -47,7 +47,7 @@ public class ActionQueue {
}
public void enqueue(String hostname, AgentCommand cmd) {
-
+
Queue<AgentCommand> q = getQueue(hostname);
if (q == null) {
q = new LinkedList<AgentCommand>();
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentCommand.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentCommand.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentCommand.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentCommand.java Mon Oct 1 18:35:19 2012
@@ -28,18 +28,18 @@ import javax.xml.bind.annotation.XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {})
public abstract class AgentCommand {
-
+
@XmlElement
private AgentCommandType commandType;
-
+
public AgentCommand() {
this.commandType = AgentCommandType.STATUS_COMMAND;
}
-
+
public AgentCommand(AgentCommandType type) {
this.commandType = type;
}
-
+
@XmlType
@XmlEnum
public enum AgentCommandType {
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandReport.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandReport.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandReport.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandReport.java Mon Oct 1 18:35:19 2012
@@ -37,38 +37,38 @@ public class CommandReport {
String status;
@XmlElement
int exitCode;
-
+
@XmlElement
private String clusterName;
-
+
public String getActionId() {
return this.actionId;
}
-
+
public void setActionId(String actionId) {
this.actionId = actionId;
}
-
+
public String getStdErr() {
return this.stderr;
}
-
+
public void setStdErr(String stderr) {
this.stderr = stderr;
}
-
+
public int getExitCode() {
return this.exitCode;
}
-
+
public void setExitCode(int exitCode) {
this.exitCode = exitCode;
}
-
+
public String getStdOut() {
return this.stdout;
}
-
+
public void setStdOut(String stdout) {
this.stdout = stdout;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ComponentStatus.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ComponentStatus.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ComponentStatus.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ComponentStatus.java Mon Oct 1 18:35:19 2012
@@ -37,7 +37,7 @@ public class ComponentStatus {
String serviceName;
@XmlElement
String clusterName;
-
+
public String getComponentName() {
return this.componentName;
}
@@ -45,19 +45,19 @@ public class ComponentStatus {
public void setComponentName(String componentName) {
this.componentName = componentName;
}
-
+
public String getMessage() {
return this.msg;
}
-
+
public void setMessage(String msg) {
this.msg = msg;
}
-
+
public String getStatus() {
return this.status;
}
-
+
public void setStatus(String status) {
this.status = status;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java Mon Oct 1 18:35:19 2012
@@ -33,50 +33,50 @@ import org.apache.ambari.server.utils.Ja
/**
- * Execution commands are scheduled by action manager, and these are
+ * Execution commands are scheduled by action manager, and these are
* persisted in the database for recovery.
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {})
public class ExecutionCommand extends AgentCommand {
-
+
public ExecutionCommand() {
super(AgentCommandType.EXECUTION_COMMAND);
}
-
+
@XmlElement
private String clusterName;
-
+
@XmlElement
private String commandId;
-
+
@XmlElement
private String hostname;
-
+
@XmlElement
@XmlJavaTypeAdapter(JaxbMapKeyValAdapter.class)
private Map<String, String> params = null;
-
+
@XmlElement
@XmlJavaTypeAdapter(JaxbMapKeyListAdapter.class)
private Map<String, List<String>> clusterHostInfo = null;
-
+
@XmlElement
private List<RoleExecution> rolesCommands;
-
+
@XmlElement
@XmlJavaTypeAdapter(JaxbMapKeyMapAdapter.class)
private Map<String, Map<String, String>> configurations;
-
+
public String getCommandId() {
return this.commandId;
}
-
+
public void setCommandId(String commandId) {
this.commandId = commandId;
}
-
+
@Override //Object
public boolean equals(Object other) {
if (!(other instanceof ExecutionCommand)) {
@@ -86,32 +86,32 @@ public class ExecutionCommand extends Ag
return (this.commandId == o.commandId &&
this.hostname == o.hostname);
}
-
+
@Override //Object
public int hashCode() {
return (hostname + commandId).hashCode();
}
-
+
public void setHostName(String host) {
this.hostname = host;
}
-
+
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {})
static class RoleExecution {
-
+
@XmlElement
private String role;
-
+
//These params are at role level
@XmlElement
@XmlJavaTypeAdapter(JaxbMapKeyValAdapter.class)
private Map<String, String> roleParams = null;
-
+
@XmlElement
private String cmd;
-
+
public String getRole() {
return role;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java Mon Oct 1 18:35:19 2012
@@ -49,7 +49,7 @@ public class HeartBeat {
List<ComponentStatus> componentStatus = new ArrayList<ComponentStatus>();
@XmlElement
HostStatus nodeStatus;
-
+
public long getResponseId() {
return responseId;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java Mon Oct 1 18:35:19 2012
@@ -43,12 +43,12 @@ import com.google.inject.Singleton;
*/
@Singleton
public class HeartBeatHandler {
-
+
private final Clusters clusterFsm;
private final ActionQueue actionQueue;
private final ActionManager actionManager;
private HeartbeatMonitor heartbeatMonitor;
-
+
@Inject
public HeartBeatHandler(Clusters fsm, ActionQueue aq, ActionManager am) {
this.clusterFsm = fsm;
@@ -56,11 +56,11 @@ public class HeartBeatHandler {
this.actionManager = am;
this.heartbeatMonitor = new HeartbeatMonitor(fsm, aq, am, 60000);
}
-
+
public void start() {
heartbeatMonitor.start();
}
-
+
public HeartBeatResponse handleHeartBeat(HeartBeat heartbeat) throws AmbariException {
HeartBeatResponse response = new HeartBeatResponse();
@@ -85,7 +85,7 @@ public class HeartBeatHandler {
actionManager.actionResponse(hostname, reports);
// Examine heartbeart for component status
- List<Cluster> clusters = clusterFsm.getClusters(hostname);
+ List<Cluster> clusters = clusterFsm.getClustersForHost(hostname);
for (Cluster cl : clusters) {
for (ComponentStatus status : heartbeat.componentStatus) {
if (status.getClusterName() == cl.getClusterName()) {
@@ -108,7 +108,7 @@ public class HeartBeatHandler {
}
return response;
}
-
+
public RegistrationResponse handleRegistration(Register register)
throws InvalidStateTransitonException, AmbariException {
String hostname = register.getHostname();
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatResponse.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatResponse.java Mon Oct 1 18:35:19 2012
@@ -63,7 +63,7 @@ public class HeartBeatResponse {
public List<AgentCommand> getAgentCommands() {
return this.cmds;
}
-
+
public void setAgentCommands(List<AgentCommand> cmds) {
this.cmds = cmds;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java Mon Oct 1 18:35:19 2012
@@ -41,7 +41,7 @@ public class HeartbeatMonitor implements
private final int threadWakeupInterval; //1 minute
private volatile boolean shouldRun = true;
private Thread monitorThread = null;
-
+
public HeartbeatMonitor(Clusters fsm, ActionQueue aq, ActionManager am,
int threadWakeupInterval) {
this.fsm = fsm;
@@ -58,7 +58,7 @@ public class HeartbeatMonitor implements
monitorThread = new Thread(this);
monitorThread.start();
}
-
+
@Override
public void run() {
while (shouldRun) {
@@ -83,7 +83,7 @@ public class HeartbeatMonitor implements
for (Host hostObj : allHosts) {
String host = hostObj.getHostName();
HostState hostState = hostObj.getState();
-
+
long lastHeartbeat = 0;
try {
lastHeartbeat = fsm.getHost(host).getLastHeartbeatTime();
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/Register.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/Register.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/Register.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/Register.java Mon Oct 1 18:35:19 2012
@@ -44,7 +44,7 @@ public class Register {
private String hostname;
@XmlElement
private HostInfo hardwareProfile;
-
+
public short getResponseId() {
return responseId;
}
@@ -60,7 +60,7 @@ public class Register {
public String getHostname() {
return hostname;
}
-
+
public HostInfo getHardwareProfile() {
return hardwareProfile;
}
@@ -72,9 +72,9 @@ public class Register {
public void setHostname(String hostname) {
this.hostname = hostname;
}
-
+
public void setHardwareProfile(HostInfo hardwareProfile) {
- this.hardwareProfile = hardwareProfile;
+ this.hardwareProfile = hardwareProfile;
}
@Override
@@ -82,8 +82,8 @@ public class Register {
String ret = "responseId=" + responseId + "\n" +
"timestamp=" + timestamp + "\n" +
"hostname=" + hostname + "\n";
-
- if (hardwareProfile != null)
+
+ if (hardwareProfile != null)
ret = ret + "hardwareprofile=" + this.hardwareProfile.toString();
return ret;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationCommand.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationCommand.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationCommand.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationCommand.java Mon Oct 1 18:35:19 2012
@@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {})
public class RegistrationCommand extends AgentCommand {
-
+
public RegistrationCommand() {
super(AgentCommandType.REGISTRATION_COMMAND);
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java Mon Oct 1 18:35:19 2012
@@ -35,7 +35,7 @@ import javax.xml.bind.annotation.XmlType
public class RegistrationResponse {
@XmlElement
private RegistrationStatus response;
-
+
private AgentCommand command = null;
public RegistrationStatus getResponseStatus() {
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/StatusCommand.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/StatusCommand.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/StatusCommand.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/StatusCommand.java Mon Oct 1 18:35:19 2012
@@ -38,13 +38,13 @@ public class StatusCommand extends Agent
public StatusCommand() {
super(AgentCommandType.STATUS_COMMAND);
}
-
+
@XmlElement
List<String> roles;
@XmlElement
private String clusterName;
-
+
public List<String> getRoles() {
return roles;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/rest/AgentResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/rest/AgentResource.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/rest/AgentResource.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/rest/AgentResource.java Mon Oct 1 18:35:19 2012
@@ -53,7 +53,7 @@ public class AgentResource {
static void init(HeartBeatHandler instance) {
hh = instance;
}
-
+
/**
* Register information about the host (Internal API to be used for
* Ambari Agent)
@@ -63,8 +63,8 @@ public class AgentResource {
* @response.representation.406.doc Error in register message format
* @response.representation.408.doc Request Timed out
* @param message Register message
- * @throws InvalidStateTransitonException
- * @throws AmbariException
+ * @throws InvalidStateTransitonException
+ * @throws AmbariException
* @throws Exception
*/
@Path("register/{hostName}")
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/BootStrapResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/BootStrapResource.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/BootStrapResource.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/BootStrapResource.java Mon Oct 1 18:35:19 2012
@@ -38,18 +38,18 @@ import com.google.inject.Inject;
@Path("/bootstrap")
public class BootStrapResource {
-
+
private static BootStrapImpl bsImpl;
private static Log LOG = LogFactory.getLog(BootStrapResource.class);
-
+
@Inject
static void init(BootStrapImpl instance) {
bsImpl = instance;
}
/**
* Run bootstrap on a list of hosts.
- * @response.representation.200.doc
- *
+ * @response.representation.200.doc
+ *
* @response.representation.200.mediaType application/json
* @response.representation.406.doc Error in format
* @response.representation.408.doc Request Timed out
@@ -57,15 +57,15 @@ public class BootStrapResource {
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public BSResponse bootStrap(SshHostInfo sshInfo) {
return bsImpl.runBootStrap(sshInfo);
}
-
+
/**
* Current BootStrap Information thats running.
- * @response.representation.200.doc
- *
+ * @response.representation.200.doc
+ *
* @response.representation.200.mediaType application/json
* @response.representation.406.doc Error in format
* @response.representation.408.doc Request Timed out
@@ -73,11 +73,11 @@ public class BootStrapResource {
*/
@GET
@Path("/{requestId}")
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public BootStrapStatus getBootStrapStatus(@PathParam("requestId")
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public BootStrapStatus getBootStrapStatus(@PathParam("requestId")
long requestId) {
BootStrapStatus status = bsImpl.getStatus(0);
- if (status == null)
+ if (status == null)
throw new WebApplicationException(Response.Status.NO_CONTENT);
return status;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/HealthCheck.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/HealthCheck.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/HealthCheck.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/rest/HealthCheck.java Mon Oct 1 18:35:19 2012
@@ -32,7 +32,7 @@ import javax.ws.rs.core.MediaType;
public class HealthCheck {
private final String status = "RUNNING";
// This method is called if TEXT_PLAIN is request
-
+
@GET
@Produces(MediaType.TEXT_PLAIN)
public String plainTextCheck() {
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatus.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatus.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatus.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatus.java Mon Oct 1 18:35:19 2012
@@ -33,31 +33,31 @@ import javax.xml.bind.annotation.XmlType
public class BSHostStatus {
@XmlElement
private String status;
- @XmlElement
+ @XmlElement
private String hostName;
@XmlElement
private String log;
-
+
public void setStatus(String status) {
this.status = status;
}
-
+
public String getStatus() {
return this.status;
}
-
+
public void setHostName(String hostName) {
this.hostName = hostName;
}
-
+
public String getHostName() {
return this.hostName;
}
-
+
public String getLog() {
return this.log;
}
-
+
public void setLog(String log) {
this.log = log;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java Mon Oct 1 18:35:19 2012
@@ -37,18 +37,18 @@ class BSHostStatusCollector {
static String logFileFilter = ".log";
static String doneFileFilter = ".done";
private static Log LOG = LogFactory.getLog(BSHostStatusCollector.class);
-
+
private List<String> hosts;
public BSHostStatusCollector(File requestIdDir, List<String> hosts) {
this.requestIdDir = requestIdDir;
this.hosts = hosts;
}
-
+
public List<BSHostStatus> getHostStatus() {
return hostStatus;
}
-
+
public void run() {
LOG.info("Request directory " + requestIdDir);
hostStatus = new ArrayList<BSHostStatus>();
@@ -64,9 +64,9 @@ class BSHostStatusCollector {
status.setHostName(host);
done = new File(requestIdDir, host + doneFileFilter);
log = new File(requestIdDir, host + logFileFilter);
- if (!done.exists())
+ if (!done.exists())
status.setStatus("RUNNING");
- else
+ else
status.setStatus("DONE");
if (!log.exists()) {
status.setLog("");
@@ -82,4 +82,4 @@ class BSHostStatusCollector {
hostStatus.add(status);
}
}
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSResponse.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSResponse.java Mon Oct 1 18:35:19 2012
@@ -39,34 +39,34 @@ public class BSResponse {
OK,
ERROR
}
-
- @XmlElement
+
+ @XmlElement
private BSRunStat status;
- @XmlElement
+ @XmlElement
private String log;
- @XmlElement
+ @XmlElement
private long requestId;
-
+
public long getRequestId() {
return this.requestId;
}
-
+
public void setRequestId(long requestId) {
this.requestId = requestId;
}
-
+
public BSRunStat getStatus() {
return this.status;
}
-
+
public void setStatus(BSRunStat status) {
this.status = status;
}
-
+
public String getLog() {
return this.log;
}
-
+
public void setLog(String log) {
this.log = log;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java Mon Oct 1 18:35:19 2012
@@ -57,14 +57,14 @@ public class BootStrapImpl {
public BootStrapImpl(Configuration conf) {
this.conf = conf;
this.bootStrapDir = conf.getBootStrapDir();
- this.bootScript = conf.getBootStrapScript();
+ this.bootScript = conf.getBootStrapScript();
this.bsStatus = new FifoLinkedHashMap<Long, BootStrapStatus>();
}
/**
* Return {@link BootStrapStatus} for a given responseId.
* @param requestId the responseId for which the status needs to be returned.
- * @return status for a specific response id. A response Id of -1 means the
+ * @return status for a specific response id. A response Id of -1 means the
* latest responseId.
*/
public synchronized BootStrapStatus getStatus(long requestId) {
@@ -85,7 +85,7 @@ public class BootStrapImpl {
/**
- * Run the bs script to ssh to a list of hosts
+ * Run the bs script to ssh to a list of hosts
* with a ssh key.
*/
class BSRunner extends Thread {
@@ -119,7 +119,7 @@ public class BootStrapImpl {
private class BSStatusCollector implements Runnable {
@Override
public void run() {
- BSHostStatusCollector collector = new BSHostStatusCollector(requestIdDir,
+ BSHostStatusCollector collector = new BSHostStatusCollector(requestIdDir,
sshHostInfo.getHosts());
collector.run();
List<BSHostStatus> hostStatus = collector.getHostStatus();
@@ -178,7 +178,7 @@ public class BootStrapImpl {
try {
createRunDir();
writeSshKeyFile(sshHostInfo.getSshKey());
- /* Running command:
+ /* Running command:
* script hostlist bsdir sshkeyfile
*/
commands[0] = this.bsScript;
@@ -188,13 +188,13 @@ public class BootStrapImpl {
LOG.info("Host= " + hostString + " bs=" + this.bsScript + " requestDir=" +
requestIdDir + " keyfile=" + this.sshKeyFile);
Process process = Runtime.getRuntime().exec(commands);
- /** Startup a scheduled executor service to look through the logs
+ /** Startup a scheduled executor service to look through the logs
*/
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
BSStatusCollector statusCollector = new BSStatusCollector();
- ScheduledFuture<?> handle = scheduler.scheduleWithFixedDelay(statusCollector,
+ ScheduledFuture<?> handle = scheduler.scheduleWithFixedDelay(statusCollector,
0, 10, TimeUnit.SECONDS);
- LOG.info("Kicking off the scheduler for polling on logs in " +
+ LOG.info("Kicking off the scheduler for polling on logs in " +
this.requestIdDir);
try {
int exitCode = process.waitFor();
@@ -259,7 +259,7 @@ public class BootStrapImpl {
response.setLog("BootStrap in Progress: Cannot Run more than one.");
response.setStatus(BSRunStat.ERROR);
return response;
- }
+ }
requestId++;
bsRunner = new BSRunner(info, bootStrapDir.toString(),
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java?rev=1392503&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java Mon Oct 1 18:35:19 2012
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ambari.server.bootstrap;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Class captures immediate response to a bootstrap api call.
+ * If the api call is ok, the return should return that its ok.
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {})
+public class BootStrapPostStatus {
+ @XmlType(name="status")
+ @XmlEnum
+ public enum BSPostStat {
+ OK,
+ ERROR
+ }
+
+ @XmlElement
+ private BSPostStat postStatus;
+ @XmlElement
+ private String log;
+ @XmlElement
+ private long requestId;
+
+ public long getRequestId() {
+ return this.requestId;
+ }
+
+ public void setRequestId(long requestId) {
+ this.requestId = requestId;
+ }
+
+ public BSPostStat getStatus() {
+ return this.postStatus;
+ }
+
+ public void setStatus(BSPostStat status) {
+ this.postStatus = status;
+ }
+
+ public String getLog() {
+ return this.log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapPostStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapStatus.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapStatus.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapStatus.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapStatus.java Mon Oct 1 18:35:19 2012
@@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlType
/**
- * Status of a bootstrap operation. Operation is successful or error
+ * Status of a bootstrap operation. Operation is successful or error
* and explains all the info regarding the operation on each host.
*
*/
@@ -44,36 +44,36 @@ public class BootStrapStatus {
SUCCESS,
ERROR
}
-
- @XmlElement
+
+ @XmlElement
private BSStat status;
-
+
@XmlElement
private List<BSHostStatus> hostsStatus;
-
+
@XmlElement
private String log;
-
+
public void setStatus(BSStat status) {
this.status = status;
}
-
+
public BSStat getStatus() {
return this.status;
}
-
+
public void setHostsStatus(List<BSHostStatus> hostsStatus) {
this.hostsStatus = hostsStatus;
}
-
+
public List<BSHostStatus> getHostsStatus() {
return this.hostsStatus;
}
-
+
public void setLog(String log) {
this.log = log;
}
-
+
public String getLog() {
return this.log;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/FifoLinkedHashMap.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/FifoLinkedHashMap.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/FifoLinkedHashMap.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/FifoLinkedHashMap.java Mon Oct 1 18:35:19 2012
@@ -26,12 +26,12 @@ import java.util.Map;
*
*/
@SuppressWarnings("serial")
-public class FifoLinkedHashMap<K, V> extends
+public class FifoLinkedHashMap<K, V> extends
LinkedHashMap<K, V> {
public static final int MAX_ENTRIES = 100;
- protected boolean removeEldestEntry(Map.Entry<K,
+ protected boolean removeEldestEntry(Map.Entry<K,
V> eldest) {
return size() > MAX_ENTRIES;
}
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java Mon Oct 1 18:35:19 2012
@@ -29,35 +29,35 @@ import javax.xml.bind.annotation.XmlType
/**
* Information that the API needs to provide to run bootstrap on hosts.
- *
+ *
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {})
public class SshHostInfo {
-
+
@XmlElement
private String sshKey;
-
- @XmlElement
+
+ @XmlElement
private List<String> hosts = new ArrayList<String>();
-
+
public String getSshKey() {
return sshKey;
}
-
+
public void setSshKey(String sshKey) {
this.sshKey = sshKey;
}
-
+
public void setHosts(List<String> hosts) {
this.hosts = hosts;
}
-
+
public List<String> getHosts() {
return this.hosts;
}
-
+
public String hostListAsString() {
String ret = "";
if (this.hosts == null) {
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java Mon Oct 1 18:35:19 2012
@@ -52,7 +52,7 @@ public class Configuration {
public static final String SRVR_CRT_PASS_KEY = "security.server.crt_pass";
public static final String PASSPHRASE_ENV_KEY = "security.server.passphrase_env_var";
public static final String PASSPHRASE_KEY = "security.server.passphrase";
-
+
public static final String CLIENT_SECURITY_KEY = "client.security";
public static final String LDAP_USE_SSL_KEY = "authorization.ldap.useSSL";
public static final String LDAP_PRIMARY_URL_KEY = "authorization.ldap.primaryUrl";
@@ -70,8 +70,8 @@ public class Configuration {
public static final String KSTR_NAME_DEFAULT = "keystore.p12";
private static final String SRVR_CRT_PASS_FILE_DEFAULT ="pass.txt";
private static final String PASSPHRASE_ENV_DEFAULT = "AMBARI_PASSPHRASE";
-
-
+
+
private static final String CLIENT_SECURITY_DEFAULT = "local";
private static final String LDAP_USER_SEARCH_FILTER_DEFAULT = "({attribute}={0})";
@@ -85,7 +85,7 @@ public class Configuration {
-
+
private static final Log LOG = LogFactory.getLog(Configuration.class);
private static Configuration instance;
@@ -101,7 +101,7 @@ public class Configuration {
}
/**
- * For Testing only. This is to be able to create Configuration object
+ * For Testing only. This is to be able to create Configuration object
* for testing.
* @param properties properties to use for testing using the Conf object.
*/
@@ -122,7 +122,7 @@ public class Configuration {
configsMap.put(LDAP_USER_DEFAULT_ROLE_KEY, properties.getProperty(LDAP_USER_DEFAULT_ROLE_KEY, LDAP_USER_DEFAULT_ROLE_DEFAULT));
try {
- File passFile = new File(configsMap.get(SRVR_KSTR_DIR_KEY) + File.separator
+ File passFile = new File(configsMap.get(SRVR_KSTR_DIR_KEY) + File.separator
+ configsMap.get(SRVR_CRT_PASS_FILE_KEY));
if (passFile.exists()) {
String srvrCrtPass = FileUtils.readFileToString(passFile);
@@ -180,7 +180,7 @@ public class Configuration {
}
return bootscript;
}
-
+
/**
* Get the map with server config parameters.
* Keys - public constants of this class
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java Mon Oct 1 18:35:19 2012
@@ -91,7 +91,7 @@ public class AmbariServer {
webAppContext.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springWebAppContext);
-
+
server.setHandler(webAppContext);
certMan.initRootCert();
@@ -101,7 +101,7 @@ public class AmbariServer {
ServletHolder rootServlet = root.addServlet(DefaultServlet.class, "/");
rootServlet.setInitOrder(1);
-
+
root.addFilter(SecurityFilter.class, "/*", 1);
//Secured connector for 2-way auth
SslSocketConnector sslConnectorTwoWay = new SslSocketConnector();
@@ -119,11 +119,11 @@ public class AmbariServer {
sslConnectorTwoWay.setKeystoreType("PKCS12");
sslConnectorTwoWay.setTruststoreType("PKCS12");
sslConnectorTwoWay.setNeedClientAuth(true);
-
+
//Secured connector for 1-way auth
SslSocketConnector sslConnectorOneWay = new SslSocketConnector();
sslConnectorOneWay.setPort(CLIENT_ONE_WAY);
-
+
sslConnectorOneWay.setKeystore(keystore);
sslConnectorOneWay.setTruststore(keystore);
sslConnectorOneWay.setPassword(srvrCrtPass);
@@ -132,8 +132,8 @@ public class AmbariServer {
sslConnectorOneWay.setKeystoreType("PKCS12");
sslConnectorOneWay.setTruststoreType("PKCS12");
sslConnectorOneWay.setNeedClientAuth(false);
-
-
+
+
server.addConnector(sslConnectorOneWay);
server.addConnector(sslConnectorTwoWay);
@@ -161,7 +161,7 @@ public class AmbariServer {
"org.apache.ambari.server.security.unsecured.rest");
root.addServlet(cert, "/cert/*");
cert.setInitOrder(4);
-
+
ServletHolder certs = new ServletHolder(ServletContainer.class);
certs.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
"com.sun.jersey.api.core.PackagesResourceConfig");
@@ -209,4 +209,4 @@ public class AmbariServer {
LOG.error("Failed to run the Ambari Server", t);
}
}
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java Mon Oct 1 18:35:19 2012
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ambari.server.orm.entities;
import javax.persistence.Entity;
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java Mon Oct 1 18:35:19 2012
@@ -5,6 +5,24 @@ import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
@IdClass(UserEntityPK.class)
@javax.persistence.Table(name = "users", schema = "ambari", catalog = "")
@Entity
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java Mon Oct 1 18:35:19 2012
@@ -73,11 +73,11 @@ public class CertificateManager {
String srvrKstrDir = configsMap.get(Configuration.SRVR_KSTR_DIR_KEY);
String srvrCrtName = configsMap.get(Configuration.SRVR_CRT_NAME_KEY);
File certFile = new File(srvrKstrDir + File.separator + srvrCrtName);
-
+
return certFile.exists();
}
-
-
+
+
/**
* Runs os command
*/
@@ -88,11 +88,11 @@ public class CertificateManager {
try {
process = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
-
+
while ((line = br.readLine()) != null) {
LOG.info(line);
}
-
+
try {
process.waitFor();
}
@@ -103,19 +103,19 @@ public class CertificateManager {
catch (IOException e){
e.printStackTrace();
}
-
+
}
-
+
private void generateServerCertificate() {
LOG.info("Generation of server certificate");
-
+
Map<String, String> configsMap = configs.getConfigsMap();
String srvrKstrDir = configsMap.get(Configuration.SRVR_KSTR_DIR_KEY);
String srvrCrtName = configsMap.get(Configuration.SRVR_CRT_NAME_KEY);
String srvrKeyName = configsMap.get(Configuration.SRVR_KEY_NAME_KEY);
String kstrName = configsMap.get(Configuration.KSTR_NAME_KEY);
String srvrCrtPass = configsMap.get(Configuration.SRVR_CRT_PASS_KEY);
-
+
Object[] scriptArgs = {srvrCrtPass, srvrKstrDir, srvrKeyName,
srvrCrtName, kstrName};
@@ -139,16 +139,16 @@ public class CertificateManager {
*/
public String getServerCert() {
Map<String, String> configsMap = configs.getConfigsMap();
- File certFile = new File(configsMap.get(Configuration.SRVR_KSTR_DIR_KEY) + File.separator + configsMap.get(Configuration.SRVR_CRT_NAME_KEY));
+ File certFile = new File(configsMap.get(Configuration.SRVR_KSTR_DIR_KEY) + File.separator + configsMap.get(Configuration.SRVR_CRT_NAME_KEY));
String srvrCrtContent = null;
try {
srvrCrtContent = FileUtils.readFileToString(certFile);
} catch (IOException e) {
LOG.error(e.getMessage());
- }
+ }
return srvrCrtContent;
}
-
+
/**
* Signs agent certificate
* Adds agent certificate to server keystore
@@ -157,19 +157,19 @@ public class CertificateManager {
public String signAgentCrt(String agentHostname, String agentCrtReqContent, String passphraseAgent) {
LOG.info("Signing of agent certificate");
LOG.info("Verifying passphrase");
-
-
-
+
+
+
String passphraseSrvr = configs.getConfigsMap().get(Configuration.PASSPHRASE_KEY);
-
+
System.out.println(passphraseSrvr);
System.out.println(passphraseAgent);
-
+
if (!passphraseAgent.equals(passphraseSrvr)) {
LOG.warn("Incorrect passphrase from agent");
return "";
}
-
+
Map<String, String> configsMap = configs.getConfigsMap();
String srvrKstrDir = configsMap.get(Configuration.SRVR_KSTR_DIR_KEY);
String srvrCrtPass = configsMap.get(Configuration.SRVR_CRT_PASS_KEY);
@@ -177,8 +177,8 @@ public class CertificateManager {
String srvrKeyName = configsMap.get(Configuration.SRVR_KEY_NAME_KEY);
String agentCrtReqName = agentHostname + ".csr";
String agentCrtName = agentHostname + ".crt";
-
-
+
+
File agentCrtReqFile = new File(srvrKstrDir + File.separator + agentCrtReqName);
try {
FileUtils.writeStringToFile(agentCrtReqFile, agentCrtReqContent);
@@ -190,9 +190,9 @@ public class CertificateManager {
srvrCrtPass,srvrKeyName,srvrCrtName};
String command = MessageFormat.format(SIGN_AGENT_CRT,scriptArgs);
-
+
LOG.error(command);
-
+
runCommand(command);
File agentCrtFile = new File(srvrKstrDir + File.separator + agentCrtName);
@@ -203,7 +203,7 @@ public class CertificateManager {
e.printStackTrace();
LOG.error("Error reading signed agent certificate");
}
-
+
return agentCrtContent;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SecurityFilter.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SecurityFilter.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SecurityFilter.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SecurityFilter.java Mon Oct 1 18:35:19 2012
@@ -46,9 +46,9 @@ public class SecurityFilter implements F
HttpServletRequest req = (HttpServletRequest) serReq;
String reqUrl = req.getRequestURL().toString();
-
+
System.out.println("req url:" + reqUrl);
-
+
//req.getC
if (serReq.getLocalPort() == AmbariServer.CLIENT_ONE_WAY) {
@@ -69,12 +69,12 @@ public class SecurityFilter implements F
private boolean isRequestAllowed(String reqUrl) {
try {
boolean isMatch = Pattern.matches("https://[A-z]*:[0-9]*/cert/ca[/]*", reqUrl);
-
+
if (isMatch)
return true;
-
+
isMatch = Pattern.matches("https://[A-z]*:[0-9]*/certs/[A-z0-9-]*", reqUrl);
-
+
if (isMatch)
return true;
@@ -82,4 +82,4 @@ public class SecurityFilter implements F
}
return false;
}
-}
\ No newline at end of file
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SignCertResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SignCertResponse.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SignCertResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/SignCertResponse.java Mon Oct 1 18:35:19 2012
@@ -45,7 +45,7 @@ public class SignCertResponse {
private String result;
@XmlElement
private String signedCa;
-
+
public String getResult() {
return result;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateDownload.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateDownload.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateDownload.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateDownload.java Mon Oct 1 18:35:19 2012
@@ -33,17 +33,17 @@ import com.google.inject.Inject;
public class CertificateDownload {
private static Log LOG = LogFactory.getLog(CertificateDownload.class);
private static CertificateManager certMan;
-
+
@Inject
static void init(CertificateManager instance) {
certMan = instance;
}
-
+
@GET
@Produces({MediaType.TEXT_PLAIN})
public String downloadSrvrCrt() {
return certMan.getServerCert();
}
-
-
+
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateSign.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateSign.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateSign.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/CertificateSign.java Mon Oct 1 18:35:19 2012
@@ -38,12 +38,12 @@ import com.google.inject.Inject;
public class CertificateSign {
private static Log LOG = LogFactory.getLog(CertificateSign.class);
private static CertificateManager certMan;
-
+
@Inject
static void init(CertificateManager instance) {
certMan = instance;
}
-
+
/**
* Signs agent certificate
* @response.representation.200.doc This API is invoked by Ambari agent running
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java?rev=1392503&r1=1392502&r2=1392503&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java Mon Oct 1 18:35:19 2012
@@ -20,8 +20,6 @@ package org.apache.ambari.server.state.l
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
-import org.apache.ambari.server.state.live.host.HostEvent;
-import org.apache.ambari.server.state.live.host.HostState;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
@@ -29,83 +27,71 @@ import org.apache.ambari.server.state.li
public interface Cluster {
/**
+ * Get the cluster ID
+ */
+ public long getClusterId();
+
+ /**
* Get the Cluster Name
*/
public String getClusterName();
/**
- * Add a new host to the cluster
- * @throws AmbariException
+ * Set the Cluster Name
*/
- public void addHost(String host) throws AmbariException;
-
+ public void setClusterName(String clusterName);
+
/**
* Add a new ServiceComponentHost to the cluster
* @param serviceName
* @param componentName
- * @param hostName
+ * @param hostname
* @param isClient
*/
public void addServiceComponentHost(String serviceName, String componentName,
- String hostName, boolean isClient) throws AmbariException;
-
- /**
- * Get the State for a given Host
- * @param hostName Host hostname for which to retrieve state
- * @return
- * @throws AmbariException
- */
- public HostState getHostState(String hostName) throws AmbariException;
-
- /**
- * Set the State for a given Host
- * @param hostName Host's hostname for which state is to be set
- * @param state HostState to set
- */
- public void setHostState(String hostName, HostState state)
- throws AmbariException;
-
- /**
- * Send event to the given Host
- * @param hostName Host's hostname
- * @param event Event to be handled
- */
- public void handleHostEvent(String hostName, HostEvent event)
- throws AmbariException, InvalidStateTransitonException;
+ String hostname, boolean isClient) throws AmbariException;
/**
* Get the State for a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param hostName Host name
+ * @param hostname Host name
* @return ServiceComponentHostState
*/
public ServiceComponentHostState getServiceComponentHostState(String service,
- String serviceComponent, String hostName) throws AmbariException;
+ String serviceComponent, String hostname) throws AmbariException;
/**
* Set the State for a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param hostName Host name
+ * @param hostname Host name
* @param state State to set
*/
public void setServiceComponentHostState(String service,
- String serviceComponent, String hostName,
+ String serviceComponent, String hostname,
ServiceComponentHostState state) throws AmbariException;
/**
* Send an Event to a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param hostName Host name
+ * @param hostname Host name
* @param event Event to be handled
*/
public void handleServiceComponentHostEvent(String service,
- String serviceComponent, String hostName,
+ String serviceComponent, String hostname,
ServiceComponentHostEvent event)
throws AmbariException, InvalidStateTransitonException;
+ /**
+ * Retrieve a ServiceComponentHost object
+ * @param serviceName Service name
+ * @param serviceComponentName ServiceComponent name
+ * @param hostname Host name
+ * @return
+ * @throws AmbariException
+ */
public ServiceComponentHost getServiceComponentHost(String serviceName,
String componentName, String hostname) throws AmbariException;
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java?rev=1392503&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java Mon Oct 1 18:35:19 2012
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ambari.server.state.live;
+
+import org.apache.ambari.server.orm.entities.ClusterEntity;
+
+/**
+ * Factory interface for Guice injections
+ */
+public interface ClusterFactory {
+ Cluster create(ClusterEntity clusterEntity);
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native