001package jmri.jmrix.ecos;
002
003import javax.annotation.Nonnull;
004import jmri.Reporter;
005
006/**
007 * EcosReporterManager implements the ReporterManager for ECoS
008 *
009 * @author Kevin Dickerson Copyright (C) 2012
010 */
011public class EcosReporterManager extends jmri.managers.AbstractReporterManager {
012
013    // ctor has to register for ECoS events
014    public EcosReporterManager(EcosSystemConnectionMemo memo) {
015        super(memo);
016    }
017
018    /**
019     * {@inheritDoc}
020     */
021    @Override
022    @Nonnull
023    public EcosSystemConnectionMemo getMemo() {
024        return (EcosSystemConnectionMemo) memo;
025    }
026
027    @Nonnull
028    @Override
029    protected Reporter createNewReporter(@Nonnull String systemName, String userName) throws IllegalArgumentException {
030        Reporter r = new EcosReporter(systemName, userName);
031        register(r);
032        return r;
033    }
034    
035    /**
036     * Validates to contain at least 1 number . . .
037     * <p>
038     * TODO: Custom validation for EcosReporterManager could be improved.
039     * {@inheritDoc}
040     */
041    @Override
042    @Nonnull
043    public String validateSystemNameFormat(@Nonnull String name, @Nonnull java.util.Locale locale) throws jmri.NamedBean.BadSystemNameException {
044        return validateTrimmedMin1NumberSystemNameFormat(name,locale);
045    }
046
047}