예제 #1
0
  private void forElement(XMap element, boolean custom, String graniteConfigProperties) {
    String scan = element.get("@scan");

    this.scan = Boolean.TRUE.toString().equals(scan);

    loadCustomAMF3Serializer(element, custom);
    loadCustomAMF3DeserializerSecurizer(element, custom);
    loadCustomAMF3MessageInterceptor(element, custom);
    loadCustomConverters(element, custom);
    loadCustomMethodMatcher(element, custom);
    loadCustomInvocationListener(element, custom);
    loadCustomInstantiators(element, custom);
    loadCustomClassGetter(element, custom);
    loadCustomExternalizers(element, custom);
    loadCustomJMFExtendedCodecs(element, custom);
    loadCustomJMFDefaultStoredStrings(element, custom);
    loadCustomJMFReflection(element, custom);
    loadCustomDescriptors(element, custom);
    loadCustomExceptionConverters(element, custom);
    loadCustomTideComponents(element, custom);
    loadCustomSecurity(element, custom);
    loadCustomMessageSelector(element, custom);
    loadCustomGravity(element, custom);
    loadCustomDistributedDataFactory(element, custom);

    if (this.scan) scanConfig(graniteConfigProperties);

    finishCustomConverters(custom);
  }
예제 #2
0
 private void loadCustomTideComponents(XMap element, boolean custom) {
   for (XMap component : element.getAll("tide-components/tide-component")) {
     boolean disabled = Boolean.TRUE.toString().equals(component.get("@disabled"));
     String type = component.get("@type");
     if (type != null)
       tideComponentMatchers.add(TIDE_COMPONENT_MATCHER_FACTORY.getTypeMatcher(type, disabled));
     else {
       String name = component.get("@name");
       if (name != null)
         tideComponentMatchers.add(TIDE_COMPONENT_MATCHER_FACTORY.getNameMatcher(name, disabled));
       else {
         String instanceOf = component.get("@instance-of");
         if (instanceOf != null)
           tideComponentMatchers.add(
               TIDE_COMPONENT_MATCHER_FACTORY.getInstanceOfMatcher(instanceOf, disabled));
         else {
           String annotatedWith = component.get("@annotated-with");
           if (annotatedWith == null)
             throw new GraniteConfigException(
                 "Element 'component' has no attribute 'type', 'name', 'instance-of' or 'annotated-with'");
           tideComponentMatchers.add(
               TIDE_COMPONENT_MATCHER_FACTORY.getAnnotatedWithMatcher(annotatedWith, disabled));
         }
       }
     }
   }
 }
예제 #3
0
  private void loadCustomConverters(XMap element, boolean custom) {
    XMap converters = element.getOne("converters");
    if (converters != null) {
      // Should we override standard config converters?
      String override = converters.get("@override");
      if (Boolean.TRUE.toString().equals(override)) converterClasses.clear();

      int i = 0;
      for (XMap converter : converters.getAll("converter")) {
        String type = converter.get("@type");
        try {
          // For custom config, shifts any standard converters to the end of the list...
          converterClasses.add(i++, TypeUtil.forName(type, Converter.class));
        } catch (Exception e) {
          throw new GraniteConfigException("Could not get converter class for: " + type, e);
        }
      }
    }
  }