Check if event criteria are set for change and archive events

@param attribute the specified attribute
@param eventType the specified event type
@throws DevFailed if event type is change or archive and no event criteria is set.
549589
public static void checkEventCriteria(final AttributeImpl attribute, final EventType eventType) throws DevFailed {
        switch (eventType) {
            case CHANGE_EVENT:
                ChangeEventTrigger.checkEventCriteria(attribute);
                break;
            case ARCHIVE_EVENT:
                ArchiveEventTrigger.checkEventCriteria(attribute);
                break;
            default:
                break;
        }
    }
351315
protected void fireAttributeClearedEvent() {
		if (this.listeners != null && isEventFirable()) {
			final AttributeChangeEvent event = new AttributeChangeEvent(
					//source
					this,
					//type
					Type.REMOVE_ALL,
					//old name
					null,
					//old value
					null,
					//current name
					null,
					//current value
					null);
			for (final AttributeChangeListener listener : this.listeners) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
271871
public void pushEvent(final String attributeName, final AttributeValue value, final EventType eventType)
            throws DevFailed {
        switch (eventType) {
            case CHANGE_EVENT:
            case ARCHIVE_EVENT:
            case USER_EVENT:
                // set attribute value
                final AttributeImpl attribute = AttributeGetterSetter.getAttribute(attributeName,
                        device.getAttributeList());
                attribute.lock();
                try {
                    attribute.updateValue(value);
                    // push the event
                    EventManager.getInstance().pushAttributeValueEvent(name, attributeName, eventType);
                } catch (final DevFailed e) {
                    EventManager.getInstance().pushAttributeErrorEvent(name, attributeName, e);
                } finally {
                    attribute.unlock();
                }
                break;
            default:
                throw DevFailedUtils.newDevFailed("Only USER, ARCHIVE or CHANGE event can be send");
        }
    }
569942
public void delete_device_attribute(String devname, String attname) throws DevFailed {
		databaseDAO.delete_device_attribute(this, devname, attname);
	}
1370199
protected void fireAttributeAddedEvent(String name, AttributeValue attr) {
		if (this.listeners != null && isEventFirable()) {
			final AttributeChangeEvent event = new AttributeChangeEvent(
					//source
					this,
					//type
					Type.ADDITION,
					//old name
					null,
					//old value
					null,
					//current name
					name,
					//current value
					attr);
			for (final AttributeChangeListener listener : this.listeners) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
1125556
public void write_attribute(final DeviceProxy deviceProxy,
                                final DeviceAttribute[] deviceAttributes) throws DevFailed {
		checkIfTango(deviceProxy, "write_attribute");
		build_connection(deviceProxy);

		//
		// Manage Access control
		//
		if (deviceProxy.access == TangoConst.ACCESS_READ) {
	    	// ping the device to throw execption
	    	// if failed (for reconnection)
	    	ping(deviceProxy);

        	throwNotAuthorizedException(deviceProxy.devname + ".write_attribute()",
                	"DeviceProxy.write_attribute()");
		}
		// Build an AttributeValue IDL object array
        AttributeValue_4[] attributeValues_4 = new AttributeValue_4[0];
		AttributeValue[] attributeValues = new AttributeValue[0];

		if (deviceProxy.device_5 != null || deviceProxy.device_4 != null) {
	    	attributeValues_4 = new AttributeValue_4[deviceAttributes.length];
	    	for (int i=0 ; i<deviceAttributes.length ; i++) {
                attributeValues_4[i] = deviceAttributes[i].getAttributeValueObject_4();
	    	}
		} else {
	    	attributeValues = new AttributeValue[deviceAttributes.length];
	    	for (int i = 0; i < deviceAttributes.length; i++) {
                attributeValues[i] = deviceAttributes[i].getAttributeValueObject_2();
	    	}
		}
		boolean done = false;
		final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
		for (int i = 0; i < retries && !done; i++) {
	    	// write attributes on device server
	    	try {
				if (deviceProxy.device_5 != null) {
		    		deviceProxy.device_5.write_attributes_4(
                            attributeValues_4, DevLockManager.getInstance().getClntIdent());
				} else
                if (deviceProxy.device_4 != null) {
		    		deviceProxy.device_4.write_attributes_4(
                            attributeValues_4, DevLockManager.getInstance().getClntIdent());
				} else
                if (deviceProxy.device_3 != null) {
		    		deviceProxy.device_3.write_attributes_3(attributeValues);
				} else {
		    		deviceProxy.device.write_attributes(attributeValues);
				}
				done = true;
	    	} catch (final DevFailed e) {
				// Except.print_exception(e);
				throw e;
	    	} catch (final MultiDevFailed e) {
				throw new NamedDevFailedList(e, name(deviceProxy),
						"DeviceProxy.write_attribute", "MultiDevFailed");
	    	} catch (final Exception e) {
				manageExceptionReconnection(deviceProxy, retries, i, e,
					this.getClass() + ".DeviceProxy.write_attribute");
	    	}
		} // End of for ( ; ; )
   	}
833473
protected synchronized void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr) {
		if (this.listenerList != null && isEventFirable()) {
			final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
			this.listenerList.toArray(list);
			final AttributeChangeEvent event = new AttributeChangeEvent(
					this,
					Type.RENAME,
					oldName,
					attr,
					newName,
					attr);
			for (final AttributeChangeListener listener : list) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
1340276
public int subscribe_event(DeviceProxy device,
                               String attribute,
                               int event,
                               int max_size,
                               String[] filters,
                               boolean stateless)
            throws DevFailed {
        return subscribe_event(device, attribute, event, null, max_size, filters, stateless);
    }
817174
protected void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr) {
		if (this.listeners != null && isEventFirable()) {
			final AttributeChangeEvent event = new AttributeChangeEvent(
					//source
					this,
					//type
					Type.RENAME,
					//old name
					oldName,
					//old value
					attr,
					//current name
					newName,
					//current value
					attr);
			for (final AttributeChangeListener listener : this.listeners) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
799494
private void callEventSubscriptionAndConnect(DeviceProxy device, String eventType)
            throws DevFailed {
        //  Done for IDL>=5 and not for notifd event system (no attribute name)
        String device_name = device.name();
        String[] info = new String[] {
                device_name,
                "",
                "subscribe",
                eventType,
                Integer.toString(device.get_idl_version())
        };
        DeviceData argIn = new DeviceData();
        argIn.insert(info);
        String cmdName = getEventSubscriptionCommandName();
        ApiUtil.printTrace(device.get_adm_dev().name() + ".command_inout(\"" +
                cmdName + "\") for " + device_name + eventType);
        DeviceData argOut =
                device.get_adm_dev().command_inout(cmdName, argIn);
        ApiUtil.printTrace("    command_inout done.");

        //	And then connect to device
        checkDeviceConnection(device, null, argOut, eventType);
    }
1077386
public void unsubscribe_event(int event_id) throws DevFailed {
        //	Get callback struct for event ID
        EventCallBackStruct callbackStruct =
                getCallBackStruct(event_callback_map, event_id);
        if (callbackStruct != null) {
            removeCallBackStruct(event_callback_map, callbackStruct);
            unsubscribeTheEvent(callbackStruct);
        }
        else {
            //	If not found check if in failed map
            callbackStruct =
                    getCallBackStruct(failed_event_callback_map, event_id);
            if (callbackStruct != null)
                removeCallBackStruct(failed_event_callback_map, callbackStruct);
            else
                Except.throw_event_system_failed("API_EventNotFound",
                        "Failed to unsubscribe event, the event id (" + event_id +
                                ") specified does not correspond with any known one",
                        "EventConsumer.unsubscribe_event()");
        }
    }
787241
private void addAttributePolling(final AttributeImpl attr) throws DevFailed {
        if (MANAGER == null) {
            startCache();
        }
        removeAttributePolling(attr);
        final AttributeCache cache = new AttributeCache(MANAGER, attr, deviceName, deviceLock, aroundInvoke);
        if (attr.getPollingPeriod() == 0) {
            extTrigAttributeCacheMap.put(attr, cache);
        } else {
            attributeCacheMap.put(attr, cache);
        }
        updatePoolConf();
    }
1187116
protected void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) {
		if (this.listeners != null && isEventFirable()) {
			final AttributeChangeEvent event = new AttributeChangeEvent(
					//source
					this,
					//type
					Type.VALUE_UPDATE,
					//old name
					name,
					//old value
					oldValue,
					//current name
					name,
					//current value
					currentValue);
			for (final AttributeChangeListener listener : this.listeners) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}
1355932
void onColumnTypeChanged(@Observes ValueChangeEvent<ColumnType> event) {
        PortablePreconditions.checkNotNull("ValueChangeEvent<ColumnType>",
                                           event);
        if (event.getContext().equals(columnType)) {

            // Update the help tooltip when the column type changes
            String columnTypeDescr = getColumnTypeDescription(event.getValue());
            columnType.setHelpContent(DataSetEditorConstants.INSTANCE.attributeColumnType(),
                                      columnTypeDescr,
                                      Placement.RIGHT);
        }
    }
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;

    }
240584
@Check(CheckType.FAST)
	public void checkBehaviorUnitEventType(SarlBehaviorUnit behaviorUnit) {
		final JvmTypeReference event = behaviorUnit.getName();
		final LightweightTypeReference ref = toLightweightTypeReference(event);
		if (ref == null || !this.inheritanceHelper.isSarlEvent(ref)) {
			error(MessageFormat.format(
					Messages.SARLValidator_75,
					event.getQualifiedName(),
					Messages.SARLValidator_62,
					this.grammarAccess.getOnKeyword()),
					event,
					null,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					TYPE_BOUNDS_MISMATCH);
		}
	}
788960
protected int subscribe_user_event(String attr_name, String[] filters, boolean stateless)
            throws DevFailed {
        return event_supplier.subscribe_event(attr_name,
                USER_EVENT, this, filters, stateless);
    }