Search in sources :

Example 31 with WholeIllegalArgumentException

use of org.whole.lang.exceptions.WholeIllegalArgumentException in project whole by wholeplatform.

the class ReusablesDynamicCompilerVisitor method visit.

@Override
public void visit(PersistenceId entity) {
    String persistenceKitId = entity.getValue();
    setResultIterator(IteratorFactory.singleValuedRunnableIterator((IEntity selfEntity, IBindingManager bm, IEntity... arguments) -> {
        if (!ReflectionFactory.hasPersistenceKit(persistenceKitId))
            throw new WholeIllegalArgumentException("The Persistence is not deployed: " + persistenceKitId).withSourceEntity(entity).withBindings(bm);
        bm.setResult(BindingManagerFactory.instance.createValue(ReflectionFactory.getPersistenceKit(persistenceKitId)));
    }).withSourceEntity(entity));
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) WholeIllegalArgumentException(org.whole.lang.exceptions.WholeIllegalArgumentException)

Example 32 with WholeIllegalArgumentException

use of org.whole.lang.exceptions.WholeIllegalArgumentException in project whole by wholeplatform.

the class ReusablesDynamicCompilerVisitor method visit.

@Override
public void visit(URL entity) {
    entity.getPersistence().accept(this);
    IEntityIterator<?> persistenceIterator = getResultIterator();
    entity.getContent().accept(this);
    IEntityIterator<?> contentIterator = getResultIterator();
    setResultIterator(IteratorFactory.composeIterator(IteratorFactory.singleValuedRunnableIterator(new ResourcePersistenceRunnable() {

        protected IPersistenceProvider getPersistenceProvider(String path, IBindingManager bm) {
            try {
                return new URLPersistenceProvider(new java.net.URL(path), bm);
            } catch (MalformedURLException e) {
                throw new WholeIllegalArgumentException(e).withSourceEntity(entity).withBindings(bm);
            }
        }
    }, new int[] { 0 }, persistenceIterator).withSourceEntity(entity), contentIterator));
}
Also used : MalformedURLException(java.net.MalformedURLException) IBindingManager(org.whole.lang.bindings.IBindingManager) URLPersistenceProvider(org.whole.lang.codebase.URLPersistenceProvider) WholeIllegalArgumentException(org.whole.lang.exceptions.WholeIllegalArgumentException)

Aggregations

WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)32 DataKinds (org.whole.lang.reflect.DataKinds)16 IEntity (org.whole.lang.model.IEntity)15 EnumValue (org.whole.lang.model.EnumValue)3 IBindingManager (org.whole.lang.bindings.IBindingManager)2 IWholeRuntimeException (org.whole.lang.exceptions.IWholeRuntimeException)2 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)2 ILanguageKit (org.whole.lang.reflect.ILanguageKit)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 DateTimeZone (org.joda.time.DateTimeZone)1 DateTimeParser (org.joda.time.format.DateTimeParser)1 DateTimeParserBucket (org.joda.time.format.DateTimeParserBucket)1 FixedDateTimeZone (org.joda.time.tz.FixedDateTimeZone)1 ITransactionScope (org.whole.lang.bindings.ITransactionScope)1 URLPersistenceProvider (org.whole.lang.codebase.URLPersistenceProvider)1 IEntityFactory (org.whole.lang.factories.IEntityFactory)1 IEntityRegistryProvider (org.whole.lang.factories.IEntityRegistryProvider)1 CompiledPattern (org.whole.lang.grammars.model.CompiledPattern)1 Pattern (org.whole.lang.grammars.model.Pattern)1