Skip to content

Commit

Permalink
11.5.0
Browse files Browse the repository at this point in the history
1) This version fully implements mandat macanism.
2) This also correct issues #18, #23 and #31.
3) Upgrade mecanism permitting workers to upgrade to server version by downloading server jar file has been successfully retested.
4) Was not able to reproduce issue #30 .
  • Loading branch information
lodygens committed Nov 29, 2017
2 parents 489b224 + 32117c5 commit decd15e
Show file tree
Hide file tree
Showing 54 changed files with 2,542 additions and 915 deletions.
4 changes: 2 additions & 2 deletions build/VERSION
@@ -1,4 +1,4 @@
major=11
minor=4
micro=1
minor=5
micro=0
branch=head
Binary file added doc/XWHEP-10.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion docker/client/Dockerfile
Expand Up @@ -38,7 +38,7 @@ LABEL description="This creates a Docker image for the XWHEP client"

EXPOSE 4327

ENV XWVERSION "11.4.1"
ENV XWVERSION "11.5.0"


RUN apt-get update
Expand Down
2 changes: 1 addition & 1 deletion docker/master/Dockerfile
Expand Up @@ -42,7 +42,7 @@ LABEL version="0.4"
LABEL description="This downloads and compiles XWHEP server"
EXPOSE 4321 4322 4323 443

ENV XWVERSION "11.4.1"
ENV XWVERSION "11.5.0"

# next is only to check file is present
# before getting time to apt-get update etc.
Expand Down
2 changes: 1 addition & 1 deletion docker/master/build.sh
Expand Up @@ -100,7 +100,7 @@ END_OF_USAGE
trap fatal SIGINT SIGTERM


XWVERSION="${XWVERSION}"
XWVERSION="11.5.0"
ROOTDIR="$(dirname "$0")"
SCRIPTNAME="$(basename "$0")"

Expand Down
2 changes: 1 addition & 1 deletion docker/server/Dockerfile
Expand Up @@ -37,7 +37,7 @@ LABEL "author"="Oleg Lodygensky"
LABEL version="0.4"
LABEL description="This creates a Docker image for the XWHEP server"
EXPOSE 4321 4322 4323 443
ENV XWVERSION "11.4.1"
ENV XWVERSION "11.5.0"

ADD . /xwhep
WORKDIR /xwhep
Expand Down
2 changes: 1 addition & 1 deletion docker/worker/Dockerfile
Expand Up @@ -37,7 +37,7 @@ LABEL version="0.3"
LABEL description="This creates a Docker image for the XWHEP worker"
EXPOSE 4324 443

ENV XWVERSION "11.4.1"
ENV XWVERSION "11.5.0"


#
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/xtremweb/client/Client.java
Expand Up @@ -844,7 +844,8 @@ private void chmod() throws IOException, ClassNotFoundException, ParseException,
final XWAccessRights rights = obj.getAccessRights();
rights.chmod(modstr);
obj.setAccessRights(rights);
final XMLRPCCommandSend cmd = new XMLRPCCommandSend(uri, obj);
// final XMLRPCCommandSend cmd = new XMLRPCCommandSend(uri, obj);
final XMLRPCCommandSend cmd = XMLRPCCommandSend.newCommand(uri, obj);
commClient().send(cmd);
}
}
Expand Down Expand Up @@ -2954,6 +2955,7 @@ private void ping() throws InvalidKeyException, AccessControlException, IOExcept
private void workRequest() throws IOException {

try {
config.getHost().setAcceptBin(true);
final WorkInterface work = commClient().workRequest(config.getHost());
println("Work received: " + work.toXml());
} catch (final Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/xtremweb/client/HelloWorld.java
Expand Up @@ -215,7 +215,7 @@ private void execute() throws IOException {
// 1st, send data definition
//
logger.info("Sending data '" + inputFileName + "' : " + data.toXml());
final XMLRPCCommandSend cmdSend = new XMLRPCCommandSend(dataUri, data);
final XMLRPCCommandSend cmdSend = XMLRPCCommandSend.newCommand(dataUri, data);
cmdSend.exec(client);
//
// then send data content
Expand All @@ -242,7 +242,7 @@ private void execute() throws IOException {

logger.info("Submitting a new work for application '" + appUid + "' : " + work.toXml());

final XMLRPCCommandSend cmdSend = new XMLRPCCommandSend(uri, work);
final XMLRPCCommandSend cmdSend = XMLRPCCommandSend.newCommand(uri, work);
cmdSend.exec(client);
logger.info("Submitted " + work.getUID());

Expand Down
16 changes: 12 additions & 4 deletions src/main/java/xtremweb/common/XWConfigurator.java
Expand Up @@ -959,6 +959,7 @@ private void refresh(final boolean firstTime)
logger.fatal("Private key error");
}

XWTools.deleteDir(getTmpDir());
setTmpDir();

currentDispatcher = 0;
Expand Down Expand Up @@ -1384,10 +1385,17 @@ public File extractResource(final String resName, final File file) throws IOExce
* @since 7.0.0
*/
public void setTmpDir() throws IOException {
final File dir = new File(getProperty(XWPropertyDefs.TMPDIR), "XW." + XWRole.getMyRole().toString() + "."
+ UID.getMyUid().toString() + "." + ((Vector<String>) dispatchers).elementAt(currentDispatcher));

setTmpDir(dir);
final String dirname = "XW." + XWRole.getMyRole().toString() + "."
+ UID.getMyUid().toString() + "." + ((Vector<String>) dispatchers).elementAt(currentDispatcher);
final String parent = getProperty(XWPropertyDefs.TMPDIR) == null ? System.getProperty(XWPropertyDefs.JAVATMPDIR) : getProperty(XWPropertyDefs.TMPDIR);
if (parent.endsWith(dirname)) {
final File dir = new File(parent);
setTmpDir(dir);
}
else {
final File dir = new File(parent, dirname);
setTmpDir(dir);
}
}

public void setTmpDir(final String dir) throws IOException {
Expand Down
26 changes: 11 additions & 15 deletions src/main/java/xtremweb/common/XWTools.java
Expand Up @@ -880,27 +880,23 @@ public static KeyStore setCACertificateEntries(final KeyStore store) {
final X509Certificate[] gcerts = XWTools.retrieveCertificates(GOOGLE_ADDR, false);
for (int i = 0; i < gcerts.length; i++) {
final X509Certificate cert = gcerts[i];
try {
final String alias = cert.getSubjectDN().toString();
logger.finest("KeyStore set entry= " + alias + "; KeyStore.size = " + store.size());
store.setCertificateEntry(alias, cert);
} catch (final Exception e) {
logger.exception("Can't add new entry to keystore", e);
}
final String alias = cert.getSubjectDN().toString();
logger.finest("KeyStore set entry= " + alias + "; KeyStore.size = " + store.size());
store.setCertificateEntry(alias, cert);
}
} catch (final Exception e) {
logger.config("Can't add google certs to keystore");
}
try {
final X509Certificate[] ycerts = XWTools.retrieveCertificates(YAHOO_ADDR, false);
for (int i = 0; i < ycerts.length; i++) {
final X509Certificate cert = ycerts[i];
try {
final String alias = cert.getSubjectDN().toString();
logger.finest("KeyStore set entry= " + alias + "; KeyStore.size = " + store.size());
store.setCertificateEntry(alias, cert);
} catch (final Exception e) {
logger.exception("Can't add new entry to keystore", e);
}
final String alias = cert.getSubjectDN().toString();
logger.debug("KeyStore set entry= " + alias + "; KeyStore.size = " + store.size());
store.setCertificateEntry(alias, cert);
}
} catch (final Exception e) {
logger.exception("Can't add new entry to keystore", e);
logger.config("Can't add yahoo certs to keystore");
}
return store;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/xtremweb/communications/CommClient.java
Expand Up @@ -1191,8 +1191,8 @@ public void chmod(final XMLRPCCommandChmod command)
public void send(final Table obj) throws InvalidKeyException, AccessControlException, IOException,
ClassNotFoundException, SAXException, URISyntaxException {
final URI uri = newURI();
final XMLRPCCommandSend cmd = new XMLRPCCommandSend(uri, obj);
send(cmd);
final XMLRPCCommandSend cmd = XMLRPCCommandSend.newCommand(uri, obj);
this.send(cmd);
}

/**
Expand Down
75 changes: 5 additions & 70 deletions src/main/java/xtremweb/communications/CommServer.java
Expand Up @@ -55,18 +55,6 @@ public abstract class CommServer extends Thread {
* This is the port number
*/
private int port;
/**
* This is the client host name; for debug purposes only
*/
private String remoteName;
/**
* This is the client IP addr; for debug purposes only
*/
private String remoteIP;
/**
* This is the client port; for debug purposes only
*/
private int remotePort;
/**
* This is the maximum simultaneous connections
*/
Expand Down Expand Up @@ -108,6 +96,7 @@ protected void initComm(final XWConfigurator p, final Handler h) throws RemoteEx

setHandler(h);
setConfig(p);
logger.setLoggerLevel(config.getLoggerLevel());
MAXCONNECTIONS = p.getInt(XWPropertyDefs.MAXCONNECTIONS);
connPool = Collections.synchronizedList(new LinkedList());
getLogger().config("MAXCONNECTIONS = " + MAXCONNECTIONS);
Expand All @@ -128,14 +117,6 @@ protected void initComm(final XWConfigurator p, final Handler h) throws RemoteEx
}
}

protected String remoteAddresse() {
return new String("{" + getRemoteName() + "/" + getRemoteIP() + ":" + getRemotePort() + "}");
}

protected String msgWithRemoteAddresse(final String msg) {
return remoteAddresse() + " : " + msg;
}

/**
* This creates a new communication handler
*/
Expand All @@ -156,17 +137,15 @@ protected synchronized CommHandler popConnection()

while (connPool.size() <= 0) {
try {
getLogger().debug(msgWithRemoteAddresse(
"popConnection sleeping (" + nbConnections + " > " + MAXCONNECTIONS + ")"));
getLogger().debug("popConnection sleeping (" + nbConnections + " > " + MAXCONNECTIONS + ")");
wait();
getLogger().debug(msgWithRemoteAddresse("popConnection woken up"));
getLogger().debug("popConnection woken up");
} catch (final InterruptedException e) {
}
}
final CommHandler myhandler = (CommHandler) connPool.remove(0);
nbConnections++;
getLogger().debug(
msgWithRemoteAddresse("popConnection " + nbConnections + " (" + ((Thread) myhandler).getId() + ")"));
getLogger().debug("popConnection " + nbConnections + " (" + ((Thread) myhandler).getId() + ")");
notifyAll();
return myhandler;
}
Expand All @@ -182,7 +161,7 @@ public synchronized void pushConnection(final CommHandler h) {
if (nbConnections < 0) {
nbConnections = 0;
}
getLogger().debug(msgWithRemoteAddresse("pushConnection " + nbConnections + " (" + ((Thread) h).getId() + ")"));
getLogger().debug("pushConnection " + nbConnections + " (" + ((Thread) h).getId() + ")");
notifyAll();
}

Expand Down Expand Up @@ -246,48 +225,4 @@ public void setConfig(final XWConfigurator config) {
this.config = config;
}

/**
* @return the remoteName
*/
public String getRemoteName() {
return remoteName;
}

/**
* @param remoteName
* the remoteName to set
*/
public void setRemoteName(final String remoteName) {
this.remoteName = remoteName;
}

/**
* @return the remoteIP
*/
public String getRemoteIP() {
return remoteIP;
}

/**
* @param remoteIP
* the remoteIP to set
*/
public void setRemoteIP(final String remoteIP) {
this.remoteIP = remoteIP;
}

/**
* @return the remotePort
*/
public int getRemotePort() {
return remotePort;
}

/**
* @param remotePort
* the remotePort to set
*/
public void setRemotePort(final int remotePort) {
this.remotePort = remotePort;
}
}
29 changes: 19 additions & 10 deletions src/main/java/xtremweb/communications/IdRpc.java
Expand Up @@ -148,7 +148,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand All @@ -168,7 +168,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -230,7 +230,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -290,7 +290,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -399,7 +399,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -479,7 +479,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -519,7 +519,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -560,7 +560,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -620,7 +620,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -924,7 +924,7 @@ public String helpRestApi() {
@Override
public XMLRPCCommandSend newCommand(final URI uri, final UserInterface client, final Table obj)
throws IOException {
return new XMLRPCCommandSend(uri, client, obj);
return newXMLRPCCommandSend(uri, client, obj);
}

@Override
Expand Down Expand Up @@ -1044,6 +1044,15 @@ public String helpRestApi() {
public static final IdRpc LAST = DOWNLOADDATA;
public static final int SIZE = LAST.ordinal() + 1;

/**
* @since 11.5.0
*/
private final static XMLRPCCommandSend newXMLRPCCommandSend(final URI uri, final UserInterface client, final Table obj) throws IOException {
final XMLRPCCommandSend cmd = XMLRPCCommandSend.newCommand(uri, obj);
cmd.setUser(client);
return cmd;
}

/**
* This creates a new XMLRPCCommand
*
Expand Down

0 comments on commit decd15e

Please sign in to comment.