@Override public ServiceDocument getDocumentTemplate() { ServiceDocumentQueryResult r = new ServiceDocumentQueryResult(); String childLink = UriUtils.buildUriPath(getSelfLink(), "child-template"); ServiceDocument childTemplate = getChildTemplate(childLink); r.documents = new HashMap<>(); childTemplate.documentSelfLink = childLink; r.documentLinks.add(childTemplate.documentSelfLink); r.documents.put(childTemplate.documentSelfLink, childTemplate); return r; }
private String convertNavigationLink(String navigationLink) { URI uri = URI.create(navigationLink); return this.getSelfLink() + UriUtils.URI_QUERY_CHAR + UriUtils.buildUriQuery( UriUtils.FORWARDING_URI_PARAM_NAME_PATH, UriUtils.getPathParamValue(uri), UriUtils.FORWARDING_URI_PARAM_NAME_PEER, UriUtils.getPeerParamValue(uri)); }
@Override public void handleStop(Operation op) { if (!ServiceHost.isServiceStop(op)) { logWarning("Abrupt stop of factory %s", this.getSelfLink()); } super.handleStop(op); }
public TableDescription useFactoryService(FactoryService factoryService) { if (factoryService.getHost() == null) { factoryService.setHost(this.host); } try { if (getFactoryLink() == null) { setFactoryLink(factoryService.getSelfLink()); } StatefulService childService = (StatefulService) factoryService.createServiceInstance(); useStatefulService(childService); return this; } catch (Throwable e) { throw new IllegalArgumentException(String.format( "Failed to add factory %s", factoryService.getClass().getCanonicalName()), e); } }
SynchronizationTaskService.State createSynchronizationTaskState( Long membershipUpdateTimeMicros) { SynchronizationTaskService.State task = new SynchronizationTaskService.State(); task.documentSelfLink = UriUtils.convertPathCharsFromLink(this.getSelfLink()); task.factorySelfLink = this.getSelfLink(); task.factoryStateKind = Utils.buildKind(this.getStateType()); task.membershipUpdateTimeMicros = membershipUpdateTimeMicros; task.nodeSelectorLink = this.nodeSelectorLink; task.queryResultLimit = this.selfQueryResultLimit; task.taskInfo = TaskState.create(); task.taskInfo.isDirect = true; task.synchAllVersions = XenonConfiguration.bool( SynchronizationTaskService.class, "SYNCH_ALL_VERSIONS", false ); return task; }
request.key = this.getSelfLink(); logWarning("SelectOwner response from %s does not indicate that " + "local node %s is the owner for factory %s. JsonResponse: %s", r.getKey().toString(), this.getHost().getId(), this.getSelfLink(), r.getValue()); maintOp.complete(); return; getHost().getId(), this.getSelfLink()); synchronizeChildServicesAsOwner(maintOp, ownerResponse.membershipUpdateTimeMicros); }); getHost().broadcastRequest(this.nodeSelectorLink, this.getSelfLink(), true, broadcastSelectOp);
private void handleCheckpointStage(State task) { String checkPointServiceLink = UriUtils.buildUriPath( CheckpointService.FACTORY_LINK, UriUtils.convertPathCharsFromLink(this.parent.getSelfLink()));; Operation get = Operation.createGet(UriUtils.buildUri(this.getHost(), checkPointServiceLink)) .setReferer(this.getUri())
getSelfLink()); completePostRequest(o, childService); return; getSelfLink(), null); if (initialState.documentSelfLink.startsWith(getSelfLink())) { initialState.documentSelfLink = initialState.documentSelfLink .substring(getSelfLink().length());
public void completeGetWithQuery(Operation op, EnumSet<ServiceOption> caps) { boolean doExpand = false; if (op.getUri().getQuery() != null) { doExpand = UriUtils.hasODataExpandParamValue(op.getUri()); } URI u = UriUtils.buildDocumentQueryUri(getHost(), this.documentIndexLink, UriUtils.buildUriPath(getSelfLink(), UriUtils.URI_WILDCARD_CHAR), doExpand, false, caps != null ? caps : EnumSet.of(ServiceOption.NONE)); Operation query = Operation.createGet(u) .setCompletion((o, e) -> { if (e != null) { op.fail(e); return; } op.setBodyNoCloning(o.getBodyRaw()).complete(); }); sendRequest(query); }
.buildUriPath(factoryService.getSelfLink(), "child-template"); stateType.getCanonicalName(), factoryService.getSelfLink()); indexService.getDao().initForDocument(factoryService.getSelfLink(), stateType, childTemplate.documentDescription); } catch (Exception e2) {
.setTermPropertyName(ServiceDocument.FIELD_NAME_SELF_LINK) .setTermMatchType(MatchType.PREFIX) .setTermMatchValue(getSelfLink()); task.querySpec.query.addBooleanClause(selfLinkPrefixClause);
String factoryPath = factoryService.getSelfLink();
if (!UriUtils.isValidDocumentId(suffix, this.getSelfLink())) { o.fail(new IllegalArgumentException(suffix + " is an invalid id")); return; if (UriUtils.isChildPath(suffix, getSelfLink())) { serviceUri = UriUtils.buildUri(getHost(), suffix); } else {
}); getHost().selectOwner(this.nodeSelectorLink, this.getSelfLink(), selectOwnerOp);
UriUtils.convertPathCharsFromLink(this.getSelfLink()));
CheckpointService.CheckpointState s = new CheckpointService.CheckpointState(); s.timestamp = task.startTimeMicros; s.factoryLink = this.parent.getSelfLink(); if (this.isDetailedLoggingEnabled) { log(Level.INFO, "synchronization task for %s has been re-scheduled", this.parent.getSelfLink());