List of usage examples for java.util UUID toString
public String toString()
From source file:org.ovirt.engine.sdk.decorators.DiskProfiles.java
/** * Fetches DiskProfile object by id.//from w ww . j a v a 2 s .co m * * @return {@link DiskProfile } * * @throws ClientProtocolException * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public DiskProfile get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.DiskProfile.class, DiskProfile.class); }
From source file:com.mesosphere.dcos.cassandra.common.tasks.CassandraDaemonTask.java
public CassandraDaemonTask updateConfig(CassandraConfig cassandraConfig, ExecutorConfig executorConfig, UUID targetConfigName) { LOGGER.info("Updating config for task: {} to config: {}", getTaskInfo().getName(), targetConfigName.toString()); final Protos.Label label = Protos.Label.newBuilder().setKey("config_target") .setValue(targetConfigName.toString()).build(); return new CassandraDaemonTask(getBuilder() .setExecutor(getExecutor().update(executorConfig).getExecutorInfo()).setTaskId(createId(getName())) .setData(getData().withNewConfig(cassandraConfig).getBytes()).clearResources() .addAllResources(TaskUtils.updateResources(cassandraConfig.getCpus(), cassandraConfig.getMemoryMb(), getTaskInfo().getResourcesList())) .clearLabels().setLabels(Protos.Labels.newBuilder().addLabels(label).build()).build()); }
From source file:edu.unc.lib.dl.admin.collect.DepositBinCollector.java
private DepositInfo makeDeposit() { DepositInfo info = new DepositInfo(); UUID depositUUID = UUID.randomUUID(); info.depositPID = new PID("uuid:" + depositUUID.toString()); info.depositDir = new File(depositsDirectory, info.depositPID.getUUID()); info.depositDir.mkdir();/*from ww w. j a v a 2s . c o m*/ info.dataDir = new File(info.depositDir, "data"); info.dataDir.mkdir(); return info; }
From source file:com.esri.geoportal.harvester.beans.TaskManagerBean.java
@Override public boolean delete(UUID id) throws CrudlException { try (Connection connection = dataSource.getConnection(); PreparedStatement st = connection.prepareStatement("DELETE FROM TASKS WHERE ID = ?");) { st.setString(1, id.toString()); return st.executeUpdate() > 0; } catch (SQLException ex) { throw new CrudlException("Error selecting task", ex); }//w w w. j a v a2 s .c o m }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java
@Override public void provisionDirectory(UUID instanceId, UUID orgId, UUID owner) throws ServiceBrokerException { try {/*from w w w . j av a 2 s . co m*/ String path = HdfsPathTemplateUtils.fill(userspacePathTemplate, instanceId, orgId); hdfsClient.createDir(path); hdfsClient.setPermission(path, FS_USER_PERMISSION); superUserHdfsClient.setOwner(path, owner.toString(), orgId.toString()); } catch (IOException e) { throw new ServiceBrokerException("Unable to provision directory for: " + instanceId, e); } }
From source file:org.ovirt.engine.sdk.decorators.VnicProfiles.java
/** * Fetches VnicProfile object by id./*from w w w. j a v a2 s.c om*/ * * @return {@link VnicProfile } * * @throws ClientProtocolException * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public VnicProfile get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.VnicProfile.class, VnicProfile.class); }
From source file:com.github.rnewson.couchdb.lucene.LuceneServlet.java
private void cleanup(final HttpServletRequest req, final HttpServletResponse resp) throws IOException, JSONException { final Couch couch = getCouch(req); final Set<String> dbKeep = new HashSet<String>(); final JSONArray databases = couch.getAllDatabases(); for (int i = 0; i < databases.length(); i++) { final Database db = couch.getDatabase(databases.getString(i)); final UUID uuid = db.getUuid(); if (uuid == null) { continue; }//from ww w.j a va 2 s . c om dbKeep.add(uuid.toString()); final Set<String> viewKeep = new HashSet<String>(); for (final DesignDocument ddoc : db.getAllDesignDocuments()) { for (final View view : ddoc.getAllViews().values()) { viewKeep.add(view.getDigest()); } } // Delete all indexes except the keepers. final File[] dirs = DatabaseIndexer.uuidDir(root, db.getUuid()).listFiles(); if (dirs != null) { for (final File dir : dirs) { if (!viewKeep.contains(dir.getName())) { LOG.info("Cleaning old index at " + dir); FileUtils.deleteDirectory(dir); } } } } // Delete all directories except the keepers. for (final File dir : root.listFiles()) { if (!dbKeep.contains(dir.getName())) { LOG.info("Cleaning old index at " + dir); FileUtils.deleteDirectory(dir); } } resp.setStatus(202); ServletUtils.sendJsonSuccess(req, resp); }
From source file:com.esri.geoportal.harvester.beans.BrokerDefinitionManagerBean.java
@Override public boolean delete(UUID id) throws CrudlException { try (Connection connection = dataSource.getConnection(); PreparedStatement st = connection.prepareStatement("DELETE FROM BROKERS WHERE ID = ?");) { st.setString(1, id.toString()); return st.executeUpdate() > 0; } catch (SQLException ex) { throw new CrudlException("Error deleting broker definition", ex); }/*from w ww. j a v a 2s . c o m*/ }
From source file:org.ovirt.engine.sdk.decorators.SchedulingPolicies.java
/** * Fetches SchedulingPolicy object by id. * * @return {@link SchedulingPolicy }//from ww w . j ava 2 s . c om * * @throws ClientProtocolException * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public SchedulingPolicy get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.SchedulingPolicy.class, SchedulingPolicy.class); }
From source file:com.seleritycorp.common.base.eventprocessor.EventSender.java
/** * Send an Event to EventProcessor and escalates errors to the caller. * * <p>If no exceptions get thrown, this does not mean that the sent event passed validation. * It only means that on the HTTP layer everything worked. Event Processor is responding * before event validation takes place. So you need to check on the Event Processor side to * see if validation passes./*from w w w. ja va 2 s .c om*/ * * @param schema The name of the schema to send an event for * @param schemaVersion The version number for the schema * @param payload The payload to send. * @throws HttpException if there are errors sending the request. */ private void sendChecked(UUID uuid, String schema, int schemaVersion, JsonObject payload) throws HttpException { JsonObject data = new JsonObject(); data.addProperty("schema", schema); data.addProperty("schemaVersion", schemaVersion); data.addProperty("uuid", uuid.toString()); data.add("payload", payload); requestFactory.createPostJson(targetUrl, data).setExpectedStatusCode(HttpStatus.SC_NO_CONTENT).execute(); }