org.modeshape.jcr.api.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(110)

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

Logger.error介绍

[英]Log a message at the ERROR level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. The pattern consists of zero or more keys of the form {n}, where n is an integer starting at 0. Therefore, the first parameter replaces all occurrences of "{0}", the second parameter replaces all occurrences of "{1}", etc.

If any parameter is null, the corresponding key is replaced with the string "null". Therefore, consider using an empty string when keys are to be removed altogether.
[中]根据指定的格式和(可选)参数以错误级别记录消息。消息应该为每个参数包含一对空大括号,并且应该按照正确的顺序传递。该模式由格式为{n}的零个或多个键组成,其中n是从0开始的整数。因此,第一个参数替换所有出现的“{0}”,第二个参数替换所有出现的“{1}”,等等。
如果任何参数为null,则相应的键将替换为字符串“null”。因此,当键被完全移除时,考虑使用一个空字符串。

代码示例

代码示例来源:origin: ModeShape/modeshape

/**
 * Returns a set with all the names of the available repositories.
 * @return a set with the names, never {@code null}
 */
public static Set<String> getJcrRepositoryNames() {
  try {
    return repositoriesContainer.getRepositoryNames(Collections.unmodifiableMap(factoryParams));
  } catch (RepositoryException e) {
    LOGGER.error(e, WebJcrI18n.cannotLoadRepositoryNames.text());
    return Collections.emptySet();
  }
}

代码示例来源:origin: org.modeshape/modeshape-web-jcr

/**
 * Returns a set with all the names of the available repositories.
 * @return a set with the names, never {@code null}
 */
public static Set<String> getJcrRepositoryNames() {
  try {
    return repositoriesContainer.getRepositoryNames(Collections.unmodifiableMap(factoryParams));
  } catch (RepositoryException e) {
    LOGGER.error(e, WebJcrI18n.cannotLoadRepositoryNames.text());
    return Collections.emptySet();
  }
}

代码示例来源:origin: ModeShape/modeshape

private Response exceptionResponse( Throwable t,
                    Status status ) {
    switch (status) {
      case NOT_FOUND: {
        LOGGER.debug(t, "Item not found");
        break;
      }
      default: {
        LOGGER.error(t, "Server error");
        break;
      }
    }
    return Response.status(status).entity(new RestException(t)).build();
  }
}

代码示例来源:origin: ModeShape/modeshape

protected String valueToString( String absPropertyPath,
                Value value,
                String baseUrl,
                Session session ) {
  if (value == null) {
    return null;
  }
  try {
    switch (value.getType()) {
      case PropertyType.BINARY: {
        assert baseUrl != null;
        return restValueForBinary(absPropertyPath, baseUrl);
      }
      case PropertyType.REFERENCE:
      case PropertyType.WEAKREFERENCE:
      case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE: {
        assert session != null;
        return restValueForReference(value, baseUrl, session);
      }
      default: {
        return value.getString();
      }
    }
  } catch (Exception e) {
    logger.error("Cannot create JSON string from value ", e);
    return null;
  }
}

代码示例来源:origin: ModeShape/modeshape

private void addRepository( HttpServletRequest request,
              RestRepositories repositories,
              String repositoryName ) {
  RestRepositories.Repository repository = repositories.addRepository(repositoryName, request);
  try {
    Repository jcrRepository = RepositoryManager.getRepository(repositoryName);
    repository.setActiveSessionsCount(((org.modeshape.jcr.api.Repository)jcrRepository).getActiveSessionsCount());
    for (String metadataKey : jcrRepository.getDescriptorKeys()) {
      Value[] descriptorValues = jcrRepository.getDescriptorValues(metadataKey);
      if (descriptorValues != null) {
        List<String> values = new ArrayList<String>(descriptorValues.length);
        for (Value descriptorValue : descriptorValues) {
          values.add(descriptorValue.getString());
        }
        repository.addMetadata(metadataKey, values);
      }
    }
  } catch (Exception e) {
    logger.error(e, e.getMessage());
  }
}

代码示例来源:origin: ModeShape/modeshape

binaryStream.close();
} catch (IOException e) {
  logger.error("Cannot close binary stream", e);

代码示例来源:origin: ModeShape/modeshape

binaryStream.close();
} catch (IOException ioe) {
  logger.error("Cannot close binary stream", ioe);

代码示例来源:origin: org.fcrepo/modeshape-jcr

@GuardedBy( "this" )
private void removeProvidedIndex( AtomicIndex index,
                 ChangeBus observable ) {
  try {
    observable.unregister(index);
    removeIndex(index.indexDefinition(), index.managed(), index.workspaceName());
  } catch (RuntimeException e) {
    String msg = "Error removing index '{0}' in workspace '{1}' with definition: {2}";
    logger().error(e, msg, index.getName(), index.workspaceName(), index.indexDefinition());
  }
}

代码示例来源:origin: ModeShape/modeshape

@GuardedBy( "this" )
private void removeProvidedIndex( AtomicIndex index,
                 ChangeBus observable ) {
  try {
    observable.unregister(index);
    removeIndex(index.indexDefinition(), index.managed(), index.workspaceName());
  } catch (RuntimeException e) {
    String msg = "Error removing index '{0}' in workspace '{1}' with definition: {2}";
    logger().error(e, msg, index.getName(), index.workspaceName(), index.indexDefinition());
  }
}

代码示例来源:origin: ModeShape/modeshape

isValid = metadata.check();
} catch (Exception e) {
  getLogger().error(e, "Could not sequence audio file with MIMEType {0}", mimeType);
  return true;
} else {
  getLogger().error("Could not sequence audio file with MIMEType {0}", mimeType);
  return false;

代码示例来源:origin: ModeShape/modeshape

private boolean processBasicMetadata( Node sequencedNode,
                   Binary binaryValue ) {
  VideoMetadata metadata = null;
  try (InputStream stream = binaryValue.getStream()) {
    metadata = new VideoMetadata(stream);
    if (metadata.check()) {
      setPropertyIfMetadataPresent(sequencedNode, DURATION, metadata.getDuration());
      setPropertyIfMetadataPresent(sequencedNode, BITRATE, metadata.getBitrate());
      setPropertyIfMetadataPresent(sequencedNode, TITLE, metadata.getTitle());
      setPropertyIfMetadataPresent(sequencedNode, COMMENT, metadata.getComment());
      setPropertyIfMetadataPresent(sequencedNode, ENCODER, metadata.getEncoder());
      int suffix = 0;
      for (StreamMetadata streamMetadata : metadata.getStreams()) {
        Node streamNode = sequencedNode.addNode(STREAM_NODE + String.valueOf(suffix), STREAM_NODE);
        processStreamMetadata(streamNode, streamMetadata);
        suffix += 1;
      }
      return true;
    }
  } catch (Exception e) {
    getLogger().error(e, "Couldn't process the stream.");
  }
  return false;
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

} catch (RuntimeException e) {
  String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);
  } catch (RuntimeException e) {
    String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
    logger().error(e, msg, defn.getName(), workspaceName, defn);
} catch (RuntimeException e) {
  String msg = "Error adding index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

} catch (RuntimeException e) {
  String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);
  } catch (RuntimeException e) {
    String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
    logger().error(e, msg, defn.getName(), workspaceName, defn);
} catch (RuntimeException e) {
  String msg = "Error adding index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

} catch (RuntimeException e) {
  String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: org.fcrepo/modeshape-jcr

} catch (RuntimeException e) {
  String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

private boolean processXMPMetadata( Node sequencedNode,
                  Binary binaryValue) {
  PdfXmpMetadata metadata = null;
  try (InputStream stream = binaryValue.getStream()) {
    metadata = new PdfXmpMetadata(stream);
    if (metadata.check()) {
      Node xmpNode = sequencedNode.addNode(PdfMetadataLexicon.XMP_NODE, PdfMetadataLexicon.XMP_NODE);
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.BASE_URL, metadata.getBaseURL());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.CREATE_DATE, metadata.getCreateDate());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.CREATOR_TOOL, metadata.getCreatorTool());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.IDENTIFIER, metadata.getIdentifier());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.METADATA_DATE, metadata.getMetadataDate());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.MODIFY_DATE, metadata.getModifyDate());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.NICKNAME, metadata.getNickname());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.RATING, metadata.getRating());
      setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.LABEL, metadata.getLabel());
      return true;
    }
  } catch (Exception e) {
    getLogger().error(e, "Couldn't process stream.");
  }
  return false;
}

代码示例来源:origin: ModeShape/modeshape

private boolean processBasicMetadata( Node sequencedNode,
                   Binary binaryValue ) {
  EpubMetadata metadata = null;
  try (InputStream stream = binaryValue.getStream()) {
    metadata = new EpubMetadata(stream);
    if (metadata.check()) {
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.TITLE, metadata.getTitle());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CREATOR, metadata.getCreator());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CONTRIBUTOR, metadata.getContributor());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.LANGUAGE, metadata.getLanguage());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.IDENTIFIER, metadata.getIdentifier());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DESCRIPTION, metadata.getDescription());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.PUBLISHER, metadata.getPublisher());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DATE, metadata.getDate());
      addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.RIGHTS, metadata.getRights());
      return true;
    }
  } catch (Exception e) {
    getLogger().error(e, "Couldn't process stream.");
  }
  return false;
}

代码示例来源:origin: ModeShape/modeshape

getLogger().error(e, "Couldn't process stream.");

代码示例来源:origin: ModeShape/modeshape

private boolean processBasicMetadata( Node sequencedNode,
                   Binary binaryValue ) {
  OdfMetadata metadata = null;
  try (InputStream stream = binaryValue.getStream()) {
    metadata = new OdfMetadata(stream);
    if (metadata.check()) {
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PAGES, metadata.getPages());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.SHEETS, metadata.getSheets());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.CREATION_DATE, metadata.getCreationDate());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.CREATOR, metadata.getCreator());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.DESCRIPTION, metadata.getDescription());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.EDITING_CYCLES, metadata.getEditingCycles());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.EDITING_TIME, metadata.getEditingTime());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.GENERATOR, metadata.getGenerator());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.INITIAL_CREATOR, metadata.getInitialCreator());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.KEYWORDS, metadata.getKeywords());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.LANGUAGE, metadata.getLanguage());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.MODIFICATION_DATE, metadata.getModificationDate());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PRINTED_BY, metadata.getPrintedBy());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PRINT_DATE, metadata.getPrintDate());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.SUBJECT, metadata.getSubject());
      setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.TITLE, metadata.getTitle());
      return true;
    }
  } catch (Exception e) {
    getLogger().error(e, "Couldn't process stream.");
  }
  return false;
}

相关文章