O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

OpenCms 7 Development

Book Description

Extending and customizing OpenCms through its Java API

  • Targets version 7 of OpenCms

  • Create new modules to extend OpenCms functionality

  • Learn to use the OpenCms templating system

  • In Detail

    OpenCms is a professional-level open-source Website Content Management System, based on Java and XML. Many companies or organizations have requirements that go beyond what is available in the standard OpenCms application. Thankfully, OpenCms can be used by Java developers to create sophisticated add-ons and customizations that extend the power of OpenCms in virtually unlimited directions.

    Targeting version 7 of OpenCms, this book is for Java developers interested in extending and further customizing OpenCms through its Java API.

    Starting by showing how to set up a development environment for OpenCms work, the book moves you through various tasks of increasing complexity. Some of the common tasks covered are building OpenCms, XML asset type development, templating, module development, user and role setup, and search integration. In addition to these common tasks some more advanced topics are covered such as self-registering users, RSS support, developing custom widgets and extending the administrative interface. All the topics include examples and are presented while building a sample blog site.

    The skills you develop will make you an OpenCms developer to be reckoned with!

    Table of Contents

    1. OpenCms 7 Development
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. Preface
      1. What This Book Covers
      2. What You Need for This Book
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Downloading the Example Code for the Book
        2. Errata
        3. Questions
    6. 1. Overview
      1. The Site Design
      2. Required Developer Skills
          1. Basic Site Development
          2. Sites Requiring Custom Content Types
          3. Sites Requiring Custom Features
          4. Bespoke Site Development
      3. OpenCms Application Overview
        1. The OpenCms Directory Structure
          1. The Real File System Layout
          2. The Virtual File System Layout
        2. OpenCms Architecture
        3. Extensibility through Modules
        4. The OpenCms Web Request Process
        5. OpenCms Web Application Packaging
        6. Building a Complete Site with OpenCms
      4. Summary
    7. 2. Developing in OpenCms
      1. Developing Basic Site Content
      2. Setting Up an Environment for Creating JSP Code
          1. Editing Files Using File Synchronization
          2. Using WebDAV for Editing
          3. Debugging JSP Code in OpenCms
      3. Setting Up an Eclipse Environment to Build OpenCms
          1. Tools Needed to Build OpenCms in Eclipse
          2. Step 1: Checkout the Project Source from CVS
          3. Step 2: Setting the Classpath for Compilation
          4. Step 3: Using Ant to Build a Distribution Package
          5. Building OpenCms outside of Eclipse Using Ant
          6. Debugging OpenCms in Eclipse
      4. Setting Up an Eclipse Environment without Building OpenCms
      5. Summary
    8. 3. Our First Module
        1. Understanding OpenCms Modules
        2. Common Module Types
        3. Module Events
        4. Exporting and Importing Modules
      1. Creating a Module
      2. Structured Content Types
        1. Creating a BlogEntry Content Type
        2. Required Code for Creating XSD Schema Files
        3. Registering the Content Type
          1. Additional Schema Features
          2. Field Mappings
          3. Field Validations
          4. Default Field Values
          5. Localization
          6. Content Relationships
          7. Content Previewing
          8. Creating Content Using a Model
          9. User Interface Widgets
            1. DateTimeWidget
            2. BooleanWidget
            3. ColorPickerWidget
            4. DownloadGalleryWidget
            5. HtmlGalleryWidget
            6. ImageGalleryWidget
            7. LinkGalleryWidget
            8. TableGalleryWidget
            9. VfsFileWidget
            10. HtmlWidget
            11. ComboWidget
            12. SelectorWidget
            13. MultiSelectWidget
            14. StringWidget
            15. StringWidgetPlaintext
            16. TextareaWidget
            17. TextareaWidgetPlaintext
            18. DisplayWidget
            19. GroupWidget
            20. UserWidget
            21. Additional Widgets
            22. RadioSelectWidget
            23. PasswordWidget
            24. PrincipalWidget
            25. OrgUnitWidget
          10. Nested Content Definitions
        4. Editing Configuration Files with Validating Editors
        5. Organizing the Content
      3. Summary
    9. 4. Developing Templates
      1. Review of the Page Layout
      2. Templates in OpenCms
        1. Creating the Templates
        2. The Homepage Template
        3. The Blog Content Loop
        4. The Sidebar and Footer
        5. Common Code Elements
          1. Header Code
          2. Search Form
          3. Advertisements
          4. Blog Archives
          5. RSS Client and RSS Feeds
          6. Footer Section
        6. The Supporting Java Bean Class
        7. The Blog Template
      3. The Content and Template Loading Process
      4. Expressions in JSP Templates
        1. Using the Tag Library from JSP
        2. Combining Expressions with JSTL
      5. Accelerating Template Development Using WebDAV
        1. Install the Eclipse WebDAV Plug-in
        2. Create a Site Within Eclipse for the Server
        3. Import Content into the Project
      6. Summary
    10. 5. Adding Site Search
      1. A Quick Overview of Lucene
        1. Search Indexes
        2. Search Queries
      2. Configuring OpenCms Search
        1. Field Configurations
        2. Creating a Field Configuration
        3. Creating an Index Source
        4. Additional Search Settings
        5. Introducing Luke—a Visual Index Tool
      3. Writing the Search Code
        1. A Simple Search Example
        2. Subclassing the CmsSearch Bean
        3. The Search.jsp Template
      4. Summary
    11. 6. Adding User Registration and Comment Support
      1. Understanding OpenCms Security
        1. User, Groups, Roles, and Permissions
        2. Organizational Units
      2. Setting up Security for Our Site
        1. Organization Unit and Group Setup
        2. Adding the Users
        3. Resource Permissions
      3. User Login and Registration Code
      4. Adding Comment Support
        1. Adding the Comments to the XML Content
        2. Publishing the Comments
      5. Summary
    12. 7. Providing Site Customization Features
        1. What is RSS?
        2. Creating the Module
        3. The RSS Client Code
        4. Displaying the RSS Feed in the Template
        5. Adding User Preferences to Accounts
        6. Updating the Java Code
        7. Updating the JSP Templates
        8. Hooking up the Account Management Page
      1. Summary
    13. 8. Extending OpenCms: Developing a Custom Widget
        1. Designing a Custom Widget
        2. Designing the Widget
        3. The Widget Code
          1. Custom Source Interface and Implementations
          2. Using OpenCms Message Strings for Localization
        4. Registering the Widget with OpenCms
      1. Summary
    14. 9. Extending OpenCms: Adding RSS Feed Support
        1. RSS Feed Design
        2. The RSS Feed Content Type
        3. Creating a Supporting Widget
        4. The RSS Feed Template and Java Classes
        5. Content Wrapper Java Classes
        6. Wrapping It Up
      1. Summary
    15. 10. Extending OpenCms: Adding an Administration Point
        1. Administrative Points
        2. The Administration View
        3. Hooking the Administration Point Up to the Module
        4. The RSS Administration Module
          1. Leveraging the OpenCms Dialog Classes
            1. Declaring the Dialog
            2. Defining Dialog Columns
            3. Returning the Column Data
            4. Adding Column Actions
            5. Custom Rendering
          2. The Feed Manager Class
            1. Supporting the Feed Operations
          3. The New Channel Action
            1. Declaring the Dialog
            2. Declaring the Widgets
            3. Persisting Data Across Pages
            4. Handling the Dialog Actions
      1. Summary