public static GBeanInfoBuilder createStatic(Class sourceClass, String name, Class gbeanType, GBeanInfo source, String j2eeType) { if (sourceClass == null) throw new NullPointerException("sourceClass is null"); if (name == null) throw new NullPointerException("name is null"); if (gbeanType == null) throw new NullPointerException("gbeanType is null"); return new GBeanInfoBuilder(sourceClass.getName(), name, gbeanType, source, j2eeType); }
public void addAttribute(String name, String type, boolean persistent, boolean manageable) { String getter = searchForGetter(name, type, gbeanType); String setter = searchForSetter(name, type, gbeanType); addAttribute(new GAttributeInfo(name, type, persistent, manageable, getter, setter)); }
public void addInterface(Class intf, String[] persistentAttributes) { addInterface(intf, persistentAttributes, new String[0]); }
/** * @deprecated This will be removed in a future release */ public GBeanInfoBuilder(String name, ClassLoader classLoader) { this(checkNotNull(name), loadClass(classLoader, name), GBeanInfo.getGBeanInfo(name, classLoader)); }
private Map getActivationSpecInfoMap(MessagelistenerType[] messagelistenerArray, ClassLoader cl) throws DeploymentException { Map<String, GBeanData> activationSpecInfos = new HashMap<String, GBeanData>(); for (MessagelistenerType messagelistenerType : messagelistenerArray) { String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim(); ActivationspecType activationspec = messagelistenerType.getActivationspec(); String activationSpecClassName = activationspec.getActivationspecClass().getStringValue().trim(); GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, ActivationSpecWrapperGBean.GBEAN_INFO); Set<String> ignore = Collections.singleton("resourceAdapter"); setUpDynamicGBean(activationSpecClassName, infoBuilder, ignore, cl, true); GBeanInfo gbeanInfo = infoBuilder.getBeanInfo(); GBeanData activationSpecInfo = new GBeanData(gbeanInfo); activationSpecInfo.setAttribute("activationSpecClass", activationSpecClassName); activationSpecInfos.put(messageListenerInterface, activationSpecInfo); } return activationSpecInfos; }
public void addAttribute(String name, String type, boolean persistent) { addAttribute(name, type, persistent, true); }
Method method = methods[i]; if ("java.lang.Object".equals(method.getDeclaringClass().getName())) continue; if (isGetter(method)) { String attributeName = getAttributeName(method); GAttributeInfo attribute = (GAttributeInfo) attributes.get(attributeName); String attributeType = method.getReturnType().getName(); attribute.getSetterName())); } else if (isSetter(method)) { String attributeName = getAttributeName(method); String attributeType = method.getParameterTypes()[0].getName(); GAttributeInfo attribute = (GAttributeInfo) attributes.get(attributeName); addOperation(new GOperationInfo(method.getName(), method.getParameterTypes(), method.getReturnType().getName())); addInterface(interfaces, intf);
public void setPersistentAttributes(String[] persistentAttributes) { for (int i = 0; i < persistentAttributes.length; i++) { String attributeName = persistentAttributes[i]; GAttributeInfo attribute = (GAttributeInfo) attributes.get(attributeName); if (attribute != null && !references.containsKey(attributeName)) { if (isMagicAttribute(attribute)) { // magic attributes can't be persistent continue; } attributes.put(attributeName, new GAttributeInfo(attributeName, attribute.getType(), true, attribute.isManageable(), attribute.getGetterName(), attribute.getSetterName())); } else { if (attributeName.equals("kernel")) { addAttribute("kernel", Kernel.class, false); } else if (attributeName.equals("classLoader")) { addAttribute("classLoader", ClassLoader.class, false); } else if (attributeName.equals("abstractName")) { addAttribute("abstractName", AbstractName.class, false); } else if (attributeName.equals("objectName")) { addAttribute("obectName", String.class, false); } } } }
public static GBeanInfoBuilder createStatic(String name, Class gbeanType, String j2eeType) { if (gbeanType == null) throw new NullPointerException("gbeanType is null"); return createStatic(gbeanType, name, gbeanType, null, j2eeType); }
private GBeanData setUpDynamicGBeanWithProperties(String className, GBeanInfoBuilder infoBuilder, List<ConfigProperty> configProperties, Bundle bundle, Set<String> ignore) throws DeploymentException { setUpDynamicGBean(className, infoBuilder, ignore, bundle, false); GBeanInfo gbeanInfo = infoBuilder.getBeanInfo(); GBeanData gbeanData = new GBeanData(gbeanInfo); for (ConfigProperty configProperty : configProperties) { if (configProperty.getConfigPropertyValue() != null) { String name = configProperty.getConfigPropertyName(); if (gbeanInfo.getAttribute(name) == null) { String originalName = name; name = switchCase(name); if (gbeanInfo.getAttribute(name) == null) { log.warn("Unsupported config-property: " + originalName); continue; } } String type = configProperty.getConfigPropertyType(); String value = configProperty.getConfigPropertyValue(); gbeanData.setAttribute(name, getValue(type, value, bundle)); } } return gbeanData; }
public GBeanInfoBuilder(String name, Class gbeanType, String j2eeType) { this(name, checkNotNull(gbeanType), null, j2eeType); }
public GBeanInfo getBeanInfo() { Map constructorTypes = getConstructorTypes(); String setterName = null; if (proxyType == null) { Method setter = searchForSetterMethod(referenceName, referenceType, gbeanType); if (setter == null) { setter = searchForSetterMethod(referenceName, Collection.class.getName(), gbeanType); if (setter == null) { throw new InvalidConfigurationException("Reference must be a constructor argument or have a setter: name=" + referenceName + " for gbeanType: " + gbeanType);
private GBeanInfoBuilder(String sourceClass, String name, Class gbeanType, GBeanInfo source, String j2eeType) { checkNotNull(name); checkNotNull(gbeanType); this.name = name; this.gbeanType = gbeanType; for (Iterator iterator = allTypes.iterator(); iterator.hasNext();) { Class type = (Class) iterator.next(); addInterface(type);
/** * @deprecated */ public void addOperation(String name) { // FIXME : This is needed because the getters/setters are not being added as operation // i.e. kerenl.invoke("getX") fails. addOperation(new GOperationInfo(name, NO_ARGS, "")); }
private Map<String, GBeanData> getActivationSpecInfoMap(AbstractName validatorName, List<MessageListener> messageListeners, Bundle bundle) throws DeploymentException { Map<String, GBeanData> activationSpecInfos = new HashMap<String, GBeanData>(); for (MessageListener messageListener : messageListeners) { String messageListenerInterface = messageListener.getMessageListenerType(); ActivationSpec activationSpec = messageListener.getActivationSpec(); String activationSpecClassName = activationSpec.getActivationSpecClass(); GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, new AnnotationGBeanInfoBuilder(ActivationSpecWrapperGBean.class).buildGBeanInfo()); Set<String> ignore = Collections.singleton("resourceAdapter"); setUpDynamicGBean(activationSpecClassName, infoBuilder, ignore, bundle, true); GBeanInfo gbeanInfo = infoBuilder.getBeanInfo(); GBeanData activationSpecInfo = new GBeanData(gbeanInfo); activationSpecInfo.setAttribute("activationSpecClass", activationSpecClassName); activationSpecInfo.setReferencePattern("ValidatorFactory", validatorName); activationSpecInfos.put(messageListenerInterface, activationSpecInfo); } return activationSpecInfos; }
public void addAttribute(String name, Class type, boolean persistent) { addAttribute(name, type.getName(), persistent, true); }
public static GBeanInfoBuilder createStatic(String name, Class gbeanType) { if (gbeanType == null) throw new NullPointerException("gbeanType is null"); return createStatic(gbeanType, name, gbeanType, null, null); }
private GBeanData setUpDynamicGBeanWithProperties(String className, GBeanInfoBuilder infoBuilder, ConfigPropertyType[] configProperties, ClassLoader cl, Set<String> ignore) throws DeploymentException { setUpDynamicGBean(className, infoBuilder, ignore, cl, false); GBeanInfo gbeanInfo = infoBuilder.getBeanInfo(); GBeanData gbeanData = new GBeanData(gbeanInfo); for (ConfigPropertyType configProperty : configProperties) { if (configProperty.isSetConfigPropertyValue()) { String name = configProperty.getConfigPropertyName().getStringValue(); if (gbeanInfo.getAttribute(name) == null) { String originalName = name; name = switchCase(name); if (gbeanInfo.getAttribute(name) == null) { log.warn("Unsupported config-property: " + originalName); continue; } } String type = configProperty.getConfigPropertyType().getStringValue(); String value = configProperty.getConfigPropertyValue().getStringValue(); gbeanData.setAttribute(name, getValue(type, value, cl)); } } return gbeanData; }
public GBeanInfoBuilder(String name, Class gbeanType) { this(name, checkNotNull(gbeanType), null, null); }
public void addOperation(String name, Class[] paramTypes, String returnType) { addOperation(new GOperationInfo(name, paramTypes, returnType)); }