Java Doc for Download.java in  » J2EE » Expresso » com » jcorporate » expresso » ext » controller » 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 » J2EE » Expresso » com.jcorporate.expresso.ext.controller 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.jcorporate.expresso.core.controller.DBController
   com.jcorporate.expresso.ext.controller.Download

Download
public class Download extends DBController (Code)
The download controller provides a ready-to-use component for people to download files through. See DBObject for the data definition objects that support this controller

Features supported include:

  • Filter by a workspace view with the "project" parameters
  • Automatic Permission settings for which groups can download which files
  • new Automatic download restrictions for cryptographic exports
  • Automatic Redirection to other higher-speed servers such as an http or ftp server for freely available downloads

author:
   Michael Rimov
See Also:   com.jcorporate.expresso.ext.dbobj.DownloadFiles
See Also:   com.jcorporate.expresso.services.dbobj.MimeTypes
See Also:   com.jcorporate.expresso.ext.dbobj.DownloadLog



Constructor Summary
public  Download()
    

Method Summary
protected  voidcheckIsAllowed(ControllerRequest request, User u, DownloadFiles file)
     Checks file permissions and throws an Exception, and logs an event if the user does not have permission to run.
protected  StringgetDownloadTime(ControllerResponse response, long fileLength)
     Returns a string estimating download time at 28.8k This function assumes a download rate of 5 Mb / minute
Parameters:
  response - The controller response object to get the requestinguser's Locale.
Parameters:
  fileLength - The length of the file to calculate.
protected  StringgetFriendlyName(DownloadFiles oneDownloadFile)
    
protected  DownloadFilesgetThisDownloadFile(ControllerRequest request, User u)
    
public  StringgetTitle()
    
protected  booleanisAllowed(ControllerRequest request, DownloadFiles oneFile, User myUser)
     Is it allowed for this user to download this particular file?
Parameters:
  request - The Controller Request object passed to the controller state handler
Parameters:
  oneFile - The download file definition
Parameters:
  myUser - The user making the controller request.
protected  voidlogInvalidFileRequest(ControllerRequest request, User myUser)
     Sets off the system event for an invalid file number requested.
protected  voidreturnFile(String filename, OutputStream out)
    
protected  ControllerResponserunBeginState(ControllerRequest request, ControllerResponse response)
     Starts a download for a file.
protected  ControllerResponserunDownloadState(ControllerRequest controllerRequest, ControllerResponse controllerResponse)
     Returns the file actually requested by the user.
protected  ControllerResponserunListState(ControllerRequest request, ControllerResponse response)
     Lists the files available for download.
protected  voidrunViewNotesState(ControllerRequest request, ControllerResponse response)
     View the notes associated with the download.


Constructor Detail
Download
public Download()(Code)




Method Detail
checkIsAllowed
protected void checkIsAllowed(ControllerRequest request, User u, DownloadFiles file) throws ControllerException(Code)
Checks file permissions and throws an Exception, and logs an event if the user does not have permission to run.
Parameters:
  request - the ControllerRequest object
Parameters:
  u - the user requesting the file
Parameters:
  file - the file to download
throws:
  ControllerException - if the file is not allowed for the givenuser.



getDownloadTime
protected String getDownloadTime(ControllerResponse response, long fileLength) throws ControllerException(Code)
Returns a string estimating download time at 28.8k This function assumes a download rate of 5 Mb / minute
Parameters:
  response - The controller response object to get the requestinguser's Locale.
Parameters:
  fileLength - The length of the file to calculate. java.lang.String estimating the download time at 28.8k
throws:
  ControllerException - if the download time is unable to get theinternationalized strings for Minutes and Seconds.



getFriendlyName
protected String getFriendlyName(DownloadFiles oneDownloadFile) throws ControllerException, DBException(Code)
Returns the friendly download name
Parameters:
  oneDownloadFile - The download file definition object java.lang.String A friendly name for display on the Download listingpage.
throws:
  ControllerException - if the record is mal-formed
throws:
  DBException - if there's an error accessing the database.
See Also:   com.jcorporate.expresso.ext.dbobj.DownloadFiles



getThisDownloadFile
protected DownloadFiles getThisDownloadFile(ControllerRequest request, User u) throws ControllerException(Code)
Convenience method to retrieve the download file based upon the file parameter
Parameters:
  request - The ControllerRequest object
Parameters:
  u - the User requesting the DownloadFile DataObject representing the file parameterrequested.
throws:
  ControllerException - upon illegal inputs



getTitle
public String getTitle()(Code)
Returns title of this controller java.lang.String The Title of the controller



isAllowed
protected boolean isAllowed(ControllerRequest request, DownloadFiles oneFile, User myUser) throws DBException(Code)
Is it allowed for this user to download this particular file?
Parameters:
  request - The Controller Request object passed to the controller state handler
Parameters:
  oneFile - The download file definition
Parameters:
  myUser - The user making the controller request. true if the file is allowed
throws:
  DBException - upon database access error



logInvalidFileRequest
protected void logInvalidFileRequest(ControllerRequest request, User myUser) throws ControllerException(Code)
Sets off the system event for an invalid file number requested.
Parameters:
  request - The Controller Request object sent to this controller forthe state handler.
Parameters:
  myUser - The logged-in definition of the user currently logged in.
throws:
  ControllerException - if the download file number was invalid.



returnFile
protected void returnFile(String filename, OutputStream out) throws FileNotFoundException, IOException(Code)
Sends the contents of the specified file to the output stream
Parameters:
  filename - the file to send
Parameters:
  out - the output stream to write the file
throws:
  FileNotFoundException - if the file does not exist
throws:
  IOException - if an I/O error occurs



runBeginState
protected ControllerResponse runBeginState(ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
Starts a download for a file. Will provide the capability for client side redirects to download the file from a public server
Parameters:
  request - The controller request object handed to us bythe framework
Parameters:
  response - The controller Response that this class fills out. The generated ControllerResponse.
throws:
  ControllerException - if there's an error with the processing of therequest.



runDownloadState
protected ControllerResponse runDownloadState(ControllerRequest controllerRequest, ControllerResponse controllerResponse) throws ControllerException(Code)
Returns the file actually requested by the user. Records the download as well
Parameters:
  controllerRequest - The controller request object handed to us bythe framework
Parameters:
  controllerResponse - The controller Response that this class fills out. The generated ControllerResponse.
throws:
  ControllerException - if there's an error with the processing of therequest.



runListState
protected ControllerResponse runListState(ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
Lists the files available for download. Source code originally grabbed from the DownloadServlet and converted for controller use. Also
Parameters:
  request - The controller request object handed to us bythe framework
Parameters:
  response - The controller Response that this class fills out. The generated ControllerResponse.
throws:
  ControllerException - if there's an error with the processing of therequest.
See Also:   com.jcorporate.expresso.ext.dbobj.DownloadFiles
See Also:   for more information



runViewNotesState
protected void runViewNotesState(ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
View the notes associated with the download.
Parameters:
  request - The controller request object handed to us bythe framework
Parameters:
  response - The controller Response that this class fills out.
throws:
  ControllerException - upon error [data access or otherwise]



Methods inherited from com.jcorporate.expresso.core.controller.DBController
protected String getString(String stringCode, Object[] args, ControllerRequest myRequest)(Code)(Java Doc)
public static boolean isAllowed(ControllerRequest request, DBController controller, String newState) throws DBException, CacheException(Code)(Java Doc)
public boolean stateAllowed(String newState, ControllerRequest myRequest) throws ControllerException(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.