public EnvEntry injectionTarget(final String className, final String property) { getInjectionTarget().add(new InjectionTarget(className, property)); if (this.getEnvEntryName() == null) { this.setEnvEntryName("java:comp/env/" + className + "/" + property); } return this; }
public EnvEntry injectionTarget(final String className, final String property) { getInjectionTarget().add(new InjectionTarget(className, property)); if (this.getEnvEntryName() == null) { this.setEnvEntryName("java:comp/env/" + className + "/" + property); } return this; }
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 void preProcessWebXmlElement(WebApp webApp, MergeContext mergeContext) throws DeploymentException { for (EnvEntry envEntry : webApp.getEnvEntry()) { String envEntryName = envEntry.getEnvEntryName(); mergeContext.setAttribute(createEnvEntryKey(envEntryName), new MergeItem(envEntry, null, ElementSource.WEB_XML)); //Create an attribute tag to indicate whether injectTarget is configured in web.xml file if (envEntry.getInjectionTarget().size() > 0) { mergeContext.setAttribute(createEnvEntryInjectTargetConfiguredInWebXMLKey(envEntryName), Boolean.TRUE); } for (InjectionTarget injectionTarget : envEntry.getInjectionTarget()) { mergeContext.setAttribute(createEnvEntryInjectTargetKey(envEntryName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName() ), Boolean.TRUE); } } }
Set<InjectionTarget> targets = envEntry.getInjectionTarget(); if (!hasTarget(method, field, targets)) { envEntry.getInjectionTarget().add(configureInjectionTarget(method, field));
addInjections(normalize(name), ReferenceType.ENV_ENTRY, envEntry.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext)); continue; type = inferAndCheckType(module, bundle, envEntry.getInjectionTarget(), name, type); put(name, value, ReferenceType.ENV_ENTRY, module.getJndiContext(), envEntry.getInjectionTarget(), sharedContext); } else if(isSharableJndiNamespace(name)) { addInjections(normalize(name), ReferenceType.ENV_ENTRY, envEntry.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
for (InjectionTarget injectTarget : srcEnvEntry.getInjectionTarget()) { String envEntryInjectTargetKey = createEnvEntryInjectTargetKey(envEntryName, injectTarget.getInjectionTargetClass(), injectTarget .getInjectionTargetName()); if (!mergeContext.containsAttribute(envEntryInjectTargetKey)) { envEntry.getInjectionTarget().add(injectTarget); mergeContext.setAttribute(envEntryInjectTargetKey, Boolean.TRUE); webApp.getEnvEntry().add(srcEnvEntry); mergeContext.setAttribute(envEntryKey, new MergeItem(srcEnvEntry, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT)); for (InjectionTarget injectionTarget : srcEnvEntry.getInjectionTarget()) { mergeContext.setAttribute(createEnvEntryInjectTargetKey(envEntryName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName() ), Boolean.TRUE);