private ConfiguredObjectAttribute<?, ?> getConfiguredObjectAttribute(final String name) { return _configuredObject.getModel() .getTypeRegistry() .getAttributeTypes(_configuredObject.getClass()) .get(name); } }
private ConfiguredObject<?> createProxyForAuthorisation(final Class<? extends ConfiguredObject> category, final Map<String, Object> attributes, final ConfiguredObject<?> parent) { return (ConfiguredObject<?>) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[]{category}, new AuthorisationProxyInvocationHandler(attributes, getTypeRegistry().getAttributeTypes(category), category, parent)); }
private void validateExchangeDeclareArguments(final Map<String, Object> attributes) { final ConfiguredObjectTypeRegistry typeRegistry = getModel().getTypeRegistry(); final List<ConfiguredObjectAttribute<?, ?>> types = new ArrayList<>(typeRegistry.getAttributeTypes(Exchange.class).values()); typeRegistry.getTypeSpecialisations(Exchange.class).forEach(type -> types.addAll(typeRegistry.getTypeSpecificAttributes(type))); final Set<String> unsupported = attributes.keySet() .stream() .filter(name -> types.stream().noneMatch(a -> Objects.equals(name, a.getName()) && !a.isDerived())) .collect(Collectors.toSet()); if (!unsupported.isEmpty()) { throw new IllegalArgumentException(String.format( "Unsupported exchange declare arguments : %s", String.join(",", unsupported))); } }
private void validateExchangeDeclareArguments(final Map<String, Object> attributes, final Model model) { final ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); final List<ConfiguredObjectAttribute<?, ?>> types = new ArrayList<>(typeRegistry.getAttributeTypes(Exchange.class).values()); typeRegistry.getTypeSpecialisations(Exchange.class).forEach(type -> types.addAll(typeRegistry.getTypeSpecificAttributes(type))); final Set<String> unsupported = attributes.keySet() .stream() .filter(name -> types.stream().noneMatch(a -> Objects.equals(name, a.getName()) && !a.isDerived())) .collect(Collectors.toSet()); if (!unsupported.isEmpty()) { throw new IllegalArgumentException(String.format( "Unsupported exchange declare arguments : %s", String.join(",", unsupported))); } }
private Set<Protocol> getPortProtocolsAttribute(Map<String, Object> attributes) { Object object = attributes.get(Port.PROTOCOLS); if (object == null) { return null; } Model model = _parent.getModel(); ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(Port.class); ConfiguredSettableAttribute protocolsAttribute = (ConfiguredSettableAttribute) attributeTypes.get(Port.PROTOCOLS); return (Set<Protocol>) protocolsAttribute.convert(object,_parent); }
private void writeAttributes(final PrintWriter writer, final Class<? extends ConfiguredObject> configuredClass, final Model model, final List<Class<? extends ConfiguredObject>> types) { writer.println("<a name=\"types\"><h2>Attributes</h2></a>"); writer.println("<h2>Common Attributes</h2>"); writeAttributesTable(writer, model.getTypeRegistry().getAttributeTypes(configuredClass).values()); for(Class<? extends ConfiguredObject> type : types) { String typeName = getTypeName(type, model); Collection<ConfiguredObjectAttribute<?, ?>> typeSpecificAttributes = model.getTypeRegistry().getTypeSpecificAttributes(type); if(!typeSpecificAttributes.isEmpty()) { writer.println("<h2><span class=\"type\">"+typeName+"</span> Specific Attributes</h2>"); writeAttributesTable(writer, typeSpecificAttributes); } } }
new ArrayList<>(typeRegistry.getAttributeTypes(Queue.class).values()); typeRegistry.getTypeSpecialisations(Queue.class) .forEach(type -> attributeTypes.addAll(typeRegistry.getTypeSpecificAttributes(type)));
public static String getDefaultValue(String attrName) { Model model = SystemConfigBootstrapModel.getInstance(); ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); final ConfiguredObjectAttribute<?, ?> attr = typeRegistry.getAttributeTypes(SystemConfig.class).get(attrName); if(attr instanceof ConfiguredSettableAttribute) { return interpolate(model, ((ConfiguredSettableAttribute)attr).defaultValue()); } else { return null; } }
ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(Port.class); ConfiguredSettableAttribute protocolsAttribute = (ConfiguredSettableAttribute) attributeTypes.get(Port.PROTOCOLS);
private Map<String, Map> processAttributes(final Class<? extends ConfiguredObject> type, final Model model) model.getTypeRegistry().getAttributeTypes(type).values();
.getAttributeTypes(confObject.getClass()) .get(name);
_typeClass = typeClass == null ? _category : typeClass; _attributeTypes = model.getTypeRegistry().getAttributeTypes(getClass()); _automatedFields = model.getTypeRegistry().getAutomatedFields(getClass()); _stateChangeMethods = model.getTypeRegistry().getStateChangeMethods(getClass());
(ConfiguredDerivedMethodAttribute<Exchange<?>, Collection<Binding>>) getModel().getTypeRegistry().getAttributeTypes(getTypeClass()).get(DURABLE_BINDINGS); final Collection<Binding> bindings = durableBindingsAttribute.convertValue(getActualAttributes().get(DURABLE_BINDINGS), this);