summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/connector
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-03-24 02:27:47 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-03-26 11:43:54 -0500
commit621d9e5c413e561293d7484b93882d985b3fe15f (patch)
tree638f3d75761c121d9a8fb50b52a12a6686c5ac5c /base/common/src/com/netscape/certsrv/connector
parent40d3643b8d91886bf210aa27f711731c81a11e49 (diff)
downloadpki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder. This folder was created during svn migration and is no longer needed. This folder has now been removed and the contents have been moved up one level. Ticket #131
Diffstat (limited to 'base/common/src/com/netscape/certsrv/connector')
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IConnector.java61
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IHttpConnFactory.java51
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IHttpConnection.java41
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IHttpPKIMessage.java58
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IPKIMessage.java71
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IRemoteAuthority.java56
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IRequestEncoder.java49
-rw-r--r--base/common/src/com/netscape/certsrv/connector/IResender.java39
8 files changed, 426 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/connector/IConnector.java b/base/common/src/com/netscape/certsrv/connector/IConnector.java
new file mode 100644
index 000000000..202fb0794
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IConnector.java
@@ -0,0 +1,61 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.connector;
+
+import com.netscape.certsrv.base.EBaseException;
+import com.netscape.certsrv.request.IRequest;
+
+/**
+ * This interface represents a connector that forwards
+ * CMS requests to a remote authority.
+ *
+ * To register a connector, one can add the following
+ * to the CMS.cfg:
+ *
+ * <pre>
+ *
+ * Example for KRA type connector.
+ * ca.connector.KRA.enable=true
+ * ca.connector.KRA.host=thehost.netscape.com #Remote host.
+ * ca.connector.KRA.port=1974 #Remote host port.
+ * ca.connector.KRA.nickName="cert-kra" #Nickname of connector for identity purposes.
+ * ca.connector.KRA.uri="/kra/connector" #Uri of the KRA server.
+ * ca.connector.KRA.id="kra"
+ * ca.connector.KRA.minHttpConns=1 #Min connection pool connections.
+ * ca.connector.KRA.maxHttpConns=10 #Max connection pool connections.
+ * </pre>
+ *
+ * @version $Revision$, $Date$
+ */
+public interface IConnector {
+
+ /**
+ * Sends the request to a remote authority.
+ *
+ * @param req Request to be forwarded to remote authority.
+ * @return true for success, otherwise false.
+ * @exception EBaseException Failure to send request to remote authority.
+ */
+ public boolean send(IRequest req)
+ throws EBaseException;
+
+ /**
+ * Starts this connector.
+ */
+ public void start();
+}
diff --git a/base/common/src/com/netscape/certsrv/connector/IHttpConnFactory.java b/base/common/src/com/netscape/certsrv/connector/IHttpConnFactory.java
new file mode 100644
index 000000000..27a94a57f
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IHttpConnFactory.java
@@ -0,0 +1,51 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or F conspicuously and appropriately publish on eac
+// copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that{
+
+ /**
+ * Retrieves the request type.
+ *
+ * @return String with the type of request.
+ */
+ public String getReqType();
+
+ /**
+ * Retrieves the request identifier.
+ *
+ * @return String of name of request.
+ */
+ public String getReqId();
+
+ /**
+ * Copies contents of request to make a simple name/value message.
+ *
+ * @param r Instance of IRequest to be copied from.
+ */
+ public void fromRequest(IRequest r);
+
+ /**
+ * Copies contents to request.
+ *
+ * @param r Instance of IRequest to be copied to.
+ */
+ public void toRequest(IRequest r);
+}
diff --git a/base/common/src/com/netscape/certsrv/connector/IPKIMessage.java b/base/common/src/com/netscape/certsrv/connector/IPKIMessage.java
new file mode 100644
index 000000000..787dd8385
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IPKIMessage.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.connector;
+
+import java.io.Serializable;
+
+import com.netscape.certsrv.request.IRequest;
+
+/**
+ * Messages that are serialized and go over the wire.
+ * It must be serializable, and
+ * later will be inherited by CRMF message.
+ *
+ * @version $Revision$, $Date$
+ */
+public interface IPKIMessage extends Serializable {
+
+ /**
+ *
+ * Returns status of request.
+ *
+ * @return String of request status.
+ */
+ public String getReqStatus();
+
+ /**
+ * Retrieves the request type.
+ *
+ * @return String of type of request.
+ */
+ public String getReqType();
+
+ /**
+ * Retrieves the request identifer.
+ *
+ * @return String of name of request.
+ */
+ public String getReqId();
+
+ /**
+ * Makes a PKIMessage from a request
+ * PKIMessage will be sent to wire.
+ *
+ * @param r Request to copy from.
+ */
+ public void fromRequest(IRequest r);
+
+ /**
+ * Copies contents of PKIMessage to the request
+ * PKIMessage is from the wire.
+ *
+ * @param r Request to copy to.
+ */
+ public void toRequest(IRequest r);
+
+}
diff --git a/base/common/src/com/netscape/certsrv/connector/IRemoteAuthority.java b/base/common/src/com/netscape/certsrv/connector/IRemoteAuthority.java
new file mode 100644
index 000000000..50a3aea5f
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IRemoteAuthority.java
@@ -0,0 +1,56 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.connector;
+
+/**
+ * This represents a remote authority that can be
+ * a certificate manager, or key recovery manager or
+ * some other manager.
+ *
+ * @version $Revision$, $Date$
+ */
+public interface IRemoteAuthority {
+
+ /**
+ * Retrieves the host name of the remote Authority.
+ *
+ * @return String with the name of host of remote Authority.
+ */
+ public String getHost();
+
+ /**
+ * Retrieves the port number of the remote Authority.
+ *
+ * @return Int with port number of remote Authority.
+ */
+ public int getPort();
+
+ /**
+ * Retrieves the URI of the remote Authority.
+ *
+ * @return String with URI of remote Authority.
+ */
+ public String getURI();
+
+ /**
+ * Retrieves the timeout value for the connection to the remote Authority.
+ *
+ * @return In with remote Authority timeout value.
+ */
+ public int getTimeout();
+}
diff --git a/base/common/src/com/netscape/certsrv/connector/IRequestEncoder.java b/base/common/src/com/netscape/certsrv/connector/IRequestEncoder.java
new file mode 100644
index 000000000..478af4174
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IRequestEncoder.java
@@ -0,0 +1,49 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.connector;
+
+import java.io.IOException;
+
+/**
+ * This represents a rquest encoder that serializes and
+ * deserializes a request to a Remote Authority so that it can be sent through
+ * the connector.
+ *
+ * @version $Revision$, $Date$
+ */
+public interface IRequestEncoder {
+
+ /**
+ * Encodes a request object.
+ *
+ * @param r Object to serve as the source of the message.
+ * @return String containing encoded message.
+ * @exception IOException Failure of the encoding operation due to IO error.
+ */
+ String encode(Object r)
+ throws IOException;
+
+ /**
+ * Dncodes a String into an object.
+ *
+ * @return Object which is the result of the decoded message.
+ * @exception IOException Failure of the decoding operation due to IO error.
+ */
+ Object decode(String s)
+ throws IOException;
+}
diff --git a/base/common/src/com/netscape/certsrv/connector/IResender.java b/base/common/src/com/netscape/certsrv/connector/IResender.java
new file mode 100644
index 000000000..85d3e364c
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/connector/IResender.java
@@ -0,0 +1,39 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.connector;
+
+import com.netscape.certsrv.request.IRequest;
+
+/**
+ * Resend requests at intervals to the server to ensure completion of requests.
+ * Default interval is 5 minutes. The need to resend a message could arise
+ * due to an error or the fact that the message could not be serviced
+ * immediately.
+ *
+ * @version $Revision$, $Date$
+ */
+public interface IResender extends Runnable {
+
+ /**
+ * Adds the request to the resend queue.
+ *
+ * @param r Request to be placed on the resend queue.
+ */
+ public void addRequest(IRequest r);
+
+}