⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setupclient.java

📁 EJB3.0请一定要上载质量高而且本站没有的源码
💻 JAVA
字号:
package examples.shop.client;

import java.util.Iterator;

import javax.naming.Context;
import javax.naming.InitialContext;

import examples.shop.impl.entity.Product;
import examples.shop.logic.Catalog;
import examples.shop.logic.UserManager;

/**
 * Client test application on a CMP Entity Bean, Product.
 */
public class SetupClient {

    public static void main(String[] args) throws Exception {

        try {

            Context ctx = new InitialContext(System.getProperties());
            Catalog catalog = (Catalog) ctx.lookup(Catalog.class.getName());

            /*
             * Use the catalog to create Products
             */
            catalog.addProduct(new Product().init("123-456-7890", "P4-1.8",
                    "1.8 GHz Pentium 4", 200));
            catalog.addProduct(new Product().init("123-456-7891", "P4-3",
                    "3 GHz Pentium 4", 300));
            catalog.addProduct(new Product().init("123-456-7892", "P4-4",
                    "4 GHz Pentium", 400));
            catalog.addProduct(new Product().init("123-456-7893", "SD-256",
                    "256 MB SDRAM", 50));
            catalog.addProduct(new Product().init("123-456-7894", "SD-512",
                    "512 MB SDRAM", 100));
            catalog.addProduct(new Product().init("123-456-7895", "DD-1000",
                    "1GB MB DDRAM", 200));            
            catalog.addProduct(new Product().init("123-456-7896", "MP3-x",
                    "MP3 Player", 200));

            /*
             * Find a Product, and print out it's description
             */
            for (Iterator<Product> i = catalog.getProductList().iterator(); i
                    .hasNext();) {
                System.out.println(i.next().getDescription());
            }
            
            UserManager userManager = 
                (UserManager) ctx.lookup(UserManager.class.getName());            
            userManager.createUser("Gerald", "Gerald Brose", "password",
            "D-13509 Berlin, Germany");            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -