|
 |
 |
Documentation |
 |
 |
QuestCore is a set of utility classes and components to help developers building
their Java applications. To run the component in an application server, you need a server that supports EJB 2.0. |
 |
 |
Classes |
 |
 |
 |
ContextUtils: |
Management of JNDI Contexts. |
 |
 |
DataSourceFactory: |
A factory for creating and caching access to datasources. |
 |
 |
EJBHomeFactory: |
A factory for creating and caching access to EJBs. |
 |
 |
EJBUtils: |
Management of EJBs |
 |
 |
JMSUtils: |
Management of JMS Connections, Queues and Sessions. |
 |
 |
NumberingManager: |
Generation of Sequences for using in tables, or other stuff (just with Session Beans). |
 |
 |
SequencerManager: |
Generation of Sequences for using in tables, or other stuff (using Entity Beans). |
 |
 |
DataSet: |
Keeping the information about a database result in a DataSet (various rows and columns). |
 |
 |
DynamicQuery: |
Construct a sql query dynamically. |
 |
 |
SQLUtil: |
Management of ResultSet, PreparedStatement, Connection, etc... |
 |
 |
CompressUtil: |
Zip and Unzip files trought Java. |
 |
 |
DateUtils: |
Management of Date formats and transformations. |
 |
 |
FileUtils: |
Management of file creation, deletion, listing, copying, etc... |
 |
 |
MimeType: |
Discouver the MimeType associated with a determined extension. |
 |
 |
XMLUtils: |
Utilities for XML Parsing and transformation. |
|
 |
 |
ContextUtils |
 |
 |
//Get an initial context
Context ctx = ContextUtils.getRootContext();
//Lookup an entry in the jndi tree
String str = (String)ContextUtils.lookup(ctx,"name",String.class);
//Close the context, ignoring the exception
ContextUtils.close(ctx);
|
 |
|
 |
|
 |
|
 |
 |
NumberingManager |
 |
 |
An EJB to generate a sequencial number using a configuration in a database table. This EJB only used JDBC and not entity beans.
//Look for the EJB
EJBHomeFactory ejbfact = EJBHomeFactory.getInstance();
NumberingManagerHome home = ejbfact.lookup("pt.jcodeutil.core.numbering.NumberingManagerHome",NumberingManagerHome.class);
NumberingManager numbering = home.create();
//Get the sequence
long sequenceid = numbering.getNextID("key","DataSource JNDI Name");
|
 |
|
 |
 |
SequencerManager |
 |
 |
An EJB to generate a sequencial number using a configuration in a database table. This EJB uses entity beans.
//Look for the EJB
EJBHomeFactory ejbfact = EJBHomeFactory.getInstance();
SequencerManagerHome home = ejbfact.lookup("pt.jcodeutil.core.numbering.ent.SequencerManagerHome",SequencerManagerHome.class);
SequencerManager sequencer = home.create();
//Get the sequence
long sequenceid = sequencer.nextValue("key");
|
 |
|
 |
|
 |
 |
DateUtils |
 |
 |
//Add days, months and years to dates (Date or Timestamp)
long lnow = System.currentTimeMillis();
Timestamp tstart = new Timestamp(lnow);
java.util.Date dstart = new java.util.Date(lnow);
Timestamp tend = DateUtils.addDaysToTimestamp(tstart,1);
java.util.Date dend = DateUtils.addDaysToUtilDate(dstart,1);
tend = DateUtils.addMonthToTimestamp(tstart,1);
dend = DateUtils.addMonthToUtilDate(dstart,1);
tend = DateUtils.addValueToTimestamp(tstart,1000, Calendar.MILLISECOND);
dend = DateUtils.addValueToUtilDate(dstart,1000, Calendar.MILLISECOND);
tend = DateUtils.addYearToTimestamp(tstart,5);
dend = DateUtils.addYearToUtilDate(dstart,5);
|
 |
|
 |
|
 |
|