public static void setResourceEnvironment(EARContext earContext, URI uri, ResourceEnvironmentBuilder builder, ResourceRefType[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException {
Map refMap = mapResourceRefs(gerResourceRefs);
Set unshareableResources = new HashSet();
Set applicationManagedSecurityResources = new HashSet();
for (int i = 0; i < resourceRefs.length; i++) {
ResourceRefType resourceRefType = resourceRefs[i];
String type = resourceRefType.getResType().getStringValue().trim();
if (!URL.class.getName().equals(type)
&& !"javax.mail.Session".equals(type)
&& !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
String containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, earContext);
if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
unshareableResources.add(containerId);
}
if ("Application".equals(getStringValue(resourceRefType.getResAuth()))) {
applicationManagedSecurityResources.add(containerId);
}
}
}
builder.setUnshareableResources(unshareableResources);