KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > dna > tools > verifier > BadServiceAccessor


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.dna.tools.verifier;
9
10 import org.codehaus.metaclass.introspector.MetaClassAccessor;
11 import org.codehaus.metaclass.introspector.MetaClassException;
12 import org.codehaus.metaclass.model.ClassDescriptor;
13 import org.codehaus.metaclass.model.Attribute;
14 import org.codehaus.metaclass.model.FieldDescriptor;
15 import org.codehaus.metaclass.model.MethodDescriptor;
16 import java.util.Properties JavaDoc;
17 import java.awt.event.ActionListener JavaDoc;
18
19 /**
20  *
21  * @author Peter Donald
22  * @version $Revision: 1.1 $ $Date: 2004/04/18 20:13:44 $
23  */

24 class BadServiceAccessor
25     implements MetaClassAccessor
26 {
27     static final String JavaDoc BAD_SERVICE = "I-No-Exist!";
28
29     public ClassDescriptor getClassDescriptor( final String JavaDoc classname,
30                                                final ClassLoader JavaDoc classLoader,
31                                                final MetaClassAccessor accessor )
32         throws MetaClassException
33     {
34         final Properties JavaDoc bad = new Properties JavaDoc();
35         bad.setProperty( "type", ActionListener JavaDoc.class.getName() );
36
37         final Properties JavaDoc good = new Properties JavaDoc();
38         good.setProperty( "type", BAD_SERVICE );
39         final Attribute[] attributes = new Attribute[]
40         {
41             new Attribute( "dna.component" ),
42             new Attribute( "dna.service", bad ),
43             new Attribute( "dna.service", good )
44         };
45         return new ClassDescriptor( classname,
46                                     attributes,
47                                     attributes,
48                                     FieldDescriptor.EMPTY_SET,
49                                     MethodDescriptor.EMPTY_SET );
50     }
51 }
52
Popular Tags