@Override public void disposeItem ( final DataItem item ) { this.itemMap.remove ( item.getInformation ().getName () ); }
protected void addToFolder ( final DataItem item, final String name, final Map<String, Variant> attributes ) { if ( this.folder == null ) { return; } this.folder.add ( name, item.getInformation (), attributes ); }
public boolean add ( final String name, final DataItem dataItem, final Map<String, Variant> attributes ) { return add ( name, dataItem.getInformation (), attributes ); }
@Override public void dataChanged ( final DataItem item, final Variant value, final Map<String, Variant> attributes, final boolean cache ) { logger.debug ( "Data changed - itemId: {}, value: {}, attributes: {}, cache: {}", new Object[] { item.getInformation ().getName (), value, attributes, cache } ); final ItemChangeListener listener; if ( ( listener = this.listener ) != null ) { listener.dataChanged ( item.getInformation ().getName (), value, attributes, cache ); } }
public synchronized String findEntry ( final DataItem item ) { for ( final Iterator<Map.Entry<String, Entry>> i = this.entryMap.entrySet ().iterator (); i.hasNext (); ) { final String itemId = item.getInformation ().getName (); final Map.Entry<String, Entry> entry = i.next (); if ( entry.getValue () instanceof DataItemEntryCommon ) { if ( ( (DataItemEntryCommon)entry.getValue () ).getId () == itemId ) { return entry.getKey (); } } } return null; }
@Override public synchronized void disposeItem ( final DataItem dataItem ) { final String itemId = dataItem.getInformation ().getName (); if ( this.items.get ( itemId ) != dataItem ) { return; } this.items.remove ( itemId ); unregisterItem ( dataItem ); }
@Override public synchronized void disposeItem ( final DataItem dataItem ) { final String itemId = dataItem.getInformation ().getName (); if ( this.items.get ( itemId ) != dataItem ) { return; } this.items.remove ( itemId ); unregisterItem ( dataItem ); }
/** * Create new item descriptor * * @param item * the data item, must not be <code>null</code> * @param attributes * the optional describing attributes, may be <code>null</code> */ public ItemDescriptor ( final DataItem item, final Map<String, Variant> attributes ) { this.item = item; this.itemId = item.getInformation ().getName (); if ( attributes != null ) { this.attributes = new HashMap<String, Variant> ( attributes ); } else { this.attributes = Collections.emptyMap (); } }
private void registerItem ( final DataItem newItem ) { final DataItem oldItem = this.itemMap.put ( newItem.getInformation ().getName (), newItem ); if ( oldItem != null ) { disposeItem ( oldItem ); } }
public String getName ( final ItemDescriptor descriptor ) { try { return descriptor.getItem ().getInformation ().getName (); } catch ( final Throwable e ) { return null; } }
public synchronized boolean remove ( final DataItem item ) { for ( final Iterator<Map.Entry<String, Entry>> i = this.entryMap.entrySet ().iterator (); i.hasNext (); ) { final String itemId = item.getInformation ().getName (); final Map.Entry<String, Entry> entry = i.next (); if ( entry.getValue () instanceof DataItemEntryCommon ) { if ( ( (DataItemEntryCommon)entry.getValue () ).getId () == itemId ) { i.remove (); notifyRemove ( entry.getKey () ); return true; } } } return false; }
private <T extends DataItem> T registerItem ( final T item, final Map<String, Variant> properties ) { final Dictionary<?, ?> localProperties = new Hashtable<Object, Object> ( 0 ); final String itemId = item.getInformation ().getName (); // remove old item first final DataItem oldItem = this.items.remove ( itemId ); if ( oldItem != null ) { this.objectPool.removeService ( itemId, oldItem ); } this.items.put ( itemId, item ); this.objectPool.addService ( itemId, item, localProperties ); return item; }
private <T extends DataItem> T registerItem ( final T item, final Map<String, Variant> properties ) { final Dictionary<?, ?> localProperties = new Hashtable<Object, Object> ( 0 ); final String itemId = item.getInformation ().getName (); // remove old item first final DataItem oldItem = this.items.remove ( itemId ); if ( oldItem != null ) { this.objectPool.removeService ( itemId, oldItem ); } this.items.put ( itemId, item ); this.objectPool.addService ( itemId, item, localProperties ); return item; }
protected void unregisterItem ( final DataItem dataItem ) { this.objectPool.removeService ( dataItem.getInformation ().getName (), dataItem ); }
protected void unregisterItem ( final DataItem dataItem ) { this.objectPool.removeService ( dataItem.getInformation ().getName (), dataItem ); }
final String id = item.getInformation ().getName (); if ( this.itemMap.containsKey ( id ) )
final String id = item.getInformation ().getName (); logger.warn ( String.format ( "Duplicate error: item %s already registered with hive", item.getInformation ().getName () ) );