Examples of TaskWorker


Examples of ca.eandb.jdcp.job.TaskWorker

            currentJobId = jobId;
            currentTaskId = taskId;
            activeWorkers.add(this);

            this.monitor.notifyStatusChanged("Obtaining task worker...");
            TaskWorker worker;
            try {
              worker = getTaskWorker(jobId);
            } catch (DelegationException e) {
              worker = null;
            } catch (ClassNotFoundException e) {
              service.reportException(jobId, 0, e);
              idle(EXCEPTION_IDLE_SECONDS, EXCEPTION_IDLE_MESSAGE);
              worker = null;
            }

            if (worker == null) {
              this.monitor.notifyStatusChanged("Could not obtain worker...");
              this.monitor.notifyCancelled();
              return;
            }

            this.monitor.notifyStatusChanged("Performing task...");
            ClassLoader loader = worker.getClass().getClassLoader();
            Object results;

            try {
              Object task = taskDesc.getTask().deserialize(loader);
              results = worker.performTask(task, monitor);
            } catch (DelegationException e) {
              results = null;
            } catch (Exception e) {
              service.reportException(jobId, taskId, e);
              idle(EXCEPTION_IDLE_SECONDS, EXCEPTION_IDLE_MESSAGE);
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

    final FileOutputStream stream = new FileOutputStream(outputFile);       
    final CategoryNode catnode = node;
    final YKDictionary dict = yoshikoder.getDictionary();
    final int wsize = winsize;
   
    tworker = new TaskWorker(yoshikoder){
      protected void doWork() throws Exception {
        // TODO remove redundant code here!
       
        // FIRST DOC
        YKDocument doc1 = (YKDocument)docs.get(0);
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        Charset.forName("UTF8")));
    final CategoryNode catnode = node;
    final YKDictionary dict = yoshikoder.getDictionary();
    final int wsize = winsize;
   
    tworker = new TaskWorker(yoshikoder){
      protected void doWork() throws Exception {
        // FIRST DOC
        YKDocument doc1 = (YKDocument)docs.get(0);
        // tokenize the document
        TokenizationCache tcache = yoshikoder.getTokenizationCache();
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        final int wsize = yoshikoder.getWindowSize();
        final YKDocument[] docs = yoshikoder.getSelectedDocuments();
        if (docs == null || docs.length == 0)
          return;
       
        tworker = new TaskWorker(yoshikoder){
            Map<YKDocument,Concordance> m = null;
            protected void doWork() throws Exception {
              m = makeMultipleDocumentConcordance(docs, n, wsize);
            }
            protected void onError(){
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        String fname = dictionarySaver.getFile();
        if (fname == null) return;
        File f = new File(dictionarySaver.getDirectory(), FileUtil.suffix(fname, "ykd"));
       
        final File file = FileUtil.suffix(f, "ykd");
        tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
                YKDictionary dict = yoshikoder.getDictionary();
                ExportUtil.exportAsXML(dict, file);
            }
            protected void onError() {
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        String fname = documentExporter.getFile();
        if (fname == null) return;
       
        File filed = new File(documentExporter.getDirectory(), fname);
        final File file = FileUtil.suffix( filed, "txt");
        tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
                FileUtil.save(file, doc.getText(), "UTF-16");
            }
            protected void onError() {
                DialogUtil.yelp(yoshikoder, "Could not export the document", e); // TODO loc
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        String filename = concordanceExporter.getFile();
        if (filename == null) return;
       
        final File file = new File(concordanceExporter.getDirectory(),
                FileUtil.suffix(filename, "html", "htm"));
        tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
                ExportUtil.exportAsHTML(dcMap, file);
            }
            protected void onError() {
                DialogUtil.yelp(yoshikoder, "Could not export concordance as HTML", e);
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

    final List<YKDocument> docs = documents;
    final File outputFile = file;
    final FileOutputStream stream = new FileOutputStream(outputFile);       
    final CategoryNode catnode = node;
   
    tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
              // FIRST DOC
              YKDocument doc1 = (YKDocument)docs.get(0);
              // tokenize the document
            TokenizationCache tcache = yoshikoder.getTokenizationCache();
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

    final List<YKDocument> docs = documents;
    final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),
        Charset.forName("UTF8")));
    final CategoryNode catnode = node;
   
    tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
              // FIRST DOC
              YKDocument doc1 = (YKDocument)docs.get(0);
              // tokenize the document
            TokenizationCache tcache = yoshikoder.getTokenizationCache();
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.util.TaskWorker

        final File[] fs = documentChooser.getSelectedFiles();
        if (fs.length == 0) return;
       
        final Locale defLoc = yoshikoder.getDefaultLocale();
       
        tworker = new TaskWorker(yoshikoder){
            YKDocument[] docs;
            protected void doWork() throws Exception {
                docs = new YKDocument[fs.length];
                for (int ii = 0; ii < fs.length; ii++) {      
                    YKDocument doc = YKDocumentFactory.createYKDocument(fs[ii], fs[ii].getName(),
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.