Java Doc for CachingSource.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » source » impl » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.components.source.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.cocoon.components.source.impl.CachingSource

All known Subclasses:   org.apache.cocoon.components.source.impl.TraversableCachingSource,
CachingSource
public class CachingSource extends AbstractLogEnabled implements Serviceable,Initializable,XMLizable,Source(Code)
This class implements a proxy like source that uses another source to get the content. This implementation can cache the content for a given period of time.

Syntax for Protocol

 cached:http://www.apache.org/[?cocoon:cache-expires=60&cocoon:cache-name=main]
 

The above examples show how the real source http://www.apache.org is wrapped and the cached contents is used for 60 seconds. The second querystring parameter instructs that the cache key be extended with the string main. This allows the use of multiple cache entries for the same source.

The value of the expires parameter holds some additional semantics. Specifying -1 will yield the cached response to be considered valid always. Value 0 can be used to achieve the exact opposite. That is to say, the cached contents will be thrown out and updated immediately and unconditionally.


version:
   $Id: CachingSource.java 485495 2006-12-11 04:44:23Z crossley $


Inner Class :protected static class SourceMeta implements Serializable

Field Summary
final public static  StringCACHE_EXPIRES_PARAM
    
final public static  StringCACHE_NAME_PARAM
    
final protected  booleanasync
    
protected  Cachecache
    
final protected  IdentifierCacheKeycacheKey
    
final protected  StringcacheName
    
final protected  booleaneventAware
    
final protected  intexpires
    
protected  ServiceManagermanager
    
final protected  Stringprotocol
    
protected  Sourcesource
    
final protected  StringsourceUri
    
final protected  Stringuri
    

Constructor Summary
public  CachingSource(String protocol, String uri, String sourceUri, Source source, int expires, String cacheName, boolean async, boolean eventAware)
     Construct a new object.

Method Summary
public  voiddispose()
     Cleanup.
public  booleanexists()
    
protected  byte[]getBinaryResponse()
     Initialize the cached response with meta and binary contents.
protected  StringgetCacheKey()
     Return the used key.
protected  SourceValidity[]getCacheValidities()
    
public  longgetContentLength()
     Get the content length of the source or -1 if it is not possible to determine the length.
protected  longgetExpiration()
    
public  InputStreamgetInputStream()
     Return an InputStream object to read from the source.
public  longgetLastModified()
     Get the last modification date.
public  StringgetMimeType()
     The mime-type of the content described by this object.
protected  SourceMetagetResponseMeta()
     Initialize the cached response with meta info.
public  StringgetScheme()
     Return the protocol identifier.
protected  StringgetSourceURI()
     Return the uri of the cached source.
public  StringgetURI()
    
public  SourceValiditygetValidity()
     Get the Validity object.
protected  byte[]getXMLResponse()
     Initialize the cached response with meta, binary, and XML contents.
public  voidinitialize()
     Initialize the Source.
protected  byte[]readBinaryResponse(Source source)
     Read binary content from source.
protected  SourceMetareadMeta(Source source)
     Read meta data from source.
protected  byte[]readXMLResponse(Source source, byte[] binary, ServiceManager manager)
     Read XML content from source.
public  voidrefresh()
     Refresh this object and update the last modified date and content length.
public  voidservice(ServiceManager manager)
     Set the ServiceManager.
public  voidtoSAX(ContentHandler contentHandler)
     Generates SAX events representing the object's state.

Field Detail
CACHE_EXPIRES_PARAM
final public static String CACHE_EXPIRES_PARAM(Code)



CACHE_NAME_PARAM
final public static String CACHE_NAME_PARAM(Code)



async
final protected boolean async(Code)
asynchronic refresh strategy ?



cache
protected Cache cache(Code)
The current cache



cacheKey
final protected IdentifierCacheKey cacheKey(Code)
The key used in the store



cacheName
final protected String cacheName(Code)
cache key extension



eventAware
final protected boolean eventAware(Code)



expires
final protected int expires(Code)
number of seconds before cached object becomes invalid



manager
protected ServiceManager manager(Code)
The ServiceManager



protocol
final protected String protocol(Code)
The used protocol



source
protected Source source(Code)
The source object for the real content



sourceUri
final protected String sourceUri(Code)
The full URI string of the underlying source



uri
final protected String uri(Code)
The full URI string




Constructor Detail
CachingSource
public CachingSource(String protocol, String uri, String sourceUri, Source source, int expires, String cacheName, boolean async, boolean eventAware)(Code)
Construct a new object.




Method Detail
dispose
public void dispose()(Code)
Cleanup.



exists
public boolean exists()(Code)

See Also:   org.apache.excalibur.source.Source.exists



getBinaryResponse
protected byte[] getBinaryResponse() throws IOException(Code)
Initialize the cached response with meta and binary contents.
throws:
  IOException - if an the binary response could not be initialized



getCacheKey
protected String getCacheKey()(Code)
Return the used key.



getCacheValidities
protected SourceValidity[] getCacheValidities()(Code)



getContentLength
public long getContentLength()(Code)
Get the content length of the source or -1 if it is not possible to determine the length.



getExpiration
protected long getExpiration()(Code)
Expires (in milli-seconds)



getInputStream
public InputStream getInputStream() throws IOException, SourceException(Code)
Return an InputStream object to read from the source.



getLastModified
public long getLastModified()(Code)
Get the last modification date. The last modification in milliseconds since January 1, 1970 GMTor 0 if it is unknown



getMimeType
public String getMimeType()(Code)
The mime-type of the content described by this object. If the source is not able to determine the mime-type by itself this can be null.



getResponseMeta
protected SourceMeta getResponseMeta() throws IOException(Code)
Initialize the cached response with meta info.
throws:
  IOException - if an the binary response could not be initialized



getScheme
public String getScheme()(Code)
Return the protocol identifier.



getSourceURI
protected String getSourceURI()(Code)
Return the uri of the cached source.



getURI
public String getURI()(Code)
Return the unique identifer for this source



getValidity
public SourceValidity getValidity()(Code)
Get the Validity object. This can either wrap the last modification date or the expires information or... If it is currently not possible to calculate such an information null is returned.



getXMLResponse
protected byte[] getXMLResponse() throws SAXException, IOException, CascadingIOException(Code)
Initialize the cached response with meta, binary, and XML contents.
throws:
  SAXException - if something happened during xml processing
throws:
  IOException - if an IO level error occured
throws:
  CascadingIOException - wraps all other exception types



initialize
public void initialize() throws Exception(Code)
Initialize the Source.



readBinaryResponse
protected byte[] readBinaryResponse(Source source) throws IOException, SourceNotFoundException(Code)
Read binary content from source. content from source
throws:
  IOException -
throws:
  SourceNotFoundException -



readMeta
protected SourceMeta readMeta(Source source) throws SourceException(Code)
Read meta data from source.



readXMLResponse
protected byte[] readXMLResponse(Source source, byte[] binary, ServiceManager manager) throws SAXException, IOException, CascadingIOException(Code)
Read XML content from source. content from source
throws:
  SAXException -
throws:
  IOException -
throws:
  CascadingIOException -



refresh
public void refresh()(Code)
Refresh this object and update the last modified date and content length. This method will try to refresh the cached meta data and content only if cached content is expired.



service
public void service(ServiceManager manager) throws ServiceException(Code)
Set the ServiceManager.



toSAX
public void toSAX(ContentHandler contentHandler) throws SAXException(Code)
Generates SAX events representing the object's state.



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