Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.ConfigProperty


            continue;
          }

          if (! containsConfigProperty(configProperties, name)) {
            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              Object value = null;
              try {
                value = propertyDescriptor.getReadMethod().invoke(o);
              } catch (Exception e) {
              }

              javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                configProperty.setDescriptions(stringsToTexts(annotation.description()));
              }
            }
          }
        }

        // add any annotated fields we haven't already picked up
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field field : declaredFields) {
          javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

          String name = field.getName();
          Object value = null;
          try {
            value = field.get(o);
          } catch (Exception e) {
          }

          if (! containsConfigProperty(configProperties, name)) {
            String type = getConfigPropertyType(annotation, field.getType());

            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(type);
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
              }
            }
          }
        }
      } catch (Exception  e) {
View Full Code Here


        } while (aClass != null);
    }

    private void setConfigProperty(List<ConfigProperty> configProperties, javax.resource.spi.ConfigProperty cpa, String name, Class<?> type) throws DeploymentException {
        name = Introspector.decapitalize(name);
        ConfigProperty target = null;
        for (ConfigProperty configProperty : configProperties) {
            if (name.equals(configProperty.getConfigPropertyName())) {
                target = configProperty;
                break;
            }
        }
        if (target == null) {
            target = new ConfigProperty();
            target.setConfigPropertyName(name);
            configProperties.add(target);
        }
        if (cpa.type() != Object.class && cpa.type() != type) {
            throw new DeploymentException("wrong type specified: " + cpa.type().getName() + " expecting " + type.getName());
        }
        if (target.getConfigPropertyType() == null) {
            target.setConfigPropertyType(type.getName());
        }
        if (target.getConfigPropertyValue() == null) {
            target.setConfigPropertyValue(cpa.defaultValue());
        }
        if (target.isConfigPropertyConfidential() == null) {
            target.setConfigPropertyConfidential(cpa.confidential());
        }
        if (target.isConfigPropertyIgnore() == null) {
            target.setConfigPropertyIgnore(cpa.ignore());
        }
        if (target.isConfigPropertySupportsDynamicUpdates() == null) {
            target.setConfigPropertySupportsDynamicUpdates(cpa.supportsDynamicUpdates());
        }
    }
View Full Code Here

                        continue;
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            Object value = null;
                            try {
                                value = propertyDescriptor.getReadMethod().invoke(o);
                            } catch (final Exception e) {
                                // no-op
                            }

                            javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (final Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                                configProperty.setDescriptions(stringsToTexts(annotation.description()));
                            }
                        }
                    }
                }

                // add any annotated fields we haven't already picked up
                final Field[] declaredFields = clazz.getDeclaredFields();
                for (final Field field : declaredFields) {
                    final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

                    final String name = field.getName();
                    Object value = null;
                    try {
                        value = field.get(o);
                    } catch (final Exception e) {
                        // no-op
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        final String type = getConfigPropertyType(annotation, field.getType());

                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(type);
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            }
                        }
                    }
                }
            } catch (final Exception e) {
View Full Code Here

            continue;
          }

          if (! containsConfigProperty(configProperties, name)) {
            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              Object value = null;
              try {
                value = propertyDescriptor.getReadMethod().invoke(o);
              } catch (Exception e) {
              }

              javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                configProperty.setDescriptions(stringsToTexts(annotation.description()));
              }
            }
          }
        }

        // add any annotated fields we haven't already picked up
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field field : declaredFields) {
          javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

          String name = field.getName();
          Object value = null;
          try {
            value = field.get(o);
          } catch (Exception e) {
          }

          if (! containsConfigProperty(configProperties, name)) {
            String type = getConfigPropertyType(annotation, field.getType());

            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(type);
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
              }
            }
          }
        }
      } catch (Exception  e) {
View Full Code Here

            continue;
          }

          if (! containsConfigProperty(configProperties, name)) {
            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              Object value = null;
              try {
                value = propertyDescriptor.getReadMethod().invoke(o);
              } catch (Exception e) {
              }

              javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                configProperty.setDescriptions(stringsToTexts(annotation.description()));
              }
            }
          }
        }

        // add any annotated fields we haven't already picked up
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field field : declaredFields) {
          javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

          String name = field.getName();
          Object value = null;
          try {
            value = field.get(o);
          } catch (Exception e) {
          }

          if (! containsConfigProperty(configProperties, name)) {
            String type = getConfigPropertyType(annotation, field.getType());

            if (type != null) {
              ConfigProperty configProperty = new ConfigProperty();
              configProperties.add(configProperty);

              configProperty.setConfigPropertyName(name);
              configProperty.setConfigPropertyType(type);
              if (value != null) {
                configProperty.setConfigPropertyValue(value.toString());
              }

              if (annotation != null) {
                if (annotation.defaultValue() != null) {
                  configProperty.setConfigPropertyValue(annotation.defaultValue());
                }
                configProperty.setConfigPropertyConfidential(annotation.confidential());
                configProperty.setConfigPropertyIgnore(annotation.ignore());
                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
              }
            }
          }
        }
      } catch (Exception  e) {
View Full Code Here

                        continue;
                    }

                    if (!containsConfigProperty(configProperties, name)) {

                        final ConfigProperty configProperty = new ConfigProperty();
                        configProperties.add(configProperty);

                        Object value = null;
                        try {
                            value = propertyDescriptor.getReadMethod().invoke(o);
                        } catch (final Exception e) {
                            // no-op
                        }

                        javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                        if (annotation == null) {
                            try {
                                // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                            } catch (final Exception ignored) {
                                // no-op : getDeclaredField() throws exceptions and does not return null
                            }
                        }

                        configProperty.setConfigPropertyName(name);
                        configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
                        if (value != null) {
                            configProperty.setConfigPropertyValue(value.toString());
                        }

                        if (annotation != null) {
                            if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                                configProperty.setConfigPropertyValue(annotation.defaultValue());
                            }
                            configProperty.setConfigPropertyConfidential(annotation.confidential());
                            configProperty.setConfigPropertyIgnore(annotation.ignore());
                            configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            configProperty.setDescriptions(stringsToTexts(annotation.description()));
                        }

                    }
                }

                // add any annotated fields we haven't already picked up
                final Field[] declaredFields = clazz.getDeclaredFields();
                for (final Field field : declaredFields) {
                    final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

                    final String name = field.getName();
                    Object value = null;
                    try {
                        value = field.get(o);
                    } catch (final Exception e) {
                        // no-op
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        final String type = getConfigPropertyType(annotation, field.getType());

                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(type);
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            }
                        }
                    }
                }
            } catch (final Exception e) {
View Full Code Here

        } while (aClass != null);
    }

    private void setConfigProperty(List<ConfigProperty> configProperties, javax.resource.spi.ConfigProperty cpa, String name, Class<?> type) throws DeploymentException {
        name = Introspector.decapitalize(name);
        ConfigProperty target = null;
        for (ConfigProperty configProperty : configProperties) {
            if (name.equals(configProperty.getConfigPropertyName())) {
                target = configProperty;
                break;
            }
        }
        if (target == null) {
            target = new ConfigProperty();
            target.setConfigPropertyName(name);
            configProperties.add(target);
        }
        if (cpa.type() != Object.class && cpa.type() != type) {
            throw new DeploymentException("wrong type specified: " + cpa.type().getName() + " expecting " + type.getName());
        }
        if (target.getConfigPropertyType() == null) {
            target.setConfigPropertyType(type.getName());
        }
        if (target.getConfigPropertyValue() == null) {
            target.setConfigPropertyValue(cpa.defaultValue());
        }
        if (target.isConfigPropertyConfidential() == null) {
            target.setConfigPropertyConfidential(cpa.confidential());
        }
        if (target.isConfigPropertyIgnore() == null) {
            target.setConfigPropertyIgnore(cpa.ignore());
        }
        if (target.isConfigPropertySupportsDynamicUpdates() == null) {
            target.setConfigPropertySupportsDynamicUpdates(cpa.supportsDynamicUpdates());
        }
    }
View Full Code Here

                        continue;
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            Object value = null;
                            try {
                                value = propertyDescriptor.getReadMethod().invoke(o);
                            } catch (final Exception e) {
                                // no-op
                            }

                            javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (final Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                                configProperty.setDescriptions(stringsToTexts(annotation.description()));
                            }
                        }
                    }
                }

                // add any annotated fields we haven't already picked up
                final Field[] declaredFields = clazz.getDeclaredFields();
                for (final Field field : declaredFields) {
                    final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

                    final String name = field.getName();
                    Object value = null;
                    try {
                        value = field.get(o);
                    } catch (final Exception e) {
                        // no-op
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        final String type = getConfigPropertyType(annotation, field.getType());

                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(type);
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            }
                        }
                    }
                }
            } catch (final Exception e) {
View Full Code Here

                        continue;
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            Object value = null;
                            try {
                                value = propertyDescriptor.getReadMethod().invoke(o);
                            } catch (final Exception e) {
                                // no-op
                            }

                            javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (final Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                                configProperty.setDescriptions(stringsToTexts(annotation.description()));
                            }
                        }
                    }
                }

                // add any annotated fields we haven't already picked up
                final Field[] declaredFields = clazz.getDeclaredFields();
                for (final Field field : declaredFields) {
                    final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

                    final String name = field.getName();
                    Object value = null;
                    try {
                        value = field.get(o);
                    } catch (final Exception e) {
                        // no-op
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        final String type = getConfigPropertyType(annotation, field.getType());

                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(type);
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            }
                        }
                    }
                }
            } catch (final Exception e) {
View Full Code Here

                        continue;
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            Object value = null;
                            try {
                                value = propertyDescriptor.getReadMethod().invoke(o);
                            } catch (final Exception e) {
                                // no-op
                            }

                            javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
                            if (annotation == null) {
                                try {
                                    // if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
                                    annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
                                } catch (final Exception ignored) {
                                    // no-op : getDeclaredField() throws exceptions and does not return null
                                }
                            }

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                                configProperty.setDescriptions(stringsToTexts(annotation.description()));
                            }
                        }
                    }
                }

                // add any annotated fields we haven't already picked up
                final Field[] declaredFields = clazz.getDeclaredFields();
                for (final Field field : declaredFields) {
                    final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);

                    final String name = field.getName();
                    Object value = null;
                    try {
                        value = field.get(o);
                    } catch (final Exception e) {
                        // no-op
                    }

                    if (!containsConfigProperty(configProperties, name)) {
                        final String type = getConfigPropertyType(annotation, field.getType());

                        if (type != null) {
                            final ConfigProperty configProperty = new ConfigProperty();
                            configProperties.add(configProperty);

                            configProperty.setConfigPropertyName(name);
                            configProperty.setConfigPropertyType(type);
                            if (value != null) {
                                configProperty.setConfigPropertyValue(value.toString());
                            }

                            if (annotation != null) {
                                if (annotation.defaultValue() != null) {
                                    configProperty.setConfigPropertyValue(annotation.defaultValue());
                                }
                                configProperty.setConfigPropertyConfidential(annotation.confidential());
                                configProperty.setConfigPropertyIgnore(annotation.ignore());
                                configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
                            }
                        }
                    }
                }
            } catch (final Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.ConfigProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.