Package uk.org.ogsadai.activity

Examples of uk.org.ogsadai.activity.ActivityUserException


          {
              throw new ActivityTerminatedException();
          }
          catch (Exception e)
          {
              throw new ActivityUserException(e);
          }
   
  }
View Full Code Here


        trans.transform(source, result);
        String xmlString = sw.toString();
        return xmlString;
       
  }catch(ParserConfigurationException exc) {
    throw new ActivityUserException(exc);
  }
  catch(Exception exc) {
    throw new ActivityUserException(exc);
  }

  }
View Full Code Here

  private AssociationRulesProducer getAssociator() throws ActivityUserException, ActivityTerminatedException, ActivityProcessingException{
        Object block;
        block = readBlock(mAssociatorInput); // BEGIN outer list of nominal values
        if (block != ControlBlock.LIST_BEGIN)
        {
            throw new ActivityUserException(
                    new MalformedListBeginException(INPUT_ASSOCIATOR));
        }

        while ((block = readBlock(mAssociatorInput)) != ControlBlock.LIST_END)
        {
            if (block == ControlBlock.NO_MORE_DATA)
            {
                    throw new ActivityUserException(
                            new MalformedListEndException(INPUT_ASSOCIATOR));
             }
                else
                {
                  if(block instanceof AssociationRulesProducer) {
View Full Code Here

    throws ActivityUserException
    {
        int columnCount = tuplesMetadata.getColumnCount();
        if (columnCount != values.getColumnCount())
        {
            throw new ActivityUserException(
                    new UnexpectedValuesException(
                            columnCount,
                            values.getColumnCount()));
        }
View Full Code Here

            DPPMethod method = (DPPMethod) impl.newInstance();
            return method;
        }
        catch (ClassNotFoundException e)
        {
            throw new ActivityUserException(e);
        }
        catch (InstantiationException e)
        {
            throw new ActivityUserException(e);
        }
        catch (IllegalAccessException e)
        {
            throw new ActivityUserException(e);
        }
    }
View Full Code Here

   
    if (stationDir.length==0 || !stationDir[0].exists()||!stationDir[0].isDirectory())
    {           
          System.out.println("station: "+station+" not found");
          outmap.put(ERROR,"station: "+station+" not found");
        throw new ActivityUserException(new Throwable("station: "+station+" not found"));
    }
     // dirName.append(stationDir[0].getPath()).append(File.separatorChar);
      String stationPath=stationDir[0].getPath().substring(homeDir.length());
   
      while(eCal.compareTo(sCal)>=0){
       
         dirName.append(stationPath).append(File.separatorChar)
          .append(eCal.get(Calendar.YEAR)).append(File.separatorChar)
          .append(String.format("%tm", eCal));
         String dName=dirName.toString();
          dirName.setLength(0);
     //     System.out.println("dirname: "+dName);
          File directory = mResource.getFileForReading(dName);
       //   System.out.println("directory check: "+directory.getAbsolutePath());
        if (!directory.exists())
      {           
      System.out.println(dName+" "+" DIRECTORY_NOT_FOUND");
      eCal.add(Calendar.MONTH, - 1);
      continue;
      }
      else if (!directory.isDirectory())
      {
          throw new ActivityUserException(ErrorID.NOT_A_DIRECTORY);
      }
   
      File[] files = directory.listFiles(new WFileFilter(dateFormatter.format(eCal.getTime()), "",station.toUpperCase(), channel.toUpperCase()));
       
      for(File file:files)
      {
        System.out.println("adding file: "+file.getName());
        fileList.add(file);
      }  
    
         eCal.add(Calendar.DAY_OF_MONTH, - 1);
     
     
   

      output.write(ControlBlock.LIST_BEGIN);
     
     
     
    for (Iterator<File> it = fileList.iterator(); it.hasNext();)
    {
     
      String outFile=it.next().getAbsolutePath().substring(homeDir.length());
      System.out.println("file: "+outFile);
        output.write(outFile );
    }
    output.write(ControlBlock.LIST_END)
 
    }catch (ActivityUserException ae) {
      try {
        output.write(ControlBlock.LIST_BEGIN);
        output.write("");
        output.write(ControlBlock.LIST_END);

        } catch (PipeClosedException e)
          {
              iterativeStageComplete();
          }
          catch (PipeIOException e)
          {
              throw new ActivityPipeProcessingException(e);
          }
          catch (PipeTerminatedException e)
          {
              throw new ActivityTerminatedException();
          }
     
      } catch (ParseException e) {
        throw new ActivityUserException(e);
 
      } catch (PipeClosedException e)
        {
            iterativeStageComplete();
        }
View Full Code Here

      if (peOutputURI.equals(peInputURI)) {
        iri1 = IRI.create(peOutput);
        ontology1 = manager.loadOntologyFromOntologyDocument(iri1);
        LOG.debug("Loaded ontology: " + ontology1);
        if (!ontology1.containsClassInSignature(iri1)) {
          throw new ActivityUserException(
              new ActivityInferenceException(
                  "ActivityInferenceException",
                  "Ontology does not contain class: " +  iri1));
        }
      } else {
        mOutputBlockWriter.write("disjoint");
      }

      if (ontology2 != null) {
        // two different domain ontologies
        mOutputBlockWriter.write("disjoint");
      } else {
        // same domain ontology
        OWLReasonerFactory reasonerFactory = null;
        reasonerFactory = new Reasoner.ReasonerFactory();
        OWLReasoner reasoner = reasonerFactory
            .createReasoner(ontology1);

        OWLDataFactory fac = manager.getOWLDataFactory();
        OWLClass peOutputClass = fac.getOWLClass(IRI.create(peOutput));
        OWLClass peInputClass = fac.getOWLClass(IRI.create(peInput));

        if (equivalentClasses(peOutputClass, peInputClass, ontology1,
            reasoner)) {
          mOutputBlockWriter.write("equivalent");
        } else if (subclassOf(peOutputClass, peInputClass, reasoner)) {
          mOutputBlockWriter.write("subClassOf");
        } else if (disjointClasses(peOutputClass, peInputClass,
            reasoner)) {
          mOutputBlockWriter.write("disjoint");
        } else {
          mOutputBlockWriter.write("convertible");
        }
      }

    } catch (OWLOntologyCreationIOException e) {
      // IOExceptions during loading get wrapped in an
      // OWLOntologyCreationIOException
      IOException ioException = e.getCause();
      if (ioException instanceof UnknownHostException) {
        throw new ActivityUserException(new ActivityInferenceException(
            "UnknownHostException",
            "Could not load ontology. Unknown host: "
                + ioException.getMessage()));
      } else {
        throw new ActivityUserException(new ActivityInferenceException(
            "ActivityInferenceException",
            "Could not load ontology: "
                + ioException.getClass().getSimpleName() + " "
                + ioException.getMessage()));
      }
    } catch (UnparsableOntologyException e) {
      // If there was a problem loading an ontology because there are
      // syntax errors in the document (file) that
      // represents the ontology then an UnparsableOntologyException is
      // thrown
      LOG.debug("Could not parse the ontology: " + e.getMessage());
      // A map of errors can be obtained from the exception
      Map<OWLParser, OWLParserException> exceptions = e.getExceptions();
      // The map describes which parsers were tried and what the errors
      // were
      for (OWLParser parser : exceptions.keySet()) {
        LOG.debug("Tried to parse the ontology with the "
            + parser.getClass().getSimpleName() + " parser");
        LOG.debug("Failed because: "
            + exceptions.get(parser).getMessage());
      }
      throw new ActivityUserException(new ActivityInferenceException(
          "ActivityInferenceException",
          "Could not parse the ontology: " + e.getMessage()));
    } catch (UnloadableImportException e) {
      // If our ontology contains imports and one or more of the imports
      // could not be loaded then an
      // UnloadableImportException will be thrown (depending on the
      // missing imports handling policy)
      OWLOntologyCreationException cause = e
          .getOntologyCreationException();
      throw new ActivityUserException(new ActivityInferenceException(
          "ActivityInferenceException", "Could not load import: "
              + e.getImportsDeclaration() + "Reason: "
              + cause.getMessage()));
    } catch (OWLOntologyCreationException e) {
      throw new ActivityUserException(new ActivityInferenceException(
          "ActivityInferenceException", "Reason: " + e.getMessage()));
    } catch (PipeClosedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (PipeIOException e) {
View Full Code Here

          catch (PipeTerminatedException e)
          {
              throw new ActivityTerminatedException();
          } catch (UnsupportedEncodingException e) {
       
            throw new ActivityUserException(e);
      }
       
       
     
    }
View Full Code Here

        }
        else if (! directory.isDirectory())
        {
             outmap.put(ERROR,ErrorID.NOT_A_DIRECTORY);
             
          throw new ActivityUserException(ErrorID.NOT_A_DIRECTORY);
        }
     
        File[] files = directory.listFiles(new WFileFilter(String.format("%tY", eCal),network.toUpperCase() ,station.toUpperCase(), channel.toUpperCase()));
       
        for(File file:files)
        {
          System.out.println("adding file: "+file.getName());
          fileList.add(file);
       
      
           eCal.add(Calendar.DAY_OF_YEAR, - 1);
       
       
       
     
    //  } catch (FileResourceUseException e) {
      //   e.printStackTrace();
        
       
    //  }
        //  try {
           
        output.write(ControlBlock.LIST_BEGIN);
     
      for (Iterator<File> it = fileList.iterator(); it.hasNext();)
      {
        String outFile=it.next().getAbsolutePath().substring(homeDir.length());
       
          output.write(outFile );
      }
      output.write(ControlBlock.LIST_END);
       
        } catch (ParseException e) {
        throw new ActivityUserException(e);
     
          } catch (PipeClosedException e)
          {
              iterativeStageComplete();
          }
View Full Code Here

       }   
     System.out.println("end first block");
     iterationsWriter.write(intervalsList.size()/2);
    
    } catch (ParseException e) {
      throw new ActivityUserException(e);
    } catch (PipeClosedException e) {
       iterativeStageComplete();
    } catch (PipeIOException e) {
      throw new ActivityPipeProcessingException(e);
    } catch (PipeTerminatedException e) {
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.activity.ActivityUserException

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.