package org.allmyinfo.nature.linkHandler;

import org.allmyinfo.link.handler.LinkHandler;
import org.allmyinfo.nature.Nature;
import org.allmyinfo.nodes.NodeId;
import org.allmyinfo.nodes.database.NodesTransaction;
import org.allmyinfo.util.osgi.reactor.BaseReactor;
import org.eclipse.jdt.annotation.NonNull;
import org.osgi.framework.BundleContext;

public interface LinkHandlerNature extends Nature {
	LinkHandler getLinkHandler(@NonNull NodesTransaction txn, @NonNull NodeId nodeId);

	@NonNull
	NodeId insertNode(@NonNull NodesTransaction txn, @NonNull String name);

	public static class Reactor extends BaseReactor {
		@SuppressWarnings("null")
		public Reactor(final @NonNull BundleContext bundleContext,
				final @NonNull LinkHandlerNature defaultInstance) {
			super(bundleContext, LinkHandlerNature.class.getName(), null, defaultInstance);
		}

		@Override
		public @NonNull LinkHandlerNature getInstance() {
			return (LinkHandlerNature) super.getInstance();
		}
	}
}
