summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/connector
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/connector')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java173
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpConnection.java82
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java63
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java90
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpRequestEncoder.java10
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java75
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/RemoteAuthority.java12
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/RequestTransfer.java40
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/Resender.java89
9 files changed, 301 insertions, 333 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java
index 5a607ee9..925c65b3 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import com.netscape.certsrv.apps.CMS;
import com.netscape.certsrv.authority.IAuthority;
import com.netscape.certsrv.base.EBaseException;
@@ -28,7 +27,6 @@ import com.netscape.certsrv.logging.ILogger;
import com.netscape.cmsutil.http.JssSSLSocketFactory;
import com.netscape.cmsutil.net.ISocketFactory;
-
/**
* Factory for getting HTTP Connections to a HTTPO server
*/
@@ -38,14 +36,14 @@ public class HttpConnFactory {
private ILogger mLogger = CMS.getLogger();
- private int mNumConns = 0; // number of available conns in array
- private int mTotal = 0; // total num conns
+ private int mNumConns = 0; // number of available conns in array
+ private int mTotal = 0; // total num conns
private IHttpConnection mMasterConn = null; // master connection object.
private IHttpConnection mConns[];
private IAuthority mSource = null;
private IRemoteAuthority mDest = null;
private String mNickname = "";
- private int mTimeout = 0;
+ private int mTimeout = 0;
/**
* default value for the above at init time.
@@ -53,20 +51,20 @@ public class HttpConnFactory {
private boolean mDefErrorIfDown = false;
/**
- * Constructor for initializing from the config store.
- * must be followed by init(IConfigStore)
+ * Constructor for initializing from the config store. must be followed by
+ * init(IConfigStore)
*/
public HttpConnFactory() {
}
/**
* Constructor for HttpConnFactory
+ *
* @param minConns minimum number of connections to have available
- * @param maxConns max number of connections to have available. This is
+ * @param maxConns max number of connections to have available. This is
* @param serverInfo server connection info - host, port, etc.
*/
- public HttpConnFactory(int minConns, int maxConns, IAuthority source, IRemoteAuthority dest, String nickname, int timeout
- ) throws EBaseException {
+ public HttpConnFactory(int minConns, int maxConns, IAuthority source, IRemoteAuthority dest, String nickname, int timeout) throws EBaseException {
CMS.debug("In HttpConnFactory constructor mTimeout " + timeout);
mSource = source;
@@ -78,21 +76,21 @@ public class HttpConnFactory {
}
/**
- * initialize parameters obtained from either constructor or
- * config store
+ * initialize parameters obtained from either constructor or config store
+ *
* @param minConns minimum number of connection handls to have available.
* @param maxConns maximum total number of connections to ever have.
* @param connInfo ldap connection info.
* @param authInfo ldap authentication info.
- * @exception ELdapException if any error occurs.
+ * @exception ELdapException if any error occurs.
*/
- private void init(int minConns, int maxConns
- )
- throws EBaseException {
+ private void init(int minConns, int maxConns
+ )
+ throws EBaseException {
CMS.debug("min conns " + minConns + " maxConns " + maxConns);
if (minConns <= 0 || maxConns <= 0 || minConns > maxConns) {
- CMS.debug("bad values from CMS.cfg");
+ CMS.debug("bad values from CMS.cfg");
} else {
@@ -109,11 +107,11 @@ public class HttpConnFactory {
CMS.debug("before makeConnection");
CMS.debug(
- "initializing HttpConnFactory with mininum " + mMinConns + " and maximum " + mMaxConns +
- " connections to ");
+ "initializing HttpConnFactory with mininum " + mMinConns + " and maximum " + mMaxConns +
+ " connections to ");
// initalize minimum number of connection handles available.
- //makeMinimum();
+ // makeMinimum();
CMS.debug("leaving HttpConnFactory init.");
}
@@ -126,21 +124,21 @@ public class HttpConnFactory {
try {
ISocketFactory tFactory = new JssSSLSocketFactory(mNickname);
-
+
if (mTimeout == 0) {
retConn = CMS.getHttpConnection(mDest, tFactory);
} else {
retConn = CMS.getHttpConnection(mDest, tFactory, mTimeout);
}
- } catch (Exception e) {
+ } catch (Exception e) {
CMS.debug("can't make new Htpp Connection");
throw new EBaseException(
- "Can't create new Http Connection");
+ "Can't create new Http Connection");
}
-
+
return retConn;
}
@@ -160,7 +158,7 @@ public class HttpConnFactory {
return;
CMS.debug(
- "increasing minimum connections by " + increment);
+ "increasing minimum connections by " + increment);
for (int i = increment - 1; i >= 0; i--) {
mConns[i] = (IHttpConnection) createConnection();
}
@@ -172,77 +170,71 @@ public class HttpConnFactory {
}
/**
- * gets a conenction from this factory.
- * All connections obtained from the factory must be returned by
- * returnConn() method.
- * The best thing to do is to put returnConn in a finally clause so it
- * always gets called. For example,
+ * gets a conenction from this factory. All connections obtained from the
+ * factory must be returned by returnConn() method. The best thing to do is
+ * to put returnConn in a finally clause so it always gets called. For
+ * example,
+ *
* <pre>
- * IHttpConnection c = null;
- * try {
- * c = factory.getConn();
- * myclass.do_something_with_c(c);
- * }
- * catch (EBaseException e) {
- * handle_error_here();
- * }
- * finally {
- * factory.returnConn(c);
- * }
+ * IHttpConnection c = null;
+ * try {
+ * c = factory.getConn();
+ * myclass.do_something_with_c(c);
+ * } catch (EBaseException e) {
+ * handle_error_here();
+ * } finally {
+ * factory.returnConn(c);
+ * }
* </pre>
*/
- public IHttpConnection getConn()
- throws EBaseException {
+ public IHttpConnection getConn()
+ throws EBaseException {
return getConn(true);
}
/**
- * Returns a Http connection - a clone of the master connection.
- * All connections should be returned to the factory using returnConn()
- * to recycle connection objects.
- * If not returned the limited max number is affected but if that
- * number is large not much harm is done.
- * Returns null if maximum number of connections reached.
- * The best thing to do is to put returnConn in a finally clause so it
- * always gets called. For example,
+ * Returns a Http connection - a clone of the master connection. All
+ * connections should be returned to the factory using returnConn() to
+ * recycle connection objects. If not returned the limited max number is
+ * affected but if that number is large not much harm is done. Returns null
+ * if maximum number of connections reached. The best thing to do is to put
+ * returnConn in a finally clause so it always gets called. For example,
+ *
* <pre>
- * IHttpConnnection c = null;
- * try {
- * c = factory.getConn();
- * myclass.do_something_with_c(c);
- * }
- * catch (EBaseException e) {
- * handle_error_here();
- * }
- * finally {
- * factory.returnConn(c);
- * }
+ * IHttpConnnection c = null;
+ * try {
+ * c = factory.getConn();
+ * myclass.do_something_with_c(c);
+ * } catch (EBaseException e) {
+ * handle_error_here();
+ * } finally {
+ * factory.returnConn(c);
+ * }
* </pre>
- */
- public synchronized IHttpConnection getConn(boolean waitForConn)
- throws EBaseException {
+ */
+ public synchronized IHttpConnection getConn(boolean waitForConn)
+ throws EBaseException {
boolean waited = false;
CMS.debug("In HttpConnFactory.getConn");
- if (mNumConns == 0)
+ if (mNumConns == 0)
makeMinimum();
if (mNumConns == 0) {
if (!waitForConn)
return null;
try {
CMS.debug("getConn: out of http connections");
- log(ILogger.LL_WARN,
- "Ran out of http connections available "
- );
+ log(ILogger.LL_WARN,
+ "Ran out of http connections available ");
waited = true;
CMS.debug("HttpConn:about to wait for a new http connection");
- while (mNumConns == 0)
+ while (mNumConns == 0)
wait();
CMS.debug("HttpConn:done waiting for new http connection");
} catch (InterruptedException e) {
}
- }
+ }
mNumConns--;
IHttpConnection conn = mConns[mNumConns];
@@ -250,9 +242,8 @@ public class HttpConnFactory {
if (waited) {
CMS.debug("HttpConn:had to wait for an available connection from pool");
- log(ILogger.LL_WARN,
- "Http connections are available again in http connection pool "
- );
+ log(ILogger.LL_WARN,
+ "Http connections are available again in http connection pool ");
}
CMS.debug("HttpgetConn: mNumConns now " + mNumConns);
@@ -260,22 +251,20 @@ public class HttpConnFactory {
}
/**
- * Teturn connection to the factory.
- * This is mandatory after a getConn().
+ * Teturn connection to the factory. This is mandatory after a getConn().
* The best thing to do is to put returnConn in a finally clause so it
- * always gets called. For example,
+ * always gets called. For example,
+ *
* <pre>
- * IHttpConnection c = null;
- * try {
- * c = factory.getConn();
- * myclass.do_something_with_c(c);
- * }
- * catch (EBaseException e) {
- * handle_error_here();
- * }
- * finally {
- * factory.returnConn(c);
- * }
+ * IHttpConnection c = null;
+ * try {
+ * c = factory.getConn();
+ * myclass.do_something_with_c(c);
+ * } catch (EBaseException e) {
+ * handle_error_here();
+ * } finally {
+ * factory.returnConn(c);
+ * }
* </pre>
*/
public synchronized void returnConn(IHttpConnection conn) {
@@ -289,7 +278,7 @@ public class HttpConnFactory {
for (int i = 0; i < mNumConns; i++) {
if (mConns[i] == conn) {
CMS.debug(
- "returnConn: previously returned connection. " + conn);
+ "returnConn: previously returned connection. " + conn);
}
}
@@ -303,11 +292,11 @@ public class HttpConnFactory {
*/
private void log(int level, String msg) {
mLogger.log(ILogger.EV_SYSTEM, ILogger.S_LDAP, level,
- "In Http (bound) connection pool to" +
- msg);
+ "In Http (bound) connection pool to" +
+ msg);
}
protected void finalize()
- throws Exception {
+ throws Exception {
}
}
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnection.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnection.java
index e8b03542..cf0caf64 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnection.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnection.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.io.IOException;
import java.util.StringTokenizer;
@@ -33,34 +32,32 @@ import com.netscape.cmsutil.http.HttpRequest;
import com.netscape.cmsutil.http.HttpResponse;
import com.netscape.cmsutil.net.ISocketFactory;
-
public class HttpConnection implements IHttpConnection {
protected IRemoteAuthority mDest = null;
protected HttpRequest mHttpreq = new HttpRequest();
protected IRequestEncoder mReqEncoder = null;
protected HttpClient mHttpClient = null;
- protected boolean Connect(String host, HttpClient client)
- {
- StringTokenizer st = new StringTokenizer(host, " ");
- while (st.hasMoreTokens()) {
- String hp = st.nextToken(); // host:port
- StringTokenizer st1 = new StringTokenizer(hp, ":");
- try {
- String h = st1.nextToken();
- int p = Integer.parseInt(st1.nextToken());
- client.connect(h, p);
- return true;
- } catch (Exception e) {
- // may want to log the failure
- }
- try {
- Thread.sleep(5000); // 5 seconds
- } catch (Exception e) {
- }
-
- }
- return false;
+ protected boolean Connect(String host, HttpClient client) {
+ StringTokenizer st = new StringTokenizer(host, " ");
+ while (st.hasMoreTokens()) {
+ String hp = st.nextToken(); // host:port
+ StringTokenizer st1 = new StringTokenizer(hp, ":");
+ try {
+ String h = st1.nextToken();
+ int p = Integer.parseInt(st1.nextToken());
+ client.connect(h, p);
+ return true;
+ } catch (Exception e) {
+ // may want to log the failure
+ }
+ try {
+ Thread.sleep(5000); // 5 seconds
+ } catch (Exception e) {
+ }
+
+ }
+ return false;
}
public HttpConnection(IRemoteAuthority dest, ISocketFactory factory) {
@@ -76,22 +73,22 @@ public class HttpConnection implements IHttpConnection {
CMS.debug("HttpConnection: connecting to " + dest.getHost() + ":" + dest.getPort());
String host = dest.getHost();
// we could have a list of host names in the host parameters
- // the format is, for example,
+ // the format is, for example,
// "directory.knowledge.com:1050 people.catalog.com 199.254.1.2"
if (host != null && host.indexOf(' ') != -1) {
- // try to do client-side failover
- boolean connected = false;
- do {
- connected = Connect(host, mHttpClient);
- } while (!connected);
+ // try to do client-side failover
+ boolean connected = false;
+ do {
+ connected = Connect(host, mHttpClient);
+ } while (!connected);
} else {
- mHttpClient.connect(host, dest.getPort());
+ mHttpClient.connect(host, dest.getPort());
}
CMS.debug("HttpConnection: connected to " + dest.getHost() + ":" + dest.getPort());
} catch (IOException e) {
// server's probably down. that's fine. try later.
- //System.out.println(
- //"Can't connect to server in connection creation");
+ // System.out.println(
+ // "Can't connect to server in connection creation");
}
}
@@ -110,19 +107,20 @@ public class HttpConnection implements IHttpConnection {
CMS.debug("HttpConnection: connected to " + dest.getHost() + ":" + dest.getPort() + " timeout:" + timeout);
} catch (IOException e) {
// server's probably down. that's fine. try later.
- //System.out.println(
- //"Can't connect to server in connection creation");
+ // System.out.println(
+ // "Can't connect to server in connection creation");
CMS.debug("CMSConn:IOException in creating HttpConnection " + e.toString());
}
}
// Insert end
- /**
+ /**
* sends a request to remote RA/CA, returning the result.
- * @throws EBaseException if request could not be encoded
+ *
+ * @throws EBaseException if request could not be encoded
*/
- public IPKIMessage send(IPKIMessage tomsg)
- throws EBaseException {
+ public IPKIMessage send(IPKIMessage tomsg)
+ throws EBaseException {
IPKIMessage replymsg = null;
CMS.debug("in HttpConnection.send " + this);
@@ -143,8 +141,8 @@ public class HttpConnection implements IHttpConnection {
}
boolean reconnect = false;
- mHttpreq.setHeader("Content-Length",
- Integer.toString(content.length()));
+ mHttpreq.setHeader("Content-Length",
+ Integer.toString(content.length()));
if (Debug.ON)
Debug.trace("request encoded length " + content.length());
mHttpreq.setContent(content);
@@ -220,8 +218,8 @@ public class HttpConnection implements IHttpConnection {
}
}
- // decode reply.
- // if reply is bad, error is thrown and request will be resent
+ // decode reply.
+ // if reply is bad, error is thrown and request will be resent
String pcontent = p.getContent();
if (Debug.ON) {
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
index fefbe0f3..d7a73335 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.util.Vector;
import com.netscape.certsrv.apps.CMS;
@@ -36,7 +35,6 @@ import com.netscape.certsrv.request.RequestStatus;
import com.netscape.cmsutil.http.JssSSLSocketFactory;
import com.netscape.cmsutil.net.ISocketFactory;
-
public class HttpConnector implements IConnector {
protected IAuthority mSource = null;
protected IRemoteAuthority mDest = null;
@@ -45,13 +43,14 @@ public class HttpConnector implements IConnector {
// XXX todo make this a pool.
// XXX use CMMF in the future.
protected IHttpConnection mConn = null;
- private Thread mResendThread = null;
+ private Thread mResendThread = null;
private IResender mResender = null;
private int mTimeout;
private HttpConnFactory mConnFactory = null;
+
public HttpConnector(IAuthority source, String nickName,
- IRemoteAuthority dest, int resendInterval, IConfigStore config) throws EBaseException {
+ IRemoteAuthority dest, int resendInterval, IConfigStore config) throws EBaseException {
mTimeout = 0;
mSource = source;
@@ -70,22 +69,22 @@ public class HttpConnector implements IConnector {
CMS.debug("can't create new HttpConnFactory " + e.toString());
}
- // mConn = CMS.getHttpConnection(dest, mFactory);
- // this will start resending past requests in parallel.
- mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
+ // mConn = CMS.getHttpConnection(dest, mFactory);
+ // this will start resending past requests in parallel.
+ mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
mResendThread = new Thread(mResender, "HttpConnector");
}
-
+
// Inserted by beomsuk
public HttpConnector(IAuthority source, String nickName,
- IRemoteAuthority dest, int resendInterval, IConfigStore config, int timeout) throws EBaseException {
+ IRemoteAuthority dest, int resendInterval, IConfigStore config, int timeout) throws EBaseException {
mSource = source;
mDest = dest;
mTimeout = timeout;
mFactory = new JssSSLSocketFactory(nickName);
int minConns = config.getInteger("minHttpConns", 1);
- int maxConns = config.getInteger("maxHttpConns", 15);
+ int maxConns = config.getInteger("maxHttpConns", 15);
CMS.debug("HttpConn: min " + minConns);
CMS.debug("HttpConn: max " + maxConns);
@@ -96,15 +95,15 @@ public class HttpConnector implements IConnector {
CMS.debug("can't create new HttpConnFactory");
}
- // this will start resending past requests in parallel.
- mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
+ // this will start resending past requests in parallel.
+ mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
mResendThread = new Thread(mResender, "HttpConnector");
}
// Insert end
-
- public boolean send(IRequest r)
- throws EBaseException {
+
+ public boolean send(IRequest r)
+ throws EBaseException {
IHttpConnection curConn = null;
try {
@@ -141,35 +140,35 @@ public class HttpConnector implements IConnector {
CMS.debug("reply status " + replyStatus);
// non terminal states.
- // XXX hack: don't resend get revocation info requests since
+ // XXX hack: don't resend get revocation info requests since
// resent results are ignored.
if ((!r.getRequestType().equals(
- IRequest.GETREVOCATIONINFO_REQUEST)) &&
- (replyStatus == RequestStatus.BEGIN ||
- replyStatus == RequestStatus.PENDING ||
- replyStatus == RequestStatus.SVC_PENDING ||
+ IRequest.GETREVOCATIONINFO_REQUEST)) &&
+ (replyStatus == RequestStatus.BEGIN ||
+ replyStatus == RequestStatus.PENDING ||
+ replyStatus == RequestStatus.SVC_PENDING ||
replyStatus == RequestStatus.APPROVED)) {
CMS.debug("HttpConn: remote request id still pending " +
- r.getRequestId() + " state " + replyStatus);
+ r.getRequestId() + " state " + replyStatus);
mSource.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_CONNECTOR_REQUEST_NOT_COMPLETED", r.getRequestId().toString()));
mResender.addRequest(r);
return false;
}
// request was completed.
- replymsg.toRequest(r); // this only copies contents.
+ replymsg.toRequest(r); // this only copies contents.
// terminal states other than completed
- if (replyStatus == RequestStatus.REJECTED ||
- replyStatus == RequestStatus.CANCELED) {
+ if (replyStatus == RequestStatus.REJECTED ||
+ replyStatus == RequestStatus.CANCELED) {
CMS.debug(
- "remote request id " + r.getRequestId() +
- " was rejected or cancelled.");
+ "remote request id " + r.getRequestId() +
+ " was rejected or cancelled.");
r.setExtData(IRequest.REMOTE_STATUS, replyStatus.toString());
r.setExtData(IRequest.RESULT, IRequest.RES_ERROR);
r.setExtData(IRequest.ERROR,
- new EBaseException(CMS.getUserMessage("CMS_BASE_REMOTE_AUTHORITY_ERROR")));
- // XXX overload svcerrors for now.
+ new EBaseException(CMS.getUserMessage("CMS_BASE_REMOTE_AUTHORITY_ERROR")));
+ // XXX overload svcerrors for now.
Vector policyErrors = r.getExtDataInStringVector(IRequest.ERRORS);
if (policyErrors != null && policyErrors.size() > 0) {
@@ -178,18 +177,18 @@ public class HttpConnector implements IConnector {
}
CMS.debug(
- "remote request id " + r.getRequestId() + " was completed");
+ "remote request id " + r.getRequestId() + " was completed");
return true;
} catch (EBaseException e) {
CMS.debug("HttpConn: inside EBaseException " + e.toString());
-
+
if (!r.getRequestType().equals(IRequest.GETREVOCATIONINFO_REQUEST))
mResender.addRequest(r);
CMS.debug("HttpConn: error sending request to cert " + e.toString());
mSource.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CONNECTOR_SEND_REQUEST", r.getRequestId().toString(), mDest.getHost(), Integer.toString(mDest.getPort())));
- // mSource.log(ILogger.LL_INFO,
- // "Queing " + r.getRequestId() + " for resend.");
+ // mSource.log(ILogger.LL_INFO,
+ // "Queing " + r.getRequestId() + " for resend.");
return false;
} finally {
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java
index e236655d..51e3ed8a 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
@@ -32,9 +31,8 @@ import com.netscape.certsrv.connector.IHttpPKIMessage;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cmscore.util.Debug;
-
/**
- * simple name/value pair message.
+ * simple name/value pair message.
*/
public class HttpPKIMessage implements IHttpPKIMessage {
/**
@@ -66,7 +64,7 @@ public class HttpPKIMessage implements IHttpPKIMessage {
* copy contents of request to make a simple name/value message.
*/
public void fromRequest(IRequest r) {
- // actually don't need to copy source id since
+ // actually don't need to copy source id since
reqType = r.getRequestType();
reqId = r.getRequestId().toString();
reqStatus = r.getRequestStatus().toString();
@@ -96,7 +94,7 @@ public class HttpPKIMessage implements IHttpPKIMessage {
* copy contents to request.
*/
public void toRequest(IRequest r) {
- // id, type and status
+ // id, type and status
// type had to have been set in instantiation.
// id is checked but not reset.
// request status cannot be set, but can be looked at.
@@ -118,16 +116,16 @@ public class HttpPKIMessage implements IHttpPKIMessage {
r.setExtData(key, (Hashtable) value);
} else {
CMS.debug("HttpPKIMessage.toRequest(): key: " + key +
- " has unexpected type " + value.getClass().toString());
+ " has unexpected type " + value.getClass().toString());
}
} catch (NoSuchElementException e) {
- CMS.debug("Incorrect pairing of name/value for " + key);
+ CMS.debug("Incorrect pairing of name/value for " + key);
}
}
}
private void writeObject(java.io.ObjectOutputStream out)
- throws IOException {
+ throws IOException {
CMS.debug("writeObject");
out.writeObject(reqType);
if (Debug.ON)
@@ -145,34 +143,34 @@ public class HttpPKIMessage implements IHttpPKIMessage {
Object val = null;
key = enum1.nextElement();
try {
- val = enum1.nextElement();
- // test if key and value are serializable
- ObjectOutputStream os =
- new ObjectOutputStream(new ByteArrayOutputStream());
- os.writeObject(key);
- os.writeObject(val);
-
- // ok, if we dont have problem serializing the objects,
- // then write the objects into the real object stream
- out.writeObject(key);
- out.writeObject(val);
+ val = enum1.nextElement();
+ // test if key and value are serializable
+ ObjectOutputStream os =
+ new ObjectOutputStream(new ByteArrayOutputStream());
+ os.writeObject(key);
+ os.writeObject(val);
+
+ // ok, if we dont have problem serializing the objects,
+ // then write the objects into the real object stream
+ out.writeObject(key);
+ out.writeObject(val);
} catch (Exception e) {
- // skip not serialiable attribute in DRM
- // DRM does not need to store the enrollment request anymore
- CMS.debug("HttpPKIMessage:skipped key=" +
- key.getClass().getName());
- if (val == null) {
- CMS.debug("HttpPKIMessage:skipped val= null");
- } else {
- CMS.debug("HttpPKIMessage:skipped val=" +
- val.getClass().getName());
- }
+ // skip not serialiable attribute in DRM
+ // DRM does not need to store the enrollment request anymore
+ CMS.debug("HttpPKIMessage:skipped key=" +
+ key.getClass().getName());
+ if (val == null) {
+ CMS.debug("HttpPKIMessage:skipped val= null");
+ } else {
+ CMS.debug("HttpPKIMessage:skipped val=" +
+ val.getClass().getName());
+ }
}
}
}
private void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException, OptionalDataException {
+ throws IOException, ClassNotFoundException, OptionalDataException {
reqType = (String) in.readObject();
reqId = (String) in.readObject();
reqStatus = (String) in.readObject();
@@ -185,21 +183,21 @@ public class HttpPKIMessage implements IHttpPKIMessage {
while (true) {
boolean skipped = false;
try {
- keyorval = in.readObject();
+ keyorval = in.readObject();
} catch (OptionalDataException e) {
- throw e;
+ throw e;
} catch (IOException e) {
- // just skipped parameter
- CMS.debug("skipped attribute in request e="+e);
- if (!iskey) {
- int s = mNameVals.size();
- if (s > 0) {
- // remove previous key if this is value
- mNameVals.removeElementAt(s - 1);
- skipped = true;
- keyorval = "";
- }
- }
+ // just skipped parameter
+ CMS.debug("skipped attribute in request e=" + e);
+ if (!iskey) {
+ int s = mNameVals.size();
+ if (s > 0) {
+ // remove previous key if this is value
+ mNameVals.removeElementAt(s - 1);
+ skipped = true;
+ keyorval = "";
+ }
+ }
}
if (iskey) {
if (Debug.ON)
@@ -213,9 +211,9 @@ public class HttpPKIMessage implements IHttpPKIMessage {
if (Debug.ON)
Debug.trace("read " + keyorval);
if (!skipped) {
- if (keyorval == null)
- break;
- mNameVals.addElement(keyorval);
+ if (keyorval == null)
+ break;
+ mNameVals.addElement(keyorval);
}
}
} catch (OptionalDataException e) {
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpRequestEncoder.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpRequestEncoder.java
index 4a762dd8..29c3b8d0 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpRequestEncoder.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpRequestEncoder.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -28,13 +27,12 @@ import java.io.OptionalDataException;
import com.netscape.certsrv.connector.IRequestEncoder;
import com.netscape.cmscore.util.Debug;
-
/**
- * encodes a request by serializing it.
+ * encodes a request by serializing it.
*/
public class HttpRequestEncoder implements IRequestEncoder {
public String encode(Object r)
- throws IOException {
+ throws IOException {
String s = null;
byte[] serial;
ByteArrayOutputStream ba = new ByteArrayOutputStream();
@@ -47,7 +45,7 @@ public class HttpRequestEncoder implements IRequestEncoder {
}
public Object decode(String s)
- throws IOException {
+ throws IOException {
Object result = null;
byte[] serial = null;
@@ -59,7 +57,7 @@ public class HttpRequestEncoder implements IRequestEncoder {
result = is.readObject();
} catch (ClassNotFoundException e) {
- // XXX hack: change this
+ // XXX hack: change this
if (Debug.ON)
Debug.trace("class not found ex " + e + e.getMessage());
throw new IOException("Class Not Found " + e.getMessage());
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java b/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
index 9272cc93..79f77e1a 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.util.Hashtable;
import com.netscape.certsrv.apps.CMS;
@@ -36,7 +35,6 @@ import com.netscape.certsrv.request.RequestId;
import com.netscape.certsrv.request.RequestStatus;
import com.netscape.cmscore.util.Debug;
-
public class LocalConnector implements IConnector {
ILogger mLogger = CMS.getLogger();
ICertAuthority mSource = null;
@@ -46,45 +44,44 @@ public class LocalConnector implements IConnector {
public LocalConnector(ICertAuthority source, IAuthority dest) {
mSource = source;
// mSource.log(ILogger.LL_DEBUG, "Local connector setup for source " +
- // mSource.getId());
+ // mSource.getId());
mDest = dest;
CMS.debug("Local connector setup for dest " +
- mDest.getId());
+ mDest.getId());
// register for events.
mDest.registerRequestListener(new LocalConnListener());
CMS.debug("Connector inited");
}
/**
- * send request to local authority.
- * returns resulting request
+ * send request to local authority. returns resulting request
*/
public boolean send(IRequest r) throws EBaseException {
if (Debug.ON) {
Debug.print("send request type " + r.getRequestType() + " status=" + r.getRequestStatus() + " to " + mDest.getId() + " id=" + r.getRequestId() + "\n");
}
CMS.debug("send request type " + r.getRequestType() +
- " to " + mDest.getId());
+ " to " + mDest.getId());
IRequestQueue destQ = mDest.getRequestQueue();
IRequest destreq = destQ.newRequest(r.getRequestType());
CMS.debug("local connector dest req " +
- destreq.getRequestId() + " created for source rId " + r.getRequestId());
- // mSource.log(ILogger.LL_DEBUG,
- // "setting connector dest " + mDest.getId() +
- // " source id to " + r.getRequestId());
+ destreq.getRequestId() + " created for source rId " + r.getRequestId());
+ // mSource.log(ILogger.LL_DEBUG,
+ // "setting connector dest " + mDest.getId() +
+ // " source id to " + r.getRequestId());
- // XXX set context to the real identity later.
+ // XXX set context to the real identity later.
destreq.setSourceId(
- mSource.getX500Name().toString() + ":" + r.getRequestId().toString());
- //destreq.copyContents(r); // copy meta attributes in request.
+ mSource.getX500Name().toString() + ":" + r.getRequestId().toString());
+ // destreq.copyContents(r); // copy meta attributes in request.
transferRequest(r, destreq);
// XXX requestor type is not transferred on return.
destreq.setExtData(IRequest.REQUESTOR_TYPE,
- IRequest.REQUESTOR_RA);
+ IRequest.REQUESTOR_RA);
CMS.debug("connector dest " + mDest.getId() +
- " processing " + destreq.getRequestId());
+ " processing " + destreq.getRequestId());
// set context before calling process request so
// that request subsystem can record the creator
@@ -98,7 +95,7 @@ public class LocalConnector implements IConnector {
}
// Locally cache the source request so that we
- // can update it when the dest request is
+ // can update it when the dest request is
// processed (when LocalConnListener is being called).
mSourceReqs.put(r.getRequestId().toString(), r);
try {
@@ -111,8 +108,8 @@ public class LocalConnector implements IConnector {
}
CMS.debug("connector dest " + mDest.getId() +
- " processed " + destreq.getRequestId() +
- " status " + destreq.getRequestStatus());
+ " processed " + destreq.getRequestId() +
+ " status " + destreq.getRequestStatus());
if (destreq.getRequestStatus() == RequestStatus.COMPLETE) {
// no need to transfer contents if request wasn't complete.
@@ -126,7 +123,7 @@ public class LocalConnector implements IConnector {
public class LocalConnListener implements IRequestListener {
public void init(ISubsystem sys, IConfigStore config)
- throws EBaseException {
+ throws EBaseException {
}
public void set(String name, String val) {
@@ -136,36 +133,37 @@ public class LocalConnector implements IConnector {
if (Debug.ON) {
Debug.print("dest " + mDest.getId() + " done with " + destreq.getRequestId());
}
- CMS.debug(
- "dest " + mDest.getId() + " done with " + destreq.getRequestId());
+ CMS.debug(
+ "dest " + mDest.getId() + " done with " + destreq.getRequestId());
IRequestQueue sourceQ = mSource.getRequestQueue();
- // accept requests that only belong to us.
+ // accept requests that only belong to us.
// XXX review death scenarios here. - If system dies anywhere
- // here need to check all requests at next server startup.
+ // here need to check all requests at next server startup.
String sourceNameAndId = destreq.getSourceId();
String sourceName = mSource.getX500Name().toString();
- if (sourceNameAndId == null ||
- !sourceNameAndId.toString().regionMatches(0,
- sourceName, 0, sourceName.length())) {
+ if (sourceNameAndId == null ||
+ !sourceNameAndId.toString().regionMatches(0,
+ sourceName, 0, sourceName.length())) {
CMS.debug("request " + destreq.getRequestId() +
- " from " + sourceNameAndId + " not ours.");
+ " from " + sourceNameAndId + " not ours.");
return;
}
int index = sourceNameAndId.lastIndexOf(':');
if (index == -1) {
- mSource.log(ILogger.LL_FAILURE,
- "request " + destreq.getRequestId() +
- " for " + sourceNameAndId + " malformed.");
+ mSource.log(ILogger.LL_FAILURE,
+ "request " + destreq.getRequestId() +
+ " for " + sourceNameAndId + " malformed.");
return;
}
String sourceId = sourceNameAndId.substring(index + 1);
RequestId rId = new RequestId(sourceId);
- // mSource.log(ILogger.LL_DEBUG, mDest.getId() + " " +
- // destreq.getRequestId() + " mapped to " + mSource.getId() + " " + rId);
+ // mSource.log(ILogger.LL_DEBUG, mDest.getId() + " " +
+ // destreq.getRequestId() + " mapped to " + mSource.getId() + " " +
+ // rId);
IRequest r = null;
@@ -174,7 +172,7 @@ public class LocalConnector implements IConnector {
// performance enhancement, approved request will
// not be immediately available in the database. So
// retrieving the request from the queue within
- // the serviceRequest() function will have
+ // the serviceRequest() function will have
// diffculities.
// You may wonder what happen if the system crashes
// during the request servicing. Yes, the request
@@ -182,14 +180,14 @@ public class LocalConnector implements IConnector {
// resubmit their requests again.
// Note that the pending requests, on the other hand,
// are persistent before the servicing.
- // Please see stateEngine() function in
+ // Please see stateEngine() function in
// ARequestQueue.java for details.
r = (IRequest) mSourceReqs.get(rId);
if (r != null) {
if (r.getRequestStatus() != RequestStatus.SVC_PENDING) {
- mSource.log(ILogger.LL_FAILURE,
- "request state of " + rId + "not pending " +
- " from dest authority " + mDest.getId());
+ mSource.log(ILogger.LL_FAILURE,
+ "request state of " + rId + "not pending " +
+ " from dest authority " + mDest.getId());
sourceQ.releaseRequest(r);
return;
}
@@ -209,4 +207,3 @@ public class LocalConnector implements IConnector {
RequestTransfer.transfer(src, dest);
}
}
-
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/RemoteAuthority.java b/pki/base/common/src/com/netscape/cmscore/connector/RemoteAuthority.java
index ddd02f82..48e722cf 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/RemoteAuthority.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/RemoteAuthority.java
@@ -17,23 +17,19 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.certsrv.connector.IRemoteAuthority;
-
public class RemoteAuthority implements IRemoteAuthority {
String mHost = null;
int mPort = -1;
String mURI = null;
int mTimeout = 0;
-
+
/**
- * host parameter can be:
- * "directory.knowledge.com"
- * "199.254.1.2"
- * "directory.knowledge.com:1050 people.catalog.com 199.254.1.2"
+ * host parameter can be: "directory.knowledge.com" "199.254.1.2"
+ * "directory.knowledge.com:1050 people.catalog.com 199.254.1.2"
*/
public RemoteAuthority(String host, int port, String uri, int timeout) {
mHost = host;
@@ -46,7 +42,7 @@ public class RemoteAuthority implements IRemoteAuthority {
}
public void init(IConfigStore c)
- throws EBaseException {
+ throws EBaseException {
mHost = c.getString("host");
mPort = c.getInteger("port");
mURI = c.getString("uri");
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/RequestTransfer.java b/pki/base/common/src/com/netscape/cmscore/connector/RequestTransfer.java
index b0095020..c00d5c8b 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/RequestTransfer.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/RequestTransfer.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.util.Enumeration;
import java.util.Vector;
@@ -25,27 +24,26 @@ import com.netscape.certsrv.apps.CMS;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cmscore.authentication.ChallengePhraseAuthentication;
-
public class RequestTransfer {
private static final String DOT = ".";
- private static String[] transferAttributes = {
+ private static String[] transferAttributes = {
IRequest.HTTP_PARAMS,
- IRequest.AGENT_PARAMS,
- IRequest.CERT_INFO,
- IRequest.ISSUED_CERTS,
- IRequest.OLD_CERTS,
- IRequest.OLD_SERIALS,
- IRequest.REVOKED_CERTS,
- IRequest.CACERTCHAIN,
- IRequest.CRL,
- IRequest.ERRORS,
+ IRequest.AGENT_PARAMS,
+ IRequest.CERT_INFO,
+ IRequest.ISSUED_CERTS,
+ IRequest.OLD_CERTS,
+ IRequest.OLD_SERIALS,
+ IRequest.REVOKED_CERTS,
+ IRequest.CACERTCHAIN,
+ IRequest.CRL,
+ IRequest.ERRORS,
IRequest.RESULT,
IRequest.ERROR,
- IRequest.SVCERRORS,
- IRequest.REMOTE_STATUS,
- IRequest.REMOTE_REQID,
+ IRequest.SVCERRORS,
+ IRequest.REMOTE_STATUS,
+ IRequest.REMOTE_REQID,
IRequest.REVOKED_CERT_RECORDS,
IRequest.CERT_STATUS,
ChallengePhraseAuthentication.CHALLENGE_PHRASE,
@@ -53,11 +51,11 @@ public class RequestTransfer {
ChallengePhraseAuthentication.SERIALNUMBER,
ChallengePhraseAuthentication.SERIALNOARRAY,
IRequest.ISSUERDN,
- IRequest.CERT_FILTER,
+ IRequest.CERT_FILTER,
"keyRecord",
"uid", // UidPwdDirAuthentication.CRED_UID,
"udn", // UdnPwdDirAuthentication.CRED_UDN,
- };
+ };
public static boolean isProfileRequest(IRequest request) {
String profileId = request.getExtDataInString("profileId");
@@ -71,8 +69,8 @@ public class RequestTransfer {
public static String[] getTransferAttributes(IRequest r) {
if (isProfileRequest(r)) {
// copy everything in the request
- CMS.debug("RequestTransfer: profile request " +
- r.getRequestId().toString());
+ CMS.debug("RequestTransfer: profile request " +
+ r.getRequestId().toString());
Enumeration e = r.getExtDataKeys();
Vector v = new Vector();
@@ -108,8 +106,8 @@ public class RequestTransfer {
public static void transfer(IRequest src, IRequest dest) {
CMS.debug("Transfer srcId=" +
- src.getRequestId().toString() +
- " destId=" + dest.getRequestId().toString());
+ src.getRequestId().toString() +
+ " destId=" + dest.getRequestId().toString());
String attrs[] = getTransferAttributes(src);
for (int i = 0; i < attrs.length; i++) {
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/Resender.java b/pki/base/common/src/com/netscape/cmscore/connector/Resender.java
index ad89a34a..ba5906e8 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/Resender.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/Resender.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
-
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
@@ -36,16 +35,15 @@ import com.netscape.certsrv.request.RequestStatus;
import com.netscape.cmscore.util.Debug;
import com.netscape.cmsutil.http.JssSSLSocketFactory;
-
/**
- * Resend requests at intervals to the server to check if it's been completed.
+ * Resend requests at intervals to the server to check if it's been completed.
* Default interval is 5 minutes.
*/
public class Resender implements IResender {
- public static final int SECOND = 1000; //milliseconds
- public static final int MINUTE = 60 * SECOND;
- public static final int HOUR = 60 * MINUTE;
- public static final int DAY = 24 * HOUR;
+ public static final int SECOND = 1000; // milliseconds
+ public static final int MINUTE = 60 * SECOND;
+ public static final int HOUR = 60 * MINUTE;
+ public static final int DAY = 24 * HOUR;
protected IAuthority mAuthority = null;
IRequestQueue mQueue = null;
@@ -61,44 +59,44 @@ public class Resender implements IResender {
// default interval.
// XXX todo add another interval for requests unsent because server
// was down (versus being serviced in request queue)
- protected int mInterval = 1 * MINUTE;
+ protected int mInterval = 1 * MINUTE;
public Resender(IAuthority authority, String nickName, IRemoteAuthority dest) {
mAuthority = authority;
mQueue = mAuthority.getRequestQueue();
mDest = dest;
mNickName = nickName;
-
- //mConn = new HttpConnection(dest,
- // new JssSSLSocketFactory(nickName));
+
+ // mConn = new HttpConnection(dest,
+ // new JssSSLSocketFactory(nickName));
}
public Resender(
- IAuthority authority, String nickName,
- IRemoteAuthority dest, int interval) {
+ IAuthority authority, String nickName,
+ IRemoteAuthority dest, int interval) {
mAuthority = authority;
mQueue = mAuthority.getRequestQueue();
mDest = dest;
if (interval > 0)
mInterval = interval * SECOND; // interval specified in seconds.
- //mConn = new HttpConnection(dest,
- // new JssSSLSocketFactory(nickName));
+ // mConn = new HttpConnection(dest,
+ // new JssSSLSocketFactory(nickName));
}
// must be done after a subsystem 'start' so queue is initialized.
private void initRequests() {
mQueue = mAuthority.getRequestQueue();
// get all requests in mAuthority that are still pending.
- IRequestList list =
- mQueue.listRequestsByStatus(RequestStatus.SVC_PENDING);
+ IRequestList list =
+ mQueue.listRequestsByStatus(RequestStatus.SVC_PENDING);
while (list != null && list.hasMoreElements()) {
RequestId rid = list.nextRequestId();
CMS.debug(
- "added request Id " + rid + " in init to resend queue.");
- // note these are added as strings
+ "added request Id " + rid + " in init to resend queue.");
+ // note these are added as strings
mRequestIds.addElement(rid.toString());
}
}
@@ -109,13 +107,13 @@ public class Resender implements IResender {
mRequestIds.addElement(r.getRequestId().toString());
}
CMS.debug(
- "added " + r.getRequestId() + " to resend queue");
+ "added " + r.getRequestId() + " to resend queue");
}
public void run() {
- CMS.debug("Resender: In resender Thread run:");
- mConn = new HttpConnection(mDest,
+ CMS.debug("Resender: In resender Thread run:");
+ mConn = new HttpConnection(mDest,
new JssSSLSocketFactory(mNickName));
initRequests();
@@ -127,8 +125,7 @@ public class Resender implements IResender {
mAuthority.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_CONNECTOR_RESENDER_INTERRUPTED"));
continue;
}
- }
- while (true);
+ } while (true);
}
private void resend() {
@@ -141,17 +138,17 @@ public class Resender implements IResender {
while (enum1.hasMoreElements()) {
// request ids are added as strings.
- String ridString = (String) enum1.nextElement();
+ String ridString = (String) enum1.nextElement();
RequestId rid = new RequestId(ridString);
IRequest r = null;
CMS.debug(
- "resend processing request id " + rid);
+ "resend processing request id " + rid);
try {
r = mQueue.findRequest(rid);
} catch (EBaseException e) {
- // XXX bad case. should we remove the rid now ?
+ // XXX bad case. should we remove the rid now ?
mAuthority.log(ILogger.LL_WARN, CMS.getLogMessage("CMSCORE_CONNECTOR_REQUEST_NOT_FOUND", rid.toString()));
continue;
}
@@ -160,7 +157,7 @@ public class Resender implements IResender {
// request not pending anymore - aborted or cancelled.
completedRids.addElement(rid);
CMS.debug(
- "request id " + rid + " no longer service pending");
+ "request id " + rid + " no longer service pending");
} else {
boolean completed = send(r);
@@ -175,8 +172,7 @@ public class Resender implements IResender {
// if connection is down, don't send the remaining request
// as it will sure fail.
mAuthority.log(ILogger.LL_WARN, CMS.getLogMessage("CMSCORE_CONNECTOR_DOWN"));
- if (e.toString().indexOf("connection not available")
- >= 0)
+ if (e.toString().indexOf("connection not available") >= 0)
break;
}
}
@@ -189,44 +185,44 @@ public class Resender implements IResender {
RequestId id = (RequestId) en.nextElement();
CMS.debug(
- "Connector: Removed request " + id + " from re-send queue");
+ "Connector: Removed request " + id + " from re-send queue");
mRequestIds.removeElement(id.toString());
CMS.debug(
- "Connector: mRequestIds now has " +
- mRequestIds.size() + " elements.");
+ "Connector: mRequestIds now has " +
+ mRequestIds.size() + " elements.");
}
}
}
// this is almost the same as connector's send.
private boolean send(IRequest r)
- throws IOException, EBaseException {
+ throws IOException, EBaseException {
IRequest reply = null;
-
+
try {
HttpPKIMessage tomsg = new HttpPKIMessage();
HttpPKIMessage replymsg = null;
tomsg.fromRequest(r);
replymsg = (HttpPKIMessage) mConn.send(tomsg);
- if(replymsg==null)
+ if (replymsg == null)
return false;
CMS.debug(
- r.getRequestId() + " resent to CA");
-
- RequestStatus replyStatus =
- RequestStatus.fromString(replymsg.reqStatus);
+ r.getRequestId() + " resent to CA");
+
+ RequestStatus replyStatus =
+ RequestStatus.fromString(replymsg.reqStatus);
int index = replymsg.reqId.lastIndexOf(':');
- RequestId replyRequestId =
- new RequestId(replymsg.reqId.substring(index + 1));
+ RequestId replyRequestId =
+ new RequestId(replymsg.reqId.substring(index + 1));
if (Debug.ON)
Debug.trace("reply request id " + replyRequestId +
- " for request " + r.getRequestId());
+ " for request " + r.getRequestId());
if (replyStatus != RequestStatus.COMPLETE) {
CMS.debug("resend " +
- r.getRequestId() + " still not completed.");
+ r.getRequestId() + " still not completed.");
return false;
}
@@ -237,7 +233,7 @@ public class Resender implements IResender {
mQueue.markAsServiced(r);
mQueue.releaseRequest(r);
CMS.debug(
- "resend released request " + r.getRequestId());
+ "resend released request " + r.getRequestId());
return true;
} catch (EBaseException e) {
// same as not having sent it, so still want to resend.
@@ -248,6 +244,5 @@ public class Resender implements IResender {
return false;
}
-
-}
+}