List of usage examples for org.apache.commons.lang SerializationUtils deserialize
public static Object deserialize(byte[] objectData)
Deserializes a single Object
from an array of bytes.
From source file:jp.co.acroquest.endosnipe.perfdoctor.rule.RuleManager.java
/** * ??<br>/*from www .ja v a2 s .co m*/ * * @param serializedRules * ?? */ @SuppressWarnings("unchecked") public synchronized void rollbackRuleSet(final SerializedRules serializedRules) { byte[] ruleSetConfigMapData = serializedRules.getRuleSetConfigMapData(); byte[] ruleMapData = serializedRules.getRuleMapData(); if (ruleSetConfigMapData == null || ruleSetConfigMapData.length == 0 || ruleMapData == null || ruleMapData.length == 0) { return; } this.ruleSetConfigMap_ = (HashMap<String, RuleSetConfig>) SerializationUtils .deserialize(ruleSetConfigMapData); this.ruleSetMap_ = (HashMap<String, RuleSetDef>) SerializationUtils.deserialize(ruleMapData); this.removeList_ = Collections.synchronizedList(new ArrayList<RuleSetConfig>()); }
From source file:com.splicemachine.db.iapi.types.UserType.java
/** * * Decode from Key/*from w ww.j a v a2s. c o m*/ * * @see OrderedBytes#decodeBlobVar(PositionedByteRange) * * @param src * @throws StandardException */ @Override public void decodeFromKey(PositionedByteRange src) throws StandardException { if (OrderedBytes.isNull(src)) setToNull(); else value = SerializationUtils.deserialize(OrderedBytes.decodeBlobVar(src)); }
From source file:com.flexive.shared.mbeans.FxCacheProxy.java
/** * Un-marshal a value processed by {@link #marshal(Object)} before. * * @param value the value to be de-marshaled * @return the original value/* ww w . j a v a 2s . co m*/ * @since 3.1.4 */ public static Object unmarshal(Object value) { return value != null ? (CacheAdmin.isSharedCache() ? SerializationUtils.deserialize((byte[]) value) : value) : null; }
From source file:com.baidu.rigel.biplatform.tesseract.node.service.impl.IsNodeServiceImpl.java
@Override public Node loadLocalNodeImage(Node node) { LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_BEGIN, "loadLocalNodeImage", "[node:" + node + "]")); if (node == null || StringUtils.isEmpty(node.getClusterName())) { LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_EXCEPTION, "loadLocalNodeImage", "[node:" + node + "]")); throw new IllegalArgumentException(); }//from w w w. j av a 2s .c om byte[] nodeInfoByteArr = FileUtils.readFile(node.getImageFilePath()); Node localNodeInfo = null; if (nodeInfoByteArr != null) { localNodeInfo = (Node) SerializationUtils.deserialize(nodeInfoByteArr); // IP??????? node.setBlockSize(localNodeInfo.getBlockSize()); node.setClusterName(localNodeInfo.getClusterName()); node.setCurrBlockUsed(localNodeInfo.getCurrBlockUsed()); } // ? this.saveOrUpdateNodeInfo(node); LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_END, "loadLocalNodeImage", "[node:" + node + "]")); return node; }
From source file:com.splicemachine.mrio.api.core.SMSQLUtil.java
public Activation getActivation(String sql, TxnView txnView) throws SQLException, StandardException { PreparedStatement ps = connect.prepareStatement("call syscs_util.get_activation(?)"); ps.setString(1, sql);//w w w . j ava 2s.com ResultSet rs = ps.executeQuery(); rs.next(); byte[] activationHolderBytes = rs.getBytes(1); try { SpliceSpark.setupSpliceStaticComponents(); } catch (IOException ioe) { StandardException.plainWrapException(ioe); } ActivationHolder ah = (ActivationHolder) SerializationUtils.deserialize(activationHolderBytes); ah.init(txnView); return ah.getActivation(); }
From source file:ch.zhaw.ficore.p2abc.services.user.UserServiceGUI.java
@GET() @Path("/urls") public Response urls() { log.entry();// www.ja va 2 s .co m try { List<String> keys = urlStorage.keysAsStrings(); List<byte[]> values = urlStorage.values(); List<String> urls = new ArrayList<String>(); for (byte[] b : values) { urls.add((String) SerializationUtils.deserialize(b)); } Html html = UserGUI.getHtmlPramble("URLs", request); Div mainDiv = new Div().setCSSClass("mainDiv"); html.appendChild(UserGUI.getBody(mainDiv)); String text = "Here you can define aliases for URLs which are later required when you choose the issuer or verifier while obtaining credentials or requesting a resource."; P p = new P().setCSSClass("info"); mainDiv.appendChild(p); p.appendChild(new Text(text)); mainDiv.appendChild(new H2().appendChild(new Text("URLs"))); Table tbl = new Table(); Tr heading = new Tr().setCSSClass("heading"); heading.appendChild(new Td().appendChild(new Text("Name"))); heading.appendChild(new Td().appendChild(new Text("URL"))); heading.appendChild(new Td().appendChild(new Text("Action"))); tbl.appendChild(heading); int i = 0; for (String key : keys) { Tr tr = new Tr(); tr.appendChild(new Td().appendChild(new Text(key))); tr.appendChild(new Td().appendChild(new Text(urls.get(i)))); Form f = new Form("./deleteURL").setMethod("post").setCSSClass("nopad"); f.appendChild(new Input().setType("submit").setValue("delete")); f.appendChild(new Input().setType("hidden").setName("name").setValue(key)); tr.appendChild(new Td().appendChild(f)); i++; tbl.appendChild(tr); } mainDiv.appendChild(tbl); tbl = new Table(); Tr tr = new Tr(); tr.appendChild(new Td().appendChild(new Text("Name: "))); tr.appendChild(new Td().appendChild(new Input().setType("text").setName("name"))); tbl.appendChild(tr); tr = new Tr(); tr.appendChild(new Td().appendChild(new Text("URL: "))); tr.appendChild(new Td().appendChild(new Input().setType("text").setName("url"))); tbl.appendChild(tr); Form f = new Form("./addURL").setMethod("post"); f.appendChild(tbl); f.appendChild(new Input().setType("Submit").setValue("Add")); mainDiv.appendChild(f); return log.exit(Response.ok(html.write()).build()); } catch (Exception e) { log.catching(e); return log.exit(Response.status(Response.Status.BAD_REQUEST) .entity(UserGUI.errorPage(ExceptionDumper.dumpExceptionStr(e, log), request).write()).build()); } }
From source file:at.gv.egovernment.moa.id.config.auth.OAAuthParameter.java
@Override public PrivateKey getBPKDecBpkDecryptionKey() { try {//from ww w . j a va 2s.c o m EncryptedData encdata = new EncryptedData( oa_auth.getEncBPKInformation().getBPKDecryption().getKeyInformation(), oa_auth.getEncBPKInformation().getBPKDecryption().getIv()); byte[] serializedData = ConfigurationEncrytionUtil.getInstance().decrypt(encdata); BPKDecryptionParameters data = (BPKDecryptionParameters) SerializationUtils.deserialize(serializedData); return data.getPrivateKey(); } catch (BuildException e) { // TODO Auto-generated catch block Logger.error("Can not decrypt key information for bPK decryption", e); } catch (NullPointerException e) { Logger.error("No keyInformation found for bPK decryption"); } return null; }
From source file:mitm.common.sms.hibernate.SMSGatewayDAOTest.java
@Test public void testAddSMS() throws DatabaseException { final Long id = executor.executeTransaction(new DatabaseAction<Long>() { @Override//from ww w.j av a2s.c om public Long doAction(Session session) throws DatabaseException { SMS sms = new SMSImpl("123456", "sms body", "some extra data"); return addSMSAction(session, sms, null); } }); assertNotNull(id); SMSGatewayEntity entity = executor.executeTransaction(new DatabaseAction<SMSGatewayEntity>() { @Override public SMSGatewayEntity doAction(Session session) throws DatabaseException { return loadByIDAction(session, id); } }); SMS sms = SMSGatewayDAO.entityToSMS(entity); assertEquals(id, sms.getID()); assertEquals("123456", entity.getPhoneNumber()); assertEquals("sms body", entity.getMessage()); assertNotNull(entity.getData()); Object deserialized = SerializationUtils.deserialize(entity.getData()); assertTrue(deserialized instanceof String); assertEquals("some extra data", (String) deserialized); }
From source file:edu.mayo.cts2.framework.plugin.service.bioportal.rest.BioportalRestService.java
/** * Gets the last update.//from ww w.j a va 2 s .c o m * * @return the last update */ protected Date getLastUpdate() { File file = this.getUpdateLogFile(); if (!file.exists()) { return null; } else { byte[] data; try { data = FileUtils.readFileToByteArray(file); } catch (IOException e) { throw new RuntimeException(e); } Date date = (Date) SerializationUtils.deserialize(data); return date; } }
From source file:com.ephesoft.dcma.da.common.ExecuteUpdatePatch.java
private Map<String, List<BatchClassModule>> readModuleSerializeFile() { FileInputStream fileInputStream = null; Map<String, List<BatchClassModule>> newModulesMap = null; File serializedFile = null;// w w w . j a va2s . c o m try { String moduleFilePath = dbPatchFolderLocation + File.separator + DataAccessConstant.MODULE_UPDATE + SERIALIZATION_EXT; serializedFile = new File(moduleFilePath); fileInputStream = new FileInputStream(serializedFile); newModulesMap = (Map<String, List<BatchClassModule>>) SerializationUtils.deserialize(fileInputStream); updateFile(serializedFile, moduleFilePath); } catch (IOException e) { LOG.info(DataAccessConstant.ERROR_DURING_READING_THE_SERIALIZED_FILE + e.getMessage(), e); } catch (Exception e) { LOG.error(DataAccessConstant.ERROR_DURING_DE_SERIALIZING_THE_PROPERTIES_FOR_DATABASE_UPGRADE + e.getMessage(), e); } finally { try { if (fileInputStream != null) { fileInputStream.close(); } } catch (Exception e) { if (serializedFile != null) { LOG.error(DataAccessConstant.PROBLEM_CLOSING_STREAM_FOR_FILE + serializedFile.getName()); } } } return newModulesMap; }