View Javadoc
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.management.mbean;
8   
9   import org.mule.api.config.MuleConfiguration;
10  import org.mule.config.DefaultMuleConfiguration;
11  import org.mule.util.StringUtils;
12  
13  /**
14   * <code>MuleConfigurationService</code> exposes the MuleConfiguration settings as
15   * a management service.
16   * 
17   */
18  public class MuleConfigurationService implements MuleConfigurationServiceMBean
19  {
20      private  MuleConfiguration muleConfiguration;
21  
22      public MuleConfigurationService(MuleConfiguration muleConfiguration)
23      {
24          this.muleConfiguration = muleConfiguration;
25      }
26  
27      public int getSynchronousEventTimeout()
28      {
29          return muleConfiguration.getDefaultResponseTimeout();
30      }
31  
32      public String getWorkingDirectory()
33      {
34          return muleConfiguration.getWorkingDirectory();
35      }
36  
37      public int getTransactionTimeout()
38      {
39          return muleConfiguration.getDefaultTransactionTimeout();
40      }
41  
42      public int getShutdownTimeout()
43      {
44          return muleConfiguration.getShutdownTimeout();
45      }
46  
47      public boolean isClientMode()
48      {
49          return muleConfiguration.isClientMode();
50      }
51  
52  
53      public String getEncoding()
54      {
55          return muleConfiguration.getDefaultEncoding();
56      }
57  
58      public boolean isContainerMode()
59      {
60          return muleConfiguration.isContainerMode();
61      }
62  
63      public boolean isFullStackTraces()
64      {
65          /*
66              Sacrifice the code quality for the sake of keeping things simple -
67              the alternative would be to pass MuleContext into every exception constructor.
68           */
69          return DefaultMuleConfiguration.fullStackTraces;
70      }
71  
72      public void setFullStackTraces(boolean flag)
73      {
74          /*
75             Sacrifice the code quality for the sake of keeping things simple -
76             the alternative would be to pass MuleContext into every exception constructor.
77          */
78          DefaultMuleConfiguration.fullStackTraces = flag;
79      }
80  
81      public String getStackTraceFilter()
82      {
83          return StringUtils.join(DefaultMuleConfiguration.stackTraceFilter, ',');
84      }
85  
86      public void setStackTraceFilter(String filterAsString)
87      {
88          DefaultMuleConfiguration.stackTraceFilter = filterAsString.split(",");
89      }
90  }