Search in sources :

Example 51 with ContextKey

use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.

the class SchedulerManager method registerResource.

/**
 * {@inheritDoc}
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (config.getTask() != null) {
        for (final Task schedulerTask : config.getTask()) {
            ContextKey contextKey = new ContextKey(schedulerTask.getDataBean(), resource.getURI().toString(), variation, context);
            registerSchedulerTask(contextKey, schedulerTask);
        }
    }
}
Also used : Task(org.jaffa.modules.scheduler.services.configdomain.Task) ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.modules.scheduler.services.configdomain.Config)

Example 52 with ContextKey

use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.

the class SoaEventManager method unregisterResource.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    SoaEvents soaEvents = JAXBHelper.unmarshalConfigFile(SoaEvents.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (soaEvents != null) {
        for (SoaEventInfo soaEventInfo : soaEvents.getSoaEvent()) {
            ContextKey contextKey = new ContextKey(soaEventInfo.getName(), resource.getURI().toString(), variation, context);
            unregisterSoaEventInfo(contextKey);
        }
    }
}
Also used : SoaEventInfo(org.jaffa.soa.services.configdomain.SoaEventInfo) ContextKey(org.jaffa.loader.ContextKey) SoaEvents(org.jaffa.soa.services.configdomain.SoaEvents)

Example 53 with ContextKey

use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.

the class TransactionManager method registerResource.

/**
 * {@inheritDoc}
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (config.getTransactionOrType() != null) {
        for (final Object o : config.getTransactionOrType()) {
            if (o.getClass() == TransactionInfo.class) {
                final TransactionInfo transactionInfo = (TransactionInfo) o;
                ContextKey contextKey = new ContextKey(transactionInfo.getDataBean(), resource.getURI().toString(), variation, context);
                registerTransactionInfo(contextKey, transactionInfo);
            } else if (o.getClass() == TypeInfo.class) {
                final TypeInfo typeInfo = (TypeInfo) o;
                ContextKey contextKey = new ContextKey(typeInfo.getName(), resource.getURI().toString(), variation, context);
                registerTypeInfo(contextKey, typeInfo);
            }
        }
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.transaction.services.configdomain.Config) TransactionInfo(org.jaffa.transaction.services.configdomain.TransactionInfo) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo)

Example 54 with ContextKey

use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.

the class TransactionManager method unregisterResource.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (config.getTransactionOrType() != null) {
        for (final Object o : config.getTransactionOrType()) {
            if (o.getClass() == TransactionInfo.class) {
                final TransactionInfo transactionInfo = (TransactionInfo) o;
                ContextKey contextKey = new ContextKey(transactionInfo.getDataBean(), resource.getURI().toString(), variation, context);
                unregisterTransactionInfo(contextKey);
            } else if (o.getClass() == TypeInfo.class) {
                final TypeInfo typeInfo = (TypeInfo) o;
                ContextKey contextKey = new ContextKey(typeInfo.getName(), resource.getURI().toString(), variation, context);
                unregisterTypeInfo(contextKey);
            }
        }
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.transaction.services.configdomain.Config) TransactionInfo(org.jaffa.transaction.services.configdomain.TransactionInfo) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo)

Example 55 with ContextKey

use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.

the class TransactionManager method getTransactionInfo.

/**
 * Returns the TransactionInfo object for the input dataBeanClass, as defined in the configuration file.
 *
 * @param dataBeanClass the class for a dataBean.
 * @return the TransactionInfo object for the input dataBeanClass, as defined in the configuration file.
 */
public TransactionInfo getTransactionInfo(Class dataBeanClass) {
    final String dataBeanClassName = dataBeanClass.getName();
    TransactionInfo transactionInfo = getTransactionInfo(dataBeanClassName);
    if (transactionInfo == null) {
        // Lookup the class heirarchy. Add a NULL for the dataBeanClassName, even if a TransactionInfo is not found
        ContextKey superClassContextKey = null;
        while (dataBeanClass.getSuperclass() != null) {
            dataBeanClass = dataBeanClass.getSuperclass();
            transactionInfo = getTransactionInfo(dataBeanClass.getName());
            superClassContextKey = getTransactionRepository().findKey(dataBeanClass.getName());
            if (transactionInfo != null)
                break;
        }
        if ((superClassContextKey != null) && (transactionInfo != null)) {
            registerTransactionInfo(new ContextKey(transactionInfo.getDataBean(), superClassContextKey.getFileName(), superClassContextKey.getVariation(), superClassContextKey.getPrecedence()), transactionInfo);
        }
    }
    return transactionInfo;
}
Also used : ContextKey(org.jaffa.loader.ContextKey) TransactionInfo(org.jaffa.transaction.services.configdomain.TransactionInfo)

Aggregations

ContextKey (org.jaffa.loader.ContextKey)55 Test (org.junit.Test)21 Properties (java.util.Properties)6 ComponentDefinition (org.jaffa.presentation.portlet.component.ComponentDefinition)6 Component (org.jaffa.presentation.portlet.component.componentdomain.Component)5 TransactionInfo (org.jaffa.transaction.services.configdomain.TransactionInfo)5 TypeInfo (org.jaffa.transaction.services.configdomain.TypeInfo)5 InputStream (java.io.InputStream)4 Task (org.jaffa.modules.scheduler.services.configdomain.Task)4 GlobalMenu (org.jaffa.components.navigation.domain.GlobalMenu)3 BusinessFunction (org.jaffa.security.businessfunctionsdomain.BusinessFunction)3 Role (org.jaffa.security.securityrolesdomain.Role)3 Config (org.jaffa.transaction.services.configdomain.Config)3 Config (org.jaffa.modules.messaging.services.configdomain.Config)2 JmsConfig (org.jaffa.modules.messaging.services.configdomain.JmsConfig)2 JndiConfig (org.jaffa.modules.messaging.services.configdomain.JndiConfig)2 Config (org.jaffa.modules.scheduler.services.configdomain.Config)2 Components (org.jaffa.presentation.portlet.component.componentdomain.Components)2 BusinessFunctions (org.jaffa.security.businessfunctionsdomain.BusinessFunctions)2 Roles (org.jaffa.security.securityrolesdomain.Roles)2