if (connector.getResourceAdapter().getResourceAdapterClass() == null || connector.getResourceAdapter().getResourceAdapterClass().length() == 0) {
connector.getResourceAdapter().setResourceAdapterClass(connectorClass.getName());
}
final Connector connectorAnnotation = connectorClass.getAnnotation(Connector.class);
connector.setDisplayNames(getTexts(connector.getDisplayNames(), connectorAnnotation.displayName()));
connector.setDescriptions(getTexts(connector.getDescriptions(), connectorAnnotation.description()));
connector.setEisType(getString(connector.getEisType(), connectorAnnotation.eisType()));
connector.setVendorName(getString(connector.getVendorName(), connectorAnnotation.vendorName()));
connector.setResourceAdapterVersion(getString(connector.getResourceAdapterVersion(), connectorAnnotation.version()));
if (connector.getIcons().isEmpty()) {
final int smallIcons = connectorAnnotation.smallIcon().length;
final int largeIcons = connectorAnnotation.largeIcon().length;
for (int i = 0; i < smallIcons && i < largeIcons; i++) {
final Icon icon = new Icon();
// locale can't be specified in the annotation and it is en by default
// so on other systems it doesn't work because Icon return the default locale
icon.setLang(Locale.getDefault().getLanguage());
if (i < smallIcons) {
icon.setSmallIcon(connectorAnnotation.smallIcon()[i]);
}
if (i < largeIcons) {
icon.setLargeIcon(connectorAnnotation.largeIcon()[i]);
}
connector.getIcons().add(icon);
}
}
if (connector.getLicense() == null) {
final License license = new License();
connector.setLicense(license);
license.setLicenseRequired(connectorAnnotation.licenseRequired());
}
connector.getLicense().setDescriptions(getTexts(connector.getLicense().getDescriptions(), connectorAnnotation.licenseDescription()));
final SecurityPermission[] annotationSecurityPermissions = connectorAnnotation.securityPermissions();
List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
if (securityPermission == null) {
securityPermission = new ArrayList<org.apache.openejb.jee.SecurityPermission>();
}
if (securityPermission.size() == 0) {
for (final SecurityPermission sp : annotationSecurityPermissions) {
final org.apache.openejb.jee.SecurityPermission permission = new org.apache.openejb.jee.SecurityPermission();
permission.setSecurityPermissionSpec(sp.permissionSpec());
permission.setDescriptions(stringsToTexts(sp.description()));
securityPermission.add(permission);
}
}
final Class<? extends WorkContext>[] annotationRequiredWorkContexts = connectorAnnotation.requiredWorkContexts();
final List<String> requiredWorkContext = connector.getRequiredWorkContext();
if (requiredWorkContext.size() == 0) {
for (final Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
requiredWorkContext.add(cls.getName());
}
}
OutboundResourceAdapter outboundResourceAdapter = connector.getResourceAdapter().getOutboundResourceAdapter();
if (outboundResourceAdapter == null) {
outboundResourceAdapter = new OutboundResourceAdapter();
connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
}
final List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
final javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
if (authenticationMechanisms.size() == 0) {
for (final javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
final AuthenticationMechanism authMechanism = new AuthenticationMechanism();
authMechanism.setAuthenticationMechanismType(am.authMechanism());
authMechanism.setCredentialInterface(am.credentialInterface().toString());
authMechanism.setDescriptions(stringsToTexts(am.description()));
authenticationMechanisms.add(authMechanism);
}
}
if (outboundResourceAdapter.getTransactionSupport() == null) {
outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(connectorAnnotation.transactionSupport().toString()));
}
if (outboundResourceAdapter.isReauthenticationSupport() == null) {
outboundResourceAdapter.setReauthenticationSupport(connectorAnnotation.reauthenticationSupport());
}
}
// process @ConnectionDescription(s)
List<Class<?>> classes = finder.findAnnotatedClasses(ConnectionDefinitions.class);