summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-08-27 09:09:27 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-08-27 09:09:27 +0200
commit2bf4284d2da271e4f40ef3ee680f1e845b01ca60 (patch)
tree4136786e81481f171b371258b00b4af0a52089f2
parentd62e6fd732ab9223bc92b324d7cdcc9d2e28c109 (diff)
Revert 'layer' from commit 8e8185210f5bd87cb5dcda3a458fe059f811aafc.
This will be implemented as a diff overlay later.
-rw-r--r--src/main/java/com/c2kernel/process/Bootstrap.java25
-rw-r--r--src/main/java/com/c2kernel/process/module/Module.java3
-rw-r--r--src/main/java/com/c2kernel/process/module/ModuleInfo.java1
-rw-r--r--src/main/java/com/c2kernel/utils/LocalObjectLoader.java27
-rw-r--r--src/main/resources/boot/OD/Module.xsd1
-rw-r--r--src/main/resources/boot/property/CAProp.xml1
-rw-r--r--src/main/resources/boot/property/EAProp.xml1
-rw-r--r--src/main/resources/boot/property/ODProp.xml1
-rw-r--r--src/main/resources/boot/property/SCProp.xml1
-rw-r--r--src/main/resources/boot/property/SMProp.xml1
-rw-r--r--src/main/resources/mapFiles/ModuleMap.xml3
11 files changed, 13 insertions, 52 deletions
diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java
index ed15234..46e2cb6 100644
--- a/src/main/java/com/c2kernel/process/Bootstrap.java
+++ b/src/main/java/com/c2kernel/process/Bootstrap.java
@@ -106,7 +106,7 @@ public class Bootstrap
String itemName = thisItem.substring(delim+1);
try {
String location = "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml");
- verifyResource(ns, itemName, 0, itemType, location, 0, reset);
+ verifyResource(ns, itemName, 0, itemType, location, reset);
} catch (Exception e) {
Logger.error(e);
Logger.die("Error importing bootstrap items. Unsafe to continue.");
@@ -115,7 +115,7 @@ public class Bootstrap
}
- public static DomainPath verifyResource(String ns, String itemName, Integer version, String itemType, String dataLocation, int layer, boolean reset) throws Exception {
+ public static DomainPath verifyResource(String ns, String itemName, Integer version, String itemType, String dataLocation, boolean reset) throws Exception {
if (version == null) version = 0;
LookupManager lookupManager = Gateway.getLookupManager();
ResourceImportHandler typeImpHandler = getHandler(itemType);
@@ -127,7 +127,7 @@ public class Bootstrap
Iterator<Path> en = Gateway.getLookup().search(typeImpHandler.getTypeRoot(), itemName);
if (!en.hasNext()) {
Logger.msg("Bootstrap.verifyResource() - "+typeImpHandler.getName()+" "+itemName+" not found. Creating new.");
- thisProxy = createResourceItem(typeImpHandler, itemName, layer, ns);
+ thisProxy = createResourceItem(typeImpHandler, itemName, ns);
}
else {
DomainPath path = (DomainPath)en.next();
@@ -151,15 +151,6 @@ public class Bootstrap
Gateway.getStorage().put(thisProxy.getSystemKey(), new Property("Module", moduleName, false), thisProxy);
}
- // overwrite layer if different
- int currentLayer = -1;
- try {
- String layerProp = thisProxy.getProperty("Layer");
- currentLayer = Integer.parseInt(layerProp);
- } catch (Exception e) { }
- if (currentLayer != layer)
- Gateway.getStorage().put(thisProxy.getSystemKey(), new Property("Layer", String.valueOf(layer), false), thisProxy);
-
if (!modDomPath.equals(path)) { // move item to module subtree
Logger.msg("Module item "+itemName+" found with path "+path.toString()+". Moving to "+modDomPath.toString());
modDomPath.setEntity(new ItemPath(thisProxy.getSystemKey()));
@@ -248,10 +239,9 @@ public class Bootstrap
/**
* @param itemType
* @param itemName
- * @param layer
* @param data
*/
- private static ItemProxy createResourceItem(ResourceImportHandler impHandler, String itemName, int layer, String ns) throws Exception {
+ private static ItemProxy createResourceItem(ResourceImportHandler impHandler, String itemName, String ns) throws Exception {
// create props
PropertyDescriptionList pdList = impHandler.getPropDesc();
PropertyArrayList props = new PropertyArrayList();
@@ -260,12 +250,7 @@ public class Bootstrap
for (int i = 0; i < pdList.list.size(); i++) {
PropertyDescription pd = pdList.list.get(i);
String propName = pd.getName();
- String propVal;
- if (propName.equals("Name"))
- propVal = itemName;
- else if (propName.equals("Layer"))
- propVal = String.valueOf(layer);
- else propVal = pd.getDefaultValue();
+ String propVal = propName.equals("Name")?itemName:pd.getDefaultValue();
props.list.add(new Property(propName, propVal, pd.getIsMutable()));
}
diff --git a/src/main/java/com/c2kernel/process/module/Module.java b/src/main/java/com/c2kernel/process/module/Module.java
index 195c883..1272026 100644
--- a/src/main/java/com/c2kernel/process/module/Module.java
+++ b/src/main/java/com/c2kernel/process/module/Module.java
@@ -57,7 +57,6 @@ public class Module {
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("Layer", String.valueOf(info.layer), true));
moduleItem.properties.add(new com.c2kernel.property.Property("Version", info.version, true));
// Add dependency for all children
ImportDependency children = new ImportDependency("Contents");
@@ -81,7 +80,7 @@ public class Module {
for (ModuleResource thisRes : imports.getResources()) {
try {
thisRes.path = Bootstrap.verifyResource(ns, thisRes.name, thisRes.version,
- thisRes.resourceType, thisRes.resourceLocation, info.layer, reset);
+ thisRes.resourceType, thisRes.resourceLocation, reset);
} catch (Exception ex) {
Logger.error(ex);
Logger.die("Error importing module resources. Unsafe to continue.");
diff --git a/src/main/java/com/c2kernel/process/module/ModuleInfo.java b/src/main/java/com/c2kernel/process/module/ModuleInfo.java
index 646a915..55e02c9 100644
--- a/src/main/java/com/c2kernel/process/module/ModuleInfo.java
+++ b/src/main/java/com/c2kernel/process/module/ModuleInfo.java
@@ -6,7 +6,6 @@ public class ModuleInfo {
public String desc;
public String version;
- public int layer = 0;
public ArrayList<String> dependency = new ArrayList<String>();
public ModuleInfo() {
diff --git a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
index f0d8928..503e951 100644
--- a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
+++ b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
@@ -1,5 +1,5 @@
package com.c2kernel.utils;
-
+
import java.util.Iterator;
import com.c2kernel.common.InvalidDataException;
@@ -24,28 +24,15 @@ public class LocalObjectLoader {
{
DomainPath defRoot = new DomainPath(root);
Iterator<Path> e = Gateway.getLookup().search(defRoot, name);
- ItemProxy defProxy = null; int currentLayer = -1;
- while (e.hasNext()) {
+ if (e.hasNext()) {
DomainPath defPath = (DomainPath)e.next();
- ItemProxy thisProxy = Gateway.getProxyManager().getProxy(defPath);
- int thisLayer;
- try {
- String thisLayerProp = thisProxy.getProperty("Layer");
- thisLayer = Integer.parseInt(thisLayerProp);
- } catch (Exception ex) {
- thisLayer = 0;
- }
- if (thisLayer > currentLayer) {
- currentLayer = thisLayer;
- defProxy = thisProxy;
- }
- else if (thisLayer == currentLayer) {
- throw new ObjectNotFoundException("Duplicate definition for "+name+" in "+root+" found in Layer "+thisLayer, "");
- }
+ if (e.hasNext()) throw new ObjectNotFoundException("Too many matches for "+name+" in "+root, "");
+ return Gateway.getProxyManager().getProxy(defPath);
}
- if (defProxy == null)
+ else {
throw new ObjectNotFoundException("No match for "+name+" in "+root, "");
- return defProxy;
+ }
+
}
static public String getScript(String scriptName, int scriptVersion) throws ObjectNotFoundException {
diff --git a/src/main/resources/boot/OD/Module.xsd b/src/main/resources/boot/OD/Module.xsd
index c768e3f..d25352e 100644
--- a/src/main/resources/boot/OD/Module.xsd
+++ b/src/main/resources/boot/OD/Module.xsd
@@ -9,7 +9,6 @@
<xs:sequence>
<xs:element name="Description" type="xs:string" />
<xs:element name="Version" type="xs:string" />
- <xs:element name="Layer" type="xs:integer" minOccurs="0" default="0"/>
<xs:element name="Dependency" type="xs:string"
minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
diff --git a/src/main/resources/boot/property/CAProp.xml b/src/main/resources/boot/property/CAProp.xml
index b29884a..ac37ae7 100644
--- a/src/main/resources/boot/property/CAProp.xml
+++ b/src/main/resources/boot/property/CAProp.xml
@@ -2,6 +2,5 @@
<PropertyDescription Name="Name" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
<PropertyDescription Name="Complexity" IsClassIdentifier="true" DefaultValue="Composite" IsMutable="false"/>
<PropertyDescription Name="Type" IsClassIdentifier="true" DefaultValue="ActivityDesc" IsMutable="false"/>
- <PropertyDescription Name="Layer" IsClassIdentifier="false" DefaultValue="0" IsMutable="true"/>
<PropertyDescription Name="Module" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
</AllProperties>
diff --git a/src/main/resources/boot/property/EAProp.xml b/src/main/resources/boot/property/EAProp.xml
index 2477c93..a345695 100644
--- a/src/main/resources/boot/property/EAProp.xml
+++ b/src/main/resources/boot/property/EAProp.xml
@@ -2,6 +2,5 @@
<PropertyDescription Name="Name" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
<PropertyDescription Name="Complexity" IsClassIdentifier="true" DefaultValue="Elementary" IsMutable="false"/>
<PropertyDescription Name="Type" IsClassIdentifier="true" DefaultValue="ActivityDesc" IsMutable="false"/>
- <PropertyDescription Name="Layer" IsClassIdentifier="false" DefaultValue="0" IsMutable="true"/>
<PropertyDescription Name="Module" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
</AllProperties>
diff --git a/src/main/resources/boot/property/ODProp.xml b/src/main/resources/boot/property/ODProp.xml
index f4d7b15..894a6ee 100644
--- a/src/main/resources/boot/property/ODProp.xml
+++ b/src/main/resources/boot/property/ODProp.xml
@@ -1,6 +1,5 @@
<AllProperties>
<PropertyDescription Name="Name" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
<PropertyDescription Name="Type" IsClassIdentifier="true" DefaultValue="OutcomeDesc" IsMutable="false"/>
- <PropertyDescription Name="Layer" IsClassIdentifier="false" DefaultValue="0" IsMutable="true"/>
<PropertyDescription Name="Module" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
</AllProperties>
diff --git a/src/main/resources/boot/property/SCProp.xml b/src/main/resources/boot/property/SCProp.xml
index 9ff0366..f5de23c 100644
--- a/src/main/resources/boot/property/SCProp.xml
+++ b/src/main/resources/boot/property/SCProp.xml
@@ -1,6 +1,5 @@
<AllProperties>
<PropertyDescription Name="Name" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
<PropertyDescription Name="Type" IsClassIdentifier="true" DefaultValue="Script" IsMutable="false"/>
- <PropertyDescription Name="Layer" IsClassIdentifier="false" DefaultValue="0" IsMutable="true"/>
<PropertyDescription Name="Module" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
</AllProperties>
diff --git a/src/main/resources/boot/property/SMProp.xml b/src/main/resources/boot/property/SMProp.xml
index f43d0b5..8581e74 100644
--- a/src/main/resources/boot/property/SMProp.xml
+++ b/src/main/resources/boot/property/SMProp.xml
@@ -1,6 +1,5 @@
<AllProperties>
<PropertyDescription Name="Name" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
<PropertyDescription Name="Type" IsClassIdentifier="true" DefaultValue="StateMachine" IsMutable="false"/>
- <PropertyDescription Name="Layer" IsClassIdentifier="false" DefaultValue="0" IsMutable="true"/>
<PropertyDescription Name="Module" IsClassIdentifier="false" DefaultValue="" IsMutable="false"/>
</AllProperties>
diff --git a/src/main/resources/mapFiles/ModuleMap.xml b/src/main/resources/mapFiles/ModuleMap.xml
index 440b852..45f6cbe 100644
--- a/src/main/resources/mapFiles/ModuleMap.xml
+++ b/src/main/resources/mapFiles/ModuleMap.xml
@@ -38,9 +38,6 @@
<field name="version" direct="true" type="string">
<bind-xml name="Version" node="element" />
</field>
- <field name="layer" direct="true" type="integer">
- <bind-xml name="Layer" node="element" />
- </field>
<field name="dependency" collection="arraylist" direct="true"
type="string">
<bind-xml name="Dependency" node="element" />