Wednesday Jul 31, 2013

Deployment Profiles explained

A Deployment Profile is a data structure in JDeveloper that describes how to put together the contents of a Project or Application for publishing to a remote target. The target can be the file system, an Application Server, a Mobile device, etc. anything that JDeveloper can interface with.

The most common type of Deployment Profile is a JAR Profile, which lets you simply zip up all the contents of the project into a .jar file. A JAR Profile consists of one or more FileGroups, similar to Ant filesets, but at a higher level of abstraction. A FileGroup has Contributors, that act as the source of files, and filter patterns that select from them. Finally it has a target location within the jar where the selected files should end up.

For example, a "Project Source" contributor would provide all source files, a pattern of "Include **" would select all the files and a target of "src" would put all the source files under the "/src/" directory within the .jar archive.

Similarly, a "Project Output" contributor would get all the compiled .class files. Arbitrary directories can also be added as contributors, but this is usually not a good idea, its better to express the dependency to that directory in some other form and have one of the standard or pre-defined contributors bring it in.

So far we've been referring to a specific type of FileGroup called a Packaging file group. Another useful FileGroup which can be included in a JAR Profile is the Library file group. This file group gathers all the Libraries of a project and adds each one as a contributor source. Based on the definition of the library, it also makes some choices as to which ones to omit. For example, libraries that are not marked 'Deployed by Default' are not added. Users have the option to override the default. Just like the Packagingfile group, the Libraryfile group also lets you select the actual files from the library using patterns, by default all files from a certain library are added (in JDeveloper each Library can have several jar files).

All these actions can be done via UI, or using the API. A default "JAR Profile" is an instance of the ArchiveProfile class. A ProfileFactory is provided as a facade to create any type of profile.

import oracle.ide.Context;
import oracle.jdeveloper.deploy.ProfileFactory;
import oracle.jdeveloper.deploy.jar.ArchiveProfile;


ProfileFactory factory = ProfileFactory.getInstance();

// Create a context for the profile.
// Here we have a pre-existing project.
Context context = new Context( project );

// Create a JAR profile with a single packaging file group and a single
// library file group
MyProfile p = factory.create( "name1", ArchiveProfile.class, context);

Next we'll see how to deploy this profile to disk.

Thursday Feb 21, 2013

Deploying applications from JDeveloper

Oracle JDeveloper offers a one-stop deployment feature that lets you package your Application or Projects in various kinds of modules and deploy locally or to a remote server.


The deployment in JDeveloper is geared towards a development experience and not intended to be used to directly deploy to a production environment, although it is possible to do so. In this blog I will attempt to describe various aspects of the deployment feature and offer insights into how it can be customized to suit various requirements. Customization may be done via the UI by simply setting various options or may be involved through programmatic manipulations done by JDeveloper extensions.


About

Tips and Techniques on extending JDeveloper

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today