Package org.slf4j

Examples of org.slf4j.Marker


    DurationUnit du = Util.selectDurationUnitForDisplay(globalStopWatch);
    return buildProfilerString(du, TOP_PROFILER_FIRST_PREFIX, TOTAL_ELAPSED, "");
  }

  public void log() {
    Marker profilerMarker = MarkerFactory.getMarker(PROFILER_MARKER_NAME);
    if (logger == null) {
      throw new NullPointerException(
          "If you invoke the log() method, then you must associate a logger with this profiler.");
    }
    if (logger.isDebugEnabled(profilerMarker)) {
View Full Code Here


        this.onMismatch = onMismatch;
    }

    @Override
    public FilterReply decide(ILoggingEvent loggingEvent) {
        Marker marker = loggingEvent.getMarker();
        if (marker != null) {
            for (Marker candidate : markers) {
                if (marker.contains(candidate)) {
                    return FilterReply.ACCEPT;
                }
            }
        }
        return onMismatch;
View Full Code Here

    @Override
    public Marker getMarker(final String name) {
        if (name == null) {
            throw new IllegalArgumentException("Marker name must not be null");
        }
        Marker marker = markerMap.get(name);
        if (marker != null) {
            return marker;
        }
        marker = new MarkerWrapper(name);
        Marker existing = markerMap.putIfAbsent(name, marker);
        return existing == null ? marker : existing;
    }
View Full Code Here

    public void classWillLoad(PlasticClassEvent event)
    {
        if (logger.isDebugEnabled())
        {
            Marker marker = MarkerFactory.getMarker(event.getPrimaryClassName());

            String extendedClassName = event.getType() == ClassType.PRIMARY ? event.getPrimaryClassName() : String
                    .format("%s (%s for %s)", event.getClassName(), event.getType(), event.getPrimaryClassName());

            logger.debug(marker,
View Full Code Here

    private <T> void logOperationDetails(SessionOperation<T> opsthrows RepositoryException {
        if(operationLogger.isDebugEnabled()){
            String desc = ops.description();
            if(desc != null){
                Marker sessionMarker = MarkerFactory.getMarker(this.toString());
                operationLogger.debug(sessionMarker,desc);
            }
        }
    }
View Full Code Here

    private <T> void logOperationDetails(SessionOperation<T> opsthrows RepositoryException {
        if(operationLogger.isDebugEnabled()){
            String desc = ops.description();
            if(desc != null){
                Marker sessionMarker = MarkerFactory.getMarker(this.toString());
                operationLogger.debug(sessionMarker,desc);
            }
        }
    }
View Full Code Here

    @Override
    public void classWillLoad(PlasticClassEvent event)
    {
        if (logger.isDebugEnabled())
        {
            Marker marker = MarkerFactory.getMarker(event.getPrimaryClassName());

            String extendedClassName = event.getType() == ClassType.PRIMARY ? event.getPrimaryClassName() : String
                    .format("%s (%s for %s)", event.getClassName(), event.getType(), event.getPrimaryClassName());

            logger.debug(marker,
View Full Code Here

    private <T> void logOperationDetails(SessionOperation<T> opsthrows RepositoryException {
        if(operationLogger.isDebugEnabled()){
            String desc = ops.description();
            if(desc != null){
                Marker sessionMarker = MarkerFactory.getMarker(this.toString());
                operationLogger.debug(sessionMarker,String.format("[%s] %s",toString(),desc));
            }
        }
    }
View Full Code Here

public class SourceDescriptionMapper {
  private static final Logger logger = LoggerFactory.getLogger(CommonMapper.class);

  public void toSourceDescription(Source dqSource, GedcomxConversionResult result) throws IOException {
    Marker sourceContext = ConversionContext.getDetachedMarker(String.format("@%s@ SOUR", dqSource.getId()));
    ConversionContext.addReference(sourceContext);
    try {
      SourceDescription gedxSourceDescription = new SourceDescription();
      gedxSourceDescription.setId(dqSource.getId());

      if (dqSource.getAbbreviation() != null) {
        gedxSourceDescription.setTitles(Arrays.asList(new TextValue(dqSource.getAbbreviation())));
      }
      else if (dqSource.getTitle() != null) {
        gedxSourceDescription.setTitles(Arrays.asList(new TextValue(dqSource.getTitle())));
      }

      org.gedcomx.source.SourceCitation citation = new org.gedcomx.source.SourceCitation();
      citation.setCitationTemplate(new ResourceReference(URI.create("gedcom5:citation-template")));
      citation.setFields(new ArrayList<CitationField>());
      citation.setValue("");

      if (dqSource.getAuthor() != null) {
        CitationField field = new CitationField();
        field.setName(URI.create("gedcom5:citation-template/author"));
        field.setValue(dqSource.getAuthor());
        citation.getFields().add(field);
        citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getAuthor() : dqSource.getAuthor()));
      }

      if (dqSource.getTitle() != null) {
        CitationField field = new CitationField();
        field.setName(URI.create("gedcom5:citation-template/title"));
        field.setValue(dqSource.getTitle());
        citation.getFields().add(field);
        citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getTitle() : dqSource.getTitle()));
      }

      if (dqSource.getPublicationFacts() != null) {
        CitationField field = new CitationField();
        field.setName(URI.create("gedcom5:citation-template/publication-facts"));
        field.setValue(dqSource.getPublicationFacts());
        citation.getFields().add(field);
        citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getPublicationFacts() : dqSource.getPublicationFacts()));
      }

      if (dqSource.getText() != null) {
        logger.warn(ConversionContext.getContext(), "GEDCOM X does not currently support text extracted from a source.");
      }

      if (dqSource.getRepositoryRef() != null) {
        Marker repoContext = ConversionContext.getDetachedMarker("REPO");
        ConversionContext.addReference(repoContext);
        try {
          RepositoryRef dqRepositoryRef = dqSource.getRepositoryRef();
          if (dqRepositoryRef.getRef() != null) {
            gedxSourceDescription.setMediator(new ResourceReference(URI.create(CommonMapper.getOrganizationReference(dqRepositoryRef.getRef()))));
            // TODO: map NOTEs as another note associated with this SourceDescription
          }
          else {
            String inlineRepoId = dqSource.getId() + ".REPO";
            Agent gedxOrganization = new Agent();
            gedxOrganization.setId(inlineRepoId);
            for (Note dqNote : dqRepositoryRef.getNotes()) {
              org.gedcomx.common.Note gedxNote = new org.gedcomx.common.Note();
              gedxNote.setText(dqNote.getValue());
              gedxOrganization.addExtensionElement(gedxNote);
            }
            for (NoteRef dqNoteRef : dqRepositoryRef.getNoteRefs()) {
              logger.warn(ConversionContext.getContext(), "Unable to associate a note ({}) with the inline-defined organization ({})", dqNoteRef.getRef(), inlineRepoId);
            }
            result.addOrganization(gedxOrganization);
            gedxSourceDescription.setMediator(new ResourceReference(URI.create(CommonMapper.getOrganizationReference(inlineRepoId))));
          }

          if (dqRepositoryRef.getCallNumber() != null) {
            CitationField field = new CitationField();
            field.setName(URI.create("gedcom5:citation-template/call-number"));
            field.setValue(dqRepositoryRef.getCallNumber());
            citation.getFields().add(field);
            citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqRepositoryRef.getCallNumber() : dqRepositoryRef.getCallNumber()));
          }
        }
        finally {
          ConversionContext.removeReference(repoContext);
        }
      }

      if (dqSource.getCallNumber() != null) {
        CitationField field = new CitationField();
        field.setName(URI.create("gedcom5:citation-template/call-number"));
        field.setValue(dqSource.getCallNumber());
        citation.getFields().add(field);
        citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getCallNumber() : dqSource.getCallNumber()));
      }

      if (citation.getValue().length() > 0) {
        citation.setValue(citation.getValue() + '.');
        gedxSourceDescription.setCitations(Arrays.asList(citation));
      }

      // dqSource.getMediaType();  // nothing equivalent in the GEDCOM X model

      int cntNotes = dqSource.getNotes().size() + dqSource.getNoteRefs().size();
      if (cntNotes > 0) {
        logger.warn(ConversionContext.getContext(), "Did not process {} notes or references to notes.", cntNotes);
      }

      int cntMedia = dqSource.getMedia().size() + dqSource.getMediaRefs().size();
      if (cntMedia > 0) {
        logger.warn(ConversionContext.getContext(), "Did not process {} media items or references to media items.", cntMedia);
      }

      if (dqSource.getType() != null) {
        Marker nameTypeContext = ConversionContext.getDetachedMarker(dqSource.getTypeTag());
        ConversionContext.addReference(nameTypeContext);
        logger.warn(ConversionContext.getContext(), "Source type ({}) was ignored.", dqSource.getType());
        ConversionContext.removeReference(nameTypeContext);
      }

      if (dqSource.getDate() != null) {
        Marker dateContext = ConversionContext.getDetachedMarker("DATE");
        ConversionContext.addReference(dateContext);
        logger.warn(ConversionContext.getContext(), "Specificaton does not define the meaning of DATE in this context; value ({}) was ignored.", dqSource.getDate());
        ConversionContext.removeReference(dateContext);
      }

      if (dqSource.getReferenceNumber() != null) {
        Marker refnContext = ConversionContext.getDetachedMarker("REFN");
        ConversionContext.addReference(refnContext);
        logger.warn(ConversionContext.getContext(), "User reference number ({}) was ignored.", dqSource.getReferenceNumber());
        ConversionContext.removeReference(refnContext);
      }

      if (dqSource.getRin() != null) {
        logger.warn(ConversionContext.getContext(), "RIN ({}) was ignored.", dqSource.getRin());
      }

      if (dqSource.getUid() != null) {
        Marker uidContext = ConversionContext.getDetachedMarker(dqSource.getUidTag());
        ConversionContext.addReference(uidContext);
        logger.warn(ConversionContext.getContext(), "UID ({}) was ignored.", dqSource.getUid());
        ConversionContext.removeReference(uidContext);
      }
View Full Code Here

      ConversionContext.removeReference(sourceContext);
    }
  }

  public void toOrganization(Repository dqRepository, GedcomxConversionResult result) throws IOException {
    Marker repositoryContext = ConversionContext.getDetachedMarker(String.format("@%s@ REPO", dqRepository.getId()));
    ConversionContext.addReference(repositoryContext);
    try {
      Agent gedxOrganization = new Agent();

      CommonMapper.populateAgent(gedxOrganization
View Full Code Here

TOP

Related Classes of org.slf4j.Marker

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.