Tuesday, December 21, 2010

OCPJP preps resources and links

http://www.whizlabs.com/scjp/scjp.html

http://scjptest.com/

http://www.coderanch.com/forums
http://www.coderanch.com/how-to/java/SCJP-FAQ#writeOn
http://www.coderanch.com/how-to/java/ScjpMockTests
http://www.coderanch.com/forums/f-24/java-programmer-SCJP
http://www.javachamp.com/public/bookshelf.xhtml

http://www.pass4sure.com/310-065.html

http://www.javacertificationexams.com/scjp-mock-exams.php


Books:
Sybex - Richard F. Raposa - SCJP Sun Certified Programmer for Java Platform, SE6

wicket + unit testing

https://cwiki.apache.org/WICKET/unit-test.html

https://cwiki.apache.org/WICKET/testing-pages.html

http://paulszulc.wordpress.com/category/wicket/

http://www.devx.com/Java/Article/35620/1954

http://apache-wicket.1842946.n4.nabble.com/how-to-pass-initial-request-parameters-with-WicketTester-td3023595.html

http://www.mail-archive.com/users@wicket.apache.org/msg02958.html

http://mail-archives.apache.org/mod_mbox/wicket-users/201011.mbox/%3C6AE6F5755F903843B12F4EC91377888D014115FF2D@ba-srv-exchange%3E

Monday, December 20, 2010

JDBC Connection Pool org.apache.tomcat.jdbc.pool

Injecting JNDI datasources for JUnit Tests outside of a container:
http://blogs.sun.com/randystuph/entry/injecting_jndi_datasources_for_junit

http://ascendant76.blogspot.com/2010/02/upcoming-jdbc-pool.html


http://people.apache.org/~fhanik/tomcat/jdbc-pool.html

Wednesday, December 15, 2010

wicket - bookmarkable pages

https://cwiki.apache.org/WICKET/bookmarkable-pages-and-links.html

http://www.javalobby.org/java/forums/t61556.html

http://www.mkyong.com/wicket/how-do-change-wicket-url-bookmarkablepage-structure-url-mounting/

moving to the cloud ebook

http://mkyong.tradepub.com/free/w_goog20/

Friday, December 10, 2010

notes on fop migration till fop 1.0

besides fop.jar needed libs:
xmlgraphics-commons-1.4.jar (because of MimeConstants.PDF)
commons-io-1.3.1.jar

other exceptions because of the changed implementation:
Element "fo:page-sequence-master" is missing required property "master-name"!

javax.xml.transform.TransformerException: org.xml.sax.SAXException: Mismatch: table-cell (http://www.w3.org/1999/XSL/Format) vs. root (http://www.w3.org/1999/XSL/Format) -> solved by
<fo:table table-layout="fixed" width="100%" border-collapse="separate">
and removing any empty table cells - using number-columns-spanned property of table-cell instead

design tools
1) http://www.ecrion.com/Products/XFDesigner/Overview.aspx - great tool
2) http://www.java4less.com/fopdesigner/fodesigner.php - I didn't manage to do anything meaningful with the trial version

Thursday, December 9, 2010

links on hibernate migration

http://community.jboss.org/wiki/HibernateCoreMigrationGuide30

http://community.jboss.org/wiki/HibernateCoreMigrationGuide31

http://community.jboss.org/wiki/HibernateCoreMigrationGuide32

http://community.jboss.org/wiki/HibernateCoreMigrationGuide33

http://community.jboss.org/wiki/HibernateCoreMigrationGuide36

Wednesday, December 1, 2010

notes on struts2

1) passing parameters to an action
--- in struts.xml
<action name="login" class="at.kds.epb5.epbback.action.LoginAction" method="execute">
<result name="success" type="redirectAction">
<param name="actionName">list</param>
<param name="stickerBundleStatus">1</param>
</result>
<result name="input">/login.jsp</result>
<result name="error">/login.jsp</result>
</action>
since the default stack is used, there is no need to specify an interceptor

--- Action bean class has to implement ParameterAware interface and hence to implement its setParameters method
e.g.
@Override
public void setParameters(Map parameters) {
try {
if ( parameters == null ) return;
String[] tmp = (String[])parameters.get("stickerBundleStatus");
if(tmp != null && tmp[0] != null
) {
stickerBundleStatus = Integer.valueOf(tmp[0]);
}
} catch (Exception ex) {
stickerBundleStatus = StickerBundle.STATUS_OPEN;
}

}


2) Parameters saved to the session
the action bean has to implement SessionAware interface and its method setSession()
e.g.
Map session = null;

@Override
public void setSession(Map session) {
this.session = session;
}
and when needed to use session.put() and session.get() methods

3) Preparable interface - with the default stack when the action bean implements Prepare interface, prepare() and prepareXXX() are called before XXX() action method

Tuesday, November 23, 2010

Friday, November 5, 2010

RESTful Web Services

implementations:

Sun's Jersey
Restlet
RESTEasy
Struts + REST plugin

personal favourite so far - Jersey
unfortunately Google App Engine supports Restlet, so ... I have to use it.

books:
1)
RESTful Java Web Services, Jose Sandoval, Packt Publishing, ISBN 978-1-847196-46-0
source: http://www.packtpub.com/files/code/6460_Code.zip
2) The Java EE 6 Tutorial, Basic Concepts, Fourth Edition, ISBN-13: 978-013-708185-1

1) referecences TextWise's API

Restlet - RESTful framework for Java

http://wiki.restlet.org

Jersey - Sun's implementation for RESTful web services

reference implementation of Sun's Java API for RESTful Web Services
aka JAX-RS

https://jersey.dev.java.net/

db4o

db 4 objects
http://www.db4o.com/

Wednesday, November 3, 2010

Google App Engine

what is supported / not supported:
http://code.google.com/p/googleappengine/wiki/WillItPlayInJava

-> only restful java web services are supported
to look at
restlet: http://www.restlet.org/documentation/2.0/firstSteps
restlet integration in google app engine: http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/252-restlet.html

Monday, November 1, 2010

Wicket + Google App Engine

http://herebebeasties.com/2009-04-10/wicket-on-googles-app-engine/

Back to Wicket, totally disappointed from Spring

I really don't understand why Spring is so popular... absolutely useless

Thursday, October 28, 2010

Spring Web Flow 2: flow redirect

needed : proper mapping definition

e.g.
epb5-servlet.xml

<!-- Spring MVC -->
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/loginform.htm">flowController</prop>
<prop key="/jobheaderform.htm">flowController</prop>
</props>
</property>
</bean>



to redirect from loginform flow to jobheaderform flow:
e.g.in loginform.xml:
<view-state id="jobHeaderView" view="flowRedirect:jobheaderform.htm?jobId=15438">
</view-state>

where jobId is defined as an input in jobheaderform flow:
<input name="jobId" required="true" />

Wednesday, October 27, 2010

notes on Spring Web Flow

1) Spring Web Flow 1.0 and Spring Web Flow 2.0 are different as e.g. Struts 1 and Struts 2. i.e. there is no compatibility
2) having trouble with the latest version of Spring Web Flow 2 and Spring 3 -> an app implemented with an older version is not working with the libs from the latest distributions
3) web flow definition -> in a state, there may be only one evaluate -> the second one is not executed, the flow fails

Monday, October 25, 2010

Web App testing - SeleniumHQ

http://seleniumhq.org/

Apache Ivy

http://ant.apache.org/ivy/
dependency management that is easily integrated with ant

Friday, October 22, 2010

Having Fun with Spring Roo

it is really funny ... to build java projects ... from command prompt....

http://s3.springsource.com/MRKT/roo/2010-01-Five_Minutes_Roo.mov

Tuesday, October 19, 2010

maven - Oracle JDBC driver dependency

e.g. we'd like to use ojdbc14.jar for Oracle 10.2.0.1.0

1) install jdbc driver in mvn repository

mvn install:install-file -Dfile={ORACLE_HOME}/jdbc/lib/ojdbc14.jar -Dpackaging=jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0

2) specify dependency in pom.xml

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>

other people's blogs

http://joelonsoftware.com/
to check Painless Functional Specifications in particular

http://www.gridshore.nl/


http://www.andygibson.net/articles/seam_spring_comparison/html/ch02.html

unfortunately again about Spring Web Flow 1:
http://www.cakesolutions.net/teamblogs/2008/07/16/spring-webflow-passing-objects-between-parent-flow-and-subflows/

http://forum.springsource.org/archive/index.php/t-39048.html

**********
Struts 2:
http://cse-mjmcl.cse.bris.ac.uk/blog/2007/09/10/1189430125294.html

***********
http://denis-zhdanov.blogspot.com/2009/09/standalone-tomcat6-based-web.html


http://paulszulc.wordpress.com

Saturday, October 16, 2010

getting familiar with spring

Spring in Action, 2nd edition, Craig Walls
notes

DI - Dependency Injection
AOP - Aspect-Oriented Programming

s.
EJB 3.0 specs
Expert One-on-One: J2EE Design and Development, Rod Johnson
templating frameworks Velocity, FreeMaker
AOP Alliance interfaces, AspectJ
JMX Java Management Extension
JCA Java EE Connector API
...

Thursday, September 23, 2010

hibernate criteria API exists subquery

SELECT *
FROM service_type
WHERE EXISTS (SELECT 1
FROM service
WHERE service.active = 1
AND service.is_57 = service_type.id)


Criteria criteria = session.createCriteria(ServiceType.class, "servicetype");
DetachedCriteria serviceCriteria = DetachedCriteria.forClass(Services.class, "service");
serviceCriteria.add(Restrictions.eq("ACTIVE", new Integer(1)));
serviceCriteria.add(Property.forName("servicetype.ID").eqProperty("service.IS_57"));
criteria.add(Subqueries.exists(serviceCriteria.setProjection(Projections.property("service.ID"))));
return criteria.list();

Tuesday, September 21, 2010

I hate hibernate

today's problem
I see it reported by others as well:
http://www.theserverside.com/discussions/thread.tss?thread_id=37010
http://www.coderanch.com/t/422591/ORM/java/Hibernate-one-many-association-foreign


foreign keys when the column name on child side differs from the primary key

in JOB_HRD mapping file, key is JOB_DI, foreign column is SERVICE_ID
<set name="SERVICES" cascade="all" inverse="true" lazy="true" outer-join="auto">
<key column="ID"/>
<one-to-many class="at.oeamtc.oop.hybernate.Services"/>
</set>
the generated join query is JOB_HDR.JOB_ID = SERVICE.ID and not the wanted one : JOB_HDR.SERVICE_ID = SERVICE.ID

second attempt to use many-to-one
<many-to-one name="services" class="at.oeamtc.oop.hybernate.Services" insert="false" update="false">
<column name="SERVICE_ID"></column>
</many-to-one>
when there is property SERVICE_ID in the mapping file

first complained that there is such a property SERVICE_ID and that update and insert into many-to-one should be set to false; after set to false, it complains that it cannot set the corresponding property (in this case services in JobHeader class)...

the only solution found, to remove the other mapping of SERVICE_ID

and all these to be able to write a join subquery with Criteria API...

-------------------
finally solved:
dual mapping on SERVICE_ID is possible but beside update='false' and insert='false' it is needed also cascade='none':
<many-to-one name="service" class="at.oeamtc.oop.hybernate.Services" cascade="none" insert="false" update="false" >
<column name="SERVICE_ID"></column>
</many-to-one>

getter and setter methods to be defined in java bean class, this time no setter is called in the constructor (as I did the previous time)

and the query is:
Criteria criteria = session.createCriteria(Jobs.class);
//add restrictions / expressions

//join with job_header
criteria = criteria .createCriteria("JOB_HDR");
//add further restrictions / expressions

//join with service:
//note that service is the name of many-to-one relationship in the mapping file
//as above JOB_HDR is many-to-one in the mapping file for jobs
crit = crit.createCriteria("service").add(Expression.eq("IS_57", serviceTypeId));

Tuesday, September 14, 2010

metro (JAX-WS 2.2.) web service - down up approach

starting from java code when generating wsdl by using wsgen, I do not see collection elements in XSD (when only getters are used), i.e.

for
public class Cheque implements java.io.Serializable {

Integer id;
Customer customer;
List chequeRows = new ArrayList();

public get List() {
return chequeRows;
}

//no setter for chequeRows is used
//instead getChequeRows().add() is used to add cheque rows to the list
//...
}

and the result xsd does not have chequeRow elements

to force it - annotation @XMLElement is used:

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;


@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)

public class Cheque implements java.io.Serializable {

@XmlElement
Integer id;

@XmlElement
Customer customer;

@XmlElement
List chequeRows = new ArrayList();

public get List() {
return chequeRows;
}

//no setter for chequeRows is used
//instead getChequeRows().add() is used to add cheque rows to the list
//...
}


also, it is necessary to use @WebParam and @WebResult annotations with name="" otherwise parameters are named 'paramx' and the method result is named 'return';
targetNamespace has to be specified though

Thursday, September 2, 2010

impressed by Sprarx Systems Enterprise Architect v.8

among other nice new features, EA can be used as a project management tool as well
Sparx Systems

Wednesday, September 1, 2010

metro (JAX-WS 2.2.) web service on java5

ok, a web service implemented with JAX-WS 2.2. is deployed and running under
tomcat 7.0.0 and JDK 6.0_21
I am very happy with the performance
but I do need it running on tomcat6 with jre1.5, so...

according to the documentation JAX-WS 2.2. should work on java 5 update 2

0) precondition
metro 2.0.1 is installed

1) compilation

. javax.annotation.PostConstruct and javax.annotation.PreDestroy for java5 may be found in jsr250-api.jar from Sun JWSDP 2.0 (--> \jaxws\lib );
. @Override for interfaces implementation is not supported? -> annotations are commented
-> compilation of the web service with JDK 1.5.0_07 is successful

2) deployment
under tomcat 6.0.18, JRE 1.5.0_07
as written in readme of metro2.0.1 use metro-on-tomcat.xml
just run
ant -Dtomcat.home= -f /metro-on-tomcat.xml uninstall
(which just copy:
. webservices-api.jar and jsr173_api.jar to \endorsed
. webservices-extra.jar, webservices-extra-api.jar, webservices-rt.jar and webservices-tools.jar to \shared\lib
. )

it is working, I am impressed

TODOs

cloud computing: salesforce

Tuesday, August 31, 2010

Apache Wicket

in May I came across Apache Wicket
and I really became a big fan of this framework
in a very short time I was able to rewrite a web application based on another (JSF-based) framework by following the examples from

Wicket in Action
by Martijn Dashorst and Eelco Hillenius

What I found difficult was the migration from the already implemented web application from Wicket 1.3.1 to Wicket 1.4.8

here are some notes I took back then

1) instead of MarkupContainer use WebMarkupContainer (Form.add() does not accept MarkupContainer as an argument)
2) wicket configuration web.xml -> wicket.configuration
3) instead of getModel() and setModel(), getDefaultModel() and setDefaultModel() to be used
4) messages are not displayed -> FeedbackPanel has to be inherited
5) validation -> ListView -> text fields into ListItem
6) Error Page

(why I rewrote the web application - I didn't have this planned, although I didn't like its performance... it always amazes me how a specification, in this case JSF is turned into an implementation, in this case Woodstock and then ICEFaces...)
so, I just started evaluating wicket rewriting a web application that is small from one hand and known to me on other hand. I liked so much wicket, so what was started just an evaluation project, became a replacement of the original implementation. the performance is just great.... and not just that ... it is very pleasant to use wicket !)

Socket Connections over HTTPS

//simple proof-of-the-concept and connection test 2010-07-22
//assumption - certificate already loaded in cacerts file
//@see also java web service security post

package com.yourhost.socket.client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.security.KeyStore;

import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;


public class GB_GRIPSMXWS_SocketClient {

public static final String SOCKET_SERVER_HOST = "www.yourhost.com";
public static int SOCKET_SERVER_PORT = 443;
int timeout = 10000;

/**
* @param args
*/
public static void main(String[] args) {

try {

int port = SOCKET_SERVER_HOST;
String hostname = SOCKET_SERVER_PORT;

char[] passphrase = "changeit".toCharArray();

File file = new File("jssecacerts");
if (file.isFile() == false) {
char SEP = File.separatorChar;
File dir = new File(System.getProperty("java.home") + SEP
+ "lib" + SEP + "security");
file = new File(dir, "jssecacerts");
if (file.isFile() == false) {
file = new File(dir, "cacerts");
}
}
System.out.println("Loading KeyStore " + file + "...");
InputStream in = new FileInputStream(file);
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(in, passphrase);
in.close();
SSLContext context = SSLContext.getInstance("TLS");
TrustManagerFactory tmf =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0];
context.init(null, new TrustManager[] {defaultTrustManager}, null);
SSLSocketFactory factory = context.getSocketFactory();

System.out.println("Opening connection to " + hostname + ":" + port + "...");
SSLSocket socket = (SSLSocket)factory.createSocket(hostname, port);
socket.setSoTimeout(timeout);
try {
System.out.println("Starting SSL handshake...");
socket.startHandshake();
System.out.println();
System.out.println("No errors, certificate is already trusted");

BufferedWriter writer =
new BufferedWriter(new OutputStreamWriter(
socket.getOutputStream()));
BufferedReader reader =
new BufferedReader(new InputStreamReader(
socket.getInputStream()));

// write reply to the output
//hidden -> serialize XML message to the writer
writer.write("");
writer.write("
");
writer.write("OperationName");
writer.write("2009-08-08T09:59:24.854725+01:00");
writer.write("");
writer.write("SenderID");
writer.write("");
writer.write("");
writer.write("");
writer.write("
");
writer.write("
");
writer.write("
");
writer.write("");
//so on
writer.write("
");
writer.write("
");
writer.flush();





String messageLine = null;
while ((messageLine=reader.readLine())!= null) {
System.out.println(messageLine);
}

reader.close();
writer.close();

socket.close();
} catch (SSLException ex) {
System.out.println();
ex.printStackTrace(System.out);
}



} catch (Exception ex) {
ex.printStackTrace();
}
}

}

metro (JAX-WS) web service life cycle

annotations are used (in your Service Implementation Bean)
@PostConstruct
@PreDestroy

(in JAX-RPC java.xml.rpc.server.ServiceLifecycle interface implementation was used for this purpose)

favourite tools

Allround Automations - PL/SQL Developer
Sparks Enterprise Architect
Altova XML Spy
Araxis Merge
eviware soapUI

German-English glossary, Automobile Industry

immer wieder tauchen die gleichen Begriffe auf, naemlich...

Bremsflüssigkeit - brake fluid
Siedepunkt - boiling point
HBA (d.h. Hifsbremseabbremsung) - emergency brake deceleration
KKM-Stand(die) - kilometer reading / odometer reading ?

Friday, August 27, 2010

metro books and resources

Java Web Services: Up and Running
by Martin Kalin
http://oreilly.com/catalog/9780596521134


Title:
Java Web Services: Up and Running
By:
Martin Kalin
Publisher:
O'Reilly Media
Formats:

* Print
* Ebook
* Safari Books Online

Print Release:
February 2009
Ebook Release:
February 2009
Pages:
320
Print ISBN:
978-0-596-52112-7
| ISBN 10:
0-596-52112-X
Ebook ISBN:
978-0-596-80125-0
| ISBN 10:
0-596-80125-4

metro web services - useful links

http://www.javaworld.com/community/node/981

Thursday, August 26, 2010

metro web services

installed JDK 1.6.0.21
metro 2.1

top down approach i.e. starting from WSDL

0. assumption
you have (prepared) WSDL

1.
starting wsimport I get an error message saying that JAX-WS2.2 is required while JAX-WS2.1 is actually available; suggestion either to use -Xendorsed
other solution - to put webservices-api.jar from metro/lib to endorsed lib
(it is interesting that system variable java.endorsed.dirs is not taken into account. endorsed lib in java_home\jre\lib is working though

other problems met
definitions of faults in WSDL

wsimport generates Service Endpoint Interface aka SEI e.g.
@WebService(name = "GRIPSMX", targetNamespace = "http://jetsystems.com/GRIPSMX/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})

2.
to implement it - create a class that implements the interface
(so called Service Implementation Bean aka SIB)
with annotation
@WebService(endpointInterface = "com.jetsystems.gripsmx.GRIPSMX")
and implement the actual web service methods

3. deployment

see
https://jax-ws.dev.java.net/guide/Deploying_Metro_endpoint.html
Deployment Metro Endpoint


a jax-ws web service is deployed as a separate web application with following stucture
WEB-INF/classes/ containing service endpoint interface (SEI) and SIB
WEB-INF/sun-jaxws.xml JAX-WS RI deployment descriptor
WEB-INF/web.xml Web deployment descriptor
WEB-INF/wsdl/[subdir with a name = of SIB]/ WSDL and XSD

e.g.
GRIPSMX/WEB-INF/classes/
GRIPSMX/WEB-INF/sun-jaxws.xml
GRIPSMX/WEB-INF/web.xml
GRIPSMX/WEB-INF/wsdl/GRIPSMXImplementation/GRIPSMX.wsdl
GRIPSMX/WEB-INF/wsdl/GRIPSMXImplementation/GRIPSMX.xsd

e.g. sun-jaxws.xml

<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="com.jetsystems.gripsmx.GRIPSMXImplementation" name="GRIPSMX" url-pattern="/GRIPSMX"/>
</endpoints>

and web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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/web-app_2_5.xsd">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>GRIPSMX</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>GRIPSMX</servlet-name>
<url-pattern>/GRIPSMX</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

where url-pattern in sun-jaxws.xml must match url-pattern in web.xml

http://localhost:8080/GRIPSMX/GRIPSMX?wsdl

Wednesday, August 25, 2010

ant javac

by default without line numbers
to switch it on e.g.

debug="true" debuglevel="lines,vars,source"

Hibernate and Tomcat Database Connection Pooling

1. Tomcat Database Connection Pooling (should have been an older post)
usage in a web application

1a. define db connection in context.xml in META-INF

e.g.
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/gripswsmx-hibernated">
<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/GRIPSHI" password="gripshi" type="javax.sql.DataSource" url="jdbc:oracle:thin:@192.168.2.94:1521:ORCL" username="gripshi" validationQuery="select 1 from dual"/>
</Context>

note that Context path must correspond to the web application name
validationQuery is vital to keep the connection alive

once deployed this file is moved to catalina conf/Catalina/localhost under the name of the web application / context path - so, if there are changes in db connection this file has to be edited (to avoid a new deployment)

1b. in web.xml define the connection name e.g. jdbc/GRIPSHI

<resource-ref>
<description>GRIPS MX web service DataSource Reference</description>
<res-ref-name>jdbc/GRIPSHI</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

2. Hibernate
in hibernate.properties or in hibernate.cfg.xml
2a) specify properties
hibernate.dialect
hibernate.connection.datasource pointing to the name specified in web.xml

e.g. in hibernate.cfg.xml
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/GRIPSHI</property>

2b) make sure the rest of hibernate properties for db connection
i.e.
hibernate.connection.driver_class
hibernate.default_schema
hibernate.connection.url
hibernate.connection.username
hibernate.connection.password
are omitted


see also Using Hibernate with Tomcat - C3P0 connection pool

Wednesday, August 4, 2010

Hibernate Tools

eclipse plugin
https://www.jboss.org/tools/download/stable.html

for eclipse Ganymede 3.4 - this release
https://www.jboss.org/tools/download/stable/3_0_GA.html
add site - http://download.jboss.org/jbosstools/updates/JBossTools-3.0.3.GA/

for Eclipse Helios 3.6. - 3.1. release - asks for another plugin

soapUI - parametrized tests

my goal was parametrized load tests - because of the data validation done by the web service it is not possible to run the same tests over and over again

some web sites

http://stackoverflow.com/questions/945403/soapui-getting-request-parameters-in-mock-service-script

http://www.soapui.org/Functional-Testing/working-with-scripts.html

http://groovyinsoapui.wordpress.com/2008/09/30/load-testing-with-soap-request-having-variable-parameters/

http://soa.dzone.com/articles/functional-web-services-1?page=0,5

was I accomplish was not much but:

1. TestSuite -> Test Case -> new Test Step 'Properties' - moved to the first place
defined new parameters:

receiptDateStr date e.g. 2010-08-04
receiptNumber numer e.g. 1

2. TestSuite -> Test Case -> Test Case Editor -> Setup Script added script that initialize the properties values:


log.info("In the Test Case IssueCheque Setup Script")
today = new Date()
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd")
receiptDate = sdf.format(today)
log.info("In the Test Test Case IssueCheque Setup Script: receiptDate = " + receiptDate)

targetStep = testRunner.testCase.getTestStepByName( "Properties" )
// transfer all properties
targetStep.setPropertyValue( "receiptDateStr", receiptDate)

receiptNumber = Integer.valueOf(targetStep.getPropertyValue("receiptNumber"))
log.info("In the Test Test Case IssueCheque Setup Script: last receiptNumber = " + receiptNumber)
receiptNumber = receiptNumber + 1
log.info("In the Test Test Case IssueCheque Setup Script: current receiptNumber = " + receiptNumber)
targetStep.setPropertyValue( "receiptNumber", String.valueOf(receiptNumber))

log.info(receiptDate)

3. In the test case IssueCheque that follows Properties I replaced actual values with parameters referecences:

${Properties#receiptNumber}
${Properties#receiptDateStr}

Monday, August 2, 2010

readonly attribute of a folder on XP

http://support.microsoft.com/?id=326549

Thursday, July 29, 2010

MSDN for .NET 4

http://msdn.microsoft.com/en-us/library/w0x726c2.aspx

nettcp binding in IIS7

binding information:


[protocol='https',bindingInformation='*:443:']

[protocol='net.tcp',bindingInformation='808:*']


see http://www.iis.net/ConfigReference/system.applicationHost/sites/site/bindings/binding


http://www.devx.com/codemag/Article/33655/1763/page/6



C:\>Windows\System32\inetsrv\appcmd list config -section:Sytes/


C:\>Windows\System32\inetsrv\appcmd set app "testWS/MultipleServiceWCF" /enabledProtocols:http.net.tcp

Monday, July 26, 2010

Creating .NET web service with Visual Studio 2010




http://carvingcode.blogspot.com/2010/04/creating-wcf-web-service-with-vs2010.html

see also
http://msdn.microsoft.com/en-us/library/ms733133.aspx


WCF:
http://www.code-magazine.com/Article.aspx?quickid=060123

Thursday, July 15, 2010

IT Begriffe auf Deutsch

Interface - Schnittstelle
Web Service calls - Aufruf über Webservice [Schnittstelle]
GUI - grafische Benutzeroberfläche

Tuesday, January 5, 2010

org.apache.xml.security.c14n.InvalidCanonicalizerException

got org.apache.xml.security.c14n.InvalidCanonicalizerException
needed the following jar files in classpath

xws-security_jaxrpc.jar
xalan.jar
xercesImpl.jar