Package org.safehaus.uuid

Examples of org.safehaus.uuid.UUID


   */
  public String init(BIObject dossier) {
    logger.debug("IN");
    try {
      UUIDGenerator uuidGenerator = UUIDGenerator.getInstance();
      UUID uuidObj = uuidGenerator.generateTimeBasedUUID();
      String uuid = uuidObj.toString();
      File tempFolder = new File(tempBaseFolder.getAbsolutePath() + "/" + dossier.getId().toString() + "/" + uuid);
      if (tempFolder.exists()) deleteFolder(tempFolder);
      tempFolder.mkdirs();
      File template = new File(tempFolder.getAbsolutePath() + "/" + TEMPLATE_FILE_NAME);
      ObjTemplate objTemplate = dossier.getActiveTemplate();
View Full Code Here


      Iterator iterImgs = images.keySet().iterator();
      while(iterImgs.hasNext()){
        String logicalName = (String) iterImgs.next();
        //String logicalNameForStoring = pathConfBook.replace('/', '_') + logicalName + ".jpg";
      UUIDGenerator uuidGenerator = UUIDGenerator.getInstance();
      UUID uuidObj = uuidGenerator.generateTimeBasedUUID();
      String uuid = uuidObj.toString();
      // TODO perche salvare su file system? tanto vale tenere in memoria le immagini, oppure scriverli sul file system e far puntare l'immagine al file
        String logicalNameForStoring = uuid + logicalName;
        byte[] content = (byte[])images.get(logicalName);
        File img = new File(tempDir, logicalNameForStoring + ".jpg");
        FileOutputStream fos = new FileOutputStream(img);
View Full Code Here

     * @see it.eng.spagobi.analiticalmodel.functionalitytree.presentation.ITreeHtmlGenerator#makeTree(java.util.List, javax.servlet.http.HttpServletRequest, java.lang.String)
     */
    public StringBuffer makeTree(List objectsList, HttpServletRequest httpReq, String initialPath) {
  // identity string for object of the page
  UUIDGenerator uuidGen = UUIDGenerator.getInstance();
  UUID uuid = uuidGen.generateTimeBasedUUID();
  requestIdentity = uuid.toString();
  requestIdentity = requestIdentity.replaceAll("-", "");
  httpRequest = httpReq;
  reqCont = ChannelUtilities.getRequestContainer(httpRequest);
  urlBuilder = UrlBuilderFactory.getUrlBuilder();
  msgBuilder = MessageBuilderFactory.getMessageBuilder();
View Full Code Here

    List<UUID> generateUuids(UUIDMethod method, int count, String name)
    {
        UUIDGenerator gen = UUIDGenerator.getInstance();
        ArrayList<UUID> uuids = new ArrayList<UUID>(count);
        for (int i = 0; i < count; ++i) {
            UUID uuid;

            switch (method) {
            case RANDOM: // UUID using ~128 bits of randomness
                uuid = gen.generateRandomBasedUUID();
                break;
View Full Code Here

    UUIDGenerator generator = UUIDGenerator.getInstance();

    @Test
    public void testEquality()
    {
        UUID a = generator.generateTimeBasedUUID();
        UUID b = new UUID(a.asByteArray());

        assertEquals(0, timeUUIDType.compare(a.asByteArray(), b.asByteArray()));
    }
View Full Code Here

    }

    @Test
    public void testSmaller()
    {
        UUID a = generator.generateTimeBasedUUID();
        UUID b = generator.generateTimeBasedUUID();
        UUID c = generator.generateTimeBasedUUID();

        assertEquals(-1, timeUUIDType.compare(a.asByteArray(), b.asByteArray()));
        assertEquals(-1, timeUUIDType.compare(b.asByteArray(), c.asByteArray()));
        assertEquals(-1, timeUUIDType.compare(a.asByteArray(), c.asByteArray()));
    }
View Full Code Here

    }

    @Test
    public void testBigger()
    {
        UUID a = generator.generateTimeBasedUUID();
        UUID b = generator.generateTimeBasedUUID();
        UUID c = generator.generateTimeBasedUUID();

        assertEquals(1, timeUUIDType.compare(c.asByteArray(), b.asByteArray()));
        assertEquals(1, timeUUIDType.compare(b.asByteArray(), a.asByteArray()));
        assertEquals(1, timeUUIDType.compare(c.asByteArray(), a.asByteArray()));
    }
View Full Code Here

    @Test
    public void testTimestamp()
    {
        for (int i = 0; i < 100; i++)
        {
            UUID uuid = generator.generateTimeBasedUUID();
            assert TimeUUIDType.getTimestamp(uuid.asByteArray()) == LexicalUUIDType.getUUID(uuid.asByteArray()).timestamp();
        }
    }
View Full Code Here

* @author liufang
*
*/
public class JugUUIDGenerator implements SessionIdGenerator {
  public String get() {
    UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
    return StringUtils.remove(uuid.toString(), '-');
  }
View Full Code Here

    UUIDGenerator generator = UUIDGenerator.getInstance();

    @Test
    public void testEquality()
    {
        UUID a = generator.generateTimeBasedUUID();
        UUID b = new UUID(a.asByteArray());

        assertEquals(0, timeUUIDType.compare(a.asByteArray(), b.asByteArray()));
    }
View Full Code Here

TOP

Related Classes of org.safehaus.uuid.UUID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.