void copy(Set s) { Iterator i = s.iterator(); defaults = new Properties(); while ( i.hasNext() ) { EnvironmentProperty p = (EnvironmentProperty)i.next(); if ( p.getName().startsWith(ejb10Prefix) ) { String newName = p.getName().substring(ejb10Prefix.length()); defaults.put(newName, p.getValue()); } } }
@Override public EnvironmentProperty getDescriptor() { if (envProp == null) envProp = new EnvironmentProperty(); return envProp; }
/** * Store references to environment entries. * Also validate custom resources of primitive data types. */ private void parseResources(EnvironmentProperty envProp, JndiNameEnvironment env, AppResources appResources) { String name = getLogicalJNDIName(envProp.getName(), env); String jndiName = ""; if (envProp.hasLookupName()) jndiName = envProp.getLookupName(); // error handling for mapped name null case done in getMappedName else if (envProp.getMappedName().length() > 0) jndiName = envProp.getMappedName(); AppResource envPropResource = new AppResource(name, jndiName, envProp.getType(), env, true); // If lookup/mapped name is not present, then we do not need to validate. if (jndiName.length() == 0) envPropResource.noValidation(); appResources.store(envPropResource); // Store EnvProps even if they do not have a valid lookup element appResources.storeInNamespace(name, env); }
/** * This method will copy the injection targets from env2 to env1. * * @param env1 * @param env2 */ private void combineInjectionTargets(EnvironmentProperty env1, EnvironmentProperty env2) { for (InjectionTarget injTarget: env2.getInjectionTargets()) { env1.addInjectionTarget(injTarget); } }
/** ** Returns the typed value object of this environment property. Throws an IllegalArgumentException if bounds checking is ** true and the value cannot be ** reconciled with the given type. */ public Object getValueObject() { if (this.valueObject == null) { this.valueObject = ""; } return getObjectFromString(this.getValue(), this.getValueType()); }
protected boolean isConflictResourceGroup(EnvironmentProperty other) { return !(getLookupName().equals(other.getLookupName()) && getMappedName().equals(other.getMappedName())); }
desc.addInjectionTarget(target); if (!ok(desc.getName())) { // a new one desc.setName(logicalName); if (!ok(desc.getInjectResourceType())) { desc.setInjectResourceType(resourceType.getName()); if (!ok(desc.getDescription()) && ok(resourceAn.description())) desc.setDescription(resourceAn.description()); if (!desc.hasLookupName() && !desc.isSetValueCalled() && ok(getResourceLookupValue(resourceAn, ainfo))) desc.setLookupName(getResourceLookupValue(resourceAn, ainfo)); if (!ok(desc.getMappedName()) && ok(resourceAn.mappedName())) desc.setMappedName(resourceAn.mappedName());
@Override public Node writeDescriptor(Node parent, String nodeName, EnvironmentProperty envProp) { Node envEntryNode = super.writeDescriptor(parent, nodeName, envProp); writeLocalizedDescriptions(envEntryNode, envProp); appendTextChild(envEntryNode, TagNames.ENVIRONMENT_PROPERTY_NAME, envProp.getName()); appendTextChild(envEntryNode, TagNames.ENVIRONMENT_PROPERTY_TYPE, envProp.getType()); appendTextChild(envEntryNode, TagNames.ENVIRONMENT_PROPERTY_VALUE, envProp.getValue()); appendTextChild(envEntryNode, TagNames.MAPPED_NAME, envProp.getMappedName()); if( envProp.isInjectable() ) { InjectionTargetNode ijNode = new InjectionTargetNode(); for (InjectionTarget target : envProp.getInjectionTargets()) { ijNode.writeDescriptor(envEntryNode, TagNames.INJECTION_TARGET, target); } } appendTextChild(envEntryNode, TagNames.LOOKUP_NAME, envProp.getLookupName()); return envEntryNode; } }
public String getName() { return decoree.getName(); }
while (it.hasNext()) { EnvironmentProperty prop = (EnvironmentProperty) it.next(); String propName = prop.getName(); Class type = getTypeOf(prop); type = Class.forName(prop.getType()); if (prop.getResolvedValue() != null && prop.getResolvedValue().trim().length() != 0) { Method meth = null; try { logger.log(Level.FINER, "Invoking" + meth + " on " + bean.getClass().getName() + "with " + "value [" + prop.getResolvedValueObject().getClass() + " , " + getFilteredPropValue(prop) + " ] "); meth.invoke(bean, new Object[]{prop.getResolvedValueObject()}); } else { new Object[]{prop.getName(), bean.getClass().getName()}); + prop.getName() + " and value " + getFilteredPropValue(prop), ia + " on an instance of " + bean.getClass() + " -- trying again with the type from bean"); boolean prevBoundsChecking = EnvironmentProperty.isBoundsChecking(); try { EnvironmentProperty.setBoundsChecking(false);
private void addEnvironmentProperties(ScopeType scope, Iterator envItr, Collection<JNDIBinding> jndiBindings) { while( envItr.hasNext() ) { EnvironmentProperty next = (EnvironmentProperty) envItr.next(); if( !dependencyAppliesToScope(next, scope)) { continue; } // Only env-entries that have been assigned a value are // eligible for look up if (next.hasAValue()) { String name = descriptorToLogicalJndiName(next); Object value = next.hasLookupName() ? namingUtils.createLazyNamingObjectFactory(name, next.getLookupName(), true) : namingUtils.createSimpleNamingObjectFactory(name, next.getValueObject()); jndiBindings.add(new CompEnvBinding(name, value)); } } }
/** * Construct the role reference with the same name and rolename the same * as the environment property value. * @param the environment property instance. */ public RoleReference(EnvironmentProperty environmentProperty) { super(environmentProperty.getName(), environmentProperty.getDescription(), ""); this.setValue(environmentProperty.getValue()); }
private void addOrMergeEnvironmentProperty( EnvironmentProperty environmentProperty) { try { EnvironmentProperty existing = getEnvironmentPropertyByName(environmentProperty.getName()); for (InjectionTarget next : environmentProperty.getInjectionTargets()) { existing.addInjectionTarget(next); } } catch(IllegalArgumentException e) { addEnvironmentProperty(environmentProperty); } }
EnvironmentProperty envProp = new EnvironmentProperty( acProp.propertyName(), acProp.propertyValue(), ""); if (ejbMsgBeanDesc.getActivationConfigValue(envProp.getName()) == null) { ejbMsgBeanDesc.putActivationConfigProperty(envProp);
public String getValue() { return decoree.getValue(); }
/** ** Returns a String representation of this environment property. */ public void print(StringBuffer toStringBuffer) { toStringBuffer.append("Env-Prop: ").append(super.getName()).append("@"); printInjectableResourceInfo(toStringBuffer); toStringBuffer.append("@").append(this.getType()).append("@").append(this.getValue()).append("@").append("@").append(super.getDescription()); }
/** * Returns a formatted version of this object as a String. */ public void print(StringBuffer toStringBuffer) { toStringBuffer.append("Role-Ref-Env-Prop: ").append(super.getName()).append("@").append( this.getRole()).append("@").append(super.getDescription()); }
private static String getFilteredPropValue(EnvironmentProperty prop) { if (prop == null) return "null"; String propname = prop.getName(); if (propname.toLowerCase().contains("password")) return "********"; return (prop.getResolvedValue()); }
public boolean hasAValue() { return ( setValueCalled || hasLookupName() || getMappedName().length() > 0); }