private void removeUnsetEnvEntries(final Map<String, EnvEntry> appEntries, final JndiConsumer consumer) { final Iterator<EnvEntry> entries = consumer.getEnvEntry().iterator(); while (entries.hasNext()) { final EnvEntry entry = entries.next(); if (entry.getEnvEntryValue() != null || entry.getLookupName() != null) { continue; } final EnvEntry appEntry = appEntries.get(entry.getName()); if (appEntry != null && appEntry.getEnvEntryValue() != null) { entry.setEnvEntryValue(appEntry.getEnvEntryValue()); } else { entries.remove(); } } }
private void removeUnsetEnvEntries(final Map<String, EnvEntry> appEntries, final JndiConsumer consumer) { final Iterator<EnvEntry> entries = consumer.getEnvEntry().iterator(); while (entries.hasNext()) { final EnvEntry entry = entries.next(); if (entry.getEnvEntryValue() != null || entry.getLookupName() != null) { continue; } final EnvEntry appEntry = appEntries.get(entry.getName()); if (appEntry != null && appEntry.getEnvEntryValue() != null) { entry.setEnvEntryValue(appEntry.getEnvEntryValue()); } else { entries.remove(); } } }
private void fillInMissingType(final ClassLoader loader, final EnvEntry entry) { if (entry.getType() != null) { return; } // If it has the lookup supplied we don't care if there is no type if (entry.getLookupName() != null) { return; } // We can't imply type without at least one injection point if (entry.getInjectionTarget().size() == 0) { return; } final Set<Class> types = new HashSet<Class>(); for (final InjectionTarget target : entry.getInjectionTarget()) { if (target.getInjectionTargetClass() == null) { continue; } if (target.getInjectionTargetName() == null) { continue; } types.add(getType(loader, target)); } normalize(types); final Class<?> type = types.size() == 1 ? types.iterator().next() : String.class; entry.setType(type.getName()); }
private void fillInMissingType(final ClassLoader loader, final EnvEntry entry) { if (entry.getType() != null) { return; } // If it has the lookup supplied we don't care if there is no type if (entry.getLookupName() != null) { return; } // We can't imply type without at least one injection point if (entry.getInjectionTarget().size() == 0) { return; } final Set<Class> types = new HashSet<Class>(); for (final InjectionTarget target : entry.getInjectionTarget()) { if (target.getInjectionTargetClass() == null) { continue; } if (target.getInjectionTargetName() == null) { continue; } types.add(getType(loader, target)); } normalize(types); final Class<?> type = types.size() == 1 ? types.iterator().next() : String.class; entry.setType(type.getName()); }
@Override public String toString() { return "EnvEntry{" + "name='" + getEnvEntryName() + '\'' + ", type='" + getEnvEntryType() + '\'' + ", value='" + getEnvEntryValue() + '\'' + ", mappedName='" + getMappedName() + '\'' + ", lookupName='" + getLookupName() + '\'' + '}'; } }
@Override public String toString() { return "EnvEntry{" + "name='" + getEnvEntryName() + '\'' + ", type='" + getEnvEntryType() + '\'' + ", value='" + getEnvEntryValue() + '\'' + ", mappedName='" + getMappedName() + '\'' + ", lookupName='" + getLookupName() + '\'' + '}'; } }
if (strValueOverride == null) { strValue = envEntry.getEnvEntryValue(); String lookupName = getStringValue(envEntry.getLookupName()); if (strValue != null && lookupName != null) { throw new DeploymentException("You must specify an environment entry value or lookup name but not both. Component: " + module.toString() + ", name: " + name + ", env-entry-value: " + strValue + ", lookup-name: " + lookupName + "");
private void buildEnvEntryInfos(final JndiConsumer item, final JndiEncInfo moduleJndiEnc, final JndiEncInfo compJndiEnc) { for (final EnvEntry env : item.getEnvEntry()) { // ignore env entries without a value and lookup name //If the the reference name of the environment entry is belong to those shareable JNDI name space, it somewhat is a valid one if (env.getEnvEntryValue() == null && env.getLookupName() == null && !isShareableJNDINamespace(env.getEnvEntryName()) && !CompManagedBean.class.isInstance(item) /* in this case we can desire to contextually lookup webapp value from an ear lib */) { continue; } final EnvEntryInfo info = new EnvEntryInfo(); info.referenceName = env.getEnvEntryName(); info.type = env.getEnvEntryType(); info.value = env.getEnvEntryValue(); info.location = buildLocationInfo(env); info.targets.addAll(buildInjectionInfos(env)); insert( info, appInfo.globalJndiEnc.envEntries, appInfo.appJndiEnc.envEntries, moduleJndiEnc.envEntries, compJndiEnc.envEntries ); } }
private void buildEnvEntryInfos(final JndiConsumer item, final JndiEncInfo moduleJndiEnc, final JndiEncInfo compJndiEnc) { for (final EnvEntry env : item.getEnvEntry()) { // ignore env entries without a value and lookup name //If the the reference name of the environment entry is belong to those shareable JNDI name space, it somewhat is a valid one if (env.getEnvEntryValue() == null && env.getLookupName() == null && !isShareableJNDINamespace(env.getEnvEntryName())) { continue; } final EnvEntryInfo info = new EnvEntryInfo(); info.referenceName = env.getEnvEntryName(); info.type = env.getEnvEntryType(); info.value = env.getEnvEntryValue(); info.location = buildLocationInfo(env); info.targets.addAll(buildInjectionInfos(env)); insert( info, appInfo.globalJndiEnc.envEntries, appInfo.appJndiEnc.envEntries, moduleJndiEnc.envEntries, compJndiEnc.envEntries ); } }