summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java66
1 files changed, 31 insertions, 35 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
index cb5e4cb6..99b1bc02 100644
--- a/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
+++ b/pki/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.dbs;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -35,15 +34,13 @@ import com.netscape.certsrv.dbs.EDBException;
import com.netscape.certsrv.dbs.IDBAttrMapper;
import com.netscape.certsrv.dbs.IDBObj;
import com.netscape.certsrv.logging.ILogger;
-
/**
- * A class represents ann attribute mapper that maps
- * a Java object into LDAP attribute,
- * and vice versa.
- *
+ * A class represents ann attribute mapper that maps a Java object into LDAP
+ * attribute, and vice versa.
+ *
* @author thomask
- * @version $Revision$, $Date$
+ * @version $Revision$, $Date$
*/
public class ObjectStreamMapper implements IDBAttrMapper {
@@ -69,9 +66,8 @@ public class ObjectStreamMapper implements IDBAttrMapper {
/**
* Maps object to ldap attribute set.
*/
- public void mapObjectToLDAPAttributeSet(IDBObj parent, String name,
- Object obj, LDAPAttributeSet attrs)
- throws EBaseException {
+ public void mapObjectToLDAPAttributeSet(IDBObj parent, String name,
+ Object obj, LDAPAttributeSet attrs) throws EBaseException {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
@@ -79,60 +75,60 @@ public class ObjectStreamMapper implements IDBAttrMapper {
os.writeObject(obj);
byte data[] = bos.toByteArray();
if (data == null) {
- CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet " +
- name + " size=0");
+ CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet "
+ + name + " size=0");
} else {
- CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet " +
- name + " size=" + data.length);
+ CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet "
+ + name + " size=" + data.length);
}
- attrs.add(new LDAPAttribute(mLdapName,
- data));
+ attrs.add(new LDAPAttribute(mLdapName, data));
} catch (IOException e) {
- /*LogDoc
- *
+ /*
+ * LogDoc
+ *
* @phase Maps object to ldap attribute set
+ *
* @message ObjectStreamMapper: <exception thrown>
*/
- mLogger.log(ILogger.EV_SYSTEM, ILogger.S_DB, ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_DBS_OBJECTSTREAM_MAPPER_ERROR",
- e.toString()));
- throw new EDBException(
- CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name));
+ mLogger.log(ILogger.EV_SYSTEM, ILogger.S_DB, ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_DBS_OBJECTSTREAM_MAPPER_ERROR",
+ e.toString()));
+ throw new EDBException(CMS.getUserMessage(
+ "CMS_DBS_SERIALIZE_FAILED", name));
}
}
/**
- * Maps LDAP attributes into object, and put the object
- * into 'parent'.
+ * Maps LDAP attributes into object, and put the object into 'parent'.
*/
- public void mapLDAPAttributeSetToObject(LDAPAttributeSet attrs,
- String name, IDBObj parent) throws EBaseException {
+ public void mapLDAPAttributeSetToObject(LDAPAttributeSet attrs,
+ String name, IDBObj parent) throws EBaseException {
try {
LDAPAttribute attr = attrs.getAttribute(mLdapName);
if (attr == null) {
return;
}
- ByteArrayInputStream bis = new ByteArrayInputStream(
- (byte[]) attr.getByteValues().nextElement());
+ ByteArrayInputStream bis = new ByteArrayInputStream((byte[]) attr
+ .getByteValues().nextElement());
ObjectInputStream is = new ObjectInputStream(bis);
parent.set(name, is.readObject());
} catch (IOException e) {
- throw new EDBException(
- CMS.getUserMessage("CMS_DBS_DESERIALIZE_FAILED", name));
+ throw new EDBException(CMS.getUserMessage(
+ "CMS_DBS_DESERIALIZE_FAILED", name));
} catch (ClassNotFoundException e) {
- throw new EDBException(
- CMS.getUserMessage("CMS_DBS_DESERIALIZE_FAILED", name));
+ throw new EDBException(CMS.getUserMessage(
+ "CMS_DBS_DESERIALIZE_FAILED", name));
}
}
/**
* Maps search filters into LDAP search filter.
*/
- public String mapSearchFilter(String name, String op,
- String value) throws EBaseException {
+ public String mapSearchFilter(String name, String op, String value)
+ throws EBaseException {
return mLdapName + op + value;
}
}