Moodle for iPhone Demo

Here’s an interesting (and unusually high production value) video of an iPhone mobile interface for Moodle:

Click here to view the embedded video.

Moodle also has a Java-based cross-platform mobile client which is not as pretty but seems to have decent functionality. (My impression is that this is fairly similar to the state of affairs with Blackboard’s mobile clients.) You can see screen shots here.

In the long run, we’re going to need to think seriously about creating more teaching and learning affordances that are mobile-specific rather than just creating mobile interfaces to existing LMS capabilities, but this is still a good step down the road.

Related posts:

  1. Blackboard vs. Moodle: North Carolina Community Colleges Assessment
  2. Moodle, Wave, and Widgets (Oh my!)
  3. Understanding Single Sign-On


© michael.feldstein for e-Literate, 2010. | Permalink | No comment | Add to del.icio.us
Post tags: , ,

Jersey 1.1.5.1 released

Gerard Davison | Mar 11, 2010 06:35 +0000

There is a minor point release of Jersey that includes a pair of significant bug fixes for weblogic and JDeveloper users. Worth using in preference to 1.1.5. Thanks a lot to Paul for putting this one together.

A Reader Asks – How To Pass Table Export Id Into ADF 11g Declarative Component

Andrejus Baranovskis | Mar 10, 2010 12:36 +0000
"I'm trying to use ExportCollectionActionListener inside Declarative Component, but I can't pass table export Id correctly - it gives error, Id is not found. Is it possible to make it work?"

Yes, it is. Download sample application - DCLibExport.zip. This archive contains two JDeveloper 11g applications - Declarative Component (ExportToolbarLib) and consuming application (EmployeesExport). I will not talk about Declarative Components in this post, you can read more about them from previous post.

Declarative Component example is really simple, it contains one attribute - exportId. Such type of components are really useful for proper application design and architecture, it allows to achieve proper reusability - instead of declaring Export buttons for each table, we are doing it only once:


And one button with ExportCollectionActionListener assigned, this will allow to export table data to Excel format automatically:


Important thing to mention - ExportCollectionActionListener gets ExportedId property value from Declarative Component attribute:


This means, we will be able to provide table Id value directly from consuming page and reuse Declarative Component in many pages.

Consuming application declares Tag library for Declarative Component - ExportToolbar:


Library is available in Component Palette:


Consuming page structure defines three main elements: data table, panel collection and export toolbar (our Declarative Component):


Here is main question now - how to wire together Export listener from Declarative Component and table in consuming page. The main trick - we should declare complete path and pass it through ExportId attribute. We should specify ExportToolbar Id (et1), enter into this component, and reference Panel Collection (pc1) from there. Finally, we need to access table component (t1) itself. Expression language for this case: #{et1::pc1:t1}:


On runtime we can see Export button from Declarative Component and ADF table with data:


Export works successfully:

SOA for the java developer, a focus

Especially for Patchset 2 of SOA Suite 11g we have put a focus on java development and the developer, which might not have skills to employ WSDL / XSD or XML every day, yet still wants to use the platform for monitoring, versioning and what not.

  • Support for <interface.java/> as a first class citizen next to <interface.wsdl/>
  • <service name="IInternalPartnerSupplier">
      <interface.java interface="com.otn.sample.fod.soa.internalsupplier.IInternalPartnerSupplier"/>
    </service>

    instead of

    <service name="externalpartnersupplier_client_ep">
      <interface.wsdl interface=http://partnersupplier.com/#wsdl.interface(ExternalPartnerSupplier)/>
    </service>

    This, kind of obviously, implies no need to create a WSDL in case you want to wire to an EJB / exposed Spring bean (via <sca:service/>) or want to expose a service Java friendly.

  • Full support for Spring as component implementation (next to implementation.bpel, implementation.mediator, implemetation.rule and others).
    • A spring bean <beans:bean> can be exposed as component service <sca:service>
    • A (global) reference (composite reference) can be injected as into a bean, via <sca:reference>
    • Mapping between request / callback mep (pretty much a two portType model) and the spring implementation model (beans and references)
      • ComponentType

      <service name="AsyncInteractions.AsyncInteractions">
        <interface.java interface="com.example.AsyncInteractions"
                        callbackInterface="com.example.AsyncInteractionsCallback"/>
      </service>

      • Spring beans context
      • <!--  service mapping to above interface -->
        <sca:service type="com.example.AsyncInteractions"
              name="AsyncInteractions.AsyncInteractions" target="asyncBeanImpl"/>
        <!-- spring bean -->
        <bean class="com.example.impl.AsyncSpringComponentImpl" id="asyncBeanImpl">
              <property name="callback" ref="AsyncInteractions.AsyncInteractionsCallback"/>
        </bean>       
        <!-- reference mapping to the above callbackInterface -->
        <sca:reference type="com.example.AsyncInteractionsCallback"
              name="AsyncInteractions.AsyncInteractionsCallback"/>

      • Java bean implementation
      • public class AsyncSpringComponentImpl implements AsyncInteractions
        {

          // injected by spring – this maps to the reference
          public AsyncInteractionsCallback mCallback = null;

          // implemented method from the interface
          public void process(String input)
          {
              // call the member (wired to the reference)
              mCallback.processResponse(("Hello" + input));
          }
        }

  • Native support for java objects (POJOs) across the platform
    • The mean of travel between components (hence service engines and binding components) is the normalized message (oracle.fabric.common.NormalizedMessage), modeled after an abstract WSDL (that is “type system”, headers, properties and messages)

      // SDO support
      void setSdoPayload(java.util.Map pPayloadMap, oracle.fabric.common.SDOMessageMetadata pSDOMessageMetadata);
      java.util.Map<java.lang.String, java.lang.Object> getSdoPayload();
    • // Java object support
      void setJavaPayload(java.util.Map pPayloadMap);
      java.util.Map<java.lang.String, java.lang.Object> getJavaPayload();

      // xml payload support
      void setPayload(java.util.Map pPayloadMap);
      java.util.Map<java.lang.String, java.lang.Object> getPayload();

    • Each Service Engine can have a dependency on the payload type (e.g. BPEL is based on DOM xml), and while the “underlying” message is based on a pojo, upon calling “getPayload” we will do conversion to the target format on the fly.
  • Support for EJB bindings (binding.ejb)
    • One notoriously weak point of Oracle SOA suite was the ability to connect / and use EJBs. Given that BPEL / OESB are based on XML the developer had to hand-craft (or partiallly generate the WSDL, and add binding / type mappings [and suffer through debugging it later on]) 
    • <binding name="EJBBinding" type="tns:CreditRatingService">
        <ejb:binding/>
        <!-- create the type map -->
        <format:typeMapping encoding="Java" style="Java">
          <format:typeMap typeName="xsd:string" formatType="java.lang.String" />
          <format:typeMap typeName="xsd:integer" formatType="int" />
          <format:typeMap typeName="xsd:boolean" formatType="boolean" />     
        </format:typeMapping>
        <operation name="validateSSN">
        <!-- define the ejb mapping, including type ordering, method, parts -->
          <ejb:operation
             methodName="validateSSN" parameterOrder="ssn" interface="remote"
             returnPart="status" />
          <input name="ValidateSSNRequest"/>
          <output name="ValidateSSNResponse"/>
        </operation>
      </binding>

    • In 11g we added a full fledged in- and out-bound ejb binding, based on interface.java
    • <reference name="IExternalPartnerSupplierService">
        <interface.java interface="externalps.IExternalPartnerSupplierService"/>
        <binding.ejb uri="ExternalLegacyPartnerSupplierEjb#com.otn.sample.fod.soa.externalps.IExternalPartnerSupplierService"
            javaInterface="externalps.IExternalPartnerSupplierService" ejb-version="EJB3" />
      </reference>

      So no more pain with XML to Java serialization and back, if needed the platform does it for you

  • Invocation of a composite service
    • Composite service via <binding.ejb/>
      • A composite service (based in interface.java) can be exposed as ejb. At that point you can use standard jee tooling and APIs to create a remote proxy
    • Locator API
      • The locator API can be used to query composites, their state, and also do administration. In PS2 we consolidate the mbean API (which is the admin part) and the query API (which is around the locator). At that point we are enpar with the API we had in 10.1.3.x  (SOA Suite 10g)
    • Direct Binding API
      • In order to allow high performance invocation of a composite service (and also the ability to be called back from the service) – we added a new API called direct binding. More information and a sample that shows the usage can be found here

Getting started with Nexus maven repository manager

Nexus is a maven repository manager. You can use Nexus to host your own maven repository for artifact created in your company, or for caching external artifacts.

Getting started with Nexus is pretty easy. Download the application. The package contains a webserver, so you don’t have to have a java container running. Simply unpack the downloaded archive and start the applications:

cd nexus/nexus-webapp-1.5.0/bin/jsw/linux-x86-32/
nexus start

Nexus has a web interface for managing your maven repository. The url for this web app is: http://localhost:8081/nexus/. The preconfigured admin account is admin, password: admin123.

According to the Nexus documentation you need to enable remote index downloads on a new installation, but it seems that this has been removed in the latest Nexus release. I couldn’t find the checkbox mentioned in Nexus 1.5.0.

Next you need to tell maven to use your maven repository. To do this, modify $HOME/.m2/settings.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <proxies></proxies>
  <servers></servers>
  <pluginGroups></pluginGroups>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

To make sure you are actually using dependencies downloaded through nexus, delete all dependencies maven has already cached on your system:

rm -rf ~/.m2/repository

To test this Nexus setup, we can create a little java application using maven. The following create a java web application:

mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=nl.iteye -DartifactId=App1
cd App1

You should now be able to compile and package your application:

mvn clean install

Next we’ll add the embedded glassfish maven plugin to our pom so we can test the web application. Add the plugin in the build section of your pom:

    <plugins>
         <plugin>
            <groupId>org.glassfish</groupId>
            <artifactId>maven-embedded-glassfish-plugin</artifactId>
            <version>3.0</version>
            <configuration>
               <app>${project.build.directory}/${build.finalName}.war</app>
               <port>7070</port>
               <containerType>web</containerType>
            </configuration>
         </plugin>
    </plugins>

When you try to run your application using the embedded glassfish plugin you’ll run into an error as maven will not be able to download all the required dependencies:

$:~/projects/jee/App1$ mvn embedded-glassfish:run
[INFO] Scanning for projects...
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.pom
[INFO] Unable to find resource 'org.glassfish:maven-embedded-glassfish-plugin:pom:3.0' in repository central (http://central)
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.pom
[INFO] Unable to find resource 'org.glassfish:maven-embedded-glassfish-plugin:pom:3.0' in repository central (http://central)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: org.glassfish:maven-embedded-glassfish-plugin

Reason: POM 'org.glassfish:maven-embedded-glassfish-plugin' not found in repository: Unable to download the artifact from any repository

  org.glassfish:maven-embedded-glassfish-plugin:pom:3.0

from the specified remote repositories:
  nexus (http://localhost:8081/nexus/content/groups/public)

 for project org.glassfish:maven-embedded-glassfish-plugin

To fix this problem we need to add the maven repository containing the glassfish plugin to Nexus. Log into Nexus using the admin account and, select repositories,and then add a proxy repository. Specify the following repository:

Next we need to add the glassfish proxy repository to the Public Repositories group:

Move the Glassfish Maven 2 Repository from available repositories to ordered group repositories:

Now you should be able to start Glassfish using maven, as Nexus will be able to find the required dependencies:

$:~/projects/jee/App1$ mvn embedded-glassfish:run
[INFO] Scanning for projects...
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.pom
4K downloaded  (maven-embedded-glassfish-plugin-3.0.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '7e111e395ec93ac48034fdf599552d547dc27618'; remote = '085185fbf2f1b3d0d36e557f4d42c9f47edc4d2c' - RETRYING
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.pom
4K downloaded  (maven-embedded-glassfish-plugin-3.0.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '7e111e395ec93ac48034fdf599552d547dc27618'; remote = '085185fbf2f1b3d0d36e557f4d42c9f47edc4d2c' - IGNORING
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.jar
16K downloaded  (maven-embedded-glassfish-plugin-3.0.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'd6e53dbbc063ccb40aa673f0a56bafa0c2c225db'; remote = '0469be7e503a1c3df4c8ddf199b1fba3a998cca2' - RETRYING
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/maven-embedded-glassfish-plugin/3.0/maven-embedded-glassfish-plugin-3.0.jar
16K downloaded  (maven-embedded-glassfish-plugin-3.0.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'd6e53dbbc063ccb40aa673f0a56bafa0c2c225db'; remote = '0469be7e503a1c3df4c8ddf199b1fba3a998cca2' - IGNORING
[INFO] ------------------------------------------------------------------------
[INFO] Building App1 Maven Webapp
[INFO]    task-segment: [embedded-glassfish:run]
[INFO] ------------------------------------------------------------------------
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/extras/glassfish-embedded-all/3.0/glassfish-embedded-all-3.0.pom
10K downloaded  (glassfish-embedded-all-3.0.pom)
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/extras/extras/3.0/extras-3.0.pom
2K downloaded  (extras-3.0.pom)
Downloading: http://localhost:8081/nexus/content/groups/public/org/glassfish/glassfish-parent/3.0/glassfish-parent-3.0.pom
53K downloaded  (glassfish-parent-3.0.pom)
...
INFO: Security service(s) started successfully....
classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@181c4eb
Mar 9, 2010 9:34:51 PM com.sun.enterprise.web.WebApplication start
INFO: Loading application App1 at /App1
Hit ENTER to redeploy, X to exit

That’s about it.

Share and Enjoy: del.icio.us Google Bookmarks DZone SphereIt StumbleUpon Technorati LinkedIn HackerNews PDF Digg Facebook FriendFeed Posterous Tumblr Twitter RSS

Gotchas when using memory scope prefixes in EL to access managed beans

frank.nimphius | Mar 9, 2010 13:09 +0000

Interesting post on the Oracle JDeveloper Oracle internal mailing list, answered by Andrew Robinson. Accessing a managed bean in a standard servlet scope like sessionScope or requestScope using the scope as a prefix fails if the bean instance does not exist. Thus, bean reference like #{sessionScope.myBean} may fail while #{myBean} always succeeds. The reason for this is that #{sessionScope….} and #{requestScope…} reference a Map in memory and not the JSF framework.

But why would you want to use the memory scope as a prefix? If you reference an attribute in memory scope, then the search goes from smallest scope to broader scope, which means that if – by accident – there exist two objects with the same name and you wanted to access the object in the broader scope, chances are you access the wrong object. So prefixing the expression puts you on the save side. This however is only good to use when you access objects that already exist in memory (wich could be a previously instantiated managed bean – of course)

Managed beans must be instantiated before they become available in the memory scope, which means they need to be accessed through JSF. Luckily, JSF does not allow to configure two managed beans with the same name in different scopes. So even without a scope prefix, there is no risk that application code accidentally accesses the wrong object.

Note however that using ADFc specific scope like viewScope and pageFlowScope, a prefix of “pageFlowScope” or “viewScope” is required in the EL reference.

Frank

ADF 11g : Label Modifications and Persisting Resource Bundle Changes

luc bors | Mar 9, 2010 06:48 +0000
In a comment on one of my posts on the AMIS technology blog I had a question on UIComponents. The question was if it is possible to modify prompts and labels of components programmatically. As a matter of fact this is possible. You can do this for the session only, or you can choose to persist these changes. In this post I first explain how to implement the "session only" functionality, and in

Integration in Oracle ADF with ADF Task Flows and Dynamic Regions Navigation

Today one more post from Integration series. There is a case, when Dynamic Region might have navigation to another Dynamic Region. If user will open one region from another, menu selection should be refreshed accordingly. I'm describing how to do this, thanks to blog Reader who asked this question.

Download updated sample - ADFIntegrationRegions3.zip, based on my previous post. Main change comparing to previous post sample - there is ADF Task Flow call from Locations to Departments:


All separate applications are deployed and assembled into one main application, same as it was described before. Only one difference now - first Dynamic Region (Locations) contains Departments buttons, it will navigate to second Dynamic Region (Departments) directly:


User can click on Departments button:


And here we go - Departments Dynamic Region is opened, menu item selection is synchronized as well:


Well, how to implement this? There is a very good hint in Frank Nimphius and Lynn Munsinger book (Building RIAs w/ Oracle ADF) on page #201 RegionNavigationListener. We can declare it for af:region:


And listen for navigation from Locations to Departments, if such navigation happens - we reset menu and switch Dynamic Region (Departments) as current:


Its how it works.

Red Samurai Tool – How To Check ADF 11g Package Structure and ADF Task Flow Parameters

In my previous post, I have introduced our JDeveloper 11g extension for ADF code quality validation. I will describe two rules more and will show how you can scan your ADF project for standard guidelines violations. Package structure check and task flow input parameters are documented today.

I'm demonstrating rule execution using updated sample application - RedSamuraiToolTestSample1.zip. Just to remind you, extension can be invoked by right clicking on Model or ViewController project and selecting it from available menu:


I will choose to run Package Structure Check rule:


Several violations are reported for - Application Module, View Link and Association:


Let's double check Model project structure, and we can see that report was correct - we need to fix few things for application package structure:


First, I will refactor Application Module into appmodules package:


If we run same rule again, this time only two violations will be reported - good progress:


We need to complete the rest of refactoring for View Link and Association - whole picture is correct now:


This is confirmed by our extension as well - no more violations for package structure:


Different projects may have different package structure standards, you can customize Red Samurai extension execution through preferences window:


Another rule I will describe - ADF Task Flow parameters naming convention:


Let's assume, we have a standard to give in prefix for ADF Task Flows parameter names. Developer forgot this standard and gave incorrect name - myParameter:


We run our rule to scan for ADF Task Flow input parameters names:


And here we go - rule violation is reported:


When parameter name is fixed to be inLastName:


No more violations for this rule are reported:

How-to protect your ADF pages

A great discussion on the JDeveloper forum on OTN brough a new addition to ADF application security that I like to share.

Chapter 30 of the Oracle® Fusion Middleware Fusion Developer’s Guide for Oracle Application Development Framework 11g Release 1 explains the JAAS protection mechanism for ADF pages and Task Flows. In here it is recommended that you reduce the number of JSF pages in the adfc-config.xml file to the absolute minimum and only give ADF Security permissions to those documents that need to be accessible from a browser request.

All other pages should be located in bounded task flows, which you can protect declaratively against GET requests, as they are issued from a browser URL. Bounded task flows need to be ganted to users through application roles to be accessible.

The discussion on OTN is about protecting the phyical JSPX files. If you are an authenticated and authorized user, then you could directly access the JSPX page, e.g. calling localhost:7101/myapp/faces/Departments.jspx. This then serves the page – though it may not be fully functional because it is not launched within the controller context.

The recommendation therefore is to store JSPX documents under the WEB-INF directory of the public_html folder. This solves the problem of users accessing physical files directly

Frank

Ps.: Note that if moving JSPX documents into the WEB-INF folder is not an option for you, you can write a servlet filter that checks the incoming request URL for the resource it accesses. If a jspx file is accessed you would return a http 403 error.

JDev 11gPS1 – Java editor “Declaration Insight”

The JDev11gPS1 New Features page lists a large amount of improvements, including something called the "Declaration Insight". The New Features blurb lists this feature as "When declaring local variables from method calls, declaration insight can automatically add the declaration and assignment code as well as completing the method call."

Like us, if you're using JDev11gPS1 you've probably already stumbled upon this feature and not realized it.

You'll be familiar with the traditional Completion Insight. Say in an EntityImpl you're implementing a method and within you want to call the super class method to get the database transaction. However you've forgotten the function name, is it getDBTransaction or getDatabaseTransaction? This is easily solvable by starting to type the function name "getD" then activating Completion Insight, either via pressing Ctrl-Space or the Source menu's same named option. The editor will show the Completion Insight popup in blue with all the functions starting with "getD" in the super class stack, including the method we’re interested in getDBTransaction:

Selecting the same named method, the method is instantly copied into the code:

...saving you some typing and hunting around for the right method.

However the Completion Insight only really gives the right hand side of the assignment expression. It would be good if you could get the IDE to create the left hand side of the assignment expression creating a variable of the correct type to take the result from the function, as well as the function call on the right hand side of the assignment operator as per what the Completion Insight does.

This is where the new "Declaration Insight" comes in. On invoking the Completion Insight with Ctrl-Space showing itself in blue, if you press Ctrl-Space again you'll see the popup changes to puce and displays the very similar Declaration Insight:

Again selecting the same named method, using the Declaration Insight the result is:

....where both the function call and the variable to be assigned the result are inserted into your code, ultimately saving you a bit more typing. If you're like me, and always forgetting what the return type is by the time you're back to the editor, and having to hunt for it again by double invoking the Completion Insight, this will same some extra time.

A minor but useful enhancement in the latest JDev11gPS1 release.

Red Samurai Tool – JDeveloper 11g Extension to Validate ADF Code Quality

I was working long on JDeveloper 11g extension for ADF 11g code quality checks. Finally it is available for public use - first release. This release is based on my Oracle Forms to Oracle Fusion 11g migration experience.

You can download extension - redsamuraiqt_1_0.zip and install it through JDeveloper Update wizard. It is available directly from Oracle JDeveloper Open Source and Partners Extension update center as well. Additionally, you can download sample project I'm using for this post - RedSamuraiToolTestSample.zip.

When you will run it, first screen will be welcome screen:


Next, you will be given with a list of rules to be applied for ADF code quality validation:


And finally, we have confirmation screen:


Extension can be customized through JDeveloper Preferences wizard:


You can install redsamuraiqt_1_0.zip extension through JDeveloper Check for Updates wizard from local file:


Or simply to download it from Open Source and Partner Extensions update center:


In order to invoke Red Samurai tool, right click on Model or ViewController project and select RedSamurai QT option:


To demonstrate extension functionality, I decided to show how you can ensure all View Objects contain ORDER BY clause:


It will report rule violations - View Object name and rule title:


Then you go to View Object screen and add ORDER BY clause:


If same rule is applied again, no more violations will be reported:


Another example - page title. We may have a rule to ensure all page titles are coming from Message Bundle file. If developer forgot to use title from Message Bundle and typed hard coded value:


Let's run Page Document Title rule:


Tool will generate report document, where violation will be reported:


It says that page title must be used from Message Bundle and property key should have specific value. I correct this violation and map page title to Message Bundle entry:


You can check,  Message Bundle reference should be included:


Run same rule again, no violations now:


Check for my next blog posts on the same topic - I will post updates and extension improvements.

Demo of Apache MyFaces 2 and OpenWebBeans

matthiaswessendorf | Mar 6, 2010 07:28 +0000

Recently the Apache MyFaces project released its second beta release and yesterday the Apache OpenWebBeans project released its M4 release.

These are great milestones in the direction of JavaEE at Apache!

A few month ago Bernd Bohmann and I were giving a JSF2 + X presentation in Muenster, at the JUG. The presentation was great and we showed a lot of cool features of JSF2 and CDI. The big plus was that we were Apache projects (MyFaces and OWB), which we build from the trunk. Now since there are these important milestones, I was able to actually make the demo project available under my “facesgoodies” demo/kickstart project.

Get the source of the Maven project from here.

Once you extracted the source, just run “mvn” and Maven downloads all you need!

Enjoy!


Using Struts with JDeveloper 11g?

If you are, then you need to view and respond to this announcement which I've posted on the OTN discussion forum...

Ning’s Async Http Client and Twitter Streaming API

matthiaswessendorf | Mar 5, 2010 06:25 +0000

Recently I played with the Apache Wink REST Client to access the Twitter Streaming API. Yesterday Jean-Francois Arcand announced the availability of Ning’s new Async Http Client. The blog looked interesting and the Twitter stream is a perfect example to combine the two. If you are behind a firewall you need to set a proxy-server on the AsyncHttpClientConfig and pass it into the constructor of the AsyncHttpClient. After that, you simply call the prepareGet(…) and here you pass in an anonymous AsyncCompletionHandler:

String logon = "user:password";
String encodedLogon = new BASE64Encoder().encode(logon.getBytes());

AsyncHttpClientConfig cc = new AsyncHttpClientConfig.Builder()
 .setProxyServer(
 new ProxyServer(Protocol.HTTP, "my-proxy", 8080)
 )
 .build();

AsyncHttpClient asyncHttpClient = new AsyncHttpClient(cc);

try
{
 Future<Response> f = asyncHttpClient.prepareGet(
 "http://stream.twitter.com/spritzer.json")
 .addHeader("Authorization","Basic " + encodedLogon)
 .execute(new AsyncCompletionHandler()
 {
 @Override
 public STATE onBodyPartReceived(HttpResponseBodyPart content)
 throws Exception
 {
 System.out.println("Tweet: " + new String(content.getBodyPartBytes()));

 return STATE.CONTINUE;
 }
 @Override
 public Object onCompleted(Response response) throws Exception
 {
 // TODO Auto-generated method stub
 return response;
 }
 @Override
 public void onThrowable(Throwable arg0)
 {
 }
 });

 Response r = f.get();
....

The interesting part of the anonymous implementation is its onBodyPartReceived(). Once the Twitter server has put a new tweet into the stream, the callback is called as soon as the actual (JSON) output arrives your client machine. In here, you could parse the JSON can trigger different methods of your application, based on what you want.

The AsyncHttpClient is pretty interesting – However I noticed a limitation that no parameters are allowed on GET request. Not via its setParameter/s() method nor via using the ? character => http://server_url?param=value.

Need to check more by checking out the code from here.

Parameters with HTTP POST

Of course, doing a HTTP_POST the parameters work as expected ;-)

Request req = new
 RequestBuilder(RequestType.POST)
 .setUrl("http://stream.twitter.com/1/statuses/filter.json")
 .addHeader(
   "Content-Type","application/x-www-form-urlencoded")
 .addHeader("Authorization","Basic" + encodedLogon)
 .setParameter("track", "Java")
 .build();

 Future<Response> f = asyncHttpClient.executeRequest(req,
  new AsyncCompletionHandler()
 {
 ....
 // similar as above...
 }
...

Looking forward to continue using this neat project! Good job guys…


JEE CDI tip: Target Unreachable, identifier resolved to null

If you are just starting out with JEE CDI (Weld), it’s easy to forget the required beans.xml file. If you don’t include it, you may run into problems like this:

SEVERE: javax.el.PropertyNotFoundException: /index.xhtml @8,67 action="#{crm.ping}": Target Unreachable, identifier 'crm' resolved to null
javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: /index.xhtml @8,67 action="#{crm.ping}": Target Unreachable, identifier 'crm' resolved to null
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:95)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
...

The beans.xml file (in META-INF/classes or WEB-INF/) can be empty or contain the following:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
Share and Enjoy: del.icio.us Google Bookmarks DZone SphereIt StumbleUpon Technorati LinkedIn HackerNews PDF Digg Facebook FriendFeed Posterous Tumblr Twitter RSS

The Poetry of Wisdom in Oracle Documentation: E.g. PPR and List Of Values

frank.nimphius | Mar 5, 2010 04:48 +0000

Our ADF Faces documentation contains little nuggets of poetry and wisdom that are easy to memorize helping you to better understand the product – and answer questions on OTN with it. For example, today I found and liked:

Note: If your trigger component is an inputLov or an inputComboBoxLov, and the target component is an input component set to required, then a validation error will be thrown for the input component when the LOV popup is displayed. To avoid this, you must use programmatic partial page rendering.

Note: In some cases, you may want a component to be rerendered only when a particular event is fired, not for every event associated with the trigger component, or you may want some logic to determine whether a component is to be rerendered. In these cases, you can programatically enable PPR.

Excellent !

Frank

Want to dig your own nuggets? here is the documentation: Looking forward to read your blogs and tweets with your favorite quotes.

Java Memory Management

Gert Leenders | Mar 4, 2010 14:13 +0000
When writing programs it’s always good to know what’s happing in the core of the Framework you’re using. This allow you to get a better idea why things happen in a certain way or what to do in case you receive an error.

So if you’re a java programmer a good thing to read is this paper on memory management in the Virtual machine. It has a short introduction, a brief overview of the concepts and later on it dives a little deeper with an overview on the different garbage collectors and a chapter on ergonomics. At the end you get some tips and recommendations.

Chapter 6 also contains the paragraph ‘What to Do about OutOfMemoryError’ helpful for us all I think :-) (especially when you’ve ever have used BufferedImage)

Here you can find more information on Java HotSpot Garbage Collection.

Overview Java Web Frameworks

This week I came across a good overview of Java Web Frameworks:

http://www.flickr.com/photos/mraible/4378559350/

http://www.flickr.com/photos/mraible/4378559350/

The presentation (that will be given at TSSJS Las Vegas 2010) this time-line originates from, can be found here. The overview was created by Matt Raible of Raible Designs.

Absent Code attribute in method that is not native or abstract

I ran into the following problem yesterday while building a rest service using resteasy: the code would compile ok, but the unit tests wouldn’t run. I got the following exception in the output of the unit tests:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ws/rs/ext/RuntimeDelegate
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

The problem is caused by the javeee-api dependency in my maven pom. As described here, the following dependency provides you with the java-ee api’s, not the implementation. This is ok for compiling, but can’t be used for executing code.

<dependency>
  <groupId>javax</groupId>
  <artifactId>javaee-api</artifactId>
  <version>6.0</version>
</dependency>

I thought i’d solved the issue by adding a scope of provided or even compile, but this doesn’t fix the problem. The maven build still fails with the Absent code attribute… error. Removing the dependency completely solves the issue for now, but will probably give me some problems when i add more code which uses jee6.

Share and Enjoy: del.icio.us Google Bookmarks DZone SphereIt StumbleUpon Technorati LinkedIn HackerNews PDF Digg Facebook FriendFeed Posterous Tumblr Twitter RSS