@Override public void elementUpdated(ContextEvent event) { updateLinkedRelationshipInstances(event.getSource().getId()); } }
@Override public void elementUpdated(ContextEvent event) { updateLinkedAttributeInstances(event.getSource().getId()); } }
/** * Removes an relationship instance from being updated. * * @param relationshipInstance the relationship instance to be removed. */ protected void removeUpdatedRelationshipInstance(Relationship<?, ?> relationshipInstance) { removeUpdatedRelationshipInstance(relationshipInstance.getId()); }
protected Behavior getBehavior(ContextEvent event) { Attribute attributeInstance = event.getSourceAttributeInstance(); ContextValue value = attributeInstance.getValue(); Object data = (value != null) ? value.getData() : null; return behaviors.get(data); }
/** * {@link ContextManager#getContext()} */ protected Context getContext() { synchronized (contextBrokerLock) { if (contextBroker != null) return contextBroker.getContext(); throw new NotAccessibleContextException("contextManager is null"); } }
/** * Removes an attribute instance from being updated. * * @param attributeInstance the attribute instance to be removed. */ protected void removeUpdatedAttributeInstance(Attribute attributeInstance) { removeUpdatedAttributeInstance(attributeInstance.getId()); }
/** * {@link ContextManager#getServiceEntity()} */ public BundleEntity getBundleEntity() { synchronized (contextBrokerLock) { if (contextBroker != null) return contextBroker.getBundleEntity(); throw new NotAccessibleContextException("contextManager is null"); } }
@Override public void run() { ContextEvent event = createContextEvent(eventType, arg); if ((observer.handle(event) & ContextObserver.HANDLE_READ) != 0) observer.elementUpdated(event); } }
/** * {@inheritDoc} */ @Override public void deactivate() { removeAllUpdatedRelationshipInstances(); super.deactivate(); }
/** * {@link Context#peek(java.net.URI)} */ protected <T extends ContextElement> T contextPeek(URI elementId) { synchronized (contextBrokerLock) { return getContext().peek(elementId); } }
/** * {@inheritDoc} */ @Override public void deactivate() { removeAllUpdatedAttributeInstances(); super.deactivate(); }
/** * {@inheritDoc} */ @Override public void deactivate() { removeAllObservedElements(); super.deactivate(); }
/** * {@link Context#contains(java.net.URI)} */ protected boolean contextContains(URI elementId) { synchronized (contextBrokerLock) { return getContext().contains(elementId); } }
/** * {@inheritDoc} */ @Override public int handle(ContextEvent event) { // Default return (event.getEventType() & (ContextEvent.ELEMENT_ADDED | ContextEvent.ELEMENT_REMOVED)) == 0 ? ContextObserver.HANDLE_READ : ContextObserver.HANDLE_NONE; }
/** * {@inheritDoc} */ @Override public T setTargetEntity(T targetEntity) { return setTargetEntity(0, targetEntity); }
/** * {@inheritDoc} */ @Override public T removeTargetEntity() { return removeTargetEntity(0); }
@Override public void elementUpdated(ContextEvent event) { AbstractEntity.this.notifyElementUpdated(ContextEvent.ATTINSTANCE_UPDATED, event); } }
/** * Constructs a relationship specifying its id and source entity. * * @param id the URI of the relationship instance. * @param sourceEntity the source entity. */ public AbstractRelationship(URI id, S sourceEntity) { super(id); this.setSourceEntity(sourceEntity); }
/** * {@inheritDoc} */ @Override public T getTargetEntity() { return getTargetEntity(0); }
/** * Constructs an element with the specified id. * * @param id the id representing this element. */ AbstractContextElement(URI id) { this.setId(id); context = null; }