public DASImpl()

in rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java [70:98]


    public DASImpl(Config inConfig) {
        Config cfg = inConfig;
        if (cfg == null) {
            cfg = ConfigFactory.INSTANCE.createConfig();
        }
        this.configWrapper = new MappingWrapper(cfg);

        Iterator i = configWrapper.getConfig().getCommand().iterator();
        while (i.hasNext()) {
            org.apache.tuscany.das.rdb.config.Command commandConfig =
                (org.apache.tuscany.das.rdb.config.Command) i.next();
            String kind = commandConfig.getKind();
            if (kind.equalsIgnoreCase(KIND_SELECT)) {
                commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig, configWrapper, commandConfig.getResultDescriptor()));
            } else if (kind.equalsIgnoreCase(KIND_UPDATE)) {
                commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig));
            } else if (kind.equalsIgnoreCase(KIND_INSERT)) {
                commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig, new String[0]));
            } else if (kind.equalsIgnoreCase(KIND_DELETE)) {
                commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig));
            } else if (kind.equalsIgnoreCase(KIND_PROCEDURE)) {
                commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getParameter()));
            } else {
                throw new RuntimeException("Invalid kind of command: " + kind);
            }

        }

    }