Exemplo n.º 1
0
 private void writeDateArgument(String key, Date date, XMLEventWriter writer)
     throws XMLStreamException {
   putStartTag(writer, QNAME_TAG_ARGUMENT);
   putAttribute(writer, QNAME_ATTR_NAME, key);
   putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_DATE);
   putCharacters(writer, JournalHelper.formatDate(date));
   putEndTag(writer, QNAME_TAG_ARGUMENT);
 }
Exemplo n.º 2
0
 /**
  * Create an instance of the proper JournalWriter child class, as determined by the server
  * parameters.
  */
 public static JournalWriter getInstance(
     Map<String, String> parameters, String role, ServerInterface server) throws JournalException {
   Object journalWriter =
       JournalHelper.createInstanceAccordingToParameter(
           PARAMETER_JOURNAL_WRITER_CLASSNAME,
           new Class[] {Map.class, String.class, ServerInterface.class},
           new Object[] {parameters, role, server},
           parameters);
   logger.info("JournalWriter is " + journalWriter.toString());
   return (JournalWriter) journalWriter;
 }
Exemplo n.º 3
0
 /**
  * Subclasses should call this method to initialize a new Journal file, if they already know the
  * repository hash and the current date.
  */
 protected void writeDocumentHeader(XMLEventWriter writer, String repositoryHash, Date currentDate)
     throws JournalException {
   try {
     putStartDocument(writer);
     putStartTag(writer, QNAME_TAG_JOURNAL);
     putAttribute(writer, QNAME_ATTR_REPOSITORY_HASH, repositoryHash);
     putAttribute(writer, QNAME_ATTR_TIMESTAMP, JournalHelper.formatDate(currentDate));
   } catch (XMLStreamException e) {
     throw new JournalException(e);
   }
 }
Exemplo n.º 4
0
  private void writeJournaEntryStartTag(CreatorJournalEntry journalEntry, XMLEventWriter writer)
      throws XMLStreamException {
    putStartTag(writer, QNAME_TAG_JOURNAL_ENTRY);
    putAttribute(writer, QNAME_ATTR_METHOD, journalEntry.getMethodName());
    putAttribute(
        writer, QNAME_ATTR_TIMESTAMP, JournalHelper.formatDate(journalEntry.getContext().now()));

    String[] clientIpArray =
        journalEntry
            .getContext()
            .getEnvironmentValues(Constants.HTTP_REQUEST.CLIENT_IP_ADDRESS.attributeId);
    if (clientIpArray != null && clientIpArray.length > 0) {
      putAttribute(writer, QNAME_ATTR_CLIENT_IP, clientIpArray[0]);
    }

    String[] loginIdArray =
        journalEntry.getContext().getSubjectValues(Constants.SUBJECT.LOGIN_ID.uri);
    if (loginIdArray != null && loginIdArray.length > 0) {
      putAttribute(writer, QNAME_ATTR_LOGIN_ID, loginIdArray[0]);
    }
  }
Exemplo n.º 5
0
 private void writeContextNow(Context context, XMLEventWriter writer) throws XMLStreamException {
   putStartTag(writer, QNAME_TAG_NOW);
   putCharacters(writer, JournalHelper.formatDate(context.now()));
   putEndTag(writer, QNAME_TAG_NOW);
 }
Exemplo n.º 6
0
 private String encipherPassword(Context context, String password) {
   String key = JournalHelper.formatDate(context.now());
   return PasswordCipher.encipher(key, password);
 }