You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/30 05:44:15 UTC
svn commit: r398278 - in /geronimo/branches/1.1/modules:
deployment/src/test/org/apache/geronimo/deployment/
kernel/src/java/org/apache/geronimo/kernel/config/
Author: ammulder
Date: Sat Apr 29 20:44:14 2006
New Revision: 398278
URL: http://svn.apache.org/viewcvs?rev=398278&view=rev
Log:
Add child configurations to ConfigurationInfo
Modified:
geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Modified: geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=398278&r1=398277&r2=398278&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java Sat Apr 29 20:44:14 2006
@@ -134,7 +134,7 @@
touch(watchFile1, NOW);
touch(watchFile2, NOW);
- existingConfigurationInfos.add(new ConfigurationInfo(null, NEW_ID, ConfigurationModuleType.CAR, PAST, null, dir));
+ existingConfigurationInfos.add(new ConfigurationInfo(null, NEW_ID, ConfigurationModuleType.CAR, PAST, null, null, dir));
SingleFileHotDeployer singleFileHotDeployer = new SingleFileHotDeployer(dir,
watchPaths,
@@ -158,7 +158,7 @@
touch(watchFile1, NOW);
touch(watchFile2, NOW);
- existingConfigurationInfos.add(new ConfigurationInfo(null, DIFFERENT_ID, ConfigurationModuleType.CAR, PAST, null, dir));
+ existingConfigurationInfos.add(new ConfigurationInfo(null, DIFFERENT_ID, ConfigurationModuleType.CAR, PAST, null, null, dir));
SingleFileHotDeployer singleFileHotDeployer = new SingleFileHotDeployer(dir,
watchPaths,
@@ -182,7 +182,7 @@
touch(watchFile1, NOW);
touch(watchFile2, NOW);
- existingConfigurationInfos.add(new ConfigurationInfo(null, OLD_VERSION_ID, ConfigurationModuleType.CAR, PAST, null, dir));
+ existingConfigurationInfos.add(new ConfigurationInfo(null, OLD_VERSION_ID, ConfigurationModuleType.CAR, PAST, null, null, dir));
SingleFileHotDeployer singleFileHotDeployer = new SingleFileHotDeployer(dir,
watchPaths,
@@ -206,7 +206,7 @@
touch(watchFile1, PAST);
touch(watchFile2, PAST);
- existingConfigurationInfos.add(new ConfigurationInfo(null, NEW_ID, ConfigurationModuleType.CAR, NOW, null, dir));
+ existingConfigurationInfos.add(new ConfigurationInfo(null, NEW_ID, ConfigurationModuleType.CAR, NOW, null, null, dir));
SingleFileHotDeployer singleFileHotDeployer = new SingleFileHotDeployer(dir,
watchPaths,
@@ -230,7 +230,7 @@
touch(watchFile1, PAST);
touch(watchFile2, PAST);
- existingConfigurationInfos.add(new ConfigurationInfo(null, OLD_VERSION_ID, ConfigurationModuleType.CAR, NOW, null, dir));
+ existingConfigurationInfos.add(new ConfigurationInfo(null, OLD_VERSION_ID, ConfigurationModuleType.CAR, NOW, null, null, dir));
SingleFileHotDeployer singleFileHotDeployer = new SingleFileHotDeployer(dir,
watchPaths,
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java?rev=398278&r1=398277&r2=398278&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java Sat Apr 29 20:44:14 2006
@@ -38,36 +38,19 @@
private final long created;
private final File inPlaceLocation;
private final Set ownedConfigurations = new LinkedHashSet();
+ private final Set childConfigurations = new LinkedHashSet();
private final State state;
private final Artifact parentID;
- public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, File inPlaceLocation) {
- this.storeName = storeName;
- this.configID = configID;
- this.type = type;
- this.created = created;
- this.inPlaceLocation = inPlaceLocation;
- if (ownedConfigurations != null) {
- this.ownedConfigurations.addAll(ownedConfigurations);
- }
- state = null;
- parentID = null;
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, Set childConfigurations, File inPlaceLocation) {
+ this(storeName, configID, type, created, ownedConfigurations, childConfigurations, inPlaceLocation, null, null);
}
- public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, File inPlaceLocation, State state) {
- this.storeName = storeName;
- this.configID = configID;
- this.type = type;
- this.created = created;
- this.inPlaceLocation = inPlaceLocation;
- if (ownedConfigurations != null) {
- this.ownedConfigurations.addAll(ownedConfigurations);
- }
- this.state = state;
- parentID = null;
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, Set childConfigurations, File inPlaceLocation, State state) {
+ this(storeName, configID, type, created, ownedConfigurations, childConfigurations, inPlaceLocation, state, null);
}
- public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, File inPlaceLocation, State state, Artifact parentID) {
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type, long created, Set ownedConfigurations, Set childConfigurations, File inPlaceLocation, State state, Artifact parentID) {
this.storeName = storeName;
this.configID = configID;
this.type = type;
@@ -76,6 +59,9 @@
if (ownedConfigurations != null) {
this.ownedConfigurations.addAll(ownedConfigurations);
}
+ if (childConfigurations != null) {
+ this.childConfigurations.addAll(childConfigurations);
+ }
this.state = state;
this.parentID = parentID;
}
@@ -102,6 +88,10 @@
public Set getOwnedConfigurations() {
return ownedConfigurations;
+ }
+
+ public Set getChildConfigurations() {
+ return childConfigurations;
}
public State getState() {
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=398278&r1=398277&r2=398278&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Sat Apr 29 20:44:14 2006
@@ -168,31 +168,42 @@
}
public static void writeConfigInfo(PrintWriter writer, ConfigurationData configurationData) {
- writer.println("id=" + configurationData.getId());
- writer.println("type=" + configurationData.getModuleType());
- writer.println("created=" + configurationData.getCreated());
+ writeConfigInfo("", writer, configurationData);
+ }
+ private static void writeConfigInfo(String prefix, PrintWriter writer, ConfigurationData configurationData) {
+ writer.println(prefix+"id=" + configurationData.getId());
+ writer.println(prefix+"type=" + configurationData.getModuleType());
+ writer.println(prefix+"created=" + configurationData.getCreated());
Set ownedConfigurations = configurationData.getOwnedConfigurations();
int i = 0;
for (Iterator iterator = ownedConfigurations.iterator(); iterator.hasNext();) {
Artifact ownedConfiguration = (Artifact) iterator.next();
- writer.println("owned.configuration." + i++ + "=" + ownedConfiguration);
+ writer.println(prefix+"owned." + i++ + "=" + ownedConfiguration);
+ }
+ i = 0;
+ for (Iterator it = configurationData.getChildConfigurations().values().iterator(); it.hasNext(); i++) {
+ ConfigurationData data = (ConfigurationData) it.next();
+ writeConfigInfo("child."+i+".", writer, data);
}
+ writer.flush();
}
public static ConfigurationInfo readConfigurationInfo(InputStream in, AbstractName storeName, File inPlaceLocation) throws IOException {
Properties properties = new Properties();
properties.load(in);
-
- String id = properties.getProperty("id");
+ return readConfigurationInfo("", properties, storeName, inPlaceLocation);
+ }
+ private static ConfigurationInfo readConfigurationInfo(String prefix, Properties properties, AbstractName storeName, File inPlaceLocation) throws IOException {
+ String id = properties.getProperty(prefix+"id");
Artifact configId = Artifact.create(id);
- String type = properties.getProperty("type");
+ String type = properties.getProperty(prefix+"type");
ConfigurationModuleType moduleType = ConfigurationModuleType.getByName(type);
if (moduleType == null) {
throw new IllegalArgumentException("Unknown module type: " + type);
}
- String created = properties.getProperty("created");
+ String created = properties.getProperty(prefix+"created");
long time;
try {
time = Long.parseLong(created);
@@ -204,13 +215,25 @@
for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
- if (name.startsWith("owned.configuration.")) {
+ if (name.startsWith(prefix+"owned.")) {
String value = (String) entry.getValue();
Artifact ownedConfiguration = Artifact.create(value);
ownedConfigurations.add(ownedConfiguration);
}
}
- return new ConfigurationInfo(storeName, configId, moduleType, time, ownedConfigurations, inPlaceLocation);
+ LinkedHashSet childConfigurations = new LinkedHashSet();
+ int test = 0;
+ while(true) {
+ String next = prefix+"child."+test+".";
+ String value = properties.getProperty(next+".id");
+ if(value == null) {
+ break;
+ }
+ childConfigurations.add(readConfigurationInfo(next, properties, storeName, inPlaceLocation));
+ ++test;
+ }
+
+ return new ConfigurationInfo(storeName, configId, moduleType, time, ownedConfigurations, childConfigurations, inPlaceLocation);
}
/**
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=398278&r1=398277&r2=398278&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Sat Apr 29 20:44:14 2006
@@ -174,6 +174,7 @@
configurationInfo.getType(),
configurationInfo.getCreated(),
configurationInfo.getOwnedConfigurations(),
+ configurationInfo.getChildConfigurations(),
configurationInfo.getInPlaceLocation(),
State.RUNNING);
} else {
@@ -182,6 +183,7 @@
configurationInfo.getType(),
configurationInfo.getCreated(),
configurationInfo.getOwnedConfigurations(),
+ configurationInfo.getChildConfigurations(),
configurationInfo.getInPlaceLocation(),
State.STOPPED);
}