Monday, October 31, 2011

ADF Hudson configuration and usage

Ok so we moved off team city to use Hudson, so I though I would note some of my hassles.

1) No as many as though just needed to make use of the Advanced Project Options to set the checkout directory for some projects (our build project mainly has relative paths).

Tick Use custom workspace
  set directory to the desired location like: ./jobs/project/${JOB_NAME}
Tick Clean workspace before build 

2) our poll SCM 0,10,20,30,40,50 * * * *

3) Advanced button near invoke ant has a Build file property for ant files not in the root ours: Build/build.xml

4) Used Archive the artifacts property - tip for this just put in the name of the artifact you want to archive and on the first build Hudson will tell you where the file is located in the console output.

NOTE: a move to maven would fix all my problems but we have a couple of draconian internet policy so I will need to get an artifactory user setup for the downloads before we embark hassles.

ADF and Hudson 1 - Installation

Quick and dirty installation guide really was a simple install so here goes:


We are running on dead rat and I am a fossil so I went for a RPM install not yum.

1) Added a hudson user using useradd.
2) rpm -ivh hudson.rpm
3) Make sure your java is in the candidates list.

cat /etc/init.d/hudson
look for this config:

 for candidate in /usr/java/latest/bin/java /usr/lib/jvm/java-1.6.0/bin/java /usr/lib/jvm/jre-1.6.0/bin/java 
/usr/lib/jvm/java-1.5.0/bin/java /usr/lib/jvm/jre-1.5.0/bin/java /usr/bin/java
do
  [ -x "$HUDSON_JAVA_CMD" ] && break
  HUDSON_JAVA_CMD="$candidate"
done

4) Optional : Change the huson startup to run as the hudson user using sudo
visudo

Add the following config:

Cmnd_Alias HUDSON = /etc/init.d/hudson stop, /etc/init.d/hudson start, /etc/init.d/hudson restart
hudson ALL= NOPASSWD: HUDSON 

5) Edit any config you need in /etc/sysconfig/hudson

6) Start hudson
sudo /etc/init.d/hudson start

Thursday, October 27, 2011

Hudson or Jenkins for me?

We have been faced with the choice of going with Hudson or Jenkins as our CI enviroment for our ADF build.

Hudson
Oracle backed Sonatype supported. More structured.


Jenkins
More OSS style, larger comunity majority of the orginal developer community.

Really very similar.

Guess the safest thing to do is go with Hudson and upgrade to Jenkins if need be. So we will be going with Hudson, head decision not heart decision. This is also consistent with the ADF community.



Links :http://jaxenter.com/oracle-speak-out-on-hudson-jenkins.1-34569.html
http://bobbickel.blogspot.com/2011/03/jenkins-vs-hudson-time-to-upgrade.html
http://jenkins-ci.org/content/about-jenkins-ci
http://hudson-ci.org/docs/process_summary.html
http://groups.google.com/group/adf-methodology/browse_thread/thread/f4c4f616d5520166?pli=1

ADF: LOV Description instead of code

I keep on forgetting how to do this so this is a note to self in terms I understand (ie pictures):

Add the related entiy object to yours (in the example we are adding RegionEO(list of values) to CountryEO)

Now add the RegionName field from the EO and a transient attribute (I named mine RegionNameLOV)

Make the transient attribute updateable and base it on the expression RegionName (the description you wish to display)


Add a list of values to RegionNameLOV and map BOTH key to parent fk (region id here) AND RegionName to your transient coulmn (RegionNameLOV).

 Map the transient as an Input text with List of Values.




Then just drag the lov item onto the page (RegionNameLOV)

Tuesday, October 25, 2011

ADF: JDev 11.1.2.1

Ok so I installed 11.1.2.1 today nothing much has changed so far. (smoothest upgrade so far)
Will update if I find any problems.

All post from now will be for 11.1.2.1.

Having a problem with multi edit list lovs - if it is a large LOV and you scroll down the LOV stays in the fetching data state - will try find a work around.

Java: Regular expression Library

Ok I always forget how to use java regular expressions and get confused so the following is the list of examples that will help my brain out (I will add stuff over time.)


Ends With .java : .*\\.java
Starts With helloDolly: helloDolly.*
Phone number: ^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$

. Everthing (any character one only)
^ Not
* Many
\ Escape
[] Grouping
$ End of line
? Makes the preceding item optional.

| (pipe) Causes the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of options.
+ Repeats the previous item once or more.

\d A digit: [0-9]
\D A non-digit: [^0-9]
\s A whitespace character: [ \t\n\x0B\f\r]
\S A non-whitespace character: [^\s]
\w A word character: [a-zA-Z_0-9]
\W A non-word character: [^\w]



 
.* Everything (any character many times)


a* match all sequential a's 
  
Character Classes
[abc] a, b, or c (simple class)
[^abc] Any character except a, b, or c (negation)
[a-zA-Z] a through z, or A through Z, inclusive (range)
[a-d[m-p]] a through d, or m through p: [a-dm-p] (union)
[a-z&&[def]] d, e, or f (intersection)
[a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction)
[a-z&&[^m-p]] a through z, 



SymbolMeaning
* 0 or more times
+ 1 or more times
?0 or 1 time
{n} Exactly n number of times
{n,m} n to m number of times
References:
http://www.omicentral.com/cheatsheets/JavaRegularExpressionsCheatSheet.pdf
http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html
http://www.regular-expressions.info/reference.html  
http://www.javaworld.com/javaworld/jw-07-2001/jw-0713-regex.html?page=2

Thursday, October 20, 2011

ADF 11.1.2 - hanging screen after validation error

JDev 11.1.2

We have found that if you get a validation error - ie mandatory field error - and then navigate away to another page using a link (goLink) our systems hangs and you cannot click or perform any other action.

Solution

Add the following javascript to your page:

 function clearAllMessages(evt) {
   AdfPage.PAGE.clearAllMessages();
 }

And on all your goLinks add a clientlistener.

 


Wednesday, October 19, 2011

ADF: skinning tree icons

I was struggling to override the icons on a tree with our style sheet (done pre 11.1.4) nothing I was doing was working (the icons remained) - tried using af|tree::expanded-icon-style, af|tree::expanded-icon etc.

So if anyone is struggling with this here is what I did to fix this - I just created a new style sheet using the nifty new adf style sheet item and found my tree item I wished to override. I then used the new style sheet in my app and everything worked as expected. (I suspect this was do with a spelling error but the new css editor makes this a thing of the past)


The reason for this is I want all the auto tree icons to dissapear and add my own icons to the facet to denote what each tree item is.

css source -

@namespace af "http://xmlns.oracle.com/adf/faces/rich";
@namespace dvt "http://xmlns.oracle.com/dss/adf/faces";

af|tree::collapsed-icon-style
{
  background-image: none;
}
af|tree::expanded-icon-style
{
  background-image: none;
}

Friday, October 14, 2011

Weblogic: Log Filter Kung Fu

This so made my happy today I have some error/warining messages that annoy the hell out of me and clutter up my dev. (Ignorable messages but we redirect stdout to the log files)

So I know this is just hiding the problem but some messages are just worth the effort to hide and not to fix:

1) Click on your domain (DefaultDomain)  link on the left hand menu. Then Click on the log filter tab (second row of tabs). Then Click new. Give your log filter a funky name.



2) Create the filter info by clicking Edit. The below example shows how to exclude any message with the text 'oracle.adf.share.security.providers.jps.JpsIdentityManagementProvider' in the message see link at the end for all filter syntax. Click Save.




3) Navigate to the  Enviroment>Server link on the LHM and then choose your server. Click on the Logging General tab. Make sure you select the Advanced Hyperlink.


4) Select your new filter for any log you wish to filter - and there you go.



NOTE:
Make sure Redirect stderr logging enabled and Redirect stdout logging enabled are checked on the server (DefaultServer>Logging>General) you wish to filter. (Advanced tab)

Links:
 http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ConsoleHelp/taskhelp/domain_log_filters/CreateLogFilters.html
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/wldf_configuring/appendix_query.html

Wednesday, October 12, 2011

ADF survey - Your Chance to Change the ADF Future

http://blogs.oracle.com/grantronald/entry/your_chance_to_change_the

Give it a go maybe it will help...

ADF sort of generic screen for tables with the same structure

We have a couple (about a hundred) of tables with the same structure (Code, Description, Create Date, Update Date).


So I wanted to do something simple so that I did not have to create all these screens

1) EO
  I created the EO based on one of the tables I had that had the above columns.

I then Added a transient attribute called table name to my EO based on a groovy expression. (the expression needs to change as I am reading web tier stuff from the model layer but I will fix this later)


I then generated a java class for my EO.


And added the following overriden method to my newly created java class.

protected StringBuffer buildDMLStatement(int i,
AttributeDefImpl[] attributeDefImpl,
  AttributeDefImpl[] attributeDefImpl2, AttributeDefImpl[] attributeDefImpl3, boolean b) {   StringBuffer statement = super.buildDMLStatement(
  i, attributeDefImpl, attributeDefImpl2, attributeDefImpl3, b);
return new StringBuffer(StringUtils.replace(statement.toString(), 
  "REGIONS", getTableName())); }


2) VO

I created a VO based on the entity we just created (including the transient attribute).




Generate a java class for this view object as you did with the EO.

Add the following code to the VOImpl just generated.
 
private String dynamicTableName = "REGIONS";
protected String buildFromClause() {
  String fromClause = super.buildFromClause();
  return StringUtils.replace(fromClause, "REGIONS", getDynamicTableName());
}
public String getDynamicTableName() {
  return dynamicTableName;
}
public void setDynamicTableName(String dynamicTableName) {
  this.dynamicTableName = dynamicTableName;
}
3) AM
Add the following method to your AM java impl (generate it if it does not exist):



 public void setDynamicTableParam(String dynamicTableParam) {
  getGenericTypesVO().setDynamicTableName(dynamicTableParam);
  this.getSession().getUserData().put("dynamicTableName", dynamicTableParam);
}

Add the new VO to the AM.

Add this as a client interface


4) JSF
  Create a page and drag your vo on add any buttons you wish.


5) Task Flow
 Create a taskflow with a parameter called tablePara



6) Bean
 Mark the bean as view scope in your task flow and pop this in the constructor, NOTE: This does not work in the new version just bind this to an invoke method on prepare model now and map #{pageFlowScope.tblPara} to your value in the method binding - much better idea (http://dstas.blogspot.com/2010/09/adf-11g-methodaction-and-invokeaction.html)
    super();
    Map pfs = AdfFacesContext.getCurrentInstance().getPageFlowScope();
    String tableName = (String) pfs.get("tblPara");
    Map params = new HashMap();
    params.put("dynamicTableParam", tableName);
    ADFUtils.executeOperationBinding("setDynamicTableParam", params);
    ADFContext.getCurrent().getPageFlowScope().put("setDynamicTableParam", tableName);

Test it and see how it works - as you change the name of the input parameter to the task flow the data fetched and updated etc will be relative to the table name you supply.

Easy tesing is to create an index page with a couple of links:
<af:goLink text="Generic - Regions" id="gl1" destination="/faces/adf.task-flow?adf.tfId=genericFour-tfd&adf.tfDoc=
  /WEB-INF/generic-tfd.xml&tblPara=REGIONS"/>
<af:goLink text="Generic - Regions2" id="gl2" destination="/faces/adf.task-flow?adf.tfId=genericFour-tfd&adf.tfDoc=
  /WEB-INF/generic-tfd.xml&tblPara=REGIONS2"/>


I still have to  but you should have all you need for this solution. If anyone has a better way of doing this feel free to shout.

Tuesday, October 11, 2011

ADF range paging table selection breaking

We where having a few problems with selection on a row table - the selected row was not always selected when clicked and was broken after that.

Changed the to Scrollable from Range Paging and the problem went away. Not the best solution but the page did not need to have range paging enabled.

Monday, October 10, 2011

oracle.security.idm.ObjectNotFoundException: No User found matching the criteria

Ok so I know you can ignore this warning in ADF but I wanted to get to the bottom of the error and find out if I could make it disappear.

So I swapped the to the xml id store provider in the jps-config.xml and added a jazn.com realm in system-jazn-data.xml and added my user but no luck.


So I got fed up with trying to fix this so I decided to hide it : http://javaosdev.blogspot.com/2011/10/weblogic-log-filter-kung-fu.html

Can you say shortcut anyway no more shall I see this on logging in. Woo Hoo.

Thursday, October 6, 2011

Weblogic : persistent file store is forced to use buffered I/O

 The persistent file store "_WLS_DefaultServer" is forced to use buffered I/O and so may have significantly degraded performance. Either the OS/hardware environment does not support the chosen write policy or the native wlfileio library is missing. See store open log messages for the requested and final write policies. See the documentation on store synchronous write policy configuration for advice.


See this post it fixed it for me:http://javaosdev.blogspot.com/2011/10/weblogic-defeating-unable-to-load.html

Weblogic: Defeating the Unable to load performance pack 64bit

JDeveloper 11.1.2, Windows7, 64bit

Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in blah....

I get this error message on my local windows machine and it annoys the hell out of me so I had to fix it.

Step 1) Download the generic install version of Jdev (jar version)
Step 2) Install this with a 64 bit vm -- cmd prompt java -server -jar jdevstudio11115install.jar (I used the -server parameter I dont know if this makes a difference but I dont feel like trying without it.)
Step 3 ) make sure you use a 64bit jvm in the install



Worked for me.

Tuesday, October 4, 2011

ADF table scrollbar disappears when there are many records

11.1.2, ie8, firefox7, chrome14

Yhea ok so this is wierd my table only has a couple of hundred thousand rows and my scrollbar goes walk about when I query all of them if I tighten the query and return less rows my scrollbar shows up.

Need to investigate further will let you know what I find.

I know there is no reason to have so many rows displayed but I find it interesting never the less.

Made a quick test page on a large table with a bind variable mapping to rownnum and here are the results:

1 million records
ie - scrolly there
chrome - scrolly there
firefox - scrolly there

Somwhere around 1.2 million
ie - scrolly there
chrome - scrolly there
firefox - scrolly MISSING


Somwhere around 8.4 million

ie - scrolly there
chrome - scrolly MISSING
firefox - scrolly MISSING



OK so it looks like a firefox/chrome problem - use ie or chrome or alternativley map all huge result sets to cut off before 1 million records.

Monday, October 3, 2011

SOA what? Enhancements I would like to see in JDev/ ADF for service stuff

My suggestions for ADF to be more SOA friendly:

1) Ability to configure the web service data control end point on the fly using just weblogic.
2) Metadata used from xsd to generate screens with length etc validation and correct label naming.
3) LOV service implementation using non adf generated services.
4) Search service implementation using non adf generated services.
5) Paging and performance enhancements.

Feel free to add stuff here if you wish.