} catch (IOException e) {
throw new IllegalArgumentException("Invalid application lib path " + file.getAbsolutePath());
}
}
ResourceAdapter resourceAdapter = connector.getResourceAdapter();
if (resourceAdapter.getResourceAdapterClass() != null) {
ResourceInfo resourceInfo = new ResourceInfo();
resourceInfo.service = "Resource";
if (resourceAdapter.getId() != null) {
resourceInfo.id = resourceAdapter.getId();
} else {
resourceInfo.id = connectorModule.getModuleId() + "RA";
}
resourceInfo.className = resourceAdapter.getResourceAdapterClass();
resourceInfo.properties = new Properties();
for (ConfigProperty property : resourceAdapter.getConfigProperty()) {
String name = property.getConfigPropertyName();
String value = property.getConfigPropertyValue();
if (value != null) {
resourceInfo.properties.setProperty(name, value);
}
}
resourceInfo.properties.putAll(ConfigurationFactory.getSystemProperties(resourceInfo.id, "RESOURCE"));
connectorInfo.resourceAdapter = resourceInfo;
}
OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
if (outbound != null) {
String transactionSupport = "none";
switch (outbound.getTransactionSupport()) {
case LOCAL_TRANSACTION:
transactionSupport = "local";
break;
case NO_TRANSACTION:
transactionSupport = "none";
break;
case XA_TRANSACTION:
transactionSupport = "xa";
break;
}
for (ConnectionDefinition connection : outbound.getConnectionDefinition()) {
ResourceInfo resourceInfo = new ResourceInfo();
resourceInfo.service = "Resource";
if (connection.getId() != null) {
resourceInfo.id = connection.getId();
} else if (outbound.getConnectionDefinition().size() == 1) {
resourceInfo.id = connectorModule.getModuleId();
} else {
resourceInfo.id = connectorModule.getModuleId() + "-" + connection.getConnectionFactoryInterface();
}
resourceInfo.className = connection.getManagedConnectionFactoryClass();
resourceInfo.types.add(connection.getConnectionFactoryInterface());
resourceInfo.properties = new Properties();
for (ConfigProperty property : connection.getConfigProperty()) {
String name = property.getConfigPropertyName();
String value = property.getConfigPropertyValue();
if (value != null) {
resourceInfo.properties.setProperty(name, value);
}
}
resourceInfo.properties.setProperty("TransactionSupport", transactionSupport);
resourceInfo.properties.setProperty("ResourceAdapter", connectorInfo.resourceAdapter.id);
resourceInfo.properties.putAll(ConfigurationFactory.getSystemProperties(resourceInfo.id, "RESOURCE"));
connectorInfo.outbound.add(resourceInfo);
}
}
InboundResource inbound = resourceAdapter.getInboundResourceAdapter();
if (inbound != null) {
for (MessageListener messageListener : inbound.getMessageAdapter().getMessageListener()) {
MdbContainerInfo mdbContainerInfo = new MdbContainerInfo();
mdbContainerInfo.service = "Container";
if (messageListener.getId() != null) {
mdbContainerInfo.id = messageListener.getId();
} else if (inbound.getMessageAdapter().getMessageListener().size() == 1) {
mdbContainerInfo.id = connectorModule.getModuleId();
} else {
mdbContainerInfo.id = connectorModule.getModuleId() + "-" + messageListener.getMessageListenerType();
}
mdbContainerInfo.properties = new Properties();
mdbContainerInfo.properties.setProperty("ResourceAdapter", connectorInfo.resourceAdapter.id);
mdbContainerInfo.properties.setProperty("MessageListenerInterface", messageListener.getMessageListenerType());
mdbContainerInfo.properties.setProperty("ActivationSpecClass", messageListener.getActivationSpec().getActivationSpecClass());
// todo provider system should fill in this information
mdbContainerInfo.types.add("MESSAGE");
mdbContainerInfo.className = "org.apache.openejb.core.mdb.MdbContainer";
mdbContainerInfo.constructorArgs.addAll(Arrays.asList("id", "transactionManager", "securityService", "ResourceAdapter", "MessageListenerInterface", "ActivationSpecClass", "InstanceLimit"));
mdbContainerInfo.properties.setProperty("InstanceLimit", "10");
mdbContainerInfo.properties.putAll(ConfigurationFactory.getSystemProperties(mdbContainerInfo.id, "CONTAINER"));
connectorInfo.inbound.add(mdbContainerInfo);
}
}
for (AdminObject adminObject : resourceAdapter.getAdminObject()) {
ResourceInfo resourceInfo = new ResourceInfo();
resourceInfo.service = "Resource";
if (adminObject.getId() != null) {
resourceInfo.id = adminObject.getId();
} else if (resourceAdapter.getAdminObject().size() == 1) {
resourceInfo.id = connectorModule.getModuleId();
} else {
resourceInfo.id = connectorModule.getModuleId() + "-" + adminObject.getAdminObjectInterface();
}
resourceInfo.className = adminObject.getAdminObjectClass();