00001 /* 00002 * CAST - The CoSy Architecture Schema Toolkit 00003 * 00004 * Copyright (C) 2006-2007 Nick Hawes 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * as published by the Free Software Foundation; either version 2.1 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA 00020 * 00021 */ 00022 00026 package cast.configuration; 00027 00028 import java.util.ArrayList; 00029 import java.util.Iterator; 00030 import java.util.Properties; 00031 00032 import cast.cdl.SUBARCHIDKEY; 00033 00037 public class ArchitectureConfiguration implements CASTConnectionConfiguration, 00038 Iterable<SubarchitectureConfiguration> { 00039 00043 public static final String MOTIVE_GEN_NAM = "motivegen"; 00044 00048 public static final String GOAL_MANAGER_NAME = "goalmanager"; 00049 00050 private ArrayList<SubarchitectureConfiguration> m_subarchitectures; 00051 00052 // private ProcessDescription m_motiveGenerator; 00053 00054 // private ProcessDescription m_goalManager; 00055 private Properties m_archDefaults; 00056 00057 // public boolean isSingleSubarchConfig() { 00058 // return m_motiveGenerator == null; 00059 // } 00060 // 00061 // /** 00062 // * @return the motiveGenerator 00063 // */ 00064 // public ProcessDescription getMotiveGenerator() { 00065 // return m_motiveGenerator; 00066 // } 00067 // 00068 // /** 00069 // * @return the goalManager 00070 // */ 00071 // public ProcessDescription getGoalManager() { 00072 // return m_goalManager; 00073 // } 00074 00078 public ArchitectureConfiguration() { 00079 m_subarchitectures = new ArrayList<SubarchitectureConfiguration>(); 00080 m_archDefaults = new Properties(); 00081 m_archDefaults.setProperty(SUBARCHIDKEY.value, "general.arch"); 00082 00083 } 00084 00085 public ArrayList<SubarchitectureConfiguration> getSubarchitectures() { 00086 return m_subarchitectures; 00087 } 00088 00089 // 00090 // /** 00091 // * @param _host 00092 // * @param _string 00093 // * @param _string2 00094 // */ 00095 // public ArchitectureConfiguration(String _host, String _motiveGen, 00096 // String _goalMan) { 00097 // this(); 00098 // setMotiveGenerator(_motiveGen, ProcessLanguage.JAVA_PROCESS, 00099 // _host); 00100 // setGoalManager(_goalMan, ProcessLanguage.JAVA_PROCESS, _host); 00101 // } 00102 00103 // public void setMotiveGenerator(String _motiveGen, 00104 // ProcessLanguage _lang, String _host) { 00105 // setMotiveGenerator(_motiveGen, _lang, _host, new Properties()); 00106 // } 00107 // 00108 // public void setMotiveGenerator(String _motiveGen, 00109 // ProcessLanguage _lang, String _host, Properties _props) { 00110 // Properties props = new Properties(m_archDefaults); 00111 // props.putAll(_props); 00112 // 00113 // m_motiveGenerator = ClientUtils.newProcessDescription( 00114 // // unique id for the process 00115 // ArchitectureConfiguration.MOTIVE_GEN_NAM, 00116 // // actual class name of the process 00117 // _motiveGen, 00118 // // indicate that the process is in Java 00119 // _lang, 00120 // // and what machine it should run on 00121 // _host, props); 00122 // 00123 // } 00124 // 00125 // public void setGoalManager(String _goalManager, 00126 // ProcessLanguage _lang, String _host) { 00127 // setGoalManager(_goalManager, _lang, _host, new Properties()); 00128 // } 00129 // 00130 // public void setGoalManager(String _goalManager, 00131 // ProcessLanguage _lang, String _host, Properties _props) { 00132 // 00133 // Properties props = new Properties(m_archDefaults); 00134 // props.putAll(_props); 00135 // 00136 // m_goalManager = ClientUtils.newProcessDescription( 00137 // // unique id for the process 00138 // ArchitectureConfiguration.GOAL_MANAGER_NAME, 00139 // // actual class name of the process 00140 // _goalManager, 00141 // // indicate that the process is in Java 00142 // _lang, 00143 // // and what machine it should run on 00144 // _host, props); 00145 // 00146 // } 00147 00148 public void addSubarchitectureConfiguration( 00149 SubarchitectureConfiguration _config) { 00150 m_subarchitectures.add(_config); 00151 } 00152 00153 00154 /* 00155 * (non-Javadoc) 00156 * 00157 * @see java.lang.Iterable#iterator() 00158 */ 00159 public Iterator<SubarchitectureConfiguration> iterator() { 00160 return m_subarchitectures.iterator(); 00161 } 00162 00163 }
1.5.8