diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-12-12 14:13:36 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-12-12 14:13:36 +0100 |
| commit | 428d828ca640d1348979f9982d1c0bc0a489a3b4 (patch) | |
| tree | a40b0f8fa46942f5e9d4c805a4df724ee5a5aa6b /src/main/java/com/c2kernel/process | |
| parent | d5d65f58e69424d898f88e8304a49f147d4036f6 (diff) | |
Properties preserve and respect the PropertyDescription 'isMutable'
property. This setting prevents the WriteProperty predefined step from
changing the property value when isMutable is false. WriteProperty also
requires the selected property to already exist - they should be created
either during Item instantiation or using AddC2KObject.
LDAPPropertyManager prepends the Property name in its entries with ! if
they are non mutable.
Various places around the kernel that create properties now set the
mutable field.
Fixes #150
Diffstat (limited to 'src/main/java/com/c2kernel/process')
| -rw-r--r-- | src/main/java/com/c2kernel/process/Bootstrap.java | 16 | ||||
| -rw-r--r-- | src/main/java/com/c2kernel/process/module/Module.java | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index b37cc8a..51b98b0 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -175,7 +175,7 @@ public class Bootstrap PropertyDescription pd = pdList.list.get(i);
String propName = pd.getName();
String propVal = propName.equals("Name")?itemName:pd.getDefaultValue();
- props.list.add(new Property(propName, propVal));
+ props.list.add(new Property(propName, propVal, pd.getIsMutable()));
}
CompositeActivity ca = new CompositeActivity();
@@ -259,8 +259,8 @@ public class Bootstrap // assign admin role
Logger.msg("Bootstrap.checkAgent() - Assigning role '"+role+"'");
rolePath.addAgent(agentPath);
- Gateway.getStorage().put(agentPath.getSysKey(), new Property("Name", name), null);
- Gateway.getStorage().put(agentPath.getSysKey(), new Property("Type", "Agent"), null);
+ Gateway.getStorage().put(agentPath.getSysKey(), new Property("Name", name, true), null);
+ Gateway.getStorage().put(agentPath.getSysKey(), new Property("Type", "Agent", false), null);
Logger.msg("Bootstrap.checkAgent() - Done");
} catch (Exception ex) {
Logger.error("Unable to create "+name+" user.");
@@ -298,14 +298,14 @@ public class Bootstrap thisServerPath.setEntity(serverEntity);
Gateway.getLDAPLookup().add(thisServerPath);
}
- Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Name", serverName), null);
- Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Type", "Server"), null);
- Gateway.getStorage().put(serverEntity.getSysKey(), new Property("KernelVersion", Resource.getKernelVersion()), null);
+ Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Name", serverName, false), null);
+ Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Type", "Server", false), null);
+ Gateway.getStorage().put(serverEntity.getSysKey(), new Property("KernelVersion", Resource.getKernelVersion(), true), null);
if (Gateway.getProperty("ItemServer.Proxy.port") != null)
Gateway.getStorage().put(serverEntity.getSysKey(),
- new Property("ProxyPort", Gateway.getProperty("ItemServer.Proxy.port")), null);
+ new Property("ProxyPort", Gateway.getProperty("ItemServer.Proxy.port"), true), null);
Gateway.getStorage().put(serverEntity.getSysKey(),
- new Property("ConsolePort", String.valueOf(Logger.getConsolePort())), null);
+ new Property("ConsolePort", String.valueOf(Logger.getConsolePort()), true), null);
Gateway.getProxyManager().connectToProxyServer(Gateway.getProperty("ItemServer.name"), Integer.parseInt(Gateway.getProperty("ItemServer.Proxy.port")));
}
diff --git a/src/main/java/com/c2kernel/process/module/Module.java b/src/main/java/com/c2kernel/process/module/Module.java index d0a017c..58cf503 100644 --- a/src/main/java/com/c2kernel/process/module/Module.java +++ b/src/main/java/com/c2kernel/process/module/Module.java @@ -53,10 +53,10 @@ public class Module { public void addModuleItem(String moduleXML) {
NewItem moduleItem = new NewItem(name, "/desc/modules/", "ModuleWorkflow");
// Module properties
- moduleItem.properties.add(new com.c2kernel.property.Property("Namespace", ns));
- moduleItem.properties.add(new com.c2kernel.property.Property("Name", name));
- moduleItem.properties.add(new com.c2kernel.property.Property("Type", "Module"));
- moduleItem.properties.add(new com.c2kernel.property.Property("Version", info.version));
+ moduleItem.properties.add(new com.c2kernel.property.Property("Namespace", ns, false));
+ moduleItem.properties.add(new com.c2kernel.property.Property("Name", name, false));
+ moduleItem.properties.add(new com.c2kernel.property.Property("Type", "Module", false));
+ moduleItem.properties.add(new com.c2kernel.property.Property("Version", info.version, true));
// Add dependency for all children
Dependency children = new Dependency("Contents");
for (ModuleImport thisImport : imports.list) {
|
