View Javadoc

1   /*
2    * $Id: MuleConfigurationService.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.management.mbean;
12  
13  import org.mule.api.config.MuleConfiguration;
14  import org.mule.config.DefaultMuleConfiguration;
15  import org.mule.util.StringUtils;
16  
17  /**
18   * <code>MuleConfigurationService</code> exposes the MuleConfiguration settings as
19   * a management service.
20   * 
21   */
22  public class MuleConfigurationService implements MuleConfigurationServiceMBean
23  {
24      private  MuleConfiguration muleConfiguration;
25  
26      public MuleConfigurationService(MuleConfiguration muleConfiguration)
27      {
28          this.muleConfiguration = muleConfiguration;
29      }
30  
31      public int getSynchronousEventTimeout()
32      {
33          return muleConfiguration.getDefaultResponseTimeout();
34      }
35  
36      public String getWorkingDirectory()
37      {
38          return muleConfiguration.getWorkingDirectory();
39      }
40  
41      public int getTransactionTimeout()
42      {
43          return muleConfiguration.getDefaultTransactionTimeout();
44      }
45  
46      public int getShutdownTimeout()
47      {
48          return muleConfiguration.getShutdownTimeout();
49      }
50  
51      public boolean isClientMode()
52      {
53          return muleConfiguration.isClientMode();
54      }
55  
56  
57      public String getEncoding()
58      {
59          return muleConfiguration.getDefaultEncoding();
60      }
61  
62      public boolean isContainerMode()
63      {
64          return muleConfiguration.isContainerMode();
65      }
66  
67      public boolean isFullStackTraces()
68      {
69          /*
70              Sacrifice the code quality for the sake of keeping things simple -
71              the alternative would be to pass MuleContext into every exception constructor.
72           */
73          return DefaultMuleConfiguration.fullStackTraces;
74      }
75  
76      public void setFullStackTraces(boolean flag)
77      {
78          /*
79             Sacrifice the code quality for the sake of keeping things simple -
80             the alternative would be to pass MuleContext into every exception constructor.
81          */
82          DefaultMuleConfiguration.fullStackTraces = flag;
83      }
84  
85      public String getStackTraceFilter()
86      {
87          return StringUtils.join(DefaultMuleConfiguration.stackTraceFilter, ',');
88      }
89  
90      public void setStackTraceFilter(String filterAsString)
91      {
92          DefaultMuleConfiguration.stackTraceFilter = filterAsString.split(",");
93      }
94  }