Search in sources :

Example 11 with ContextKey

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

the class BusinessFunctionManager method registerResource.

/**
 * registerResource - Registers the roles into the business function repository from a business-functions.xml file.
 * @param resource the object that contains the xml config file.
 * @param context  key with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    BusinessFunctions businessFunctions = JAXBHelper.unmarshalConfigFile(BusinessFunctions.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (businessFunctions.getBusinessFunction() != null) {
        for (final BusinessFunction businessFunction : businessFunctions.getBusinessFunction()) {
            ContextKey contextKey = new ContextKey(businessFunction.getName(), resource.getURI().toString(), variation, context);
            registerBusinessFunction(contextKey, businessFunction);
        }
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) BusinessFunctions(org.jaffa.security.businessfunctionsdomain.BusinessFunctions) BusinessFunction(org.jaffa.security.businessfunctionsdomain.BusinessFunction)

Example 12 with ContextKey

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

the class RoleManager method registerResource.

/**
 * registerResource - Registers the roles into the role repository from the roles.xml files found in META-INF/roles.xml
 * that exist in the classpath.
 * @param resource the object that contains the xml config file.
 * @param context  key with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Roles roles = JAXBHelper.unmarshalConfigFile(Roles.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (roles.getRole() != null) {
        for (final Role role : roles.getRole()) {
            ContextKey key = new ContextKey(role.getName(), resource.getURI().toString(), variation, context);
            registerRole(key, role);
        }
    }
}
Also used : Role(org.jaffa.security.securityrolesdomain.Role) ContextKey(org.jaffa.loader.ContextKey) Roles(org.jaffa.security.securityrolesdomain.Roles)

Example 13 with ContextKey

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

the class MessagingManager method registerResource.

/**
 * Unmarshall the contents of the configuration to create and register
 * MessageInfo, QueueInfo, TopicInfo, and/or MessageFilter objects.
 * @param resource the object that contains the xml config file.
 * @param context key with which config file to be registered.
 * @param variation key with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    List<Object> messageObjects = config.getMessageOrQueueOrTopic();
    if (messageObjects != null) {
        for (final Object o : messageObjects) {
            if (o instanceof MessageInfo) {
                final MessageInfo info = (MessageInfo) o;
                validateMessageInfo(info);
                ContextKey contextKey = new ContextKey(info.getDataBean(), resource.getURI().toString(), variation, context);
                registerMessageInfo(contextKey, info);
            } else if (o instanceof QueueInfo) {
                final QueueInfo info = (QueueInfo) o;
                ContextKey contextKey = new ContextKey(info.getName(), resource.getURI().toString(), variation, context);
                registerQueueInfo(contextKey, info);
            } else if (o instanceof TopicInfo) {
                final TopicInfo info = (TopicInfo) o;
                ContextKey contextKey = new ContextKey(info.getName(), resource.getURI().toString(), variation, context);
                registerTopicInfo(contextKey, info);
            } else if (o instanceof MessageFilter) {
                final MessageFilter filter = (MessageFilter) o;
                ContextKey contextKey = new ContextKey(filter.getFilterName(), resource.getURI().toString(), variation, context);
                registerMessageFilter(contextKey, filter);
            } else {
                log.warn("MessagingObject.registerResource, unexpected object: " + o);
            }
        }
        // for
        checkForQueueAndTopicNamingConflicts();
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.modules.messaging.services.configdomain.Config)

Example 14 with ContextKey

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

the class MessagingManager method unregisterResource.

/**
 * Unregister the message objects defined by a particular resource.
 * @param resource the object that contains the xml config file.
 * @param context key with which config file to be registered.
 * @param variation key with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException
 */
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    List<Object> messageObjects = config.getMessageOrQueueOrTopic();
    if (messageObjects != null) {
        for (final Object o : messageObjects) {
            if (o instanceof MessageInfo) {
                final MessageInfo info = (MessageInfo) o;
                validateMessageInfo(info);
                ContextKey contextKey = new ContextKey(info.getDataBean(), resource.getURI().toString(), variation, context);
                unregisterMessageInfo(contextKey);
            } else if (o instanceof QueueInfo) {
                final QueueInfo info = (QueueInfo) o;
                ContextKey contextKey = new ContextKey(info.getName(), resource.getURI().toString(), variation, context);
                unregisterQueueInfo(contextKey);
            } else if (o instanceof TopicInfo) {
                final TopicInfo info = (TopicInfo) o;
                ContextKey contextKey = new ContextKey(info.getName(), resource.getURI().toString(), variation, context);
                unregisterTopicInfo(contextKey);
            } else if (o instanceof MessageFilter) {
                final MessageFilter filter = (MessageFilter) o;
                ContextKey contextKey = new ContextKey(filter.getFilterName(), resource.getURI().toString(), variation, context);
                unregisterMessageFilter(contextKey);
            } else {
                log.warn("MessagingObject.registerResource, unexpected object: " + o);
            }
        }
        // for
        checkForQueueAndTopicNamingConflicts();
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.modules.messaging.services.configdomain.Config)

Example 15 with ContextKey

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

the class SoaEventManager method registerResource.

/**
 * {@inheritDoc}
 */
@Override
public void registerResource(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);
            registerSoaEventInfo(contextKey, soaEventInfo);
        }
    }
}
Also used : SoaEventInfo(org.jaffa.soa.services.configdomain.SoaEventInfo) ContextKey(org.jaffa.loader.ContextKey) SoaEvents(org.jaffa.soa.services.configdomain.SoaEvents)

Aggregations

ContextKey (org.jaffa.loader.ContextKey)49 Test (org.junit.Test)21 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 Properties (java.util.Properties)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 InputStream (java.io.InputStream)2 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