Examples of DAS


Examples of opendap.dap.DAS

    // list of excluded variables
    Set<String> excludedVariables
      = config.getProcessingInstructions().getInstructionValues(OpendapConfigMetKeys.EXCLUDE_VARIABLES_ATTR);
 
    try {
      DAS das = dConn.getDAS();
      @SuppressWarnings("unchecked")
      Enumeration<String> names = das.getNames();
      while (names.hasMoreElements()) {
        String attName = names.nextElement();
        LOG.log(Level.FINE, "Extracting DAS attribute: " + attName);
        AttributeTable at = das.getAttributeTable(attName);
        Enumeration<String> e = at.getNames();
       
        // NetCDF global attributes
        // store attribute name, all values for ALL attributes (strings and numerics)
        ProcessingInstructions processingInstructions = config.getProcessingInstructions();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {

        try {
            InputStream mapping = createConfigStream();
            Connection conn = getConnection();
            DAS das = DAS.FACTORY.createDAS(mapping, conn);

            Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?");

            select.setParameter(1, logonID);

            DataObject root = select.executeQuery();
            conn.close();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
            throws RemoteException {

        try {
            DAS das = DAS.FACTORY.createDAS(getConnection());
            Command insert = das.createCommand("insert into customers (firstName,lastName,address,email, loginID, password  ) values ('"
                    + customerProfile.getFirstName() + "', '" + customerProfile.getLastName() + "', '" + customerProfile.getAddress() + "', '"
                    + customerProfile.getEmail() + "', '" + customerProfile.getLoginID() + "', '" + customerProfile.getPassword() + "')");

            insert.execute();
            CustomerProfileData ret = getCustomerProfile(customerProfile.getLoginID());
            String cid = ret.getId() + "";
            if (createSavings) {
                insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance  ) values (" + cid + ", '"
                        + AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_SAVINGS + "', " + 1.0F + ")");
                insert.execute();

            }
            if (createCheckings) {
                insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance  ) values (" + cid + ", '"
                        + AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS + "', " + 1.0F + ")");
                insert.execute();

            }
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    }

    public CustomerProfileData createAccountNOTWORKING(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
            throws RemoteException {
        try {
            DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection());
            Command read = das.getCommand("all customers");

            // select.setDataObjectModel();
            DataObject root = read.executeQuery();

            // Create a new stockPurchase
            DataObject customer = root.createDataObject("customerProfileData");

            // THIS SEEMS TO BE THE ONLY WAY TO DO THIS .. NO WAY TO JUST ADD AN EXISTING CUSTOMER.
            customer.set("firstName", customerProfile.getFirstName());
            customer.set("lastName", customerProfile.getLastName());
            customer.set("address", customerProfile.getAddress());
            customer.set("email", customerProfile.getEmail());
            customer.set("loginID", customerProfile.getLoginID());
            customer.set("password", customerProfile.getPassword());

            das.applyChanges(root);
            return getCustomerProfile(customerProfile.getLoginID());

        } catch (Exception e) {
            if (e instanceof RemoteException) {
                throw (RemoteException) e;
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

            final AccountFactory accountFactory = AccountFactory.INSTANCE;
            final AccountReport accountReport = accountFactory.createAccountReport();
            InputStream mapping = createConfigStream();

            Connection conn = getConnection();
            DAS das = DAS.FACTORY.createDAS(mapping, conn);

            Command select = das.createCommand("SELECT accountNumber, accountType, balance FROM accounts where id = ?");
            select.setParameter(1, customerID);

            DataObject root = select.executeQuery();
            accountReport.getAccountSummaries().addAll(root.getList("AccountSummary"));

            // Get Stocks

            select = das.createCommand("SELECT Symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber  FROM stocks where id = ?");
            select.setParameter(1, customerID);

            // select.addConverter("STOCKS.PURCHASEDATE", DateConverter.class.getName());

            root = select.executeQuery();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    public float deposit(String account, float ammount) throws RemoteException {

        try {
            Connection conn = getConnection();
            DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn);

            Command select = das.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = ?");
            select.setParameter(1, account);

            DataObject root = select.executeQuery();
            Collection accounts = root.getList("AccountSummary");
            AccountSummary accountData = (AccountSummary) accounts.iterator().next();
            float newbalance = accountData.getBalance() + ammount;
            accountData.setBalance(newbalance);
            // update department set companyid = ? where department.name = ?

            Command update = das.getCommand("update balance");
            update.setParameter(1, new Float(newbalance));
            update.setParameter(2, account);
            update.execute();
            conn.close();
            return newbalance;
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    }

    public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException {
        try {
            DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection());

            Command read = das.getCommand("stockbylotSelect");
            read.setParameter(1, purchaseLotNumber);// autoboxing :-)
            DataObject root = read.executeQuery();
            List stocks = root.getList("StockSummary");
            if (null != stocks && !stocks.isEmpty()) {
                StockSummary stock = (StockSummary) stocks.get(0);
                int newQuatity = Math.max(stock.getQuantity() - quantity, 0);
                if (newQuatity < 1) {

                    Command delete = das.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?");
                    delete.setParameter(1, purchaseLotNumber);
                    delete.execute();

                } else {

                    Command update = das.getCommand("stockbylot");

                    update.setParameter(1, newQuatity);
                    update.setParameter(2, purchaseLotNumber);
                    update.execute();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    }

    public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException {

        try {
            DAS das = DAS.FACTORY.createDAS(getConnection());
            Command insert = das.createCommand("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate) values (?,?,?,?,?)");
            insert.setParameter(1, new Integer(id));
            insert.setParameter(2, stock.getSymbol());
            insert.setParameter(3, stock.getQuantity());
            insert.setParameter(4, stock.getPurchasePrice());
            insert.setParameter(5, DateConverter.INSTANCE.getColumnValue(stock.getPurchaseDate()));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    }

    public void testWithdrawThroughDAS(withdraw wd) throws Exception {

        Connection conn = createConnection();
        DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn);
        Command select = das.getCommand("get account");

        select.setParameter(1, wd.getAccountNumber());

        DataObject root = select.executeQuery();

        Collection accounts = root.getList("AccountSummary");
        AccountSummary account = (AccountSummary) accounts.iterator().next();
        float newbalance = account.getBalance() - wd.getAmount();
        account.setBalance(newbalance);
        // update department set companyid = ? where department.name = ?

        Command update = das.getCommand("update balance");
        update.setParameter(1, new Float(newbalance));
        update.setParameter(2, wd.getAccountNumber());

        update.execute();
        conn.close();
View Full Code Here

Examples of org.apache.tuscany.das.rdb.DAS

    }

    protected void testStrockPurchaseThroughDAS(purchaseStock sp) throws InstantiationException, IllegalAccessException, ClassNotFoundException,
            SQLException {

        DAS das = DAS.FACTORY.createDAS(createConfigStream(), createConnection());
        Command read = das.getCommand("all stocks");

        DataObject root = read.executeQuery();

        // Create a new stockPurchase
        DataObject stockPurchase = root.createDataObject("StockSummary");
        stockPurchase.set("id", new Integer(sp.getId()));
        stockPurchase.set("symbol", sp.getStock().getSymbol());
        stockPurchase.set("quantity", new Integer(sp.getStock().getQuantity()));
        stockPurchase.set("purchasePrice", new Float(11.00));
        // String type = stockPurchase.getType().getProperty("purchaseDate").getType().toString();
        stockPurchase.setDate("purchaseDate", new Date());

        das.applyChanges(root);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.