You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by an...@apache.org on 2013/10/01 14:33:11 UTC
svn commit: r1528066 [2/2] - in /ace/trunk:
org.apache.ace.agent.update.itest/ org.apache.ace.agent/
org.apache.ace.agent/src/org/apache/ace/agent/impl/
org.apache.ace.agent/test/org/apache/ace/agent/impl/
org.apache.ace.authentication.itest/ org.apach...
Modified: ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java (original)
+++ ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java Tue Oct 1 12:33:09 2013
@@ -25,9 +25,9 @@ import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.amdatu.mongo.MongoDBService;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.it.IntegrationTestBase;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
import org.apache.ace.log.server.store.LogStore;
import org.apache.felix.dm.Component;
import org.osgi.service.log.LogService;
@@ -76,7 +76,7 @@ public class MongoLogStoreTest extends I
storeEvents();
- List<LogEvent> events = m_logStore.get(new LogDescriptor("mytarget1,1,0"));
+ List<Event> events = m_logStore.get(new Descriptor("mytarget1,1,0"));
assertEquals(3, events.size());
} catch (MongoException ex) {
System.err.println("Mongodb not available on localhost, skipping test");
@@ -91,7 +91,7 @@ public class MongoLogStoreTest extends I
storeEvents();
- List<LogEvent> events = m_logStore.get(new LogDescriptor("mytarget1,1,2"));
+ List<Event> events = m_logStore.get(new Descriptor("mytarget1,1,2"));
assertEquals(2, events.size());
} catch (Exception ex) {
System.err.println("Mongodb not available on localhost, skipping test");
@@ -106,13 +106,13 @@ public class MongoLogStoreTest extends I
storeEvents();
- List<LogDescriptor> descriptors = m_logStore.getDescriptors();
+ List<Descriptor> descriptors = m_logStore.getDescriptors();
assertEquals(2, descriptors.size());
assertEquals("mytarget1", descriptors.get(0).getTargetID());
- assertEquals(1, descriptors.get(0).getLogID());
+ assertEquals(1, descriptors.get(0).getStoreID());
assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
assertEquals("mytarget2", descriptors.get(1).getTargetID());
- assertEquals(1, descriptors.get(1).getLogID());
+ assertEquals(1, descriptors.get(1).getStoreID());
assertEquals(5, descriptors.get(1).getRangeSet().getHigh());
} catch (MongoException ex) {
System.err.println("Mongodb not available on localhost, skipping test");
@@ -131,23 +131,23 @@ public class MongoLogStoreTest extends I
Properties props = new Properties();
props.setProperty("myProperty", "myvalue");
- LogEvent event1 = new LogEvent("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event2 = new LogEvent("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event1 = new Event("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event2 = new Event("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
m_logStore.put(Arrays.asList(event1, event2));
- List<LogDescriptor> descriptors = m_logStore.getDescriptors();
+ List<Descriptor> descriptors = m_logStore.getDescriptors();
assertEquals(3, descriptors.size());
assertEquals("mytarget1", descriptors.get(0).getTargetID());
- assertEquals(1, descriptors.get(0).getLogID());
+ assertEquals(1, descriptors.get(0).getStoreID());
assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
assertEquals("mytarget1", descriptors.get(1).getTargetID());
- assertEquals(2, descriptors.get(1).getLogID());
+ assertEquals(2, descriptors.get(1).getStoreID());
assertEquals(2, descriptors.get(1).getRangeSet().getHigh());
assertEquals("mytarget2", descriptors.get(2).getTargetID());
- assertEquals(1, descriptors.get(2).getLogID());
+ assertEquals(1, descriptors.get(2).getStoreID());
assertEquals(5, descriptors.get(2).getRangeSet().getHigh());
} catch (MongoException ex) {
System.err.println("Mongodb not available on localhost, skipping test");
@@ -165,19 +165,19 @@ public class MongoLogStoreTest extends I
Properties props = new Properties();
props.setProperty("myProperty", "myvalue");
- LogEvent event1 = new LogEvent("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event2 = new LogEvent("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event1 = new Event("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event2 = new Event("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
m_logStore.put(Arrays.asList(event1, event2));
- List<LogDescriptor> descriptors = m_logStore.getDescriptors("mytarget1");
+ List<Descriptor> descriptors = m_logStore.getDescriptors("mytarget1");
assertEquals(2, descriptors.size());
assertEquals("mytarget1", descriptors.get(0).getTargetID());
- assertEquals(1, descriptors.get(0).getLogID());
+ assertEquals(1, descriptors.get(0).getStoreID());
assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
assertEquals("mytarget1", descriptors.get(1).getTargetID());
- assertEquals(2, descriptors.get(1).getLogID());
+ assertEquals(2, descriptors.get(1).getStoreID());
assertEquals(2, descriptors.get(1).getRangeSet().getHigh());
} catch (MongoException ex) {
System.err.println("Mongodb not available on localhost, skipping test");
@@ -187,11 +187,11 @@ public class MongoLogStoreTest extends I
private void storeEvents() throws IOException {
Properties props = new Properties();
props.setProperty("myProperty", "myvalue");
- LogEvent event1 = new LogEvent("mytarget1", 1, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event2 = new LogEvent("mytarget1", 1, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event3 = new LogEvent("mytarget2", 1, 3, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event4 = new LogEvent("mytarget2", 1, 5, System.currentTimeMillis(), LogService.LOG_ERROR, props);
- LogEvent event5 = new LogEvent("mytarget1", 1, 4, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event1 = new Event("mytarget1", 1, 1, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event2 = new Event("mytarget1", 1, 2, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event3 = new Event("mytarget2", 1, 3, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event4 = new Event("mytarget2", 1, 5, System.currentTimeMillis(), LogService.LOG_ERROR, props);
+ Event event5 = new Event("mytarget1", 1, 4, System.currentTimeMillis(), LogService.LOG_ERROR, props);
m_logStore.put(Arrays.asList(event1, event2, event3, event4, event5));
}
Modified: ace/trunk/org.apache.ace.log.server.ui/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.ui/bnd.bnd?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.ui/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log.server.ui/bnd.bnd Tue Oct 1 12:33:09 2013
@@ -1,11 +1,11 @@
-buildpath: osgi.core,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- org.apache.ace.log.api;version=latest,\
org.apache.ace.client.repository.api;version=latest,\
org.apache.ace.log.server.store.api;version=latest,\
com.vaadin;version=latest,\
- org.apache.ace.webui.vaadin;version=latest
+ org.apache.ace.webui.vaadin;version=latest,\
+ org.apache.ace.feedback.common;version=latest
Private-Package: org.apache.ace.log.server.ui
Bundle-Activator: org.apache.ace.log.server.ui.Activator
Bundle-Version: 1.0.0
Modified: ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java (original)
+++ ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java Tue Oct 1 12:33:09 2013
@@ -33,9 +33,9 @@ import java.util.Map;
import org.apache.ace.client.repository.RepositoryObject;
import org.apache.ace.client.repository.object.TargetObject;
import org.apache.ace.client.repository.stateful.StatefulTargetObject;
-import org.apache.ace.log.AuditEvent;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.AuditEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.webui.NamedObject;
import org.apache.ace.webui.UIExtensionFactory;
@@ -148,7 +148,7 @@ public class LogViewerExtension implemen
* the event to get the type for, cannot be <code>null</code>.
* @return a string representation of the event's type, never <code>null</code>.
*/
- final String getEventType(LogEvent event) {
+ final String getEventType(Event event) {
if (m_eventTypeMapping.isEmpty()) {
// Lazily create a mapping of value -> name of all event-types...
for (Field f : AuditEvent.class.getFields()) {
@@ -181,7 +181,7 @@ public class LogViewerExtension implemen
* the event to create a textarea for, cannot be <code>null</code>.
* @return a {@link TextArea} instance, never <code>null</code>.
*/
- final TextArea getProperties(LogEvent event) {
+ final TextArea getProperties(Event event) {
Dictionary props = event.getProperties();
TextArea area = new TextArea("", dumpProperties(props));
@@ -193,7 +193,7 @@ public class LogViewerExtension implemen
return area;
}
- final Date getTime(LogEvent event) {
+ final Date getTime(Event event) {
return new Date(event.getTime());
}
@@ -233,10 +233,10 @@ public class LogViewerExtension implemen
*/
private void fillTable(RepositoryObject object, Table table) throws IOException {
String id = object.getAttribute(TargetObject.KEY_ID);
- List<LogDescriptor> desc = m_store.getDescriptors(id);
+ List<Descriptor> desc = m_store.getDescriptors(id);
if (desc != null) {
- for (LogDescriptor log : desc) {
- for (LogEvent event : m_store.get(log)) {
+ for (Descriptor log : desc) {
+ for (Event event : m_store.get(log)) {
table.addItem(new Object[] { getTime(event), getEventType(event), getProperties(event) }, null);
}
}
Modified: ace/trunk/org.apache.ace.log/api.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/api.bnd?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/api.bnd (original)
+++ ace/trunk/org.apache.ace.log/api.bnd Tue Oct 1 12:33:09 2013
@@ -1,4 +1,3 @@
-Private-Package: org.apache.ace.log.util
Export-Package: org.apache.ace.log
Bundle-Version: 1.0.0
Bundle-Name: Apache ACE Log API
Modified: ace/trunk/org.apache.ace.log/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/bnd.bnd?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log/bnd.bnd Tue Oct 1 12:33:09 2013
@@ -10,6 +10,7 @@
org.apache.ace.connectionfactory;version=latest,\
org.apache.ace.authentication.api;version=latest,\
org.amdatu.mongo,\
- com.mongodb
+ com.mongodb,\
+ org.apache.ace.feedback.common;version=latest
-sub: *.bnd
\ No newline at end of file
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/listener/ListenerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/listener/ListenerImpl.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/listener/ListenerImpl.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/listener/ListenerImpl.java Tue Oct 1 12:33:09 2013
@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Properties;
-import org.apache.ace.log.AuditEvent;
+import org.apache.ace.feedback.AuditEvent;
import org.apache.ace.log.Log;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java Tue Oct 1 12:33:09 2013
@@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import org.apache.ace.authentication.api.AuthenticationService;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.SortedRangeSet;
import org.osgi.service.log.LogService;
@@ -51,7 +51,7 @@ import org.osgi.service.useradmin.User;
* http://host:port/auditlog/query?tid=myid&logid=123712636323 - Return the event range belonging to the specified target and log id
*
* Accepting new audit log events:
- * http://host:port/auditlog/send - Gets a new log event and puts it in the store, the event is inside the request and should be a formatted as done in <code>LogEvent.toRepresentation()</code>.
+ * http://host:port/auditlog/send - Gets a new log event and puts it in the store, the event is inside the request and should be a formatted as done in <code>Event.toRepresentation()</code>.
*
* Querying existing audit log events:
* http://host:port/auditlog/receive - Return all known events
@@ -179,14 +179,14 @@ public class LogServlet extends HttpServ
protected boolean handleQuery(String targetID, String logID, String filter, ServletOutputStream output) throws IOException {
if ((targetID != null) && (logID != null)) {
// target and log id are specified, return only the range that matches these id's
- LogDescriptor range = m_store.getDescriptor(targetID, Long.parseLong(logID));
+ Descriptor range = m_store.getDescriptor(targetID, Long.parseLong(logID));
output.print(range.toRepresentation());
return true;
}
else if ((targetID == null) && (logID == null)) {
// no target or log id has been specified, return all ranges
- List<LogDescriptor> ranges = m_store.getDescriptors();
- for (LogDescriptor range : ranges) {
+ List<Descriptor> ranges = m_store.getDescriptors();
+ for (Descriptor range : ranges) {
output.print(range.toRepresentation() + "\n");
}
return true;
@@ -199,8 +199,8 @@ public class LogServlet extends HttpServ
if ((targetID != null) && (logID != null)) {
// target and log id are specified, return only the events that are in the range that matches these id's
if (range != null) {
- LogDescriptor storeDescriptor = m_store.getDescriptor(targetID, Long.parseLong(logID));
- outputRange(output, new LogDescriptor(storeDescriptor.getTargetID(), storeDescriptor.getLogID(), new SortedRangeSet(range)));
+ Descriptor storeDescriptor = m_store.getDescriptor(targetID, Long.parseLong(logID));
+ outputRange(output, new Descriptor(storeDescriptor.getTargetID(), storeDescriptor.getStoreID(), new SortedRangeSet(range)));
}
else {
outputRange(output, m_store.getDescriptor(targetID, Long.parseLong(logID)));
@@ -209,16 +209,16 @@ public class LogServlet extends HttpServ
}
else if ((targetID != null) && (logID == null)) {
// target id is specified, log id is not, return all events that belong to the specified target id
- List<LogDescriptor> descriptors = m_store.getDescriptors(targetID);
- for (LogDescriptor descriptor : descriptors) {
+ List<Descriptor> descriptors = m_store.getDescriptors(targetID);
+ for (Descriptor descriptor : descriptors) {
outputRange(output, descriptor);
}
return true;
}
else if ((targetID == null) && (logID == null)) {
// no target or log id has been specified, return all events
- List<LogDescriptor> descriptors = m_store.getDescriptors();
- for (LogDescriptor descriptor : descriptors) {
+ List<Descriptor> descriptors = m_store.getDescriptors();
+ for (Descriptor descriptor : descriptors) {
outputRange(output, descriptor);
}
return true;
@@ -228,7 +228,7 @@ public class LogServlet extends HttpServ
// Handle a call to the send 'command'
protected boolean handleSend(ServletInputStream input) throws IOException {
- List<LogEvent> events = new ArrayList<LogEvent>();
+ List<Event> events = new ArrayList<Event>();
boolean success = true;
BufferedReader reader = null;
@@ -239,12 +239,12 @@ public class LogServlet extends HttpServ
while ((eventString = reader.readLine()) != null) {
try {
m_log.log(LogService.LOG_DEBUG, "Log event received: '" + eventString +"'");
- LogEvent event = new LogEvent(eventString);
+ Event event = new Event(eventString);
events.add(event);
}
catch (IllegalArgumentException iae) {
success = false;
- m_log.log(LogService.LOG_WARNING, "Could not construct LogEvent from string: '" + eventString + "'");
+ m_log.log(LogService.LOG_WARNING, "Could not construct Event from string: '" + eventString + "'");
}
}
}
@@ -263,9 +263,9 @@ public class LogServlet extends HttpServ
}
// print string representations of all events in the specified range to the specified output
- private void outputRange(ServletOutputStream output, LogDescriptor range) throws IOException {
- List<LogEvent> events = m_store.get(range);
- for (LogEvent event : events) {
+ private void outputRange(ServletOutputStream output, Descriptor range) throws IOException {
+ List<Event> events = m_store.get(range);
+ for (Event event : events) {
output.print(event.toRepresentation() + "\n");
}
}
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/LogStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/LogStore.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/LogStore.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/LogStore.java Tue Oct 1 12:33:09 2013
@@ -21,30 +21,30 @@ package org.apache.ace.log.server.store;
import java.io.IOException;
import java.util.List;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
/**
- * Log store interface. Implementation of this service interface provide a persisted storage for LogEvent logs.
+ * Log store interface. Implementation of this service interface provide a persisted storage for Event logs.
*/
public interface LogStore
{
/**
- * Event topic that indicates a new LogEvent that has been added to the store. The name
- * of the log is available as EVENT_PROP_LOGNAME, the original LogEvent as EVENT_PROP_LOG_EVENT.
+ * Event topic that indicates a new Event that has been added to the store. The name
+ * of the log is available as EVENT_PROP_LOGNAME, the original Event as EVENT_PROP_LOG_EVENT.
*/
- public static final String EVENT_TOPIC = LogStore.class.getName().replace('.', '/') + "/LogEvent";
+ public static final String EVENT_TOPIC = LogStore.class.getName().replace('.', '/') + "/Event";
/**
- * Event property key containing the name of the log on which the LogEvent has been added.
+ * Event property key containing the name of the log on which the Event has been added.
*/
public static final String EVENT_PROP_LOGNAME = "name";
/**
- * Event property key containing the LogEvent that has been added.
+ * Event property key containing the Event that has been added.
*/
- public static final String EVENT_PROP_LOG_EVENT = "logEvent";
+ public static final String EVENT_PROP_LOG_EVENT = "Event";
/**
* Return all events in a given range.
@@ -53,7 +53,7 @@ public interface LogStore
* @return a list of all events in this store that are in the given range.
* @throws java.io.IOException in case of any error.
*/
- public List<LogEvent> get(LogDescriptor range) throws IOException;
+ public List<Event> get(Descriptor range) throws IOException;
/**
* Get the range for the given id and the given log.
@@ -63,7 +63,7 @@ public interface LogStore
* @return the range for the given id and the given log.
* @throws java.io.IOException in case of any error.
*/
- public LogDescriptor getDescriptor(String targetID, long logID) throws IOException;
+ public Descriptor getDescriptor(String targetID, long logID) throws IOException;
/**
* Store the given events. The implementation does not have to be transactional i.e., it might throw an exception and still
@@ -72,7 +72,7 @@ public interface LogStore
* @param events a list of events to store.
* @throws java.io.IOException in case of any error. It might be possible that only part of the events get stored.
*/
- public void put(List<LogEvent> events) throws IOException;
+ public void put(List<Event> events) throws IOException;
/**
* Get the ranges of all logs of the given id.
@@ -81,7 +81,7 @@ public interface LogStore
* @return a list of the ranges of all logs for the given id.
* @throws java.io.IOException in case of any error.
*/
- public List<LogDescriptor> getDescriptors(String targetID) throws IOException;
+ public List<Descriptor> getDescriptors(String targetID) throws IOException;
/**
* Get the ranges of all logs of all ids in this store.
@@ -89,5 +89,5 @@ public interface LogStore
* @return a list of ranges of all logs for all ids in this store.
* @throws java.io.IOException in case of any error.
*/
- public List<LogDescriptor> getDescriptors() throws IOException;
+ public List<Descriptor> getDescriptors() throws IOException;
}
\ No newline at end of file
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java Tue Oct 1 12:33:09 2013
@@ -33,12 +33,11 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Map;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.Range;
import org.apache.ace.range.SortedRangeSet;
-import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
/**
@@ -68,17 +67,17 @@ public class LogStoreImpl implements Log
}
/**
- * @see org.apache.ace.log.server.store.LogStore#get(org.apache.ace.log.LogDescriptor)
+ * @see org.apache.ace.log.server.store.LogStore#get(org.apache.ace.log.Descriptor)
*/
- public synchronized List<LogEvent> get(LogDescriptor descriptor)
+ public synchronized List<Event> get(Descriptor descriptor)
throws IOException {
- final List<LogEvent> result = new ArrayList<LogEvent>();
+ final List<Event> result = new ArrayList<Event>();
final SortedRangeSet set = descriptor.getRangeSet();
BufferedReader in = null;
try {
File log = new File(new File(m_dir,
targetIDToFilename(descriptor.getTargetID())),
- String.valueOf(descriptor.getLogID()));
+ String.valueOf(descriptor.getStoreID()));
if (!log.isFile()) {
return result;
}
@@ -87,7 +86,7 @@ public class LogStoreImpl implements Log
long counter = 0;
for (String line = in.readLine(); line != null; line = in
.readLine()) {
- LogEvent event = new LogEvent(line);
+ Event event = new Event(line);
long id = event.getID();
if ((counter != -1) && ++counter == id) {
@@ -122,34 +121,34 @@ public class LogStoreImpl implements Log
/**
* @see org.apache.ace.log.server.store.LogStore#getDescriptor(String, long)
*/
- public synchronized LogDescriptor getDescriptor(String targetID, long logID)
+ public synchronized Descriptor getDescriptor(String targetID, long logID)
throws IOException {
Long high = m_fileToID.get(new File(new File(m_dir,
targetIDToFilename(targetID)), String.valueOf(logID))
.getAbsolutePath());
if (high != null) {
Range r = new Range(1, high);
- return new LogDescriptor(targetID, logID, new SortedRangeSet(
+ return new Descriptor(targetID, logID, new SortedRangeSet(
r.toRepresentation()));
}
- List<LogEvent> events = get(new LogDescriptor(targetID, logID,
+ List<Event> events = get(new Descriptor(targetID, logID,
SortedRangeSet.FULL_SET));
long[] idsArray = new long[events.size()];
int i = 0;
- for (LogEvent e : events) {
+ for (Event e : events) {
idsArray[i++] = e.getID();
}
- return new LogDescriptor(targetID, logID, new SortedRangeSet(idsArray));
+ return new Descriptor(targetID, logID, new SortedRangeSet(idsArray));
}
/**
* @see org.apache.ace.log.server.store.LogStore#getDescriptors(String)
*/
- public List<LogDescriptor> getDescriptors(String targetID)
+ public List<Descriptor> getDescriptors(String targetID)
throws IOException {
File dir = new File(m_dir, targetIDToFilename(targetID));
- List<LogDescriptor> result = new ArrayList<LogDescriptor>();
+ List<Descriptor> result = new ArrayList<Descriptor>();
if (!dir.isDirectory()) {
return result;
}
@@ -164,8 +163,8 @@ public class LogStoreImpl implements Log
/**
* @see org.apache.ace.log.server.store.LogStore#getDescriptors()
*/
- public List<LogDescriptor> getDescriptors() throws IOException {
- List<LogDescriptor> result = new ArrayList<LogDescriptor>();
+ public List<Descriptor> getDescriptors() throws IOException {
+ List<Descriptor> result = new ArrayList<Descriptor>();
for (String name : notNull(m_dir.list())) {
result.addAll(getDescriptors(filenameToTargetID(name)));
}
@@ -175,8 +174,8 @@ public class LogStoreImpl implements Log
/**
* @see org.apache.ace.log.server.store.LogStore#put(java.util.List)
*/
- public void put(List<LogEvent> events) throws IOException {
- Map<String, Map<Long, List<LogEvent>>> sorted = sort(events);
+ public void put(List<Event> events) throws IOException {
+ Map<String, Map<Long, List<Event>>> sorted = sort(events);
for (String targetID : sorted.keySet()) {
for (Long logID : sorted.get(targetID).keySet()) {
put(targetID, logID, sorted.get(targetID).get(logID));
@@ -197,7 +196,7 @@ public class LogStoreImpl implements Log
* in case of any error.
*/
protected synchronized void put(String targetID, Long logID,
- List<LogEvent> list) throws IOException {
+ List<Event> list) throws IOException {
if ((list == null) || (list.size() == 0)) {
// nothing to add, so return
return;
@@ -215,9 +214,9 @@ public class LogStoreImpl implements Log
cached = true;
}
}
- List<LogEvent> events = null;
+ List<Event> events = null;
if (!cached) {
- events = get(new LogDescriptor(targetID, logID,
+ events = get(new Descriptor(targetID, logID,
SortedRangeSet.FULL_SET));
// remove duplicates first
@@ -250,7 +249,7 @@ public class LogStoreImpl implements Log
logID.toString())));
}
long high = 0;
- for (LogEvent event : list) {
+ for (Event event : list) {
out.println(event.toRepresentation());
if (high < event.getID()) {
high = event.getID();
@@ -261,7 +260,7 @@ public class LogStoreImpl implements Log
Dictionary props = new Hashtable();
props.put(LogStore.EVENT_PROP_LOGNAME, m_name);
props.put(LogStore.EVENT_PROP_LOG_EVENT, event);
- m_eventAdmin.postEvent(new Event(LogStore.EVENT_TOPIC, props));
+ m_eventAdmin.postEvent(new org.osgi.service.event.Event(LogStore.EVENT_TOPIC, props));
}
if ((cached) && (high < Long.MAX_VALUE)) {
m_fileToID.put(file, new Long(high));
@@ -289,21 +288,21 @@ public class LogStoreImpl implements Log
* a list of events that have those ids.
*/
@SuppressWarnings("boxing")
- protected Map<String, Map<Long, List<LogEvent>>> sort(List<LogEvent> events) {
- Map<String, Map<Long, List<LogEvent>>> result = new HashMap<String, Map<Long, List<LogEvent>>>();
- for (LogEvent event : events) {
- Map<Long, List<LogEvent>> target = result
+ protected Map<String, Map<Long, List<Event>>> sort(List<Event> events) {
+ Map<String, Map<Long, List<Event>>> result = new HashMap<String, Map<Long, List<Event>>>();
+ for (Event event : events) {
+ Map<Long, List<Event>> target = result
.get(event.getTargetID());
if (target == null) {
- target = new HashMap<Long, List<LogEvent>>();
+ target = new HashMap<Long, List<Event>>();
result.put(event.getTargetID(), target);
}
- List<LogEvent> list = target.get(event.getLogID());
+ List<Event> list = target.get(event.getStoreID());
if (list == null) {
- list = new ArrayList<LogEvent>();
- target.put(event.getLogID(), list);
+ list = new ArrayList<Event>();
+ target.put(event.getStoreID(), list);
}
list.add(event);
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java Tue Oct 1 12:33:09 2013
@@ -9,8 +9,8 @@ import java.util.Properties;
import java.util.Set;
import org.amdatu.mongo.MongoDBService;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.Range;
import org.apache.ace.range.SortedRangeSet;
@@ -31,12 +31,12 @@ public class MongoLogStore implements Lo
}
@Override
- public List<LogEvent> get(LogDescriptor range) throws IOException {
+ public List<Event> get(Descriptor range) throws IOException {
DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
long high = range.getRangeSet().getHigh();
BasicDBObject filter = new BasicDBObject().append("targetId",
- range.getTargetID()).append("logId", range.getLogID());
+ range.getTargetID()).append("logId", range.getStoreID());
if (high > 0) {
filter.append("id", new BasicDBObject("$lte", high));
}
@@ -44,7 +44,7 @@ public class MongoLogStore implements Lo
DBCursor cursor = collection.find(filter);
cursor.sort(new BasicDBObject("id", 1));
- List<LogEvent> logevents = new ArrayList<LogEvent>();
+ List<Event> Events = new ArrayList<Event>();
while (cursor.hasNext()) {
DBObject event = cursor.next();
String targetId = (String) event.get("targetId");
@@ -58,15 +58,15 @@ public class MongoLogStore implements Lo
properties.put(key, propertiesDbObject.get(key));
}
- logevents.add(new LogEvent(targetId, logId, id, time, type,
+ Events.add(new Event(targetId, logId, id, time, type,
properties));
}
- return logevents;
+ return Events;
}
@Override
- public LogDescriptor getDescriptor(String targetID, long logID)
+ public Descriptor getDescriptor(String targetID, long logID)
throws IOException {
DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
@@ -81,21 +81,21 @@ public class MongoLogStore implements Lo
if (cursor.hasNext()) {
DBObject row = cursor.next();
high = (Long) row.get("id");
- return new LogDescriptor(targetID, logID, new SortedRangeSet(
+ return new Descriptor(targetID, logID, new SortedRangeSet(
new Range(1, high).toRepresentation()));
} else {
- return new LogDescriptor(targetID, logID, SortedRangeSet.FULL_SET);
+ return new Descriptor(targetID, logID, SortedRangeSet.FULL_SET);
}
}
@Override
- public void put(List<LogEvent> events) throws IOException {
+ public void put(List<Event> events) throws IOException {
DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
- for (LogEvent event : events) {
+ for (Event event : events) {
DBObject dbObject = new BasicDBObject()
.append("targetId", event.getTargetID())
- .append("logId", event.getLogID())
+ .append("logId", event.getStoreID())
.append("id", event.getID())
.append("time", event.getTime())
.append("type", event.getType())
@@ -106,7 +106,7 @@ public class MongoLogStore implements Lo
}
@Override
- public List<LogDescriptor> getDescriptors(String targetID)
+ public List<Descriptor> getDescriptors(String targetID)
throws IOException {
DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
@@ -119,7 +119,7 @@ public class MongoLogStore implements Lo
MapReduceOutput mapReduce = collection.mapReduce(m, r, null, OutputType.INLINE, filter);
Iterator<DBObject> iterator = mapReduce.results().iterator();
- List<LogDescriptor> descriptors = new ArrayList<LogDescriptor>();
+ List<Descriptor> descriptors = new ArrayList<Descriptor>();
while(iterator.hasNext()) {
DBObject row = iterator.next();
DBObject value = (DBObject)row.get("value");
@@ -138,7 +138,7 @@ public class MongoLogStore implements Lo
}
@Override
- public List<LogDescriptor> getDescriptors() throws IOException {
+ public List<Descriptor> getDescriptors() throws IOException {
return getDescriptors(null);
}
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/LogSyncTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/LogSyncTask.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/LogSyncTask.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/LogSyncTask.java Tue Oct 1 12:33:09 2013
@@ -35,8 +35,8 @@ import java.util.List;
import org.apache.ace.connectionfactory.ConnectionFactory;
import org.apache.ace.discovery.Discovery;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.LogSync;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.SortedRangeSet;
@@ -115,8 +115,8 @@ public class LogSyncTask implements Runn
URLConnection queryConnection = m_connectionFactory.createConnection(new URL(host, m_endpoint + "/" + COMMAND_QUERY));
InputStream queryInput = queryConnection.getInputStream();
- List<LogDescriptor> localRanges = m_logStore.getDescriptors();
- List<LogDescriptor> remoteRanges = getRanges(queryInput);
+ List<Descriptor> localRanges = m_logStore.getDescriptors();
+ List<Descriptor> remoteRanges = getRanges(queryInput);
boolean result = false;
if (push) {
@@ -128,7 +128,7 @@ public class LogSyncTask implements Runn
return result;
}
- protected boolean doPush(URL host, List<LogDescriptor> localRanges, List<LogDescriptor> remoteRanges) {
+ protected boolean doPush(URL host, List<Descriptor> localRanges, List<Descriptor> remoteRanges) {
boolean result = false;
OutputStream sendOutput = null;
try {
@@ -145,7 +145,7 @@ public class LogSyncTask implements Runn
sendOutput = sendConnection.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(sendOutput));
- List<LogDescriptor> delta = calculateDelta(localRanges, remoteRanges);
+ List<Descriptor> delta = calculateDelta(localRanges, remoteRanges);
result = !delta.isEmpty();
writeDelta(delta, writer);
@@ -176,42 +176,42 @@ public class LogSyncTask implements Runn
/**
* Writes the difference between local and remote to a writer.
- * @param descriptors A list of LogDescriptors that identifies all local log entries that need to be written.
+ * @param descriptors A list of Descriptors that identifies all local log entries that need to be written.
* @param writer A writer to write to.
* @throws java.io.IOException
*/
- protected void writeDelta(List<LogDescriptor> descriptors, Writer writer) throws IOException {
- for (LogDescriptor l : descriptors) {
- writeLogDescriptor(l, writer);
+ protected void writeDelta(List<Descriptor> descriptors, Writer writer) throws IOException {
+ for (Descriptor l : descriptors) {
+ writeDescriptor(l, writer);
}
}
/**
- * Writes the LogEvents described by the descriptor to the writer.
- * @param descriptor A LogDescriptor that identifies the events to be written.
+ * Writes the Events described by the descriptor to the writer.
+ * @param descriptor A Descriptor that identifies the events to be written.
* @param writer A writer to write the events to.
* @throws java.io.IOException Thrown when either the writer goes wrong, or there is a problem
* communicating with the local log store.
*/
- protected void writeLogDescriptor(LogDescriptor descriptor, Writer writer) throws IOException {
- List<LogEvent> events = m_logStore.get(descriptor);
- for (LogEvent event : events) {
+ protected void writeDescriptor(Descriptor descriptor, Writer writer) throws IOException {
+ List<Event> events = m_logStore.get(descriptor);
+ for (Event event : events) {
writer.write(event.toRepresentation() + "\n");
}
writer.flush();
}
- protected boolean doPull(URL host, List<LogDescriptor> localRanges, List<LogDescriptor> remoteRanges) {
+ protected boolean doPull(URL host, List<Descriptor> localRanges, List<Descriptor> remoteRanges) {
boolean result = false;
- List<LogDescriptor> delta = calculateDelta(remoteRanges, localRanges);
+ List<Descriptor> delta = calculateDelta(remoteRanges, localRanges);
result = !delta.isEmpty();
- for (LogDescriptor l : delta) {
+ for (Descriptor l : delta) {
try {
/*
* The request currently contains a range. This is not yet supported by the servlet, but it will
* simply be ignored.
*/
- URL url = new URL(host, m_endpoint + "/" + COMMAND_RECEIVE + "?" + TARGETID_KEY + "=" + l.getTargetID() + "&" + LOGID_KEY + "=" + l.getLogID() + "&" + RANGE_KEY + "=" + l.getRangeSet().toRepresentation());
+ URL url = new URL(host, m_endpoint + "/" + COMMAND_RECEIVE + "?" + TARGETID_KEY + "=" + l.getTargetID() + "&" + LOGID_KEY + "=" + l.getStoreID() + "&" + RANGE_KEY + "=" + l.getRangeSet().toRepresentation());
URLConnection receiveConnection = m_connectionFactory.createConnection(url);
InputStream receiveInput = receiveConnection.getInputStream();
@@ -234,12 +234,12 @@ public class LogSyncTask implements Runn
protected void readLogs(BufferedReader reader) {
try {
- List<LogEvent> events = new ArrayList<LogEvent>();
+ List<Event> events = new ArrayList<Event>();
String eventString = null;
while ((eventString = reader.readLine()) != null) {
try {
- LogEvent event = new LogEvent(eventString);
+ Event event = new Event(eventString);
events.add(event);
}
catch (IllegalArgumentException e) {
@@ -255,23 +255,23 @@ public class LogSyncTask implements Runn
}
/**
- * Calculates the difference between two lists of <code>LogDescriptor</code>. The result will contain whatever is
+ * Calculates the difference between two lists of <code>Descriptor</code>. The result will contain whatever is
* not in <code>destination</code>, but is in <code>source</code>.
*/
- protected List<LogDescriptor> calculateDelta(List<LogDescriptor> source, List<LogDescriptor> destination) {
+ protected List<Descriptor> calculateDelta(List<Descriptor> source, List<Descriptor> destination) {
/*
* For each local descriptor, we try to find a matching remote one. If so, we will synchronize all events
* that the remote does not have. If we do not find a matching one at all, we send the complete local
* log.
*/
- List<LogDescriptor> result = new ArrayList<LogDescriptor>();
- for (LogDescriptor s : source) {
- LogDescriptor diffs = s;
- for (LogDescriptor d : destination) {
- if ((s.getLogID() == d.getLogID()) && (s.getTargetID().equals(d.getTargetID()))) {
+ List<Descriptor> result = new ArrayList<Descriptor>();
+ for (Descriptor s : source) {
+ Descriptor diffs = s;
+ for (Descriptor d : destination) {
+ if ((s.getStoreID() == d.getStoreID()) && (s.getTargetID().equals(d.getTargetID()))) {
SortedRangeSet rangeDiff = d.getRangeSet().diffDest(s.getRangeSet());
if (!isEmptyRangeSet(rangeDiff)) {
- diffs = new LogDescriptor(s.getTargetID(), s.getLogID(), rangeDiff);
+ diffs = new Descriptor(s.getTargetID(), s.getStoreID(), rangeDiff);
}
else {
diffs = null;
@@ -289,15 +289,15 @@ public class LogSyncTask implements Runn
return !set.iterator().hasNext();
}
- protected List<LogDescriptor> getRanges(InputStream stream) throws IOException {
- List<LogDescriptor> result = new ArrayList<LogDescriptor>();
+ protected List<Descriptor> getRanges(InputStream stream) throws IOException {
+ List<Descriptor> result = new ArrayList<Descriptor>();
BufferedReader queryReader = null;
try {
queryReader = new BufferedReader(new InputStreamReader(stream));
for (String line = queryReader.readLine(); line != null; line = queryReader.readLine()) {
try {
- result.add(new LogDescriptor(line));
+ result.add(new Descriptor(line));
}
catch (IllegalArgumentException iae) {
throw new IOException("Could not determine highest remote event id, received malformed event range: " + line);
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/LogImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/LogImpl.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/LogImpl.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/LogImpl.java Tue Oct 1 12:33:09 2013
@@ -21,7 +21,7 @@ package org.apache.ace.log.target;
import java.io.IOException;
import java.util.Dictionary;
import org.apache.ace.log.Log;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.target.store.LogStore;
import org.osgi.service.log.LogService;
@@ -35,11 +35,11 @@ public class LogImpl implements Log {
}
catch (NullPointerException e) {
// if we cannot store the event, we log it to the normal log as extensively as possible
- m_log.log(LogService.LOG_WARNING, "Could not store event: " + (new LogEvent("", 0, 0, 0, type, properties)).toRepresentation(), e);
+ m_log.log(LogService.LOG_WARNING, "Could not store event: " + (new Event("", 0, 0, 0, type, properties)).toRepresentation(), e);
}
catch (IOException e) {
// if we cannot store the event, we log it to the normal log as extensively as possible
- m_log.log(LogService.LOG_WARNING, "Could not store event: " + (new LogEvent("", 0, 0, 0, type, properties)).toRepresentation(), e);
+ m_log.log(LogService.LOG_WARNING, "Could not store event: " + (new Event("", 0, 0, 0, type, properties)).toRepresentation(), e);
}
}
}
\ No newline at end of file
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/LogStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/LogStore.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/LogStore.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/LogStore.java Tue Oct 1 12:33:09 2013
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.Dictionary;
import java.util.List;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Event;
/**
* Server log store interface for the targets. Implementations of this service interface provide a persisted storage for
@@ -39,7 +39,7 @@ public interface LogStore
* @return the created event that has been persisted.
* @throws java.io.IOException in case of any IO error.
*/
- public LogEvent put(int type, Dictionary props) throws IOException;
+ public Event put(int type, Dictionary props) throws IOException;
/**
* Get all events in the given log.
@@ -48,7 +48,7 @@ public interface LogStore
* @return a list of LogEvent's that are currently in the log of the given logID.
* @throws java.io.IOException in case of any IO error.
*/
- public List/*<LogEvent>*/get(long logID) throws IOException;
+ public List/*<Event>*/get(long logID) throws IOException;
/**
* Get the events in the given log that are in the range of the given lower and upper bound.
@@ -60,7 +60,7 @@ public interface LogStore
* bounds.
* @throws java.io.IOException in case of any IO error.
*/
- public List/*<LogEvent>*/get(long logID, long from, long to) throws IOException;
+ public List/*<Event>*/get(long logID, long from, long to) throws IOException;
/**
* Get the the highest id of any LogEvent entry in the given log.
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java Tue Oct 1 12:33:09 2013
@@ -27,7 +27,7 @@ import java.util.Dictionary;
import java.util.List;
import org.apache.ace.identification.Identification;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.target.store.LogStore;
import org.osgi.service.log.LogService;
@@ -158,7 +158,7 @@ public class LogStoreImpl implements Log
while (store.hasNext()) {
long eventID = store.readCurrentID();
if ((eventID >= from) && (eventID <= to)) {
- result.add(new LogEvent(new String(store.read())));
+ result.add(new Event(new String(store.read())));
} else {
store.skip();
}
@@ -251,9 +251,9 @@ public class LogStoreImpl implements Log
* @throws java.io.IOException
* in case of any IO error.
*/
- public synchronized LogEvent put(int type, Dictionary props) throws IOException {
+ public synchronized Event put(int type, Dictionary props) throws IOException {
try {
- LogEvent result = new LogEvent(null, m_store.getId(), getNextID(), System.currentTimeMillis(), type, props);
+ Event result = new Event(null, m_store.getId(), getNextID(), System.currentTimeMillis(), type, props);
m_store.append(result.getID(), result.toRepresentation().getBytes());
return result;
}
Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/task/LogSyncTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/task/LogSyncTask.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/task/LogSyncTask.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/task/LogSyncTask.java Tue Oct 1 12:33:09 2013
@@ -34,8 +34,8 @@ import java.util.List;
import org.apache.ace.connectionfactory.ConnectionFactory;
import org.apache.ace.discovery.Discovery;
import org.apache.ace.identification.Identification;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.target.store.LogStore;
import org.apache.ace.range.RangeIterator;
import org.apache.ace.range.SortedRangeSet;
@@ -152,14 +152,14 @@ public class LogSyncTask implements Runn
List events = m_LogStore.get(logID, lowest, highestLocal > highest ? highest : highestLocal);
Iterator iter = events.iterator();
while (iter.hasNext()) {
- LogEvent current = (LogEvent) iter.next();
+ Event current = (Event) iter.next();
while ((current.getID() > lowest) && rangeIterator.hasNext()) {
lowest = rangeIterator.next();
}
if (current.getID() == lowest) {
// before we send the LogEvent to the other side, we fill out the
// appropriate identification
- LogEvent event = new LogEvent(m_identification.getID(), current);
+ Event event = new Event(m_identification.getID(), current);
writer.write(event.toRepresentation() + "\n");
}
}
@@ -178,14 +178,14 @@ public class LogSyncTask implements Runn
* @throws java.io.IOException
* If no range could be determined due to an I/O failure.
*/
- protected LogDescriptor getDescriptor(InputStream queryInput) throws IOException {
+ protected Descriptor getDescriptor(InputStream queryInput) throws IOException {
BufferedReader queryReader = null;
try {
queryReader = new BufferedReader(new InputStreamReader(queryInput));
String rangeString = queryReader.readLine();
if (rangeString != null) {
try {
- return new LogDescriptor(rangeString);
+ return new Descriptor(rangeString);
}
catch (IllegalArgumentException iae) {
throw new IOException("Could not determine highest remote event id, received malformed event range (" + rangeString + ")");
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogDescriptorTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogDescriptorTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogDescriptorTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogDescriptorTest.java Tue Oct 1 12:33:09 2013
@@ -20,6 +20,7 @@ package org.apache.ace.log;
import static org.apache.ace.test.utils.TestUtils.UNIT;
+import org.apache.ace.feedback.Descriptor;
import org.apache.ace.range.SortedRangeSet;
import org.testng.annotations.Test;
@@ -27,23 +28,23 @@ public class LogDescriptorTest {
@Test(groups = { UNIT })
public void serializeDescriptor() {
- LogDescriptor descriptor = new LogDescriptor("gwid", 1, new SortedRangeSet("2-3"));
+ Descriptor descriptor = new Descriptor("gwid", 1, new SortedRangeSet("2-3"));
assert descriptor.toRepresentation().equals("gwid,1,2-3") : "The representation of our descriptor is incorrect:" + descriptor.toRepresentation();
}
@Test(groups = { UNIT })
public void deserializeDescriptor() {
- LogDescriptor descriptor = new LogDescriptor("gwid,1,2-3");
+ Descriptor descriptor = new Descriptor("gwid,1,2-3");
assert descriptor.getTargetID().equals("gwid") : "Target ID not correctly parsed.";
- assert descriptor.getLogID() == 1 : "Log ID not correctly parsed.";
+ assert descriptor.getStoreID() == 1 : "Log ID not correctly parsed.";
assert descriptor.getRangeSet().toRepresentation().equals("2-3") : "There should be nothing in the diff between the set in the descriptor and the check-set.";
}
@Test(groups = { UNIT })
public void deserializeMultiRangeDescriptor() {
- LogDescriptor descriptor = new LogDescriptor("gwid,1,1-4$k6$k8$k10-20");
+ Descriptor descriptor = new Descriptor("gwid,1,1-4$k6$k8$k10-20");
assert descriptor.getTargetID().equals("gwid") : "Target ID not correctly parsed.";
- assert descriptor.getLogID() == 1 : "Log ID not correctly parsed.";
+ assert descriptor.getStoreID() == 1 : "Log ID not correctly parsed.";
String representation = descriptor.getRangeSet().toRepresentation();
assert representation.equals("1-4,6,8,10-20") : "There should be nothing in the diff between the set in the descriptor and the check-set, but we parsed: " + representation;
}
@@ -51,9 +52,9 @@ public class LogDescriptorTest {
@Test(groups = { UNIT })
public void deserializeMultiRangeDescriptorWithFunnyGWID() {
String line = "gw$$id,1,1-4$k6$k8$k10-20";
- LogDescriptor descriptor = new LogDescriptor(line);
+ Descriptor descriptor = new Descriptor(line);
assert descriptor.getTargetID().equals("gw$id") : "Target ID not correctly parsed.";
- assert descriptor.getLogID() == 1 : "Log ID not correctly parsed.";
+ assert descriptor.getStoreID() == 1 : "Log ID not correctly parsed.";
assert line.equals(descriptor.toRepresentation()) : "Converting the line back to the representation failed.";
String representation = descriptor.getRangeSet().toRepresentation();
assert representation.equals("1-4,6,8,10-20") : "There should be nothing in the diff between the set in the descriptor and the check-set, but we parsed: " + representation;
@@ -61,6 +62,6 @@ public class LogDescriptorTest {
@Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class)
public void deserializeInvalidDescriptor() throws Exception {
- new LogDescriptor("invalidStringRepresentation");
+ new Descriptor("invalidStringRepresentation");
}
}
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java Tue Oct 1 12:33:09 2013
@@ -23,27 +23,29 @@ import static org.apache.ace.test.utils.
import java.util.Dictionary;
import java.util.Properties;
+import org.apache.ace.feedback.AuditEvent;
+import org.apache.ace.feedback.Event;
import org.testng.annotations.Test;
public class LogEventTest {
@Test(groups = { UNIT })
public void serializeLogEvent() {
- LogEvent e = new LogEvent("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
+ Event e = new Event("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
Properties p = new Properties();
p.put(AuditEvent.KEY_ID, "my first value");
- e = new LogEvent("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
+ e = new Event("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.BUNDLE_INSTALLED + "," + AuditEvent.KEY_ID + ",my first value");
- e = new LogEvent("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
+ e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
assert e.toRepresentation().equals("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
}
@SuppressWarnings("unchecked")
@Test(groups = { UNIT })
public void deserializeLogEvent() {
- LogEvent e = new LogEvent("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED + ",a,1,b,2,c,3");
+ Event e = new Event("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED + ",a,1,b,2,c,3");
assert e.getTargetID().equals("gwid,gwid\n\r$") : "Target ID is not correctly parsed";
- assert e.getLogID() == 1 : "Log ID is not correctly parsed";
+ assert e.getStoreID() == 1 : "Log ID is not correctly parsed";
assert e.getID() == 2 : "ID is not correctly parsed";
assert e.getTime() == 3 : "Time is not correctly parsed";
assert e.getType() == AuditEvent.FRAMEWORK_STARTED : "Event type is wrong";
@@ -56,28 +58,28 @@ public class LogEventTest {
@Test(groups = { UNIT })
public void deserializeIllegalLogEvent() {
try {
- new LogEvent("garbage in, garbage out!");
+ new Event("garbage in, garbage out!");
assert false : "Parsing garbage should result in an exception";
}
catch (IllegalArgumentException e) {
// expected
}
try {
- new LogEvent("g$z,1,2,3," + AuditEvent.BUNDLE_STOPPED);
+ new Event("g$z,1,2,3," + AuditEvent.BUNDLE_STOPPED);
assert false : "Parsing illegal token should result in an exception";
}
catch (IllegalArgumentException e) {
// expected
}
try {
- new LogEvent("g$,1,2,3," + AuditEvent.BUNDLE_STOPPED);
+ new Event("g$,1,2,3," + AuditEvent.BUNDLE_STOPPED);
assert false : "Parsing half of a token should result in an exception";
}
catch (IllegalArgumentException e) {
// expected
}
try {
- new LogEvent("g$,1,2,3," + AuditEvent.BUNDLE_STOPPED + ",a");
+ new Event("g$,1,2,3," + AuditEvent.BUNDLE_STOPPED + ",a");
assert false : "Parsing only a key should result in an exception";
}
catch (IllegalArgumentException e) {
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/listener/LogTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/listener/LogTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/listener/LogTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/listener/LogTest.java Tue Oct 1 12:33:09 2013
@@ -24,7 +24,7 @@ import java.util.Dictionary;
import java.util.List;
import java.util.Properties;
-import org.apache.ace.log.AuditEvent;
+import org.apache.ace.feedback.AuditEvent;
import org.apache.ace.log.Log;
import org.apache.ace.log.listener.MockLog.LogEntry;
import org.apache.ace.test.utils.TestUtils;
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java Tue Oct 1 12:33:09 2013
@@ -29,8 +29,8 @@ import java.util.Properties;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.servlet.LogServlet;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.SortedRangeSet;
@@ -43,9 +43,9 @@ import org.testng.annotations.Test;
public class LogServletTest {
private LogServlet m_logServlet;
- private LogDescriptor m_range = new LogDescriptor("tID", 123, new SortedRangeSet("1-3"));
- private LogEvent m_event1 = new LogEvent("tID", 123, 1, 888888, 1, new Properties());
- private LogEvent m_event2 = new LogEvent("tID", 123, 2, 888888, 2, new Properties());
+ private Descriptor m_range = new Descriptor("tID", 123, new SortedRangeSet("1-3"));
+ private Event m_event1 = new Event("tID", 123, 1, 888888, 1, new Properties());
+ private Event m_event2 = new Event("tID", 123, 2, 888888, 2, new Properties());
private MockLogStore m_mockStore;
@BeforeMethod(alwaysRun = true)
@@ -63,7 +63,7 @@ public class LogServletTest {
@Test(groups = { UNIT })
public void queryLog() throws Exception {
MockServletOutputStream output = new MockServletOutputStream();
- boolean result = m_logServlet.handleQuery(m_range.getTargetID(), String.valueOf(m_range.getLogID()), null, output);
+ boolean result = m_logServlet.handleQuery(m_range.getTargetID(), String.valueOf(m_range.getStoreID()), null, output);
assert result;
assert m_range.toRepresentation().equals(output.m_text);
output.m_text = "";
@@ -75,14 +75,14 @@ public class LogServletTest {
@Test(groups = { UNIT })
public void receiveLog() throws Exception {
MockServletOutputStream output = new MockServletOutputStream();
- boolean result = m_logServlet.handleReceive(m_range.getTargetID(), String.valueOf(m_range.getLogID()), "1", null, output);
+ boolean result = m_logServlet.handleReceive(m_range.getTargetID(), String.valueOf(m_range.getStoreID()), "1", null, output);
assert result;
String expected = m_event1.toRepresentation() + "\n";
String actual = output.m_text;
assert expected.equals(actual) : "We expected '" + expected + "', but received '" + actual + "'";
output = new MockServletOutputStream();
- result = m_logServlet.handleReceive(m_range.getTargetID(), String.valueOf(m_range.getLogID()), null , null, output);
+ result = m_logServlet.handleReceive(m_range.getTargetID(), String.valueOf(m_range.getStoreID()), null , null, output);
assert result;
expected = m_event1.toRepresentation() + "\n" + m_event2.toRepresentation() + "\n";
actual = output.m_text;
@@ -97,18 +97,18 @@ public class LogServletTest {
m_logServlet.handleSend(input);
String actual = "";
- for (Iterator<LogEvent> i = m_mockStore.m_events.iterator(); i.hasNext();) {
- LogEvent event = i.next();
+ for (Iterator<Event> i = m_mockStore.m_events.iterator(); i.hasNext();) {
+ Event event = i.next();
actual = actual + event.toRepresentation() + "\n";
}
assert expected.equals(actual);
}
private class MockLogStore implements LogStore {
- public List<LogEvent> m_events = new ArrayList<LogEvent>();
+ public List<Event> m_events = new ArrayList<Event>();
- public List<LogEvent> get(LogDescriptor range) {
- List<LogEvent> events = new ArrayList<LogEvent>();
+ public List<Event> get(Descriptor range) {
+ List<Event> events = new ArrayList<Event>();
if (range.getRangeSet().contains(1)) {
events.add(m_event1);
}
@@ -117,18 +117,18 @@ public class LogServletTest {
}
return events;
}
- public List<LogDescriptor> getDescriptors(String targetID) {
+ public List<Descriptor> getDescriptors(String targetID) {
return null;
}
- public List<LogDescriptor> getDescriptors() {
- List<LogDescriptor> ranges = new ArrayList<LogDescriptor>();
+ public List<Descriptor> getDescriptors() {
+ List<Descriptor> ranges = new ArrayList<Descriptor>();
ranges.add(m_range);
return ranges;
}
- public LogDescriptor getDescriptor(String targetID, long logID) throws IOException {
+ public Descriptor getDescriptor(String targetID, long logID) throws IOException {
return m_range;
}
- public void put(List<LogEvent> events) throws IOException {
+ public void put(List<Event> events) throws IOException {
m_events = events;
}
}
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java Tue Oct 1 12:33:09 2013
@@ -28,9 +28,9 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
-import org.apache.ace.log.AuditEvent;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
+import org.apache.ace.feedback.AuditEvent;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.log.server.store.impl.LogStoreImpl;
import org.apache.ace.test.utils.TestUtils;
import org.osgi.service.event.EventAdmin;
@@ -60,13 +60,13 @@ public class ServerLogStoreTester {
@SuppressWarnings("serial")
@Test(groups = { UNIT })
public void testLog() throws IOException {
- List<LogDescriptor> ranges = m_logStore.getDescriptors();
+ List<Descriptor> ranges = m_logStore.getDescriptors();
assert ranges.isEmpty() : "New store should have no ranges.";
- List<LogEvent> events = new ArrayList<LogEvent>();
+ List<Event> events = new ArrayList<Event>();
for (String target : new String[] { "g1", "g2", "g3" }) {
for (long log : new long[] { 1, 2, 3, 5 }) {
for (long id : new long[] { 1, 2, 3, 20 }) {
- events.add(new LogEvent(target, log, id, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED, new Properties() {
+ events.add(new Event(target, log, id, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED, new Properties() {
{
put("test", "bar");
}
@@ -76,19 +76,19 @@ public class ServerLogStoreTester {
}
m_logStore.put(events);
assert m_logStore.getDescriptors().size() == 3 * 4 : "Incorrect amount of ranges returned from store";
- List<LogEvent> stored = new ArrayList<LogEvent>();
- for (LogDescriptor range : m_logStore.getDescriptors()) {
- for (LogDescriptor range2 : m_logStore.getDescriptors(range.getTargetID())) {
- stored.addAll(m_logStore.get(m_logStore.getDescriptor(range2.getTargetID(), range2.getLogID())));
+ List<Event> stored = new ArrayList<Event>();
+ for (Descriptor range : m_logStore.getDescriptors()) {
+ for (Descriptor range2 : m_logStore.getDescriptors(range.getTargetID())) {
+ stored.addAll(m_logStore.get(m_logStore.getDescriptor(range2.getTargetID(), range2.getStoreID())));
}
}
Set<String> in = new HashSet<String>();
- for (LogEvent event : events) {
+ for (Event event : events) {
in.add(event.toRepresentation());
}
Set<String> out = new HashSet<String>();
- for (LogEvent event : stored) {
+ for (Event event : stored) {
out.add(event.toRepresentation());
}
assert in.equals(out) : "Stored events differ from the added.";
@@ -97,8 +97,8 @@ public class ServerLogStoreTester {
@Test( groups = { TestUtils.UNIT } )
public void testLogWithSpecialCharacters() throws IOException {
String targetID = "myta\0rget";
- LogEvent event = new LogEvent(targetID, 1, 1, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED, new Properties());
- List<LogEvent> events = new ArrayList<LogEvent>();
+ Event event = new Event(targetID, 1, 1, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED, new Properties());
+ List<Event> events = new ArrayList<Event>();
events.add(event);
m_logStore.put(events);
assert m_logStore.getDescriptors().size() == 1 : "Incorrect amount of ranges returned from store: expected 1, found " + m_logStore.getDescriptors().size();
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/task/LogTaskTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/task/LogTaskTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/task/LogTaskTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/task/LogTaskTest.java Tue Oct 1 12:33:09 2013
@@ -25,7 +25,7 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
-import org.apache.ace.log.LogDescriptor;
+import org.apache.ace.feedback.Descriptor;
import org.apache.ace.log.server.task.LogSyncTask;
import org.apache.ace.range.RangeIterator;
import org.apache.ace.range.SortedRangeSet;
@@ -34,14 +34,14 @@ import org.testng.annotations.Test;
public class LogTaskTest {
private class MockLogSyncTask extends LogSyncTask {
- public List<LogDescriptor> m_calledWith = new ArrayList<LogDescriptor>();
+ public List<Descriptor> m_calledWith = new ArrayList<Descriptor>();
public MockLogSyncTask(String endpoint, String name) {
super(endpoint, name, LogSyncTask.Mode.PUSH);
}
@Override
- protected void writeLogDescriptor(LogDescriptor descriptor, Writer writer) throws IOException {
+ protected void writeDescriptor(Descriptor descriptor, Writer writer) throws IOException {
m_calledWith.add(descriptor);
}
@@ -53,19 +53,19 @@ public class LogTaskTest {
@Test(groups = { UNIT })
public void testDeltaComputation() throws IOException {
// TODO: Test the new LogDescriptor.
- List<LogDescriptor> src = new ArrayList<LogDescriptor>();
- List<LogDescriptor> dest = new ArrayList<LogDescriptor>();
+ List<Descriptor> src = new ArrayList<Descriptor>();
+ List<Descriptor> dest = new ArrayList<Descriptor>();
MockLogSyncTask task = new MockLogSyncTask("mocklog", "mocklog");
// compare two empty lists
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.isEmpty() : "Delta of two empty lists should be empty";
// add something to the source
- src.add(new LogDescriptor("gwid", 1, new SortedRangeSet("1-5")));
+ src.add(new Descriptor("gwid", 1, new SortedRangeSet("1-5")));
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.size() == 1 : "Delta should be 1 instead of: " + task.m_calledWith.size();
task.m_calledWith.clear();
// add an overlapping destination
- dest.add(new LogDescriptor("gwid", 1, new SortedRangeSet("1-3")));
+ dest.add(new Descriptor("gwid", 1, new SortedRangeSet("1-3")));
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.size() == 1 : "Delta should be 1 instead of: " + task.m_calledWith.size();
RangeIterator i = task.m_calledWith.get(0).getRangeSet().iterator();
@@ -74,7 +74,7 @@ public class LogTaskTest {
assert !i.hasNext() : "Illegal value in SortedRangeSet";
task.m_calledWith.clear();
// add a non-overlapping destination
- dest.add(new LogDescriptor("gwid", 2, new SortedRangeSet("50-100")));
+ dest.add(new Descriptor("gwid", 2, new SortedRangeSet("50-100")));
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.size() == 1 : "Delta should be 1 instead of: " + task.m_calledWith.size();
i = task.m_calledWith.get(0).getRangeSet().iterator();
@@ -83,17 +83,17 @@ public class LogTaskTest {
assert !i.hasNext() : "Illegal value in SortedRangeSet";
task.m_calledWith.clear();
// add non-overlapping source
- src.add(new LogDescriptor("gwid", 2, new SortedRangeSet("1-49")));
+ src.add(new Descriptor("gwid", 2, new SortedRangeSet("1-49")));
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.size() == 2 : "Delta should be 2 instead of: " + task.m_calledWith.size();
task.m_calledWith.clear();
// add a source with gaps
- src.add(new LogDescriptor("gwid", 3, new SortedRangeSet("1-10")));
- dest.add(new LogDescriptor("gwid", 3, new SortedRangeSet("3,5-8")));
+ src.add(new Descriptor("gwid", 3, new SortedRangeSet("1-10")));
+ dest.add(new Descriptor("gwid", 3, new SortedRangeSet("3,5-8")));
task.writeDelta(task.calculateDelta(src, dest), null);
assert task.m_calledWith.size() == 3 : "Delta should be 3 instead of: " + task.m_calledWith.size();
- for (LogDescriptor l : task.m_calledWith) {
- if (l.getLogID() == 3) {
+ for (Descriptor l : task.m_calledWith) {
+ if (l.getStoreID() == 3) {
i = l.getRangeSet().iterator();
}
}
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/store/impl/GatewayLogStoreTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/store/impl/GatewayLogStoreTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/store/impl/GatewayLogStoreTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/store/impl/GatewayLogStoreTest.java Tue Oct 1 12:33:09 2013
@@ -26,9 +26,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.apache.ace.feedback.AuditEvent;
+import org.apache.ace.feedback.Event;
import org.apache.ace.identification.Identification;
-import org.apache.ace.log.AuditEvent;
-import org.apache.ace.log.LogEvent;
import org.apache.ace.log.target.store.LogStore;
import org.apache.ace.log.target.store.impl.LogStoreImpl;
import org.apache.ace.test.utils.TestUtils;
@@ -77,12 +77,12 @@ public class GatewayLogStoreTest {
long highest = m_logStore.getHighestID(ids[0]);
assert highest == 3 : "Store with 3 entries should have 3 as highest id but was: " + highest;
List<String> result = new ArrayList<String>();
- for (LogEvent event : (List<LogEvent>) m_logStore.get(ids[0])) {
+ for (Event event : (List<Event>) m_logStore.get(ids[0])) {
result.add(event.toRepresentation());
}
assert result.equals(events) : "Events " + events + " should equal full log " + result;
result = new ArrayList<String>();
- for (LogEvent event : (List<LogEvent>) m_logStore.get(ids[0], 1, highest)) {
+ for (Event event : (List<Event>) m_logStore.get(ids[0], 1, highest)) {
result.add(event.toRepresentation());
}
assert result.equals(events) : "Events " + events + " should equal full log " + result;
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java Tue Oct 1 12:33:09 2013
@@ -31,9 +31,9 @@ import java.util.List;
import java.util.Properties;
import org.apache.ace.discovery.Discovery;
+import org.apache.ace.feedback.Descriptor;
+import org.apache.ace.feedback.Event;
import org.apache.ace.identification.Identification;
-import org.apache.ace.log.LogDescriptor;
-import org.apache.ace.log.LogEvent;
import org.apache.ace.log.target.store.LogStore;
import org.apache.ace.log.target.task.LogSyncTask;
import org.apache.ace.range.SortedRangeSet;
@@ -62,7 +62,7 @@ public class LogSyncTaskTest {
@Test(groups = { UNIT })
public synchronized void getRange() throws Exception {
- final LogDescriptor range = new LogDescriptor(TARGET_ID, 1, new SortedRangeSet("1-10"));
+ final Descriptor range = new Descriptor(TARGET_ID, 1, new SortedRangeSet("1-10"));
m_task.getDescriptor(new InputStream() {
int m_count = 0;
byte[] m_bytes = (range.toRepresentation() + "\n").getBytes();
@@ -81,9 +81,9 @@ public class LogSyncTaskTest {
@Test(groups = { UNIT })
public synchronized void synchronizeLog() throws Exception {
- final LogDescriptor range = new LogDescriptor(TARGET_ID, 1, new SortedRangeSet(new long[] {0}));
- final LogEvent event = new LogEvent(TARGET_ID, 1, 1, 1, 1, new Properties());
- final List<LogEvent> events = new ArrayList<LogEvent>();
+ final Descriptor range = new Descriptor(TARGET_ID, 1, new SortedRangeSet(new long[] {0}));
+ final Event event = new Event(TARGET_ID, 1, 1, 1, 1, new Properties());
+ final List<Event> events = new ArrayList<Event>();
events.add(event);
InputStream input = new InputStream() {
@@ -110,7 +110,7 @@ public class LogSyncTaskTest {
public List<?> get(long logID) throws IOException { return null; }
public long[] getLogIDs() throws IOException { return null; }
@SuppressWarnings("unchecked")
- public LogEvent put(int type, Dictionary props) throws IOException { return null; }
+ public Event put(int type, Dictionary props) throws IOException { return null; }
});
MockConnection connection = new MockConnection(new URL("http://mock"));
Modified: ace/trunk/org.apache.ace.managementagent/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.managementagent/bnd.bnd?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.managementagent/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.managementagent/bnd.bnd Tue Oct 1 12:33:09 2013
@@ -1,5 +1,4 @@
--buildpath: \
- osgi.core,\
+-buildpath: osgi.core,\
org.apache.felix.configadmin,\
org.apache.felix.dependencymanager,\
org.apache.felix.deploymentadmin,\
@@ -10,7 +9,6 @@
org.apache.ace.log.target;version=latest,\
org.apache.ace.log.target.store.impl;version=latest,\
org.apache.ace.range.api;version=latest,\
- org.apache.ace.log.api;version=latest,\
org.apache.ace.log.listener;version=latest,\
org.apache.ace.discovery.api;version=latest,\
org.apache.ace.discovery.property;version=latest,\
@@ -20,7 +18,8 @@
org.apache.ace.deployment.deploymentadmin;version=latest,\
org.apache.ace.deployment.task.base;version=latest,\
org.apache.ace.deployment.task;version=latest,\
- org.apache.ace.scheduler.impl;version=latest
+ org.apache.ace.scheduler.impl;version=latest,\
+ org.apache.ace.feedback.common;version=latest
Private-Package: EDU.oswego.cs.dl.util.concurrent;-split-package:=first,\
org.apache.felix.*;-split-package:=first,\
org.apache.ace.*;-split-package:=first,\
Modified: ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd Tue Oct 1 12:33:09 2013
@@ -34,7 +34,8 @@ Private-Package: org.apache.ace.useradmi
org.apache.ace.webui.vaadin;version=latest,\
org.apache.ace.configurator.useradmin.task;version=latest,\
org.apache.ace.authentication.api;version=latest,\
- org.apache.ace.log.server.store.api;version=latest
+ org.apache.ace.log.server.store.api;version=latest,\
+ org.apache.ace.feedback.common;version=latest
-buildpath: osgi.core;version='[4.1,5)',\
osgi.cmpn,\
junit.osgi,\
Modified: ace/trunk/run-client/client.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-client/client.bndrun?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/run-client/client.bndrun (original)
+++ ace/trunk/run-client/client.bndrun Tue Oct 1 12:33:09 2013
@@ -51,7 +51,8 @@
org.apache.ace.target.mgmt.ui;version=latest,\
org.apache.ace.useradmin.ui;version=latest,\
org.apache.ace.webui.vaadin;version=latest,\
- org.apache.ace.gogo;version=latest
+ org.apache.ace.gogo;version=latest,\
+ org.apache.ace.feedback.common;version=latest
-runrepos: Workspace,\
Release
-runproperties: org.apache.felix.log.storeDebug=true,\
Modified: ace/trunk/run-server-allinone/server-allinone.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-server-allinone/server-allinone.bndrun?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/run-server-allinone/server-allinone.bndrun (original)
+++ ace/trunk/run-server-allinone/server-allinone.bndrun Tue Oct 1 12:33:09 2013
@@ -59,7 +59,8 @@
org.apache.ace.verifier.impl;version=latest,\
org.apache.ace.verifier.ui;version=latest,\
org.apache.ace.webui.vaadin;version=latest,\
- org.apache.ace.gogo;version=latest
+ org.apache.ace.gogo;version=latest,\
+ org.apache.ace.feedback.common;version=latest
-runrepos: Workspace,\
Local Repository,\
Release,\
Modified: ace/trunk/run-server/server.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-server/server.bndrun?rev=1528066&r1=1528065&r2=1528066&view=diff
==============================================================================
--- ace/trunk/run-server/server.bndrun (original)
+++ ace/trunk/run-server/server.bndrun Tue Oct 1 12:33:09 2013
@@ -36,7 +36,8 @@
org.apache.ace.resourceprocessor.useradmin;version=latest,\
org.apache.ace.scheduler.impl;version=latest,\
org.apache.ace.log.server.store.api;version=latest,\
- org.apache.ace.log.server.store.file;version=latest
+ org.apache.ace.log.server.store.file;version=latest,\
+ org.apache.ace.feedback.common;version=latest
-runrepos: Workspace,\
Release
-runproperties: org.apache.felix.log.storeDebug=true,\