public class SocketServerInterface extends java.lang.Object implements ServerInterface
Modifier and Type | Class and Description |
---|---|
private class |
SocketServerInterface.PingThread |
Modifier and Type | Field and Description |
---|---|
private ErrorHandler |
errorHandler |
private boolean |
gzip |
private java.lang.String |
host |
private java.io.InputStream |
in |
private javax.crypto.SecretKey |
key |
private java.io.InputStream |
originalIn |
private java.util.Hashtable |
originalTimes |
private java.io.OutputStream |
out |
private long |
pingdelay |
private int |
port |
private java.net.Socket |
s |
private java.lang.StringBuffer |
session |
private TopicMap |
tm |
private boolean |
uncommitted |
Constructor and Description |
---|
SocketServerInterface() |
SocketServerInterface(java.lang.String host,
int port)
Creates a new instance of SocketServerInterface
|
SocketServerInterface(java.lang.String host,
int port,
long pingdelay) |
Modifier and Type | Method and Description |
---|---|
void |
applySession(java.lang.StringBuffer session) |
void |
checkTopics(TopicMap tm) |
boolean |
cipher() |
void |
clearCache() |
boolean |
clearTopicMap() |
void |
close() |
void |
commit(boolean force) |
void |
connect() |
java.lang.String |
customCommand(java.lang.String command) |
static java.lang.String |
decode(java.lang.String sis) |
boolean |
delete(java.lang.String filename) |
static java.lang.String |
encode(java.lang.String sis) |
private Topic |
fetchTopic(java.lang.String topicSI) |
private Topic[] |
fetchTopics(java.lang.String[] topicSIs) |
private Topic[] |
fetchTopicsOfType(java.lang.String typeSI) |
boolean |
fileExists(java.lang.String file) |
java.lang.StringBuffer |
getSession() |
java.lang.String |
getTimeStamp(Topic t) |
Topic |
getTopic(java.lang.String topicSI) |
Topic |
getTopicByName(java.lang.String name) |
Topic[] |
getTopics(java.lang.String[] topicSIs) |
Topic[] |
getTopicsOfType(java.lang.String typeSI) |
private java.lang.String |
getTransferableSI(Topic t) |
boolean |
gzip() |
void |
handleServerError(java.lang.Exception e) |
private void |
initialize() |
private void |
initializeTopicMap() |
boolean |
isConnected() |
boolean |
isUncommitted() |
java.lang.String[] |
listDirectories(java.lang.String dir) |
java.lang.String[] |
listFiles(java.lang.String dir) |
boolean |
login(java.lang.String user,
java.lang.String password) |
void |
mergeIn(TopicMap tm) |
boolean |
needLogin() |
boolean |
openTopicMap(java.lang.String key) |
boolean |
ping() |
private java.lang.String |
readLine() |
static java.lang.String |
readLine(java.io.InputStream in) |
private void |
readTopicMapIn() |
void |
removeAssociation(Association a) |
void |
removeBaseName(Topic t) |
void |
removeData(Topic t,
Topic type,
Topic version) |
void |
removeSubjectIdentifier(Topic t,
Locator l) |
void |
removeSubjectLocator(Topic t) |
void |
removeTopic(Topic t) |
void |
removeTopicType(Topic t,
Topic type) |
void |
removeVariantName(Topic t,
java.util.Collection scope) |
void |
rollback() |
java.lang.String[] |
search(java.lang.String query) |
void |
setServerErrorHandler(ErrorHandler handler) |
java.lang.String |
upload(java.io.InputStream in,
java.lang.String filename,
long length) |
java.lang.String |
upload(java.io.InputStream in,
java.lang.String filename,
long length,
boolean overwrite) |
void |
writelog(java.lang.String lvl,
java.lang.String msg) |
boolean |
writeTopicMapTo(java.io.OutputStream tmout) |
private TopicMap tm
private java.net.Socket s
private java.io.InputStream in
private java.io.InputStream originalIn
private java.io.OutputStream out
private java.util.Hashtable originalTimes
private long pingdelay
private boolean uncommitted
private boolean gzip
private javax.crypto.SecretKey key
private java.lang.StringBuffer session
private ErrorHandler errorHandler
private java.lang.String host
private int port
public SocketServerInterface(java.lang.String host, int port) throws java.io.IOException
java.io.IOException
public SocketServerInterface(java.lang.String host, int port, long pingdelay) throws java.io.IOException
java.io.IOException
public SocketServerInterface() throws java.io.IOException
java.io.IOException
public void connect() throws java.io.IOException
connect
in interface ServerInterface
java.io.IOException
private void initialize() throws java.io.IOException
java.io.IOException
private void initializeTopicMap()
public void checkTopics(TopicMap tm) throws ServerException
checkTopics
in interface ServerInterface
ServerException
public java.lang.String getTimeStamp(Topic t)
public void commit(boolean force) throws WandoraException, ServerException
commit
in interface ServerInterface
WandoraException
ServerException
private java.lang.String readLine() throws java.io.IOException
java.io.IOException
public static java.lang.String readLine(java.io.InputStream in) throws java.io.IOException
java.io.IOException
private Topic fetchTopic(java.lang.String topicSI) throws ServerException
ServerException
private void readTopicMapIn() throws java.io.IOException, TopicMapException
java.io.IOException
TopicMapException
private Topic[] fetchTopicsOfType(java.lang.String typeSI) throws ServerException
ServerException
private Topic[] fetchTopics(java.lang.String[] topicSIs) throws ServerException
ServerException
public Topic getTopic(java.lang.String topicSI) throws ServerException
getTopic
in interface ServerInterface
ServerException
public Topic[] getTopics(java.lang.String[] topicSIs) throws ServerException
getTopics
in interface ServerInterface
ServerException
public Topic[] getTopicsOfType(java.lang.String typeSI) throws ServerException
getTopicsOfType
in interface ServerInterface
ServerException
public void mergeIn(TopicMap tm) throws ServerException
mergeIn
in interface ServerInterface
ServerException
public void removeAssociation(Association a) throws ServerException
removeAssociation
in interface ServerInterface
ServerException
public void removeData(Topic t, Topic type, Topic version) throws ServerException
removeData
in interface ServerInterface
ServerException
public void removeTopic(Topic t) throws ServerException
removeTopic
in interface ServerInterface
ServerException
public void removeVariantName(Topic t, java.util.Collection scope) throws ServerException
removeVariantName
in interface ServerInterface
ServerException
public void removeBaseName(Topic t) throws ServerException
removeBaseName
in interface ServerInterface
ServerException
public void rollback() throws ServerException
rollback
in interface ServerInterface
ServerException
public Topic getTopicByName(java.lang.String name) throws ServerException
getTopicByName
in interface ServerInterface
ServerException
public void removeSubjectLocator(Topic t) throws ServerException
removeSubjectLocator
in interface ServerInterface
ServerException
public void removeTopicType(Topic t, Topic type) throws ServerException
removeTopicType
in interface ServerInterface
ServerException
public boolean clearTopicMap() throws ServerException
clearTopicMap
in interface ServerInterface
ServerException
public void clearCache()
clearCache
in interface ServerInterface
public void writelog(java.lang.String lvl, java.lang.String msg) throws ServerException
writelog
in interface ServerInterface
ServerException
public boolean writeTopicMapTo(java.io.OutputStream tmout) throws java.io.IOException, ServerException
writeTopicMapTo
in interface ServerInterface
java.io.IOException
ServerException
public java.lang.String upload(java.io.InputStream in, java.lang.String filename, long length) throws ServerException
ServerException
public java.lang.String upload(java.io.InputStream in, java.lang.String filename, long length, boolean overwrite) throws ServerException
upload
in interface ServerInterface
ServerException
public java.lang.String[] listDirectories(java.lang.String dir) throws ServerException
listDirectories
in interface ServerInterface
ServerException
public java.lang.String[] listFiles(java.lang.String dir) throws ServerException
listFiles
in interface ServerInterface
ServerException
public boolean fileExists(java.lang.String file) throws ServerException
fileExists
in interface ServerInterface
ServerException
public boolean delete(java.lang.String filename) throws ServerException
delete
in interface ServerInterface
ServerException
public boolean gzip() throws ServerException
gzip
in interface ServerInterface
ServerException
public boolean cipher() throws ServerException
cipher
in interface ServerInterface
ServerException
public boolean login(java.lang.String user, java.lang.String password) throws ServerException
login
in interface ServerInterface
ServerException
public boolean needLogin()
needLogin
in interface ServerInterface
public boolean openTopicMap(java.lang.String key) throws ServerException
openTopicMap
in interface ServerInterface
ServerException
public void removeSubjectIdentifier(Topic t, Locator l) throws ServerException
removeSubjectIdentifier
in interface ServerInterface
ServerException
public java.lang.String customCommand(java.lang.String command) throws ServerException
customCommand
in interface ServerInterface
ServerException
public boolean ping() throws ServerException
ServerException
public boolean isUncommitted()
isUncommitted
in interface ServerInterface
public java.lang.String[] search(java.lang.String query) throws ServerException
search
in interface ServerInterface
ServerException
public void close() throws ServerException
close
in interface ServerInterface
ServerException
public java.lang.StringBuffer getSession()
getSession
in interface ServerInterface
public void setServerErrorHandler(ErrorHandler handler)
setServerErrorHandler
in interface ServerInterface
public void handleServerError(java.lang.Exception e)
handleServerError
in interface ServerInterface
public boolean isConnected()
isConnected
in interface ServerInterface
public void applySession(java.lang.StringBuffer session) throws ServerException
applySession
in interface ServerInterface
ServerException
private java.lang.String getTransferableSI(Topic t)
public static java.lang.String decode(java.lang.String sis)
public static java.lang.String encode(java.lang.String sis)
Copyright 2004-2015 Wandora Team