Source Code Cross Referenced for PortalConfiguration.java in  » Portal » stringbeans-3.5 » com » nabhinc » portal » model » 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 » stringbeans 3.5 » com.nabhinc.portal.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* 
0002:         * (C) Copyright 2000 - 2006 Nabh Information Systems, Inc. 
0003:         * 
0004:         * This program is free software; you can redistribute it and/or
0005:         * modify it under the terms of the GNU General Public License 
0006:         * as published by the Free Software Foundation; either version 2
0007:         * of the License, or (at your option) any later version.
0008:         * 
0009:         * This program is distributed in the hope that it will be useful,
0010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
0011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
0012:         * GNU General Public License for more details.
0013:         * 
0014:         * You should have received a copy of the GNU General Public License
0015:         * along with this program; if not, write to the Free Software 
0016:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0017:         * 
0018:         */
0019:        package com.nabhinc.portal.model;
0020:
0021:        import java.io.ByteArrayOutputStream;
0022:        import java.io.FileInputStream;
0023:        import java.io.StringReader;
0024:        import java.rmi.RemoteException;
0025:        import java.security.NoSuchAlgorithmException;
0026:        import java.text.SimpleDateFormat;
0027:        import java.util.ArrayList;
0028:        import java.util.HashMap;
0029:        import java.util.List;
0030:        import java.util.Locale;
0031:        import java.util.Vector;
0032:
0033:        import javax.xml.bind.JAXBContext;
0034:        import javax.xml.bind.Marshaller;
0035:        import javax.xml.bind.Unmarshaller;
0036:        import javax.xml.bind.annotation.XmlAttribute;
0037:        import javax.xml.bind.annotation.XmlElement;
0038:        import javax.xml.bind.annotation.XmlElementWrapper;
0039:        import javax.xml.bind.annotation.XmlRootElement;
0040:        import javax.xml.bind.annotation.XmlTransient;
0041:
0042:        import org.apache.commons.logging.Log;
0043:        import org.apache.commons.logging.LogFactory;
0044:
0045:        import com.nabhinc.core.Defaults;
0046:        import com.nabhinc.portal.api.PortalInformationStoreLocator;
0047:        import com.nabhinc.portal.core.PortalConstants;
0048:        import com.nabhinc.portal.core.PortalEventMonitor;
0049:        import com.nabhinc.portal.spi.AuthenticationServiceLocator;
0050:        import com.nabhinc.portal.spi.BaseUserServiceImpl;
0051:        import com.nabhinc.portal.spi.UserAdminServiceLocator;
0052:        import com.nabhinc.util.ComponentConfig;
0053:        import com.nabhinc.util.StringUtil;
0054:        import com.nabhinc.util.db.DBUtil;
0055:        import com.nabhinc.util.i18n.DateTimeFormatUtil;
0056:
0057:        /**
0058:         * 
0059:         *
0060:         * @author Padmanabh Dabke
0061:         * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
0062:         */
0063:        @XmlRootElement(name="portal-config")
0064:        public class PortalConfiguration {
0065:            public static final String DEFAULT_THEMES_DIR = "/themes";
0066:
0067:            public static final String DEFAULT_DATE_PATTERN = "MM/dd/yyyy";
0068:
0069:            public static final String ROOT_DIR_PARAM_NAME = "rootDir";
0070:
0071:            public static final String DEFAULT_ENCRYPTION_ALGORITHM = "MD5";
0072:
0073:            private static PortalConfiguration pcSelf = null;
0074:
0075:            private transient Log pcLogger = LogFactory.getLog(this .getClass());
0076:
0077:            public PortalConfiguration() {
0078:                super ();
0079:                pcSelf = this ;
0080:            }
0081:
0082:            public static PortalConfiguration getInstance() {
0083:                return pcSelf;
0084:            }
0085:
0086:            public static class LocaleConfig {
0087:                @XmlAttribute(name="lang")
0088:                public String lang = null;
0089:
0090:                @XmlAttribute(name="country")
0091:                public String country = null;
0092:
0093:                @XmlAttribute(name="label")
0094:                public String label = null;
0095:
0096:                @XmlAttribute(name="dateFormat")
0097:                public String dateFormat = null;
0098:
0099:                @XmlAttribute(name="timestampFormat")
0100:                public String timestampFormat = null;
0101:
0102:                public LocaleConfig() {
0103:                }
0104:
0105:                public LocaleConfig(String lang, String country, String label,
0106:                        String df, String tf) {
0107:                    this .lang = lang;
0108:                    this .country = country;
0109:                    this .label = label;
0110:                    this .dateFormat = df;
0111:                    this .timestampFormat = tf;
0112:                }
0113:
0114:                public String toString() {
0115:                    if (StringUtil.isNullOrEmpty(country)) {
0116:                        return lang;
0117:                    } else {
0118:                        return lang + "_" + country;
0119:                    }
0120:                }
0121:            }
0122:
0123:            public static class PortletAppContextConfig {
0124:
0125:                @XmlAttribute(name="contextPath")
0126:                public String contextPath = null;
0127:
0128:                @XmlAttribute(name="servletURI")
0129:                public String servletURI = null;
0130:
0131:            }
0132:
0133:            public static class ProtectedPortletConfig {
0134:
0135:                @XmlAttribute(name="portletName")
0136:                public String portletName = null;
0137:
0138:                @XmlAttribute(name="requestTypeParam")
0139:                public String requestTypeParam = "request_type";
0140:
0141:                @XmlAttribute(name="requestTypes")
0142:                public String requestTypes = null;
0143:            }
0144:
0145:            public static class PageLayoutConfig {
0146:                @XmlAttribute(name="template")
0147:                public String template = null;
0148:
0149:                @XmlAttribute(name="modelClass")
0150:                public String modelClass = null;
0151:
0152:                @XmlAttribute(name="label")
0153:                public String label = null;
0154:            }
0155:
0156:            public static class PortletTemplateConfig {
0157:                @XmlAttribute(name="template")
0158:                public String template = null;
0159:
0160:                @XmlAttribute(name="label")
0161:                public String label = null;
0162:            }
0163:
0164:            @XmlElement(name="show-maximize-portlet-icon")
0165:            private boolean psShowMaximizePortletIcon = true;
0166:
0167:            @XmlElement(name="show-minimize-portlet-icon")
0168:            private boolean psShowMinimizePortletIcon = true;
0169:
0170:            @XmlElement(name="show-refresh-portlet-icon")
0171:            private boolean psShowRefreshPortletIcon = true;
0172:
0173:            @XmlElement(name="show-detach-portlet-icon")
0174:            private boolean psShowDetachPortletIcon = true;
0175:
0176:            @XmlTransient
0177:            private LocaleConfig psDefaultLocaleConfig = new LocaleConfig("en",
0178:                    "US", null, null, null);
0179:
0180:            @XmlTransient
0181:            private List<LocaleConfig> psSupportedLocaleConfigs = new ArrayList<LocaleConfig>();
0182:
0183:            @XmlElement(name="default-display-mode")
0184:            private String psDefaultDisplayMode = PortalConstants.DISPLAY_MODE_NORMAL;
0185:
0186:            @XmlElement(name="allow-display-mode-switch")
0187:            private boolean psDisplayModeSwitchAllowed = true;
0188:
0189:            @XmlElement(name="portlet-access-controller")
0190:            private PortletAccessController psACController = new PortletAccessController();
0191:
0192:            @XmlElement(name="portal-admin-email",nillable=false)
0193:            private String psPortalAdminEmail = null;
0194:
0195:            /**
0196:             * Send user ID (and password) when resetting password.
0197:             */
0198:            @XmlElement(name="send-username-password")
0199:            private boolean psSendUsername = false;
0200:
0201:            /**
0202:             * Flag for enabling auto login option in login portlet.
0203:             */
0204:            @XmlElement(name="remember-me")
0205:            private boolean psRememberMe = false;
0206:
0207:            /**
0208:             * Flag indicating if Remember User ID option is turned on.
0209:             */
0210:            @XmlElement(name="remember-username")
0211:            private boolean psRememberUsername = false;
0212:
0213:            @XmlElement(name="encrypt-password")
0214:            private boolean psPasswordEncrypted = true;
0215:
0216:            @XmlElement(name="disable-ajax")
0217:            private boolean psAJAXDisabled = false;
0218:
0219:            /**
0220:             * Indicates whether country/locale flag to be displayed for unlogged users.
0221:             */
0222:            @XmlElement(name="supported-locales-icons")
0223:            private boolean psShowLocaleIcons = false;
0224:
0225:            /**
0226:             * Flag indicating if this portal supports SSL connections.
0227:             */
0228:            @XmlElement(name="support-secure-connection")
0229:            private boolean psSecureConnectionSupported = false;
0230:
0231:            /**
0232:             * Does this portal allow self-registration without admin intervention?
0233:             */
0234:            @XmlElement(name="allow-self-registration")
0235:            private boolean psSelfRegistrationAllowed = false;
0236:
0237:            /**
0238:             * Flag indicating whether secure url is used when users log in.
0239:             */
0240:            @XmlElement(name="secure-login")
0241:            private boolean psSecureLogin = false;
0242:
0243:            /**
0244:             * Indicates if the captcha image verification is done during new user
0245:             * registration
0246:             */
0247:            @XmlElement(name="enable-registration-captcha")
0248:            private boolean psRegistrationCaptchaEnabled = false;
0249:
0250:            /**
0251:             * Indicates if captcha verification is done during user login
0252:             */
0253:            @XmlElement(name="enable-login-captcha")
0254:            private boolean psLoginCaptchaEnabled = false;
0255:
0256:            /**
0257:             * Session timeout for the portal. If non-zero default timeout for the
0258:             * application will be overridden.
0259:             */
0260:            @XmlElement(name="session-timeout-interval")
0261:            private int psSessionTimeout = 0;
0262:
0263:            /**
0264:             * Unsecure portal base URL
0265:             */
0266:            @XmlElement(name="portal-url-prefix")
0267:            private String psPortalURLPrefix = null;
0268:
0269:            /**
0270:             * The base https URL that points to this portal.
0271:             */
0272:            @XmlElement(name="portal-secure-url-prefix")
0273:            private String psPortalSecureURLPrefix = "";
0274:
0275:            /**
0276:             * Name of the portlet displayed if a requested portlet is not found.
0277:             */
0278:            @XmlElement(name="not-found-portlet")
0279:            private String psNotFoundPortlet = null;
0280:
0281:            /**
0282:             * Comma seperated list of portlets that should not be displayed in narrow
0283:             * columns.
0284:             */
0285:            @XmlElement(name="wide-portlets")
0286:            private String psWidePortlets = null;
0287:
0288:            /**
0289:             * Themes directory name (relative to portal root).
0290:             */
0291:            @XmlElement(name="themes-dir")
0292:            private String psThemesDir = PortalConfiguration.DEFAULT_THEMES_DIR;
0293:
0294:            /**
0295:             * Class name of lifecycle monitor
0296:             */
0297:            @XmlElement(name="event-monitor-class")
0298:            private String psEventMonitorClass = null;
0299:
0300:            /**
0301:             * Relative redirect URL used in case of unprotected portlet application
0302:             * containing portlets that require user log in for some of the
0303:             * render/processAction types.
0304:             */
0305:            @XmlElement(name="protected-portlet-redirect")
0306:            private String protectedPortletRedirectURL = "/admin/portlet_redirect.jsp";
0307:
0308:            @XmlElement(name="supported-portlet-modes")
0309:            private String supportedPortletModes = "view,edit,help,config,admin,preview";
0310:
0311:            @XmlElementWrapper(name="portal-plugins")
0312:            @XmlElement(name="portal-plugin")
0313:            private List<ComponentConfig> portalPluginConfigs = null;
0314:
0315:            @XmlElementWrapper(name="login-interceptors")
0316:            @XmlElement(name="login-interceptor")
0317:            private List<ComponentConfig> loginInterceptorConfigs = null;
0318:
0319:            @XmlElementWrapper(name="protected-portlets")
0320:            @XmlElement(name="protected-portlet")
0321:            private List<ProtectedPortletConfig> protectedPortletConfigs = null;
0322:
0323:            @XmlElementWrapper(name="portlet-app-contexts")
0324:            @XmlElement(name="portlet-app-context")
0325:            private List<PortletAppContextConfig> portletAppContextConfigs = null;
0326:
0327:            @XmlElementWrapper(name="page-layouts")
0328:            @XmlElement(name="page-layout")
0329:            private List<PageLayoutConfig> pageLayoutConfigs = null;
0330:
0331:            @XmlElementWrapper(name="portlet-templates")
0332:            @XmlElement(name="portlet-template")
0333:            private List<PortletTemplateConfig> portletTemplateConfigs = null;
0334:
0335:            private transient String[] supportedModesArray = null;
0336:
0337:            private transient HashMap<String, String> psUntrackedHashMap = new HashMap<String, String>();
0338:
0339:            private transient HashMap<String, String> psWidePortletsMap = new HashMap<String, String>();
0340:
0341:            /**
0342:             * List of locales read from portal.xml file
0343:             */
0344:            private transient Vector<String> psLocaleList = new Vector<String>();
0345:
0346:            /**
0347:             * Map of locale label -> Locale object
0348:             */
0349:            private transient HashMap psLocaleMap = new HashMap();
0350:
0351:            /**
0352:             * Default portal locale
0353:             */
0354:            private transient Locale psDefaultLocale = Locale.getDefault();// new
0355:            // Locale("en",
0356:            // "US");
0357:
0358:            /**
0359:             * Default formatter for dates
0360:             */
0361:            private transient SimpleDateFormat psDefaultDateFormat = new SimpleDateFormat(
0362:                    PortalConfiguration.DEFAULT_DATE_PATTERN, psDefaultLocale);
0363:
0364:            /**
0365:             * Operating system path to the base of portal Web application
0366:             */
0367:            private transient String realPath = "";
0368:
0369:            /**
0370:             * portlet name + ":" + request type -> "". Used to check if certain request
0371:             * types on a portlet require user login
0372:             */
0373:            private transient HashMap<String, String> psProtectedPortletRequestTypesMap = new HashMap<String, String>();
0374:
0375:            private transient HashMap<String, String> psProtectedRequestTypeParamMap = new HashMap<String, String>();
0376:
0377:            private transient HashMap<String, String> psSingletonPortalAppMap = new HashMap<String, String>();
0378:
0379:            private transient HashMap<String, String> psTemplateModelClassMap = new HashMap<String, String>();
0380:
0381:            private transient PortalEventMonitor lfMonitor = null;
0382:
0383:            @XmlTransient
0384:            public PortalEventMonitor getEventMonitor() {
0385:                return this .lfMonitor;
0386:            }
0387:
0388:            @XmlTransient
0389:            public boolean isShowDetachPortletIcon() {
0390:                return psShowDetachPortletIcon;
0391:            }
0392:
0393:            public void setShowDetachPortletIcon(boolean showDetachPortletIcon) {
0394:                this .psShowDetachPortletIcon = showDetachPortletIcon;
0395:            }
0396:
0397:            @XmlTransient
0398:            public boolean isShowMaximizePortletIcon() {
0399:                return psShowMaximizePortletIcon;
0400:            }
0401:
0402:            public void setShowMaximizePortletIcon(
0403:                    boolean showMaximizePortletIcon) {
0404:                this .psShowMaximizePortletIcon = showMaximizePortletIcon;
0405:            }
0406:
0407:            @XmlTransient
0408:            public boolean isShowMinimizePortletIcon() {
0409:                return psShowMinimizePortletIcon;
0410:            }
0411:
0412:            public void setShowMinimizePortletIcon(
0413:                    boolean showMinimizePortletIcon) {
0414:                this .psShowRefreshPortletIcon = showMinimizePortletIcon;
0415:            }
0416:
0417:            @XmlTransient
0418:            public boolean isShowRefreshPortletIcon() {
0419:                return psShowRefreshPortletIcon;
0420:            }
0421:
0422:            public void setShowRefreshPortletIcon(boolean showRefreshPortletIcon) {
0423:                this .psShowRefreshPortletIcon = showRefreshPortletIcon;
0424:            }
0425:
0426:            @XmlTransient
0427:            public String getDefaultDisplayMode() {
0428:                return this .psDefaultDisplayMode;
0429:            }
0430:
0431:            public void setDefaultDisplayMode(String dMode) {
0432:                this .psDefaultDisplayMode = dMode;
0433:            }
0434:
0435:            @XmlTransient
0436:            public boolean isDisplayModeSwitchAllowed() {
0437:                return this .psDisplayModeSwitchAllowed;
0438:            }
0439:
0440:            public void setDisplayModeSwitchAllowed(boolean flag) {
0441:                this .psDisplayModeSwitchAllowed = flag;
0442:            }
0443:
0444:            @XmlTransient
0445:            public boolean isSecureLogin() {
0446:                return psSecureLogin;
0447:            }
0448:
0449:            public void setSecureLogin(boolean secureLogin) {
0450:                this .psSecureLogin = secureLogin;
0451:            }
0452:
0453:            public Locale getDefaultLocale() {
0454:                return psDefaultLocale;
0455:            }
0456:
0457:            @XmlTransient
0458:            public boolean isLoginCaptchaEnabled() {
0459:                return psLoginCaptchaEnabled;
0460:            }
0461:
0462:            public void setLoginCaptchaEnabled(boolean loginCaptchEnabled) {
0463:                this .psLoginCaptchaEnabled = loginCaptchEnabled;
0464:            }
0465:
0466:            @XmlTransient
0467:            public String getPortalAdminEmail() {
0468:                return psPortalAdminEmail;
0469:            }
0470:
0471:            public void setPortalAdminEmail(String portalAdminEmail) {
0472:                this .psPortalAdminEmail = portalAdminEmail;
0473:            }
0474:
0475:            @XmlElement(name="default-locale")
0476:            public LocaleConfig getDefaultLocaleConfig() {
0477:                return this .psDefaultLocaleConfig;
0478:            }
0479:
0480:            public void setDefaultLocaleConfig(LocaleConfig lc) {
0481:                psDefaultLocale = new Locale(lc.lang, lc.country);
0482:                psDefaultDateFormat = new SimpleDateFormat(
0483:                        PortalConfiguration.DEFAULT_DATE_PATTERN,
0484:                        psDefaultLocale);
0485:                if (StringUtil.isNotNullOrEmpty(lc.dateFormat)) {
0486:                    DateTimeFormatUtil
0487:                            .setDefaultDateFormatPattern(lc.dateFormat);
0488:                }
0489:                if (StringUtil.isNotNullOrEmpty(lc.timestampFormat)) {
0490:                    DateTimeFormatUtil
0491:                            .setDefaultDateTimeFormatPattern(lc.timestampFormat);
0492:                }
0493:            }
0494:
0495:            @XmlElementWrapper(name="supported-locales")
0496:            @XmlElement(name="locale")
0497:            public List<LocaleConfig> getSupportedLocaleConfigs() {
0498:                return this .psSupportedLocaleConfigs;
0499:            }
0500:
0501:            @SuppressWarnings("unchecked")
0502:            public void setSupportedLocaleConfigs(List<LocaleConfig> lc) {
0503:                this .psSupportedLocaleConfigs = lc;
0504:                this .psLocaleList.clear();
0505:                this .psLocaleMap.clear();
0506:                for (int i = 0; i < lc.size(); i++) {
0507:                    LocaleConfig l = lc.get(i);
0508:                    Locale loc = null;
0509:                    if (StringUtil.isNullOrEmpty(l.country)) {
0510:                        loc = new Locale(l.lang);
0511:                    } else {
0512:                        loc = new Locale(l.lang, l.country);
0513:                    }
0514:                    this .psLocaleList.add(l.label);
0515:                    this .psLocaleMap.put(l.label, loc);
0516:                    this .psLocaleMap.put(loc, l.label);
0517:                    if (StringUtil.isNotNullOrEmpty(l.dateFormat)) {
0518:                        DateTimeFormatUtil.setDateFormatPattern(loc,
0519:                                l.dateFormat);
0520:                    }
0521:                    if (StringUtil.isNotNullOrEmpty(l.timestampFormat)) {
0522:                        DateTimeFormatUtil.setDateTimeFormatPattern(loc,
0523:                                l.timestampFormat);
0524:                    }
0525:                }
0526:            }
0527:
0528:            @XmlTransient
0529:            public String getNotFoundPortlet() {
0530:                return this .psNotFoundPortlet;
0531:            }
0532:
0533:            public void setNotFoundPortlet(String nfp) {
0534:                this .psNotFoundPortlet = nfp;
0535:            }
0536:
0537:            @XmlTransient
0538:            public String getWidePortlets() {
0539:                return this .psWidePortlets;
0540:            }
0541:
0542:            public void setWidePortlets(String nfp) {
0543:                this .psWidePortlets = nfp;
0544:                this .psWidePortletsMap.clear();
0545:                if (StringUtil.isNotNullOrEmpty(nfp)) {
0546:                    String[] wPortlets = StringUtil.split(nfp, ",");
0547:                    for (int i = 0; i < wPortlets.length; i++) {
0548:                        this .psWidePortletsMap.put(wPortlets[i], "");
0549:                    }
0550:                }
0551:            }
0552:
0553:            @XmlTransient
0554:            public List<PortletAppContextConfig> getPortletAppContextConfigs() {
0555:                return this .portletAppContextConfigs;
0556:            }
0557:
0558:            public void setPortletAppContextConfigs(
0559:                    List<PortletAppContextConfig> appConfigs) {
0560:                this .portletAppContextConfigs = appConfigs;
0561:            }
0562:
0563:            @XmlTransient
0564:            public List<ProtectedPortletConfig> getProtectedPortletConfigs() {
0565:                return this .protectedPortletConfigs;
0566:            }
0567:
0568:            public void setProtectedPortletConfigs(
0569:                    List<ProtectedPortletConfig> appConfigs) {
0570:                this .protectedPortletConfigs = appConfigs;
0571:                psProtectedPortletRequestTypesMap.clear();
0572:                psProtectedRequestTypeParamMap.clear();
0573:                for (int i = 0; i < protectedPortletConfigs.size(); i++) {
0574:                    ProtectedPortletConfig pConfig = protectedPortletConfigs
0575:                            .get(i);
0576:                    String portletName = pConfig.portletName;
0577:                    String paramName = pConfig.requestTypeParam;
0578:                    if (paramName == null || paramName.equals(""))
0579:                        paramName = "request_type";
0580:                    psProtectedRequestTypeParamMap.put(portletName, paramName);
0581:                    String protectedTypesStr = pConfig.requestTypes;
0582:                    String[] pTypes = StringUtil.split(protectedTypesStr, ",");
0583:                    for (int j = 0; j < pTypes.length; j++) {
0584:                        psProtectedPortletRequestTypesMap.put(portletName + ":"
0585:                                + pTypes[j], "");
0586:                    }
0587:                }
0588:            }
0589:
0590:            @XmlTransient
0591:            public List<ComponentConfig> getPortalPluginConfigs() {
0592:                return portalPluginConfigs;
0593:            }
0594:
0595:            public void setPortalPluginConfigs(
0596:                    List<ComponentConfig> portalPlugins) {
0597:                this .portalPluginConfigs = portalPlugins;
0598:            }
0599:
0600:            @XmlTransient
0601:            public List<PageLayoutConfig> getPageLayoutConfigs() {
0602:                return this .pageLayoutConfigs;
0603:            }
0604:
0605:            public void setPageLayoutConfigs(List<PageLayoutConfig> t) {
0606:                this .pageLayoutConfigs = t;
0607:                this .psTemplateModelClassMap.clear();
0608:                if (t == null)
0609:                    return;
0610:                for (int i = 0; i < t.size(); i++) {
0611:                    PageLayoutConfig tc = t.get(i);
0612:                    this .psTemplateModelClassMap
0613:                            .put(tc.template, tc.modelClass);
0614:                }
0615:            }
0616:
0617:            @XmlTransient
0618:            public List<PortletTemplateConfig> getPortletTemplateConfigs() {
0619:                return this .portletTemplateConfigs;
0620:            }
0621:
0622:            public void setPortletTemplateConfigs(List<PortletTemplateConfig> t) {
0623:                this .portletTemplateConfigs = t;
0624:            }
0625:
0626:            @XmlTransient
0627:            public PortletAccessController getPortletAccessController() {
0628:                return this .psACController;
0629:            }
0630:
0631:            public void setPortletAccessController(PortletAccessController ace) {
0632:                this .psACController = ace;
0633:            }
0634:
0635:            @XmlTransient
0636:            public List<ComponentConfig> getLoginInterceptorConfigs() {
0637:                return loginInterceptorConfigs;
0638:            }
0639:
0640:            public void setLoginInterceptorConfigs(
0641:                    List<ComponentConfig> loginInterceptorConfigs) {
0642:                this .loginInterceptorConfigs = loginInterceptorConfigs;
0643:            }
0644:
0645:            @XmlTransient
0646:            public String getPortalSecureURLPrefix() {
0647:                return psPortalSecureURLPrefix;
0648:            }
0649:
0650:            public void setPortalSecureURLPrefix(String portalSecureURLPrefix) {
0651:                this .psPortalSecureURLPrefix = portalSecureURLPrefix;
0652:            }
0653:
0654:            @XmlTransient
0655:            public String getPortalURLPrefix() {
0656:                return psPortalURLPrefix;
0657:            }
0658:
0659:            public void setPortalURLPrefix(String portalURLPrefix) {
0660:                this .psPortalURLPrefix = portalURLPrefix;
0661:            }
0662:
0663:            @XmlTransient
0664:            public String getProtectedPortletRedirectURL() {
0665:                return protectedPortletRedirectURL;
0666:            }
0667:
0668:            public void setProtectedPortletRedirectURL(
0669:                    String protectedPortletRedirectURL) {
0670:                this .protectedPortletRedirectURL = protectedPortletRedirectURL;
0671:                if (!this .protectedPortletRedirectURL.startsWith("/"))
0672:                    this .protectedPortletRedirectURL = "/"
0673:                            + this .protectedPortletRedirectURL;
0674:            }
0675:
0676:            @XmlTransient
0677:            public SimpleDateFormat getDefaultDateFormat() {
0678:                return psDefaultDateFormat;
0679:            }
0680:
0681:            public void setDefaultDateFormat(
0682:                    SimpleDateFormat psDefaultDateFormat) {
0683:                this .psDefaultDateFormat = psDefaultDateFormat;
0684:            }
0685:
0686:            @XmlTransient
0687:            public Vector<String> getLocaleList() {
0688:                return psLocaleList;
0689:            }
0690:
0691:            @XmlTransient
0692:            public String getRealPath() {
0693:                return realPath;
0694:            }
0695:
0696:            public void setRealPath(String realPath) {
0697:                this .realPath = realPath;
0698:            }
0699:
0700:            @XmlTransient
0701:            public boolean isRegistrationCaptchaEnabled() {
0702:                return psRegistrationCaptchaEnabled;
0703:            }
0704:
0705:            public void setRegistrationCaptchaEnabled(
0706:                    boolean registrationCaptchaEnabled) {
0707:                this .psRegistrationCaptchaEnabled = registrationCaptchaEnabled;
0708:            }
0709:
0710:            @XmlTransient
0711:            public boolean isRememberMe() {
0712:                return psRememberMe;
0713:            }
0714:
0715:            public void setRememberMe(boolean rememberMe) {
0716:                this .psRememberMe = rememberMe;
0717:            }
0718:
0719:            @XmlTransient
0720:            public boolean isRememberUsername() {
0721:                return psRememberUsername;
0722:            }
0723:
0724:            public void setRememberUsername(boolean rememberUsername) {
0725:                this .psRememberUsername = rememberUsername;
0726:            }
0727:
0728:            @XmlTransient
0729:            public boolean isSendUsername() {
0730:                return psSendUsername;
0731:            }
0732:
0733:            public void setSendUsername(boolean sendUsername) {
0734:                this .psSendUsername = sendUsername;
0735:            }
0736:
0737:            @XmlTransient
0738:            public boolean isPasswordEncrypted() {
0739:                return psPasswordEncrypted;
0740:            }
0741:
0742:            public void setPasswordEncrypted(boolean flag) {
0743:                this .psPasswordEncrypted = flag;
0744:            }
0745:
0746:            @XmlTransient
0747:            public boolean isAJAXDisabled() {
0748:                return psAJAXDisabled;
0749:            }
0750:
0751:            public void setAJAXDisabled(boolean flag) {
0752:                this .psAJAXDisabled = flag;
0753:            }
0754:
0755:            @XmlTransient
0756:            public int getSessionTimeout() {
0757:                return psSessionTimeout;
0758:            }
0759:
0760:            public void setSessionTimeout(int sessionTimeout) {
0761:                this .psSessionTimeout = sessionTimeout;
0762:            }
0763:
0764:            @XmlTransient
0765:            public boolean isShowLocaleIcons() {
0766:                return psShowLocaleIcons;
0767:            }
0768:
0769:            public void setShowLocaleIcons(boolean showLocaleIcons) {
0770:                this .psShowLocaleIcons = showLocaleIcons;
0771:            }
0772:
0773:            @XmlTransient
0774:            public boolean isSecureConnectionSupported() {
0775:                return this .psSecureConnectionSupported;
0776:            }
0777:
0778:            public void setSecureConnectionSupported(
0779:                    boolean supportSecureConnection) {
0780:                this .psSecureConnectionSupported = supportSecureConnection;
0781:            }
0782:
0783:            @XmlTransient
0784:            public String getThemesDir() {
0785:                return psThemesDir;
0786:            }
0787:
0788:            public void setThemesDir(String themesDir) {
0789:                if (!themesDir.startsWith("/"))
0790:                    themesDir = "/" + themesDir;
0791:                if (themesDir.endsWith("/"))
0792:                    themesDir = themesDir.substring(0, themesDir.length() - 1);
0793:                this .psThemesDir = themesDir;
0794:            }
0795:
0796:            @XmlTransient
0797:            public boolean isSelfRegistrationAllowed() {
0798:                return psSelfRegistrationAllowed;
0799:            }
0800:
0801:            public void setSelfRegistrationAllowed(
0802:                    boolean selfRegistrationAllowed) {
0803:                this .psSelfRegistrationAllowed = selfRegistrationAllowed;
0804:            }
0805:
0806:            public void afterUnmarshal(Unmarshaller um, Object parent) {
0807:                setWidePortlets(this .psWidePortlets);
0808:                setThemesDir(this .psThemesDir);
0809:                if (this .protectedPortletConfigs != null) {
0810:                    setProtectedPortletConfigs(this .protectedPortletConfigs);
0811:                }
0812:
0813:                java.util.Date startDate = getStartDate();
0814:                if (startDate == null) {
0815:                    setStartDate(null);
0816:                }
0817:                setPageLayoutConfigs(this .pageLayoutConfigs);
0818:                this .supportedModesArray = StringUtil.split(
0819:                        this .supportedPortletModes, ",");
0820:
0821:                if (this .psPasswordEncrypted) {
0822:                    Defaults
0823:                            .setEncryptionAlgorithm(PortalConfiguration.DEFAULT_ENCRYPTION_ALGORITHM);
0824:                    try {
0825:                        try {
0826:                            ((BaseUserServiceImpl) AuthenticationServiceLocator
0827:                                    .getAuthenticationService())
0828:                                    .setDigest(PortalConfiguration.DEFAULT_ENCRYPTION_ALGORITHM);
0829:                        } catch (ClassCastException e) {
0830:                            // Ignore. We don't want to do this for a non-stringbeans
0831:                            // implementation
0832:                        }
0833:
0834:                        try {
0835:                            ((BaseUserServiceImpl) UserAdminServiceLocator
0836:                                    .getUserAdminService())
0837:                                    .setDigest(PortalConfiguration.DEFAULT_ENCRYPTION_ALGORITHM);
0838:                        } catch (ClassCastException e) {
0839:                            // Ignore. We don't want to do this for a non-stringbeans
0840:                            // implementation
0841:                        }
0842:                    } catch (NoSuchAlgorithmException e) {
0843:                        this .pcLogger.error("Unsupported digest algorithm.", e);
0844:                    }
0845:                }
0846:                if (!this .protectedPortletRedirectURL.startsWith("/"))
0847:                    this .protectedPortletRedirectURL = "/"
0848:                            + this .protectedPortletRedirectURL;
0849:                if (this .psEventMonitorClass != null) {
0850:                    try {
0851:                        this .lfMonitor = (PortalEventMonitor) Class.forName(
0852:                                this .psEventMonitorClass).newInstance();
0853:                    } catch (ClassCastException e) {
0854:                        this .pcLogger
0855:                                .error(
0856:                                        "Lifecycle monitor class does not implement monitor interface.",
0857:                                        e);
0858:                    } catch (Exception e) {
0859:                        this .pcLogger.error(
0860:                                "Invalid lifecycle monitor class name.", e);
0861:                    }
0862:                }
0863:
0864:            }
0865:
0866:            public boolean isAppVisitTracked(String appName) {
0867:                return psUntrackedHashMap.get(appName) == null;
0868:            }
0869:
0870:            @XmlTransient
0871:            public String getStartDateAsString() {
0872:                String dsName = Defaults.getDataSourceName();
0873:                String startDate = null;
0874:                try {
0875:                    startDate = DBUtil.getField(dsName,
0876:                            "SELECT startdate FROM SB_START_DATE",
0877:                            java.sql.Types.DATE, psDefaultDateFormat
0878:                                    .toPattern(), psDefaultLocale);
0879:                } catch (Exception ex) {
0880:                    pcLogger
0881:                            .error(
0882:                                    "Error in retrieving start date from database.",
0883:                                    ex);
0884:                }
0885:                return startDate;
0886:            }
0887:
0888:            @XmlTransient
0889:            public java.util.Date getStartDate() {
0890:                String dsName = Defaults.getDataSourceName();
0891:                java.util.Date startDate = null;
0892:                try {
0893:                    startDate = DBUtil.getDateField(dsName,
0894:                            "SELECT startdate FROM SB_START_DATE");
0895:                    return startDate;
0896:                } catch (Exception ex) {
0897:                    pcLogger
0898:                            .error(
0899:                                    "Error in retrieving start date from database.",
0900:                                    ex);
0901:                }
0902:                return startDate;
0903:            }
0904:
0905:            public void setStartDate(java.util.Date startDate) {
0906:                String dsName = Defaults.getDataSourceName();
0907:                String sql = null;
0908:                try {
0909:                    // check if start date has already been set.
0910:                    if (DBUtil.getDateField(dsName,
0911:                            "SELECT startdate FROM SB_START_DATE") == null) {
0912:                        if (startDate == null) {
0913:                            startDate = new java.util.Date();
0914:                        }
0915:                        sql = "INSERT INTO SB_START_DATE VALUES(?)";
0916:
0917:                    } else {
0918:                        if (startDate == null)
0919:                            return;
0920:
0921:                        sql = "UPDATE SB_START_DATE SET startdate= ?";
0922:                    }
0923:                    DBUtil.execute(dsName, sql,
0924:                            new Object[] { new java.sql.Date(startDate
0925:                                    .getTime()) });
0926:
0927:                } catch (Exception ex) {
0928:                    pcLogger.error("Error in setting start date to database.",
0929:                            ex);
0930:                }
0931:            }
0932:
0933:            public boolean isMultiInstancePortalApp(String appName) {
0934:                return psSingletonPortalAppMap.get(appName) == null;
0935:            }
0936:
0937:            public static void main(String[] args) {
0938:
0939:                try {
0940:
0941:                    JAXBContext jc = JAXBContext
0942:                            .newInstance("com.nabhinc.portal.model:com.nabhinc.condition");
0943:
0944:                    Unmarshaller u = jc.createUnmarshaller();
0945:                    PortalConfiguration pc = (PortalConfiguration) u
0946:                            .unmarshal(new FileInputStream(
0947:                                    "C:\\AllData\\eclipse\\workspace\\Stringbeans40\\WebContent\\WEB-INF\\portal.xml"));
0948:
0949:                    Marshaller m = jc.createMarshaller();
0950:                    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
0951:                    ByteArrayOutputStream sos = new ByteArrayOutputStream();
0952:                    m.marshal(pc, sos);
0953:                    String xml = sos.toString();
0954:                    System.out.println(xml);
0955:
0956:                    u.unmarshal(new StringReader(xml));
0957:                } catch (Exception e) {
0958:                    e.printStackTrace();
0959:                }
0960:            }
0961:
0962:            public String lookupModelClass(String template) {
0963:                return this .psTemplateModelClassMap.get(template);
0964:            }
0965:
0966:            @XmlTransient
0967:            public String[] getSupportedPortletModes() {
0968:                return this .supportedModesArray;
0969:            }
0970:
0971:            public void setSupportedPortletModes(String[] newModes) {
0972:                this .supportedModesArray = newModes;
0973:                this .supportedPortletModes = StringUtil.join(newModes, ",");
0974:            }
0975:
0976:            public String getRequestTypeParam(String portletName) {
0977:                return (String) psProtectedRequestTypeParamMap.get(portletName);
0978:            }
0979:
0980:            public boolean requiresUserLogin(String portletName,
0981:                    String requestType) {
0982:                return psProtectedPortletRequestTypesMap.get(portletName + ":"
0983:                        + requestType) != null;
0984:            }
0985:
0986:            public CompositeRenderable getRenderableForTemplate(String template)
0987:                    throws InstantiationException, IllegalAccessException,
0988:                    ClassNotFoundException {
0989:                String rClass = (String) this .psTemplateModelClassMap
0990:                        .get(template);
0991:                if (rClass == null) {
0992:                    return new RenderableMap();
0993:                } else {
0994:                    return (CompositeRenderable) Class.forName(rClass)
0995:                            .newInstance();
0996:                }
0997:            }
0998:
0999:            public boolean isWidePortlet(String name) {
1000:                return this .psWidePortletsMap.get(name) != null;
1001:            }
1002:
1003:            public static void load() throws RemoteException {
1004:                PortalConfiguration.pcSelf = PortalInformationStoreLocator
1005:                        .getPortalInformationStore()
1006:                        .restorePortalConfiguration();
1007:            }
1008:
1009:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.