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


java.lang.Object
   com.sun.portal.providers.context.PropertiesFilter

All known Subclasses:   com.sun.portal.providers.pctest.DateLaterThanPropertiesFilter,  com.sun.portal.providers.context.ClientPropertiesFilter,  com.sun.portal.providers.context.LocalePropertiesFilter,
PropertiesFilter
abstract public class PropertiesFilter (Code)
This class is an abstract PropertiesFilter class. Every PropertiesFilter implementation must extend this class.

A PropertiesFilter is used to describe an arbitrary filter which is used to selectively look up properties with certain criteria as well as when storing properties that are specific to certain setting. The PropertiesFilter itself does not compare any actual property values. Rather, it determines if the qualifiers ('condition' and 'value') associated with the property match the filter criteria supplied in the PropertiesFilter.

PropertiesFilters are instantiated using methods provided in PropertiesFilterFactory and are not to be constructed directly. In addition, PropertiesFilter objects are meant to be immutable and stateless. Once a PropertiesFilter is initialized, the value cannot be modified.

Nevertheless, in some cases, having an access to stateful objects such as ProviderContext within the PropertiesFilter, especially in the match() method may become necessary. This can be achieved by extending the PropertierFilter in such a way that the stateful object(s) can be passed in the constructor and stored as a member variable. Instantiating such a PropertiesFilter is done by directly constructing the PropertiesFilter, bypassing the PropertiesFilterFactory.
Here is an example:
public class LoggingPropertiesFilter extends PropertiesFilter {
private ProviderContext pc = null;
public LoggingPropertiesFilter(ProviderContext pc, String value, boolean required) {
super();
this.pc = pc;
try {
init(value, required);
} catch (PropertiesFilterException pfe) {
pc.debugError("LoggingPropertiesFilter(): Failed to init." , pfe);
}
}
public String getCondition() {
return "loggingEnabled";
}
public boolean match(String condition, String value) throws PropertiesFilterException {
if (!condition.equals("loggingEnabled")) {
return false;
}
if (getValue().equals(value)) {
pc.debugMessage("LoggingPropertiesFilter(): matched loggingEnabled property. value=" value);
}
return true;
}
}

List pflist = new ArrayList();
pflist.add(new LoggingPropertiesFilter(getProviderContext(), "foo", true);
Note that bypassing PropertiesFilterFactory may have a performance impact. Also, PropertiesContext has a life-span of one session and should not be s

Properties are looked up using different types of get/set*Property() methods which are available in ProviderContext.
See Also:   com.sun.portal.providers.context.ProviderContext
See Also:   com.sun.portal.providers.context.PropertiesFilterFactory



Constructor Summary
public  PropertiesFilter()
     Constructor.

Method Summary
abstract public  StringgetCondition()
     Get the condition of the filter, such as "locale" and "client". Filter condition is an unmodifiable constant value.
public  StringgetValue()
     Get the value of the filter that is associated with the condition of the filter.
protected  voidinit(String value, boolean required)
     Initialize PropertiesFilter with given values. PropertiesFilters are immutable.
public  booleanisRequired()
     Is filter required? A conditional property lookup involves one or more property filters. If a filter in the filter list is required, then it must match for the overall conditional lookup to succeed.
abstract public  booleanmatch(String condition, String value)
    
public  StringtoString()
     Return a string representation of the PropertiesFilter. Useful for debugging. a String representation of the PropertiesFilter.


Constructor Detail
PropertiesFilter
public PropertiesFilter()(Code)
Constructor. In most cases, PropertiesFilters should not be constructed directly. Instead, use PropertiesFilterFactory.get().
See Also:   PropertiesFilterFactory.get(StringStringboolean)




Method Detail
getCondition
abstract public String getCondition() throws PropertiesFilterException(Code)
Get the condition of the filter, such as "locale" and "client". Filter condition is an unmodifiable constant value. filter condition
exception:
  PropertiesFilterException - if there is an error in gettingthe condition of the filter.



getValue
public String getValue()(Code)
Get the value of the filter that is associated with the condition of the filter. filter value that was used to instantiate this PropertiesFilter.



init
protected void init(String value, boolean required) throws PropertiesFilterException(Code)
Initialize PropertiesFilter with given values. PropertiesFilters are immutable. You cannot re-initialize an already initialized PropertiesFilter with new values. Doing so will results in no-op.
Parameters:
  value - The value that gets associated with the filter.
Parameters:
  required - Flag indicating whether this filter criteriais required or optional.
exception:
  PropertiesFilterException - there was an error while initializing values



isRequired
public boolean isRequired()(Code)
Is filter required? A conditional property lookup involves one or more property filters. If a filter in the filter list is required, then it must match for the overall conditional lookup to succeed. If a filter is not required, then it can fail to match without causing the overall lookup to fail. A chain of non-required filters can be used to implement a progressively less-specific filter lookup, similar to the semantics of Java resource bundle lookup.

For instance, an optional filter would be useful in a case where a locale lookup is followed by a date lookup. Given the filter {locale=en, locale=US, date=03/03/2003}, you can get it to successfully match a property with the qualifier {locale=en; date=03/03/2003} even though it does not exactly match the filter specification. This done by setting the locale filter to be optional. boolean indicating whether this filter is required or optional.



match
abstract public boolean match(String condition, String value) throws PropertiesFilterException(Code)
Does the given condition and value match the filter?
Parameters:
  pc - ProviderContext object
Parameters:
  condition - the condition to be matched against the filter condition
Parameters:
  value - the value to be matched against the filter value
exception:
  PropertiesFilterException - if there is an error inprocessing properties to be matched.



toString
public String toString()(Code)
Return a string representation of the PropertiesFilter. Useful for debugging. a String representation of the PropertiesFilter.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.