Source Code Cross Referenced for RoleUnresolved.java in  » JMX » jfoxmx » javax » management » relation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » jfoxmx » javax.management.relation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.org
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package javax.management.relation;
009:
010:        import java.util.Iterator;
011:        import java.util.ArrayList;
012:        import java.util.List;
013:        import java.io.Serializable;
014:        import javax.management.ObjectName;
015:
016:        /**
017:         * Represents an unresolved role: a role not retrieved from a relation due
018:         * to a problem. It provides the role name, value (if problem when trying to
019:         * set the role) and an integer defining the problem (constants defined in
020:         * RoleStatus).
021:         *
022:         * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
023:         */
024:
025:        public class RoleUnresolved implements  Serializable {
026:
027:            // Role name
028:            private String roleName = null;
029:
030:            // Role value (ArrayList of ObjectName objects)
031:            private List roleValue = null;
032:
033:            // Problem type
034:            private int roleStatus;
035:
036:            /**
037:             * Constructor
038:             *
039:             * @param roleName  name of the role
040:             * @param roleValue  value of the role (if problem when setting the
041:             * role)
042:             * @param roleStatus  type of problem (according to known problem types,
043:             * listed as static final members).
044:             *
045:             * @exception IllegalArgumentException  if null parameter or incorrect
046:             * problem type
047:             */
048:            public RoleUnresolved(String roleName, List roleValue,
049:                    int roleStatus) throws IllegalArgumentException {
050:                if (roleName == null)
051:                    throw new IllegalArgumentException(
052:                            "Invalid parameter: roleName can not be null");
053:                setRoleName(roleName);
054:                setRoleValue(roleValue);
055:                setProblemType(roleStatus); // Can throw IllegalArgumentException
056:            }
057:
058:            /**
059:             * Retrieves role name
060:             */
061:            public String getRoleName() {
062:                return roleName;
063:            }
064:
065:            /**
066:             * Retrieves role value
067:             *
068:             * @return an ArrayList of ObjectName objects, the one provided to be set
069:             * in given role. Null if the unresolved role is returned for a read
070:             * access.
071:             */
072:            public List getRoleValue() {
073:                return roleValue;
074:            }
075:
076:            /**
077:             * Retrieves problem type
078:             *
079:             * @return an integer corresponding to a problem, those being described as
080:             * static final members of current class.
081:             */
082:            public int getProblemType() {
083:                return roleStatus;
084:            }
085:
086:            /**
087:             * Sets role name
088:             *
089:             * @exception IllegalArgumentException  if null parameter
090:             */
091:            public void setRoleName(String roleName)
092:                    throws IllegalArgumentException {
093:                if (roleName == null) {
094:                    throw new IllegalArgumentException(
095:                            "Invalid parameter: roleName can not be null");
096:                }
097:
098:                this .roleName = new String(roleName);
099:            }
100:
101:            /**
102:             * Sets role value
103:             *
104:             * @param roleValue  ArrayList of ObjectName objects for referenced
105:             * MBeans not set in role.
106:             */
107:            public void setRoleValue(List roleValue) {
108:                if (roleValue == null)
109:                    return;
110:                this .roleValue = new ArrayList();
111:                for (Iterator it = roleValue.iterator(); it.hasNext();) {
112:                    ObjectName objName = (ObjectName) (it.next());
113:                    this .roleValue.add(objName);
114:                }
115:            }
116:
117:            /**
118:             * Sets problem type
119:             *
120:             * @param roleStatus  integer corresponding to a problem. Must be one of
121:             * those described as static final members of current class.
122:             *
123:             * @exception IllegalArgumentException  if incorrect problem type
124:             */
125:            public void setProblemType(int roleStatus)
126:                    throws IllegalArgumentException {
127:                if (!(RoleStatus.isRoleStatus(roleStatus)))
128:                    throw new IllegalArgumentException(
129:                            "Incorrect problem type " + roleStatus);
130:                this .roleStatus = roleStatus;
131:            }
132:
133:            /**
134:             * Clone
135:             *
136:             * @return an independent clone
137:             */
138:            public Object clone() {
139:                try {
140:                    return new RoleUnresolved(roleName, roleValue, roleStatus);
141:                } catch (IllegalArgumentException exc) {
142:                    return null; // :)
143:                }
144:            }
145:
146:            /**
147:             * Prints a string describing the role
148:             */
149:            public String toString() {
150:                StringBuffer result = new StringBuffer();
151:                result.append("role name: " + roleName);
152:                if (roleValue != null) {
153:                    result.append("; value: ");
154:                    for (Iterator it = roleValue.iterator(); it.hasNext();) {
155:                        ObjectName objName = (ObjectName) (it.next());
156:                        result.append(objName.toString());
157:                        if (it.hasNext())
158:                            result.append(", ");
159:                    }
160:                }
161:                result.append("; problem type: " + roleStatus);
162:                return result.toString();
163:            }
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.