01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.config.schema;
06:
07: import com.tc.config.schema.context.ConfigContext;
08: import com.tc.config.schema.dynamic.FileConfigItem;
09: import com.tc.config.schema.dynamic.ParameterSubstituter;
10: import com.tc.util.Assert;
11: import com.terracottatech.config.Client;
12: import com.terracottatech.config.Modules;
13:
14: /**
15: * The standard implementation of {@link NewCommonL1Config}.
16: */
17: public class NewCommonL1ConfigObject extends BaseNewConfigObject
18: implements NewCommonL1Config {
19:
20: private final FileConfigItem logsPath;
21: private final Modules modules;
22:
23: public NewCommonL1ConfigObject(ConfigContext context) {
24: super (context);
25: Assert.assertNotNull(context);
26:
27: this .context.ensureRepositoryProvides(Client.class);
28:
29: logsPath = this .context.substitutedFileItem("logs");
30: final Client client = (Client) this .context.bean();
31: modules = client != null && client.isSetModules() ? client
32: .getModules() : null;
33:
34: if (modules != null) {
35: for (int i = 0; i < modules.sizeOfRepositoryArray(); i++) {
36: String location = modules.getRepositoryArray(i);
37: modules.setRepositoryArray(i, ParameterSubstituter
38: .substitute(location));
39: }
40: }
41: }
42:
43: public FileConfigItem logsPath() {
44: return this .logsPath;
45: }
46:
47: public Modules modules() {
48: return modules;
49: }
50:
51: }
|