Академический Документы
Профессиональный Документы
Культура Документы
Alexis Lopez
Consultant, Iteria SAS
@aa_lopez
aalopez@gmail.com
www.java-n-me.com
Agenda
Best Practice
Using the same datasource name for Weblogic (Integrated) and Glassfish
What is ADF?
Model-View-Controller Framework
11g JavaEE 5
12c JavaEE 6
Integrated Security
What is ADF?
Architecture
ADF Faces
ADF DvT
ADF Controller
ADF Binding
JDeveloper/Eclipse
MySQL
http://www.oracle.com/technetwork/developer-tools/adf/overview/adfessentials-1719844.html
oracle.jbo.server.ViewObjectImpl and
oracle.jbo.server.ViewRowImpl are used for your view
object implementations
http://dev.mysql.com/downloads/connector/j/
Open source
2
3
Make sure you define a password for the user you will use to access MySQL otherwise
JDeveloper will fail to connect.
Configure sql-mode in my.cnf file (restart required)
From MySQL Manual: Server SQL modes define what SQL syntax MySQL should support and
what kind of data validation checks it should perform. This makes it easier to use MySQL in
different environments and to use MySQL together with other database servers...
In Amazon RDS you can use DB Parameter Groups where you can define configurations for your
DB instance.
Default is:
select sysdate from dual
Change to:
select NOW() from dual
Or use any of the
MySQL Date Functions
Run your AM
Create a Player
Commit
What happened?
Are you using MySQL 5.6 or superior?
Are you using the latest driver?
Are you using DATETIME(N) where N is
0...6?
More details on:
http://www.java-n-me.com/2014/02/adf-entity-track-change-history.html
Limited to one
column per table
Assigned to a
Specific table
Original mapping
More details on:
http://www.java-n-me.com/2013/11/using-mysql-autoincrement-pk-column-in.html
Use MySQL function to retrieve the last inserted value for an AUTO_INCREMENT
column:
LAST_INSERT_ID()
Extend your Entity class and override the doDML method
1
2
@Override
protected void doDML(int op, TransactionEvent e) {
//got to call first to super, so the record is posted
//and then we ask for the last insert value
super.doDML(op, e);
//ask for the last insert value if we are inserting
if (op == DML_INSERT) {
populateAutoincrementAtt();
}
}
//... populateAutoincrementAtt() is shown next...
}
More details on:
http://www.java-n-me.com/2013/11/using-mysql-autoincrement-pk-column-in.html
}
}
catch (SQLException e) { // ...
}
@Override
protected void doDML(int op, TransactionEvent e) {
//got to call first to super, so the record is posted
//and then we ask for the last insert value
super.doDML(op, e);
//ask for the last insert value if we are inserting
if (op == DML_INSERT) {
populateAutoincrementAtt();
}
}
}
Users People
JDBC Realm Means that the universe of users and groups exists in a database
File Realm Means that the universe of users and groups exists in a file
Etc.
Authentication of users, to reliably and securely determine who is currently executing Java
code.
BASIC HTTP BASIC authentication protocol. A popup window asking for user/password
DIGEST Similar to BASIC but with security enabled for transmitting credentials
HTTPServletRequest provides methods to get the user name and verify whether the
current user has a specific role, among other
Since faces/Main.jspx is secured, the user will get redirected to the login page
if he/she is not authenticated
<security-constraint>
<web-resource-collection>
<web-resource-name>MainProtection</web-resource-name>
<url-pattern>/faces/Main.jspx</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
<auth-constraint>
<role-name>Management</role-name>
<role-name>SelfService</role-name>
</auth-constraint>
</security-constraint>
<!-- more elements -->
<security-role-mapping>
<role-name>Management</role-name>
<group-name>Management</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>SelfService</role-name>
<group-name>SelfService</group-name>
</security-role-mapping>
In glassfish-web.xml is where
you map your application
roles with the roles that you
have in your realm
java:comp/env/jdbc/DS_NAME
jdbc/DS_NAME
Web Content/WEBINF/glassfish-web.xml
References
Vesterli E., Sten (2013). Packt Publishing Ltd. Great starter book for ADF Essentials
Glassfish Security
Masoud Kalali (2010). Packt Publishing Ltd. Complete reference to security on Glassfish server
http://www.jobinesh.com/
ADF Architecture TV
Alexis Lopez
Consultant, Iteria SAS
@aa_lopez
aalopez@gmail.com
www.java-n-me.com