View Javadoc

1   /*
2    * $Id: GraphEnvironment.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.tools.visualizer.config;
12  
13  import org.mule.tools.visualizer.components.EndpointRegistry;
14  
15  import java.util.Properties;
16  
17  /**
18   * todo document
19   * 
20   * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
21   * @version $Revision: 7963 $
22   */
23  public class GraphEnvironment
24  {
25  
26      // Determines if the manager is running synchronously by default
27      private boolean defaultTwoWay = false;
28  
29      // Is the parser doing a combined generation
30      private boolean doingCombinedGeneration = false;
31  
32      // Stores references to endpoints registered in the graph
33      private EndpointRegistry endpointRegistry;
34  
35      private GraphConfig config;
36  
37      private Properties properties;
38  
39      public GraphEnvironment(GraphConfig config)
40      {
41          this.config = config;
42          properties = new Properties();
43          endpointRegistry = new EndpointRegistry(this);
44      }
45  
46      public boolean isDefaultTwoWay()
47      {
48          return defaultTwoWay;
49      }
50  
51      public void setDefaultTwoWay(boolean defaultTwoWay)
52      {
53          this.defaultTwoWay = defaultTwoWay;
54      }
55  
56      public boolean isDoingCombinedGeneration()
57      {
58          return doingCombinedGeneration;
59      }
60  
61      public void setDoingCombinedGeneration(boolean doingCombinedGeneration)
62      {
63          this.doingCombinedGeneration = doingCombinedGeneration;
64      }
65  
66      public EndpointRegistry getEndpointRegistry()
67      {
68          return endpointRegistry;
69      }
70  
71      public void setEndpointRegistry(EndpointRegistry endpointRegistry)
72      {
73          this.endpointRegistry = endpointRegistry;
74      }
75  
76      public GraphConfig getConfig()
77      {
78          return config;
79      }
80  
81      public void setConfig(GraphConfig config)
82      {
83          this.config = config;
84      }
85  
86      public Properties getProperties()
87      {
88          return properties;
89      }
90  
91      public void setProperties(Properties properties)
92      {
93          this.properties = properties;
94      }
95  
96      public void setProperty(String name, String value)
97      {
98          properties.setProperty(name, value);
99      }
100 
101     public String getProperty(String name)
102     {
103         return getProperty(name, null);
104     }
105 
106     public String getProperty(String name, String defaultValue)
107     {
108         return properties.getProperty(name, defaultValue);
109     }
110 
111     public void log(String message)
112     {
113         System.out.println(message);
114     }
115 
116     public void logError(String message, Exception e)
117     {
118         System.err.println(message);
119         if (e != null)
120         {
121             e.printStackTrace(System.err);
122         }
123     }
124 }