List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:com.castlabs.csf.cff.CreateStreamingDeliveryTargetFileset.java
@Override public int run() throws Exception { logger = setupLogger();//from ww w. j av a2s.com if (encKid != null) { this.keyid = UUID.fromString(this.encKid); this.cek = new SecretKeySpec(Hex.decodeHex(this.encKeySecretKey), "AES"); } Map<Track, String> trackOriginalFilename = setupTracks(); FragmentIntersectionFinder intersectionFinder = getFragmentStartSamples(trackOriginalFilename); Map<Track, String> filenames = generateFilenames(trackOriginalFilename); StreamingDeliveryTargetMp4Builder mp4Builder = new StreamingDeliveryTargetMp4Builder(); mp4Builder.setIntersectionFinder(intersectionFinder); Movie m = new Movie(); for (Map.Entry<Track, String> e : trackOriginalFilename.entrySet()) { if (keyid != null) { m.setTracks(Collections.<Track>singletonList(new CencEncryptingTrackImpl(e.getKey(), keyid, cek))); } else { m.setTracks(Collections.<Track>singletonList(e.getKey())); } String apid = "urn:dece:apid:org:castlabs:" + FilenameUtils.getBaseName(e.getValue()); mp4Builder.setApid(apid); Container c = mp4Builder.build(m); String filename = filenames.get(e.getKey()); FileOutputStream fos = new FileOutputStream(filename); logger.info(String.format("Writing %s (track_ID=%d, apid=%s)", filename, e.getKey().getTrackMetaData().getTrackId(), apid)); c.writeContainer(fos.getChannel()); fos.close(); } return 0; }
From source file:edu.vt.middleware.webflow.ClientFlowExecutionKey.java
public static ClientFlowExecutionKey parse(final String key) throws BadlyFormattedFlowExecutionKeyException { final String[] tokens = key.split("_"); if (tokens.length != 2) { throw new BadlyFormattedFlowExecutionKeyException(key, KEY_FORMAT); }//from www . j av a2 s .c o m final UUID uuid; try { uuid = UUID.fromString(tokens[0]); } catch (Exception e) { throw new BadlyFormattedFlowExecutionKeyException(key, KEY_FORMAT); } final byte[] decoded; try { decoded = CodecUtil.b64(tokens[1]); } catch (Exception e) { throw new BadlyFormattedFlowExecutionKeyException(key, KEY_FORMAT); } return new ClientFlowExecutionKey(uuid, decoded); }
From source file:me.prokopyl.commandtools.migration.UUIDFetcher.java
private static UUID fromMojangUUID(String id) //Mojang sends string UUIDs without dashes ... { return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); }
From source file:at.ac.tuwien.infosys.jcloudscale.classLoader.simple.RemoteClassProvider.java
@Override public void onMessage(Message message) { String className = null;//from w w w. j a va2 s.co m try { className = ((ClassRequest) ((ObjectMessage) message).getObject()).className; log.fine("Message received:" + className); // we expect sender to specify the query he's waiting response into the JMSReplyTo Destination destination = message.getJMSReplyTo(); UUID correlationId = UUID.fromString(message.getJMSCorrelationID()); // preparing class bytecode. byte[] bytecode = null; try { String classPath = className.replace('.', '/') + ".class";//TODO: use utils. InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(classPath); // If the class cannot be found, attempt to find a resource with the requested name if (is == null) { try { ClassPathResource resource = new ClassPathResource(className); if (resource.exists()) { is = resource.getInputStream(); } } catch (IOException e) { // Ignore } } if (is == null) log.severe(String.format("Requested class %s was not found.", className)); else bytecode = RemoteClassLoaderUtils.getByteArray(is); } catch (Exception ex) { log.severe("Failed to provide required class " + className + ": " + ex.toString()); ex.printStackTrace(); } finally { mq.respond(new ClassResponse(bytecode), destination, correlationId); } } catch (JMSException e) { log.severe("Failed to process message (" + className + "): " + e.toString()); e.printStackTrace(); } }
From source file:net.projectmonkey.spring.acl.hbase.repository.AccessControlEntryValue.java
public AccessControlEntryValue(final byte[] key, final PermissionFactory permissionFactory) { Assert.notNull(key, "key must not be null"); Assert.notNull(permissionFactory, "permissionFactory must not be null"); String keyString = new String(key); String[] values = keyString.split(SEPARATOR); String authority = values[1]; boolean principal = Boolean.valueOf(values[2]); int permissionMask = Integer.parseInt(values[3]); Assert.isTrue(values.length == 5, "Key must consist of 5 values separated by :"); this.id = UUID.fromString(values[0]); this.sid = SidUtil.createSid(authority, principal); this.permission = permissionFactory.buildFromMask(permissionMask); this.granting = Boolean.valueOf(values[4]); this.authority = authority; this.key = key; }
From source file:com.boxedfolder.web.client.BeaconResourceTests.java
@Before public void setup() { MockitoAnnotations.initMocks(this); BeaconResource resource = new BeaconResource(); resource.setService(service);//from w w w. j a v a2 s.c om restUserMockMvc = MockMvcBuilders.standaloneSetup(resource).build(); mapper = new ObjectMapper(); mapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); mapper.setConfig(mapper.getSerializationConfig().withView(View.Client.class)); // Create 3 beacons testData = new ArrayList<Beacon>(); Beacon beacon = new Beacon(); beacon.setName("Beacon 1"); beacon.setMajor(1); beacon.setMinor(2); beacon.setUuid(UUID.fromString("de305d54-75b4-431b-adb2-eb6b9e546014")); testData.add(beacon); beacon = new Beacon(); beacon.setName("Beacon 2"); beacon.setMajor(1); beacon.setMinor(2); beacon.setUuid(UUID.fromString("de305d54-75b4-431b-adb2-eb6b9e546011")); testData.add(beacon); beacon = new Beacon(); beacon.setName("Beacon 3"); beacon.setMajor(1); beacon.setMinor(2); beacon.setUuid(UUID.fromString("de305d54-75b4-431b-adb2-eb6b9e546012")); testData.add(beacon); }
From source file:com.hellblazer.process.impl.AbstractManagedProcess.java
public static UUID getIdFrom(File homeDirectory) { if (!homeDirectory.exists() || !homeDirectory.isDirectory()) { return null; }/*from ww w . j ava 2 s .c o m*/ File[] contents = homeDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith(CONTROL_DIR_PREFIX); } }); if (contents == null || contents.length == 0) { if (log.isLoggable(Level.FINE)) { log.fine("Home directory does not exist or does not contain a valid control directory: " + homeDirectory.getAbsolutePath()); } return null; } if (contents.length > 1) { if (log.isLoggable(Level.FINE)) { log.fine("Home directory contains more than a single control directory: " + homeDirectory.getAbsolutePath()); } return null; } String uuidString = contents[0].getName().substring(CONTROL_DIR_PREFIX.length()); if (uuidString.length() == 0) { if (log.isLoggable(Level.FINE)) { log.fine("Home directory does not contain a valid control directory: " + homeDirectory.getAbsolutePath()); } return null; } return UUID.fromString(uuidString); }
From source file:com.formkiq.core.dao.QueueDaoImpl.java
@SuppressWarnings("resource") @Override/* w ww . j av a2 s. c o m*/ public int delete(final String messageid) { String sql = "delete from queue_messages where " + " queue_message_id=:id"; Session session = getEntityManager().unwrap(Session.class); int result = session.createSQLQuery(sql).setParameter("id", UUID.fromString(messageid)).executeUpdate(); return result; }
From source file:com.intellectualcrafters.plot.uuid.UUIDFetcher.java
public static UUID getUUID(final String id) { return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); }
From source file:com.boxedfolder.carrot.web.client.AnalyticsResource.java
@JsonView(View.Meta.class) @ResponseStatus(HttpStatus.CREATED)//from w w w . ja v a2s . c o m @RequestMapping(value = "/logs/{appKey}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public AnalyticsLog createAnalyticsLogs(@RequestBody @Valid AnalyticsLog log, @PathVariable("appKey") String appKey) { return service.save(log, UUID.fromString(appKey)); }