Package ru.webcrafter.core

Examples of ru.webcrafter.core.WebCrafterService


import java.util.List;

public class WebCrafterStandaloneClientMain {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:client.xml");
        WebCrafterService service = (WebCrafterService) applicationContext.getBean("rmiProxy");

        try {
            ItemTemplate wood = service.getItemTemplate("Wood");
            if (wood == null) {
                wood = new ItemTemplate("Wood");
                service.addItemTemplate(wood);
            }
            ItemTemplate fire = service.getItemTemplate("Fire");
            if (fire == null) {
                fire = new ItemTemplate("Fire");
                service.addItemTemplate(fire);
            }
            ItemTemplate coal = service.getItemTemplate("Coal");
            if (coal == null) {
                coal = new ItemTemplate("Coal");
                service.addItemTemplate(coal);
            }
            Recipe makeWoodCoal = service.getRecipe("Coal");
            if (makeWoodCoal == null) {
                List<ItemTemplate> ingredients = new ArrayList<ItemTemplate>();
                ingredients.add(wood);
                ingredients.add(fire);
                makeWoodCoal = new Recipe("Coal", ingredients, coal);
                service.addRecipe(makeWoodCoal);
            }
            System.out.println(makeWoodCoal.getId());
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
View Full Code Here

TOP

Related Classes of ru.webcrafter.core.WebCrafterService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.