f8361ab20111f95079e44158a768b225f8edb642
[mediacube.git] /
1 package user.commons.nexio.server.protocol;
2
3 import java.io.IOException;
4 import java.util.Calendar;
5 import java.util.List;
6
7 public class NexioServerProtocolImpl implements NexioServerProtocol {
8
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;
18         
19         private Connection connection = null;
20         
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); 
32         }
33
34         @Override
35         public Calendar executeGetExtendedFieldGetModifiedTimestamp(Id id) throws IOException, ProtocolException {
36                 return getExtendedFieldGetModifiedTimestampCommand.execute(id);
37         }
38
39         @Override
40         public Xid executeGetExtendedIDFromIDHandle(Id id) throws IOException, ProtocolException {
41                 return getExtendedIDFromIDHandleCommand.execute(id);
42         }
43
44         @Override
45         public Id executeGetIDHandleFromExtendedID(Xid xid) throws IOException, ProtocolException {
46                 return getIDHandleFromExtendedIDCommand.execute(xid);
47         }
48
49         @Override
50         public byte[] executeGetIDMetadata(Id id) throws IOException, ProtocolException {
51                 return getIDMetadataCommand.execute(id);
52         }
53
54         @Override
55         public Id executeListFirstIDHandle() throws IOException, ProtocolException {
56                 return listFirstIDHandleCommand.execute();
57         }
58
59         @Override
60         public Id executeListNextIDHandle() throws IOException, ProtocolException {
61                 return listNextIDHandleCommand.execute();
62         }
63
64         @Override
65         public long executeGetIDFileSizeCommand(Id id) throws IOException, ProtocolException {
66                 return getIDFileSizeCommand.execute(id);
67         }
68
69         @Override
70         public byte executePortStatusCommand() throws IOException, ProtocolException{
71                 return portStatusCommand.execute(); 
72         }
73
74         @Override
75         public byte[] executeGetExtendedFieldCommand(Id id, byte[] fieldNumber) throws IOException, ProtocolException{
76                 return getExtendedFieldCommand.execute(id, fieldNumber); 
77         }
78         
79         
80         @Override
81         public Connection getConnection(){;
82                 return this.connection;
83         }
84
85         
86 }