use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class MessagingManager method getMessageInfo.
/**
* Returns the MessageInfo object for the input dataBeanClass,
* as defined in the configuration file.
* @param dataBeanClass key used for the repository
* @return the MessageInfo object for the input dataBeanClass
*/
public MessageInfo getMessageInfo(String dataBeanClass) {
MessageInfo messageInfo = messageInfoRepository.query(dataBeanClass);
if (messageInfo == null) {
// Lookup the class heirarchy. Add a NULL for the dataBeanClassName, even if a MessageInfo is not found
synchronized (messageInfoRepository) {
messageInfo = messageInfoRepository.query(dataBeanClass);
try {
if (messageInfo == null) {
Class clazz = Class.forName(dataBeanClass);
ContextKey superClassContextKey = null;
while (clazz.getSuperclass() != null && messageInfo == null) {
clazz = clazz.getSuperclass();
messageInfo = messageInfoRepository.query(clazz.getName());
superClassContextKey = messageInfoRepository.findKey(clazz.getName());
}
if (superClassContextKey != null) {
messageInfoRepository.register(new ContextKey(dataBeanClass, superClassContextKey.getFileName(), superClassContextKey.getVariation(), superClassContextKey.getPrecedence()), messageInfo);
}
}
} catch (ClassNotFoundException e) {
log.error("Unable to find class definition for " + dataBeanClass, e);
}
}
}
return messageInfo;
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class JndiJmsManager method registerResource.
/**
* Unmarshall the contents of the configuration to create and register
* JmsConfig 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 {
JndiConfig config = JAXBHelper.unmarshalConfigFile(JndiConfig.class, resource, JMS_JNDI_CONFIGURATION_SCHEMA_FILE);
JmsConfig jmsConfig = config.getJmsConfig();
populateJmsConfig(jmsConfig);
ContextKey contextKey = new ContextKey(jmsConfig.getUser(), resource.getURI().toString(), variation, context);
jmsRepository.register(contextKey, jmsConfig);
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class JndiJmsManager method unregisterResource.
/**
* Unregister the JmsConfig 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 {
JndiConfig config = JAXBHelper.unmarshalConfigFile(JndiConfig.class, resource, JMS_JNDI_CONFIGURATION_SCHEMA_FILE);
JmsConfig jmsConfig = config.getJmsConfig();
ContextKey contextKey = new ContextKey(jmsConfig.getUser(), resource.getURI().toString(), variation, context);
jmsRepository.unregister(contextKey);
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class SchedulerManager 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.getTask() != null) {
for (final Task schedulerTask : config.getTask()) {
ContextKey contextKey = new ContextKey(schedulerTask.getDataBean(), resource.getURI().toString(), variation, context);
unregisterSchedulerTask(contextKey);
}
}
}
use of org.jaffa.loader.ContextKey in project jaffa-framework by jaffa-projects.
the class SchedulerManager method getSchedulerTask.
/**
* Returns the scheduler task 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 Task getSchedulerTask(String dataBeanClass) {
Task task = schedulerTaskRepository.query(dataBeanClass);
if (task == null) {
// Lookup the class hierarchy. Add a NULL for the dataBeanClassName, even if a Task is not found
synchronized (schedulerTaskRepository) {
task = schedulerTaskRepository.query(dataBeanClass);
try {
if (task == null) {
Class clazz = Class.forName(dataBeanClass);
ContextKey superClassContextKey = null;
while (clazz.getSuperclass() != null && task == null) {
clazz = clazz.getSuperclass();
task = schedulerTaskRepository.query(clazz.getName());
superClassContextKey = schedulerTaskRepository.findKey(clazz.getName());
}
if (superClassContextKey != null) {
schedulerTaskRepository.register(new ContextKey(dataBeanClass, superClassContextKey.getFileName(), superClassContextKey.getVariation(), superClassContextKey.getVariation()), task);
}
}
} catch (ClassNotFoundException e) {
log.error("Unable to find class definition for " + dataBeanClass, e);
}
}
}
return task;
}
Aggregations