List of usage examples for java.util UUID toString
public String toString()
From source file:com.ryan.ryanreader.fragments.PostListingFragment.java
public static PostListingFragment newInstance(final RedditSubreddit subreddit, final URI url, final UUID session, final CacheRequest.DownloadType downloadType) { final PostListingFragment f = new PostListingFragment(); final Bundle bundle = new Bundle(4); bundle.putParcelable("subreddit", subreddit); bundle.putString("url", url.toString()); if (session != null) bundle.putString("session", session.toString()); bundle.putString("downloadType", downloadType.name()); f.setArguments(bundle);/*w ww . ja va2 s .c om*/ return f; }
From source file:at.ac.tuwien.infosys.jcloudscale.utility.ReflectionUtil.java
public static void injectCloudId(Object obj, UUID id) { for (Field f : obj.getClass().getDeclaredFields()) { if (f.getAnnotation(CloudObjectId.class) != null) { f.setAccessible(true);//from w w w .j a va 2 s .c o m try { if (f.getType().equals(String.class)) f.set(obj, id.toString()); else f.set(obj, id); } catch (Exception e) { e.printStackTrace(); throw new JCloudScaleException(e, "Unexpected error when injecting @CloudObjectId"); } } } }
From source file:com.spectralogic.ds3cli.integration.test.helpers.ABMTestHelper.java
/** * Deletes a data policy Acl for group with the specified ID, and verifies that said * acl was deleted. If the acl was not properly deleted, then an error is logged. *//* w w w. j a v a2 s . co m*/ public static void deleteDataPolicyAclForGroup(final UUID aclId, final Ds3Client client) { if (aclId == null) { //This might not be an error if this function is called as part of cleanup code LOG.debug("Data policy Acl was null"); return; } //Delete the acl try { final DeleteDataPolicyAclSpectraS3Response deleteAcl = client .deleteDataPolicyAclSpectraS3(new DeleteDataPolicyAclSpectraS3Request(aclId.toString())); assertThat(deleteAcl.getStatusCode(), is(204)); } catch (final IOException | AssertionError e) { LOG.error("Data policy Acl was not deleted as expected: {}", aclId.toString()); } //Verify that the Acl was deleted try { client.getDataPolicyAclSpectraS3(new GetDataPolicyAclSpectraS3Request(aclId.toString())); LOG.error("Data policy Acl still exists despite deletion attempt: {}", aclId.toString()); } catch (final IOException e) { //Pass: expected data policy acl to not exist } }
From source file:com.spectralogic.ds3client.integration.test.helpers.ABMTestHelper.java
/** * Deletes a storage domain member with the specified ID, and verifies that said storage * domain member was deleted. If the member was not properly deleted, then an error is logged. */// w w w. j a v a 2 s . c o m public static void deleteStorageDomainMember(final UUID memberId, final Ds3Client client) { if (memberId == null) { //This might not be an error if this function is called as part of cleanup code LOG.debug("Member Id was null"); return; } //Delete the storage domain member try { client.deleteStorageDomainMemberSpectraS3( new DeleteStorageDomainMemberSpectraS3Request(memberId.toString())); } catch (final IOException | AssertionError e) { LOG.error("Storage domain member was not deleted as expected: " + memberId.toString()); } //Verify that the storage domain member was deleted try { client.getStorageDomainMemberSpectraS3(new GetStorageDomainMemberSpectraS3Request(memberId.toString())); LOG.error("Storage domain member still exists despite deletion attempt: " + memberId.toString()); } catch (final IOException e) { //Pass: expected storage domain member to not exist } }
From source file:nu.yona.server.subscriptions.rest.UserController.java
static Link getUserSelfLinkWithTempPassword(UUID userId, String tempPassword) { ControllerLinkBuilder linkBuilder = linkTo(methodOn(UserController.class).getUser(Optional.empty(), tempPassword, userId.toString(), null, null, userId)); // Should call expand, but that's not done because of https://github.com/spring-projects/spring-hateoas/issues/703 return linkBuilder.withSelfRel(); }
From source file:com.cloudera.impala.common.FileSystemUtil.java
/** * Moves all visible (non-hidden) files from a source directory to a destination * directory. Any sub-directories within the source directory are skipped. * Returns the number of files moved as part of this operation. *///w ww .j a v a2 s . c o m public static int moveAllVisibleFiles(Path sourceDir, Path destDir) throws IOException { FileSystem fs = destDir.getFileSystem(CONF); Preconditions.checkState(fs.isDirectory(destDir)); Preconditions.checkState(fs.isDirectory(sourceDir)); // Use the same UUID to resolve all file name conflicts. This helps mitigate problems // that might happen if there is a conflict moving a set of files that have // dependent file names. For example, foo.lzo and foo.lzo_index. UUID uuid = UUID.randomUUID(); // Enumerate all the files in the source int numFilesMoved = 0; for (FileStatus fStatus : fs.listStatus(sourceDir)) { if (fStatus.isDirectory()) { LOG.debug("Skipping copy of directory: " + fStatus.getPath()); continue; } else if (isHiddenFile(fStatus.getPath().getName())) { continue; } Path destFile = new Path(destDir, fStatus.getPath().getName()); if (fs.exists(destFile)) { destFile = new Path(destDir, appendToBaseFileName(destFile.getName(), uuid.toString())); } FileSystemUtil.moveFile(fStatus.getPath(), destFile, false); ++numFilesMoved; } return numFilesMoved; }
From source file:com.oneops.inductor.AbstractOrderExecutor.java
/** * boolean check for uuid//from w w w . ja v a 2s. c om * * @param uuid string */ public static boolean isUUID(String uuid) { if (uuid == null) return false; try { // we have to convert to object and back to string because the built // in fromString does not have // good validation logic. UUID fromStringUUID = UUID.fromString(uuid); String toStringUUID = fromStringUUID.toString(); return toStringUUID.equalsIgnoreCase(uuid); } catch (IllegalArgumentException e) { return false; } }
From source file:edu.usc.goffish.gofs.tools.GoFSDeployGraph.java
private static void writeSlices(IPartitionDirectory partitionDirectory, String graphId, IPartitionBuilder partitionBuilder, IPartitionMapper partitionMapper, IPartitionDistributer partitionDistributer, Long2LongOpenHashMap remoteVerticesMappings) throws IOException { long time;/*from ww w .j a v a 2s. c o m*/ int totalSubgraphs = 0; // write slices and deploy for (ISerializablePartition partition : partitionBuilder.getPartitions()) { // assign remote vertex subgraph ids for (ISubgraph subgraph : partition) { for (ITemplateVertex remoteVertex : subgraph.remoteVertices()) { // CHEAT if (!(remoteVertex instanceof TemplateRemoteVertex)) { throw new IllegalStateException(); } ((TemplateRemoteVertex) remoteVertex) .setRemoteSubgraphId(remoteVerticesMappings.get(remoteVertex.getId())); } } System.out.println("**partition " + partition.getId() + " has " + partition.size() + " subgraphs across " + partition.numVertices() + " vertices"); totalSubgraphs += partition.size(); System.out.println("distributing partition " + partition.getId() + "..."); time = System.currentTimeMillis(); URI dataNodeLocation = partitionMapper.getLocationForPartition(partition); URI slicesLocation = dataNodeLocation.resolve(DataNode.DATANODE_SLICE_DIR.toString()); UUID fragment = partitionDistributer.distribute(slicesLocation, partition); partitionDirectory.putPartitionMapping(graphId, partition.getId(), dataNodeLocation.resolve("#" + fragment.toString())); System.out.println("distribution finished [" + (System.currentTimeMillis() - time) + "ms]"); } System.out.println("**total subgraphs: " + totalSubgraphs); }
From source file:com.spectralogic.ds3client.integration.test.helpers.ABMTestHelper.java
/** * Deletes a data persistence rule with the specified ID, and verifies that said data * persistence rule was deleted. If the rule was not properly deleted, then an error is logged. *//* www . ja va 2 s .co m*/ public static void deleteDataPersistenceRule(final UUID dataPersistenceRuleId, final Ds3Client client) { if (dataPersistenceRuleId == null) { //This might not be an error if this function is called as part of cleanup code LOG.debug("Data persistence rule Id was null"); return; } //Delete the data persistence rule try { client.deleteDataPersistenceRuleSpectraS3( new DeleteDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString())); } catch (final IOException | AssertionError e) { LOG.error("Data persistence rule was not deleted as expected: " + dataPersistenceRuleId.toString()); } //Verify that the data persistence rule was deleted try { client.getDataPersistenceRuleSpectraS3( new GetDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString())); LOG.error("Data persistence rule still exists despite deletion attempt: " + dataPersistenceRuleId.toString()); } catch (final IOException e) { //Pass: expected data persistence rule to not exist } }
From source file:com.spectralogic.ds3cli.helpers.ABMTestHelper.java
/** * Deletes a storage domain member with the specified ID, and verifies that said storage * domain member was deleted. If the member was not properly deleted, then an error is logged. *//* w ww . j av a 2 s . co m*/ public static void deleteStorageDomainMember(final UUID memberId, final Ds3Client client) { if (memberId == null) { //This might not be an error if this function is called as part of cleanup code LOG.debug("Member Id was null"); return; } //Delete the storage domain member try { final DeleteStorageDomainMemberSpectraS3Response deleteMember = client .deleteStorageDomainMemberSpectraS3( new DeleteStorageDomainMemberSpectraS3Request(memberId.toString())); } catch (final IOException | AssertionError e) { LOG.error("Storage domain member was not deleted as expected: {}", memberId.toString()); } //Verify that the storage domain member was deleted try { client.getStorageDomainMemberSpectraS3(new GetStorageDomainMemberSpectraS3Request(memberId.toString())); LOG.error("Storage domain member still exists despite deletion attempt: {}", memberId.toString()); } catch (final IOException e) { //Pass: expected storage domain member to not exist } }