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);
}
}
}
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);
}
}
}
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);
}
}
}
}
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);
}
}
}
}
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;
}
Aggregations