1 package user.commons.nexio.server.protocol;
3 import java.io.IOException;
4 import java.util.Calendar;
7 public class NexioServerProtocolImpl implements NexioServerProtocol {
9 private GetExtendedIDFromIDHandleCommand getExtendedIDFromIDHandleCommand = null;
10 private GetIDMetadataCommand getIDMetadataCommand = null;
11 private GetIDHandleFromExtendedIDCommand getIDHandleFromExtendedIDCommand = null;
12 private GetExtendedFieldGetModifiedTimestampCommand getExtendedFieldGetModifiedTimestampCommand = null;
13 private ListFirstIDHandleCommand listFirstIDHandleCommand = null;
14 private ListNextIDHandleCommand listNextIDHandleCommand = null;
15 private GetIDFileSizeCommand getIDFileSizeCommand = null;
16 private PortStatusCommand portStatusCommand = null;
17 private GetExtendedFieldCommand getExtendedFieldCommand = null;
19 private Connection connection = null;
21 public NexioServerProtocolImpl(Connection _connection) {
22 this.connection = _connection;
23 getExtendedIDFromIDHandleCommand = new GetExtendedIDFromIDHandleCommand(connection);
24 getIDMetadataCommand = new GetIDMetadataCommand(connection);
25 getIDHandleFromExtendedIDCommand = new GetIDHandleFromExtendedIDCommand(connection);
26 getExtendedFieldGetModifiedTimestampCommand = new GetExtendedFieldGetModifiedTimestampCommand(connection);
27 listFirstIDHandleCommand = new ListFirstIDHandleCommand(connection);
28 listNextIDHandleCommand = new ListNextIDHandleCommand(connection);
29 getIDFileSizeCommand = new GetIDFileSizeCommand(connection);
30 portStatusCommand = new PortStatusCommand(connection);
31 getExtendedFieldCommand = new GetExtendedFieldCommand(connection);
35 public Calendar executeGetExtendedFieldGetModifiedTimestamp(Id id) throws IOException, ProtocolException {
36 return getExtendedFieldGetModifiedTimestampCommand.execute(id);
40 public Xid executeGetExtendedIDFromIDHandle(Id id) throws IOException, ProtocolException {
41 return getExtendedIDFromIDHandleCommand.execute(id);
45 public Id executeGetIDHandleFromExtendedID(Xid xid) throws IOException, ProtocolException {
46 return getIDHandleFromExtendedIDCommand.execute(xid);
50 public byte[] executeGetIDMetadata(Id id) throws IOException, ProtocolException {
51 return getIDMetadataCommand.execute(id);
55 public Id executeListFirstIDHandle() throws IOException, ProtocolException {
56 return listFirstIDHandleCommand.execute();
60 public Id executeListNextIDHandle() throws IOException, ProtocolException {
61 return listNextIDHandleCommand.execute();
65 public long executeGetIDFileSizeCommand(Id id) throws IOException, ProtocolException {
66 return getIDFileSizeCommand.execute(id);
70 public byte executePortStatusCommand() throws IOException, ProtocolException{
71 return portStatusCommand.execute();
75 public byte[] executeGetExtendedFieldCommand(Id id, byte[] fieldNumber) throws IOException, ProtocolException{
76 return getExtendedFieldCommand.execute(id, fieldNumber);
81 public Connection getConnection(){;
82 return this.connection;