read an attribute history. IDL 5 version. The history is filled only be
attribute polling

@param attributeName The attribute to retrieve
@param maxSize       The history maximum size returned
@throws DevFailed
774063
@Override
    public DevAttrHistory_5 read_attribute_history_5(final String attributeName, final int maxSize) throws DevFailed {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        checkInitialization();
        deviceMonitoring.startRequest("read_attribute_history_5");
        DevAttrHistory_5 result = null;
        try {
            final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, attributeList);
            if (attr.getBehavior() instanceof ForwardedAttribute) {
                final ForwardedAttribute fwdAttr = (ForwardedAttribute) attr.getBehavior();
                result = fwdAttr.getAttributeHistory(maxSize);
            } else {
                if (!attr.isPolled()) {
                    throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_NOT_POLLED, attr.getName()
                            + " is not polled");
                }
                result = attr.getHistory().getAttrHistory5(maxSize);
            }
        } catch (final Exception e) {
            deviceMonitoring.addError();
            if (e instanceof DevFailed) {
                throw (DevFailed) e;
            } else {
                // with CORBA, the stack trace is not visible by the client if
                // not inserted in DevFailed.
                throw DevFailedUtils.newDevFailed(e);
            }
        }
        return result;

    }
1183618
public DeviceAttribute[] read_attribute(final DeviceProxy deviceProxy, final String[] attributeNames)
	    throws DevFailed {
	DeviceAttribute[] attr;

	build_connection(deviceProxy);

	// Read attributes on device server
	AttributeValue[] attributeValues = new AttributeValue[0];
	AttributeValue_3[] attributeValues_3 = new AttributeValue_3[0];
	AttributeValue_4[] attributeValues_4 = new AttributeValue_4[0];
	AttributeValue_5[] attributeValues_5 = new AttributeValue_5[0];
	if (deviceProxy.url.protocol == TANGO) {
	    // try 2 times for reconnection if requested
	    boolean done = false;
	    final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
	    for (int i = 0; i < retries && !done; i++) {
            try {
                if (deviceProxy.device_5 != null) {
                    attributeValues_5 = deviceProxy.device_5.read_attributes_5(
                            attributeNames, deviceProxy.dev_src,
                            DevLockManager.getInstance().getClntIdent());
                }
                else if (deviceProxy.device_4 != null) {
                    attributeValues_4 = deviceProxy.device_4.read_attributes_4(
                            attributeNames, deviceProxy.dev_src,
                            DevLockManager.getInstance().getClntIdent());
                }
                else if (deviceProxy.device_3 != null) {
                    attributeValues_3 = deviceProxy.device_3.read_attributes_3(
                            attributeNames, deviceProxy.dev_src);
                }
                else if (deviceProxy.device_2 != null) {
                    attributeValues = deviceProxy.device_2.read_attributes_2(
                            attributeNames, deviceProxy.dev_src);
                }
                else {
                    attributeValues = deviceProxy.device.read_attributes(attributeNames);
                }
                done = true;
            } catch (final DevFailed e) {
                // Except.print_exception(e);
                final StringBuilder sb = new StringBuilder(attributeNames[0]);
                for (int j = 1; j < attributeNames.length; j++) {
                    sb.append(", ").append(attributeNames[j]);
                }
                Except.throw_connection_failed(e, "TangoApi_CANNOT_READ_ATTRIBUTE",
                    "Cannot read attribute(s):   " + sb.toString(),
                        deviceProxy.getFull_class_name() + ".read_attribute()");
            } catch (final Exception e) {
                manageExceptionReconnection(deviceProxy,
                        retries, i, e, this.getClass() + ".read_attribute");
            }
	    }
	    // Build a Device Attribute Object
	    // Depends on Device_impl version
	    if (deviceProxy.device_5 != null) {
            attr = new DeviceAttribute[attributeValues_5.length];
            for (int i = 0; i < attributeValues_5.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_5[i]);
            }
	    } else if (deviceProxy.device_4 != null) {
            attr = new DeviceAttribute[attributeValues_4.length];
            for (int i = 0; i < attributeValues_4.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_4[i]);
            }
	    } else if (deviceProxy.device_3 != null) {
            attr = new DeviceAttribute[attributeValues_3.length];
            for (int i = 0; i < attributeValues_3.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_3[i]);
            }
	    } else {
            attr = new DeviceAttribute[attributeValues.length];
            for (int i = 0; i < attributeValues.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues[i]);
            }
	    }
	} else {
	    attr = deviceProxy.taco_device.read_attribute(attributeNames);
	}
	return attr;
    }
288971
public void delete_attribute_property(String attributeName, String propertyName) throws DevFailed {
        database.delete_class_attribute_property(className, attributeName, propertyName);
    }
17646
public DeviceDataHistory[] attribute_history(final DeviceProxy deviceProxy,
            final String attributeName, final int nbData) throws DevFailed {
        checkIfTango(deviceProxy, "attribute_history");
        build_connection(deviceProxy);

        if (DeviceProxy.isCheck_idl() && get_idl_version(deviceProxy) < 2) {
            Except.throw_non_supported_exception("TangoApi_IDL_NOT_SUPPORTED",
                "Not supported by the IDL version used by device",
                    deviceProxy.getFull_class_name() + ".attribute_history()");
        }

        DeviceDataHistory[] deviceDataHistories = new DeviceDataHistory[0];
        try {
            // Check IDL revision to know kind of history.
            if (deviceProxy.device_5 != null) {
                final DevAttrHistory_5 attrHistory_5 =
                        deviceProxy.device_5.read_attribute_history_5(attributeName, nbData);
                deviceDataHistories =
                        ConversionUtil.attributeHistoryToDeviceDataHistoryArray(attrHistory_5);
            }
            else if (deviceProxy.device_4 != null) {
                final DevAttrHistory_4 attrHistory_4 =
                        deviceProxy.device_4.read_attribute_history_4(attributeName, nbData);
                deviceDataHistories =
                        ConversionUtil.attributeHistoryToDeviceDataHistoryArray(attrHistory_4);
            }
            else if (deviceProxy.device_3 != null) {
                final DevAttrHistory_3[] attrHistories_3 =
                        deviceProxy.device_3.read_attribute_history_3(attributeName, nbData);

                deviceDataHistories = new DeviceDataHistory[attrHistories_3.length];
                for (int i = 0; i < attrHistories_3.length; i++) {
                    deviceDataHistories[i] = new DeviceDataHistory(attrHistories_3[i]);
                }
            }
            else if (deviceProxy.device_2 != null) {
                final DevAttrHistory[] attrHistories = deviceProxy.device_2.read_attribute_history_2(
                    attributeName, nbData);
                deviceDataHistories = new DeviceDataHistory[attrHistories.length];
                for (int i=0 ; i<attrHistories.length ; i++) {
                    deviceDataHistories[i] = new DeviceDataHistory(attrHistories[i]);
                }
            }
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            throw_dev_failed(deviceProxy, e, "read_attribute_history()", false);
        }
        return deviceDataHistories;
    }
421582
private Map<String, String> getAttributePropertiesFromDBSingle(final String attributeName) throws DevFailed {
        xlogger.entry(attributeName);
        final Map<String, String> result = new CaseInsensitiveMap<String>();
        final Map<String, String[]> prop = DatabaseFactory.getDatabase().getAttributeProperties(deviceName,
                attributeName);
        for (final Entry<String, String[]> entry : prop.entrySet()) {
            final String name = entry.getKey();
            final String[] value = entry.getValue();
            if (value.length > 0) {
                result.put(name, value[0]);
            } else {
                result.put(name, "");
            }
        }
        xlogger.exit();
        return result;
    }
483508
public int read_attribute_asynch(final DeviceProxy deviceProxy, final String attname)
            throws DevFailed {
        final String[] attnames = new String[1];
        attnames[0] = attname;
        return read_attribute_asynch(deviceProxy, attnames);
    }
40460
public AttributeInfo get_attribute_info(final DeviceProxy deviceProxy, final String attname)
	    throws DevFailed {
        final String[] attnames = ApiUtil.toStringArray(attname);
        final AttributeInfo[] ac = get_attribute_info(deviceProxy, attnames);
        return ac[0];
    }
425727
public DbHistory[] get_device_property_history(String devname, String propname) throws DevFailed {
		return databaseDAO.get_device_property_history(this, devname, propname);
	}
984353
static byte[] marshallIDL5(final AttributeImpl attribute) throws DevFailed {
        XLOGGER.entry();
        final AttributeValue_5 attributeValue = TangoIDLAttributeUtil.toAttributeValue5(attribute,
                attribute.getReadValue(), attribute.getWriteValue());
        return marshallIDL5(attributeValue);
    }
118880
public DeviceDataHistory[] attribute_history(final DeviceProxy deviceProxy, final String attname)
            throws DevFailed {
        int hist_depth = 10;
        final DbDatum data = get_property(deviceProxy, "poll_ring_depth");
        if (!data.is_empty()) {
            hist_depth = data.extractLong();
        }
        return attribute_history(deviceProxy, attname, hist_depth);
    }
1046195
public DbHistory[] get_device_attribute_property_history(String devname, String attname, String propname) throws DevFailed {
		return databaseDAO.get_device_attribute_property_history(this, devname, attname, propname);
	}
793470
public DbAttribute[] get_device_attribute_property(String devname, String[] attnames) throws DevFailed {
		return databaseDAO.get_device_attribute_property(this, devname, attnames);
	}
234352
public void removeAttributeProperties(final String attributeName) throws DevFailed {
        final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
        attr.removeProperties();
    }
160746
static byte[] marshallIDL4(final AttributeImpl attribute) throws DevFailed {
        XLOGGER.entry();
        final AttributeValue_4 attributeValue = TangoIDLAttributeUtil.toAttributeValue4(attribute,
                attribute.getReadValue(), attribute.getWriteValue());
        return marshallIDL4(attributeValue);
    }
825176
AttributeValue get_last_attr_value() throws DevFailed
	{
		RingElt	record = get_last_element();
		if (record.except == null)
			return record.attr_value;
		else
			throw record.except;
	}
275131
static byte[] marshallIDL5(final AttributeValue_5 attributeValue) throws DevFailed {
        XLOGGER.entry();
        final CDROutputStream os = new CDROutputStream();
        try {
            AttributeValue_5Helper.write(os, attributeValue);
            XLOGGER.exit();
            return cppAlignment(os.getBufferCopy());
        } finally {
            os.close();
        }
    }
1254695
public AttributeValue[] read_attributes(final String[] names) throws DevFailed {
	Util.out4.println("DeviceImpl.read_attributes arrived" + names[0]);

	// Record operation request in black box
	blackbox.insert_op(Op_Read_Attr);

	// Return exception if the device does not have any attribute
	if (dev_attr.get_attr_nb() == 0) {
	    Except.throw_exception("API_AttrNotFound", "The device does not have any attribute",
		    "DeviceImpl.read_attributes");
	}

	// Build a sequence with the names of the attribute to be read.
	// This is necessary in case of the "AllAttr" shortcut is used
	// If all attributes are wanted, build this list
	final String[] real_names = checkRealNames(names);

	// If nb connection is closed to the maximum value,
	// throw an exception to do not block devices.
	Util.increaseAccessConter();
	if (Util.getAccessConter() > Util.getPoaThreadPoolMax() - 2) {
	    Util.decreaseAccessConter();
	    Except.throw_exception("API_MemoryAllocation", Util.instance().get_ds_real_name()
		    + ": No thread available to connect device", "DeviceImpl.read_attributes()");
	}

	final Vector wanted_attr = new Vector();
	final Vector wanted_w_attr = new Vector();
	AttributeValue[] back = null;
	try {
	    switch (Util.get_serial_model()) {
	    case BY_CLASS:
		synchronized (device_class) {
		    sortAttributes(real_names, wanted_attr, wanted_w_attr);
		    back = manageReadAttrinbute(real_names, wanted_attr, wanted_w_attr);
		}
		break;

	    case BY_DEVICE:
		synchronized (this) {
		    sortAttributes(real_names, wanted_attr, wanted_w_attr);
		    back = manageReadAttrinbute(real_names, wanted_attr, wanted_w_attr);
		}
		break;

	    default: // NO_SYNC
		synchronized (this) {
		    sortAttributes(real_names, wanted_attr, wanted_w_attr);
		}
		back = manageReadAttrinbute(real_names, wanted_attr, wanted_w_attr);
	    }
	} // End of try

	catch (final DevFailed exc) {
	    Util.decreaseAccessConter();
	    setNotActive(real_names);
	    throw exc;
	} catch (final Exception exc) {
	    Util.decreaseAccessConter();
	    setNotActive(real_names);
	    exc.printStackTrace();
	    Except.throw_exception("API_ExceptionCatched", exc.toString(),
		    "DeviceImpl.read_attributes");
	}

	Util.decreaseAccessConter();
	setNotActive(real_names);

	// Return to caller
	Util.out4.println("Leaving DeviceImpl.read_attributes");
	return back;
    }