org.modeshape.jcr.api.Logger类的使用及代码示例

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

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

Logger介绍

[英]A generic logger interface.
[中]通用记录器接口。

代码示例

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

private String restValueForReference( Value value,
                   String baseUrl,
                   Session session ) throws RepositoryException {
  String nodeId = value.getString();
  Node referredNode = session.getNodeByIdentifier(nodeId);
  if (referredNode != null) {
    return RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(referredNode.getPath()));
  }
  logger.warn("Cannot resolve reference with id: {0}", nodeId);
  return nodeId;
}

代码示例来源: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.fcrepo/modeshape-jcr

private Name primaryTypeFor( Path resolvedPath ) {
    boolean isFolder = Files.isDirectory(resolvedPath, LinkOption.NOFOLLOW_LINKS);
    boolean isFile = Files.isRegularFile(resolvedPath, LinkOption.NOFOLLOW_LINKS);
    if (!isFile && !isFolder) {
      connector.log().debug("The entry at {0} is neither a file nor a folder", resolvedPath);
      return null;
    }
    return isFolder ? JcrNtLexicon.FOLDER : JcrNtLexicon.FILE;
  }
}

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

/**
 * Cleans up any resources related to {@link AbstractHandler#ACTIVE_SESSION}
 */
public static void cleanupActiveSession() {
  Session session = AbstractHandler.ACTIVE_SESSION.get();
  if (session != null) {
    try {
      AbstractHandler.ACTIVE_SESSION.remove();
      session.logout();
      LOGGER.debug("Logged out REST service session");
    } catch (Exception e) {
      LOGGER.warn(e, "Error while trying to logout REST service session");
    }
  }
}

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

@Override
  public void filter( ContainerRequestContext requestContext ) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Received request: {0}", requestContext.getUriInfo().getRequestUri().toString());
      LOGGER.debug("Executing method: {0}", requestContext.getMethod());
    }
  }
}

代码示例来源: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

logger().debug("Initializing the local index provider '{0}' in repository '{1}' at: {2}", getName(), getRepositoryName(),
        directory);
  logger().debug("Attempting to create directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
          getRepositoryName());
  if (dir.mkdirs()) {
    logger().debug("Created directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
            getRepositoryName());
  } else {
    logger().debug("Unable to create directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
            getRepositoryName());
if (logger().isDebugEnabled()) {
  String action = file.exists() ? "Opening" : "Creating";
  logger().debug("{0} the local index provider database for repository '{1}' at: {2}", action, getRepositoryName(),
          file.getAbsolutePath());
if (this.cacheSize != null) {
  dbMaker.cacheSize(cacheSize);
  logger().debug("MapDB cache size set to {0} for index provider {1}", cacheSize, getName());
  logger().debug("MapDB cacheLRU enabled for index provider {0}", getName());
  logger().debug("MapDB mmapFiles enabled for index provider {0}", getName());
  logger().debug("MapDB commitFileSync enabled for index provider {0}", getName());
  logger().debug("MapDB transactions disabled for index provider {0}", getName());

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

private boolean processUsingAdvancedMetadata( Node imageNode,
                       Binary binaryValue,
                       boolean imageParsedUsingDefaultMetadata ) throws Exception {
  try (InputStream stream = binaryValue.getStream()) {
    Metadata advancedMetadata = ImageMetadataReader.readMetadata(new BufferedInputStream(stream), false);
    ExifIFD0Directory exifIFD0Directory = advancedMetadata.getDirectory(ExifIFD0Directory.class);
    if (exifIFD0Directory == null || !hasTags(exifIFD0Directory, EXIF_TAGS)) {
      if (!imageParsedUsingDefaultMetadata) {
        getLogger().info("Neither default nor advanced metadata parser can resolve image. Ignoring sequencing");
      }
      getLogger().debug("No relevant IFD0 information found, ignoring EXIF node.");
      return imageParsedUsingDefaultMetadata;
    }
    if (!imageParsedUsingDefaultMetadata) {
      //it's a format not supported by the default metadata and since we're reading the IFD0 descriptor, mark the image
      //as a TIFF
      getLogger().info(
          "Image has IFD0 block information but is not one of the standard image types, marking it as TIFF");
      imageNode.setProperty(ImageMetadataLexicon.FORMAT_NAME, TIFF_FORMAT);
      imageNode.setProperty(JcrConstants.JCR_MIME_TYPE, IMAGE_TIFF_DEFAULT_MIME_TYPE);
    }
    addEXIFNode(imageNode, exifIFD0Directory);
    return true;
  } catch (Exception e) {
    getLogger().debug(e, "Cannot process image for advanced metadata");
    return imageParsedUsingDefaultMetadata;
  }
}

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

@Override
  public void filter( ContainerRequestContext requestContext,
            ContainerResponseContext responseContext ) {
    LOGGER.trace("Executing cleanup filter...");
    AbstractHandler.cleanupActiveSession();
  }
}

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

ManagedIndex index,
        IndexDefinition defn ) {
boolean traceEnabled = logger().isTraceEnabled();
if (!defn.isEnabled()) {
  if (traceEnabled) {
    logger().trace("Skipping index '{0}' in '{1}' provider because it is not enabled",
            defn.getName(), getName());
    logger().trace("Skipping index '{0}' in '{1}' provider for query because it doest not match the '{2}' workspace",  
            defn.getName(), getName(), workspaceName);
    logger().trace("Considering index '{0}' in '{1}' provider for query in workspace '{2}'",
            defn.getName(),
            getName(), 
  logger().trace("Skipping index '{0}' in '{1}' provider for query because the index definition node type '{2}' does not match the selected node types '{3}'",
          defn.getName(), getName(), defn.getNodeTypeName(), calculator.selectedNodeTypes());

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

doDelete(path, session);
} catch (NotFoundException e) {
  logger.info("Node at path {0} already deleted", path);

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

@SuppressWarnings( "synthetic-access" )
private void fireEntryModified( ConnectorChangeSet connectorChangeSet,
                Path resolvedPath ) {
  connector.log().debug("Received ENTRY_MODIFY event on '{0}'", resolvedPath);
    connector.log().debug("The entry at {0} is not a regular file; ignoring modify event", resolvedPath);
    return;
    connector.log().warn("Cannot get binary value for '{0}'", resolvedPath);

代码示例来源: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);
  if (!isChanged(oldDefn, defn)) {
    logger().debug("Index provider '{0}' is not updating index in workspace '{1}' because there were no changes: {2}",
            getName(), workspaceName, defn);
    continue;
  } 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: org.fcrepo/modeshape-jcr

logger().debug("Initializing the local index provider '{0}' in repository '{1}' at: {2}", getName(), getRepositoryName(),
        directory);
  logger().debug("Attempting to create directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
          getRepositoryName());
  if (dir.mkdirs()) {
    logger().debug("Created directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
            getRepositoryName());
  } else {
    logger().debug("Unable to create directory for local indexes in repository '{1}' at: {0}", dir.getAbsolutePath(),
            getRepositoryName());
if (logger().isDebugEnabled()) {
  String action = file.exists() ? "Opening" : "Creating";
  logger().debug("{0} the local index provider database for repository '{1}' at: {2}", action, getRepositoryName(),
          file.getAbsolutePath());
if (this.cacheSize != null) {
  dbMaker.cacheSize(cacheSize);
  logger().debug("MapDB cache size set to {0} for index provider {1}", cacheSize, getName());
  logger().debug("MapDB cacheLRU enabled for index provider {0}", getName());
  logger().debug("MapDB mmapFiles enabled for index provider {0}", getName());
  logger().debug("MapDB commitFileSync enabled for index provider {0}", getName());
  logger().debug("MapDB transactions disabled for index provider {0}", getName());

代码示例来源:origin: org.modeshape/modeshape-sequencer-images

private boolean processUsingAdvancedMetadata( Node imageNode,
                       Binary binaryValue,
                       boolean imageParsedUsingDefaultMetadata ) throws Exception {
  try (InputStream stream = binaryValue.getStream()) {
    Metadata advancedMetadata = ImageMetadataReader.readMetadata(new BufferedInputStream(stream), false);
    ExifIFD0Directory exifIFD0Directory = advancedMetadata.getDirectory(ExifIFD0Directory.class);
    if (exifIFD0Directory == null || !hasTags(exifIFD0Directory, EXIF_TAGS)) {
      if (!imageParsedUsingDefaultMetadata) {
        getLogger().info("Neither default nor advanced metadata parser can resolve image. Ignoring sequencing");
      }
      getLogger().debug("No relevant IFD0 information found, ignoring EXIF node.");
      return imageParsedUsingDefaultMetadata;
    }
    if (!imageParsedUsingDefaultMetadata) {
      //it's a format not supported by the default metadata and since we're reading the IFD0 descriptor, mark the image
      //as a TIFF
      getLogger().info(
          "Image has IFD0 block information but is not one of the standard image types, marking it as TIFF");
      imageNode.setProperty(ImageMetadataLexicon.FORMAT_NAME, TIFF_FORMAT);
      imageNode.setProperty(JcrConstants.JCR_MIME_TYPE, IMAGE_TIFF_DEFAULT_MIME_TYPE);
    }
    addEXIFNode(imageNode, exifIFD0Directory);
    return true;
  } catch (Exception e) {
    getLogger().debug(e, "Cannot process image for advanced metadata");
    return imageParsedUsingDefaultMetadata;
  }
}

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

/**
 * Get the queryable index with the given name and applicable for the given workspace.
 *
 * @param indexName the name of the index in this provider; never null
 * @param workspaceName the name of the workspace; never null
 * @return the queryable index, or null if there is no such index
 */
public final Index getIndex( String indexName,
               String workspaceName ) {
  logger().trace("Looking for index '{0}' in '{1}' provider for query in workspace '{2}'", indexName, getName(),
          workspaceName);
  Map<String, AtomicIndex> byWorkspaceNames = providedIndexesByWorkspaceNameByIndexName.get(indexName);
  return byWorkspaceNames == null ? null : byWorkspaceNames.get(workspaceName);
}

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

ManagedIndex index,
        IndexDefinition defn ) {
boolean traceEnabled = logger().isTraceEnabled();
if (!defn.isEnabled()) {
  if (traceEnabled) {
    logger().trace("Skipping index '{0}' in '{1}' provider because it is not enabled",
            defn.getName(), getName());
    logger().trace("Skipping index '{0}' in '{1}' provider for query because it doest not match the '{2}' workspace",  
            defn.getName(), getName(), workspaceName);
    logger().trace("Considering index '{0}' in '{1}' provider for query in workspace '{2}'",
            defn.getName(),
            getName(), 
  logger().trace("Skipping index '{0}' in '{1}' provider for query because the index definition node type '{2}' does not match the selected node types '{3}'",
          defn.getName(), getName(), defn.getNodeTypeName(), calculator.selectedNodeTypes());

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

private String restValueForBinary( String absPropertyPath,
                  String baseUrl ) {
  if (absPropertyPath == null) {
    logger.warn("Cannot generate rest representation of a binary value, because the property is unknown");
    return null;
  }
  return RestHelper.urlFrom(baseUrl, BINARY_METHOD_NAME, encodedPath(absPropertyPath));
}

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

private Name primaryTypeFor( Path resolvedPath ) {
    boolean isFolder = Files.isDirectory(resolvedPath, LinkOption.NOFOLLOW_LINKS);
    boolean isFile = Files.isRegularFile(resolvedPath, LinkOption.NOFOLLOW_LINKS);
    if (!isFile && !isFolder) {
      connector.log().debug("The entry at {0} is neither a file nor a folder", resolvedPath);
      return null;
    }
    return isFolder ? JcrNtLexicon.FOLDER : JcrNtLexicon.FILE;
  }
}

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

@SuppressWarnings( "synthetic-access" )
private void fireEntryModified( ConnectorChangeSet connectorChangeSet,
                Path resolvedPath ) {
  connector.log().debug("Received ENTRY_MODIFY event on '{0}'", resolvedPath);
    connector.log().debug("The entry at {0} is not a regular file; ignoring modify event", resolvedPath);
    return;
    connector.log().warn("Cannot get binary value for '{0}'", resolvedPath);

相关文章