Skip to content
Snippets Groups Projects
Commit 8ba776eb authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

release

parent de3010ce
No related branches found
No related tags found
No related merge requests found
Showing
with 250 additions and 247 deletions
......@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
......
......@@ -27,11 +27,4 @@
<nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>ArchivingConf</name>
<type>2</type>
<location>C:/SOLEIL_ROOT/tango-soleil-win32-5.5.8RC3/tango/bin/ArchivingConf</location>
</link>
</linkedResources>
</projectDescription>
......@@ -13,7 +13,7 @@
<artifactId>hdbtdbArchivingServers</artifactId>
<name>hdbtdbArchivingServers</name>
<version>2.2.15</version>
<version>2.3.0</version>
<scm>
<connection>${scm.connection.svn.tango-cs}:archiving/server/hdbtdbArchivingServers</connection>
......@@ -42,6 +42,10 @@
<groupId>org.tango</groupId>
<artifactId>TangORB-javadao</artifactId>
</dependency>
<dependency>
<groupId>org.tango</groupId>
<artifactId>JTangoCommons</artifactId>
</dependency>
<dependency>
<groupId>fr.esrf.atk</groupId>
<artifactId>ATKCore</artifactId>
......
package Common.Archiver.Collector;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import fr.esrf.TangoDs.Util;
import fr.esrf.tangoatk.core.AttributePolledList;
import fr.esrf.tangoatk.core.ErrorEvent;
import fr.esrf.tangoatk.core.IAttribute;
import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ScalarEvent;
public abstract class ArchiverCollector {
/**
* This list is the list used by the refresher of the Collector
*/
protected final AttributePolledList attributeList = new AttributePolledList();
// This hashtable contains the mode counters by attribute
private final Map<String, ModesCounters> attributeModeCounterMap = new HashMap<String, ModesCounters>();
// Diary file
protected ILogger m_logger;
protected ILogger logger;
/**
* An ModeHandler is associated to each Collector to handle the archiving
......@@ -19,19 +31,24 @@ public abstract class ArchiverCollector {
*/
protected ModeHandler m_modeHandler;
/**
* This field represent the refreshing rate of the Collector
*/
private boolean refreshing;
public ArchiverCollector(ModeHandler modeHandler) {
m_modeHandler = modeHandler;
}
public void setDiaryLogger(ILogger _logger) {
this.m_logger = _logger;
this.logger = _logger;
}
/* Allows to indicate to the collector that a new attribute must be managed */
protected synchronized void addAttribute(String name) {
String lower = name.toLowerCase();
if (attributeModeCounterMap.containsKey(lower)) {
m_logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
+ "already exists in the map ==> Counter Re-init");
attributeModeCounterMap.get(lower).init();
} else {
......@@ -71,11 +88,121 @@ public abstract class ArchiverCollector {
doArchive = m_modeHandler.isDataArchivable(mc, dataType, readValueObject, lastValueObject);
} catch (Exception e) {
e.printStackTrace();
this.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
this.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
+ " with the value of " + attCompleteName);
}
return doArchive;
}
/**
* Triggers the collecting action of this HdbCollector.
*/
protected synchronized void startCollecting() {
if (!attributeList.isEmpty()) {
if (!attributeList.isRefresherStarted()) {
attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
attributeList.setSynchronizedPeriod(true);
attributeList.startRefresher();
refreshing = true;
logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " start refresh for " + attributeList.getSize()
+ " attributes");
} else {
// force a refresh for newly added attributes
attributeList.refresh();
logger.trace(ILogger.LEVEL_DEBUG, "FORCING refresh for " + this.getClass());
}
}
}
/**
* Stops the collecting action of this TdbCollector.
*/
protected synchronized void stopCollecting() {
try {
logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " stop refresh on " + attributeList.getSize()
+ " attributes");
attributeList.stopRefresher();
refreshing = false;
} catch (final Exception e) {
Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "TdbCollector.stopCollecting" + "\r\n"
+ "\t Reason : \t " + e.getClass().getName() + "\r\n" + "\t Description : \t " + e.getMessage()
+ "\r\n" + "\t Additional information : \t " + "" + "\r\n");
e.printStackTrace();
}
}
/**
* Returns a boolean to know whether the attribute list is empty or not
*
* @return A boolean to know whether the attribute list is empty or not
*/
public boolean hasEmptyList() {
return attributeList.isEmpty();
}
public synchronized short[] loadAssessment() {
final short[] ret = new short[3];
final Enumeration<?> myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
final IAttribute nextAttr = (IAttribute) myAttList.nextElement();
final int X = nextAttr.getMaxXDimension();
final int Y = nextAttr.getMaxYDimension();
short type = 0;
if (X > 1) {
type++;
}
if (Y > 1) {
type++;
}
ret[type]++;
}
return ret;
}
public List<String> getAttributeList() {
final List<String> attributeListResult = new ArrayList<String>();
final Enumeration<?> myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
final IAttribute attr = (IAttribute) myAttList.nextElement();
attributeListResult.add(attr.getName());
}
return attributeListResult;
}
public synchronized boolean isCollected(String attributeName) {
boolean isCollected = false;
final Enumeration<?> myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
final IAttribute attr = (IAttribute) myAttList.nextElement();
if (attr.getName().equalsIgnoreCase(attributeName)) {
isCollected = true;
break;
}
}
return isCollected;
}
public synchronized String assessment() {
final StringBuffer ass = new StringBuffer();
ass.append("Collector Reference : " + toString() + "\r\n");
ass.append("Activity (refreshing) : " + isRefreshing() + "\r\n");
ass.append("Mode : " + "\r\n" + m_modeHandler.getMode().toString() + "\r\n");
ass.append("Attribute list (" + attributeList.getSize() + "): " + "\r\n");
final Enumeration<?> myAttList = attributeList.elements();
int i = 1;
while (myAttList.hasMoreElements()) {
final IAttribute iNumberScalar = (IAttribute) myAttList.nextElement();
ass.append("\t" + i++ + "\t" + iNumberScalar.getName() + "\r\n");
}
return ass.toString();
}
public boolean isRefreshing() {
return refreshing;
}
}
......@@ -342,11 +342,6 @@ public class DbProxy implements IDbProxy {
}
public void updateModeRecord(final AttributeLightMode attributeLightMode) throws ArchivingException {
manager.getDataBase().getMode().updateModeRecord(attributeLightMode.getAttribute_complete_name());
}
public void updateModeRecord(final String att_name) throws ArchivingException {
manager.getDataBase().getMode().updateModeRecord(att_name);
}
......@@ -356,26 +351,13 @@ public class DbProxy implements IDbProxy {
}
public Vector<AttributeLightMode> getArchiverCurrentTasks(final String archiverName) throws ArchivingException {
Util.out4.println("DbProxy.getArchiverCurrentTasks");
// Vector<AttributeLightMode> archiverCurrentTasks = new
// Vector<AttributeLightMode>();
final boolean facility = manager.isM_Facility();
try {
final Vector<AttributeLightMode> archiverCurrentTasks = manager
.getDataBase()
.getMode()
.getArchiverCurrentTasks(
(facility ? "//" + new Database().get_tango_host() + "/" : "") + archiverName);
// System.out.println("Current Tasks - " +
// archiverCurrentTasks.size() + ": ");
// for (int i = 0; i < archiverCurrentTasks.size(); i++) {
// final AttributeLightMode attributeLightMode =
// archiverCurrentTasks.elementAt(i);
// System.out.println("******************* " + (i + 1)
// + " *******************");
// System.out.println(attributeLightMode);
// }
return archiverCurrentTasks;
} catch (final DevFailed devFailed) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + GlobalConst.DBT_UNREACH_EXCEPTION;
......
......@@ -121,19 +121,15 @@
package HdbArchiver.Collector;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import Common.Archiver.Collector.ArchiverCollector;
import HdbArchiver.HdbArchiver;
import fr.esrf.Tango.DevFailed;
import fr.esrf.TangoDs.Util;
import fr.esrf.tangoatk.core.AttributePolledList;
import fr.esrf.tangoatk.core.ErrorEvent;
import fr.esrf.tangoatk.core.IAttribute;
import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingEvent;
import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingException;
......@@ -142,16 +138,8 @@ import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.LimitedStack;
import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ScalarEvent;
public abstract class HdbCollector extends ArchiverCollector {
/**
* This list is the list used by the refresher of the Collector
*/
protected final AttributePolledList attributeList = new AttributePolledList();
/**
* This field represent the refreshing rate of the Collector
*/
protected boolean refreshing;
protected boolean isFirstValue;
protected volatile Map<String, Boolean> isFirstValueList = new ConcurrentHashMap<String, Boolean>();
/**
* This parameter specify the number of time a Collector retry the archiving
......@@ -182,17 +170,21 @@ public abstract class HdbCollector extends ArchiverCollector {
public HdbCollector(final HdbModeHandler _modeHandler) {
super(_modeHandler);
isFirstValue = true;
}
protected abstract void addSourceForPolling(final AttributeLightMode attributeLightMode) throws ArchivingException;
protected abstract void addSourceForEvents(final AttributeLightMode attributeLightMode) throws ArchivingException;
/**
* Returns a boolean to know whether the attribute list is empty or not
* Removes an attribute from the list of the attributes for which is
* responsible this HdbCollector. If the attribute was registered for the
* archive events, we unsubscribe from it.
*
* @return A boolean to know whether the attribute list is empty or not
* @param attributeName
* @throws ArchivingException
*/
public boolean hasEmptyList() {
return attributeList.isEmpty();
}
public abstract void removeSource(String attributeName) throws ArchivingException;
protected void setLastValue(final ScalarEvent scalarEvent, final Object lastValue) {
setLastTimestamp(scalarEvent);
......@@ -211,7 +203,7 @@ public abstract class HdbCollector extends ArchiverCollector {
*/
public void addSource(final AttributeLightMode attributeLightMode) throws ArchivingException {
isFirstValue = true;
isFirstValueList.put(attributeLightMode.getAttribute_complete_name().toLowerCase(), true);
if (HdbArchiver.isUseEvents) {
addSourceForEvents(attributeLightMode);
} else {
......@@ -219,56 +211,6 @@ public abstract class HdbCollector extends ArchiverCollector {
}
}
protected abstract void addSourceForPolling(final AttributeLightMode attributeLightMode) throws ArchivingException;
protected abstract void addSourceForEvents(final AttributeLightMode attributeLightMode) throws ArchivingException;
/**
* Removes an attribute from the list of the attributes for which is
* responsible this HdbCollector. If the attribute was registered for the
* archive events, we unsubscribe from it.
*
* @param attributeName
* @throws ArchivingException
*/
public abstract void removeSource(String attributeName) throws ArchivingException;
/**
* Triggers the collecting action of this HdbCollector.
*/
public synchronized void startCollecting() {
if (!attributeList.isEmpty()) {
if (attributeList.size() == 1) {
attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
attributeList.setSynchronizedPeriod(true);
attributeList.startRefresher();
refreshing = true;
} else {
// force a refresh for newly added attributes
attributeList.refresh();
}
}
}
/**
* Stops the collecting action of this HdbCollector.
*/
public synchronized void stopCollecting() {
Util.out4.println("HdbCollector.stopCollecting");
m_logger.trace(ILogger.LEVEL_INFO, "HdbCollector.stopCollecting");
try {
if (attributeList.isEmpty()) {
attributeList.stopRefresher();
refreshing = false;
}
} catch (final Exception e) {
Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "HdbCollector.stopCollecting" + "\r\n"
+ "\t Reason : \t " + "UNKNOWN_ERROR" + "\r\n" + "\t Description : \t " + e.getMessage() + "\r\n"
+ "\t Additional information : \t " + "" + "\r\n");
e.printStackTrace();
}
}
public void errorChange(final ErrorEvent errorEvent) {
final long temp = System.currentTimeMillis();
Util.out4.println("\n" + this.getClass().toString() + " (" + temp + ")" + "\n\t Source \t : "
......@@ -277,25 +219,6 @@ public abstract class HdbCollector extends ArchiverCollector {
}
public synchronized String assessment() {
final StringBuffer ass = new StringBuffer();
ass.append("Collector Reference : " + toString() + "\r\n");
ass.append("Activity (refreshing) : " + isRefreshing() + "\r\n");
ass.append("Mode : " + "\r\n" + m_modeHandler.getMode().toString() + "\r\n");
ass.append("Attribute list (" + attributeList.getSize() + "): " + "\r\n");
final Enumeration myAttList = attributeList.elements();
int i = 1;
while (myAttList.hasMoreElements()) {
final IAttribute iNumberScalar = (IAttribute) myAttList.nextElement();
ass.append("\t" + i++ + "\t" + iNumberScalar.getName() + "\r\n");
}
return ass.toString();
}
public boolean isRefreshing() {
return refreshing;
}
protected void setLastTimestamp(final ArchivingEvent scalarEvent) {
if (scalarEvent != null) {
final String name = scalarEvent.getAttribute_complete_name();
......@@ -325,7 +248,7 @@ public abstract class HdbCollector extends ArchiverCollector {
final long newTime = archivingEvent.getTimeStamp();
if (newTime == 0) {
m_logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
+ " - tableName: " + archivingEvent.getTable_name());
return false;
}
......@@ -335,10 +258,10 @@ public abstract class HdbCollector extends ArchiverCollector {
return true;
}
final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, m_logger);
final boolean isValidDate = lastTimestampStack.validateDate(newTime, m_logger);
final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, logger);
final boolean isValidDate = lastTimestampStack.validateDate(newTime, logger);
if (isAlreadyRegisteredDate || !isValidDate) {
m_logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
+ " - timestamp: " + new Timestamp(newTime));
return false;
}
......@@ -346,38 +269,6 @@ public abstract class HdbCollector extends ArchiverCollector {
return true;
}
public synchronized short[] loadAssessment() {
final short[] ret = new short[3];
final Enumeration myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
final IAttribute nextAttr = (IAttribute) myAttList.nextElement();
final int X = nextAttr.getMaxXDimension();
final int Y = nextAttr.getMaxYDimension();
short type = 0;
if (X > 1) {
type++;
}
if (Y > 1) {
type++;
}
ret[type]++;
}
return ret;
}
public List<String> getAttributeList() {
final List<String> attributeListResult = new ArrayList<String>();
final Enumeration<?> myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
final IAttribute attr = (IAttribute) myAttList.nextElement();
attributeListResult.add(attr.getName());
}
return attributeListResult;
}
public void setDbProxy(final DbProxy _dbProxy) {
dbProxy = _dbProxy;
}
......
......@@ -171,6 +171,17 @@ public class HdbCollectorFactory {
return tableCollector.get(superMode);
}
public HdbCollector get(final String attributeName) {
HdbCollector result = null;
for (HdbCollector collector : tableCollector.values()) {
if (collector.isCollected(attributeName)) {
result = collector;
break;
}
}
return result;
}
/**
* This method create a new HdbCollector instance if required associated to
* an attribute. In this method, attributes are not grouped by mode.
......@@ -450,7 +461,7 @@ public class HdbCollectorFactory {
for (final Map.Entry<SuperMode, HdbCollector> entry : tableCollector.entrySet()) {
final SuperMode mode = entry.getKey();
final HdbCollector collector = entry.getValue();
if (collector.getAttributeList().contains(attributeName)) {
if (collector.isCollected(attributeName)) {
collector.removeSource(attributeName);
}
if (collector.hasEmptyList()) {
......
......@@ -203,8 +203,8 @@ public class Image_RO extends HdbCollector implements IImageListener {
super.setLastTimestamp(snapImageEvent_RO);
} catch (final Exception e) {
final String message = "Problem (ArchivingException) storing Image_RO value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......
......@@ -130,7 +130,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
evtAdaptHMap = new HashMap<Device, TangoEventsAdapter>();
}
/* synchronized */@Override
@Override
public synchronized void removeSource(final String attributeName) throws ArchivingException {
Util.out2.println("BooleanScalar.removeSource");
......@@ -143,20 +143,18 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
* while ( ( IBooleanScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IBooleanScalar attribute = (IBooleanScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeBooleanScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -165,6 +163,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -175,6 +175,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
stopCollecting();
final IBooleanScalar attribute = (IBooleanScalar) attributeList.add(attName);
attribute.addBooleanScalarListener(this);
attribute.addErrorListener(this);
......@@ -183,12 +184,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -203,6 +200,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -361,14 +360,14 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -382,8 +381,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing BooleanScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -414,13 +413,13 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_BOOLEAN, getWritableValue()),
DEFAULT_TRY_NUMBER);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -139,8 +139,8 @@ public class BooleanScalar_RO extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_RO/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -143,8 +143,8 @@ public class BooleanScalar_RW extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_RW/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -124,8 +124,8 @@ public class BooleanScalar_WO extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_WO/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -176,7 +176,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
public synchronized void removeSource(final String attributeName) throws ArchivingException {
Util.out2.println("NumberScalar.removeSource");
m_logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
+ attributeName);
if (HdbArchiver.isUseEvents) {
......@@ -188,20 +188,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
* while ( ( INumberScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final INumberScalar attribute = (INumberScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeNumberScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
m_logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
isFirstValueList.remove(attributeName.toLowerCase());
logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
m_logger.trace(ILogger.LEVEL_INFO, "===> StopCollecting is requested ");
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -211,8 +209,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
m_logger.trace(ILogger.LEVEL_INFO, "===> Exiting " + this.getClass().getSimpleName() + ".removeSource for "
+ attributeName);
startCollecting();
}
}
......@@ -223,6 +220,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
INumberScalar attribute = null;
stopCollecting();
attribute = (INumberScalar) attributeList.add(attName);
attribute.addNumberScalarListener(this);
attribute.addErrorListener(this);
......@@ -231,11 +229,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -249,6 +243,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -419,17 +415,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
scalarEvent.avoidUnderFlow();
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
}
}
......@@ -441,8 +438,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
} catch (final Exception e) {
e.printStackTrace();
final String message = "Problem storing NumberScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -473,7 +470,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
/* Must be change because the number scalar are not only double */
try {
......@@ -481,7 +478,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
getNullValueScalarEvent(errorEvent, ((AAttribute) errorEvent.getSource()).getTangoDataType(),
getWritableValue()), tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -157,8 +157,8 @@ public class NumberScalar_RO extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RO/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -182,8 +182,8 @@ public class NumberScalar_RW extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RW/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -140,8 +140,8 @@ public class NumberScalar_WO extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RW/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -80,19 +80,18 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
* while ( ( IDevStateScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IDevStateScalar attribute = (IDevStateScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeDevStateScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -101,6 +100,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -114,6 +115,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
// ==
// null )
// {
stopCollecting();
IDevStateScalar attribute = null;
attribute = (IDevStateScalar) attributeList.add(attName);
......@@ -123,11 +125,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
......@@ -143,6 +141,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -300,15 +300,15 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -322,8 +322,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing StateScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -358,13 +358,13 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STATE, getWritableValue()),
tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -104,8 +104,8 @@ public class StateScalar_RO extends StateScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in StateScalar_RO/devStateScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -82,19 +82,18 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
* while ( ( IStringScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IStringScalar attribute = (IStringScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeStringScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -103,6 +102,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -113,6 +114,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
try {
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
stopCollecting();
IStringScalar attribute = null;
attribute = (IStringScalar) attributeList.add(attName);
......@@ -122,11 +124,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -141,6 +139,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -304,15 +304,15 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -326,8 +326,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing StringScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -357,13 +357,13 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STRING, getWritableValue()),
tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -102,8 +102,8 @@ public class StringScalar_RO extends StringScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in StringScalar_RO/stringScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment