Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied skeletal implementation to interface migration automated refactoring #747

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ public interface StatReplicator extends RemoteTCPClientProxy, ServiceFlushable,

void replicateLevel(String name, long level, long time);

void replicateTiming(String name, long timing, long time);
default void replicateTiming(String name, long level, long time) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@ public final void replicateCount(String name, long count, long now) {
@Override
public final void replicateLevel(String name, long level, long now) {
}

@Override
public void replicateTiming(String name, long level, long time) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
package io.advantageous.qbit.boon.client;

import io.advantageous.boon.core.Sys;
import io.advantageous.qbit.client.BeforeMethodSent;
import io.advantageous.qbit.client.Client;
import io.advantageous.qbit.http.client.HttpClient;
import io.advantageous.qbit.spi.ClientFactory;

public class BoonClientFactory implements ClientFactory {
Expand All @@ -30,13 +27,4 @@ public class BoonClientFactory implements ClientFactory {
* Holds on to Boon cache so we don't have to recreate reflected gak.
*/
Object context = Sys.contextToHold();


@Override
public Client create(final String uri,
final HttpClient httpClient,
final int requestBatchSize,
final BeforeMethodSent beforeMethodSent) {
return new BoonClient(uri, httpClient, requestBatchSize, beforeMethodSent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ public class BoonEventBusProxyCreator implements EventBusProxyCreator {
*/
Object context = Sys.contextToHold();

@Override
public <T> T createProxy(final EventManager eventManager, final Class<T> eventBusProxyInterface) {

return createProxyWithChannelPrefix(eventManager, eventBusProxyInterface, null);
}

@Override
public <T> T createProxyWithChannelPrefix(final EventManager eventManager, final Class<T> eventBusProxyInterface,
final String channelPrefix) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.advantageous.boon.core.Str;
import io.advantageous.boon.core.Sys;
import io.advantageous.boon.core.reflection.AnnotationData;
import io.advantageous.boon.core.reflection.BeanUtils;
import io.advantageous.boon.core.reflection.ClassMeta;
import io.advantageous.boon.core.reflection.MethodAccess;
import io.advantageous.qbit.GlobalConstants;
Expand All @@ -47,7 +46,6 @@

import static io.advantageous.boon.core.reflection.ClassMeta.classMeta;
import static io.advantageous.qbit.annotation.AnnotationUtils.*;
import static io.advantageous.qbit.service.ServiceContext.serviceContext;

/**
* @author rhightower
Expand Down Expand Up @@ -206,13 +204,6 @@ public void joinService(final ServiceQueue serviceQueue) {
}


@Override
public void leave() {
final ServiceQueue serviceQueue = serviceContext().currentService();
leaveEventBus(serviceQueue);
}


@Override
public void leaveEventBus(final ServiceQueue serviceQueue) {
if (serviceQueue == null) {
Expand Down Expand Up @@ -495,13 +486,6 @@ private List<Object> events(String channel) {
return events;
}

@Override
public <T> void sendCopy(String channel, T event) {

T copy = BeanUtils.copy(event);
this.send(channel, copy);
}

@Override
public void forwardEvent(final EventTransferObject<Object> event) {
messageCountSinceLastFlush++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,4 @@ private InvocationHandler createInvocationHandler(Class<?> serviceInterface,
}


@Override
public <T> T createProxy(Class<T> serviceInterface, String serviceName, EndPoint endPoint, BeforeMethodSent beforeMethodSent) {
return createProxyWithReturnAddress(serviceInterface, serviceName, "local", 0, new AtomicBoolean(true), "", endPoint, beforeMethodSent);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@ public List<Message<Object>> parse(String address, String args) {

}

@Override
public List<MethodCall<Object>> parseMethodCalls(String address, String body) {
//noinspection unchecked
return (List<MethodCall<Object>>) (Object) parse(address, body);
}

@Override
public List<Response<Object>> parseResponses(String address, String body) {
//noinspection unchecked
return (List<Response<Object>>) (Object) parse(address, body);
}


private Response<Object> parseResponseFromChars(char[] args, final String returnAddress) {
final char[][] chars = CharScanner.splitFromStartWithLimit(args, (char) PROTOCOL_SEPARATOR, 0, RESPONSE_RETURN);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ <T> T createProxyWithReturnAddress(Class<T> serviceInterface,
EndPoint serviceBundle,
BeforeMethodSent beforeMethodSent);

<T> T createProxy(Class<T> serviceInterface,
default <T> T createProxy(Class<T> serviceInterface,
String serviceName,
EndPoint serviceBundle,
BeforeMethodSent beforeMethodSent);
EndPoint endPoint,
BeforeMethodSent beforeMethodSent) {
return createProxyWithReturnAddress(serviceInterface, serviceName, "local", 0, new AtomicBoolean(true), "", endPoint, beforeMethodSent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ default <T> T createProxy(final Class<T> eventBusProxyInterface) {
return createProxy(QBit.factory().systemEventManager(), eventBusProxyInterface);
}

<T> T createProxy(final EventManager eventManager, final Class<T> eventBusProxyInterface);
default <T> T createProxy(final EventManager eventManager, final Class<T> eventBusProxyInterface) {

return createProxyWithChannelPrefix(eventManager, eventBusProxyInterface, null);
}


<T> T createProxyWithChannelPrefix(final EventManager eventManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package io.advantageous.qbit.events;

import static io.advantageous.qbit.service.ServiceContext.serviceContext;

import io.advantageous.boon.core.reflection.BeanUtils;
import io.advantageous.qbit.events.spi.EventTransferObject;
import io.advantageous.qbit.service.ServiceQueue;

Expand Down Expand Up @@ -57,7 +60,10 @@ default void joinServices(ServiceQueue... serviceQueues) {
/**
* Opposite of join. ONLY FOR SERVICES.
*/
void leave();
default void leave() {
final ServiceQueue serviceQueue = serviceContext().currentService();
leaveEventBus(serviceQueue);
}

/**
* This method can be called outside of a service.
Expand Down Expand Up @@ -131,7 +137,11 @@ default void joinServices(ServiceQueue... serviceQueues) {
* @param event event
* @param <T> T
*/
<T> void sendCopy(String channel, T event);
default <T> void sendCopy(String channel, T event) {

T copy = BeanUtils.copy(event);
this.send(channel, copy);
}


void forwardEvent(EventTransferObject<Object> event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ public T body() {
return body;
}

@Override
public boolean isSingleton() {
return true;
}

@Override
public String toString() {
return "EventImpl{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ default void setShouldContinueWebSocket(Predicate<WebSocket> predicate) {

void setHttpRequestsIdleConsumer(Consumer<Void> idleConsumer);

void setWebSocketIdleConsume(Consumer<Void> idleConsumer);
default void setWebSocketIdleConsume(Consumer<Void> idleConsumer) {

}

default HttpTransport startTransport() {
start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ public MultiMap<String, String> getFormParams() {
return formParams();
}

@Override
public boolean hasParams() {
return false;
}

@Override
public boolean hasHeaders() {
return false;
}

@Override
public long timestamp() {
return timestamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ public MultiMap<String, String> headers() {
return MultiMap.empty();
}

@Override
public boolean hasParams() {
return false;
}

@Override
public boolean hasHeaders() {
return false;
}

@Override
public long timestamp() {
return timestamp;
Expand All @@ -125,11 +115,6 @@ public Object body() {
return message;
}

@Override
public boolean isSingleton() {
return true;
}

public String getUri() {
return uri;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public interface Message<T> {

T body(); //Body could be a Map for parameters for forms or JSON or bytes[] or String

boolean isSingleton();
default boolean isSingleton() {
return true;
}


default MultiMap<String, String> params() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public interface MethodCall<T> extends Request<T> {

long timestamp();

String objectName();
default String objectName() {
return "";
}

boolean hasCallback();

Expand Down
16 changes: 12 additions & 4 deletions qbit/core/src/main/java/io/advantageous/qbit/message/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,23 @@ default Request<Object> originatingRequest() {
}


boolean hasParams();
default boolean hasParams() {
return false;
}

boolean hasHeaders();
default boolean hasHeaders() {
return false;
}

long timestamp();

boolean isHandled();
default boolean isHandled() {
return false;
}

void handled();
default void handled() {

}

default boolean hasCallback() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,6 @@ public long timestamp() {
return timestamp;
}

@Override
public boolean isHandled() {
return false;
}

@Override
public void handled() {

}

@Override
public String objectName() {
return objectName;
Expand Down Expand Up @@ -154,11 +144,6 @@ public void originatingRequest(Request<Object> originatingRequest) {
this.originatingRequest = originatingRequest;
}

@Override
public boolean isSingleton() {
return true;
}

public boolean hasParams() {
return params != null && params.size() > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,11 @@ public MultiMap<String, String> headers() {
return null;
}

@Override
public boolean hasParams() {
return false;
}

@Override
public boolean hasHeaders() {
return false;
}

@Override
public long timestamp() {
return timestamp;
}

@Override
public boolean isHandled() {
return false;
}

@Override
public void handled() {
}

@Override
public String objectName() {
return "";
}

@Override
public Request<Object> originatingRequest() {
return originatingRequest;
Expand All @@ -128,9 +104,4 @@ public long id() {
public Object body() {
return arguments;
}

@Override
public boolean isSingleton() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ public T body() {
}
}

@Override
public boolean isSingleton() {
return true;
}

@Override
public boolean wasErrors() {
return errors;
Expand Down
Loading