Search in sources :

Example 1 with Components

use of org.jaffa.presentation.portlet.component.componentdomain.Components in project jaffa-framework by jaffa-projects.

the class ComponentManager method registerResource.

/**
 * Unmarshall the contents of the configuration to create and register
 * ComponentDefinition, 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 with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException for file opening or reading errors, or when an
 * attempt to create a ComponentDefinition throws a
 * ComponentDefinitionException
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Components components = JAXBHelper.unmarshalConfigFile(Components.class, resource, COMPONENT_XSD);
    List<Component> componentList = components.getComponent();
    if (componentList != null) {
        for (final Component component : componentList) {
            ComponentDefinition definition = createComponentDefinition(component);
            ContextKey contextKey = new ContextKey(definition.getComponentName(), resource.getURI().toString(), variation, context);
            registerComponentDefinition(contextKey, definition);
        }
    }
}
Also used : Components(org.jaffa.presentation.portlet.component.componentdomain.Components) ContextKey(org.jaffa.loader.ContextKey) Component(org.jaffa.presentation.portlet.component.componentdomain.Component) ComponentDefinition(org.jaffa.presentation.portlet.component.ComponentDefinition)

Example 2 with Components

use of org.jaffa.presentation.portlet.component.componentdomain.Components in project jaffa-framework by jaffa-projects.

the class ComponentManager method unregisterResource.

/**
 * Unregister a given component resource.
 * @param resource the object that contains the xml config file.
 * @param context key with which config file to be registered.
 * @param variation with which config file to be registered.
 * @throws JAXBException
 * @throws SAXException
 * @throws IOException for file opening or reading errors, or when an
 * attempt to create a ComponentDefinition throws a
 * ComponentDefinitionException
 */
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Components components = JAXBHelper.unmarshalConfigFile(Components.class, resource, COMPONENT_XSD);
    List<Component> componentList = components.getComponent();
    if (componentList != null) {
        for (final Component component : componentList) {
            ComponentDefinition definition = createComponentDefinition(component);
            ContextKey contextKey = new ContextKey(definition.getComponentName(), resource.getURI().toString(), variation, context);
            unregisterComponentDefinition(contextKey);
        }
    }
}
Also used : Components(org.jaffa.presentation.portlet.component.componentdomain.Components) ContextKey(org.jaffa.loader.ContextKey) Component(org.jaffa.presentation.portlet.component.componentdomain.Component) ComponentDefinition(org.jaffa.presentation.portlet.component.ComponentDefinition)

Aggregations

ContextKey (org.jaffa.loader.ContextKey)2 ComponentDefinition (org.jaffa.presentation.portlet.component.ComponentDefinition)2 Component (org.jaffa.presentation.portlet.component.componentdomain.Component)2 Components (org.jaffa.presentation.portlet.component.componentdomain.Components)2