private <T extends ImporterDescription, V> ModelOutput<V> createOutput0( DataModelDefinition<V> definition, ImporterPreparator<T> preparator, ImporterDescription description, TestContext context) throws IOException { assert definition != null; assert preparator != null; assert description != null; T desc = preparator.getDescriptionClass().cast(description); return preparator.createOutput(definition, desc, context); } }
private <T extends ImporterDescription> void truncate0( ImporterPreparator<T> preparator, ImporterDescription description, TestContext context) throws IOException { assert preparator != null; assert description != null; T desc = preparator.getDescriptionClass().cast(description); preparator.truncate(desc, context); }
private <T> void prepare( DataModelDefinition<T> definition, ImporterDescription desctipion, URI source) throws IOException { assert definition != null; assert desctipion != null; assert source != null; ModelOutput<T> output = importers.createOutput(definition, desctipion, context); prepare(definition, output, source); }
/** * Truncates the target importer's input. * @param description target importer * @throws IOException if failed to prepare the importer * @throws IllegalArgumentException if some parameters were {@code null} */ public void truncate(ImporterDescription description) throws IOException { if (description == null) { throw new IllegalArgumentException("description must not be null"); //$NON-NLS-1$ } importers.truncate(description, context); }
@Override public void truncate(ImporterDescription description, TestContext context) throws IOException { for (ImporterPreparator<?> element : elements) { if (element.getDescriptionClass().isAssignableFrom(description.getClass())) { truncate0(element, description, context); return; } } throw new IOException(MessageFormat.format( Messages.getString("SpiImporterPreparator.errorFailedToTruncate"), //$NON-NLS-1$ description)); }
private <T> void prepare( DataModelDefinition<T> definition, ImporterDescription description, DataModelSourceFactory source) throws IOException { assert definition != null; assert description != null; assert source != null; ModelOutput< T> output = getDriver(description).createOutput(definition, description, context); prepare(definition, output, source); }
/** * Truncates the target importer's input. * @param description target importer * @throws IOException if failed to prepare the importer * @throws IllegalArgumentException if some parameters were {@code null} */ public void truncate(ImporterDescription description) throws IOException { if (description == null) { throw new IllegalArgumentException("description must not be null"); //$NON-NLS-1$ } getDriver(description).truncate(description, context); }
@Override public <V> ModelOutput<V> createOutput( DataModelDefinition<V> definition, ImporterDescription description, TestContext context) throws IOException { for (ImporterPreparator<?> element : elements) { if (element.getDescriptionClass().isAssignableFrom(description.getClass())) { return createOutput0(definition, element, description, context); } } throw new IOException(MessageFormat.format( Messages.getString("SpiImporterPreparator.errorFailedToCreateOutput"), //$NON-NLS-1$ description)); }
/** * Opens the target importer's input to prepare it. * @param <T> type of data model * @param type class of data model * @param description target importer * @return model object sink to prepare the importer's input * @throws IOException if failed to open the importer * @throws IllegalArgumentException if some parameters were {@code null} */ public <T> ModelOutput<T> prepare(Class<T> type, ImporterDescription description) throws IOException { if (type == null) { throw new IllegalArgumentException("type must not be null"); //$NON-NLS-1$ } if (description == null) { throw new IllegalArgumentException("description must not be null"); //$NON-NLS-1$ } if (type != description.getModelType()) { throw new IllegalArgumentException( "invalid model type: type must be = description.getModelType()"); //$NON-NLS-1$ } DataModelDefinition<T> definition = findDefinition(type); return importers.createOutput(definition, description, context); }