KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > phoenix > metainfo > BlockInfo


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

8 package org.apache.avalon.phoenix.metainfo;
9
10 /**
11  * This class contains meta-information of use to administative
12  * tools and the kernel. It describes the services offered by a type
13  * of block, the dependencies of the block, the management interface of
14  * block (if any) and also contains information useful to presenting
15  * information in administative screens (like human readable names etc).
16  *
17  * @author <a HREF="mailto:peter at apache.org">Peter Donald</a>
18  */

19 public class BlockInfo
20 {
21     private final BlockDescriptor m_descriptor;
22
23     private final ServiceDescriptor[] m_services;
24
25     private final ServiceDescriptor[] m_managementAccessPoints;
26
27     private final DependencyDescriptor[] m_dependencies;
28
29     /**
30      * Basic constructor that takes as parameters all parts.
31      */

32     public BlockInfo( final BlockDescriptor descriptor,
33                       final ServiceDescriptor[] services,
34                       final ServiceDescriptor[] managementAccessPoints,
35                       final DependencyDescriptor[] dependencies )
36     {
37         m_descriptor = descriptor;
38         m_services = services;
39         m_managementAccessPoints = managementAccessPoints;
40         m_dependencies = dependencies;
41     }
42
43     /**
44      * Return meta information that is generallly only required by administration tools.
45      *
46      * It should be loaded on demand and not always present in memory.
47      *
48      * @return the BlockDescriptor
49      */

50     public BlockDescriptor getBlockDescriptor()
51     {
52         return m_descriptor;
53     }
54
55     /**
56      * This returns a list of Services that this block exports.
57      *
58      * @return an array of Services
59      */

60     public ServiceDescriptor[] getServices()
61     {
62         return m_services;
63     }
64
65     /**
66      * This returns a list of Services that this block can be Managed by.
67      *
68      * @return an array of Management Access Points (management services)
69      */

70     public ServiceDescriptor[] getManagementAccessPoints()
71     {
72         return m_managementAccessPoints;
73     }
74
75     /**
76      * Return an array of Service dependencies that this Block depends upon.
77      *
78      * @return an array of Service dependencies
79      */

80     public DependencyDescriptor[] getDependencies()
81     {
82         return m_dependencies;
83     }
84
85     /**
86      * Retrieve a dependency with a particular role.
87      *
88      * @param role the role
89      * @return the dependency or null if it does not exist
90      */

91     public DependencyDescriptor getDependency( final String JavaDoc role )
92     {
93         for( int i = 0; i < m_dependencies.length; i++ )
94         {
95             if( m_dependencies[ i ].getRole().equals( role ) )
96             {
97                 return m_dependencies[ i ];
98             }
99         }
100
101         return null;
102     }
103 }
104
Popular Tags