Search in sources :

Example 11 with InvalidApplicationException

use of org.qi4j.api.common.InvalidApplicationException in project qi4j-sdk by Qi4j.

the class ValueAssemblyImpl method newValueModel.

ValueModel newValueModel(StateDeclarations stateDeclarations, AssemblyHelper helper) {
    try {
        associationsModel = new AssociationsModel();
        manyAssociationsModel = new ManyAssociationsModel();
        buildComposite(helper, stateDeclarations);
        ValueModel valueModel = new ValueModel(types, visibility, metaInfo, mixinsModel, (ValueStateModel) stateModel, compositeMethodsModel);
        return valueModel;
    } catch (Exception e) {
        throw new InvalidApplicationException("Could not register " + types, e);
    }
}
Also used : ManyAssociationsModel(org.qi4j.runtime.association.ManyAssociationsModel) ValueModel(org.qi4j.runtime.value.ValueModel) InvalidApplicationException(org.qi4j.api.common.InvalidApplicationException) ManyAssociationsModel(org.qi4j.runtime.association.ManyAssociationsModel) AssociationsModel(org.qi4j.runtime.association.AssociationsModel) InvalidApplicationException(org.qi4j.api.common.InvalidApplicationException)

Example 12 with InvalidApplicationException

use of org.qi4j.api.common.InvalidApplicationException in project qi4j-sdk by Qi4j.

the class AbstractQi4jServletBootstrap method contextInitialized.

@Override
public final void contextInitialized(ServletContextEvent sce) {
    try {
        ServletContext context = sce.getServletContext();
        LOGGER.trace("Assembling Application");
        qi4j = new Energy4Java();
        applicationModel = qi4j.newApplicationModel(this);
        LOGGER.trace("Instanciating and activating Application");
        application = applicationModel.newInstance(qi4j.api());
        api = qi4j.api();
        beforeApplicationActivation(application);
        application.activate();
        afterApplicationActivation(application);
        LOGGER.trace("Storing Application in ServletContext");
        context.setAttribute(Qi4jServletSupport.APP_IN_CTX, application);
    } catch (Exception ex) {
        if (application != null) {
            try {
                beforeApplicationPassivation(application);
                application.passivate();
                afterApplicationPassivation(application);
            } catch (Exception ex1) {
                LOGGER.warn("Application not null and could not passivate it.", ex1);
            }
        }
        throw new InvalidApplicationException("Unexpected error during ServletContext initialization, see previous log for errors.", ex);
    }
}
Also used : ServletContext(javax.servlet.ServletContext) Energy4Java(org.qi4j.bootstrap.Energy4Java) InvalidApplicationException(org.qi4j.api.common.InvalidApplicationException) InvalidApplicationException(org.qi4j.api.common.InvalidApplicationException)

Aggregations

InvalidApplicationException (org.qi4j.api.common.InvalidApplicationException)12 AssociationsModel (org.qi4j.runtime.association.AssociationsModel)4 ManyAssociationsModel (org.qi4j.runtime.association.ManyAssociationsModel)4 MetaInfo (org.qi4j.api.common.MetaInfo)3 Provider (java.security.Provider)2 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)2 ActivatorsModel (org.qi4j.runtime.activation.ActivatorsModel)2 EntityModel (org.qi4j.runtime.entity.EntityModel)2 ValueModel (org.qi4j.runtime.value.ValueModel)2 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 TypeVariable (java.lang.reflect.TypeVariable)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ServletContext (javax.servlet.ServletContext)1 Activator (org.qi4j.api.activation.Activator)1 CollectionType (org.qi4j.api.type.CollectionType)1 EnumType (org.qi4j.api.type.EnumType)1 MapType (org.qi4j.api.type.MapType)1