Coverage Report - org.mule.module.boot.VersionWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
VersionWrapper
0%
0/12
0%
0/8
2.333
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.boot;
 8  
 
 9  
 import org.mule.config.i18n.CoreMessages;
 10  
 
 11  
 import org.tanukisoftware.wrapper.WrapperListener;
 12  
 import org.tanukisoftware.wrapper.WrapperManager;
 13  
 
 14  
 /**
 15  
  * There is a need to exit from wrapper
 16  
  * This is a good place for other information message
 17  
  */
 18  0
 public class VersionWrapper implements WrapperListener
 19  
 {
 20  
     public Integer start(String[] args)
 21  
     {
 22  
         try
 23  
         {
 24  0
             System.out.println(CoreMessages.productInformation());
 25  
         }
 26  0
         catch (Exception e)
 27  
         {
 28  0
             e.printStackTrace();
 29  0
             return Integer.valueOf(1);
 30  0
         }
 31  0
         return null;
 32  
     }
 33  
 
 34  
     public int stop(int exitCode)
 35  
     {
 36  0
         return exitCode;
 37  
     }
 38  
 
 39  
     public void controlEvent(int event)
 40  
     {
 41  0
         if (WrapperManager.isControlledByNativeWrapper())
 42  
         {
 43  
             // The Wrapper will take care of this event
 44  
         }
 45  
         else
 46  
         {
 47  
             // We are not being controlled by the Wrapper, so
 48  
             //  handle the event ourselves.
 49  0
             if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) ||
 50  
                 (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) ||
 51  
                 (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT))
 52  
             {
 53  0
                 WrapperManager.stop(0);
 54  
             }
 55  
         }
 56  0
     }
 57  
 }