Skip to content

Commit

Permalink
Merge pull request #730 from amitjoy/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
amitjoy committed Jan 29, 2024
2 parents 03d5f28 + 66fc94a commit 622ce15
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 56 deletions.
66 changes: 27 additions & 39 deletions cnf/ext/runtime.bnd
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
bundles.equinox: \
org.eclipse.equinox.app,\
org.eclipse.equinox.common,\
org.eclipse.equinox.event,\
org.eclipse.equinox.preferences,\
org.eclipse.equinox.registry

bundles.console: \
org.apache.felix.gogo.runtime,\
org.apache.felix.gogo.shell,\
org.apache.felix.gogo.command,\
org.eclipse.equinox.console

bundles.deps: \
bundles.javax: \
javax.annotation,\
javax.inject,\
javax.xml.jre,\
org.apache.commons.jxpath,\
com.google.guava,\
org.eclipse.jdt.annotation

bundles.eclipse.emf: \
org.eclipse.emf.common,\
org.eclipse.emf.ecore,\
org.eclipse.emf.ecore.change,\
org.eclipse.emf.ecore.xmi
javax.inject

bundles.eclipse.core: \
org.eclipse.core.commands,\
Expand Down Expand Up @@ -73,26 +50,37 @@ bundles.e4.efxclipse: \
bundles.slf4j: \
org.eclipse.fx.core.slf4j

bundles.apache.commons: \
org.apache.commons.lang3,\
org.apache.commons.commons-io,\
org.apache.commons.text

bundles.ui.3rdparty: \
controlsfx,\
eu.hansolo.tilesfx,\

bundles.wrapper: \
com.osgifx.console.wrapper.mug,\
com.osgifx.console.wrapper.formsfx

bundles.configurations: \
org.apache.felix.configadmin,\
org.apache.felix.configurator

bundles.felix: \
${bundles.configurations},\
org.apache.felix.dependencymanager

bundles.required: \
${bundles.e4.core},\
${bundles.e4.efxclipse},\
${bundles.deps},\
${bundles.javax},\
${bundles.eclipse.core},\
${bundles.slf4j},\
${bundles.apache.commons},\
${bundles.ui.3rdparty},\
${bundles.wrapper},\
com.google.guava,\
org.apache.aries.component-dsl.component-dsl,\
org.apache.commons.lang3,\
org.apache.commons.commons-io,\
org.apache.commons.text,\
org.eclipse.equinox.preferences,\
controlsfx,\
javax.inject,\
com.osgifx.console.util,\
com.osgifx.console.wrapper.mug,\
eu.hansolo.tilesfx,\
com.osgifx.console.wrapper.formsfx,\
org.apache.felix.dependencymanager

bundles.configurations: \
org.apache.felix.configadmin,\
org.apache.felix.configurator
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

public final class SimpleMqtt5Subscriber implements Mqtt5Subscriber {

private final BundleContext bundleContext;
private ServiceTracker<MessageSubscription, MessageSubscription> subscriberTracker;
private final BundleContext bundleContext;

public SimpleMqtt5Subscriber(final BundleContext bundleContext) {
this.bundleContext = bundleContext;
Expand All @@ -40,9 +39,10 @@ public SimpleMqtt5Subscriber(final BundleContext bundleContext) {
public PushStream<Mqtt5Message> subscribe(final String channel) {
final PushStreamProvider provider = new PushStreamProvider();
final SimplePushEventSource<Mqtt5Message> source = acquirePushEventSource(provider);
subscriberTracker = new ServiceTracker<MessageSubscription, MessageSubscription>(bundleContext,
MessageSubscription.class,
null) {

final ServiceTracker<MessageSubscription, MessageSubscription> subscriberTracker = new ServiceTracker<MessageSubscription, MessageSubscription>(bundleContext,
MessageSubscription.class,
null) {
@Override
public MessageSubscription addingService(final ServiceReference<MessageSubscription> reference) {
final MessageSubscription service = super.addingService(reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum RpcType {
String EVENT_LISTENER_REMOVED_EVENT_TOPIC = "fx/console/supervisor/event/listener/removed";

/**
* Returns the type of the communication
* Returns the type of the RPC communication
*/
RpcType getType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private <T> T getInstance(final Class<T> requestedType, final Class<?> parent) {
}
return (T) instanceFromProvider;
}
return (T) createNewInstance(type, parent);
return (T) createNewInstance(type);
} catch (final DiException rootCause) {
final StringBuilder errorMessage = new StringBuilder("DI wasn't able to create your class hierarchy. ");
if (parent != null) {
Expand All @@ -163,7 +163,7 @@ private <T> T getInstance(final Class<T> requestedType, final Class<?> parent) {
/**
* Create a new instance of the given type.
*/
private <T> T createNewInstance(final Class<T> type, final Class<?> parent) {
private <T> T createNewInstance(final Class<T> type) {
final Constructor<T> constructor = findConstructor(type);
final Parameter[] parameters = constructor.getParameters();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,23 @@ public List<GraphPath<ComponentVertex, DefaultEdge>> getAllServiceComponentsThat
return paths.getAllPaths(vertices, requirerGraph.vertexSet(), true, null);
}

@SuppressWarnings("unused")
public Graph<ComponentVertex, DefaultEdge> getAllCycles() {
final var tarjan = new TarjanSimpleCycles<>(requirerGraph);
final var cycles = tarjan.findSimpleCycles();
final Graph<ComponentVertex, DefaultEdge> graph = new DefaultDirectedGraph<>(DefaultEdge.class);

for (final List<ComponentVertex> group : cycles) {
Node<ComponentVertex> node = CircularLinkedList.create(group);
for (@SuppressWarnings("unused")
final ComponentVertex element : group) {
node = node.getNext();
final var source = node.getData();
graph.addVertex(source);
final var target = node.getNext().getData();
graph.addVertex(target);
graph.addEdge(source, target);
if (node != null) {
for (final ComponentVertex element : group) {
node = node.getNext();
final var source = node.getData();
graph.addVertex(source);
final var target = node.getNext().getData();
graph.addVertex(target);
graph.addEdge(source, target);
}
}
}
return graph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Parent createContent() {
final var used = usage.used / KB_CONVERSION;
final var max = usage.max / KB_CONVERSION;

final double tickSize = max / Y_AXIS_TICK_COUNT;
final var tickSize = (double) max / Y_AXIS_TICK_COUNT;
final var rounding = 10d;

Platform.runLater(() -> {
Expand Down

0 comments on commit 622ce15

Please sign in to comment.