use of alma.ACSErr.NameValue in project ACS by ACS-Community.
the class AcsJException method getNameValueArray.
/**
* To be used by {@link #getErrorTrace()} or whoever else
* cares about a <code>NameValue[]</code>.
*/
public NameValue[] getNameValueArray() {
NameValue[] nameValArray = new NameValue[m_properties.size()];
int count = 0;
for (Iterator iter = m_properties.keySet().iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String value = m_properties.getProperty(key);
NameValue nameVal = new NameValue(key, value);
nameValArray[count] = nameVal;
count++;
}
return nameValArray;
}
use of alma.ACSErr.NameValue in project ACS by ACS-Community.
the class CompletionEventPublisherClient method publishEvent.
/**
* Publish a {@link StructWithACompletion}.
*
* At the present this tests shall pass because of the workaround described
* in the ticket (i.e. added another typedef for for the sequence in the
* {@link Completion}).
*/
private void publishEvent() {
m_logger.info("Going to publish an event");
// Create and initialize an event with a Completion
Completion c = new Completion();
c.code = 100;
c.timeStamp = System.currentTimeMillis();
c.type = 101;
// ICT-3870 error happens also without any ErorTrace in the previuError property
// of the COmpletion but this way it is more compete
ErrorTrace event = new ErrorTrace();
event.previousError = new ErrorTrace[0];
event.errorCode = 1;
event.errorType = 2;
event.file = "filename";
event.host = "hostname";
event.lineNum = 3;
event.process = "processname";
event.routine = "reoutinename";
event.severity = Severity.Alert;
NameValue nv = new NameValue();
nv.name = "NameValue name";
nv.value = "NameValue value";
event.data = new NameValue[0];
event.shortDescription = "short desc";
event.sourceObject = "src obj";
event.thread = "thread name";
event.timeStamp = System.currentTimeMillis();
c.previousError = new ErrorTrace[1];
c.previousError[0] = event;
try {
m_supplier.publishEvent(c);
m_logger.info("Event successfull published.");
} catch (Throwable t) {
m_logger.log(AcsLogLevel.ERROR, "Error publishing the event with a Completion", t);
}
}
use of alma.ACSErr.NameValue in project ACS by ACS-Community.
the class ErrorTraceManipulator method setProperty.
public static String setProperty(ErrorTrace et, String key, String value) {
String oldValue = null;
boolean alreadyThere = false;
if (et.data != null) {
for (int i = 0; i < et.data.length; i++) {
NameValue nv = et.data[i];
if (nv.name.equals(key)) {
alreadyThere = true;
oldValue = nv.value;
nv.value = value;
break;
}
}
}
if (!alreadyThere) {
NameValue[] oldNVs = et.data;
int oldLength = 0;
if (oldNVs == null) {
et.data = new NameValue[1];
} else {
oldLength = oldNVs.length;
et.data = new NameValue[oldLength + 1];
System.arraycopy(oldNVs, 0, et.data, 0, oldLength);
}
et.data[oldLength] = new NameValue(key, value);
}
return oldValue;
}
Aggregations