Skip to content

Commit

Permalink
Stubbing services, adding security context. deduplicating REST resources
Browse files Browse the repository at this point in the history
More work to share REST controller classes between radio and server.
Therefore we are supplying a special security context that is providing
a special "allow everything" subject and we are stubbing user services.
Moving DTOs used to rest-model module, so it can be used as an API
return type later.
Extracting several semantically associated methods of the SystemResource
to separate resources.
  • Loading branch information
dennisoelkers committed Jan 12, 2015
1 parent 45815ea commit 286b7c3
Show file tree
Hide file tree
Showing 72 changed files with 838 additions and 920 deletions.
Expand Up @@ -24,7 +24,7 @@
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import org.graylog2.Configuration;
import org.graylog2.ServerVersion;
import org.graylog2.shared.ServerVersion;
import org.graylog2.UI;
import org.graylog2.bindings.AlarmCallbackBindings;
import org.graylog2.bindings.InitializerBindings;
Expand Down
43 changes: 0 additions & 43 deletions graylog2-radio/src/main/java/org/graylog2/radio/RadioVersion.java

This file was deleted.

Expand Up @@ -32,6 +32,7 @@
import org.graylog2.radio.buffers.processors.RadioProcessBufferProcessor;
import org.graylog2.radio.inputs.InputStateListener;
import org.graylog2.radio.inputs.PersistedInputsImpl;
import org.graylog2.radio.security.RadioSecurityContextFactory;
import org.graylog2.radio.system.activities.NullActivityWriter;
import org.graylog2.radio.transports.RadioTransport;
import org.graylog2.radio.users.NullUserServiceImpl;
Expand Down Expand Up @@ -60,8 +61,8 @@ protected void configure() {
bindSingletons();
bindTransport();
bind(ProcessBufferProcessor.class).to(RadioProcessBufferProcessor.class);
SecurityContextFactory instance = null;
bind(SecurityContextFactory.class).toProvider(Providers.of(instance));
//SecurityContextFactory instance = null;
//bind(SecurityContextFactory.class).toProvider(Providers.of(instance));
bindDynamicFeatures();
bindContainerResponseFilters();
bindExceptionMappers();
Expand All @@ -73,6 +74,7 @@ private void bindInterfaces() {
bind(ActivityWriter.class).to(NullActivityWriter.class);
bind(PersistedInputs.class).to(PersistedInputsImpl.class);
bind(UserService.class).to(NullUserServiceImpl.class);
bind(SecurityContextFactory.class).to(RadioSecurityContextFactory.class);
}

private void bindEventBusListeners() {
Expand Down
Expand Up @@ -35,6 +35,7 @@
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException;

public class PersistedInputsImpl implements PersistedInputs {
private static final Logger LOG = LoggerFactory.getLogger(PersistedInputsImpl.class);
Expand Down Expand Up @@ -122,6 +123,22 @@ public boolean add(MessageInput input) {

@Override
public boolean remove(Object o) {
if (o instanceof MessageInput) {
final MessageInput messageInput = (MessageInput)o;
try {
inputService.unregisterInCluster(messageInput);
} catch (ExecutionException | InterruptedException | IOException e) {
LOG.error("Could not unregister input in Graylog2 cluster: ", e);
return false;
}

return true;
}
return false;
}

@Override
public boolean update(String id, MessageInput newInput) {
return false;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 286b7c3

Please sign in to comment.