Announcement Announcement Module
No announcement yet.
missing AbstractClassScanner Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • missing AbstractClassScanner


    in spring-as3 1.1 there was a class AbstractClassScanner which implements IMetaDataProcessor. You have refactored a lot in the code base for 2.0. I seems that the class scanning topic is delegated to as3commons-metadata, which brings its own IMetaDataProcessor and an implementation via AbstractMetaDataProcessor.
    In 2.0 the is a new interface IClassScanner - extended from IMetaDataProcessor. The intention is to add custom Metadata in a class, which has to be processes lazy. Currently we are using AbstractClassScanner (1.1) and override the scan(classNames:String) method; where is the related part in 2.0 which does this scanning process?

    Maybe someone can help?

  • #2
    Hi there,

    the class scanning has been completely overhauled indeed, it has been merged with the metadata scanning system. Since class scanning turned out to be just regular metadata processing, just not on an instance, but on a class.
    There's a small doc section on it here:

    In short, you create an IClassScanner (really just an IMetadataProcessor), register it for specific metadata (e.g. [Process], whatever) and once the scanner gets invoked its process() method will be invoked, the target parameter in that case will be the Class object (so not the class name).

    For an example check out the org.springextensions.actionscript.metadata.process or.PostConstructMetadataProcessor.<

    If you need any more assistance, let me know your specific use case and I'll try and help you out.




    • #3
      One Problem solved, new ones pops up - getObjectsOfType(class:Class)

      Hi Roland,

      it seems that i have completely overlooked the mentioned section in the manual; Now this class is processes each class which is declared with the required Metadata.

      This is how we did the registration:
      var factory:ClassScannerObjectFactoryPostProcessor = new ClassScannerObjectFactoryPostProcessor();
      factory.addScanner(new ExtensionClassScanner());

      Now i have the following problem:
      Class A, annotated with metadata gets detected. At this moment a instance of the class is not available. The classname is included in the metadata - deffered instantiation. In version 1.1 the context knews about a registration, e.g. when Class A is detected, the bundlecontext gets informed to know about the detection, too. In version 1.1 we did the following to get all references.

      var list:Object = _context.getObjectsOfType(BundleData); //getObjectsOfType(class:Class) is not available in 2.0

      so i thought give the following a try

      var list:Object = _context.objectDefinitionRegistry.getObjectDefinit ionsForType(BundleData); //list a bunch of registered objects; all these have in common that are registered immediately via a Configuration;
      so every time this function is called a null reference returns;

      What is the equivalent to _context.getObjectsOfType?

      We saw an Object in the context called cache; It seems this class lists the registered class names, in a Vector.<String>, but not the references to the registered class objects.

      Maybe you can help out?



      • #4

        Hi there,

        I'm trying to understand your use-case here, why are you trying to retrieve an object definition for the classes you're scanning exactly? Or do you just want to obtain a reference to the Class object for the given class name?
        In the latter case all you need to do is call ClassUtils.forName(className), you won't need the definition.
        If you do need the definition, then I'm not sure if using a class scanner is the right approach, I'd guess that using a regular IMetadataProcessor would make more sense.

        Could you explain in more detail what the function of your ExtensionClassScanner is?

        This may all still come down to a bug of course (after all, we're still in beta hehe), but I'd like to see your use-case working naturally, so I'll do my best to be of assistance.

        thanks for your understanding!


        Last edited by 666shooter; Dec 20th, 2011, 03:56 AM. Reason: misspelled my own name...


        • #5
          Issue Resolved

          Hi Roland,

          i resolved this issue with the following method, so its not a bug in SAS 2

          protected function readBundleDatas():Array // of BundleData
          var result:Array = [];

          // in an AIR impl, we would loop through all the directories in the plugins
          // in an MXML impl we would loop through all the Beans

          //todo: 1.1
          //var list:Object = _context.getObjectsOfType(BundleData);
          //var list:Object = _context.objectDefinitionRegistry.getObjectDefinit ionsForType(ClassUtils.forName("org.teotigraphix.s xplugins.bundles.BundleData"));

          var cachedNames:Vector.<String> = _context.cache.getCachedNames();

          for each (var str:String in cachedNames)
          //if(_context.cache.getPreparedInstance(str) is BundleData)
          // result.push(_context.cache.getInstance(str));
          if(_context.cache.getInstance(str) is BundleData)

          return result;


          A description, what will be archived by this approach, we did will follow, but in general its quite the same as here;




          • #6

            Hey Markus,

            great to see you have everything in working order!
            Please let me know if you run into any other issues, or perhaps if you have suggestions or criticism, I'd like to hear everyone's thoughts.