use of org.apache.airavata.common.exception.ApplicationSettingsException in project airavata by apache.
the class RabbitMQListener method main.
public static void main(String[] args) {
File file = new File("/tmp/latency_client");
parseArguments(args);
try {
FileOutputStream fos = new FileOutputStream(file, false);
final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
String brokerUrl = ServerSettings.getSetting(RABBITMQ_BROKER_URL);
System.out.println("broker url " + brokerUrl);
final String exchangeName = ServerSettings.getSetting(RABBITMQ_EXCHANGE_NAME);
List<String> routingKeys = getRoutingKeys(level);
Subscriber subscriber = MessagingFactory.getSubscriber(message -> {
}, routingKeys, Type.STATUS);
} catch (ApplicationSettingsException e) {
logger.error("Error reading airavata server properties", e);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of org.apache.airavata.common.exception.ApplicationSettingsException in project airavata by apache.
the class PreJobCommandResource method isExists.
public boolean isExists(Object identifier) throws AppCatalogException {
HashMap<String, String> ids;
if (identifier instanceof Map) {
ids = (HashMap) identifier;
} else {
logger.error("Identifier should be a map with the field name and it's value");
throw new AppCatalogException("Identifier should be a map with the field name and it's value");
}
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(ids.get(PreJobCommandConstants.DEPLOYMENT_ID), ids.get(PreJobCommandConstants.COMMAND)));
if (em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
return preJobCommand != null;
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
throw new AppCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
use of org.apache.airavata.common.exception.ApplicationSettingsException in project airavata by apache.
the class ResourceJobManagerResource method remove.
@Override
public void remove(Object identifier) throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
Query q = generator.deleteQuery(em);
q.executeUpdate();
em.getTransaction().commit();
if (em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
throw new AppCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
use of org.apache.airavata.common.exception.ApplicationSettingsException in project airavata by apache.
the class ResourceJobManagerResource method get.
@Override
public AppCatalogResource get(Object identifier) throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
Query q = generator.selectQuery(em);
ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
em.getTransaction().commit();
if (em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
return resourceJobManagerResource;
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
throw new AppCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
use of org.apache.airavata.common.exception.ApplicationSettingsException in project airavata by apache.
the class ScpDataMovementResource method remove.
@Override
public void remove(Object identifier) throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
Query q = generator.deleteQuery(em);
q.executeUpdate();
em.getTransaction().commit();
if (em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
throw new AppCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
Aggregations