001package jmri.jmrit.logixng; 002 003import java.beans.PropertyVetoException; 004 005import javax.annotation.Nonnull; 006 007import jmri.Manager; 008import jmri.NamedBean; 009 010/** 011 * Base interface for the LogixNG action and expression managers. 012 * 013 * @param <E> the type of NamedBean supported by this manager 014 * 015 * @author Daniel Bergqvist 2020 016 */ 017public interface BaseManager<E extends NamedBean> extends Manager<E> { 018 019 /** 020 * Remember a NamedBean Object created outside the manager. 021 * <p> 022 * The non-system-specific SignalHeadManagers use this method extensively. 023 * 024 * @param maleSocket the bean 025 * @return the registered bean with attached male sockets 026 * @throws NamedBean.DuplicateSystemNameException if a different bean with the same 027 * system name is already registered in 028 * the manager 029 */ 030 E registerBean(@Nonnull E maleSocket); 031 032 /** 033 * Method for a UI to delete a bean. 034 * <p> 035 * The UI should first request a "CanDelete", this will return a list of 036 * locations (and descriptions) where the bean is in use via throwing a 037 * VetoException, then if that comes back clear, or the user agrees with the 038 * actions, then a "DoDelete" can be called which inform the listeners to 039 * delete the bean, then it will be deregistered and disposed of. 040 * <p> 041 * If a property name of "DoNotDelete" is thrown back in the VetoException 042 * then the delete process should be aborted. 043 * 044 * @param maleSocket The MaleSocket to be deleted 045 * @param property The programmatic name of the request. "CanDelete" will 046 * enquire with all listeners if the item can be deleted. 047 * "DoDelete" tells the listener to delete the item 048 * @throws java.beans.PropertyVetoException If the recipients wishes the 049 * delete to be aborted (see above) 050 */ 051 void deleteBean(@Nonnull MaleSocket maleSocket, @Nonnull String property) throws PropertyVetoException; 052 053 /** 054 * Method for a UI to delete the children of a bean. 055 * <p> 056 * The UI should first request a "CanDelete", this will return a list of 057 * locations (and descriptions) where the bean is in use via throwing a 058 * VetoException, then if that comes back clear, or the user agrees with the 059 * actions, then a "DoDelete" can be called which inform the listeners to 060 * delete the children of the bean, then it will be deregistered and disposed of. 061 * <p> 062 * If a property name of "DoNotDelete" is thrown back in the VetoException 063 * then the delete process should be aborted. 064 * 065 * @param maleSocket The MaleSocket of which the children are to be deleted 066 * @param property The programmatic name of the request. "CanDelete" will 067 * enquire with all listeners if the item can be deleted. 068 * "DoDelete" tells the listener to delete the item 069 * @throws java.beans.PropertyVetoException If the recipients wishes the 070 * delete to be aborted (see above) 071 */ 072 void deleteChildren(@Nonnull MaleSocket maleSocket, @Nonnull String property) throws PropertyVetoException; 073 074 /** 075 * Get the default male socket class 076 * @return the class 077 */ 078 Class<? extends MaleSocket> getMaleSocketClass(); 079 080 /** 081 * Get the last item registered in the mananger. 082 * @return the last item 083 */ 084 MaleSocket getLastRegisteredMaleSocket(); 085 086 /** 087 * Register a male socket factory. 088 * @param factory the factory 089 */ 090 void registerMaleSocketFactory(MaleSocketFactory<E> factory); 091 092}