Search in sources :

Example 1 with ServiceNameVersion

use of i5.las2peer.api.p2p.ServiceNameVersion in project Distributed-Noracle-Backend by Distributed-Noracle.

the class QuestionVotesResource method getQuestionText.

private String getQuestionText(String questionId) throws ServiceInvocationException {
    String qText = "";
    Serializable rmiResult = Context.get().invoke(new ServiceNameVersion(NoracleQuestionService.class.getCanonicalName(), NoracleService.API_VERSION), "getQuestion", questionId);
    if (rmiResult instanceof Question)
        qText = ((Question) rmiResult).getText();
    return qText;
}
Also used : Serializable(java.io.Serializable) ServiceNameVersion(i5.las2peer.api.p2p.ServiceNameVersion) Question(i5.las2peer.services.noracleService.model.Question)

Example 2 with ServiceNameVersion

use of i5.las2peer.api.p2p.ServiceNameVersion in project Distributed-Noracle-Backend by Distributed-Noracle.

the class QuestionVotesResource method getAllVotes.

@Override
public VoteList getAllVotes(String objectId) throws ServiceInvocationException {
    Serializable rmiResult = Context.get().invoke(new ServiceNameVersion(NoracleVoteService.class.getCanonicalName(), NoracleService.API_VERSION), "getAllVotes", objectId);
    VoteList vote;
    if (rmiResult instanceof VoteList) {
        vote = (VoteList) rmiResult;
    } else {
        throw new InternalServiceException("Unexpected result (" + rmiResult.getClass().getCanonicalName() + ") of RMI call");
    }
    return vote;
}
Also used : Serializable(java.io.Serializable) ServiceNameVersion(i5.las2peer.api.p2p.ServiceNameVersion) VoteList(i5.las2peer.services.noracleService.model.VoteList) InternalServiceException(i5.las2peer.api.execution.InternalServiceException)

Example 3 with ServiceNameVersion

use of i5.las2peer.api.p2p.ServiceNameVersion in project Distributed-Noracle-Backend by Distributed-Noracle.

the class QuestionVotesResource method getAgentVote.

@Override
public Vote getAgentVote(String objectId, String agentId) throws ServiceInvocationException {
    Serializable rmiResult = Context.get().invoke(new ServiceNameVersion(NoracleVoteService.class.getCanonicalName(), NoracleService.API_VERSION), "getAgentVote", objectId, agentId);
    Vote vote;
    if (rmiResult instanceof Vote) {
        vote = (Vote) rmiResult;
    } else {
        throw new InternalServiceException("Unexpected result (" + rmiResult.getClass().getCanonicalName() + ") of RMI call");
    }
    return vote;
}
Also used : Serializable(java.io.Serializable) Vote(i5.las2peer.services.noracleService.model.Vote) ServiceNameVersion(i5.las2peer.api.p2p.ServiceNameVersion) InternalServiceException(i5.las2peer.api.execution.InternalServiceException)

Example 4 with ServiceNameVersion

use of i5.las2peer.api.p2p.ServiceNameVersion in project Distributed-Noracle-Backend by Distributed-Noracle.

the class RelationVotesResource method getAgentVote.

@Override
public Vote getAgentVote(String objectId, String agentId) throws ServiceInvocationException {
    Serializable rmiResult = Context.get().invoke(new ServiceNameVersion(NoracleVoteService.class.getCanonicalName(), NoracleService.API_VERSION), "getAgentVote", objectId, agentId);
    Vote vote;
    if (rmiResult instanceof Vote) {
        vote = (Vote) rmiResult;
    } else {
        throw new InternalServiceException("Unexpected result (" + rmiResult.getClass().getCanonicalName() + ") of RMI call");
    }
    return vote;
}
Also used : Serializable(java.io.Serializable) Vote(i5.las2peer.services.noracleService.model.Vote) ServiceNameVersion(i5.las2peer.api.p2p.ServiceNameVersion) InternalServiceException(i5.las2peer.api.execution.InternalServiceException)

Example 5 with ServiceNameVersion

use of i5.las2peer.api.p2p.ServiceNameVersion in project Distributed-Noracle-Backend by Distributed-Noracle.

the class NoracleServiceTest method startService.

private void startService(Node node, String clsName, String version) throws Exception {
    ServiceAgentImpl serviceAgent = ServiceAgentImpl.createServiceAgent(new ServiceNameVersion(clsName, version), "testtest");
    serviceAgent.unlock("testtest");
    node.storeAgent(serviceAgent);
    node.registerReceiver(serviceAgent);
}
Also used : ServiceNameVersion(i5.las2peer.api.p2p.ServiceNameVersion) ServiceAgentImpl(i5.las2peer.security.ServiceAgentImpl)

Aggregations

ServiceNameVersion (i5.las2peer.api.p2p.ServiceNameVersion)16 Serializable (java.io.Serializable)13 InternalServiceException (i5.las2peer.api.execution.InternalServiceException)6 ApiResponses (io.swagger.annotations.ApiResponses)5 Gson (com.google.gson.Gson)3 Space (i5.las2peer.services.noracleService.model.Space)3 URI (java.net.URI)3 URISyntaxException (java.net.URISyntaxException)3 JSONObject (net.minidev.json.JSONObject)3 JSONParser (net.minidev.json.parser.JSONParser)3 ParseException (net.minidev.json.parser.ParseException)3 ServiceInvocationException (i5.las2peer.api.execution.ServiceInvocationException)2 Envelope (i5.las2peer.api.persistency.Envelope)2 EnvelopeAccessDeniedException (i5.las2peer.api.persistency.EnvelopeAccessDeniedException)2 EnvelopeOperationFailedException (i5.las2peer.api.persistency.EnvelopeOperationFailedException)2 Question (i5.las2peer.services.noracleService.model.Question)2 SpaceSubscription (i5.las2peer.services.noracleService.model.SpaceSubscription)2 Vote (i5.las2peer.services.noracleService.model.Vote)2 VoteList (i5.las2peer.services.noracleService.model.VoteList)2 Instant (java.time.Instant)2