Tuesday, March 2, 2010

Generate ant build file from project issue

Occured in JDeveloper Version: 10.1.3.4

Problem description

Trying to generate ant build file from project issues the following exception in Jdeveloper

image

java.lang.NullPointerException
    at oracle.ide.net.URLFactory.newURL(URLFactory.java:85)
    at oracle.ide.net.URLFactory.newUniqueURL(URLFactory.java:164)
    at oracle.jdeveloper.builder.SourceModel.generateDefaultFileName(SourceModel.java:135)
    at oracle.jdevimpl.ant.wizard.GenerateBuildfileModel.initializeFromContext(GenerateBuildfileModel.java:83)
    …

Reason

The appropriate project directory is not listed under the Project properties>Project content>Resources.

Solution

Just open the project properties and add the project folder under project content>Resources

image

After doing so the creation of the ant project build file works as expected!

Friday, February 12, 2010

FAQ: Why should I use Oracle ADF for application development?

Examining JDeveloper Version: 11.1.1.2.0

As the fusion developer guide states Oracle ADF is

"An end-to-end application framework that builds on Java Platform, Enterprise Edition standards and open-source technologies to simplify and accelerate implementing service-oriented applications."

So what does this mean and what are the benefits from my personal point of view? I will try to give an satisfactorily answer.

  1. At its core ADF couples loosly different technologies by its ADF binding layer and exposes business services uniformly through data controls for the frontend developer. The following business services in the backend and user interface frontends are supported:
    0000@1856_1856-412664ef08d2de3f
    From the architectural point of view further technologies can be integrated through custom data control implementations, e.g JSON Data Control, XML Data Control, etc.
  2. No matter which type of backend technology you want to use (POJO, EJB3/JPA, ADF BC (based on DB tables or service data objects), WebService, Placeholder) the declarative ui development through data controls abstracts from the underlying technical details.
  3. Write ONCE your business service and use it for API provisioning (Web service, REST) and UI (Web, Mobile, Desktop, Office)
  4. With ADF it is easy to expose your Software as a Service (SaaS). Whether as ADF Taskflow with tight integration capabilities in Oracle WebCenter or through JSF portlet bridge as standard based JSR 168 Portlets. In analogy to service registries I think there will be someday an easy to use Taskflow registry (better than resource catalog;-) from which you can compose your application -> Improved WebCenter.
  5. Abstract and easily "canonicalify" your data model through Service Data Objects (SDO). That way you can reuse business components across diffrent departments and abstract from the underlying persistence store.
  6. Integrate your application into a SOA by firing events from your business components, invoke BPEL processes or create Human Workflows
  7. Easily push data to the client by Oracles Active Data Service technology.
  8. Based on JSF standards as the front end developer you don't have to care about which specific rendering technologies to use. As an example take a look at DVT (visualization) components. The usage of the components remains always the same, but the output can be configured: PNG or Flash. Someday HTML5 or JavaFX or whatever might be rendered. As Application Developer you just will get those features by updating to a new ADF Version without the need to know how the underlying rendering technology works.
  9. Personalization: With ADF it is easy to let the application users customize the ui for their needs. Those runtime customizations are persisted across the session through Meta Data Services (MDS). Beyond this it is possible to create seeded customizations for different sites or industries.
  10. Declaratively bind security constraints to application roles. Depending on infrastructure just map the enterprise roles (users, groups) to the application roles. Furthermore: if deployment is planned on the Oracle WebLogic Server it is really easy to integrate with almost any authentication provider: OID, OpenLDAP, ActiveDirectory, etc....

As the name suggests ADF simply was invented for exactly what you want to do: application development;-)

If you do not have any of the above requirements and prefer coding instead of dragging and dropping then you are well of with a more lightweight framework. In the Java world take a look at

  1. Playframework
  2. Grails

Those frameworks are really cool and make a lot of fun to develop with - or should I say "to play with".

Of course there are some reasons for: "Why I should NOT use ADF for application development"

  1. JDevelopers performance and stability is really poor in comparison to every other well Java IDE.
  2. Integrated WebLogic server takes 3 minutes to startup. With every new release it seems that the startup time increases.

Further information

Monday, January 18, 2010

ADF 11g: Define default UI for MDS user customization

JDeveloper Version: 11.1.1.2.0

Introduction

In this post I want to show how you can enhance the built-in feature “user customization accross sessions using MDS”. If you just activate this feature an define the default UserCC-class to be used, you typically will face the problem that for the first time the end users access your web application they will see the UI, layout, etc. as designed by the developer. Very often default values will be used so at the end someone might end up with fine tuning advises  like “Please expand this column by 5px and put column x in front of the others….” and so on. And in the end you will still be not sure if your layout meet the exact idea of the manager.

What managers actually want is, to define e.g. the width of columns, etc on their own and let that setting be the default for all the other end users. With ADF11g that requirement can be achieved with only a few lines of code + configuration.

How to do

Create a custom Customization Class like the following

package de.team.faces.mds;

import javax.faces.context.FacesContext;

import oracle.adf.share.config.UserCC;

import oracle.mds.core.MetadataObject;
import oracle.mds.core.RestrictedSession;

public class DefaultUserCC extends UserCC {

  private static final String DEFAULT_CC_VALUE_USERNAME =
    "de.team.faces.mds.DEFAULT_CC_VALUE_USERNAME";

  public DefaultUserCC() {
    super();
  }

  /**
   * Overrides the UserCC
   * @param sess
   * @param mo
   * @return
   */
  public String[] getValue(RestrictedSession sess, MetadataObject mo) {

    String[] value = super.getValue(sess, mo);
    if (value == null) {
      return null;
    }

    FacesContext context = FacesContext.getCurrentInstance();
    String valueUsername =
      context.getExternalContext().getInitParameter(DEFAULT_CC_VALUE_USERNAME);
    if (valueUsername == null) {
      return value;
    }

    return new String[] { valueUsername };

  }
}

and register it in your adf-config.xml file at the following position

image

It is important, to register the DefaultUserCC-class before UserCC class since that’s the precendence which will be evaluated by the MDS runtime.

Now edit the web.xml and add the following parameter to define the user whose mds runtime customization will be used as default customization for users that have not customized their UI yet.

image 

With that configuration sking will be able to define the default UI  for all the other users.

Further reading

Customizing Applications with MDS

Monday, January 11, 2010

JDeveloper 11g: Know the IDEs coding features to get more productive

JDeveloper Version: 11.1.1.2.0

Introduction

There are a couple of useful IDE features that may not be so obvious because those are not always accessible by the menu but only through shortcuts. So in this post I just want to show some of the cool features that makes one more productive while developing.

Tag-Documentation (Press Ctrl-D on a Tag)

0000@1800_0-412664a6bc091a2b

Javadoc-Documentation (Press Ctrl-D on a class or method in java source code)

0002@1800_1800-412664a6c00c22e4

Javadoc-Documentation (Press Alt and Mouse Over on a class or method in java source code)

0004@1800_1800-412664a6c1a740da

Quick Source View (Shift+ Mouse Over Sourcefiles in Application navigator)

0005@1800_1800-412664adda468acf

Quick View in Sourcecode Mode (Ctrl+Mouse Over on right indicator bar) 0001@1800_1800-412664a6be23a67f

This also works for Java Sourcecode of course:

0003@1800_1800-412664a6c127d27d

Block Coloring (new in JDev 11.1.1.2)

0006@1800_1800-412664adde8641fe

Quick Preview in Taskflow (Shift+Mouse Over view-activity)

0009@1800_1800-412664ade127d27d

Quick file switch (Strg+TAB)

0007@1800_1800-412664addf4cfd58

Go to Java Type (Ctrl+-)

0008@1800_1800-412664ade0308b91

Alternatively use the search box in the top right corner of the IDE

0012@1800_1800-412664adea894ab7

to quickly find the file you are looking for. In most cases you will be faster than searching manually in the application navigator.

Quick Outline/Method navigation (Ctrl+Shift+O)

0010@1800_1800-412664ade3f258bf

Customize and explore

And of course you can customize your IDE shortcuts under Preferences>Shortcut keys

0011@1800_1800-412664ade4901e57

And of course it is good place to explorer new CodeEditor features.

Observation

There are still some features I am missing. used from e.g. Eclipse. This is

  • Ctrl+D: Delete current line
  • Alt+Arrow Up/Down: Move current line/block up down. This is really cool once you get used to it!

Friday, January 8, 2010

JDeveloper 11: Incomplete ViewObject information after IDE restart

Status: open
JDeveloper Version: 11.1.1.2.0

Issue

Last time I often face the following issue:

  1. Have a ViewObject-Definition file in Overview mode openedimage
  2. Close JDeveloper.
  3. Restart JDeveloper
    image
  4. Not every time but somtimes the ViewObject-Definition file seems to be incomplete!
    image
  5. Sometimes information shows up, but the two Overview tabs are confusing…
    image
  6. Any explanations for that behaviour?

Solution

First keep cool;-), your ViewObject-Definition content is still there! It just does not show up correctly in Overview Mode. Close the file and reopen it.

Update

Seeems like the two overview tabs show up everytime.

Saturday, January 2, 2010

Oracle TPC: Possible upgrade issue from 11.1.1.1 to 11.1.1.2

Status: resolved
Oracle Team Productivity Center: 11.1.1.2.0
Oracle WebLogic Server: 10.3.2
Environment: TELDE

First of all I wish all my readers out there a HAPPY AND SUCCESSFUL NEW YEAR 2010!

In a previous post I have blogged about setting up (a clean) Oracle Team Productivity Center Server. In this post I want to share my experience if you upgrade an existing OTPC database repository to 11.1.1.2 but want to install the otpc.war on a clean WLS 10.3.2 domain.

Issue

Tool/Area
Action
Client Start Xming
Putty Login as oracle
{setup your environment}
[oracle@telde ~]$ cd /u01/product/oracle/middleware/11.1.1/tpc/ [oracle@telde tpc]$ java -jar tpcinstaller.jar
Installer 1.Provide the database connection properties to the existing OTPC repository
2.Choose the autodeploy directory of a clean WLS 10.3.2 domain
3.Start installation
  You will encounter the following error
image

So how to solve the installation error if you want to install on a clean WLS 10.3.2 domain?

Solution

Tool/Area
Action
 
Putty Login as oracle
{setup your environment}

OK so now we need to manually install the otpc.war into weblogic domain.

1) We first verify that it is included in the tpcinstaller:

[oracle@telde tmp]$ jar -vft tpcinstaller.jar | grep otpc
16485122 Fri Oct 30 01:33:40 CET 2009 lib/otpc.war

2) Now we extract it and copy otpc.war to the domain home/autodeploy

[oracle@telde tmp]$ jar -xf tpcinstaller.jar lib/otpc.war
[oracle@telde tmp]$ cp -p lib/otpc.war $DOMAIN_HOME/autodeploy

3)Run the tpcinstaller once again!!!!

4)Start the WebLogic server

[oracle@telde tmp]$cd $DH
[oracle@telde fusion_domain]./startWebLogic.sh

 
   

Background information

During installation of OTPC the otcp.war is modified so that it contains the correct database connection information.

[oracle@telde autodeploy]$ cd /u01/app/oracle/product/11.1.1.2/middleware/user_projects/domains/base_domain/autodeploy/
[oracle@telde autodeploy]$ ls -l
total 24252
-rw-r--r-- 1 oracle oinstall  8309132 Nov  5 07:43 otpc.war
-rw-r--r-- 1 oracle oinstall 16485122 Oct 30 01:33 otpc.war-1257402576730
-rw-r----- 1 oracle oinstall     2131 Nov  4 02:07 readme.txt

Those connection properties are stored in persistence.xml which itself is contained in _wl_cls_gen.jar file.

image

So if you encounter connection problems persistence.xml in the exploded app directory is the file you should first look to verify the connection properties.