} catch (IOException e) {
throw new IllegalArgumentException("Invalid application lib path " + file.getAbsolutePath());
}
}
ResourceAdapter resourceAdapter = connector.getResourceAdapter();
if (resourceAdapter.getResourceAdapterClass() != null) {
String id = getId(connectorModule);
String className = resourceAdapter.getResourceAdapterClass();
ServiceProvider provider = new ServiceProvider(className, id, "Resource");
provider.getTypes().add(className);
ServiceUtils.registerServiceProvider(appId, provider);
Resource resource = new Resource(id, className, appId + "#" + id);
for (ConfigProperty property : resourceAdapter.getConfigProperty()) {
String name = property.getConfigPropertyName();
String value = property.getConfigPropertyValue();
if (value != null) {
resource.getProperties().setProperty(name, value);
}
}
connectorInfo.resourceAdapter = configFactory.configureService(resource, ResourceInfo.class);
}
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()) {
String id = getId(connection, outbound, connectorModule);
String className = connection.getManagedConnectionFactoryClass();
String type = connection.getConnectionFactoryInterface();
ServiceProvider provider = new ServiceProvider(className, id, "Resource");
provider.getTypes().add(type);
ServiceUtils.registerServiceProvider(appId, provider);
Resource resource = new Resource(id, type, appId + "#" + id);
Properties properties = resource.getProperties();
for (ConfigProperty property : connection.getConfigProperty()) {
String name = property.getConfigPropertyName();
String value = property.getConfigPropertyValue();
if (value != null) {
properties.setProperty(name, value);
}
}
properties.setProperty("TransactionSupport", transactionSupport);
if (connectorInfo.resourceAdapter != null) {
properties.setProperty("ResourceAdapter", connectorInfo.resourceAdapter.id);
}
ResourceInfo resourceInfo = configFactory.configureService(resource, ResourceInfo.class);
connectorInfo.outbound.add(resourceInfo);
}
}
InboundResourceadapter inbound = resourceAdapter.getInboundResourceAdapter();
if (inbound != null) {
for (MessageListener messageListener : inbound.getMessageAdapter().getMessageListener()) {
String id = getId(messageListener, inbound, connectorModule);
Container container = new Container(id, "MESSAGE", null);
Properties properties = container.getProperties();
properties.setProperty("ResourceAdapter", connectorInfo.resourceAdapter.id);
properties.setProperty("MessageListenerInterface", messageListener.getMessageListenerType());
properties.setProperty("ActivationSpecClass", messageListener.getActivationSpec().getActivationSpecClass());
MdbContainerInfo mdbContainerInfo = configFactory.configureService(container, MdbContainerInfo.class);
connectorInfo.inbound.add(mdbContainerInfo);
}
}
for (AdminObject adminObject : resourceAdapter.getAdminObject()) {
String id = getId(adminObject, resourceAdapter, connectorModule);
String className = adminObject.getAdminObjectClass();
String type = adminObject.getAdminObjectInterface();