Friday, March 9, 2007

LPTRA

And for EE fanatics I've implemented the resource adapter (JCA 1.5 with CCI), a right-way to access parallel port from inside EE applications. To use it, you need UParPort library installed. Then, simply deploy this RAR (resource adapter archive) into your application server. When you have done it, create a datasource for the LPTRA. You will have to specify pin names, while you are creating the datasource, like this: 1PinName=eye1, 2PinName=eye2 and so on. That's all. You may download the sources of the LPTRA as well.

Example:

@Resource (name = "eis/ParPort")
private ConnectionFactory connFactory;

Connection conn = null;
try {
conn = connFactory.getConnection();
Interaction interaction = conn.createInteraction ();
MappedRecord r =
connFactory.getRecordFactory ().createMappedRecord ("");

r.put ("eye1", true); // turn eye1 pin into the on state
r.put ("eye2", false); // turn eye2 off
interaction.execute (null, r);
} catch (ResourceException e) {
e.printStackTrace (); // Not sexy
} finally {
if (conn != null) {
try {
conn.close();
} catch (ResourceException e) {
e.printStackTrace (); // Not sexy
}
}
}

1 comment:

  1. Excessive injection velocity will cause burning or thermal decomposition of the plastic materials. Also, poor glossiness, weld traces, and discoloration are some problems ensuing from an excessively elevated velocity. In addition, separating the molded parts causes the manufacturing value to extend. On the other hand, low pressure results in an increase in mould shrinkage, thus, resulting in intolerable elements with inferior qualities. Keep these components in thoughts when designing your injection molded half, and {remember that|keep in thoughts that|do not overlook Direct CNC that} it is simpler to keep away from problems to start with} than change your design down the road.

    ReplyDelete