gpt4 book ai didi

pl.edu.icm.yadda.common.YaddaException.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 11:40:49 30 4
gpt4 key购买 nike

本文整理了Java中pl.edu.icm.yadda.common.YaddaException.<init>()方法的一些代码示例,展示了YaddaException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YaddaException.<init>()方法的具体详情如下:
包路径:pl.edu.icm.yadda.common.YaddaException
类名称:YaddaException
方法名:<init>

YaddaException.<init>介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.yadda/yadda-common

/**
 * Utility method which returns an array containing name/value pair created from single string.
 * @param value
 * @return
 */
public static String[] parseValue(String value) throws YaddaException {
  int i = value.indexOf(SEPARATOR);
  if (i<0) {
    throw new YaddaException("Invalid stored name/value ["+value+"]");
  } else {
    String[] ret = new String[2];
    // name
    ret[0] = value.substring(0, i);
    // value
    ret[1] = value.substring(i+SEPARATOR_LENGTH);
    return ret;
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-common

protected void writeProperties() throws YaddaException {
  FileOutputStream out = null;
  try {
    out = new FileOutputStream(file); 
    properties.store(out, null);
    out.close();
    out = null;
  } catch (Exception e) {
    throw new YaddaException("Could not write properties file ["+file.getAbsolutePath()+"]", e);
  } finally {
    if (out!=null) {
      try { out.close(); } catch (Exception e) {/*do nothing*/}
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-common

public void setPropertiesFile(File file) throws YaddaException {
  this.file = file;
  if (! file.exists()) {
    File dir = file.getParentFile();
    if (!dir.exists() && !dir.mkdirs()) {
      throw new YaddaException("Could not create directory "+dir.getAbsolutePath());
    }
  }
  readProperties();
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

@Override
protected T doProcess(T data, Map<String, Serializable> context, IProcessListener listener, ProcessingStats stats)
    throws Exception {
  
  //initializer.drop();
  
  String indexName = (String)context.get(Constants.PARAM_INDEX_NAME);
  if (indexName == null)
    throw new YaddaException("Index name not provided to the process");
  
  indexManagerFacade.optimize(indexName);
            
  return data;
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-tools

public RegexpReferenceParser(String resource) throws YaddaException {
  try {
    parser = new RegexpParser(resource, "citation");
  } catch (AnalysisException e) {
    throw new YaddaException(e);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-content

public RegexpReferenceParser2(String resource) throws YaddaException {
  try {
    parser = new RegexpParser(resource, "citation");
  } catch (AnalysisException e) {
    throw new YaddaException(e);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-common

protected void readProperties() throws YaddaException {
  properties = new Properties();
  if (! file.exists()) {
    log.info("Properties file ["+file.getAbsolutePath()+"] does not exist");
  } else {
    InputStream in = null;
    try {
      in = new FileInputStream(file);
      properties.load(in);
      in.close();
      in = null;
    } catch (Exception e) {
      throw new YaddaException("Could not load properties file ["+file.getAbsolutePath()+"]", e);
    } finally {
      if (in!=null) {
        try { in.close(); } catch (Exception e) {/*do nothing*/}
      }    
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-services2

/**
 * Encodes a cookie into string 
 * @param cookie cookie to encode
 * @return encoded cookie
 * @throws YaddaException when encoding failed (e.g. cookie is not 
 * serializable - shouldn't happen)
 */
public static String encode(Cookie cookie) throws YaddaException {
  try {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(os);
    oos.writeObject(cookie);
    oos.close();
    return (new BASE64Encoder().encode(os.toByteArray()));
  } catch (Exception e) {
    throw new YaddaException("Error during cookie serialization", e);
  }
  
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-services2

/**
 * Decodes a cookie from the string
 * @param stringCookie string with serialized cookie
 * @return decoded cookie
 * @throws YaddaException when serialized form is invalid
 */
public static Cookie decode(String stringCookie) throws YaddaException {
  
  try {
  
    InputStream is = new ByteArrayInputStream(new BASE64Decoder().decodeBuffer(stringCookie));
    ObjectInputStream ois = new ObjectInputStream(is);
    
    return (Cookie)ois.readObject();
  
  } catch (Exception e) {
    throw new YaddaException("Invalid cookie", e);
  }
  
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-tools

public RegexpAuthorParser(String configurationResource) throws YaddaException {
  try {
    parser = new RegexpParser(configurationResource, "author");
    surnameParser = new RegexpParser(configurationResource, "surname");
  } catch (AnalysisException e) {
    throw new YaddaException(e);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

protected CountingIterator<CatalogObjectMeta> createPartstampIterator(
    Date from, Date to, String[] types, String[] tags, String collection) throws YaddaException {
  String[] myTags = tags;            
  if (collection != null) {
    if (myTags == null) {
      myTags = new String[] {CatalogParamConstants.TAG_COLLECTION_PREFIX+collection};
    } else {
      myTags=Utils.arrayMerge(tags,new String[] {TAG_COLLECTION_PREFIX+collection});
    }
  }            
  try {
    
    return catalogFacade.iterateByPartStamps(types, from, to, tags);
  } catch (CatalogException e) {
    log2.error("Could not initialize DateRangeSourceIterator!",e);
    throw new YaddaException("Error initializing DateRangeSourceIterator!",e);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

protected CountingIterator<CatalogObjectMeta> createCatalogIterator(
    Date from, Date to, String[] tags, String collection) throws YaddaException {
  String[] myTags = tags;            
  if (collection != null) {
    if (myTags == null) {
      myTags = new String[] {CatalogParamConstants.TAG_COLLECTION_PREFIX+collection};
    } else {
      myTags=Utils.arrayMerge(tags,new String[] {TAG_COLLECTION_PREFIX+collection});
    }
  }            
  //String[] types=new String[] {TYPE_BWMETA1};
  try {
    
    return catalogFacade.iterateObjects(null, from, to, myTags, false);
  } catch (CatalogException e) {
    log2.error("Could not initialize DateRangeSourceIterator!",e);
    throw new YaddaException("Error initializing DateRangeSourceIterator!",e);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-content

/**
 * This method is left here becouse it signature was first
 * @throws YaddaException
 */public void transfer() throws YaddaException{
  logInit();
  CountingIterator<CatalogObjectMeta> iterator = null;
  try {
    iterator = catalogFacade.iterateObjects(new String[]{}, null, null, null, false);
  } catch (CatalogException e) {
    throw new YaddaException("Cannot iterate objects", e);
  }
   log.debug("Iterator acquired");
  Iterator<String> iter=new CatalogStringIterator(iterator, this, catalogFacade);
  transfer(iter);
  
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

@Override
  public void store(MixRecord data, ProcessContext ctx)
      throws Exception {
    String normalId = data.getDotId();
    String extId = data.get10DigitId();
    
    CatalogObject normalCO = catalogFacade.getObject(new YaddaObjectID("urn:zbl:"+normalId));
    CatalogObject extCO = catalogFacade.getObject(new YaddaObjectID());
    

    
    CountingIterator<CatalogObjectMeta> iterator = null;
    try {
      iterator = catalogFacade.iterateObjects(new String[]{}, null, null, null, false);
    } catch (CatalogException e) {
      throw new YaddaException("Cannot iterate objects", e);
    }
    System.out.println("Iterator acquired");
//        Iterator<String> iter=new CatalogStringIterator(iterator, catalogFacade);
//        transfer(iter);
  }

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

@Override
  public void store(MixRecord data, ProcessContext ctx)
      throws Exception {
    String normalId = data.getDotId();
    String extId = data.get10DigitId();
    
    fw.write("Przyjalem zbl: "+ data.getDotId()+" , ktore tlumaczy sie na zbl-ext: "+data.get10DigitId()+"\n");
    
    CatalogObject normalCO = catalogFacade.getObject(new YaddaObjectID("urn:zbl:"+normalId));
    CatalogObject extCO = catalogFacade.getObject(new YaddaObjectID());
    

    
    CountingIterator<CatalogObjectMeta> iterator = null;
    try {
      iterator = catalogFacade.iterateObjects(new String[]{}, null, null, null, false);
    } catch (CatalogException e) {
      throw new YaddaException("Cannot iterate objects", e);
    }
    System.out.println("Iterator acquired");
//        Iterator<String> iter=new CatalogStringIterator(iterator, catalogFacade);
//        transfer(iter);
  }

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

protected Ancestors get(final String key, final Map<String, Ancestors> ancestorsToWrite) throws YaddaException {
  Ancestors result = ancestorsToWrite.get(key);
  if (result != null) {
    return result;
  }
  try {
    result = (Ancestors) cache.getFromCache(key);
  } catch (final NeedsRefreshException e) {
    result = null;
    try {
      final CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID(key),
          CatalogParamConstants.TYPE_ELEMENT_ANCESTORS3, null);
      if (part != null) {
        result = (Ancestors) serializers.get(CatalogParamConstants.TYPE_ELEMENT_ANCESTORS3).toObject(key,
            part.getData());
      }
      if (result == null) {
        cache.cancelUpdate(key);
        return null;
      } else {
        cache.putInCache(key, result);
        return result;
      }
    } catch (final Exception ex) {
      cache.cancelUpdate(key);
      throw new YaddaException(ex);
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

doc = converter.convert(ce);
if (doc == null) {
  throw new YaddaException("Catalog element " + ce.getExtId()
    + " could not be converted to CDocument");

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

protected Object[] readElement(final String extId) throws YaddaException {
  try {
    final CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID(extId),
        CatalogParamConstants.TYPE_BWMETA1, null);
    final CatalogObjectPart<String> childrenPart = catalogFacade.getPart(new YaddaObjectID(extId),
        CatalogParamConstants.TYPE_ELEMENT_CHILDREN3, null);
    // final ElementTreeNode part = (ElementTreeNode) getPart();
    // if (part != null && part instanceof ElementTreeNode) {
    // for (final Set<ElementTreeNode> childrenOfHierarchy :
    // part.getChildren().values()) {
    // children.addAll(childrenOfHierarchy);
    // }
    // }
    boolean hasChildren = false;
    if (childrenPart != null && childrenPart.getData() != null) {
      final ElementTreeNode childrenPartData = (ElementTreeNode) serializers.get(
          CatalogParamConstants.TYPE_ELEMENT_CHILDREN3).toObject(extId, childrenPart.getData());
      hasChildren = hasChildren(childrenPartData);
    }
    if (part != null) {
      return new Object[] {
          (Element) serializers.get(CatalogParamConstants.TYPE_BWMETA1).toObject(extId, part.getData()),
          part.getTimestamp(), hasChildren };
    } else {
      return null;
    }
  } catch (final Exception ex) {
    throw new YaddaException(ex);
  }
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process

throw new YaddaException("Element contents not found");
  throw new YaddaException("Element contents not found");

代码示例来源:origin: pl.edu.icm.yadda/yadda-content

if (conn != null)
    try { conn.close(); } catch (RepositoryException ee) { }
  throw new YaddaException("Cannot store items", e);
} catch (Exception e) {
  if (conn != null)
    try { conn.close(); } catch (RepositoryException ee) { }
  e.printStackTrace();
  throw new YaddaException("Cannot store items", e);

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com