C H A P T E R  1

Image

Introduction to Plug-Ins

Plug-ins allow third-party developers to add additional functionality to software applications and frameworks. Plug-ins exist for many different types of applications, such Mozilla Firefox (Add-ons and Extensions), Microsoft Word (Add-Ins), and development frameworks such as Salesforce.com.

As Oracle Application Express (APEX) has been growing, so have the requests from the APEX community for specific features. To the best of their ability, the team from Oracle that develops APEX has modified the product to meet these demands; however, it's not fair to assume that they can add in every request that they receive. For this reason, the plug-ins framework was created. Starting in APEX 4.0, the APEX framework was extended to allow all developers to create their own plug ins to add additional functionality in a supported and declarative way. APEX plug ins can be shared within organizations and with the entire APEX community.

About This Book

This book provides step-by-step instructions on how to build plug-ins, along with detailed explanations about all the available options for plug-ins. It also contains some useful tools, techniques, and best practices to help ensure successful plug-in development and implementation. This book is targeted toward intermediate to advanced-level APEX developers.

It is assumed that you know the fundamentals of APEX and have developed some applications with it. If you are new to APEX, you're encouraged to read a beginners book and then use this one to further enhance your APEX development skill set. A recommended book for new developers is Beginning Oracle Application Express 4, which is also published by Apress.

Besides basic knowledge about APEX, this book assumes you are comfortable with the languages and frameworks listed here. If you need to brush up on some of the web-based technologies, www.w3schools.com has some excellent free tutorials to help you learn.

  • PL/SQL
  • JavaScript (JS)
  • jQuery
  • CSS
  • HTML

Image Note This book contains examples on how to build all the different types of plug-ins. All the plug-ins that are highlighted in this book are open source plug-ins that can be easily integrated into commercial applications without concern about licensing.

Plug-Ins and Their Advantages

Plug-ins allow APEX developers to create their own supported and declarative objects in APEX. When developed correctly, plug-ins behave exactly like native APEX objects and are seamless for both developers and users alike.

There are several types of plug-ins that can currently be developed. Some of them focus on the user interface (UI), and some are for process only. Page process plug-ins can go either way, because you can use them during rendering to manipulate what the user sees, and during page processing to perform back-end work. Most often, process plug-ins are used for back-end processing.

Following are the plug-in types available:

  • UI / Front-end related
    • Dynamic action
    • Item
    • Region
  • Process / Back-end related
    • Authorization *
    • Authentication *
    • Process

Image Note Plug-ins tagged with a “*” are new to 4.1. Since they are extremely new to APEX (at the time of writing), they will not be covered in this book.

As APEX evolved, developers started to create their own frameworks to integrate new and advanced features in APEX. These custom frameworks made it difficult to manage and maintain applications. Plug-ins resolve the need for custom frameworks as they provide a declarative way to develop custom objects within APEX.

Besides removing the need for customized frameworks, plug-ins allow developers to easily share plug-ins within an organization and the community. Previously, when developers integrated a new feature in APEX, they would share it via a blog post. Other developers would need to copy and then modify the code to merge it into their application. If third-party files, such as JavaScript or CSS files, were required, you would need to integrate them into your application somehow. All these moving parts made it complex to share ideas and code. Plug-ins encapsulate all that complexity and remove the dependencies, since they bundle all the required objects into a single item, which can be easily shared.

Getting Started

WAIT! You are probably eager to start learning to develop your first plug-in, but don't skip over this section. The rest of the book assumes that you have all the necessary tools in place to successfully and efficiently develop plug-ins. This section will cover all the tools you'll need throughout this book.

Oracle Database

Before using APEX, you'll need to have an Oracle database to develop on. All the examples in this book were built on an Oracle 11gR2 instance. Some of the code may not be compatible with previous versions of Oracle but can be easily modified to work with older versions.

There are several options to choose from depending on your current situation. If you have access to a development instance of Oracle 11gR2, then you can skip this subsection. If not, there are several easy options for you:

apex.oracle.com: Oracle provides a free online instance of APEX for development purposes. The SQL Workshop will allow you to create and modify PL/SQL code. This is the easiest solution to setup; however, it will be cumbersome to develop and debug PL/SQL code via a web interface. You may encounter some restrictions connecting to external resources (such as web services) using apex.oracle.com for the examples in this book.

Oracle XE: Oracle provides a free (both for commercial and personal use) database called Oracle XE. It is an ideal option for installing a personal instance of Oracle. Oracle XE does have some size and functional limitations, but they should not hinder your ability to build plug-ins or follow the examples in this book. For more information about how to download and install Oracle XE, go to the following OTN page: www.oracle.com/technetwork/database/expressedition/overview/index.html.

Virtual machine: Oracle provides a virtual machine image that is a full version of 11gR2. You'll first need to install Oracle Virtual Box: www.oracle.com/technetwork/server-storage/virtualbox/index.html. The developer virtual machine image can be downloaded from the OTN Developer Days page: www.oracle.com/technetwork/database/enterprise edition/databaseappdev-vm-161299.html.

Install Oracle: If you want a full version of Oracle directly, you can obtain a developer's license and download a copy from OTN: www.oracle.com/technetwork/database/enterprise edition/overview/index.html. This is not a recommended approach for non-DBAs as it can take a while to properly configure Oracle from scratch. Of the four options just listed, Oracle XE may be the best option to implement on a personal or work PC. Each of the links provides installation instructions where applicable. Before installing or using any of the foregoing options, please read the licensing agreements.

APEX Instance

If you're using a corporate database or a personal instance, you'll need to ensure that a recent version of APEX is installed. To follow along with the examples in this book, you will need APEX 4.1 or above. The following query identifies the current version of APEX installed on your database:

SELECT *
FROM apex_release

If you don't have APEX installed or need to upgrade it, you can download it from OTN: www.oracle.com/technetwork/developer-tools/apex/downloads/index.html. The download page has links to detailed instructions on how to install or upgrade APEX. If you are using apex.oracle.com, you do not need to install or upgrade APEX.

Development IDE

When developing plug-ins, it's highly recommended that you use a good PL/SQL and SQL IDE. SQL Developer is a free, Java-based, PL/SQL, and SQL IDE developed by Oracle. You can download SQL Developer from OTN: www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html. SQL Developer provides syntax highlighting, allows you to quickly browse all the database objects, implement unit tests, and debug code. There are other third-party tools, such as Toad from Quest software.

A good text editor will help when creating and modifying web files such as CSS, JS, and HTML. There are many free text editors available such as Notepad++ (http://notepad-plus-plus.org).

Web Browser

APEX officially supports the following major browsers: IE 7+, Firefox 3.5+, Google Chrome 4.0+, and Safari 4.0+. You can use any of these browsers to develop plug-ins, but some may be easier than others.

This book assumes that you will be developing plug-ins with either Firefox 4.0+ or Google Chrome 11.0+. When using Firefox, Firebug (http://getfirebug.com) should be installed. Chapter 8 describes how to install and configure Firebug for Firefox.

Web Server

A web server is the gateway that allows your browser to communicate to the database and serve files to the client's browser. As part of the APEX installation process, you will have had to setup a web server.

One of the key components to developing certain types of plug-ins in APEX is the use of external files, such as JavaScript and CSS files. When working with external files, it is easiest if you can store them on an accessible web server and modify them directly.

Depending on your personal or organization's setup, you may not have access to a web server. Installing a local web server is not required for this book but is highly recommended if you don't have quick and easy access to one. Chapter 8 contains step-by-step instructions on how to install and configure a free local web server.

Summary

This chapter gives a high-level overview of what is and isn't covered in this book. Although not all types of APEX plug-ins will be covered, you will get a solid understanding of how they work. Once you've read through this book, you should be able to use what you've learned to create your own plug-ins, which you can share within your organization or with the APEX community.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106