Source Code Cross Referenced for PSProviderContext.java in  » Portal » Open-Portal » com » sun » portal » desktop » context » 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.desktop.context 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* 
0002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved. 
0003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
0004:         */
0005:        package com.sun.portal.desktop.context;
0006:
0007:        import javax.servlet.http.HttpServletRequest;
0008:        import javax.servlet.ServletConfig;
0009:        import javax.servlet.ServletContext;
0010:
0011:        import java.io.File;
0012:
0013:        import java.util.Iterator;
0014:        import java.util.List;
0015:        import java.util.ArrayList;
0016:        import java.util.Map;
0017:        import java.util.HashMap;
0018:        import java.util.Hashtable;
0019:        import java.util.Locale;
0020:        import java.util.Set;
0021:        import java.util.StringTokenizer;
0022:        import java.util.Collections;
0023:        import java.util.logging.Logger;
0024:        import java.util.logging.Level;
0025:        import java.net.URL;
0026:        import java.net.MalformedURLException;
0027:
0028:        import com.sun.portal.desktop.context.DesktopContextThreadLocalizer;
0029:        import com.sun.portal.desktop.context.ParentContainerThreadLocalizer;
0030:        import com.sun.portal.desktop.context.ContextException;
0031:
0032:        import com.sun.portal.desktop.encode.Encoder;
0033:        import com.sun.portal.desktop.encode.EncoderException;
0034:
0035:        import com.sun.portal.desktop.template.ParsedTagArray;
0036:
0037:        import com.sun.portal.desktop.ServletContextThreadLocalizer;
0038:        import com.sun.portal.desktop.ServletConfigThreadLocalizer;
0039:        import com.sun.portal.desktop.RequestThreadLocalizer;
0040:        import com.sun.portal.desktop.ROC;
0041:
0042:        import com.sun.portal.desktop.util.Integers;
0043:        import com.sun.portal.desktop.util.I18n;
0044:        import com.sun.portal.desktop.util.IURLEncoder;
0045:        import com.sun.portal.desktop.util.IURLDecoder;
0046:
0047:        import com.sun.portal.providers.context.ProviderContext;
0048:        import com.sun.portal.providers.context.ProviderContextException;
0049:        import com.sun.portal.providers.context.PropertiesFilter;
0050:        import com.sun.portal.providers.context.PropertiesFilterException;
0051:        import com.sun.portal.providers.context.PropertiesFilterFactory;
0052:        import com.sun.portal.providers.context.ClientPropertiesFilter;
0053:        import com.sun.portal.providers.ProviderWidths;
0054:        import com.sun.portal.providers.ProviderEditTypes;
0055:        import com.sun.portal.log.common.PortalLogger;
0056:
0057:        public abstract class PSProviderContext implements  ProviderContext,
0058:                UserListener {
0059:
0060:            //
0061:            // this object maps uids to properties context objects
0062:            //
0063:            protected static Map propertiesContexts = new HashMap();
0064:            protected PropertiesContext propertiesContext = null;
0065:
0066:            private static ServletContext servletContext = null;
0067:            private static ServletConfig servletConfig = null;
0068:
0069:            protected DesktopContext desktopContext = null;
0070:
0071:            protected List localePropertiesFilters = null;
0072:
0073:            protected String localeString = null;
0074:
0075:            protected List clientPropertiesFilters = null;
0076:
0077:            protected List clientAndLocalePropertiesFilters = null;
0078:
0079:            protected String clientType = null;
0080:            protected Set clientTypeParents = null;
0081:
0082:            public static final String CLIENT_PROPERTIES_FILTERS = "clientPropertiesFilters";
0083:            public static final String LOCALE_PROPERTIES_FILTERS = "localePropertiesFilters";
0084:            public static final String CLIENT_AND_LOCALE_PROPERTIES_FILTERS = "clientAndLocalePropertiesFilters";
0085:
0086:            // Create a logger for this class
0087:            private static Logger debugLogger = PortalLogger
0088:                    .getLogger(PSProviderContext.class);
0089:            private static Level ERROR = Level.INFO;
0090:            private static Level WARNING = Level.FINE;
0091:            private static Level MESSAGE = Level.FINER;
0092:
0093:            public synchronized void init(HttpServletRequest req) {
0094:                desktopContext = DesktopContextThreadLocalizer.get();
0095:
0096:                if (ServletConfigThreadLocalizer.exists()) {
0097:                    //
0098:                    // servlet config may not be present in the case
0099:                    // of wsrp, where we do not have access to it
0100:                    //
0101:                    // consequently, getServletConfig() will return
0102:                    // null in a wsrp producer context
0103:                    //
0104:                    servletConfig = ServletConfigThreadLocalizer.get();
0105:                }
0106:
0107:                servletContext = ServletContextThreadLocalizer.get();
0108:
0109:                if (servletConfig == null) {
0110:                    // nothing, this is not an error
0111:                    // we expect this when in a wsrp context
0112:                }
0113:                if (servletContext == null) {
0114:                    throw new ContextError(
0115:                            "PSProviderContext.init(): servlet context was null");
0116:                }
0117:
0118:                addUserListener(this );
0119:
0120:                if (isAuthless(req)) {
0121:                    initAuthlessClientAndLocalePropertiesFilters();
0122:                } else { // auth
0123:                    initClientAndLocalePropertiesFilters(true, true);
0124:                }
0125:
0126:                initPropertiesContext();
0127:            }
0128:
0129:            public void refresh() {
0130:                getPropertiesContext().refresh();
0131:            }
0132:
0133:            public abstract void contentChanged(String channelName);
0134:
0135:            public abstract void allContentChanged();
0136:
0137:            protected String getPropertiesContextClassName() {
0138:                return getDesktopContext().getPropertiesContextClassName();
0139:            }
0140:
0141:            protected PropertiesContext getPropertiesContext() {
0142:                if (propertiesContext == null) {
0143:                    throw new ContextError(
0144:                            "PSProviderContext.getPropertiesContext(): not initialized");
0145:                }
0146:                return propertiesContext;
0147:            }
0148:
0149:            protected void initPropertiesContext() {
0150:                synchronized (propertiesContexts) {
0151:                    if (propertiesContext == null) {
0152:                        propertiesContext = (PropertiesContext) propertiesContexts
0153:                                .get(getUserID());
0154:                    }
0155:
0156:                    if (propertiesContext == null) {
0157:                        //debugError("PSProviderContext.getPropertiesContext():  creating new properties context for uid=" + getUserID());		    
0158:                        String propertiesContextClassName = getPropertiesContextClassName();
0159:                        if (propertiesContextClassName == null) {
0160:                            throw new ContextError(
0161:                                    "DesktopContext.getPropertiesContext(): class name was null");
0162:                        }
0163:
0164:                        try {
0165:                            propertiesContext = (PropertiesContext) (Class
0166:                                    .forName(propertiesContextClassName)
0167:                                    .newInstance());
0168:                        } catch (ClassNotFoundException cnfe) {
0169:                            throw new ContextError(
0170:                                    "PSProviderContext.getPropertiesContext()",
0171:                                    cnfe);
0172:                        } catch (NoClassDefFoundError ncdfe) {
0173:                            throw new ContextError(
0174:                                    "PSProviderContext.getPropertiesContext()",
0175:                                    ncdfe);
0176:                        } catch (IllegalAccessException iae) {
0177:                            throw new ContextError(
0178:                                    "PSProviderContext.getPropertiesContext()",
0179:                                    iae);
0180:                        } catch (ClassCastException cce) {
0181:                            throw new ContextError(
0182:                                    "PSProviderContext.getPropertiesContext()",
0183:                                    cce);
0184:                        } catch (InstantiationException ie) {
0185:                            throw new ContextError(
0186:                                    "PSProviderContext.getPropertiesContext()",
0187:                                    ie);
0188:                        } catch (SecurityException se) {
0189:                            throw new ContextError(
0190:                                    "PSProviderContext.getPropertiesContext()",
0191:                                    se);
0192:                        }
0193:
0194:                        propertiesContext.init(RequestThreadLocalizer
0195:                                .getRequest());
0196:                        propertiesContexts.put(getUserID(), propertiesContext);
0197:
0198:                    } else {
0199:                        // nothing addUserReference();
0200:                    }
0201:
0202:                }
0203:            }
0204:
0205:            protected DesktopContext getDesktopContext() {
0206:                return desktopContext;
0207:            }
0208:
0209:            //
0210:            // properties
0211:            //
0212:
0213:            public String getClassName(String channel)
0214:                    throws ProviderContextException {
0215:                try {
0216:                    return getPropertiesContext().getClassName(channel);
0217:                } catch (ContextError ce) {
0218:                    throw new ProviderContextException(
0219:                            "PSProviderContext.getClassName(): ", ce);
0220:                }
0221:            }
0222:
0223:            public String getStringProperty(String channel, String key)
0224:                    throws ProviderContextException {
0225:                try {
0226:                    return getStringProperty(channel, key, false);
0227:                } catch (ContextError ce) {
0228:                    throw new ProviderContextException(
0229:                            "PSProviderContext.getStringProperty(): ", ce);
0230:                }
0231:            }
0232:
0233:            public String getStringProperty(String channel, String key,
0234:                    List pflist) throws ProviderContextException {
0235:                try {
0236:                    return getPropertiesContext().getStringProperty(channel,
0237:                            key, pflist);
0238:                } catch (ContextError ce) {
0239:                    throw new ProviderContextException(
0240:                            "PSProviderContext.getStringProperty(): ", ce);
0241:                }
0242:            }
0243:
0244:            public String getStringProperty(String channel, String key,
0245:                    List pflist, boolean exact) throws ProviderContextException {
0246:                try {
0247:                    return getPropertiesContext().getStringProperty(channel,
0248:                            key, pflist, exact);
0249:                } catch (ContextError ce) {
0250:                    throw new ProviderContextException(
0251:                            "PSProviderContext.getStringProperty(): ", ce);
0252:                }
0253:            }
0254:
0255:            public String getStringProperty(String channel, String key,
0256:                    String def) throws ProviderContextException {
0257:                try {
0258:                    return getStringProperty(channel, key, def, false);
0259:                } catch (ContextError ce) {
0260:                    throw new ProviderContextException(
0261:                            "PSProviderContext.getStringProperty(): ", ce);
0262:                }
0263:            }
0264:
0265:            public String getStringProperty(String channel, String key,
0266:                    String def, List pflist) throws ProviderContextException {
0267:                try {
0268:                    return getPropertiesContext().getStringProperty(channel,
0269:                            key, def, pflist);
0270:                } catch (ContextError ce) {
0271:                    throw new ProviderContextException(
0272:                            "PSProviderContext.getStringProperty(): ", ce);
0273:                }
0274:            }
0275:
0276:            public String getStringProperty(String channel, String key,
0277:                    boolean localized) throws ProviderContextException {
0278:                try {
0279:                    if (localized) {
0280:                        List pflist = getLocalePropertiesFilters();
0281:                        return getPropertiesContext().getStringProperty(
0282:                                channel, key, pflist);
0283:                    } else {
0284:                        return getPropertiesContext().getStringProperty(
0285:                                channel, key, (List) null);
0286:                    }
0287:                } catch (ContextError ce) {
0288:                    throw new ProviderContextException(
0289:                            "PSProviderContext.getStringProperty(): ", ce);
0290:                }
0291:            }
0292:
0293:            public String getStringProperty(String channel, String key,
0294:                    String def, boolean localized)
0295:                    throws ProviderContextException {
0296:                try {
0297:                    if (localized) {
0298:                        List pflist = getLocalePropertiesFilters();
0299:                        return getPropertiesContext().getStringProperty(
0300:                                channel, key, def, pflist);
0301:                    } else {
0302:                        return getPropertiesContext().getStringProperty(
0303:                                channel, key, def, null);
0304:                    }
0305:                } catch (ContextError ce) {
0306:                    throw new ProviderContextException(
0307:                            "PSProviderContext.getStringProperty(): ", ce);
0308:                }
0309:            }
0310:
0311:            public void setStringProperty(String channel, String key, String val)
0312:                    throws ProviderContextException {
0313:                try {
0314:                    getPropertiesContext().setStringProperty(channel, key, val);
0315:                } catch (ContextError ce) {
0316:                    throw new ProviderContextException(
0317:                            "PSProviderContext.setStringProperty(): ", ce);
0318:                }
0319:            }
0320:
0321:            public void setStringProperty(String channel, String key,
0322:                    String val, List pflist) throws ProviderContextException {
0323:                try {
0324:                    getPropertiesContext().setStringProperty(channel, key, val,
0325:                            pflist);
0326:                } catch (ContextError ce) {
0327:                    throw new ProviderContextException(
0328:                            "PSProviderContext.setStringProperty(): ", ce);
0329:                }
0330:            }
0331:
0332:            public Iterator getNames(String channel)
0333:                    throws ProviderContextException {
0334:                try {
0335:                    return getPropertiesContext().getNames(channel);
0336:                } catch (ContextError ce) {
0337:                    throw new ProviderContextException(
0338:                            "PSProviderContext.getNames(): ", ce);
0339:                }
0340:            }
0341:
0342:            public Map getCollectionProperty(String channel, String key)
0343:                    throws ProviderContextException {
0344:                try {
0345:                    return getPropertiesContext().getCollectionProperty(
0346:                            channel, key);
0347:                } catch (ContextError ce) {
0348:                    throw new ProviderContextException(
0349:                            "PSProviderContext.getCollectionPropperty(): ", ce);
0350:                }
0351:            }
0352:
0353:            public Map getCollectionProperty(String channel, String key, Map def)
0354:                    throws ProviderContextException {
0355:                try {
0356:                    return getPropertiesContext().getCollectionProperty(
0357:                            channel, key, def);
0358:                } catch (ContextError ce) {
0359:                    throw new ProviderContextException(
0360:                            "PSProviderContext.getCollectionProperty(): ", ce);
0361:                }
0362:            }
0363:
0364:            public Map getCollectionProperty(String channel, String key,
0365:                    List pflist) throws ProviderContextException {
0366:                try {
0367:                    return getPropertiesContext().getCollectionProperty(
0368:                            channel, key, pflist);
0369:                } catch (ContextError ce) {
0370:                    throw new ProviderContextException(
0371:                            "PSProviderContext.getCollectionProperty(): ", ce);
0372:                }
0373:            }
0374:
0375:            public Map getCollectionProperty(String channel, String key,
0376:                    Map def, List pflist) throws ProviderContextException {
0377:                try {
0378:                    return getPropertiesContext().getCollectionProperty(
0379:                            channel, key, def, pflist);
0380:                } catch (ContextError ce) {
0381:                    throw new ProviderContextException(
0382:                            "PSProviderContext.getCollectionProperty(): ", ce);
0383:                }
0384:            }
0385:
0386:            public Map getCollectionProperty(String channel, String key,
0387:                    boolean localized) throws ProviderContextException {
0388:                try {
0389:                    if (localized) {
0390:                        List pflist = getLocalePropertiesFilters();
0391:                        return getPropertiesContext().getCollectionProperty(
0392:                                channel, key, pflist);
0393:                    } else {
0394:                        return getPropertiesContext().getCollectionProperty(
0395:                                channel, key, (List) null);
0396:                    }
0397:                } catch (ContextError ce) {
0398:                    throw new ProviderContextException(
0399:                            "PSProviderContext.getCollectionProperty(): ", ce);
0400:                }
0401:            }
0402:
0403:            public Map getCollectionProperty(String channel, String key,
0404:                    Map def, boolean localized) throws ProviderContextException {
0405:                try {
0406:                    if (localized) {
0407:                        List pflist = getLocalePropertiesFilters();
0408:                        return getPropertiesContext().getCollectionProperty(
0409:                                channel, key, def, pflist);
0410:                    } else {
0411:                        return getPropertiesContext().getCollectionProperty(
0412:                                channel, key, def, null);
0413:                    }
0414:                } catch (ContextError ce) {
0415:                    throw new ProviderContextException(
0416:                            "PSProviderContext.getCollectionProperty(): ", ce);
0417:                }
0418:            }
0419:
0420:            public void setCollectionProperty(String channel, String key,
0421:                    Map val) throws ProviderContextException {
0422:                try {
0423:                    getPropertiesContext().setCollectionProperty(channel, key,
0424:                            val);
0425:                } catch (ContextError ce) {
0426:                    throw new ProviderContextException(
0427:                            "PSProviderContext.setCollectionProperty(): ", ce);
0428:                }
0429:            }
0430:
0431:            public void setCollectionProperty(String channel, String key,
0432:                    Map val, List pflist) throws ProviderContextException {
0433:                try {
0434:                    getPropertiesContext().setCollectionProperty(channel, key,
0435:                            val, pflist);
0436:                } catch (ContextError ce) {
0437:                    throw new ProviderContextException(
0438:                            "PSProviderContext.setCollectionProperty(): ", ce);
0439:                }
0440:            }
0441:
0442:            public void setCollectionProperty(String channel, String key,
0443:                    List val) throws ProviderContextException {
0444:                try {
0445:                    getPropertiesContext().setCollectionProperty(channel, key,
0446:                            val);
0447:                } catch (ContextError ce) {
0448:                    throw new ProviderContextException(
0449:                            "PSProviderContext.setCollectionProperty(): ", ce);
0450:                }
0451:            }
0452:
0453:            public void setCollectionProperty(String channel, String key,
0454:                    List val, List pflist) throws ProviderContextException {
0455:                try {
0456:                    getPropertiesContext().setCollectionProperty(channel, key,
0457:                            val, pflist);
0458:                } catch (ContextError ce) {
0459:                    throw new ProviderContextException(
0460:                            "PSProviderContext.setCollectionProperty(): ", ce);
0461:                }
0462:            }
0463:
0464:            public boolean getBooleanProperty(String channel, String key)
0465:                    throws ProviderContextException {
0466:                try {
0467:                    return getPropertiesContext().getBooleanProperty(channel,
0468:                            key);
0469:                } catch (ContextError ce) {
0470:                    throw new ProviderContextException(
0471:                            "PSProviderContext.getBooleanProperty(): ", ce);
0472:                }
0473:            }
0474:
0475:            public boolean getBooleanProperty(String channel, String key,
0476:                    List pflist) throws ProviderContextException {
0477:                try {
0478:                    return getPropertiesContext().getBooleanProperty(channel,
0479:                            key, pflist);
0480:                } catch (ContextError ce) {
0481:                    throw new ProviderContextException(
0482:                            "PSProviderContext.getBooleanProperty(): ", ce);
0483:                }
0484:            }
0485:
0486:            public boolean getBooleanProperty(String channel, String key,
0487:                    boolean def) throws ProviderContextException {
0488:                try {
0489:                    return getPropertiesContext().getBooleanProperty(channel,
0490:                            key, def);
0491:                } catch (ContextError ce) {
0492:                    throw new ProviderContextException(
0493:                            "PSProviderContext.getBooleanProperty(): ", ce);
0494:                }
0495:            }
0496:
0497:            public boolean getBooleanProperty(String channel, String key,
0498:                    boolean def, List pflist) throws ProviderContextException {
0499:                try {
0500:                    return getPropertiesContext().getBooleanProperty(channel,
0501:                            key, def, pflist);
0502:                } catch (ContextError ce) {
0503:                    throw new ProviderContextException(
0504:                            "PSProviderContext.getBooleanProperty(): ", ce);
0505:                }
0506:            }
0507:
0508:            public void setBooleanProperty(String channel, String key,
0509:                    boolean val) throws ProviderContextException {
0510:                try {
0511:                    getPropertiesContext()
0512:                            .setBooleanProperty(channel, key, val);
0513:                } catch (ContextError ce) {
0514:                    throw new ProviderContextException(
0515:                            "PSProviderContext.setBooleanProperty(): ", ce);
0516:                }
0517:            }
0518:
0519:            public void setBooleanProperty(String channel, String key,
0520:                    boolean val, List pflist) throws ProviderContextException {
0521:                try {
0522:                    getPropertiesContext().setBooleanProperty(channel, key,
0523:                            val, pflist);
0524:                } catch (ContextError ce) {
0525:                    throw new ProviderContextException(
0526:                            "PSProviderContext.setBooleanProperty(): ", ce);
0527:                }
0528:            }
0529:
0530:            public int getIntegerProperty(String channel, String key)
0531:                    throws ProviderContextException {
0532:                try {
0533:                    return getPropertiesContext().getIntegerProperty(channel,
0534:                            key);
0535:                } catch (ContextError ce) {
0536:                    throw new ProviderContextException(
0537:                            "PSProviderContext.getIntegerProperty(): ", ce);
0538:                }
0539:            }
0540:
0541:            public int getIntegerProperty(String channel, String key,
0542:                    List pflist) throws ProviderContextException {
0543:                try {
0544:                    return getPropertiesContext().getIntegerProperty(channel,
0545:                            key, pflist);
0546:                } catch (ContextError ce) {
0547:                    throw new ProviderContextException(
0548:                            "PSProviderContext.getIntegerProperty(): ", ce);
0549:                }
0550:            }
0551:
0552:            public Object getProperty(String channel, String key)
0553:                    throws ProviderContextException {
0554:                try {
0555:                    return getPropertiesContext().getProperty(channel, key);
0556:                } catch (ContextError ce) {
0557:                    throw new ProviderContextException(
0558:                            "PSProviderContext.getProperty(): ", ce);
0559:                }
0560:            }
0561:
0562:            public Object getProperty(String channel, String key, Object def)
0563:                    throws ProviderContextException {
0564:                try {
0565:                    return getPropertiesContext()
0566:                            .getProperty(channel, key, def);
0567:                } catch (ContextError ce) {
0568:                    throw new ProviderContextException(
0569:                            "PSProviderContext.getProperty(): ", ce);
0570:                }
0571:            }
0572:
0573:            public void setProperty(String channel, String key, Object val)
0574:                    throws ProviderContextException {
0575:                try {
0576:                    getPropertiesContext().setProperty(channel, key, val);
0577:                } catch (ContextError ce) {
0578:                    throw new ProviderContextException(
0579:                            "PSProviderContext.setProperty(): ", ce);
0580:                }
0581:            }
0582:
0583:            public int getIntegerProperty(String channel, String key, int def)
0584:                    throws ProviderContextException {
0585:                try {
0586:                    return getPropertiesContext().getIntegerProperty(channel,
0587:                            key, def);
0588:                } catch (ContextError ce) {
0589:                    throw new ProviderContextException(
0590:                            "PSProviderContext.getIntegerProperty(): ", ce);
0591:                }
0592:            }
0593:
0594:            public int getIntegerProperty(String channel, String key, int def,
0595:                    List pflist) throws ProviderContextException {
0596:                try {
0597:                    return getPropertiesContext().getIntegerProperty(channel,
0598:                            key, def, pflist);
0599:                } catch (ContextError ce) {
0600:                    throw new ProviderContextException(
0601:                            "PSProviderContext.getIntegerProperty(): ", ce);
0602:                }
0603:            }
0604:
0605:            public void setIntegerProperty(String channel, String key, int val)
0606:                    throws ProviderContextException {
0607:                try {
0608:                    getPropertiesContext()
0609:                            .setIntegerProperty(channel, key, val);
0610:                } catch (ContextError ce) {
0611:                    throw new ProviderContextException(
0612:                            "PSProviderContext.setIntegerProperty(): ", ce);
0613:                }
0614:            }
0615:
0616:            public void setIntegerProperty(String channel, String key, int val,
0617:                    List pflist) throws ProviderContextException {
0618:                try {
0619:                    getPropertiesContext().setIntegerProperty(channel, key,
0620:                            val, pflist);
0621:                } catch (ContextError ce) {
0622:                    throw new ProviderContextException(
0623:                            "PSProviderContext.setIntegerProperty(): ", ce);
0624:                }
0625:            }
0626:
0627:            public boolean existsStringProperty(String channel, String name)
0628:                    throws ProviderContextException {
0629:                try {
0630:                    return getPropertiesContext().existsStringProperty(channel,
0631:                            name);
0632:                } catch (ContextError ce) {
0633:                    throw new ProviderContextException(
0634:                            "PSProviderContext.existsStringProperty(): ", ce);
0635:                }
0636:            }
0637:
0638:            public boolean existsStringProperty(String channel, String name,
0639:                    List pflist) throws ProviderContextException {
0640:                try {
0641:                    return getPropertiesContext().existsStringProperty(channel,
0642:                            name, pflist);
0643:                } catch (ContextError ce) {
0644:                    throw new ProviderContextException(
0645:                            "PSProviderContext.existsStringProperty(): ", ce);
0646:                }
0647:            }
0648:
0649:            public boolean existsStringProperty(String channel, String name,
0650:                    boolean localized) throws ProviderContextException {
0651:                try {
0652:                    if (localized) {
0653:                        List pflist = getLocalePropertiesFilters();
0654:                        return getPropertiesContext().existsStringProperty(
0655:                                channel, name, pflist);
0656:                    } else {
0657:                        return getPropertiesContext().existsStringProperty(
0658:                                channel, name, null);
0659:                    }
0660:                } catch (ContextError ce) {
0661:                    throw new ProviderContextException(
0662:                            "PSProviderContext.existsStringProperty(): ", ce);
0663:                }
0664:            }
0665:
0666:            public boolean existsBooleanProperty(String channel, String name)
0667:                    throws ProviderContextException {
0668:                try {
0669:                    return getPropertiesContext().existsBooleanProperty(
0670:                            channel, name);
0671:                } catch (ContextError ce) {
0672:                    throw new ProviderContextException(
0673:                            "PSProviderContext.existsBooleanProperty(): ", ce);
0674:                }
0675:            }
0676:
0677:            public boolean existsBooleanProperty(String channel, String name,
0678:                    List pflist) throws ProviderContextException {
0679:                try {
0680:                    return getPropertiesContext().existsBooleanProperty(
0681:                            channel, name, pflist);
0682:                } catch (ContextError ce) {
0683:                    throw new ProviderContextException(
0684:                            "PSProviderContext.existsBooleanProperty(): ", ce);
0685:                }
0686:            }
0687:
0688:            public boolean existsIntegerProperty(String channel, String name)
0689:                    throws ProviderContextException {
0690:                try {
0691:                    return getPropertiesContext().existsIntegerProperty(
0692:                            channel, name);
0693:                } catch (ContextError ce) {
0694:                    throw new ProviderContextException(
0695:                            "PSProviderContext.existsIntegerProperty(): ", ce);
0696:                }
0697:
0698:            }
0699:
0700:            public boolean existsIntegerProperty(String channel, String name,
0701:                    List pflist) throws ProviderContextException {
0702:                try {
0703:                    return getPropertiesContext().existsIntegerProperty(
0704:                            channel, name, pflist);
0705:                } catch (ContextError ce) {
0706:                    throw new ProviderContextException(
0707:                            "PSProviderContext.existsIntegerProperty(): ", ce);
0708:                }
0709:
0710:            }
0711:
0712:            public boolean existsCollectionProperty(String channel, String name)
0713:                    throws ProviderContextException {
0714:                try {
0715:                    return getPropertiesContext().existsCollectionProperty(
0716:                            channel, name);
0717:                } catch (ContextError ce) {
0718:                    throw new ProviderContextException(
0719:                            "PSProviderContext.existsCollectionProperty(): ",
0720:                            ce);
0721:                }
0722:            }
0723:
0724:            public boolean existsCollectionProperty(String channel,
0725:                    String name, List pflist) throws ProviderContextException {
0726:                try {
0727:                    return getPropertiesContext().existsCollectionProperty(
0728:                            channel, name, pflist);
0729:                } catch (ContextError ce) {
0730:                    throw new ProviderContextException(
0731:                            "PSProviderContext.existsCollectionProperty(): ",
0732:                            ce);
0733:                }
0734:            }
0735:
0736:            public boolean existsCollectionProperty(String channel,
0737:                    String name, boolean localized)
0738:                    throws ProviderContextException {
0739:                try {
0740:                    if (localized) {
0741:                        List pflist = getLocalePropertiesFilters();
0742:                        return getPropertiesContext().existsCollectionProperty(
0743:                                channel, name, pflist);
0744:                    } else {
0745:                        return getPropertiesContext().existsCollectionProperty(
0746:                                channel, name, null);
0747:                    }
0748:                } catch (ContextError ce) {
0749:                    throw new ProviderContextException(
0750:                            "PSProviderContext.existsCollectionProperty(): ",
0751:                            ce);
0752:                }
0753:            }
0754:
0755:            public synchronized List getClientAndLocalePropertiesFilters()
0756:                    throws ProviderContextException {
0757:                if (isAuthless(RequestThreadLocalizer.getRequest())) {
0758:
0759:                    // client type and locale cannot change per request
0760:                    // get the filters from ROC
0761:                    return getAuthlessClientAndLocalePropertiesFilters();
0762:                }
0763:
0764:                if (clientAndLocalePropertiesFilters == null) {
0765:                    throw new ProviderContextException(
0766:                            "PSProviderContext.getClientAndLocalePropertiesFilters(): not initialized");
0767:                }
0768:                boolean clientTypeChanged = isClientTypeChanged();
0769:                boolean localeChanged = isLocaleChanged();
0770:                if (clientTypeChanged || localeChanged) {
0771:                    clientAndLocalePropertiesFilters = initClientAndLocalePropertiesFilters(
0772:                            clientTypeChanged, localeChanged);
0773:                }
0774:
0775:                return clientAndLocalePropertiesFilters;
0776:            }
0777:
0778:            private List getAuthlessClientAndLocalePropertiesFilters()
0779:                    throws ProviderContextException {
0780:                List pflist = (List) ROC
0781:                        .getObject(CLIENT_AND_LOCALE_PROPERTIES_FILTERS);
0782:                if (pflist == null) {
0783:                    // New request for authless
0784:                    pflist = initAuthlessClientAndLocalePropertiesFilters();
0785:                }
0786:                return pflist;
0787:            }
0788:
0789:            protected List initClientAndLocalePropertiesFilters(
0790:                    boolean clientTypeChanged, boolean localeChanged) {
0791:                if (clientTypeChanged) {
0792:                    clientPropertiesFilters = initClientPropertiesFilters();
0793:                }
0794:
0795:                if (localeChanged) {
0796:                    localePropertiesFilters = initLocalePropertiesFilters();
0797:                }
0798:
0799:                List pflist = new ArrayList();
0800:
0801:                pflist.addAll(clientPropertiesFilters);
0802:                pflist.addAll(localePropertiesFilters);
0803:                clientAndLocalePropertiesFilters = Collections
0804:                        .unmodifiableList(pflist);
0805:
0806:                return clientAndLocalePropertiesFilters;
0807:            }
0808:
0809:            protected List initAuthlessClientAndLocalePropertiesFilters() {
0810:
0811:                List pflist = new ArrayList();
0812:                initAuthlessClientPropertiesFilters();
0813:                initAuthlessLocalePropertiesFilters();
0814:
0815:                pflist.addAll((List) ROC.getObject(CLIENT_PROPERTIES_FILTERS));
0816:                pflist.addAll((List) ROC.getObject(LOCALE_PROPERTIES_FILTERS));
0817:                pflist = Collections.unmodifiableList(pflist);
0818:                ROC.setObject(CLIENT_AND_LOCALE_PROPERTIES_FILTERS, pflist);
0819:                return pflist;
0820:            }
0821:
0822:            public synchronized List getLocalePropertiesFilters()
0823:                    throws ProviderContextException {
0824:
0825:                if (isAuthless(RequestThreadLocalizer.getRequest())) {
0826:                    return getAuthlessLocalePropertiesFilters();
0827:                }
0828:
0829:                if (localePropertiesFilters == null) {
0830:                    throw new ProviderContextException(
0831:                            "PSProviderContext.getLocalePropertiesFilters(): not initialized");
0832:                }
0833:                if (isLocaleChanged()) {
0834:                    localePropertiesFilters = initLocalePropertiesFilters(getLocaleString());
0835:                }
0836:
0837:                return localePropertiesFilters;
0838:            }
0839:
0840:            private List getAuthlessLocalePropertiesFilters()
0841:                    throws ProviderContextException {
0842:
0843:                List pflist = (List) ROC.getObject(LOCALE_PROPERTIES_FILTERS);
0844:                if (pflist == null) {
0845:                    pflist = initAuthlessLocalePropertiesFilters();
0846:                }
0847:                return pflist;
0848:
0849:            }
0850:
0851:            private boolean isLocaleChanged() {
0852:                String newLocale = getDesktopContext().getLocaleString();
0853:                if ((newLocale != null) && (!newLocale.equals(localeString))) {
0854:                    return true;
0855:                }
0856:                return false;
0857:            }
0858:
0859:            protected List initLocalePropertiesFilters() {
0860:
0861:                localeString = getLocaleString();
0862:                localePropertiesFilters = initLocalePropertiesFilters(localeString);
0863:
0864:                // use default if not specified 
0865:                if (localePropertiesFilters == null) {
0866:                    localeString = Locale.getDefault().toString();
0867:                    localePropertiesFilters = initLocalePropertiesFilters(localeString);
0868:                }
0869:
0870:                return localePropertiesFilters;
0871:            }
0872:
0873:            protected List initAuthlessLocalePropertiesFilters() {
0874:
0875:                String authlessLocale = getLocaleString();
0876:                List pflist = initLocalePropertiesFilters(authlessLocale);
0877:                ROC.setObject(LOCALE_PROPERTIES_FILTERS, pflist);
0878:                return pflist;
0879:            }
0880:
0881:            protected static List initLocalePropertiesFilters(
0882:                    String stringformat) {
0883:                if (stringformat == null) {
0884:                    return null;
0885:                }
0886:
0887:                List pflist = new ArrayList();
0888:                StringTokenizer tokenizer = new StringTokenizer(stringformat,
0889:                        "_");
0890:                try {
0891:                    while (tokenizer.hasMoreTokens()) {
0892:                        PropertiesFilter pf = PropertiesFilterFactory
0893:                                .get(
0894:                                        PropertiesFilterFactory.LOCALE_PROPERTIESFILTER_CLASSNAME,
0895:                                        tokenizer.nextToken(), false);
0896:
0897:                        pflist.add(pf);
0898:                    }
0899:                } catch (PropertiesFilterException pfe) {
0900:                    throw new ContextError(
0901:                            "PSDesktopContext.initLocalePropertiesFilters(): ",
0902:                            pfe);
0903:                }
0904:
0905:                return Collections.unmodifiableList(pflist);
0906:            }
0907:
0908:            public synchronized List getClientPropertiesFilters()
0909:                    throws ProviderContextException {
0910:
0911:                if (isAuthless(RequestThreadLocalizer.getRequest())) {
0912:                    return getAuthlessClientPropertiesFilters();
0913:                }
0914:
0915:                if (clientPropertiesFilters == null) {
0916:                    throw new ProviderContextException(
0917:                            "PSProviderContext.getClientPropertiesFilters(): not initialized");
0918:                }
0919:                if (isClientTypeChanged()) {
0920:                    clientPropertiesFilters = initClientPropertiesFilters();
0921:                }
0922:
0923:                return clientPropertiesFilters;
0924:            }
0925:
0926:            public List getClientPropertiesFilters(String clientType) {
0927:                return initClientPropertiesFilters(clientType);
0928:            }
0929:
0930:            private List getAuthlessClientPropertiesFilters()
0931:                    throws ProviderContextException {
0932:                List pflist = (List) ROC.getObject(CLIENT_PROPERTIES_FILTERS);
0933:                if (pflist == null) {
0934:                    pflist = initAuthlessClientPropertiesFilters();
0935:                }
0936:                return pflist;
0937:            }
0938:
0939:            private boolean isClientTypeChanged() {
0940:                String newClientType = getDesktopContext().getClientType();
0941:                if (newClientType != null) {
0942:
0943:                    if (!newClientType.equals(clientType)) {
0944:                        return true;
0945:                    }
0946:
0947:                    Set newClientTypeParents = ClientPropertiesFilter
0948:                            .getClientParents(this , newClientType);
0949:                    if ((newClientTypeParents != null)
0950:                            && !newClientTypeParents.equals(clientTypeParents)) {
0951:                        return true;
0952:                    }
0953:                }
0954:                return false;
0955:            }
0956:
0957:            protected List initAuthlessClientPropertiesFilters() {
0958:
0959:                String authlessClientType = getClientType();
0960:                if (authlessClientType == null) {
0961:                    authlessClientType = getDefaultClientType();
0962:                }
0963:
0964:                List authlessClientPropertiesFilters = initClientPropertiesFilters(authlessClientType);
0965:                ROC.setObject(CLIENT_PROPERTIES_FILTERS,
0966:                        authlessClientPropertiesFilters);
0967:                return authlessClientPropertiesFilters;
0968:            }
0969:
0970:            protected List initClientPropertiesFilters() {
0971:
0972:                clientType = getClientType();
0973:                clientTypeParents = ClientPropertiesFilter.getClientParents(
0974:                        this , clientType);
0975:                clientPropertiesFilters = initClientPropertiesFilters(clientType);
0976:
0977:                // use default if not specified
0978:                if (clientPropertiesFilters == null) {
0979:                    clientType = getDefaultClientType();
0980:                    clientPropertiesFilters = initClientPropertiesFilters(clientType);
0981:                }
0982:
0983:                return clientPropertiesFilters;
0984:
0985:            }
0986:
0987:            protected List initClientPropertiesFilters(String clientType) {
0988:                if (clientType == null) {
0989:                    return null;
0990:                }
0991:
0992:                List filters = new ArrayList();
0993:
0994:                try {
0995:                    filters = ClientPropertiesFilter.getClientFilters(this ,
0996:                            clientType, false);
0997:                } catch (PropertiesFilterException e) {
0998:                    throw new ContextError(
0999:                            "PSProviderContext.initClientPropertiesFilters(): ",
1000:                            e);
1001:                }
1002:
1003:                return Collections.unmodifiableList(filters);
1004:
1005:            }
1006:
1007:            public String getProviderName(String channel)
1008:                    throws ProviderContextException {
1009:                try {
1010:                    return getPropertiesContext().getProviderName(channel);
1011:                } catch (ContextError ce) {
1012:                    throw new ProviderContextException(
1013:                            "PSProviderContext.getProviderName(): ", ce);
1014:                }
1015:            }
1016:
1017:            public int getProviderVersion(String channel)
1018:                    throws ProviderContextException {
1019:                try {
1020:                    return getPropertiesContext().getProviderVersion(channel);
1021:                } catch (ContextError ce) {
1022:                    throw new ProviderContextException(
1023:                            "PSProviderContext.getVersion(): ", ce);
1024:                }
1025:            }
1026:
1027:            //
1028:            // services
1029:            //
1030:
1031:            public String getDesktopURL(HttpServletRequest req) {
1032:                return getDesktopContext().getDesktopURL(req);
1033:            }
1034:
1035:            public String getDesktopURL(HttpServletRequest req, Map query,
1036:                    Map pathInfo) {
1037:                return getDesktopContext().getDesktopURL(req, query, pathInfo);
1038:            }
1039:
1040:            public String getDesktopURL(HttpServletRequest req, Map query,
1041:                    Map pathInfo, boolean escape) {
1042:                String url = getDesktopContext().getDesktopURL(req, query,
1043:                        pathInfo);
1044:                if (escape) {
1045:                    try {
1046:                        url = escape(url);
1047:                    } catch (ProviderContextException pce) {
1048:                        debugLogger.log(Level.INFO, "PSDT_CSPDC0023", pce);
1049:                    }
1050:                }
1051:                return url;
1052:            }
1053:
1054:            public String getDesktopURL(HttpServletRequest req, String query,
1055:                    boolean escape) {
1056:                String url = getDesktopContext().getDesktopURL(req, query);
1057:                if (escape) {
1058:                    try {
1059:                        url = escape(url);
1060:                    } catch (ProviderContextException pce) {
1061:                        debugLogger.log(Level.INFO, "PSDT_CSPDC0023", pce);
1062:                    }
1063:                }
1064:                return url;
1065:            }
1066:
1067:            public String getLocaleString() {
1068:                return getDesktopContext().getLocaleString();
1069:            }
1070:
1071:            public synchronized Locale getLocale() {
1072:                return getDesktopContext().getLocale();
1073:            }
1074:
1075:            public String getDesktopType() {
1076:                return getDesktopContext().getDesktopType();
1077:            }
1078:
1079:            public String getLogoutURL() {
1080:                return getDesktopContext().getLogoutURL();
1081:            }
1082:
1083:            public String getLoginURL() {
1084:                return getDesktopContext().getLoginURL();
1085:            }
1086:
1087:            public String getStringAttribute(String name) {
1088:                return getDesktopContext().getStringAttribute(name);
1089:            }
1090:
1091:            public String getStringAttribute(String name, Locale locale) {
1092:                return getDesktopContext().getStringAttribute(name, locale);
1093:            }
1094:
1095:            public void setStringAttribute(String name, String val) {
1096:                getDesktopContext().setStringAttribute(name, val);
1097:            }
1098:
1099:            public String encodeURL(String url) {
1100:                return getDesktopContext().encodeURL(url);
1101:            }
1102:
1103:            public String getDefaultChannelName() {
1104:                return getDesktopContext().getDefaultChannelName();
1105:            }
1106:
1107:            //
1108:            // servlet request
1109:            //
1110:
1111:            public StringBuffer getRequestServer(HttpServletRequest req) {
1112:                return getDesktopContext().getRequestServer(req);
1113:            }
1114:
1115:            //
1116:            // client methods
1117:            //
1118:
1119:            public String getContentType() {
1120:                return getDesktopContext().getContentType();
1121:            }
1122:
1123:            public String getCharset() {
1124:                return getDesktopContext().getCharset();
1125:            }
1126:
1127:            public String getClientType() {
1128:                return getDesktopContext().getClientType();
1129:            }
1130:
1131:            public String getDefaultClientType() {
1132:                return getDesktopContext().getDefaultClientType();
1133:            }
1134:
1135:            public String getClientPath() {
1136:                return getDesktopContext().getClientPath();
1137:            }
1138:
1139:            public String getClientTypeProperty(String key) {
1140:                return getDesktopContext().getClientTypeProperty(key);
1141:            }
1142:
1143:            public String getClientTypeProperty(String clientType, String key) {
1144:                return getDesktopContext().getClientTypeProperty(clientType,
1145:                        key);
1146:            }
1147:
1148:            public Set getClientTypeProperties(String clientType, String key) {
1149:                return getDesktopContext().getClientTypeProperties(clientType,
1150:                        key);
1151:            }
1152:
1153:            public String escape(String unescaped)
1154:                    throws ProviderContextException {
1155:                try {
1156:                    return Encoder.encode(getDesktopContext()
1157:                            .getEncoderClassName(), unescaped);
1158:                } catch (EncoderException ee) {
1159:                    throw new ProviderContextException(
1160:                            "ProviderContext.escape():", ee);
1161:                }
1162:            }
1163:
1164:            //
1165:            // session methods
1166:            //
1167:
1168:            public Object getSessionProperty(String name) {
1169:                return getDesktopContext().getSessionProperty(name);
1170:            }
1171:
1172:            public void setSessionProperty(String name, Object val) {
1173:                getDesktopContext().setSessionProperty(name, val);
1174:            }
1175:
1176:            public String getSessionID() {
1177:                return getDesktopContext().getSessionID();
1178:            }
1179:
1180:            public boolean isAuthless(HttpServletRequest req) {
1181:                return getDesktopContext().isAuthless(req);
1182:            }
1183:
1184:            public String getUserID() {
1185:                return getDesktopContext().getUserID();
1186:            }
1187:
1188:            public void addSessionListener(SessionListener sl) {
1189:                getDesktopContext().addSessionListener(sl);
1190:            }
1191:
1192:            public void addUserListener(UserListener ul) {
1193:                getDesktopContext().addUserListener(ul);
1194:            }
1195:
1196:            public String getAuthenticationType() {
1197:                return getDesktopContext().getAuthenticationType();
1198:            }
1199:
1200:            //
1201:            // client properties
1202:            //
1203:            public String getClientProperty(String name) {
1204:                return getDesktopContext().getClientProperty(name);
1205:            }
1206:
1207:            public void setClientProperty(String name, String value) {
1208:                getDesktopContext().setClientProperty(name, value);
1209:            }
1210:
1211:            //
1212:            // debug methods
1213:            //
1214:
1215:            public boolean isDebugEnabled() {
1216:                return !Level.OFF.equals(debugLogger.getLevel());
1217:            }
1218:
1219:            public boolean isDebugErrorEnabled() {
1220:                return debugLogger.isLoggable(ERROR);
1221:            }
1222:
1223:            public boolean isDebugWarningEnabled() {
1224:                return debugLogger.isLoggable(WARNING);
1225:            }
1226:
1227:            public boolean isDebugMessageEnabled() {
1228:                return debugLogger.isLoggable(MESSAGE);
1229:            }
1230:
1231:            public void debugMessage(Object o) {
1232:                debugLogger.log(MESSAGE, o.toString());
1233:            }
1234:
1235:            public void debugWarning(Object o) {
1236:                debugLogger.log(WARNING, o.toString());
1237:            }
1238:
1239:            public void debugError(Object o) {
1240:                debugLogger.log(ERROR, o.toString());
1241:            }
1242:
1243:            public void debugMessage(Object o, Throwable t) {
1244:                debugLogger.log(MESSAGE, o.toString(), t);
1245:            }
1246:
1247:            public void debugWarning(Object o, Throwable t) {
1248:                debugLogger.log(WARNING, o.toString(), t);
1249:            }
1250:
1251:            public void debugError(Object o, Throwable t) {
1252:                debugLogger.log(ERROR, o.toString(), t);
1253:            }
1254:
1255:            //
1256:            // template methods
1257:            //
1258:
1259:            public StringBuffer getTemplate(String name, String file)
1260:                    throws ProviderContextException {
1261:                try {
1262:                    return getDesktopContext().getTemplate(name,
1263:                            getProviderName(name), file).getTemplateSB();
1264:                } catch (ContextError ce) {
1265:                    throw new ProviderContextException(
1266:                            "PSProviderContext.getTemplate(): ", ce);
1267:                }
1268:            }
1269:
1270:            public StringBuffer getTemplate(String desktopType, String locale,
1271:                    String name, String clientPath, String file, String baseDir)
1272:                    throws ProviderContextException {
1273:
1274:                try {
1275:                    ParsedTagArray pta = getDesktopContext().getTemplate(
1276:                            desktopType, locale, name, getProviderName(name),
1277:                            clientPath, file, baseDir);
1278:                    return pta.getTemplateSB();
1279:                } catch (ContextError ce) {
1280:                    throw new ProviderContextException(
1281:                            "PSProviderContext.getTemplate(): ", ce);
1282:                }
1283:            }
1284:
1285:            public StringBuffer getTemplate(String name, String file,
1286:                    Hashtable table) throws ProviderContextException {
1287:                try {
1288:                    return getDesktopContext().getTemplate(name,
1289:                            getProviderName(name), file, table);
1290:                } catch (ContextError ce) {
1291:                    throw new ProviderContextException(
1292:                            "PSProviderContext.getTemplate(): ", ce);
1293:                }
1294:
1295:            }
1296:
1297:            public StringBuffer getTemplate(String desktopType, String locale,
1298:                    String name, String clientPath, String file,
1299:                    Hashtable table, String baseDir)
1300:                    throws ProviderContextException {
1301:
1302:                try {
1303:                    return getDesktopContext().getTemplate(desktopType, locale,
1304:                            name, getProviderName(name), clientPath, file,
1305:                            table, baseDir);
1306:                } catch (ContextError ce) {
1307:                    throw new ProviderContextException(
1308:                            "PSProviderContext.getTemplate(): ", ce);
1309:                }
1310:            }
1311:
1312:            public File getTemplatePath(String name, String file)
1313:                    throws ProviderContextException {
1314:                return getDesktopContext().getTemplatePath(name,
1315:                        getProviderName(name), file);
1316:            }
1317:
1318:            public File getTemplatePath(String desktopType, String locale,
1319:                    String name, String clientPath, String file, String baseDir)
1320:                    throws ProviderContextException {
1321:                return getDesktopContext().getTemplatePath(desktopType, locale,
1322:                        name, getProviderName(name), clientPath, file, baseDir);
1323:            }
1324:
1325:            public File getTemplateMostSpecificPath(String name, String file)
1326:                    throws ProviderContextException {
1327:                return getDesktopContext().getTemplateMostSpecificPath(name,
1328:                        getProviderName(name), file);
1329:            }
1330:
1331:            public File getTemplateMostSpecificPath(String desktopType,
1332:                    String locale, String name, String clientPath, String file,
1333:                    String baseDir) throws ProviderContextException {
1334:                return getDesktopContext().getTemplateMostSpecificPath(
1335:                        desktopType, locale, name, getProviderName(name),
1336:                        clientPath, file, baseDir);
1337:            }
1338:
1339:            //
1340:            // config
1341:            //
1342:            public String getStaticContentPath() {
1343:                return getDesktopContext().getStaticContentPath();
1344:            }
1345:
1346:            public ServletContext getServletContext() {
1347:                return servletContext;
1348:            }
1349:
1350:            public ServletConfig getServletConfig() {
1351:                return servletConfig;
1352:            }
1353:
1354:            public void userLogout(UserEvent ue) {
1355:                String uid = ue.getUserID();
1356:                synchronized (propertiesContexts) {
1357:                    propertiesContexts.remove(uid);
1358:                }
1359:                //debugError("PSProviderContext.userLogout(): removed properties context for uid=" + uid + ", propertiesContexts=" + propertiesContexts);
1360:                //debugError("PSProviderContext.userLogout(): propertiesContexts size=" + propertiesContexts.size());
1361:            }
1362:
1363:            public String getConfigProperty(String key) {
1364:                return getDesktopContext().getConfigProperty(key);
1365:            }
1366:
1367:            public String getParentContainerName(String channel) {
1368:                String parent = ParentContainerThreadLocalizer.get();
1369:                return parent;
1370:            }
1371:
1372:            public Set getRoles() {
1373:                return getDesktopContext().getRoles();
1374:            }
1375:
1376:            public String getTopChannelName(HttpServletRequest req) {
1377:                return getDesktopContext().getTopChannelName(req);
1378:            }
1379:
1380:            public String encodeURLParameter(String key) {
1381:                String enc = null;
1382:                if (key != null && key.length() != 0) {
1383:                    try {
1384:                        enc = IURLEncoder.encode(I18n.encodeCharset(key,
1385:                                getCharset()));
1386:                    } catch (Exception e) {
1387:                        debugLogger.log(Level.INFO, "PSDT_CSPDC0024", e);
1388:                        enc = "";
1389:                    }
1390:                }
1391:                return enc;
1392:            }
1393:
1394:            public String decodeURLParameter(String key) {
1395:                return key;
1396:            }
1397:
1398:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.