本文整理了Java中org.xowl.infra.server.xsp.XSPReplyResult.getData()
方法的一些代码示例,展示了XSPReplyResult.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSPReplyResult.getData()
方法的具体详情如下:
包路径:org.xowl.infra.server.xsp.XSPReplyResult
类名称:XSPReplyResult
方法名:getData
暂无
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
/**
* Retrieves a stored procedure
*
* @param name The name of the procedure
*/
private void getProcedure(String name) {
XOWLStoredProcedure procedure = ((XSPReplyResult<XOWLStoredProcedure>) database.getStoreProcedure(name)).getData();
procedures.put(name, procedure);
}
代码示例来源:origin: org.xowl.platform/xowl-service-collaboration
@Override
public Collection<Artifact> getOutputsFor(String specificationId) {
ArtifactStorageService storageService = Register.getComponent(ArtifactStorageService.class);
if (storageService == null)
return Collections.emptyList();
Collection<Artifact> artifacts = new ArrayList<>();
for (String artifactId : manifest.getArtifactsForOutput(specificationId)) {
XSPReply reply = storageService.retrieve(artifactId);
if (reply.isSuccess())
artifacts.add(((XSPReplyResult<Artifact>) reply).getData());
}
return artifacts;
}
代码示例来源:origin: org.xowl.platform/xowl-service-collaboration
@Override
public Collection<Artifact> getInputsFor(String specificationId) {
ArtifactStorageService storageService = Register.getComponent(ArtifactStorageService.class);
if (storageService == null)
return Collections.emptyList();
Collection<Artifact> artifacts = new ArrayList<>();
for (String artifactId : manifest.getArtifactsForInput(specificationId)) {
XSPReply reply = storageService.retrieve(artifactId);
if (reply.isSuccess())
artifacts.add(((XSPReplyResult<Artifact>) reply).getData());
}
return artifacts;
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public boolean checkHasRole(String userId, String roleId) {
Map<String, Node> parameters = new HashMap<>();
parameters.put("user", nodes.getIRINode(USERS + userId));
parameters.put("role", nodes.getIRINode(ROLES + roleId));
XSPReply reply = database.executeStoredProcedure(procedures.get("procedure-check-role"),
new BaseStoredProcedureContext(Collections.<String>emptyList(), Collections.<String>emptyList(), parameters));
if (!reply.isSuccess())
return false;
Result result = ((XSPReplyResult<Result>) reply).getData();
return reply.isSuccess() && ((ResultYesNo) result).getValue();
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public Collection<PlatformGroup> getGroups() {
Map<String, Node> parameters = new HashMap<>();
XSPReply reply = database.executeStoredProcedure(procedures.get("procedure-get-groups"),
new BaseStoredProcedureContext(Collections.<String>emptyList(), Collections.<String>emptyList(), parameters));
if (!reply.isSuccess())
return Collections.emptyList();
ResultSolutions result = ((XSPReplyResult<ResultSolutions>) reply).getData();
Collection<PlatformGroup> groups = new ArrayList<>(result.getSolutions().size());
for (RDFPatternSolution solution : result.getSolutions()) {
String id = ((IRINode) solution.get("group")).getIRIValue().substring(GROUPS.length());
String name = ((LiteralNode) solution.get("name")).getLexicalValue();
groups.add(getGroup(id, name));
}
return groups;
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public Collection<PlatformRole> getRoles() {
Map<String, Node> parameters = new HashMap<>();
XSPReply reply = database.executeStoredProcedure(procedures.get("procedure-get-roles"),
new BaseStoredProcedureContext(Collections.<String>emptyList(), Collections.<String>emptyList(), parameters));
if (!reply.isSuccess())
return Collections.emptyList();
ResultSolutions result = ((XSPReplyResult<ResultSolutions>) reply).getData();
Collection<PlatformRole> roles = new ArrayList<>(result.getSolutions().size());
for (RDFPatternSolution solution : result.getSolutions()) {
String id = ((IRINode) solution.get("role")).getIRIValue().substring(ROLES.length());
String name = ((LiteralNode) solution.get("name")).getLexicalValue();
roles.add(getRole(id, name));
}
return roles;
}
代码示例来源:origin: org.xowl.platform/xowl-service-lts
@Override
public XSPReply getArtifacts() {
XOWLDatabase connection = getRemote();
if (connection == null)
return XSPReplyNetworkError.instance();
StringWriter writer = new StringWriter();
writer.write("DESCRIBE ?a WHERE { GRAPH <");
writer.write(IOUtils.escapeAbsoluteURIW3C(KernelSchema.GRAPH_ARTIFACTS));
writer.write("> { ?a a <");
writer.write(IOUtils.escapeAbsoluteURIW3C(KernelSchema.ARTIFACT));
writer.write("> } }");
XSPReply reply = connection.sparql(writer.toString(), null, null);
if (!reply.isSuccess())
return reply;
ResultQuads sparqlResult = ((XSPReplyResult<ResultQuads>) reply).getData();
return new XSPReplyResultCollection<>(buildArtifacts(sparqlResult.getQuads()));
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public Collection<PlatformUser> getUsers() {
Map<String, Node> parameters = new HashMap<>();
XSPReply reply = database.executeStoredProcedure(procedures.get("procedure-get-users"),
new BaseStoredProcedureContext(Collections.<String>emptyList(), Collections.<String>emptyList(), parameters));
if (!reply.isSuccess())
return Collections.emptyList();
ResultSolutions result = ((XSPReplyResult<ResultSolutions>) reply).getData();
Collection<PlatformUser> users = new ArrayList<>(result.getSolutions().size());
for (RDFPatternSolution solution : result.getSolutions()) {
String id = ((IRINode) solution.get("user")).getIRIValue().substring(USERS.length());
String name = ((LiteralNode) solution.get("name")).getLexicalValue();
users.add(getUser(id, name));
}
return users;
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
/**
* Deploy a stored procedure
*
* @param name The name of the procedure
* @param parameters The parameters for the procedure
*/
private void deployProcedure(String name, String... parameters) {
String content = readResource(name + ".sparql");
XSPReply reply = database.addStoredProcedure(name, content, Arrays.asList(parameters));
if (!reply.isSuccess()) {
Logging.get().error("Failed to deploy the procedure " + name);
return;
}
XOWLStoredProcedure procedure = ((XSPReplyResult<XOWLStoredProcedure>) reply).getData();
procedures.put(name, procedure);
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
/**
* Gets the name of an entity
*
* @param entity The IRI of an entity
* @return The entity's name
*/
private String getEntityName(String entity) {
Map<String, Node> parameters = new HashMap<>();
parameters.put("entity", nodes.getIRINode(entity));
XSPReply reply = database.executeStoredProcedure(procedures.get("procedure-get-entity-name"),
new BaseStoredProcedureContext(Collections.<String>emptyList(), Collections.<String>emptyList(), parameters));
if (!reply.isSuccess())
return null;
ResultSolutions result = ((XSPReplyResult<ResultSolutions>) reply).getData();
if (result.getSolutions().size() == 0)
return null;
RDFPatternSolution solution = result.getSolutions().iterator().next();
return ((LiteralNode) solution.get("name")).getLexicalValue();
}
代码示例来源:origin: org.xowl.platform/xowl-service-lts
@Override
public void doRun() {
ArtifactStorageService storage = ServiceUtils.getService(ArtifactStorageService.class);
if (storage == null) {
result = XSPReplyServiceUnavailable.instance();
return;
}
result = storage.retrieve(artifactId);
if (!result.isSuccess())
return;
result = storage.pullFromLive(((XSPReplyResult<Artifact>) result).getData());
}
}
代码示例来源:origin: org.xowl.platform/xowl-service-lts
@Override
public void doRun() {
ArtifactStorageService storage = ServiceUtils.getService(ArtifactStorageService.class);
if (storage == null) {
result = XSPReplyServiceUnavailable.instance();
return;
}
result = storage.retrieve(artifactId);
if (!result.isSuccess())
return;
result = storage.pushToLive(((XSPReplyResult<Artifact>) result).getData());
}
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public PlatformUser authenticate(String login, String password) {
XSPReply reply = getAccess(login).login(login, password);
if (!reply.isSuccess())
return null;
PlatformUser result = ((XSPReplyResult<PlatformUser>) reply).getData();
return getUser(result.getIdentifier(), result.getName());
}
代码示例来源:origin: org.xowl.platform/xowl-service-lts
@Override
public Result sparql(String query) {
XOWLDatabase connection = getRemote();
if (connection == null)
return new ResultFailure("The connection to the remote host is not configured");
XSPReply reply = connection.sparql(query, null, null);
if (!reply.isSuccess())
return new ResultFailure(reply.getMessage());
return ((XSPReplyResult<Result>) reply).getData();
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public PlatformUser getUser(String identifier) {
PlatformUser result = cacheUsers.get(identifier);
if (result != null)
return result;
SecurityService securityService = Register.getComponent(SecurityService.class);
if (securityService == null)
return null;
PlatformUser currentUser = securityService.getCurrentUser();
XSPReply reply = getAccess(currentUser == null ? identifier : currentUser.getIdentifier()).getPlatformUser(identifier);
if (!reply.isSuccess())
return null;
result = ((XSPReplyResult<PlatformUser>) reply).getData();
return getUser(result.getIdentifier(), result.getName());
}
代码示例来源:origin: org.xowl.platform/xowl-kernel-impl
@Override
public XSPReply authenticate(String client, String token) {
if (isBanned(client))
return XSPReplyUnauthenticated.instance();
XSPReply reply = checkToken(token);
if (reply == XSPReplyUnauthenticated.instance()) {
// the token is invalid
onLoginFailure(client);
Logging.get().info("Authentication failure from " + client + " with invalid token");
return reply;
}
if (!reply.isSuccess()) {
Logging.get().info("Authentication failure from " + client + " with invalid token");
return reply;
}
PlatformUser user = getRealm().getUser(((XSPReplyResult<String>) reply).getData());
CONTEXT.set(user);
return new XSPReplyResult<>(user);
}
代码示例来源:origin: org.xowl.platform/xowl-service-collaboration
@Override
public RemoteCollaboration getNeighbour(String collaborationId) {
SecurityService securityService = Register.getComponent(SecurityService.class);
if (securityService == null)
return null;
XSPReply reply = securityService.checkAction(ACTION_GET_NEIGHBOURS);
if (!reply.isSuccess())
return null;
if (!(securityService.getRealm() instanceof RemotePlatformAccessProvider))
return null;
RemotePlatformAccess remotePlatform = ((RemotePlatformAccessProvider) securityService.getRealm()).getAccess(securityService.getCurrentUser().getIdentifier());
if (remotePlatform == null)
return null;
reply = remotePlatform.getCollaborationNeighbour(collaborationId);
if (!reply.isSuccess())
return null;
return ((XSPReplyResult<RemoteCollaboration>) reply).getData();
}
代码示例来源:origin: org.xowl.platform/xowl-service-consistency
@Override
public XSPReply activateRule(String identifier) {
StorageService storageService = Register.getComponent(StorageService.class);
if (storageService == null)
return XSPReplyServiceUnavailable.instance();
TripleStore live = storageService.getLiveStore();
XSPReply reply = getRule(identifier);
if (!reply.isSuccess())
return reply;
XOWLConsistencyRule rule = ((XSPReplyResult<XOWLConsistencyRule>) reply).getData();
reply = live.activateRule(rule);
if (!reply.isSuccess())
return reply;
EventService eventService = Register.getComponent(EventService.class);
if (eventService != null)
eventService.onEvent(new ConsistencyRuleActivatedEvent(rule, this));
return reply;
}
代码示例来源:origin: org.xowl.platform/xowl-service-security-internal
@Override
public XSPReply resetUserKey(String identifier, String newKey) {
// check authorization
SecurityService securityService = Register.getComponent(SecurityService.class);
if (securityService == null)
return XSPReplyServiceUnavailable.instance();
PlatformUser platformUser = getUser(identifier);
if (platformUser == null)
return new XSPReplyApiError(ERROR_INVALID_USER, identifier);
XSPReply reply = securityService.getPolicy().checkAction(securityService, SecurityService.ACTION_RESET_USER_KEY, platformUser);
if (!reply.isSuccess())
return reply;
// execute
reply = server.getUser(identifier);
if (!reply.isSuccess())
return reply;
XOWLUser xowlUser = ((XSPReplyResult<XOWLUser>) reply).getData();
return xowlUser.updatePassword(newKey);
}
代码示例来源:origin: org.xowl.platform/xowl-service-collaboration
@Override
public XSPReply createRole(String identifier, String name) {
SecurityService securityService = Register.getComponent(SecurityService.class);
if (securityService == null)
return XSPReplyServiceUnavailable.instance();
XSPReply reply = securityService.checkAction(ACTION_ADD_ROLE);
if (!reply.isSuccess())
return reply;
reply = securityService.getRealm().createRole(identifier, name);
if (!reply.isSuccess())
return reply;
PlatformRole role = ((XSPReplyResult<PlatformRole>) reply).getData();
manifest.addRole(role);
reply = serializeManifest();
if (!reply.isSuccess())
return reply;
return new XSPReplyResult<>(role);
}
内容来源于网络,如有侵权,请联系作者删除!