dev@grizzly.java.net

Re: Discussion about Annotations support in GWSD

From: Survivant 00 <survivant00_at_gmail.com>
Date: Fri, 25 Sep 2009 09:08:40 -0400

here the first prototype

need your feedback on this one. I tried with war that I found on the web..
but I didn,t cover everything.

You will need deployer to run this test. I didn't include that directly
into deployer because I want to test it outside first.


look need to tell the application where to look. it will check into
WEB-INF/classes and WEB-INF/lib

and the output it's a webapp populated with annotations found in the
classes.

The main concern is with @Resource.

Each webserver can handle it differently.. and that's not fun.


public static void main(String[] args) throws Exception {

        AnnotationParser parser = new AnnotationParser();

        final Map.Entry<String, URLClassLoader> loaderEntry =

GrizzlyWebServerDeployer.explodeAndCreateWebAppClassLoader("C:/workspace_personal/WebAnnotation/",
new URLClassLoader(new URL[0]));

        URLClassLoader classLoader = loaderEntry.getValue();

        WebApp webapp = parser.parseAnnotation(classLoader);


        System.out.println(webapp);


    }


<WebApp>
<ResourceRef>
<description></description>
<mappedName></mappedName>
<resAuth>Container</resAuth>
<resRefName>jdbc/TestDB</resRefName>
<resSharingScope>Shareable</resSharingScope>
<resType>javax.sql.DataSource</resType>
</ResourceRef>
<SecurityRole>
<roleName>BusinessAdmin</roleName>
</SecurityRole>
<SecurityRole>
<roleName>context</roleName>
</SecurityRole>
<EnvEntry>
<description></description>
<mappedName>Cool</mappedName>
<envEntryName>contextfield</envEntryName>
<envEntryType>java.lang.String</envEntryType>
<envEntryValue>Cool</envEntryValue>
</EnvEntry>
<LifecycleCallback>
<lifecycleCallbackClass>listeners.ContextListener</lifecycleCallbackClass>
<lifecycleCallbackMethod>mymethod</lifecycleCallbackMethod>
</LifecycleCallback>
<LifecycleCallback>
<lifecycleCallbackClass>grizzly.HelloWorldExample</lifecycleCallbackClass>
<lifecycleCallbackMethod>pre</lifecycleCallbackMethod>
</LifecycleCallback>
</WebApp>