本文整理汇总了Java中jade.core.ProfileImpl类的典型用法代码示例。如果您正苦于以下问题:Java ProfileImpl类的具体用法?Java ProfileImpl怎么用?Java ProfileImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProfileImpl类属于jade.core包,在下文中一共展示了ProfileImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import jade.core.ProfileImpl; //导入依赖的package包/类
private void init()
{
// Gets JADE runtime interface
jade.core.Runtime runtime = jade.core.Runtime.instance();
runtime.setCloseVM(true);
// Creates a profile
Profile profile = new ProfileImpl(true);
profile.setParameter(Profile.CONTAINER_NAME, "Pacman");
profile.setParameter(Profile.MAIN_HOST, "localhost");
profile.setParameter(Profile.GUI, "true");
// Creates a non-main container
// In this case, JADE's main container must be running
//containerController = runtime.createAgentContainer(profile);
// Creates a main container
containerController = runtime.createMainContainer(profile);
}
示例2: main
import jade.core.ProfileImpl; //导入依赖的package包/类
public static void main(String[] args) {
Runtime rt = Runtime.instance();
// Exit the JVM when there are no more containers around
rt.setCloseVM(true);
// Create a default profile
Profile profile = new ProfileImpl("192.168.111.1", 8888, "main");
AgentContainer mainContainer = rt.createMainContainer(profile);
addStationToRuntime(rt);
addTransporterContainer(rt);
addCleanerContainer(rt);
addPainterContainer(rt);
AgentController rma = null;
try {
rma = mainContainer.createNewAgent("rma", "jade.tools.rma.rma", new Object[0]);
rma.start();
} catch (StaleProxyException e) {
e.printStackTrace();
}
}
示例3: main
import jade.core.ProfileImpl; //导入依赖的package包/类
public static void main(String[] args) throws StaleProxyException {
// Start a new JADE runtime system
Runtime.instance().setCloseVM(true);
Runtime rt = jade.core.Runtime.instance();
Properties props = new ExtendedProperties();
props.setProperty(Profile.GUI, "true");
props.setProperty(Profile.LOCAL_HOST, "172.16.0.83");
AgentContainer cc = rt.createMainContainer(new ProfileImpl(props));
// Start a FTPAgent
AgentController ftpAgent = cc.createNewAgent("ftp", "com.jools.jade.agent.FTPAgent",
new String[]{
"username",
"password",
"ftp.server.net"
}
);
ftpAgent.start();
}
示例4: createContainer
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* Create a container in the platform
*
* @param container
* The name of the container
*/
public void createContainer(String container) {
ContainerController controller = this.platformContainers.get(container);
if (controller == null) {
// TODO make this configurable
Profile p = new ProfileImpl();
p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);
p.setParameter(Profile.MAIN_HOST, MAIN_HOST);
p.setParameter(Profile.MAIN_PORT, MAIN_PORT);
p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);
int port = Integer.parseInt(MAIN_PORT);
port = port + 1 + this.platformContainers.size();
p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));
p.setParameter(Profile.CONTAINER_NAME, container);
logger.fine("Creating container " + container + "...");
ContainerController agentContainer = this.runtime
.createAgentContainer(p);
this.platformContainers.put(container, agentContainer);
logger.fine("Container " + container + " created successfully.");
} else {
logger.fine("Container " + container + " is already created.");
}
}
示例5: runJadeWithArguments
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* Method which runs JADE with the specified arguments, which are equivalent to the arguments that JADE receives in the command line.
*
* @param args
* - arguments, as specified in the command line.
*/
@Deprecated
public static AgentContainer runJadeWithArguments(String args)
{
// decompose the args String into tokens:
Vector<String> argsVector = new Vector<String>();
String[] argsArray = new String[0];
StringTokenizer tokenizer = new StringTokenizer(args);
while(tokenizer.hasMoreTokens())
argsVector.addElement(tokenizer.nextToken());
// parse the vector of arguments:
Properties props = jade.Boot.parseCmdLineArgs(argsVector.toArray(argsArray));
ProfileImpl profile = new ProfileImpl(props);
// launch the main container:
// System.out.println("Launching a main-container..."+profile);
if(argsVector.contains(new String("-container")))
return Runtime.instance().createAgentContainer(profile);
return Runtime.instance().createMainContainer(profile);
}
示例6: getNewInstanceOfProfilImpl
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* This Method returns a new Instance of {@link ProfileImpl} that is used to start JADE-Container.
* @return jade.core.Profile
*/
public ProfileImpl getNewInstanceOfProfilImpl(){
ProfileImpl profile = new ProfileImpl();
if (debug) {
this.setProfileDumOptions(profile);
}
this.setProfileLocalHost(profile);
this.setProfileLocalPort(profile);
this.setProfileLocalPortMTP(profile);
this.setProfileServices(profile);
return profile;
}
示例7: getJadeProfile
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* This method invokes all loaded PlugIn-Classes, so that it can set
* further configurations for JADE container.
*
* @param jadeContainerProfile The profile to change
* @return the configured JADE Profile
*/
public ProfileImpl getJadeProfile(ProfileImpl jadeContainerProfile) {
for (int i = 0; i < this.size(); i++) {
PlugIn pi = this.get(i);
jadeContainerProfile = pi.getJadeProfile(jadeContainerProfile);
}
return jadeContainerProfile;
}
示例8: getContainerProfile
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* This method returns the JADE-Profile, which has to be used
* for the container-profiles.
* If a project is focused the specific project-configuration will
* be used. Otherwise the default-configuration of AgentGUI will be
* used.
* @return Profile (for Jade-Containers)
*/
public ProfileImpl getContainerProfile() {
ProfileImpl jadeContainerProfile = null;
Project currProject = Application.getProjectFocused();
// --- Configure the JADE-Profile to use --------------------
if (currProject==null) {
// --- Take the AgentGUI-Default-Profile ----------------
jadeContainerProfile = Application.getGlobalInfo().getJadeDefaultProfile();
System.out.println("JADE-Profile: Use AgentGUI-defaults");
} else {
// --- Take the Profile of the current Project ----------
jadeContainerProfile = currProject.getJadeConfiguration().getNewInstanceOfProfilImpl();
// --- Invoke the Profile configuration in the plug-ins --
jadeContainerProfile = currProject.getPlugInsLoaded().getJadeProfile(jadeContainerProfile);
System.out.println("JADE-Profile: Use " + currProject.getProjectName() + "-configuration" );
// --- If the current project has external resources ----
boolean hasBundelJars = currProject.getProjectBundleLoader().getBundleJarsListModel().size()>0;
boolean hasRegularJars = currProject.getProjectBundleLoader().getRegularJarsListModel().size()>0;
boolean ideExecuted = Application.getGlobalInfo().getExecutionEnvironment()==ExecutionEnvironment.ExecutedOverIDE;
if (hasBundelJars==true || hasRegularJars==true || ideExecuted==true) {
// --- Set marker to start the FileManagerAgent ---------
this.fileMangerProject = currProject;
}
}
return jadeContainerProfile;
}
示例9: createAgentContainer
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* Adding an AgentContainer to the local platform.
*
* @param newContainerName the container name
* @return the agent container
*/
public AgentContainer createAgentContainer(String newContainerName) {
ProfileImpl pSub = this.getContainerProfile();
pSub.setParameter(Profile.CONTAINER_NAME, newContainerName);
pSub.setParameter(Profile.MAIN, (new Boolean(false)).toString());
pSub.setParameter(Profile.MTPS, null);
AgentContainer agentContainer = Runtime.instance().createAgentContainer(pSub);
this.getAgentContainerList().add(agentContainer);
return agentContainer;
}
示例10: addStationToRuntime
import jade.core.ProfileImpl; //导入依赖的package包/类
private static void addStationToRuntime(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "stations");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("CleaningFloor", "gseproject.passive.CleaningFloorAgent", null);
cont.createNewAgent("PaintingFloor", "gseproject.passive.PaintingFloorAgent", null);
cont.createNewAgent("SourcePalette", "gseproject.passive.SourcepaletteAgent", null);
cont.createNewAgent("GoalPalette", "gseproject.passive.GoalpaletteAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例11: addTransporterContainer
import jade.core.ProfileImpl; //导入依赖的package包/类
private static void addTransporterContainer(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "transporter");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("Transporter", "gseproject.robot.RobotAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例12: addCleanerContainer
import jade.core.ProfileImpl; //导入依赖的package包/类
private static void addCleanerContainer(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "cleaner");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("Cleaner", "gseproject.robot.RobotAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例13: addPainterContainer
import jade.core.ProfileImpl; //导入依赖的package包/类
private static void addPainterContainer(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "painter");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("Painter", "gseproject.robot.RobotAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例14: activate
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* Old method, only for compliance with former versions (prior 3.0)
*/
public TransportAddress activate(InChannel.Dispatcher disp)
throws MTPException {
try {
return activate(disp,new ProfileImpl(new ExtendedProperties()));
} catch(Exception e) {
throw new MTPException(e.getMessage());
}
}
示例15: testJade1
import jade.core.ProfileImpl; //导入依赖的package包/类
/**
* from: Luis Lezcano Airaldi <[email protected]> to:
* [email protected] date: Sat, Jun 7, 2014 at 3:10 PM
*
* Hello! It's very easy to use Jade as a library. Here's an example from a
* small application I made:
*/
public void testJade1()
{
// This is the important method. This launches the jade platform.
final Runtime rt = Runtime.instance();
final Profile profile = new ProfileImpl();
// With the Profile you can set some options for the container
profile.setParameter(Profile.PLATFORM_ID, "Platform Name");
profile.setParameter(Profile.CONTAINER_NAME, "Container Name");
// Create the Main Container
final AgentContainer mainContainer = rt.createMainContainer(profile);
final String agentName = "manager";
final String agentType = "ia.main.AgentManager"; // FIXME
final Object[] agentArgs = {};
try
{
// Here I create an agent in the main container and start it.
final AgentController ac = mainContainer.createNewAgent(agentName,
agentType, agentArgs);
ac.start();
} catch (final StaleProxyException e)
{
LOG.error(String.format("Problem creating/starting Jade agent '%s'"
+ " of type: %s with args: %s", agentName, agentType,
Arrays.asList(agentArgs)), e);
}
}