Skip to content

Commit

Permalink
Add unresolved-ESInputTag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Grunewald committed Feb 20, 2014
1 parent 87ce948 commit 26a7802
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2014-02-20 Martin Grunewald <[email protected]>
* tag V01-07-07
* add Fix bugs in (V)ESInputTag implementation

2014-02-19 Martin Grunewald <[email protected]>
* tag V01-07-06
* add support in GUI for (V)ESInputTag based on work from Sandro
Expand Down
2 changes: 1 addition & 1 deletion src/conf/confdb.version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
confdb.version=V01-07-06
confdb.version=V01-07-07
[email protected]
confdb.url=http://j2eeps.cern.ch/cms-project-confdb-hltdev/
11 changes: 10 additions & 1 deletion src/confdb/data/ESInputTagParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,14 @@ public boolean setValue(String valueAsString)

/** set data */
public void setData(String data) { this.data = data; }


/** unresolved ESInputTags */
public int unresolvedESInputTagCount(IConfiguration config)
{
if ((config.essource(module)==null)&&(config.esmodule(module)==null)) {
return 1;
} else {
return 0;
}
}
}
5 changes: 5 additions & 0 deletions src/confdb/data/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,9 @@ public void remove()
}
}

/** unresolvedESInputTagCount */
public int unresolvedESInputTagCount() {
return unresolvedESInputTagCount(config);
}

}
25 changes: 25 additions & 0 deletions src/confdb/data/PSetParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,31 @@ else if (p instanceof PSetParameter) {
return result;
}

/** number of unresolved ESInputTag parameters in pset */
public int unresolvedESInputTagCount(IConfiguration config)
{
int result = 0;
for (Parameter p : parameters) {
if (p instanceof VPSetParameter) {
VPSetParameter vpset = (VPSetParameter)p;
result += vpset.unresolvedESInputTagCount(config);
}
else if (p instanceof PSetParameter) {
PSetParameter pset = (PSetParameter)p;
result += pset.unresolvedESInputTagCount(config);
}
else if (p instanceof ESInputTagParameter) {
ESInputTagParameter par = (ESInputTagParameter)p;
result += par.unresolvedESInputTagCount(config);
}
else if (p instanceof VESInputTagParameter) {
VESInputTagParameter par = (VESInputTagParameter)p;
result += par.unresolvedESInputTagCount(config);
}
}
return result;
}

/** number of parameters in parameter-set */
public int parameterCount() { return parameters.size(); }

Expand Down
26 changes: 26 additions & 0 deletions src/confdb/data/ParameterContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,30 @@ else if (p instanceof PSetParameter) {
return result;
}

/** nuymber of unresolved ESInputTags */
public int unresolvedESInputTagCount(IConfiguration config)
{
int result = 0;
Iterator<Parameter> itP = parameterIterator();
while (itP.hasNext()) {
Parameter p = itP.next();
if (p instanceof VPSetParameter) {
VPSetParameter vpset = (VPSetParameter)p;
result += vpset.unresolvedESInputTagCount(config);
}
else if (p instanceof PSetParameter) {
PSetParameter pset = (PSetParameter)p;
result += pset.unresolvedESInputTagCount(config);
}
else if (p instanceof ESInputTagParameter) {
ESInputTagParameter par = (ESInputTagParameter)p;
result += par.unresolvedESInputTagCount(config);
}
else if (p instanceof VESInputTagParameter) {
VESInputTagParameter par = (VESInputTagParameter)p;
result += par.unresolvedESInputTagCount(config);
}
}
return result;
}
}
80 changes: 80 additions & 0 deletions src/confdb/data/ReferenceContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ public int unresolvedInputTagCount()
return unresolvedInputTags().length;
}

/** calculate the number of unresolved ESInputTags */
public int unresolvedESInputTagCount()
{
return unresolvedESInputTags().length;
}

/** get unresolved InputTags */
public String[] unresolvedInputTags()
{
Expand All @@ -122,6 +128,15 @@ public String[] unresolvedInputTags()
return unresolved.toArray(new String[unresolved.size()]);
}

/** get unresolved ESInputTags */
public String[] unresolvedESInputTags()
{
ArrayList<String> unresolved = new ArrayList<String>();
for (Reference r : entries)
getUnresolvedESInputTags(r,unresolved,name());
return unresolved.toArray(new String[unresolved.size()]);
}

/** does this container contain an OutputModule? */
public boolean hasOutputModule()
{
Expand Down Expand Up @@ -374,6 +389,71 @@ else if (p instanceof VPSetParameter) {
}


/** get unresolved ESInputTags from a reference, given labels to this point */
private void getUnresolvedESInputTags(Reference r,
ArrayList<String> unresolved,
String prefix)
{
if (r instanceof ModuleReference) {
ModuleReference modref = (ModuleReference)r;
ModuleInstance module = (ModuleInstance)modref.parent();
Iterator<Parameter> it = module.parameterIterator();
while (it.hasNext()) {
Parameter p = it.next();
getUnresolvedESInputTags(p,unresolved,prefix+"/"+module.name());
}
}
else if (r instanceof OutputModuleReference) {
}
else {
ReferenceContainer container = (ReferenceContainer)r.parent();
Iterator<Reference> it = container.entryIterator();
while (it.hasNext()) {
Reference entry = it.next();
getUnresolvedESInputTags(entry,unresolved,prefix+"/"+r.name());
}
}
}

/** get unresolved ESInputTags from a parameter, given labels to this point */
private void getUnresolvedESInputTags(Parameter p,
ArrayList<String> unresolved,
String prefix)
{
if (p instanceof ESInputTagParameter) {
ESInputTagParameter itp = (ESInputTagParameter)p;

if (!itp.isValueSet()||
itp.module().equals(new String())||
itp.module().equals("")) return;

if ( (config.essource(itp.module())==null) || (config.esmodule(itp.module())==null) ) {
unresolved.add(prefix+"::"+itp.name()+"="+itp.valueAsString());
}
}
else if (p instanceof VESInputTagParameter) {
VESInputTagParameter vitp = (VESInputTagParameter)p;
for (int i=0;i<vitp.vectorSize();i++) {
ESInputTagParameter itp =
new ESInputTagParameter("["+(new Integer(i)).toString()+"]",
vitp.value(i).toString(),false);
itp.setParent(vitp);
getUnresolvedESInputTags(itp,unresolved,prefix+"::"+vitp.name());
}
}
else if (p instanceof PSetParameter) {
PSetParameter pset = (PSetParameter)p;
for (int i=0;i<pset.parameterCount();i++)
getUnresolvedESInputTags(pset.parameter(i),unresolved,prefix+"::"+pset.name());
}
else if (p instanceof VPSetParameter) {
VPSetParameter vpset = (VPSetParameter)p;
for (int i=0;i<vpset.parameterSetCount();i++)
getUnresolvedESInputTags(vpset.parameterSet(i),unresolved,prefix+"::"+vpset.name());
}
}


/** add all Path entries to 'paths' array (recursively) */
private void getPathsAmongEntries(Iterator<Reference> itEntry,
ArrayList<Path> paths)
Expand Down
21 changes: 20 additions & 1 deletion src/confdb/data/VESInputTagParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ public Object removeValue(int i)
return result;
}

/** unresolved ESInputTags */
public int unresolvedESInputTagCount(IConfiguration config)
{
int result = 0;
for (ESInputTag tag : values) result += tag.unresolvedESInputTagCount(config);
return result;

}

}


Expand Down Expand Up @@ -203,5 +212,15 @@ public String toString()
}
return result;
}


/** unresolved ESInputTags */
public int unresolvedESInputTagCount(IConfiguration config)
{
if ((config.essource(module)==null)&&(config.esmodule(module)==null)) {
return 1;
} else {
return 0;
}
}

}
10 changes: 10 additions & 0 deletions src/confdb/data/VPSetParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ public int unsetTrackedParameterCount()
return result;
}

/** number of unresolved ESInputTag parameters in vpset */
public int unresolvedESInputTagCount(IConfiguration config)
{
int result = 0;
for (PSetParameter pset : parameterSets) {
result += pset.unresolvedESInputTagCount(config);
}
return result;
}

/** number of parameter set entries */
public int parameterSetCount() { return parameterSets.size(); }

Expand Down
16 changes: 13 additions & 3 deletions src/confdb/gui/ConfigurationTreeRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public String prepareText()
if (node instanceof Instance) {
Instance instance = (Instance)node;
int count = instance.unsetTrackedParameterCount();
int unresolved = instance.unresolvedESInputTagCount();
result="<html>";
if (instance instanceof ESPreferable) {
ESPreferable esp = (ESPreferable)instance;
Expand All @@ -180,12 +181,14 @@ public String prepareText()
}
else result += instance.name();
if (count>0) result += " <font color=#ff0000>["+count+"]</font>";
if (unresolved>0) result += " <font color=#00ff00>["+unresolved+"]</font>";
result+="</html>";
}
else if (node instanceof Path) {
Path path = (Path)node;
int entryCount = path.entryCount();
int unsetCount = path.unsetTrackedParameterCount();
int unresolvedCount = path.unresolvedESInputTagCount();
result = "<html>";
if (!path.isEndPath()&&path.datasetCount()==0)
result += "<font color=#ff0000>"+getText()+"</font>";
Expand All @@ -197,8 +200,9 @@ else if (node instanceof Path) {
"<font color=#ff0000>("+entryCount+")</font>";
if (unsetCount>0)
result += " <font color=#ff0000>["+unsetCount+"]</font>";
if (unresolvedCount>0) result += " <font color=#00ff00>["+unresolvedCount+"]</font>";
if (doDisplayUnresolvedInputTags) {
int unresolvedCount = path.unresolvedInputTagCount();
unresolvedCount = path.unresolvedInputTagCount();
if (unresolvedCount>0)
result+=" <font color=#0000ff>["+unresolvedCount+"]</font>";
}
Expand All @@ -211,40 +215,46 @@ else if (node instanceof PathReference) {
Path path = (Path)reference.parent();
int entryCount = path.entryCount();
int count = path.unsetTrackedParameterCount();
int unresolved = path.unresolvedESInputTagCount();
result = "<html>" + reference.getOperatorAndName();
result += (entryCount>0) ? "("+entryCount+")":
"<font color=#ff0000>("+entryCount+")</font>";
if (count>0) result += " <font color=#ff0000>["+count+"]</font>";
if (unresolved>0) result += " <font color=#00ff00>["+unresolved+"]</font>";
result += "</html>";
}
else if (node instanceof Sequence) {
Sequence sequence = (Sequence)node;
int refCount = sequence.parentPaths().length;
int entryCount = sequence.entryCount();
int count = sequence.unsetTrackedParameterCount();
int unresolved = sequence.unresolvedESInputTagCount();
result = (refCount>0) ?
"<html>"+getText() :
"<html><font color=#808080>"+getText()+"</font>";
result += (entryCount>0) ?
" ("+entryCount+")":"<font color=#ff0000>("+entryCount+")</font>";
if (count>0) result += " <font color=#ff0000>["+count+"]</font>";
if (unresolved>0) result += " <font color=#00ff00>["+unresolved+"]</font>";
result += "</html>";
}
else if (node instanceof SequenceReference) {
SequenceReference reference = (SequenceReference)node;
Sequence sequence = (Sequence)reference.parent();
int entryCount = sequence.entryCount();
int count = sequence.unsetTrackedParameterCount();
int unresolved = sequence.unresolvedESInputTagCount();
result = "<html>" + reference.getOperatorAndName();
result += (entryCount>0) ?
" ("+entryCount+")":
"<font color=#ff0000>("+entryCount+")</font>";
if (count>0) result += " <font color=#ff0000>["+count+"]</font>";
if (unresolved>0) result += " <font color=#00ff00>["+unresolved+"]</font>";
if (doDisplayUnresolvedInputTags && (xpath != null)) {
int n=0;
String label = ((Reference)node).name();
String[] unresolved = xpath.unresolvedInputTags();
for (String un : unresolved) {
String[] Unresolved = xpath.unresolvedInputTags();
for (String un : Unresolved) {
String[] tokens = un.split("[/:]");
for (int i=0; i<tokens.length; i++) {
if (label.equals(tokens[i])) {
Expand Down

0 comments on commit 26a7802

Please sign in to comment.