Package org.apache.cocoon.util

Examples of org.apache.cocoon.util.HashMap


     *
     * For nested configurations override this function.
     * */
    public void configure(Configuration conf) throws ConfigurationException {
        Configuration[] parameters = conf.getChildren();
        this.settings = new HashMap(parameters.length);
        for (int i = 0; i < parameters.length; i++) {
            String key = parameters[i].getName();
            String val = parameters[i].getValue("");
            this.settings.put (key, val);
        }
View Full Code Here



    /** The default constructor. */
    public AbstractMarkupLanguage() {
        // Initialize language table
        this.languages = new HashMap();
    }
View Full Code Here

        /** The list of built-in logicsheets defined for this target language */
        protected HashMap namedLogicsheets;

        /** The default constructor */
        protected LanguageDescriptor() {
            this.namedLogicsheets = new HashMap();
        }
View Full Code Here

        this.documentFixed = false;
        this.fixed = false;
        this.formName = null;
        this.recordingCount = 0;
        this.repeater = new LinkedList();
        this.formValues = new HashMap();

        if (this.inputSelector != null) {
            if (this.input != null)
                this.inputSelector.release(this.input);
            this.manager.release(this.inputSelector);
View Full Code Here

        if (conf != null) {
            String key = null;
            String val = null;
            Configuration[] parameters = conf.getChildren();
            this.settings = new HashMap(parameters.length);
            for ( int i = 0; i < parameters.length; i++) {
                key = parameters[i].getName();
                val = parameters[i].getValue();
                if ( key != null )
                    this.settings.put(key, val);
View Full Code Here

       
        if (conf != null) {
            String key = null;
            String val = null;
            Configuration[] parameters = conf.getChildren();
            this.settings = new HashMap(parameters.length);
            for ( int i = 0; i < parameters.length; i++) {
                key = parameters[i].getName();
                val = parameters[i].getValue();
                if ( key != null )
                    this.settings.put(key, val);
View Full Code Here

        if (conf != null) {
            String key = null;
            String val = null;
            Configuration[] parameters = conf.getChildren();
            this.settings = new HashMap(parameters.length);
            for ( int i = 0; i < parameters.length; i++) {
                key = parameters[i].getName();
                val = parameters[i].getValue();
                if ( key != null )
                    this.settings.put(key, val);
View Full Code Here

            LinkedList hints = new LinkedList();
            if (conf != null) {
                String val = null;
                String nodeName = null;
                Configuration[] parameters = conf.getChildren();
                this.settings = new HashMap(parameters.length);
                for ( int i = 0; i < parameters.length; i++) {
                    nodeName= parameters[i].getName();
                    if (getLogger().isDebugEnabled())
                        getLogger().debug("configure -- " + nodeName);
                    if ( nodeName != null ) {
View Full Code Here

    public Map act( Redirector redirector, SourceResolver resolver, Map objectModel,
                    String source, Parameters param ) throws Exception {

        DataSourceComponent datasource = null;
        Connection conn = null;
        Map results = new HashMap();

        // read global parameter settings
        boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
        Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
       
        if (this.settings.containsKey("reloadable"))
            reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
        // read local parameter settings
        try {
            Configuration conf =
                this.getConfiguration(param.getParameter("descriptor", (String) this.settings.get("descriptor")),
                                      resolver,
                                      param.getParameterAsBoolean("reloadable",reloadable));
           
            datasource = this.getDataSource(conf, param);
            conn = datasource.getConnection();
            if (conn.getAutoCommit() == true) {
                try {
                    conn.setAutoCommit(false);
                } catch (Exception ex) {
                    String tmp = param.getParameter("use-transactions",(String) this.settings.get("use-transactions",null));
                    if (tmp != null &&  (tmp.equalsIgnoreCase("no") || tmp.equalsIgnoreCase("false") || tmp.equalsIgnoreCase("0"))) {
                        if (getLogger().isErrorEnabled())
                            getLogger().error("This DB connection does not support transactions. If you want to risk your data's integrity by continuing nonetheless set parameter \"use-transactions\" to \"no\".");
                        throw ex;
                    }
                }
            }

            Configuration[] tables = conf.getChildren("table");
            String tablesetname = param.getParameter("table-set", (String) this.settings.get("table-set"));
            Map set_tables = null; // default to old behaviour
           
            HashMap modeTypes = null;

            if (tablesetname != null) {
                // new set based behaviour
                Configuration[] tablesets = conf.getChildren("table-set");
                String setname = null;
                boolean found = false;
               
                // find tables contained in tableset
                int j = 0;
                for (j=0; j<tablesets.length; j++) {
                    setname = tablesets[j].getAttribute ("name", "");
                    if (tablesetname.trim().equals (setname.trim ())) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new IOException(" given set " + tablesetname + " does not exists in a description file.");
                }
               
                Configuration[] set = tablesets[j].getChildren("table");
       
                // construct a Map that contains the names of the tables
                // contained in the requested tableset
                set_tables = new HashMap(set.length);
                for (int i=0; i<set.length; i++) {
                    // look for alternative modes
                    modeTypes = new HashMap(2);
                    modeTypes.put( MODE_AUTOINCR, set[i].getAttribute( "autoincr-mode", "autoincr" ) );
                    modeTypes.put( MODE_OTHERS, set[i].getAttribute( "others-mode",   "others" ) );
                    set_tables.put(set[i].getAttribute("name",""), modeTypes);
                }
            } else {
                modeTypes = new HashMap(2);
                modeTypes.put( MODE_AUTOINCR, "autoincr" );
                modeTypes.put( MODE_OTHERS, "others" );
            };
            for (int i=0; i<tables.length; i++) {
                if ( set_tables == null ||
                     set_tables.containsKey( tables[i].getAttribute( "name" ) ) ||
                     ( tables[i].getAttribute( "alias", null ) != null && set_tables.containsKey( tables[i].getAttribute( "alias" ) ) )
View Full Code Here

    public void configure(Configuration conf) throws ConfigurationException {
        if (conf != null) {
          String key = null;
          String val = null;
          Configuration[] parameters = conf.getChildren();
          this.settings = new HashMap(parameters.length);
          for ( int i = 0; i < parameters.length; i++) {
            key = parameters[i].getName();
            val = parameters[i].getValue(null);
            if ( key != null )
                this.settings.put(key, val);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.util.HashMap

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.