1st DNA container ever, need metadata contracts

Leo Simons <[email protected]> Sat, 03 Apr 2004 14:58:17 +0200
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <[email protected]>
Hi gang!

Like promised a while back, I've implemented basic dna support in 
jicarilla. The basic testcase will come up at

http://cvs.sourceforge.net/viewcvs.py/jicarilla/jicarilla-sandbox/platform/container-integration/src/test/org/jicarilla/container/test/integration/dna

after sourceforge anoncvs updates, the code that makes it work will be at

http://cvs.sourceforge.net/viewcvs.py/jicarilla/jicarilla-sandbox/platform/container-integration/src/java/org/jicarilla/container/integration/dna

and the dna part of the TCK is at

http://cvs.sourceforge.net/viewcvs.py/jicarilla/jicarilla-sandbox/platform/container/tck/impl/src/java/org/jicarilla/container/tck/components/type1/dna

(be gentle, this is work in progress :-D).

---

You'll see that whilst the test components have dna metadata in their 
javadoc tags, this information is not extracted, nor used, and hence 
there is no verification of the dna container-component contract.

This is not because this verification cannot be built, but because the 
contract is not clear to me. Relevant bits on the website:

   "DNA components must declare the resources that they are capable of
    providing to other components."

   "DNA components must also declare what resources they require to
    operate."

   "MetaClass  is the toolkit used to access the metadata about any java
    class."

What is not stated on the website is anything along the lines of

   "Containers must verify the dna contract using metaclass, and not run
    components that do not provide verifiable resource utilization data,
    nor should the container attempt to run components for which not all
    resources are available."

What's your thoughts on that? Is this a requirement for calling a 
container "dna compliant"?

What's up with metaclass? Where does it live currently, where is it 
moving, is there a final release? Which release should be used with dna-1.0?

Regardless of whether the verification contract is optional, I'm 
wondering about how I should implement it. I found

http://cvs.codehaus.org/viewcvs.cgi/dna/tools/src/test/org/jcontainer/dna/tools/verifier/ComponentVerifierTestCase.java?root=jcontainer

and basic ComponentVerifier usage is easy to see in the ant task...

public class DnaUtil
{
   /* ... */

   // TODO: should this be in dna-tools?
   public static void verifyDnaContract( Class type )
     throws InvalidTypeException
   {
     final ComponentVerifier verifier = new ComponentVerifier();
     final VerifyIssue[] issues = verifier.verifyType( type );
     if( issues.length > 0 )
     {
         throw new InvalidTypeException( issues );
           // TODO: exception does not exist yet...
     }
   }

   public static void verifySatisfiableDnaContract( Class type,
     ResourceLocator availableResources )
   {
     verifyDnaContract( type );

     // TODO: what goes here?
   }
}

what do you think should be on the TODO lines? Should a utility class 
like this (all dna-compatible containers would need stuff like this) 
live in dna?

-- 
cheers,

- Leo Simons

-----------------------------------------------------------------------
Weblog              -- http://leosimons.com/
IoC Component Glue  -- http://jicarilla.org/
Articles & Opinions -- http://articles.leosimons.com/
-----------------------------------------------------------------------
"We started off trying to set up a small anarchist community, but
  people wouldn't obey the rules."
                                                         -- Alan Bennett