public void addAttribute(String name, String type, boolean persistent) { addAttribute(name, type, persistent, true); }
public void addAttribute(String name, Class type, boolean persistent) { addAttribute(name, type.getName(), persistent, true); }
public void addAttribute(String name, Class type, boolean persistent, boolean manageable) { addAttribute(name, type.getName(), persistent, manageable); }
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); } } } }
private void setUpDynamicGBean(String adapterClassName, GBeanInfoBuilder infoBuilder, Set<String> ignore, ClassLoader cl, boolean decapitalize) throws DeploymentException { //add all javabean properties that have both getter and setter. Ignore the "required" flag from the dd. Map<String, String> getters = new HashMap<String, String>(); Set<String> setters = new HashSet<String>(); Method[] methods; try { Class activationSpecClass = cl.loadClass(adapterClassName); methods = activationSpecClass.getMethods(); } catch (ClassNotFoundException e) { throw new DeploymentException("Can not load adapter class in classloader " + cl, e); } catch (NoClassDefFoundError e) { throw new DeploymentException("Can not load adapter class in classloader " + cl, e); } for (Method method : methods) { String methodName = method.getName(); if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0) { String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2); getters.put(setCase(attributeName, decapitalize), method.getReturnType().getName()); } else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) { setters.add(setCase(methodName.substring(3), decapitalize)); } } getters.keySet().retainAll(setters); getters.keySet().removeAll(ignore); for (Map.Entry<String, String> entry : getters.entrySet()) { infoBuilder.addAttribute(new DynamicGAttributeInfo(entry.getKey(), entry.getValue(), true, true, true, true)); } }
private void setUpDynamicGBean(String adapterClassName, GBeanInfoBuilder infoBuilder, Set<String> ignore, Bundle bundle, boolean decapitalize) throws DeploymentException { //add all javabean properties that have both getter and setter. Ignore the "required" flag from the dd. Map<String, String> getters = new HashMap<String, String>(); Set<String> setters = new HashSet<String>(); Method[] methods; try { Class activationSpecClass = bundle.loadClass(adapterClassName); methods = activationSpecClass.getMethods(); } catch (ClassNotFoundException e) { throw new DeploymentException("Can not load adapter class in classloader " + bundle, e); } catch (NoClassDefFoundError e) { throw new DeploymentException("Can not load adapter class in classloader " + bundle, e); } for (Method method : methods) { String methodName = method.getName(); if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0) { String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2); getters.put(setCase(attributeName, decapitalize), method.getReturnType().getName()); } else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) { setters.add(setCase(methodName.substring(3), decapitalize)); } } getters.keySet().retainAll(setters); getters.keySet().removeAll(ignore); for (Map.Entry<String, String> entry : getters.entrySet()) { infoBuilder.addAttribute(new DynamicGAttributeInfo(entry.getKey(), entry.getValue(), true, true, true, true)); } }
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)); }