-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 424658b
Showing
225 changed files
with
11,156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.settings | ||
.project | ||
.classpath | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
NegoFAST | ||
======== | ||
|
||
NegoFAST is an automated negotiation framework written in Java. | ||
|
||
The distribution of NegoFAST includes six parts, which corresponds with the six modules | ||
included in this repository: | ||
|
||
1. NegoFAST-Core: It is a set of interfaces that conform the protocol-independent part of | ||
the NegoFAST framework. | ||
2. NegoFAST-Bargaining: It is a set of interfaces that provide a bargaining-specific | ||
extension of the NegoFAST-Core framework. | ||
3. Model-Lite: It is a set of interfaces that define a specific model for expressing | ||
agreements, proposals and preferences. Agreements and proposals are modelled as a set of | ||
name-value pairs, whereas preferences are modelled as weighted utility functions. | ||
4. Simple-Protocol: It is the specification of a simple protocol negotiation protocol and | ||
a negotiation protocol. | ||
5. August: It is a proof-of-concept implementation of the NegoFAST framework and | ||
ModelLite. Currently the infrastructure layer of August supports concurrency by means of | ||
Java threads but it does not support distribution across different computers. However, | ||
this infrastructure layer is easily replaceable by a more complex one. | ||
6. JobsSubmitter: It is a sample implementation of an automated negotiation system based | ||
on the NegoFAST framework. It implements the negotiation of a job submission agreement | ||
amongst a job submitter and two job hosting services. | ||
|
||
You can try the demo implementation of the JobsSubmitter by running: | ||
|
||
mvn exec:java -pl demo-jobs-submitter | ||
|
||
We are very interested in any feedback you might have, including details of how you're | ||
using NegoFAST, what you like about it, and what you think needs improvement. You can | ||
leave this feedback at resinas <at> us.es. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>negofast</groupId> | ||
<artifactId>negofast</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<artifactId>august</artifactId> | ||
<name>August</name> | ||
<description>August is a proof-of-concept implementation of the NegoFAST framework and ModelLite that also includes the specification of a simple protocol negotiation protocol and a negotiation protocol.</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>negofast</groupId> | ||
<artifactId>negofast-bargaining</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>negofast</groupId> | ||
<artifactId>model-lite</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>negofast</groupId> | ||
<artifactId>simple-protocol</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
august/src/main/java/august/commithandler/simple/SimpleCommitHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* SimpleCommitHandler.java | ||
* | ||
* Created on August 9, 2007, 11:43 AM | ||
* | ||
* To change this template, choose Tools | Template Manager | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package august.commithandler.simple; | ||
|
||
import java.net.URI; | ||
|
||
import negofast.core.interactions.requestcommitapproval.ApprovalType; | ||
import negofast.core.interactions.requestcommitapproval.ICommitHandler; | ||
import negofast.core.interactions.requestcommitapproval.ICommitRequester; | ||
import negofast.core.model.IProposal; | ||
|
||
/** | ||
* | ||
* @author resman | ||
*/ | ||
public class SimpleCommitHandler implements ICommitHandler<IProposal<?>> { | ||
|
||
/** | ||
* Creates a new instance of SimpleCommitHandler | ||
*/ | ||
public SimpleCommitHandler() { | ||
} | ||
|
||
public void approvalRequest(URI thread, IProposal<?> p, ApprovalType t, ICommitRequester requester) { | ||
requester.approved(thread); | ||
} | ||
|
||
public void fail(URI thread) { | ||
} | ||
|
||
public void success(URI thread) { | ||
} | ||
|
||
} |
121 changes: 121 additions & 0 deletions
121
...rc/main/java/august/core/bargainingprotocolhandler/AbstractBargainingProtocolHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package august.core.bargainingprotocolhandler; | ||
|
||
import java.net.URI; | ||
|
||
import negofast.bargaining.interactions.protocolconversion.IBargainingNegotiator; | ||
import negofast.bargaining.interactions.protocolconversion.IBargainingProtocolHandler; | ||
import negofast.core.model.INegotiationMessage; | ||
import negofast.core.model.INegotiationProtocolInstance; | ||
import negofast.core.model.IProposal; | ||
import august.infrastructure.registry.ServiceRegistry; | ||
|
||
public abstract class AbstractBargainingProtocolHandler<PartyInterface,State extends AbstractProtocolState<?,?>> implements IBargainingProtocolHandler { | ||
|
||
protected URI negotiation; | ||
protected INegotiationProtocolInstance config; | ||
protected URI partyURI; | ||
protected URI myURI; | ||
protected PartyInterface party; | ||
private IBargainingNegotiator negotiator; | ||
protected State state; | ||
protected ServiceRegistry registry; | ||
|
||
public AbstractBargainingProtocolHandler(ServiceRegistry registry, URI negotiation, INegotiationProtocolInstance config, URI party) { | ||
super(); | ||
this.negotiation = negotiation; | ||
this.config = config; | ||
this.registry = registry; | ||
|
||
if (party != null) { | ||
this.partyURI = party; | ||
this.party = createPartyProxy(registry, partyURI); | ||
} | ||
|
||
setUpStates(); | ||
} | ||
|
||
public abstract void setUpStates(); | ||
|
||
public void setState(State newState) { | ||
this.state = newState; | ||
} | ||
|
||
public State getState() { | ||
return state; | ||
} | ||
|
||
public IBargainingNegotiator getNegotiator() { | ||
return negotiator; | ||
} | ||
|
||
public void setNegotiator(IBargainingNegotiator negotiator) { | ||
this.negotiator = negotiator; | ||
} | ||
|
||
public void unregister() { | ||
registry.unregisterService(this); | ||
} | ||
|
||
|
||
public URI getMyURI() { | ||
return myURI; | ||
} | ||
|
||
public PartyInterface getParty() { | ||
return party; | ||
} | ||
|
||
public URI getPartyURI() { | ||
return partyURI; | ||
} | ||
|
||
public void setPartyURI(URI party) { | ||
if (partyURI == null || ! partyURI.equals(party)) { | ||
this.partyURI = party; | ||
this.party = createPartyProxy(registry, party); | ||
} | ||
} | ||
|
||
public abstract PartyInterface createPartyProxy(ServiceRegistry reg, URI party); | ||
|
||
public URI getNegotiationContext() { | ||
return negotiation; | ||
} | ||
|
||
public INegotiationProtocolInstance getConfig() { | ||
return config; | ||
} | ||
|
||
public void init(URI negotiation, IBargainingNegotiator negotiator) { | ||
state.init(negotiation, negotiator); | ||
} | ||
|
||
public void accept(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.accept(negotiation, msg); | ||
} | ||
|
||
public void cfp(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.cfp(negotiation, msg); | ||
} | ||
|
||
public void commit(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.commit(negotiation, msg); | ||
} | ||
|
||
public void propose(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.propose(negotiation, msg); | ||
} | ||
|
||
public void rejectNegotiation(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.rejectNegotiation(negotiation, msg); | ||
} | ||
|
||
public void rejectProposal(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.rejectProposal(negotiation, msg); | ||
} | ||
|
||
public void withdraw(URI negotiation, INegotiationMessage<IProposal<?>> msg) { | ||
state.withdraw(negotiation, msg); | ||
} | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
august/src/main/java/august/core/bargainingprotocolhandler/AbstractProtocolState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package august.core.bargainingprotocolhandler; | ||
|
||
import java.net.URI; | ||
|
||
import negofast.bargaining.interactions.protocolconversion.IBargainingNegotiator; | ||
import negofast.core.model.INegotiationMessage; | ||
import negofast.core.model.IProposal; | ||
|
||
public abstract class AbstractProtocolState<MyInterface,PH extends AbstractBargainingProtocolHandler<?,?>> { | ||
|
||
private PH handler; | ||
|
||
public AbstractProtocolState(PH ctx) { | ||
super(); | ||
handler = ctx; | ||
} | ||
|
||
public PH getContext() { | ||
return handler; | ||
} | ||
|
||
public void sendError(String cause) { | ||
getContext().getNegotiator().error(getContext().getNegotiationContext(), cause); | ||
throw new RuntimeException(cause + " in (" + getContext().getState() + ")" + getContext().getMyURI()); | ||
} | ||
|
||
// public IBargainingNegotiator getNegotiator() { | ||
// return context.getNegotiator(); | ||
// } | ||
// | ||
// public Protocol getParty() { | ||
// return context.getParty(); | ||
// } | ||
// | ||
// public URI getMyURI() { | ||
// return context.getMyURI(); | ||
// } | ||
// | ||
// public URI getThread() { | ||
// return context.getNegotiationContext(); | ||
// } | ||
// | ||
// public void setState(SimpleProtocolState newState) { | ||
// context.setState(newState); | ||
// } | ||
|
||
|
||
|
||
public void accept(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void cfp(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void commit(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void init(URI thread, IBargainingNegotiator negotiator) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void propose(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void rejectNegotiation(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void rejectProposal(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
public void withdraw(URI thread, INegotiationMessage<IProposal<?>> msg) { | ||
handler.getNegotiator().error(thread, "Operation not allowed"); | ||
throw new RuntimeException("Operation not allowed in (" + handler.state + ")" + handler.getMyURI()); | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
august/src/main/java/august/core/bargainingprotocolhandler/OperationNotAllowedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package august.core.bargainingprotocolhandler; | ||
|
||
public class OperationNotAllowedException extends RuntimeException { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 7582155233156199283L; | ||
|
||
} |
Oops, something went wrong.