KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > loom > components > util > info > ServiceDescriptor


1 /*
2  * Copyright (C) The Loom Group. All rights reserved.
3  *
4  * This software is published under the terms of the Loom
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.loom.components.util.info;
9
10 /**
11  * This descriptor defines the type of service offerend or required by a
12  * component. The type corresponds to the class name of the class/interface
13  * implemented by component.
14  *
15  * <p>Also associated with each service is a set of arbitrary Attributes that
16  * can be used to store extra information about service.</p>
17  *
18  * <p>Possible uses for the Attributes are to declare a service as "stateless",
19  * "pass-by-value", "remotable" or even to attach Attributes such as security or
20  * transaction constraints. These Attributes are container specific and should
21  * not be relied upon to work in all containers.</p>
22  *
23  * @author Peter Donald
24  * @version $Revision: 1.2 $ $Date: 2004/05/01 12:48:34 $
25  */

26 public final class ServiceDescriptor
27 {
28     /** Constant set of 0 service descriptors. */
29     public static final ServiceDescriptor[] EMPTY_SET = new ServiceDescriptor[ 0 ];
30
31     /**
32      * The implementationKey for the service. This usually indicates the name of
33      * the service class.
34      */

35     private final String JavaDoc m_type;
36
37     /**
38      * Construct a service with specified name and Attributes.
39      *
40      * @param type the type of Service
41      */

42     public ServiceDescriptor( final String JavaDoc type )
43     {
44         if( null == type )
45         {
46             throw new NullPointerException JavaDoc( "type" );
47         }
48
49         m_type = type;
50     }
51
52     /**
53      * Return the implementationKey of service.
54      *
55      * @return the implementationKey of service.
56      */

57     public String JavaDoc getType()
58     {
59         return m_type;
60     }
61
62     /**
63      * Overide toString to perform a reasonable strinigifcation of service.
64      *
65      * @return string representing service
66      */

67     public String JavaDoc toString()
68     {
69         final StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
70         sb.append( m_type );
71         return sb.toString();
72     }
73 }
74
Popular Tags