You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/03/10 10:43:16 UTC

[05/20] git commit: adding clean up phase

adding clean up phase


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/975a6a4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/975a6a4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/975a6a4a

Branch: refs/heads/master
Commit: 975a6a4af951ec3c8c38218c22f7529d74553850
Parents: ea588e4
Author: Nirmal Fernando <ni...@apache.org>
Authored: Mon Mar 10 14:54:57 2014 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Mon Mar 10 14:54:57 2014 +0530

----------------------------------------------------------------------
 .../agent/phase/impl/CleanUpPhase.java          | 62 ++++++++++++++++++++
 1 file changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/975a6a4a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/CleanUpPhase.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/CleanUpPhase.java b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/CleanUpPhase.java
new file mode 100644
index 0000000..73f3313
--- /dev/null
+++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/CleanUpPhase.java
@@ -0,0 +1,62 @@
+/*
+ * 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.stratos.cartridge.agent.phase.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cartridge.agent.executor.ExtensionExecutor;
+import org.apache.stratos.cartridge.agent.phase.Phase;
+import org.apache.stratos.cartridge.agent.runtime.DataHolder;
+
+/**
+ * Inception phase of Cartridge Agent. From initialization to sending instance
+ * started event.
+ */
+public class CleanUpPhase extends Phase {
+	
+	private static final Log log = LogFactory.getLog(CleanUpPhase.class);
+
+	public CleanUpPhase() {
+		super(CleanUpPhase.class.getName());
+	}
+	
+	public CleanUpPhase(String id) {
+		super(id);
+	}
+
+	@Override
+	public void execute() {
+
+		log.info("Currently Executing Phase: " + super.getId());
+
+		// execute all the extensions of this phase in order.
+		for (ExtensionExecutor extensionExecutor : super.getExtensions()) {
+			extensionExecutor.execute();
+		}
+
+		// clean up all the phases
+		for (Phase phase : DataHolder.getInstance().getPhases()) {
+			phase.cleanUp();
+		}
+
+		log.info("Finished Executing Phase: " + super.getId());
+	}
+
+}