Sunday, March 20, 2011

Is there a standardised way to embed metadata (e.g. version, license) in SWC components?

Scenario: there is an Adobe Flex 3 project which uses several third-party libraries and components in the form of SWC files.

How can we know "what is inside" those SWC files? Specifically, how can I make sure that the project uses the latest versions of all those components?

According to official Adobe Flex 3 help, "you can define" (sic) a version property for a component that you intend to package and distribute. Something along the lines of:

private static const version:String = '1.0.0.42';

But that property is not treated in any special way by Adobe's authoring tools, and I suspect that it is not commonly used by the community, anyway.

The file catalog.xml that is inside all SWC components doesn't seem to contain anything useful in that sense.

Are developers distributing SWC usually embedding metadata in those files in any way? Is there a standardised way to retrieve data such as version, license, author and copyright from a SWC file?

From stackoverflow
  • You are making an interesting point.

    Adobe has provided a way to include basic metadatas in SWFs (and thus in SWCs) but this is stored in the binary and there's no way to extract it without decompilation.

    Interestingly, if one knows how to read a SWF, extracting metadatas is fairly easy. But most of the time it doesn't contain any useful information because obviously authoring tools don't let you simply view it...

    So I guess first we need some integration in our authoring tools, then we may begin finding useful information in the metadatas :)

    tripu : Thank you, Philippe. Where is the documentation about that metadata that can be included in `SWF`'s?
  • SWCs are generally distributed in a package with other supporting files, such as documentation and examples. Version, license, and author information is usually available as part of that package in a separate readme or license file. I've never seen component developers in the Flex world compile that sort of information into the SWC itself.

  • I would consider it good practice to include the version name in the .swc file itself. For example, if you use the Mate framework, the swc filename is something like Mate_08_5.swc. At a quick glance, you can see that you're using version 0.8.5.

    As far as license goes, usually you distribute a LICENSE text file within the .zip that contains your .swc file.

  • You could look into RSL digests. These attach a different hash value to each version of a particular library (swc/library/libraries/digests in the catalog.xml file) . Then all you have to do is only load the library with the known digest value.

    If you don't have any control over the SWC files being used and they're not using digests, you are kind of stuck with whatever proprietary versioning system the vendor is using though.

0 comments:

Post a Comment