Checksum Aspect – Part 5

Over the course of the past few weeks while I have explored Aspects, I have come to appreciate them for the powerful programming tool that they are.  I can see enormous value in attaching attributes and behavior to instances of non-related object type, or to just select instances of a type.  However, my initial warning still stands:  a large number of Aspects or ill-designed and implemented Aspects can really affect performance and create a maintenance and debugging nightmare.  A system administrator or maintainer could very well be asking themselves “Where is this functionality implemented?”, if you aren’t clear and careful in your design and use of Aspects.

I see some other cool applications of Aspects beyond the checksum that I have used as my test project here.  I can see where an Aspect (in conjunction with a checksum) could be used to apply a digital signature or be used to check for duplicate content.  You could also use an Aspect as a powerful debugging and tracing tool by attaching some functionality to an object instance that would report various things about itself.

One capability of Aspects that I have not mentioned is the ability to assign a default Aspect to an object type.  By declaring an Aspect as a default Aspect of a type (you can have more than one default Aspect), you ensure that every instance of the type that is created has the Aspect attached to it.  In my case, I could have declared the checksum_aspect to be a default Aspect of dm_document and that would have ensured that every dm_document created had the capability to calculate and store its checksum.  In this way, the Aspect almost demonstrates TBO-like behavior.  One major drawback to this idea is that a default Aspect cannot be detached from an object instance, so you could never rid it of its checksum capability.  To set an Aspect as a default Aspect, use this DQL:

ALTER TYPE dm_document ADD DEFAULT ASPECTS checksum_aspect;

To remove a default Aspect, use this DQL:

ALTER TYPE dm_document REMOVE DEFAULT ASPECTS checksum_aspect;

To add an Aspect to a single instance of an object, use this DQL:

UPDATE dm_document OBJECT APPEND  r_aspect_name = ‘checksum_aspect’ WHERE object_name = ‘myTestDoc’;

To list the Aspects attached to an object, use this DQL:

SELECT r_aspect_name FROM dm_document WHERE object_name = ‘myTestDoc’;

To find all objects that have a particular Aspect attached to it, use this DQL:

SELECT r_object_id, object_name FROM dm_document WHERE any r_aspect_name = ‘checksum_aspect’;

To find a list of types and the Aspects attached to them, use this DQL:

SELECT name FROM dm_type WHERE  r_object_id IN (SELECT r_type_id FROM dmi_type_info WHERE any default_aspects IS NOT null);

I hope you have enjoyed this exploration of Aspects as much as I have and found some of it helpful or at least interesting. I still think checksums are cool, and now I think Aspects are cool too. I will definitely be looking for ways to work Aspects into my solution designs in the future.

Two parting comments:  1) There is a good discussion of Aspects here.  It is a bit dated but still applicable and worth the read.  #2) The Composer project for my checksum Aspect can be downloaded here.

Advertisements

About Scott
I have been implementing Documentum solutions since 1997. In 2005, I published a book about developing Documentum solutions for the Documentum Desktop Client (ISBN 0595339689). In 2010, I began this blog as a record of interesting and (hopefully) helpful bits of information related to Documentum, and as a creative outlet.

7 Responses to Checksum Aspect – Part 5

  1. Pingback: Checksum Aspect – Part 0 « dm_misc: Miscellaneous Documentum Tidbits and Information

  2. Pingback: Checksum Aspect – Part 4 « dm_misc: Miscellaneous Documentum Tidbits and Information

  3. Mark Faine says:

    I’ve been considering doing the exact same thing for the purpose of preventing duplicate content but I was planning on implementing as a SBO/TBO, overriding doSave and generating and storing the checksum in an attribute for every object there. The only thing holding me back has been the fear that it would be too much overhead. What do you think?

    By the way, nice blog. I’m always looking for Documentum info so I’m surprised I didn’t find it sooner.

    Like

    • Scott says:

      Mark, thanks for checking in. I have done this in my personal development environment as described here using Aspects. I broadly applied checksums to hundreds (thousands?) of content objects with no discernable performance problems. I’d say give it a try. I recommend using Aspects though. I believe Aspects give you the greatest flexibility as far as object type applicability and makes it simple to roll-back should you decide this isn’t working (e.g., no changes to the object model). I know TCS uses checksums to reduce content duplication. If you peruse the dmr_content object you can find the attribute it uses. That said, if TCS is implementing checksums at that level, it can’t be that much of a performance hit, right?

      Like

  4. Mark Faine says:

    Okay, I think I’ll give it a go, and I will use Aspects but I also think I will keep the checksum related bit and whatever else that can be reused in a SBO.

    I love Aspects as a concept and a technology but I’m not too thrilled about how EMC has decided to only half-way implement them. They should be exposed in every UI without the need for customization just as if they were any other type.

    We need to roll our own poor man’s RMA (long story) and I have always intended on doing it with aspects but customizing a lot of stock user interfaces (and then needing to support them indefinitely) is not going to go over very well.

    Like

    • Scott says:

      Good luck.

      I agree with your assessment of EMC’s implementation of Aspects. As I indicated in part 4 of this post, I was really bummed that I
      had to write a WDK component just to view a few Aspect fields.

      I’m not sure what’s on the books for D7 or the new D2 interface, but perhaps they will follow through with Aspects and treat them as first class citizens in the Docbase.

      Like

  5. Mark Faine says:

    I really hope so, in fact I’m kind of banking on it. I’m developing a new object model for our next major upgrade and I’m leaning very heavily on aspects.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: