-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/ceridwen-standard-interchange-protocol-library-…
…2.9.3'
- Loading branch information
Showing
27 changed files
with
1,225 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,126 @@ | ||
## ceridwen-standard-interchange-protocol-library | ||
## Ceridwen 3M SIP Circulation Library for Java | ||
|
||
Java Implementation of the 3M SIP2 and NISO SIP3 Protocols for library circulation and self-check facilities. | ||
3M SIP is an industry standard protocol by 3M to allow automatec check out terminals communicate with library systems. | ||
|
||
The Ceridwen 3M SIP Circulation Library for Java is an Open Source (GPL v3) implementation of the 3M SIP version 2 protocol (also known as SIP2). It includes both client and server implementations and support both telnet and socket based communications. | ||
|
||
### Problems and Issues | ||
|
||
For general problems please contact [[email protected]](mailto:[email protected]). For bugs and feature requests, please use our [online issue tracker](). | ||
|
||
### License | ||
|
||
The Ceridwen Self Issue Client is available as open source under [GPL v3](http://www.gnu.org/licenses/gpl.html). Contact [[email protected]](mailto:[email protected]) for other licensing options. | ||
|
||
### Sample Application | ||
|
||
The following hava code demonstrates the use of the library. It starts up a simple server implementation, and then uses the client API to check out a book. | ||
|
||
```java | ||
public class Sample { | ||
|
||
public static void main(String[] args) { | ||
try { | ||
System.setProperty("com.ceridwen.circulation.SIP.charset", "ISO8859_1"); | ||
|
||
SIPDaemon server; | ||
|
||
// Run netty server | ||
server = new SIPDaemon("Sample", "localhost", 12345, false, new DummyDriverFactory(), true); | ||
server.start(); | ||
|
||
// Do sample checkout | ||
Sample.checkOut(); | ||
|
||
// Shut down netty server | ||
server.stop(); | ||
} catch (Exception ex) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex); | ||
} | ||
} | ||
|
||
public static void checkOut() { | ||
/** | ||
* Now try basic client commands | ||
*/ | ||
SocketConnection connection; | ||
|
||
connection = new SocketConnection(); | ||
connection.setHost("localhost"); | ||
connection.setPort(12345); | ||
connection.setConnectionTimeout(30000); | ||
connection.setIdleTimeout(30000); | ||
connection.setRetryAttempts(2); | ||
connection.setRetryWait(500); | ||
|
||
try { | ||
connection.connect(); | ||
} catch (Exception ex) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex); | ||
return; | ||
} | ||
|
||
/** | ||
* It is necessary to send a SC Status with protocol version 2.0 else server | ||
* will assume 1.0) | ||
*/ | ||
SCStatus scStatusRequest = new SCStatus(); | ||
scStatusRequest.setProtocolVersion(ProtocolVersion.VERSION_2_00); | ||
|
||
Message scStatusResponse; | ||
|
||
try { | ||
scStatusResponse = connection.send(scStatusRequest); | ||
} catch (RetriesExceeded | ConnectionFailure | MessageNotUnderstood | ChecksumError | SequenceError | MandatoryFieldOmitted | InvalidFieldLength ex) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex); | ||
return; | ||
} | ||
|
||
if (!(scStatusResponse instanceof ACSStatus)) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, "Error - Status Request did not return valid response from server."); | ||
return; | ||
} | ||
|
||
/** | ||
* For debugging XML handling code (but could be useful in Cocoon) | ||
*/ | ||
scStatusResponse.xmlEncode(System.out); | ||
|
||
/** | ||
* Check if the server can support checkout | ||
*/ | ||
if (!((ACSStatus) scStatusResponse).getSupportedMessages().isSet(SupportedMessages.CHECK_OUT)) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, "Check out not supported"); | ||
return; | ||
} | ||
|
||
CheckOut checkOutRequest = new CheckOut(); | ||
|
||
/** | ||
* Now try a checkout request | ||
*/ | ||
checkOutRequest.setPatronIdentifier("2000000"); | ||
checkOutRequest.setItemIdentifier("300000000"); | ||
checkOutRequest.setSCRenewalPolicy(Boolean.TRUE); | ||
checkOutRequest.setTransactionDate(new Date()); | ||
|
||
Message checkOutResponse; | ||
|
||
try { | ||
checkOutResponse = connection.send(checkOutRequest); | ||
} catch (RetriesExceeded | ConnectionFailure | MessageNotUnderstood | ChecksumError | SequenceError | MandatoryFieldOmitted | InvalidFieldLength ex) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex); | ||
return; | ||
} | ||
|
||
if (!(checkOutResponse instanceof CheckOutResponse)) { | ||
Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, "Error - CheckOut Request did not return valid response from server"); | ||
return; | ||
} | ||
checkOutResponse.xmlEncode(System.out); | ||
|
||
connection.disconnect(); | ||
} | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.