List of usage examples for org.apache.commons.lang SerializationUtils serialize
public static byte[] serialize(Serializable obj)
Serializes an Object
to a byte array for storage/serialization.
From source file:jp.co.acroquest.endosnipe.perfdoctor.rule.RuleManager.java
/** * ???<br>/*from w w w.j av a 2s .c o m*/ * rollbackRuleSet???????????? * * @return ?? */ public synchronized SerializedRules saveRuleSet() { byte[] ruleSetConfigMapData = SerializationUtils.serialize(this.ruleSetConfigMap_); byte[] ruleSetMapData = SerializationUtils.serialize(this.ruleSetMap_); return new SerializedRules(ruleSetConfigMapData, ruleSetMapData); }
From source file:com.splicemachine.db.iapi.types.UserType.java
/** * * Get Key length. TODO JL./*from ww w .java2s . c o m*/ * * @return * @throws StandardException */ @Override public int encodedKeyLength() throws StandardException { return isNull() ? 1 : SerializationUtils.serialize((Serializable) value).length; }
From source file:com.baidu.rigel.biplatform.tesseract.node.service.impl.IsNodeServiceImpl.java
@Override public void saveNodeImage(Node node) { LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_BEGIN, "saveNodeImage", "[node:" + node + "]")); if (node == null || StringUtils.isEmpty(node.getClusterName())) { LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_EXCEPTION, "saveNodeImage", "[node:" + node + "]")); throw new IllegalArgumentException(); }// w w w .jav a2 s. co m FileUtils.write(node.getImageFilePath(), SerializationUtils.serialize(node), true); LOGGER.info( String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_END, "saveNodeImage", "[node:" + node + "]")); }
From source file:com.splicemachine.db.iapi.types.UserType.java
/** * * Encode into Key/*from w ww . j a v a 2 s . c o m*/ * * @see OrderedBytes#encodeBlobVar(PositionedByteRange, byte[], Order) * * @param src * @param order * @throws StandardException */ @Override public void encodeIntoKey(PositionedByteRange src, Order order) throws StandardException { if (isNull()) OrderedBytes.encodeNull(src, order); else OrderedBytes.encodeBlobVar(src, SerializationUtils.serialize((Serializable) value), order); }
From source file:com.flexive.shared.mbeans.FxCacheProxy.java
/** * Marshal a value before writing it to the cache, if necessary. * * <p>If the cache is shared between several deployments (class loaders) in a VM, we need * to serialize all values before writing them to the cache to avoid ClassCastExceptions. * This obviously has a grave performance penalty, but really seems to be the only solution in this scenario. * For optimal cache performance, deploy your applications in a single EAR * or disabled the shared cache if you deploy only a single WAR file.</p> /*from w w w .j av a 2s .c o m*/ * @param value the value to be written * @return the marshaled value * @since 3.1.4 * @see CacheAdmin#isSharedCache() */ public static Object marshal(Object value) { // marshal only if the cache is shared between deployments, otherwise let JBoss Cache handle this return CacheAdmin.isSharedCache() ? SerializationUtils.serialize((Serializable) value) : value; }
From source file:info.raack.appliancelabeler.data.JDBCDatabase.java
public void saveOAuthTokensForUserId(String userId, String email, Map<String, OAuthConsumerToken> tokens) { HashMap<String, OAuthConsumerToken> hashMapForTokens = new HashMap<String, OAuthConsumerToken>(); hashMapForTokens.putAll(tokens);//from w w w . j ava 2s .c om SqlLobValue blob = new SqlLobValue(SerializationUtils.serialize(hashMapForTokens)); if (email != null) { jdbcTemplate.update(saveAccessTokensForUser, new Object[] { userId, email, blob }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.BLOB }); } else { jdbcTemplate.update(saveAccessTokensForUserWithoutEmail, new Object[] { userId, blob }, new int[] { Types.VARCHAR, Types.BLOB }); } }
From source file:com.splicemachine.db.iapi.types.UserType.java
public void updateThetaSketch(UpdateSketch updateSketch) { if (!isNull()) updateSketch.update(SerializationUtils.serialize(SerializationUtils.serialize((Serializable) value))); }
From source file:ch.zhaw.ficore.p2abc.services.user.UserServiceGUI.java
@POST() @Path("/addURL") public Response addURL(@FormParam("name") final String name, @FormParam("url") final String url) { log.entry();// w w w . j av a 2 s . c o m try { urlStorage.put(name, SerializationUtils.serialize(url)); return log.exit(urls()); } 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:edu.illinois.cs.cogcomp.annotation.BasicAnnotatorService.java
/** * run the named annotator on the TextAnnotation provided * * @param ta TextAnnotation to update// w w w . j ava 2 s . c om * @param viewName name of View to populate * @throws AnnotatorException */ private void addViewAndCache(TextAnnotation ta, String viewName) throws AnnotatorException { // allow for TOKENS and SENTENCE View to be present independently of explicit annotator, // as TextAnnotationBuilder provides these if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName)) return; if (!viewProviders.containsKey(viewName)) throw new AnnotatorException("View '" + viewName + "' is not supported by this AnnotatorService. "); Annotator annotator = viewProviders.get(viewName); // get inputs required by annotator // recursive call: MUST HAVE VERIFIED NO CYCLICAL DEPENDENCIES // TODO: add depth-first search: look for cycles for (String prereqViewName : annotator.getRequiredViews()) { addView(ta, prereqViewName); } View view = annotator.getView(ta); ta.addView(viewName, view); if (!disableCache) { String cacheKey = getCacheKey(ta, viewName); removeKeyFromCache(cacheKey); putInCache(cacheKey, SerializationUtils.serialize(view)); } }
From source file:fr.inria.oak.paxquery.translation.Logical2Pact.java
private static final Operator<Record>[] translate(CartesianProduct cp) { Operator<Record>[] childPlan1 = translate(cp.getLeft()); Operator<Record>[] childPlan2 = translate(cp.getRight()); // create CrossOperator for cartesian product CrossOperator cartesianProduct = CrossOperator.builder(CartesianProductOperator.class).input1(childPlan1) .input2(childPlan2).name("Product").build(); // cartesian product configuration final String encodedNRSMD1 = DatatypeConverter .printBase64Binary(SerializationUtils.serialize(cp.getLeft().getNRSMD())); cartesianProduct.setParameter(PACTOperatorsConfiguration.NRSMD1_BINARY.toString(), encodedNRSMD1); final String encodedNRSMD2 = DatatypeConverter .printBase64Binary(SerializationUtils.serialize(cp.getRight().getNRSMD())); cartesianProduct.setParameter(PACTOperatorsConfiguration.NRSMD2_BINARY.toString(), encodedNRSMD2); return new Operator[] { cartesianProduct }; }