Examples of DuccProperties


Examples of org.apache.uima.ducc.common.utils.DuccProperties

    DuccProperties parseClass(String name, String parent)
      throws IOException,
      IllegalConfigurationException
    {
        DuccProperties ret = new DuccProperties();
        ret.put("type", "class");
        ret.put("name", name);
        if ( parent != null ) {
            ret.put("parent", parent);
        }

        parseInternal(ret);

        return ret;
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

     * Propogate my properties to all my kids and their kids, etc.  Classes only, Nodepools don't
     * do any sort of inheritance.
     */
    void propogateDown(String clname)
    {
        DuccProperties cl = clmap.get(clname);
        String children = cl.getStringProperty("children", null);
        if ( children == null ) return;

        String[] kids = children.split("\\s+");
        for ( String kid : kids ) {
            DuccProperties kp = clmap.get(kid);

            for ( Object o : cl.keySet() ) {
                if ( ! kp.containsKey(o) ) {
                    String k = (String) o;
                    if ( k.equals("abstract" ) ) continue;       // don't propogate down abstractness
                    if ( k.equals("children" ) ) continue;       // don't propogate down children
                    if ( k.equals("default" ) ) continue;        // don't propogate down default
                    String v = cl.getStringProperty(k);
                    // System.out.println("Object " + kp.get("name") + " inherits " + k + "," + v + " from " + cl.get("name"));
                    kp.put(k, v);
                }               
            }
            propogateDown(kid);
        }
    }
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

           
            if ( parent == null ) {
                independentClasses.add(name);
            } else {
                DuccProperties par_cl = clmap.get(parent);
                if ( par_cl == null ) {
                    throw new IllegalConfigurationException("Class " + name + " parent pool " + parent + " cannot be found.");
                }
                String children = par_cl.getStringProperty("children", null);
                if ( children == null ) {
                    children = name;
                } else {
                    children = children + " " + name;
                }
                par_cl.put("children", children);
            }
        }

        // now starting at every root, propogate stuff down
        for ( String s : independentClasses ) {
            propogateDown(s);
        }

        // must fill in defaults, which we couldn't do until we finished inheritance
        for ( DuccProperties p : clmap.values() ) {
            String policy = p.getStringProperty("policy", null);
            String name = p.getProperty("name");

            if ( policy == null ) {
                throw new IllegalConfigurationException("Class " + name + " is missing scheduling policy ");
            }
            if ( policy.equals("FAIR_SHARE") ) {
                fairShareExists = true;
                handleDefault(p, fairShareDefault, policy);
                supplyDefaults(p, defaultFairShareClass);
            } else
            if ( policy.equals("FIXED_SHARE") ) {
                fixedExists = true;
                handleDefault(p, fixedDefault, policy);
                supplyDefaults(p, defaultFixedShareClass);
            } else
            if ( policy.equals("RESERVE") ) {
                reserveExists = true;
                handleDefault(p, reserveDefault, policy);
                supplyDefaults(p, defaultReserveClass);
            } else {
                throw new IllegalConfigurationException("Unknown scheduling policy \"" + policy + "\" in class " + name);
            }
        }

        // remove the abstract classes as they are no longer needed and we don't want to let them leak out
        // where somebody might think they're ok to use
        Iterator<String> iter = clmap.keySet().iterator();
        while ( iter.hasNext() ) {
            String k = iter.next();
            DuccProperties p = clmap.get(k);
            if ( p.containsKey("abstract") ) {
                // System.out.println("---------------- Remove " + p.get("name"));
                iter.remove();
            }
        }
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

            String parent = p.getStringProperty("parent", null);
            String name   = p.getStringProperty("name");
            if ( parent == null ) {
                independentNodepools.add(p);
            } else {
                DuccProperties par_pool = npmap.get(parent);
                if ( par_pool == null ) {
                    throw new IllegalConfigurationException("Nodepool " + name+ " parent pool " + parent + " cannot be found.");
                }
                @SuppressWarnings("unchecked")
        List<DuccProperties> children = (List<DuccProperties>) par_pool.get("children");
                if ( children == null ) {
                    children = new ArrayList<DuccProperties>();
                    par_pool.put("children", children);
                }
                children.add(p);
            }
        }

        // connect the classes into their nodepools
        for ( DuccProperties p : classes ) {
            if ( p.containsKey("abstract") ) continue;                // don't propogate these out

            String name = p.getStringProperty("name");

            String npname = p.getStringProperty("nodepool", null);
            if ( npname == null ) {
                throw new IllegalConfigurationException("Class " + name + " is not assigned to a nodepool.");
            }
            DuccProperties np = npmap.get(npname);
            if ( np == null ) {
                throw new IllegalConfigurationException("Class " + name + " assigned to nodepool " + npname + " but nodepool does not exist.");
            }

            @SuppressWarnings("unchecked")
      List<DuccProperties> class_set = (List<DuccProperties>) np.get("classes");
            if ( class_set == null ) {
                class_set = new ArrayList<DuccProperties>();
                np.put("classes", class_set);
            }
            class_set.add(p);

        }       
    }
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

        // Need job props and meta props for webserver.
        // The pinger is always the default configured UIMA-AS pinger.
        //
        // job props: working_directory, log_directory
        // meta props: endpoint, user
        job_props = new DuccProperties();
        // job_props.put("working_directory", System.getProperty("user.dir")); // whatever my current dir is
        // job_props.put("log_directory", System.getProperty("user.dir") + "/../logs");
        //job_props.put("service_ping_jvm_args", "-Xmx50M");
        props_filename = state_dir + "/services/" + id.toString() + ".svc";
        saveServiceProperties();

        meta_props = new DuccProperties();
        meta_props.put("user", System.getProperty("user.name"));
        meta_props.put("endpoint", key);
        meta_props.put("service-class", ""+service_class.decode());
        meta_props.put("service-type", ""+service_type.decode());
        meta_props.put("stopped", ""+stopped);
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

        // The pinger is always the default configured UIMA-AS pinger.
        // Submitted services must always be UIMA-AS services, for now, checked in caller.
        //
        // job props: working_directory, log_directory
        // meta props: endpoint, user
        job_props = new DuccProperties();
        //job_props.put("service_ping_jvm_args", "-Xmx50M");
        props_filename = state_dir + "/services/" + id.toString() + ".svc";
        saveServiceProperties();

        meta_props = new DuccProperties();
        meta_props.put("user", System.getProperty("user.name"));
        meta_props.put("endpoint", key);
        meta_props.put("service-class", ""+service_class.decode());
        meta_props.put("service-type", ""+service_type.decode());
        meta_props.put("stopped", ""+stopped);
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

     *
     */
    private void runSortTester(String propsfile)
    {
        int friendly = 1;
        DuccProperties props = new DuccProperties();
        try {
      props.load(propsfile);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
            System.exit(1);
    }

       
        String svcnames = props.getStringProperty("services");
        String[] svcs = svcnames.split("\\s");
        ServiceSet[] allServices = new ServiceSet[svcs.length];
        int ndx = 0;
        for ( String svc : svcs ) {
            svc = svc.trim();
            String key = "UIMA-AS:" + svc + ":tcp://foo:123";
            ServiceSet dep = serviceStateHandler.getServiceByName(key);
            if ( dep == null ) {
                dep = new ServiceSet(new DuccId(friendly++), new DuccId(0), key, null);
                serviceStateHandler.putServiceByName(key, dep);
                allServices[ndx++] = dep;
            }

            String depnames = props.getStringProperty("svc." + svc);
            String[] deps = depnames.split("\\s");
            List<String> subdeps = new ArrayList<String>();
            for ( String subsvc : deps ) {
                subsvc = subsvc.trim();
                if ( subsvc.equals("")) continue;
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

            // turn the argument string into properties
            String[] as = args.split(",");
            StringWriter sw = new StringWriter();
            for ( String s : as ) sw.write(s + "\n");
            StringReader sr = new StringReader(sw.toString());           
            DuccProperties props = new DuccProperties();
            try {
                props.load(sr);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            meta_timeout = props.getIntProperty("meta_timeout", 5000);
            broker_jmx_port = props.getIntProperty("broker_jmx_port", 1099);
            queue_threshold = props.getIntProperty("queue_threshold", 0);
            window = props.getIntProperty("window", 3);
        }
        queueSizeWindow = new int[window];
        logger.debug("<ctr>", null, "INIT: meta_timeout", meta_timeout, "broker_jmx_port", broker_jmx_port, "queue_threshold", queue_threshold, "window", window);

        this.monitor = new UimaAsServiceMonitor(endpoint, broker_host, broker_jmx_port);
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

     * @return {@link IServiceReply IServiceReply} object with register status.
     */
    public IServiceReply register(String[] args)
        throws Exception
    {
        DuccProperties dp = new DuccProperties();
        init (this.getClass().getName(), registration_options, args, null, dp, callback, "sm");

        // Note: dp & cli_props are identical ... use only the class variable here for consistency
       
        setLinger();
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

     * @return {@link IServiceReply IServiceReply} object with unregister reply status.
     */
    public IServiceReply unregister(String[] args)
        throws Exception
    {
        DuccProperties dp = new DuccProperties();
        init(this.getClass().getName(), unregister_options, args, null, dp, callback, "sm");
       

        Pair<Integer, String> id = getId(UiOption.Unregister);
        String user = dp.getProperty(UiOption.User.pname());
        byte[] auth_block = (byte[]) dp.get(UiOption.Signature.pname());

        ServiceUnregisterEvent ev = new ServiceUnregisterEvent(user, id.first(), id.second(), auth_block);
       
        try {
            return (IServiceReply) dispatcher.dispatchAndWaitForDuccReply(ev);
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.