Insert data in DeviceAttribute from a Integer.

@param integerValue
the value to insert on DeviceAttribute
@param deviceAttributeWritten
the DeviceAttribute attribute to write
@throws DevFailed
329846
public static void insertFromInteger(final Integer integerValue,
	    final DeviceAttribute deviceAttributeWritten) throws DevFailed {

	switch (deviceAttributeWritten.getType()) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceAttributeWritten.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceAttributeWritten.insert_us(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceAttributeWritten.insert_uc(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceAttributeWritten.insert_ul(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_LONG64 not supported",
		    "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceAttributeWritten.insert_u64(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceAttributeWritten.insert(integerValue.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceAttributeWritten.insert(integerValue.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceAttributeWritten.insert(integerValue.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (integerValue.doubleValue() == 1) {
		deviceAttributeWritten.insert(true);
	    } else {
		deviceAttributeWritten.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    try {
		deviceAttributeWritten.insert(DevState.from_int(integerValue.intValue()));
	    } catch (final org.omg.CORBA.BAD_PARAM badParam) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "Cannot sent"
			+ integerValue.intValue() + "for input Tango_DEV_STATE type",
			"AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    }
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceAttributeWritten.getType() + " not supported",
		    "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    break;
	}
    }
874727
public void pushAttributeDataReadyEvent(final String deviceName, final String attributeName, final int counter)
            throws DevFailed {
        xlogger.entry();
        final String fullName = EventUtilities.buildEventName(deviceName, attributeName, EventType.DATA_READY_EVENT);
        final EventImpl eventImpl = getEventImpl(fullName);
        if (eventImpl != null) {
            for (ZMQ.Socket eventSocket : eventEndpoints.values()) {
                eventImpl.pushAttributeDataReadyEvent(counter, eventSocket);
            }
        }
        xlogger.exit();
    }
1291037
public void setAttributePropertyInDB(final String attributeName, final String propertyName, final String value)
            throws DevFailed {
        xlogger.entry(propertyName);

        // insert value in db only if input value is different and not a
        // default value
        // if (checkCurrentValue) {
        // final String presentValue = getAttributePropertyFromDB(attributeName, propertyName);
        // final boolean isADefaultValue = presentValue.isEmpty()
        // && (value.equalsIgnoreCase(AttributePropertiesImpl.NOT_SPECIFIED)
        // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_DIPLAY_UNIT)
        // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_UNIT) || value
        // .equalsIgnoreCase(AttributePropertiesImpl.NO_STD_UNIT));
        // if (!isADefaultValue && !presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) {
        // LOGGER.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value });
        // final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        // propInsert.put(propertyName, new String[] { value });
        // DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        // }
        // } else {
        logger.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value });
        final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        propInsert.put(propertyName, new String[] { value });
        DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        // }
        xlogger.exit();
    }
979872
public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties)
            throws DevFailed {
        final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
        attr.setProperties(properties);
    }
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);
    }
241211
public void write_attribute(final DeviceProxy deviceProxy, final DeviceAttribute deviceAttribute)
	    	throws DevFailed {
		checkIfTango(deviceProxy, "write_attribute");
		try {
	    	final DeviceAttribute[] array = { deviceAttribute };
	    	write_attribute(deviceProxy, array);
		} catch (final NamedDevFailedList e) {
	    	final NamedDevFailed namedDF = e.elementAt(0);
	    	throw new DevFailed(namedDF.err_stack);
		} catch (final Exception e) {
	    	throw_dev_failed(deviceProxy, e, "device.write_attributes()", false);
		}
    }
930687
public static Integer extractToInteger(final DeviceData deviceDataArgout) throws DevFailed {
	final Object value = CommandHelper.extract(deviceDataArgout);
	Integer argout = null;
	if (value instanceof Short) {
	    argout = Integer.valueOf(((Short) value).intValue());
	} else if (value instanceof String) {
	    try {
		argout = Integer.valueOf((String) value);
	    } catch (final Exception e) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
			+ " is not a numerical", "CommandHelper.extractToInteger(deviceDataArgin)");
	    }
	} else if (value instanceof Integer) {
	    argout = (Integer) value;
	} else if (value instanceof Long) {
	    argout = Integer.valueOf(((Long) value).intValue());
	} else if (value instanceof Float) {
	    argout = Integer.valueOf(((Float) value).intValue());
	} else if (value instanceof Boolean) {
	    if (((Boolean) value).booleanValue()) {
		argout = Integer.valueOf(1);
	    } else {
		argout = Integer.valueOf(0);
	    }
	} else if (value instanceof Double) {
	    argout = Integer.valueOf(((Double) value).intValue());
	} else if (value instanceof DevState) {
	    argout = Integer.valueOf(((DevState) value).value());
	} else {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
		    + " not supported",
		    "CommandHelper.extractToInteger(Object value,deviceDataArgin)");
	}

	return argout;
    }
1195831
@Override
    public void write_attributes_4(final AttributeValue_4[] values, final ClntIdent clIdent) throws MultiDevFailed,
            DevFailed {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        checkInitialization();
        final String[] names = new String[values.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = values[i].name;
        }
        logger.debug("writing {}", Arrays.toString(names));
        deviceMonitoring.startRequest("write_attributes_4 " + Arrays.toString(names), clIdent);
        clientIdentity.set(clIdent);
        if (!name.equalsIgnoreCase(getAdminDeviceName())) {
            clientLocking.checkClientLocking(clIdent, names);
        }
        final Object lock = deviceLock.getAttributeLock();
        try {
            synchronized (lock != null ? lock : new Object()) {
                AttributeGetterSetter.setAttributeValue4(values, attributeList, stateImpl, aroundInvokeImpl, clIdent);
            }
        } catch (final Exception e) {
            deviceMonitoring.addError();
            if (e instanceof MultiDevFailed) {
                throw (MultiDevFailed) e;
            } else {
                // with CORBA, the stack trace is not visible by the client if
                // not inserted in DevFailed.
                throw DevFailedUtils.newDevFailed(e);
            }
        }
        xlogger.exit();
    }
12908
public static void insertFromShortArray(final short[] shortValues,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {
	// by default for xdim = 1, send the sum.
	Double doubleSum = new Double(0);
	for (final short shortValue : shortValues) {
	    doubleSum = doubleSum + shortValue;
	}

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceDataArgin.insert_us(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceDataArgin.insert_u64(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceDataArgin.insert(doubleSum.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceDataArgin.insert(doubleSum.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(doubleSum.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (doubleSum.doubleValue() == 1) {
		deviceDataArgin.insert(true);
	    } else {
		deviceDataArgin.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    DevState devStateValue = DevState.UNKNOWN;
	    if (shortValues.length > 0) {
		try {
		    devStateValue = DevState.from_int(Short.valueOf(shortValues[0]).intValue());
		} catch (final org.omg.CORBA.BAD_PARAM badParam) {
		    devStateValue = DevState.UNKNOWN;
		}
	    }
	    deviceDataArgin.insert(devStateValue);
	    break;

	// Array input type
	case TangoConst.Tango_DEVVAR_SHORTARRAY:
	    deviceDataArgin.insert(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_USHORTARRAY:
	    deviceDataArgin.insert_us(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_CHARARRAY:
	    final byte[] byteValues = new byte[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		byteValues[i] = Short.valueOf(shortValues[i]).byteValue();
	    }
	    deviceDataArgin.insert(byteValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONGARRAY:
	    final int[] longValues = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		longValues[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(longValues);
	    break;
	case TangoConst.Tango_DEVVAR_ULONGARRAY:
	    final long[] ulongValues = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		ulongValues[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_ul(ulongValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONG64ARRAY:
	    final int[] long64Values = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		long64Values[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(long64Values);
	    break;
	case TangoConst.Tango_DEVVAR_ULONG64ARRAY:
	    final long[] uLong64Values = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		uLong64Values[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_u64(uLong64Values);
	    break;
	case TangoConst.Tango_DEVVAR_FLOATARRAY:
	    final float[] floatValues = new float[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		floatValues[i] = Short.valueOf(shortValues[i]).floatValue();
	    }
	    deviceDataArgin.insert(floatValues);
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLEARRAY:
	    final double[] doubleValues = new double[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		doubleValues[i] = Short.valueOf(shortValues[i]).doubleValue();
	    }
	    deviceDataArgin.insert(doubleValues);
	    break;
	case TangoConst.Tango_DEVVAR_STRINGARRAY:
	    final String[] stringValues = new String[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		stringValues[i] = Short.valueOf(shortValues[i]).toString();
	    }
	    deviceDataArgin.insert(stringValues);
	    break;

	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	}
    }
1252198
public DbAttribute[] get_device_attribute_property(Database database, String deviceName, String[] attnames)
            throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        DeviceData argIn = new DeviceData();
        DeviceData argOut;
        int mode = 2;

        try {
            //	value is an array
            argIn.insert(ApiUtil.toStringArray(deviceName, attnames));
            argOut = command_inout(database, "DbGetDeviceAttributeProperty2", argIn);
        } catch (DevFailed e) {
            if (e.errors[0].reason.equals("API_CommandNotFound")) {
                //	Value is just one element
                argOut = command_inout(database, "DbGetDeviceAttributeProperty", argIn);
                mode = 1;
            } else
                throw e;
        }
        return ApiUtil.toDbAttributeArray(argOut.extractStringArray(), mode);
    }
1101138
public void write_attribute_asynch(DeviceAttribute[] attribs, CallBack cb) throws DevFailed {
        deviceProxyDAO.write_attribute_asynch(this, attribs, cb);
    }
100657
public void write_attribute_reply(final DeviceProxy deviceProxy, final int id)
		    throws DevFailed {
		final Request request = ApiUtil.get_async_request(id);
        try {
            if (deviceProxy.device_5 != null || deviceProxy.device_4 != null) {
                check_asynch_reply(deviceProxy, request, id, "write_attributes_4");
            } else if (deviceProxy.device_3 != null) {
                check_asynch_reply(deviceProxy, request, id, "write_attributes_3");
            } else if (deviceProxy.device_2 != null) {
                check_asynch_reply(deviceProxy, request, id, "write_attributes");
            } else {
                check_asynch_reply(deviceProxy, request, id, "write_attributes");
            }
        }
        catch (ConnectionFailed e) {
            DeviceAttribute[]   deviceAttributes;
            try {
                //  If failed, retrieve data from request object
                final NVList args = request.arguments();
                final Any any = args.item(0).value();

                if (deviceProxy.idl_version>=4) {
                    AttributeValue_4[]    attributeValues_4 =
                            AttributeValueList_4Helper.extract(any);

                    deviceAttributes = new DeviceAttribute[attributeValues_4.length];
                    for (int i=0 ;  i<attributeValues_4.length ; i++) {
                        deviceAttributes[i] = new DeviceAttribute(attributeValues_4[i]);
                    }
                }
                else if (deviceProxy.idl_version>=3) {
                    AttributeValue[]    attributeValues =
                            AttributeValueListHelper.extract(any);
                    deviceAttributes = new DeviceAttribute[attributeValues.length];
                    for (int i=0 ;  i<attributeValues.length ; i++) {
                        deviceAttributes[i] = new DeviceAttribute(attributeValues[i]);
                    }
                }
                else
                    throw e;
            }
            catch (org.omg.CORBA.Bounds e1) {
                System.err.println(e1);
                throw e;
            }

            //  And do the synchronous write_attributes
            deviceProxy.write_attribute(deviceAttributes);
        }
    }
230068
public static void insertFromInteger(final Integer integerValue,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceDataArgin.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceDataArgin.insert_us(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceDataArgin.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceDataArgin.insert_u64(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceDataArgin.insert(integerValue.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceDataArgin.insert(integerValue.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(integerValue.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (integerValue.doubleValue() == 1) {
		deviceDataArgin.insert(true);
	    } else {
		deviceDataArgin.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    try {
		deviceDataArgin.insert(DevState.from_int(integerValue.intValue()));
	    } catch (final org.omg.CORBA.BAD_PARAM badParam) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "Cannot sent"
			+ integerValue.intValue() + "for input Tango_DEV_STATE type",
			"CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    }
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    break;
	}
    }
562040
public void insert(final DeviceData deviceData, final String argin) {
        DevStringHelper.insert(deviceData.getAny(), argin);
    }
235072
void set_write_value(Any any) throws DevFailed
	{
		switch (data_type)
		{
		case Tango_DEV_STATE :
			// Check data type inside the any
			DevState[] st = null;
			try
			{
				st = DevVarStateArrayHelper.extract(any);
			}
			catch (BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevBoolean",
						       "WAttribute.set_write_value()");
			}
		
			//	No min max value check for boolean !
			state_val = st[0];
			break;
		
		case Tango_DEV_BOOLEAN :
			// Check data type inside the any
			boolean[] bl_ptr = null;
			try
			{
				bl_ptr = DevVarBooleanArrayHelper.extract(any);
			}
			catch (BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevBoolean",
						       "WAttribute.set_write_value()");
			}
		
			//	No min max value check for boolean !
			old_bool_val = bool_val;		
			bool_val = bl_ptr[0];
			break;
		
		case Tango_DEV_SHORT :
			// Check data type inside the any
			short[] sh_ptr = null;
			try
			{
				sh_ptr = DevVarShortArrayHelper.extract(any);
			}
			catch (BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevShort",
						       "WAttribute.set_write_value()");
			}
		
			// Check the incoming value
			if (check_min_value == true)
			{
				if (sh_ptr[0] <= min_value.sh)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",
							       o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (sh_ptr[0] >= max_value.sh)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",
							       o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_short_val = short_val;		
			short_val = sh_ptr[0];
			break;
		

		case Tango_DEV_USHORT :
			// Check data type inside the any
			short[] ush_ptr = null;
			try
			{
				ush_ptr = DevVarUShortArrayHelper.extract(any);
			}
			catch (BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevUShort",
						       "WAttribute.set_write_value()");
			}
		
			// Check the incoming value
			int	ush_val =  (0xFFFF & ush_ptr[0]);
			if (check_min_value == true)
			{
				if (ush_val <= min_value.sh)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",
							       o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (ush_val >= max_value.sh)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",
							       o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_long_val = long_val;				
			long_val = ush_val;
			break;
		

		case Tango_DEV_LONG :
			// Check data type inside the any
			int[] lg_ptr = null;
			try
			{
				lg_ptr = DevVarLongArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevLong",
						       "WAttribute.set_write_value()");
			}
			// Check the incoming value
			if (check_min_value == true)
			{
				if (lg_ptr[0] <= min_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (lg_ptr[0] >= max_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_long_val = long_val;				
			long_val = lg_ptr[0];
			break;


		case Tango_DEV_ULONG :
			// Check data type inside the any
			int[] ulg_ptr = null;
			try
			{
				ulg_ptr = DevVarULongArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevULong",
						       "WAttribute.set_write_value()");
			}
			// Check the incoming value
			long	mask = (long) 0x7fffffff;
			mask += ((long)1 << 31);
			long	ulg_val =  (mask & (long)ulg_ptr[0]);
			if (check_min_value == true)
			{
				if (ulg_val <= min_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (ulg_val >= max_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_long64_val = long64_val;				
			long64_val = ulg_val;
			break;


		case Tango_DEV_LONG64 :
			// Check data type inside the any
			long[] lg64_ptr = null;
			try
			{
				lg64_ptr = DevVarLong64ArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevLong",
						       "WAttribute.set_write_value()");
			}
			// Check the incoming value
			if (check_min_value == true)
			{
				if (lg64_ptr[0] <= min_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (lg64_ptr[0] >= max_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_long64_val = long64_val;				
			long64_val = lg64_ptr[0];
			break;


		case Tango_DEV_ULONG64 :
			// Check data type inside the any
			long[] ulg64_ptr = null;
			try
			{
				ulg64_ptr = DevVarLong64ArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevLong",
						       "WAttribute.set_write_value()");
			}
			// Check the incoming value
			if (check_min_value == true)
			{
				if (ulg64_ptr[0] <= min_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (ulg64_ptr[0] >= max_value.lg)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}

			old_long64_val = long64_val;				
			long64_val = ulg64_ptr[0];
			break;

		
		case Tango_DEV_DOUBLE :
			// Check data type inside the any
			double[] db_ptr = null;
			try
			{
				db_ptr = DevVarDoubleArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevDouble",
						       "WAttribute.set_write_value()");
			}
		
			// Check the incoming value
			if (check_min_value == true)
			{
				if (db_ptr[0] <= min_value.db)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is below the minimum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}
			if (check_max_value == true)
			{
				if (db_ptr[0] >= max_value.db)
				{
					StringBuffer o = new StringBuffer("Set value for attribute ");
					o.append(name);
					o.append(" is above the maximum authorized");
					Except.throw_exception("API_WAttrOutsideLimit",o.toString(),
							       "WAttribute.set_write_value()");
				}
			}		

			old_double_val = double_val;
			double_val = db_ptr[0];
			break;
		

		case Tango_DEV_STRING :
			String[] str_ptr = null;
			try
			{
				str_ptr = DevVarStringArrayHelper.extract(any);
			}
			catch(BAD_OPERATION ex)
			{
				Except.throw_exception("API_IncompatibleAttrDataType",
						       "Incompatible attribute type, expected type is : Tango_DevString",
						       "WAttribute.set_write_value()");
			}

			old_str_val = str_val;
			str_val = str_ptr[0];
			break;
		}
	}
837171
public void write_asynch(DeviceAttribute attr, CallBack cb)  throws DevFailed {
        dev.write_attribute_asynch(attr, cb);
    }
820846
public void put_device_attribute_property(Database database, String deviceName, DbAttribute attr)
            throws DevFailed {
        DbAttribute[] da = new DbAttribute[1];
        da[0] = attr;
        put_device_attribute_property(database, deviceName, da);
    }