Source Code Cross Referenced for ServerRegistrationID.java in  » Portal » jboss-portal-2.6.4 » org » jboss » portal » theme » 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 » Portal » jboss portal 2.6.4 » org.jboss.portal.theme 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /******************************************************************************
002:         * JBoss, a division of Red Hat                                               *
003:         * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
004:         * contributors as indicated by the @authors tag. See the                     *
005:         * copyright.txt in the distribution for a full listing of                    *
006:         * individual contributors.                                                   *
007:         *                                                                            *
008:         * This is free software; you can redistribute it and/or modify it            *
009:         * under the terms of the GNU Lesser General Public License as                *
010:         * published by the Free Software Foundation; either version 2.1 of           *
011:         * the License, or (at your option) any later version.                        *
012:         *                                                                            *
013:         * This software is distributed in the hope that it will be useful,           *
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
016:         * Lesser General Public License for more details.                            *
017:         *                                                                            *
018:         * You should have received a copy of the GNU Lesser General Public           *
019:         * License along with this software; if not, write to the Free                *
020:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
021:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
022:         ******************************************************************************/package org.jboss.portal.theme;
023:
024:        /**
025:         * Abstraction of a unique identifier for registered meta data.
026:         *
027:         * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>.
028:         * @version <tt>$Revision: 8784 $</tt>
029:         */
030:        public class ServerRegistrationID extends FQN {
031:            /** The serialVersionUID */
032:            private static final long serialVersionUID = 8042337046523234207L;
033:
034:            private String desc = null;
035:
036:            public static class Type {
037:                private final String type;
038:
039:                private Type(String type) {
040:                    this .type = type;
041:                }
042:
043:                public boolean equals(Object o) {
044:                    if (this  == o) {
045:                        return true;
046:                    }
047:                    if (o instanceof  Type) {
048:                        Type that = (Type) o;
049:                        return this .type.equals(that.type);
050:                    }
051:                    return false;
052:                }
053:
054:                public int hashCode() {
055:                    return type.hashCode();
056:                }
057:
058:                public String toString() {
059:                    return type;
060:                }
061:            }
062:
063:            private Type type;
064:
065:            /** type for a registered Portal Theme. */
066:            public static final Type TYPE_THEME = new Type("theme");
067:
068:            /** Type for a registered Portal Layout. */
069:            public static final Type TYPE_LAYOUT = new Type("layout");
070:
071:            /** Type for a registered Portal RenderSet. */
072:            public static final Type TYPE_RENDERSET = new Type("renderSet");
073:
074:            /**
075:             * @param type
076:             * @param names
077:             * @throws IllegalArgumentException
078:             */
079:            private ServerRegistrationID(Type type, String[] names) {
080:                super (names);
081:                this .type = type;
082:            }
083:
084:            /**
085:             * Create a new registration id based on the provided type and names.
086:             *
087:             * @param type  the type of registration to create (TYPE_THEME or TYPE_LAYOUT)
088:             * @param names an array of names that together build a unique id
089:             * @return a new ServerRegistrationID
090:             */
091:            public static ServerRegistrationID createID(Type type,
092:                    String[] names) {
093:                return new ServerRegistrationID(type, names);
094:            }
095:
096:            public String toString() {
097:                if (desc == null) {
098:                    StringBuffer buffer = new StringBuffer();
099:                    buffer.append(names[0]);
100:                    for (int i = 1; i < names.length; i++) {
101:                        buffer.append('.').append(names[i]);
102:                    }
103:                    desc = buffer.toString();
104:                }
105:                return desc;
106:            }
107:
108:            /**
109:             * convenience method to create a new registration id for a theme.
110:             *
111:             * @param appID the name of the portal web application that contains the theme
112:             * @param name  the name of the theme
113:             * @return a registration id for the meta data of a portal theme with the unique id created from <code>appID</code>
114:             *         and <code>name</code>
115:             * @throws IllegalArgumentException if any of the provided paramter values are null
116:             * @see #createID
117:             * @see #TYPE_THEME
118:             */
119:            public static ServerRegistrationID createPortalThemeID(
120:                    String appID, String name) throws IllegalArgumentException {
121:
122:                return new ServerRegistrationID(TYPE_THEME, new String[] {
123:                        appID, name });
124:            }
125:
126:            /**
127:             * convenience method to create a new registration id for a layout.
128:             *
129:             * @param appID the name of the portal web application that contains the layout
130:             * @param name  the name of the layout
131:             * @return a registration id for the meta data of a portal layout with the unique id created from <code>appID</code>
132:             *         and <code>name</code>
133:             * @throws IllegalArgumentException if any of the provided parameter values are null
134:             * @see #createID
135:             * @see #TYPE_LAYOUT
136:             */
137:            public static ServerRegistrationID createPortalLayoutID(
138:                    String appID, String name) throws IllegalArgumentException {
139:                return new ServerRegistrationID(TYPE_LAYOUT, new String[] {
140:                        appID, name });
141:            }
142:
143:            /** @return the type of this registration data */
144:            public Type getType() {
145:                return type;
146:            }
147:
148:            public boolean equals(Object obj) {
149:                if (obj == this ) {
150:                    return true;
151:                }
152:                if (!(obj instanceof  ServerRegistrationID)) {
153:                    return false;
154:                }
155:                ServerRegistrationID other = (ServerRegistrationID) obj;
156:                if (other.names.length != names.length) {
157:                    return false;
158:                }
159:
160:                if (other.type != type) {
161:                    return false;
162:                }
163:
164:                for (int i = 0; i < names.length; i++) {
165:                    if (!names[i].equals(other.names[i])) {
166:                        return false;
167:                    }
168:                }
169:                return true;
170:            }
171:
172:            public int hashCode() {
173:                int tmp = type.hashCode();
174:
175:                for (int i = 0; i < names.length; i++) {
176:                    tmp = tmp * 29 + names[i].hashCode();
177:                }
178:                return tmp;
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.