Source Code Cross Referenced for DSAMEMultiPortalConstants.java in  » Portal » Open-Portal » com » sun » portal » community » mc » impl » am » 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 » Open Portal » com.sun.portal.community.mc.impl.am 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: DSAMEMultiPortalConstants.java,v 1.1 2005/06/15 12:03:23 as133206 Exp $
003:         * Copyright 2004 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.community.mc.impl.am;
014:
015:        import com.sun.portal.admin.common.util.AdminUtil;
016:
017:        import java.util.HashMap;
018:        import java.util.Map;
019:
020:        // This file is copy of ps/desktop/src/com/sun/portal/desktop/context/DSAMEMultiPortalConstants.java,
021:        // with one difference: it throws Error in place of ContextError.
022:        // If ps/desktop file changes, that file should be re-copied into this package with same class-name,
023:        // and changed to throw Error in place of ContextError.
024:        // A hack to remove cyclic dependency between CtyMC module and Desktop.
025:
026:        public class DSAMEMultiPortalConstants implements  DSAMEConstants {
027:
028:            private static Map instances = new HashMap(2);
029:
030:            /**
031:             * Always holds the id of the first instance created.
032:             * This is used only during the getInstance with no args.
033:             * The only use this has, is to avoid the cost of getting the
034:             * key set from the map and then iterating thru the set to
035:             * get the poralId when only one entry exists.
036:             */
037:            private static String loneId = null;
038:
039:            private DSAMEMultiPortalConstants(String id) {
040:                //Every portal MUST have a valid portal id.
041:                validateId(id);
042:                //In case of an upgraded portal, the service and attrs do
043:                //not have a portal id in their names
044:                if (!id.equals(AdminUtil.UPGRADED_PORTAL)) {
045:                    id = id.trim();
046:                    MP_ATTR_PREFIX = "sunPortal" + id + "Desktop";
047:                    MP_SUN_DESKTOP_SERVICE = "SunPortal" + id
048:                            + "DesktopService";
049:                    MP_SUN_DESKTOP_OBJECT_CLASS = "SunPortal" + id
050:                            + "DesktopPerson";
051:                    MP_ATTR_DEFAULTCHANNELNAME = MP_ATTR_PREFIX
052:                            + "DefaultChannelName";
053:                    MP_ATTR_EDITPROVIDERCONTAINERNAME = MP_ATTR_PREFIX
054:                            + "EditProviderContainerName";
055:                    MP_ATTR_COMMUNITY_PARENT_CONTAINER_URL_PARAMETER = MP_ATTR_PREFIX
056:                            + "CommunityParentContainerURLParameter";
057:                    MP_ATTR_COMMUNITY_HOME_CONTAINER_NAME = MP_ATTR_PREFIX
058:                            + "CommunityHomeContainerName";
059:
060:                    MP_ATTR_DESKTOP_TYPE = MP_ATTR_PREFIX + "Type";
061:                    MP_ATTR_DP_DOCUMENT_USER = MP_ATTR_PREFIX
062:                            + "DpDocumentUser";
063:                    MP_ATTR_DP_LAST_MODIFIED_USER = MP_ATTR_PREFIX
064:                            + "DpLastModifiedUser";
065:                }
066:            }
067:
068:            /**
069:             * portalId may contain only letters, digits and hyphen.
070:             *
071:             * @throws com.sun.portal.desktop.context.ContextError
072:             *          if the identifier is invalid
073:             */
074:            private void validateId(String id) {
075:                if (id == null || id.length() == 0) {
076:                    throw new Error("Invalid portal identifier");
077:                } else if (id.matches(".*[^a-zA-Z0-9-].*")) {
078:                    throw new Error("Invalid portal identifier");
079:                }
080:            }
081:
082:            /**
083:             * The prefix MP indicates MULTI_PORTAL
084:             * Conventionally, the identifiers should be lower case as they are not
085:             * being set in the static initilizers. But practically these are
086:             * constants for a portal server instance, hence the capitalization.
087:             */
088:
089:            // Attribute Prefix
090:            public String MP_ATTR_PREFIX = ATTR_PREFIX;
091:
092:            //
093:            // Service Names
094:            //
095:            public String MP_SUN_DESKTOP_SERVICE = "SunPortalDesktopService";
096:
097:            public String MP_SUN_DESKTOP_OBJECT_CLASS = "SunPortalDesktopPerson";
098:
099:            //
100:            // Dynamic Attributes
101:            //
102:            public String MP_ATTR_DEFAULTCHANNELNAME = ATTR_PREFIX
103:                    + "DefaultChannelName";
104:
105:            public String MP_ATTR_EDITPROVIDERCONTAINERNAME = ATTR_PREFIX
106:                    + "EditProviderContainerName";
107:
108:            public String MP_ATTR_COMMUNITY_PARENT_CONTAINER_URL_PARAMETER = ATTR_PREFIX
109:                    + "CommunityParentContainerURLParameter";
110:
111:            public String MP_ATTR_COMMUNITY_HOME_CONTAINER_NAME = ATTR_PREFIX
112:                    + "CommunityHomeContainerName";
113:
114:            public String MP_ATTR_DESKTOP_TYPE = ATTR_PREFIX + "Type";
115:
116:            //
117:            // User Attributes
118:            //
119:            public String MP_ATTR_DP_DOCUMENT_USER = ATTR_PREFIX
120:                    + "DpDocumentUser";
121:
122:            public String MP_ATTR_DP_LAST_MODIFIED_USER = ATTR_PREFIX
123:                    + "DpLastModifiedUser";
124:
125:            //
126:            // instance management
127:            //
128:
129:            public static synchronized void createInstance(String id) {
130:                if (!instances.containsKey(id)) {
131:                    instances.put(id, new DSAMEMultiPortalConstants(id));
132:                    if (instances.size() == 1) {
133:                        loneId = id;
134:                    }
135:                }
136:            }
137:
138:            /**
139:             * For the desktop code, there is always only one instance of this class
140:             * since each portal runs in its own JVM. This method returns such
141:             * instance which has been created using createInstance. It throws a
142:             * ContextError if no instance exists or if more than one instances
143:             * exist. So ideally, there will be only one instance in existance
144:             * if this class is being properly used in the desktop code.
145:             */
146:            public static DSAMEMultiPortalConstants getInstance() {
147:                int n = instances.size();
148:                if (n == 0) {
149:                    throw new Error("Instance does not exist");
150:                } else if (n > 1) {
151:                    throw new Error("Invalid use of getInstance: "
152:                            + " More than one instance exists");
153:                }
154:                return (DSAMEMultiPortalConstants) instances.get(loneId);
155:            }
156:
157:            /**
158:             * The desktop code executes in VM in which there is only one
159:             * portal. Thus there is a single instance of this
160:             * class which gets initialized at the servlet init time.
161:             * Once initialized, this never changes during the lifetime of that VM.
162:             * But in case of admin mbeans, the situation is different. Different
163:             * mbeans belonging to different portals run in the same JVM of the cacao
164:             * server. Each mbean knows which portal it belongs to and hence can
165:             * request an instance of this class initialized for a specific portal.
166:             * So this method is used by the mbeans to get a specific instance. The rule
167:             * to use this method still remains same, that is, one MUST first create
168:             * an instance before trying to get it, otherwise a ContextError is
169:             * thrown.
170:             */
171:            public static DSAMEMultiPortalConstants getInstance(String id) {
172:                if (!instances.containsKey(id)) {
173:                    throw new Error("Instance does not exist");
174:                }
175:                return (DSAMEMultiPortalConstants) instances.get(id);
176:            }
177:        }
www___.ja__v__a_2s_.__c__o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.