public AtomicReference<Object[]> getExtensors() { if (delegate != null) { return delegate.getExtensors(); } return extensors; }
public boolean containsExtensor(Object el) { if (delegate != null) { return delegate.containsExtensor(el); } Object[] exts = extensors.get(); if (exts != null) { for (Object o : exts) { if (o == el) { return true; } } } return false; } public void addExtensor(Object el) {
public void setDocumentation(String s) { if (delegate != null) { delegate.setDocumentation(s); } else { documentation = s; } } public Map<String, Object> getProperties() {
/** * Lookup a configuration value. This may be found in the properties holder supplied * (i.e. an EndpointInfo or ServiceInfo), or it may be a property on the Bus itself. * If no value is found, the defaultValue is returned. * * @param defaultValue the default value * @param type the extensor type * @return the configuration value or the default */ public <T> T getTraversedExtensor(T defaultValue, Class<T> type) { if (delegate != null) { return delegate.getTraversedExtensor(defaultValue, type); } T extensor = getExtensor(type); if (extensor == null) { return defaultValue; } return extensor; }
public final void setDelegate(AbstractPropertiesHolder p, boolean props) { delegate = p; delegateProperties = props; if (delegate == null) { return; } if (documentation != null) { delegate.setDocumentation(documentation); documentation = null; } if (extensionAttributes != null) { delegate.setExtensionAttributes(extensionAttributes); extensionAttributes = null; } if (extensors.get() != null) { for (Object el : extensors.get()) { delegate.addExtensor(el); } extensors.set(null); } if (delegateProperties && propertyMap.get() != null) { for (Map.Entry<String, Object> p2 : propertyMap.get().entrySet()) { delegate.setProperty(p2.getKey(), p2.getValue()); } propertyMap.set(null); } }
private void copyExtensors(AbstractPropertiesHolder info, List<?> extList) { if (info != null) { for (ExtensibilityElement ext : cast(extList, ExtensibilityElement.class)) { if (!info.containsExtensor(ext)) { info.addExtensor(ext); } } } }
public void addExtensor(Object el) { if (delegate != null) { delegate.addExtensor(el); return; } Object[] exts = extensors.get(); Object[] exts2; if (exts == null) { exts2 = new Object[1]; } else { exts2 = new Object[exts.length + 1]; for (int i = 0; i < exts.length; i++) { exts2[i] = exts[i]; } } exts2[exts2.length - 1] = el; if (!extensors.compareAndSet(exts, exts2)) { //keep trying addExtensor(el); } }
private void addPolicy(AbstractPropertiesHolder place, ServiceInfo service, Policy p, Class<?> cls, String defName) { Element el = addPolicy(service, p, cls, defName); if (el != null && !isExistsPolicyReference(place.getExtensors().get(), getPolicyRefURI(el))) { UnknownExtensibilityElement uee = new UnknownExtensibilityElement(); uee.setElement(el); uee.setRequired(true); uee.setElementType(DOMUtils.getElementQName(el)); place.addExtensor(uee); } } private Element addPolicy(ServiceInfo service, Policy p, Class<?> cls, String defName) {
public void setExtensionAttributes(Map<QName, Object> attrs) { if (delegate != null) { delegate.setExtensionAttributes(attrs); return; } extensionAttributes = attrs; }
public Object getExtensionAttribute(QName name) { if (delegate != null) { return delegate.getExtensionAttribute(name); } return null == extensionAttributes ? null : extensionAttributes.get(name); }
public void addExtensionAttribute(QName name, Object attr) { if (delegate != null) { delegate.addExtensionAttribute(name, attr); return; } if (null == extensionAttributes) { extensionAttributes = new HashMap<>(); } extensionAttributes.put(name, attr); }
public String getDocumentation() { if (delegate != null) { return delegate.getDocumentation(); } return documentation; } public void setDocumentation(String s) {
public Map<QName, Object> getExtensionAttributes() { if (delegate != null) { return delegate.getExtensionAttributes(); } return extensionAttributes; }
public <T> T getExtensor(Class<T> cls) { if (delegate != null) { return delegate.getExtensor(cls); } Object[] exts = extensors.get(); if (exts == null) { return null; } for (int x = 0; x < exts.length; x++) { if (cls.isInstance(exts[x])) { return cls.cast(exts[x]); } } return null; } public <T> List<T> getExtensors(Class<T> cls) {
public final void setDelegate(AbstractPropertiesHolder p, boolean props) { delegate = p; delegateProperties = props; if (delegate == null) { return; } if (documentation != null) { delegate.setDocumentation(documentation); documentation = null; } if (extensionAttributes != null) { delegate.setExtensionAttributes(extensionAttributes); extensionAttributes = null; } if (extensors.get() != null) { for (Object el : extensors.get()) { delegate.addExtensor(el); } extensors.set(null); } if (delegateProperties && propertyMap.get() != null) { for (Map.Entry<String, Object> p2 : propertyMap.get().entrySet()) { delegate.setProperty(p2.getKey(), p2.getValue()); } propertyMap.set(null); } }
private void copyExtensors(AbstractPropertiesHolder info, List<?> extList) { if (info != null) { for (ExtensibilityElement ext : cast(extList, ExtensibilityElement.class)) { if (!info.containsExtensor(ext)) { info.addExtensor(ext); } } } }
public void addExtensor(Object el) { if (delegate != null) { delegate.addExtensor(el); return; } Object[] exts = extensors.get(); Object[] exts2; if (exts == null) { exts2 = new Object[1]; } else { exts2 = new Object[exts.length + 1]; for (int i = 0; i < exts.length; i++) { exts2[i] = exts[i]; } } exts2[exts2.length - 1] = el; if (!extensors.compareAndSet(exts, exts2)) { //keep trying addExtensor(el); } }
private void addPolicy(AbstractPropertiesHolder place, ServiceInfo service, Policy p, Class<?> cls, String defName) { Element el = addPolicy(service, p, cls, defName); if (el != null && !isExistsPolicyReference(place.getExtensors().get(), getPolicyRefURI(el))) { UnknownExtensibilityElement uee = new UnknownExtensibilityElement(); uee.setElement(el); uee.setRequired(true); uee.setElementType(DOMUtils.getElementQName(el)); place.addExtensor(uee); } } private Element addPolicy(ServiceInfo service, Policy p, Class<?> cls, String defName) {
public void setExtensionAttributes(Map<QName, Object> attrs) { if (delegate != null) { delegate.setExtensionAttributes(attrs); return; } extensionAttributes = attrs; }
/** * Lookup a configuration value. This may be found in the properties holder supplied * (i.e. an EndpointInfo or ServiceInfo), or it may be a property on the Bus itself. * If no value is found, the defaultValue is returned. * * @param defaultValue the default value * @param type the extensor type * @return the configuration value or the default */ public <T> T getTraversedExtensor(T defaultValue, Class<T> type) { if (delegate != null) { return delegate.getTraversedExtensor(defaultValue, type); } T extensor = getExtensor(type); if (extensor == null) { return defaultValue; } return extensor; }