Examples of JournalEntryContext


Examples of org.fcrepo.server.journal.entry.JournalEntryContext

    /**
     * Read the context tax and populate a JournalEntryContext object.
     */
    public JournalEntryContext readContext(XMLEventReader reader)
            throws JournalException, XMLStreamException {
        JournalEntryContext context = new JournalEntryContext();

        XMLEvent event = reader.nextTag();
        if (!isStartTagEvent(event, QNAME_TAG_CONTEXT)) {
            throw getNotStartTagException(QNAME_TAG_CONTEXT, event);
        }

        context.setPassword(readContextPassword(reader));
        context.setNoOp(readContextNoOp(reader));
        context.setNow(readContextNow(reader));
        context
                .setEnvironmentAttributes(readMultiMap(reader,
                                                       CONTEXT_MAPNAME_ENVIRONMENT));
        context.setSubjectAttributes(readMultiMap(reader,
                                                  CONTEXT_MAPNAME_SUBJECT));
        context
                .setActionAttributes(readMultiMap(reader,
                                                  CONTEXT_MAPNAME_ACTION));
        context.setResourceAttributes(readMultiMap(reader,
                                                   CONTEXT_MAPNAME_RESOURCE));
        context.setRecoveryAttributes(readMultiMap(reader,
                                                   CONTEXT_MAPNAME_RECOVERY));

        event = reader.nextTag();
        if (!isEndTagEvent(event, QNAME_TAG_CONTEXT)) {
            throw getNotEndTagException(QNAME_TAG_CONTEXT, event);
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

        StringBuffer buffer = new StringBuffer();
        buffer.append("Event: method='").append(journalEntry.getMethodName())
                .append("', ").append(journalEntry.getIdentifier())
                .append("\n");
        if (logLevel == LEVEL_HIGH) {
            JournalEntryContext context = journalEntry.getContext();
            buffer.append("    context=").append(context.getClass().getName())
                    .append("\n");
            buffer.append(writeMapValues("environmentAttributes", context
                    .getEnvironmentAttributes()));
            buffer.append(writeMapValues("subjectAttributes", context
                    .getSubjectAttributes()));
            buffer.append(writeMapValues("actionAttributes", context
                    .getActionAttributes()));
            buffer.append(writeMapValues("resourceAttributes", context
                    .getResourceAttributes()));
            buffer.append(writeMapValues("recoveryAttributes", context
                    .getRecoveryAttributes()));
            buffer.append("        password='*********'\n");
            buffer.append("        noOp=").append(context.getNoOp())
                    .append("\n");
        }
        if (logLevel == LEVEL_HIGH || logLevel == LEVEL_MEDIUM) {
            buffer.append("        now=" + journalEntry.getContext().getNoOp()
                    + "\n");
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

            throws JournalException, XMLStreamException {
        StartElement startTag = getJournalEntryStartTag(reader);
        String methodName =
                getRequiredAttributeValue(startTag, QNAME_ATTR_METHOD);

        JournalEntryContext context =
                new ContextXmlReader().readContext(reader);
        ConsumerJournalEntry cje =
                new ConsumerJournalEntry(methodName, context);

        readArguments(reader, cje);
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

                                ENTRY_2, ENTRY_3}));
    }

    private static CreatorJournalEntry createSampleEntry1() {
        try {
            JournalEntryContext context =
                    buildContext("somePassword",
                                 false,
                                 DATE_1,
                                 ENVIRONMENT_1,
                                 SUBJECT_1,
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

    /**
     * Try entry 1 again, with null input stream.
     */
    private static CreatorJournalEntry createSampleEntry1a() {
        try {
            JournalEntryContext context =
                    buildContext("somePassword",
                                 false,
                                 new Date(),
                                 ENVIRONMENT_1,
                                 SUBJECT_1,
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

        }
    }

    private static CreatorJournalEntry createSampleEntry2() {
        try {
            JournalEntryContext context =
                    buildContext("bogusStuff",
                                 false,
                                 new Date(),
                                 ENVIRONMENT_2,
                                 SUBJECT_2,
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

            return null;
        }
    }

    private static CreatorJournalEntry createSampleEntry3() {
        JournalEntryContext context =
                buildContext("mySecretWord",
                             false,
                             new Date(),
                             ENVIRONMENT_3,
                             SUBJECT_3,
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

                                                    String[][] environment,
                                                    String[][] subject,
                                                    String[][] action,
                                                    String[][] resource,
                                                    String[][] recovery) {
        JournalEntryContext context = new JournalEntryContext();
        context.setPassword(password);
        context.setNoOp(noop);
        context.setNow(now);
        context.setEnvironmentAttributes(buildMultiMap(environment));
        context.setSubjectAttributes(buildMultiMap(subject));
        context.setActionAttributes(buildMultiMap(action));
        context.setResourceAttributes(buildMultiMap(resource));
        context.setRecoveryAttributes(buildMultiMap(recovery));
        return context;
    }
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

        xmlWriter = createXmlWriter();
    }

    public void testBasicWriteAndRead() throws Exception {
        JournalEntryContext context1 = new JournalEntryContext();
        context1.setPassword("SuperSecret");
        context1.setNoOp(true);
        context1.setEnvironmentAttributes(createMap("envAttr", "envValue"));
        context1.setSubjectAttributes(createMap(new String[][] {
                {"subAttr1", "subValue1"}, {"subAttr2", "subValue2"}}));
        context1.setActionAttributes(createMap(new String[][] {{
                "ActionAttribute", "ActionValue"}}));
        context1.setRecoveryAttributes(createMap(
                "recoveryAttribute",
                new String[] {"recoveryValue", "recoveryValue2"}));

        ContextXmlWriter contextWriter = new ContextXmlWriter();
        contextWriter.writeContext(context1, xmlWriter);

        String xmlString = xmlStringWriter.toString();
        XMLEventReader xmlReader = createXmlReaderAndPosition(xmlString);

        ContextXmlReader contextReader = new ContextXmlReader();
        JournalEntryContext context2 = contextReader.readContext(xmlReader);

        assertContextsAreEqual(context1, context2);

    }
View Full Code Here

Examples of org.fcrepo.server.journal.entry.JournalEntryContext

        assertContextsAreEqual(context1, context2);

    }

    public void testReadObsoletePasswordCipherType() throws Exception {
        JournalEntryContext context1 = new JournalEntryContext();
        context1.setPassword("ShoopShoop");
        context1.setNoOp(true);

        String xmlString =
                "<context>\n" + "  <password>ShoopShoop</password>\n"
                        + "  <noOp>true</noOp>\n" + "  <now>"
                        + JournalHelper.formatDate(context1.now()) + "</now>\n"
                        + "  <multimap name=\"environment\"></multimap>\n"
                        + "  <multimap name=\"subject\"></multimap>\n"
                        + "  <multimap name=\"action\"></multimap>\n"
                        + "  <multimap name=\"resource\"></multimap>\n"
                        + "  <multimap name=\"recovery\"></multimap>\n"
                        + "</context>\n";

        XMLEventReader xmlReader = createXmlReaderAndPosition(xmlString);

        ContextXmlReader contextReader = new ContextXmlReader();
        JournalEntryContext context2 = contextReader.readContext(xmlReader);

        assertContextsAreEqual(context1, context2);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.