cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r902834 [2/2] - in /cxf/trunk: rt/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/logging/ rt/management-web/ rt/management-web/src/ rt/management-web/src/main/ rt/management-web/src/main/java/ rt/management-web/src/main/java/org/...
Date Mon, 25 Jan 2010 14:51:52 GMT
Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom;
+
+/**
+ * Helps disable logging from calls of the same thread. Motivation: log handlers in this package causes other
+ * threads (from executor) to start logging (by using JAXB that itself uses JUL) which in turn can be caught
+ * by the same handler leading to infinite loop.
+ * <p>
+ * Other approach than using thread local storage would be scanning of stack trace of current thread to see if
+ * root of call comes from same package as package of handler - it's less effective so TLS is using here.
+ */
+final class LoggingThread {
+
+    private static ThreadLocal<LoggingThread> threadLocal = new ThreadLocal<LoggingThread>() {
+        @Override
+        protected LoggingThread initialValue() {
+            return new LoggingThread();
+        }
+    };
+
+    private boolean isSilent;
+
+    private LoggingThread() {
+    }
+
+    public static void markSilent(boolean silent) {
+        LoggingThread lt = threadLocal.get();
+        lt.isSilent = silent;
+    }
+
+    public static boolean isSilent() {
+        return threadLocal.get().isSilent;
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom.converter;
+
+import java.util.List;
+
+import org.apache.abdera.model.Element;
+import org.apache.cxf.management.web.logging.LogRecord;
+
+/**
+ * Converts batch of log records into one or more ATOM Elements to deliver.
+ */
+public interface Converter {
+
+    /**
+     * Converts given collection.
+     * 
+     * @param records not-null collection of records
+     * @return non-empty collection of ATOM Elements that represent log records
+     */
+    List<? extends Element> convert(List<LogRecord> records);
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/Converter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,342 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom.converter;
+
+import java.io.StringWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.Feed;
+import org.apache.commons.lang.Validate;
+import org.apache.cxf.jaxrs.ext.atom.AbstractEntryBuilder;
+import org.apache.cxf.jaxrs.ext.atom.AbstractFeedBuilder;
+import org.apache.cxf.management.web.logging.LogRecord;
+import org.apache.cxf.management.web.logging.LogRecords;
+
+/**
+ * Converter producing ATOM Feeds on standalone Entries with LogRecords or LogRecordsLists embedded as content
+ * or extension. For configuration details see constructor documentation.
+ */
+public final class StandardConverter implements Converter {
+
+    /** Conversion output */
+    public enum Output {
+        FEED,
+        ENTRY
+    }
+
+    /** Quantities of entries in feed or logrecords in entry */
+    public enum Multiplicity {
+        ONE,
+        MANY
+    }
+
+    /** Entity format */
+    public enum Format {
+        CONTENT,
+        EXTENSION
+    }
+
+    private Factory factory;
+    private JAXBContext context;
+    private DateFormat df;
+    private Converter worker;
+    private AbstractFeedBuilder<List<LogRecord>> feedBuilder;
+    private AbstractEntryBuilder<List<LogRecord>> entryBuilder;
+
+    /**
+     * Creates configured converter with default post-processing of feeds/entries mandatory properties.
+     * Regardless of "format", combination of "output" and "multiplicity" flags can be interpreted as follow:
+     * <ul>
+     * <li>ENTRY ONE - for each log record one entry is produced, converter returns list of entries</li>
+     * <li>ENTRY MANY - list of log records is packed in one entry, converter return one entry.</li>
+     * <li>FEED ONE - list of log records is packed in one entry, entry is inserted to feed, converter returns
+     * one feed.</li>
+     * <li>FEED MANY - for each log record one entry is produced, entries are collected in one feed, converter
+     * returns one feed.</li>
+     * </ul>
+     * 
+     * @param output whether root elements if Feed or Entry (e.g. for AtomPub).
+     * @param multiplicity for output==FEED it is multiplicity of entities in feed for output==ENTITY it is
+     *            multiplicity of log records in entity.
+     * @param format log records embedded as entry content or extension.
+     */
+    public StandardConverter(Output output, Multiplicity multiplicity, Format format) {
+        this(output, multiplicity, format, null, null);
+    }
+
+    /**
+     * Creates configured converter with feeds/entries post-processing based on data provided by feed and
+     * entry builders.
+     */
+    public StandardConverter(Output output, Multiplicity multiplicity, Format format,
+                             AbstractFeedBuilder<List<LogRecord>> feedBuilder,
+                             AbstractEntryBuilder<List<LogRecord>> entryBuilder) {
+        Validate.notNull(output, "output is null");
+        Validate.notNull(multiplicity, "multiplicity is null");
+        Validate.notNull(format, "format is null");
+        this.feedBuilder = feedBuilder;
+        this.entryBuilder = entryBuilder;
+        
+        configure(output, multiplicity, format);
+        df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+        factory = Abdera.getNewFactory();
+        try {
+            context = JAXBContext.newInstance(LogRecords.class, LogRecord.class);
+        } catch (JAXBException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public List<? extends Element> convert(List<LogRecord> records) {
+        return worker.convert(records);
+    }
+
+    private void configure(final Output output, final Multiplicity multiplicity, final Format format) {
+        if (output == Output.ENTRY && multiplicity == Multiplicity.ONE) {
+            worker = new Converter() {
+                public List<Entry> convert(List<LogRecord> records) {
+                    return createEntries(format, records);
+                }
+            };
+        }
+        if (output == Output.ENTRY && multiplicity == Multiplicity.MANY) {
+            worker = new Converter() {
+                public List<Entry> convert(List<LogRecord> records) {
+                    // produces one entry with list of all log records
+                    return Arrays.asList(createEntryFromList(format, records));
+                }
+            };
+        }
+        if (output == Output.FEED && multiplicity == Multiplicity.ONE) {
+            worker = new Converter() {
+                public List<Feed> convert(List<LogRecord> records) {
+                    // produces one feed with one entry with list of all log records
+                    return Arrays.asList(createFeedWithSingleEntry(format, records));
+                }
+            };
+        }
+        if (output == Output.FEED && multiplicity == Multiplicity.MANY) {
+            worker = new Converter() {
+                public List<Feed> convert(List<LogRecord> records) {
+                    // produces one feed with many entries, each entry with one log record
+                    return Arrays.asList(createFeed(format, records));
+                }
+            };
+        }
+        if (worker == null) {
+            throw new IllegalArgumentException("Unsupported configuration");
+        }
+    }
+
+    private List<Entry> createEntries(Format format, List<LogRecord> records) {
+        List<Entry> entries = new ArrayList<Entry>();
+        for (LogRecord record : records) {
+            entries.add(createEntryFromRecord(format, record));
+        }
+        return entries;
+    }
+    
+    private Entry createEntryFromList(Format format, List<LogRecord> records) {
+        Entry e = createEntry(records);
+        if (format == Format.CONTENT) {
+            setEntryContent(e, createContent(records));
+        } else {
+            setEntryContent(e, createExtension(records));
+        }
+        return e;
+    }
+    
+    private Entry createEntryFromRecord(Format format, LogRecord record) {
+        Entry e = createEntry(Collections.singletonList(record));
+        if (format == Format.CONTENT) {
+            setEntryContent(e, createContent(record));
+        } else {
+            setEntryContent(e, createExtension(record));
+        }
+        return e;
+    }
+    
+    private String createContent(LogRecord record) {
+        StringWriter writer = new StringWriter();
+        try {
+            context.createMarshaller().marshal(record, writer);
+        } catch (JAXBException e) {
+            throw new RuntimeException(e);
+        }
+        return writer.toString();
+    }
+
+    private String createContent(List<LogRecord> records) {
+        StringWriter writer = new StringWriter();
+        LogRecords list = new LogRecords();
+        list.setLogRecords(records);
+        try {
+            context.createMarshaller().marshal(list, writer);
+        } catch (JAXBException e) {
+            throw new RuntimeException(e);
+        }
+        return writer.toString();
+    }
+
+    private ExtensibleElement createExtension(LogRecord record) {
+        ExtensibleElement erec = factory.newExtensionElement(qn("logRecord"));
+        String date = df.format(record.getEventTimestamp());
+        // timezone in date does not have semicolon as XML Date requires
+        // e.g we have "2009-11-23T22:03:53.996+0100"
+        // instead of "2009-11-23T22:03:53.996+01:00"
+        date = date.substring(0, date.length() - 2) + ":" + date.substring(date.length() - 2);
+        // forget about single line "addExtension().setText()" since
+        // javac failure "org.apache.abdera.model.Element cannot be dereferenced"
+        Element e = erec.addExtension(qn("eventTimestamp"));
+        e.setText(date);
+        e = erec.addExtension(qn("level"));
+        e.setText(record.getLevel().toString());
+        e = erec.addExtension(qn("loggerName"));
+        e.setText(record.getLoggerName());
+        e = erec.addExtension(qn("message"));
+        e.setText(record.getMessage());
+        e = erec.addExtension(qn("threadName"));
+        e.setText(record.getThreadName());
+        e = erec.addExtension(qn("throwable"));
+        e.setText(record.getThrowable());
+        return erec;
+    }
+
+    private QName qn(String name) {
+        return new QName("http://cxf.apache.org/log", name, "log");
+    }
+
+    private ExtensibleElement createExtension(List<LogRecord> records) {
+        ExtensibleElement list = factory.newExtensionElement(qn("logRecords"));
+        for (LogRecord rec : records) {
+            list.addExtension(createExtension(rec));
+        }
+        return list;
+    }
+
+    private Entry createEntry(List<LogRecord> records) {
+        Entry entry = factory.newEntry();
+        setDefaultEntryProperties(entry, records);
+        
+        return entry;
+    }
+    
+    private void setEntryContent(Entry e, String content) {
+        e.setContent(content, Content.Type.XML);
+    }
+
+    private void setEntryContent(Entry e, ExtensibleElement ext) {
+        e.addExtension(ext);
+    }
+
+    private Feed createFeedWithSingleEntry(Format format, List<LogRecord> records) {
+        
+        Feed feed = factory.newFeed();
+        feed.addEntry(createEntryFromList(format, records));
+        setDefaultFeedProperties(feed, records);
+        return feed;
+    }
+    
+    private Feed createFeed(Format format, List<LogRecord> records) {
+        
+        Feed feed = factory.newFeed();
+        List<Entry> entries = createEntries(format, records);
+        for (Entry entry : entries) {
+            feed.addEntry(entry);
+        }
+        setDefaultFeedProperties(feed, records);
+        return feed;
+    }
+
+    protected void setDefaultFeedProperties(Feed feed, List<LogRecord> records) {
+        if (feedBuilder != null) {
+            feed.setId(feedBuilder.getId(records));
+            feed.addAuthor(feedBuilder.getAuthor(records));
+            feed.setTitle(feedBuilder.getTitle(records));
+            feed.setUpdated(feedBuilder.getUpdated(records));
+            feed.setBaseUri(feedBuilder.getBaseUri(records));
+            List<String> categories = feedBuilder.getCategories(records);
+            if (categories != null) {
+                for (String category : categories) {
+                    feed.addCategory(category);
+                }
+            }
+            Map<String, String> links = feedBuilder.getLinks(records);
+            if (links != null) {
+                for (java.util.Map.Entry<String, String> mapEntry : links.entrySet()) {
+                    feed.addLink(mapEntry.getKey(), mapEntry.getValue());
+                }
+            }            
+        } else {
+            feed.setId("uuid:" + UUID.randomUUID().toString());
+            feed.addAuthor("CXF");
+            feed.setTitle(String.format("Feed with %d entry(ies)", feed.getEntries().size()));
+            feed.setUpdated(new Date());
+        }
+    }
+    
+    protected void setDefaultEntryProperties(Entry entry, List<LogRecord> records) {
+        if (entryBuilder != null) {
+            entry.setId(entryBuilder.getId(records));
+            entry.addAuthor(entryBuilder.getAuthor(records));
+            entry.setTitle(entryBuilder.getTitle(records));
+            entry.setUpdated(entryBuilder.getUpdated(records));
+            entry.setBaseUri(entryBuilder.getBaseUri(records));
+            List<String> categories = entryBuilder.getCategories(records);
+            if (categories != null) {
+                for (String category : categories) {
+                    entry.addCategory(category);
+                }
+            }
+            Map<String, String> links = entryBuilder.getLinks(records);
+            if (links != null) {
+                for (java.util.Map.Entry<String, String> mapEntry : links.entrySet()) {
+                    entry.addLink(mapEntry.getKey(), mapEntry.getValue());
+                }
+            }
+            entry.setPublished(entryBuilder.getPublished(records));
+            entry.setSummary(entryBuilder.getSummary(records));
+        } else {    
+            entry.setId("uuid:" + UUID.randomUUID().toString());
+            entry.addAuthor("CXF");
+            entry.setTitle(String.format("Entry with %d log record(s)", 
+                                         records.size()));
+            entry.setUpdated(new Date());
+        }
+    }
+    
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/converter/StandardConverter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom.deliverer;
+
+import org.apache.abdera.model.Element;
+
+/**
+ * ATOM element deliverer. Represents transport strategy e.g. using
+ * {@link org.apache.cxf.jaxrs.client.WebClient}, SOAP reliable messaging etc.
+ */
+public interface Deliverer {
+
+    /**
+     * Delivers ATOM element.
+     * 
+     * @param element element to deliver.
+     * @return true if delivery successful, false otherwise.
+     */
+    boolean deliver(Element element) throws InterruptedException;
+    
+    /**
+     * Returns the address of the remote endpoint this deliverer send elements to
+     * @return
+     */
+    String getEndpointAddress();
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/Deliverer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom.deliverer;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.abdera.model.Element;
+import org.apache.commons.lang.Validate;
+
+/**
+ * Wrapper on other deliverer retrying delivery in case of failure. Delivery attempts repeat in loop with some
+ * pause time between retries until successful delivery or exceeding time limit. Time delay between delivery
+ * is configurable strategy. Two predefined strategies are given: each time pause same amount of time (linear)
+ * and each next time pause time doubles (exponential).
+ */
+public final class RetryingDeliverer implements Deliverer {
+
+    private Deliverer deliverer;
+    private PauseCalculator pauser;
+    private int timeout;
+
+    /**
+     * Creates retrying deliverer with predefined retry strategy.
+     * 
+     * @param worker real deliverer used to push data out.
+     * @param timeout maximum time range (in seconds) that retrial is continued; time spent on delivery call
+     *            is included. No timeout (infinite loop) if set to zero.
+     * @param pause time of pause (in seconds) greater than zero.
+     * @param linear if true linear strategy (each time pause same amount of time), exponential otherwise
+     *            (each next time pause time doubles).
+     */
+    public RetryingDeliverer(Deliverer worker, int timeout, int pause, boolean linear) {
+        Validate.notNull(worker, "worker is null");
+        Validate.isTrue(timeout >= 0, "timeout is negative");
+        Validate.isTrue(pause > 0, "pause is not greater than zero");
+        deliverer = worker;
+        this.timeout = timeout;
+        this.pauser = linear ? new ConstantPause(pause) : new ExponentialPause(pause);
+    }
+
+    /**
+     * Creates retrying deliverer with custom retry strategy.
+     * 
+     * @param worker real deliverer used to push data out.
+     * @param timeout maximum time range (in seconds) that retrial is continued; time spent on delivery call
+     *            is included. No timeout (infinite loop) if set to zero.
+     * @param strategy custom retry pausing strategy.
+     */
+    public RetryingDeliverer(Deliverer worker, int timeout, PauseCalculator strategy) {
+        Validate.notNull(worker, "worker is null");
+        Validate.notNull(strategy, "strategy is null");
+        Validate.isTrue(timeout >= 0, "timeout is negative");
+        deliverer = worker;
+        pauser = strategy;
+        this.timeout = timeout;
+    }
+
+    public boolean deliver(Element element) throws InterruptedException {
+        Calendar cal = Calendar.getInstance();
+        cal.add(Calendar.SECOND, timeout);
+        Date timeoutDate = cal.getTime();
+        while (!deliverer.deliver(element)) {
+            int sleep = pauser.nextPause();
+            cal = Calendar.getInstance();
+            cal.add(Calendar.SECOND, sleep);
+            if (timeout == 0 || timeoutDate.after(cal.getTime())) {
+                Thread.sleep(sleep * 1000);
+            } else {
+                pauser.reset();
+                return false;
+            }
+        }
+        pauser.reset();
+        return true;
+    }
+
+    /** Calculates time of subsequent pauses between delivery attempts. */
+    public interface PauseCalculator {
+
+        /** Time of next pause (in seconds). */
+        int nextPause();
+
+        /** Restarts calculation. */
+        void reset();
+    }
+
+    private static class ConstantPause implements PauseCalculator {
+        private int pause;
+
+        public ConstantPause(int pause) {
+            this.pause = pause;
+        }
+
+        public int nextPause() {
+            return pause;
+        }
+
+        public void reset() {
+        }
+    }
+
+    private static class ExponentialPause implements PauseCalculator {
+        private int pause;
+        private int current;
+
+        public ExponentialPause(int pause) {
+            this.pause = pause;
+            current = pause;
+        }
+
+        public int nextPause() {
+            int c = current;
+            current *= 2;
+            return c;
+        }
+
+        public void reset() {
+            current = pause;
+        }
+    }
+
+    public String getEndpointAddress() {
+        return deliverer.getEndpointAddress();
+    }
+
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/RetryingDeliverer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.management.web.logging.atom.deliverer;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.Feed;
+import org.apache.commons.lang.Validate;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.provider.AtomEntryProvider;
+import org.apache.cxf.jaxrs.provider.AtomFeedProvider;
+
+/**
+ * Marshaling and delivering based on JAXRS' WebClient.
+ */
+public final class WebClientDeliverer implements Deliverer {
+    private WebClient wc;
+
+    @SuppressWarnings("unchecked")
+    public WebClientDeliverer(String deliveryAddress) {
+        Validate.notEmpty(deliveryAddress, "deliveryAddress is empty or null");
+        List<?> providers = Arrays.asList(new AtomFeedProvider(), new AtomEntryProvider());
+        wc = WebClient.create(deliveryAddress, providers);
+    }
+
+    public WebClientDeliverer(WebClient wc) {
+        Validate.notNull(wc, "wc is null");
+        this.wc = wc;
+    }
+
+    public boolean deliver(Element element) {
+        String type = element instanceof Feed ? "application/atom+xml" : "application/atom+xml;type=entry";
+        wc.type(type);
+        Response res = wc.post(element);
+        int status = res.getStatus();
+        return status >= 200 && status <= 299;
+    }
+    
+    public String getEndpointAddress() {
+        return wc.getBaseURI().toString();
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/deliverer/WebClientDeliverer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Support for producing logs in
+ * <a href="http://tools.ietf.org/html/rfc4287">ATOM Syndication Format</a>.
+ * Allows to configure <tt>java.util.logging</tt> (JUL) loggers to use
+ * handlers producing ATOM feeds that are either pushed to or pulled by client.  
+ */
+package org.apache.cxf.management.web.logging.atom;
+

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java?rev=902834&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java Mon Jan 25 14:51:51 2010
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * CXF specific logging support. Based on <tt>java.util.logging</tt> (JUL)
+ * with use of different logging frameworks factored out; assumes that client 
+ * with source code logging to other systems, like Log4J, can bridge 
+ * to this implementation applying <a href="www.slf4j.org">SLF4J</a> 
+ * that JAXRS already depends on.
+ */
+@javax.xml.bind.annotation.XmlSchema(xmlns = {
+        @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://cxf.apache.org/log", prefix = "log")
+            })
+package org.apache.cxf.management.web.logging;
+

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/pom.xml?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/rt/pom.xml (original)
+++ cxf/trunk/rt/pom.xml Mon Jan 25 14:51:51 2010
@@ -54,6 +54,7 @@
         <module>ws/rm</module>
         <module>ws/security</module>
         <module>management</module>
+        <module>management-web</module>
         <module>javascript</module>
     </modules>
 

Modified: cxf/trunk/systests/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/pom.xml?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/pom.xml (original)
+++ cxf/trunk/systests/jaxrs/pom.xml Mon Jan 25 14:51:51 2010
@@ -172,6 +172,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-management-web</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency> 
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-testsupport</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java Mon Jan 25 14:51:51 2010
@@ -36,11 +36,11 @@
 import org.apache.abdera.model.Link;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.cxf.jaxrs.ext.logging.LogLevel;
-import org.apache.cxf.jaxrs.ext.logging.ReadWriteLogStorage;
-import org.apache.cxf.jaxrs.ext.logging.ReadableLogStorage;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
 import org.apache.cxf.jaxrs.provider.AtomFeedProvider;
+import org.apache.cxf.management.web.logging.LogLevel;
+import org.apache.cxf.management.web.logging.ReadWriteLogStorage;
+import org.apache.cxf.management.web.logging.ReadableLogStorage;
 import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
 import org.apache.cxf.transport.http.HTTPConduit;
 
@@ -73,7 +73,7 @@
 
     @Before
     public void before() throws Exception {
-        context = JAXBContext.newInstance(org.apache.cxf.jaxrs.ext.logging.LogRecord.class);
+        context = JAXBContext.newInstance(org.apache.cxf.management.web.logging.LogRecord.class);
         Storage.clearRecords();
     }
 
@@ -114,7 +114,7 @@
         Thread.sleep(3000);
         
         verifyStoragePages("http://localhost:9080/atom3/logs", "next", "Resource3", "theStorageLogger");
-        List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list = Storage.getRecords();
+        List<org.apache.cxf.management.web.logging.LogRecord> list = Storage.getRecords();
         assertEquals(4, list.size());
         verifyStoragePages("http://localhost:9080/atom3/logs", "next", "Resource3", "theStorageLogger");
         verifyStoragePages("http://localhost:9080/atom3/logs?page=2", "previous", "Resource3", 
@@ -238,8 +238,8 @@
     @Ignore
     public static class ExternalStorage implements ReadableLogStorage {
 
-        private List<org.apache.cxf.jaxrs.ext.logging.LogRecord> records = 
-            new LinkedList<org.apache.cxf.jaxrs.ext.logging.LogRecord>();
+        private List<org.apache.cxf.management.web.logging.LogRecord> records = 
+            new LinkedList<org.apache.cxf.management.web.logging.LogRecord>();
         
         public ExternalStorage() {
             addRecord("org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPullSpringTest$Resource4", 
@@ -259,8 +259,8 @@
         }
         
         private void addRecord(String loggerName, Level level, Throwable t) {
-            org.apache.cxf.jaxrs.ext.logging.LogRecord lr = 
-                new org.apache.cxf.jaxrs.ext.logging.LogRecord();
+            org.apache.cxf.management.web.logging.LogRecord lr = 
+                new org.apache.cxf.management.web.logging.LogRecord();
             lr.setLoggerName(loggerName);
             lr.setLevel(LogLevel.fromJUL(level));
             if (t != null) {
@@ -279,8 +279,8 @@
             return -1;
         }
 
-        public void load(List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list, 
-                         SearchCondition<org.apache.cxf.jaxrs.ext.logging.LogRecord> condition, 
+        public void load(List<org.apache.cxf.management.web.logging.LogRecord> list, 
+                         SearchCondition<org.apache.cxf.management.web.logging.LogRecord> condition, 
                          int loadFrom, 
                          int maxNumberOfRecords) {
             int limit = loadFrom + maxNumberOfRecords;
@@ -295,16 +295,16 @@
     
     @Ignore
     public static class Storage implements ReadWriteLogStorage {
-        private static List<org.apache.cxf.jaxrs.ext.logging.LogRecord> records = 
-            new LinkedList<org.apache.cxf.jaxrs.ext.logging.LogRecord>();
+        private static List<org.apache.cxf.management.web.logging.LogRecord> records = 
+            new LinkedList<org.apache.cxf.management.web.logging.LogRecord>();
 
-        public void load(List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list,
-                         SearchCondition<org.apache.cxf.jaxrs.ext.logging.LogRecord> sc,
+        public void load(List<org.apache.cxf.management.web.logging.LogRecord> list,
+                         SearchCondition<org.apache.cxf.management.web.logging.LogRecord> sc,
                          int from, int quantity) {
             list.addAll(records.subList(from, from + quantity));
         }
 
-        public void save(List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list) {
+        public void save(List<org.apache.cxf.management.web.logging.LogRecord> list) {
             records.addAll(list);
         }
         
@@ -318,7 +318,7 @@
             return records.size();
         }
 
-        public static List<org.apache.cxf.jaxrs.ext.logging.LogRecord> getRecords() {
+        public static List<org.apache.cxf.management.web.logging.LogRecord> getRecords() {
             return records;
         }
         
@@ -354,13 +354,13 @@
         
     }
     
-    private org.apache.cxf.jaxrs.ext.logging.LogRecord readLogRecord(String value) throws Exception {
-        return (org.apache.cxf.jaxrs.ext.logging.LogRecord)
+    private org.apache.cxf.management.web.logging.LogRecord readLogRecord(String value) throws Exception {
+        return (org.apache.cxf.management.web.logging.LogRecord)
             context.createUnmarshaller().unmarshal(new StringReader(value));
     }
     
     
-    private void updateCounters(org.apache.cxf.jaxrs.ext.logging.LogRecord record, 
+    private void updateCounters(org.apache.cxf.management.web.logging.LogRecord record, 
                                 String clsName,
                                 String namedLoggerName) {
         String name = record.getLoggerName();

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java Mon Jan 25 14:51:51 2010
@@ -37,7 +37,7 @@
 import org.apache.abdera.model.Feed;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.cxf.jaxrs.ext.logging.LogRecords;
+import org.apache.cxf.management.web.logging.LogRecords;
 import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
 
 import org.junit.Before;
@@ -75,7 +75,7 @@
         Resource4.clear();
         Resource5.clear();
         context = JAXBContext.newInstance(LogRecords.class, 
-            org.apache.cxf.jaxrs.ext.logging.LogRecord.class);
+            org.apache.cxf.management.web.logging.LogRecord.class);
     }
 
     @Test
@@ -92,7 +92,7 @@
             assertEquals(1, entries.size());
             Entry e = entries.get(0);
             LogRecords records = readLogRecords(e.getContent());
-            List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list = records.getLogRecords();
+            List<org.apache.cxf.management.web.logging.LogRecord> list = records.getLogRecords();
             assertNotNull(list);
             assertEquals(1, list.size());
             updateCounters(list.get(0), "Resource");
@@ -153,10 +153,10 @@
         
         for (Entry e : elements) {
             LogRecords records = readLogRecords(e.getContent());
-            List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list = records.getLogRecords();
+            List<org.apache.cxf.management.web.logging.LogRecord> list = records.getLogRecords();
             assertNotNull(list);
             assertEquals(2, list.size());
-            for (org.apache.cxf.jaxrs.ext.logging.LogRecord record : list) {
+            for (org.apache.cxf.management.web.logging.LogRecord record : list) {
                 updateCounters(record, "Resource4");
             }
             
@@ -178,7 +178,7 @@
             assertEquals(1, entries.size());
             Entry e = entries.get(0);
             LogRecords records = readLogRecordsExtension(e);
-            List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list = records.getLogRecords();
+            List<org.apache.cxf.management.web.logging.LogRecord> list = records.getLogRecords();
             assertNotNull(list);
             assertEquals(1, list.size());
             updateCounters(list.get(0), "Resource5");
@@ -373,19 +373,19 @@
         return (LogRecords)context.createUnmarshaller().unmarshal(new StringReader(value));
     }
     
-    private org.apache.cxf.jaxrs.ext.logging.LogRecord readLogRecord(String value) throws Exception {
-        return (org.apache.cxf.jaxrs.ext.logging.LogRecord)
+    private org.apache.cxf.management.web.logging.LogRecord readLogRecord(String value) throws Exception {
+        return (org.apache.cxf.management.web.logging.LogRecord)
             context.createUnmarshaller().unmarshal(new StringReader(value));
     }
     
     private LogRecords readLogRecordsExtension(Entry e) throws Exception {
         ExtensibleElement el = e.getExtension(new QName("http://cxf.apache.org/log", "logRecords", "log"));
         LogRecords records = new LogRecords();
-        List<org.apache.cxf.jaxrs.ext.logging.LogRecord> list = 
-            new ArrayList<org.apache.cxf.jaxrs.ext.logging.LogRecord>();
+        List<org.apache.cxf.management.web.logging.LogRecord> list = 
+            new ArrayList<org.apache.cxf.management.web.logging.LogRecord>();
         for (Element element : el.getElements()) {
-            org.apache.cxf.jaxrs.ext.logging.LogRecord record = 
-                new org.apache.cxf.jaxrs.ext.logging.LogRecord();
+            org.apache.cxf.management.web.logging.LogRecord record = 
+                new org.apache.cxf.management.web.logging.LogRecord();
             Element loggerName = element.getFirstChild(
                                      new QName("http://cxf.apache.org/log", "loggerName", "log"));
             if (loggerName != null) {
@@ -402,7 +402,7 @@
         return records;
     }
     
-    private void updateCounters(org.apache.cxf.jaxrs.ext.logging.LogRecord record, String clsName) {
+    private void updateCounters(org.apache.cxf.management.web.logging.LogRecord record, String clsName) {
         String name = record.getLoggerName();
         if (name != null && name.length() > 0) {
             if (("org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushSpringTest$" + clsName).equals(name)) {

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java Mon Jan 25 14:51:51 2010
@@ -39,53 +39,29 @@
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.ext.atom.AbstractEntryBuilder;
 import org.apache.cxf.jaxrs.ext.atom.AbstractFeedBuilder;
-import org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler;
-import org.apache.cxf.jaxrs.ext.logging.atom.converter.Converter;
-import org.apache.cxf.jaxrs.ext.logging.atom.converter.StandardConverter;
-import org.apache.cxf.jaxrs.ext.logging.atom.converter.StandardConverter.Format;
-import org.apache.cxf.jaxrs.ext.logging.atom.converter.StandardConverter.Multiplicity;
-import org.apache.cxf.jaxrs.ext.logging.atom.converter.StandardConverter.Output;
-import org.apache.cxf.jaxrs.ext.logging.atom.deliverer.Deliverer;
-import org.apache.cxf.jaxrs.ext.logging.atom.deliverer.WebClientDeliverer;
 import org.apache.cxf.jaxrs.provider.AtomEntryProvider;
 import org.apache.cxf.jaxrs.provider.AtomFeedProvider;
+import org.apache.cxf.management.web.logging.atom.AtomPushHandler;
+import org.apache.cxf.management.web.logging.atom.converter.Converter;
+import org.apache.cxf.management.web.logging.atom.converter.StandardConverter;
+import org.apache.cxf.management.web.logging.atom.converter.StandardConverter.Format;
+import org.apache.cxf.management.web.logging.atom.converter.StandardConverter.Multiplicity;
+import org.apache.cxf.management.web.logging.atom.converter.StandardConverter.Output;
+import org.apache.cxf.management.web.logging.atom.deliverer.Deliverer;
+import org.apache.cxf.management.web.logging.atom.deliverer.WebClientDeliverer;
 
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-
-public class JAXRSLoggingAtomPushTest {
+public class JAXRSLoggingAtomPushTest extends Assert {
     private static final Logger LOG = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class);
     private static Server server;
     
-    @Ignore
-    @Path("/")
-    public static class Resource {
-        
-        private static Queue<Feed> feeds = new ConcurrentLinkedQueue<Feed>();
-        private static Queue<Entry> entries = new ConcurrentLinkedQueue<Entry>();
-        
-        @POST
-        public void consume(Feed feed) {
-            feeds.add(feed);
-        }
-
-        @POST
-        @Path("/atomPub")
-        public void consume(Entry entry) {
-            entries.add(entry);
-        }
-        
-        public static void clear() {
-            feeds.clear();
-            entries.clear();
-        }
-    }
-
+    
     @SuppressWarnings("unchecked")
     @BeforeClass
     public static void beforeClass() throws Exception {
@@ -181,20 +157,10 @@
     public void testPrivateLoggerCustomBuilders() throws Exception {
         configureLogging("resources/logging_atompush_disabled.properties");
         Logger log = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class, null, "private-log");
-        AbstractFeedBuilder<List<org.apache.cxf.jaxrs.ext.logging.LogRecord>> fb = 
-            new AbstractFeedBuilder<List<org.apache.cxf.jaxrs.ext.logging.LogRecord>>() {
-                @Override
-                public String getAuthor(List<org.apache.cxf.jaxrs.ext.logging.LogRecord> pojo) {
-                    return "custom author";
-                }
-            };
-        AbstractEntryBuilder<List<org.apache.cxf.jaxrs.ext.logging.LogRecord>> eb = 
-            new AbstractEntryBuilder<List<org.apache.cxf.jaxrs.ext.logging.LogRecord>>() {
-                @Override
-                public String getSummary(List<org.apache.cxf.jaxrs.ext.logging.LogRecord> pojo) {
-                    return "custom summary";
-                }
-            };
+        AbstractFeedBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> fb = 
+            createCustomFeedBuilder();
+        AbstractEntryBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> eb =
+            createCustomEntryBuilder(); 
         Converter c = new StandardConverter(Output.FEED, Multiplicity.ONE, Format.CONTENT, fb, eb);
         Deliverer d = new WebClientDeliverer("http://localhost:9080");
         Handler h = new AtomPushHandler(2, c, d);
@@ -207,6 +173,34 @@
         assertEquals("Different logged events count;", 3, Resource.feeds.size());
     }
 
+
+    @Ignore
+    private AbstractFeedBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> 
+    createCustomFeedBuilder() {
+
+        AbstractFeedBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> fb = 
+            new AbstractFeedBuilder<List<org.apache.cxf.management.web.logging.LogRecord>>() {
+                @Override
+                public String getAuthor(List<org.apache.cxf.management.web.logging.LogRecord> pojo) {
+                    return "custom author";
+                }
+            };
+        return fb; 
+    }  
+
+    @Ignore
+    private AbstractEntryBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> 
+    createCustomEntryBuilder() {
+        AbstractEntryBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> eb = 
+            new AbstractEntryBuilder<List<org.apache.cxf.management.web.logging.LogRecord>>() {
+                @Override
+                public String getSummary(List<org.apache.cxf.management.web.logging.LogRecord> pojo) {
+                    return "custom summary";
+                }
+            };
+        return eb;
+    }
+
     @Test
     public void testAtomPubEntries() throws Exception {
         configureLogging("resources/logging_atompush_atompub.properties");
@@ -217,4 +211,28 @@
         assertEquals("Different logged events count;", 6, Resource.entries.size());
     }
 
+    @Ignore
+    @Path("/")
+    public static class Resource {
+        
+        private static Queue<Feed> feeds = new ConcurrentLinkedQueue<Feed>();
+        private static Queue<Entry> entries = new ConcurrentLinkedQueue<Entry>();
+        
+        @POST
+        public void consume(Feed feed) {
+            feeds.add(feed);
+        }
+
+        @POST
+        @Path("/atomPub")
+        public void consume(Entry entry) {
+            entries.add(entry);
+        }
+        
+        public static void clear() {
+            feeds.clear();
+            entries.clear();
+        }
+    }
+
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties Mon Jan 25 14:51:51 2010
@@ -1,5 +1,5 @@
 # Atom logger plus echo on console
-handlers = org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
+handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
 
 # Set the default logging level for the root logger
 .level = ALL
@@ -23,8 +23,8 @@
 org.apache.axiom.level = OFF
 
 # Atom handler specific settings
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.url = http://localhost:9080
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.batchSize = 1
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.output = feed
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.entries = one
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.format = content
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.batchSize = 1
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.output = feed
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.entries = one
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.format = content

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties Mon Jan 25 14:51:51 2010
@@ -1,5 +1,5 @@
 # Atom logger plus echo on console
-handlers = org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
+handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
 
 # Set the default logging level for the root logger
 .level = ALL
@@ -23,9 +23,9 @@
 org.apache.axiom.level = OFF
 
 # Atom handler specific settings
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.url = http://localhost:9080/atomPub
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.batchSize = 1
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.output = entry
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.multiplicity = one
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.format = extension
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080/atomPub
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.batchSize = 1
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.output = entry
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.multiplicity = one
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.format = extension
 

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties Mon Jan 25 14:51:51 2010
@@ -1,5 +1,5 @@
 # Atom logger plus echo on console
-handlers = org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
+handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
 
 # Set the default logging level for the root logger
 .level = ALL
@@ -23,5 +23,5 @@
 org.apache.axiom.level = OFF
 
 # Atom handler specific settings
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.url = http://localhost:9080
-org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.batchSize = 3
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080
+org.apache.cxf.management.web.logging.atom.AtomPushHandler.batchSize = 3

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompull/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompull/WEB-INF/beans.xml?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompull/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompull/WEB-INF/beans.xml Mon Jan 25 14:51:51 2010
@@ -38,7 +38,7 @@
 	<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 
-	<bean id = "atomPullServer" class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPullServer" 
+	<bean id = "atomPullServer" class="org.apache.cxf.management.web.logging.atom.AtomPullServer" 
 	      init-method="init">
 	      <property name="loggers"
 			value="
@@ -46,7 +46,7 @@
 			namedLogger:WARN" />
 	</bean>
 	
-	<bean id = "atomPullServer2" class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPullServer" 
+	<bean id = "atomPullServer2" class="org.apache.cxf.management.web.logging.atom.AtomPullServer" 
 	      init-method="init">
 	      <property name="loggers"
 			value="
@@ -56,7 +56,7 @@
 		  	
 	</bean>
 	
-	<bean id = "atomPullServer3" class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPullServer" 
+	<bean id = "atomPullServer3" class="org.apache.cxf.management.web.logging.atom.AtomPullServer" 
 	      init-method="init">
 	      <property name="loggers"
 			value="
@@ -69,7 +69,7 @@
 		</property>	
 	</bean>
 	
-	<bean id = "atomPullServer4" class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPullServer" 
+	<bean id = "atomPullServer4" class="org.apache.cxf.management.web.logging.atom.AtomPullServer" 
 	      init-method="init">
 	      <property name="loggers"
 			value="

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml?rev=902834&r1=902833&r2=902834&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml Mon Jan 25 14:51:51 2010
@@ -38,7 +38,7 @@
 	<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 
-	<bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+	<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="multiplicity" value="one"/>
 		<property name="loggers"
@@ -50,7 +50,7 @@
 		</property>	
 	</bean>
 
-    <bean id="webDeliverer" class="org.apache.cxf.jaxrs.ext.logging.atom.deliverer.WebClientDeliverer">
+    <bean id="webDeliverer" class="org.apache.cxf.management.web.logging.atom.deliverer.WebClientDeliverer">
         <constructor-arg ref="webClient"/>
     </bean>
 
@@ -60,7 +60,7 @@
         <constructor-arg ref="feedProvider" />
     </bean> 
 
-    <bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+    <bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="batchSize" value="4"/>
 		<property name="loggers"
@@ -70,7 +70,7 @@
 		<property name="url" value="http://localhost:9080/batch/feeds"/>	
 	</bean>
 
-    <bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+    <bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="output" value="entry"/>
 		<property name="loggers"
@@ -82,7 +82,7 @@
 		</property>	
 	</bean>
 
-    <bean id="webDeliverer3" class="org.apache.cxf.jaxrs.ext.logging.atom.deliverer.WebClientDeliverer">
+    <bean id="webDeliverer3" class="org.apache.cxf.management.web.logging.atom.deliverer.WebClientDeliverer">
         <constructor-arg ref="webClient3"/>
     </bean>
 
@@ -92,7 +92,7 @@
         <constructor-arg ref="entryProvider" />
     </bean> 
 
-    <bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+    <bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="output" value="entry"/>
 		<property name="multiplicity" value="many"/>
@@ -104,7 +104,7 @@
 		<property name="url" value="http://localhost:9080/entriesMany/entries"/>
 	</bean>
 
-    <bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+    <bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="multiplicity" value="one"/>
 		<property name="format" value="extension"/>
@@ -147,7 +147,7 @@
 	<!--  
 	Other config samples:
 	
-	<bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+	<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 
 		<property name="url" value="http://localhost:9080/feed" />
@@ -155,7 +155,7 @@
 	</bean>
 
 	<bean id="soapDeliverer" ... />
-	<bean class="org.apache.cxf.jaxrs.ext.logging.atom.AtomPushBean"
+	<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
 		init-method="init">
 		<property name="deliverer">
 			<ref bean="soapDeliverer" />



Mime
View raw message