@Test public void testGenerateObejctId() throws Exception { String resultId = "resultId"; String url = "http: String defaultEncoding = "utf8"; String digestAlgorithm = "md5"; String objectId = ObjectStoreContentProviderUtils.generateObjectId( resultId, url, defaultEncoding, digestAlgorithm); assertEquals("resultId::c9db569cb388e160e4b86ca1ddff84d7", objectId); }
public static String generateObjectId(String resultId, String url, String defaultEncoding, String digestAlgorithm) { try { StringBuilder strBuilder = new StringBuilder(resultId); strBuilder.append(objectIdSeparator); MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update(url.getBytes(defaultEncoding)); strBuilder.append(new String(Hex.encodeHex(md.digest()))); return strBuilder.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
ObjectStoreContentProviderUtils { public static String generateObjectId(String resultId, String url, String defaultEncoding, String digestAlgorithm) { try { StringBuilder strBuilder = new StringBuilder(resultId); strBuilder.append(objectIdSeparator); MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update(url.getBytes(defaultEncoding)); strBuilder.append(new String(Hex.encodeHex(md.digest()))); return strBuilder.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }
ObjectStoreContentProviderUtils { public static String generateObjectId(String resultId, String url, String defaultEncoding, String digestAlgorithm) { try { StringBuilder strBuilder = new StringBuilder(resultId); strBuilder.append(objectIdSeparator); MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update(url.getBytes(defaultEncoding)); strBuilder.append(new String(Hex.encodeHex(md.digest()))); return strBuilder.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } private  ObjectStoreContentProviderUtils(); }
ObjectStoreContentProviderUtils { public static String generateObjectId(String resultId, String url, String defaultEncoding, String digestAlgorithm) { try { StringBuilder strBuilder = new StringBuilder(resultId); strBuilder.append(objectIdSeparator); MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update(url.getBytes(defaultEncoding)); strBuilder.append(new String(Hex.encodeHex(md.digest()))); return strBuilder.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } private  ObjectStoreContentProviderUtils(); static byte[] getContentFromURL(String resourceLoc,
			ContentRetrievalContext context); static byte[] getContentFromURL(URL url,
            ContentRetrievalContext context); static String generateObjectId(String resultId, String url,
			String defaultEncoding, String digestAlgorithm); static String extractResultIdFromObjectId(String objectId); }
ObjectStoreContentProviderUtils { public static String generateObjectId(String resultId, String url, String defaultEncoding, String digestAlgorithm) { try { StringBuilder strBuilder = new StringBuilder(resultId); strBuilder.append(objectIdSeparator); MessageDigest md = MessageDigest.getInstance(digestAlgorithm); md.update(url.getBytes(defaultEncoding)); strBuilder.append(new String(Hex.encodeHex(md.digest()))); return strBuilder.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } private  ObjectStoreContentProviderUtils(); static byte[] getContentFromURL(String resourceLoc,
			ContentRetrievalContext context); static byte[] getContentFromURL(URL url,
            ContentRetrievalContext context); static String generateObjectId(String resultId, String url,
			String defaultEncoding, String digestAlgorithm); static String extractResultIdFromObjectId(String objectId); static final String defaultEncoding; }