adding initializing 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/42d14e32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/42d14e32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/42d14e32

Branch: refs/heads/master
Commit: 42d14e32fc5bf84a198c39811159c617b600d122
Parents: 05627ec
Author: Nirmal Fernando <[email protected]>
Authored: Mon Mar 10 14:54:02 2014 +0530
Committer: Nirmal Fernando <[email protected]>
Committed: Mon Mar 10 14:54:02 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/42d14e32/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/InitializingPhase.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/InitializingPhase.java
 
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/InitializingPhase.java
new file mode 100644
index 0000000..0305a44
--- /dev/null
+++ 
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/phase/impl/InitializingPhase.java
@@ -0,0 +1,60 @@
+/*
+ * 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.event.publisher.CartridgeAgentEventPublisher;
+import org.apache.stratos.cartridge.agent.executor.ExtensionExecutor;
+import org.apache.stratos.cartridge.agent.phase.Phase;
+
+/**
+ * Inception phase of Cartridge Agent. From initialization to sending instance
+ * started event.
+ */
+public class InitializingPhase extends Phase {
+       
+       private static final Log log = 
LogFactory.getLog(InitializingPhase.class);
+
+       public InitializingPhase() {
+               super(InitializingPhase.class.getName());
+       }
+       
+       public InitializingPhase(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();
+               }
+
+               // Publish instance started event
+               CartridgeAgentEventPublisher.publishInstanceStartedEvent();
+               
+               log.info("Finished Executing Phase: "+super.getId());
+       }
+
+}

Reply via email to