Skip to content

Commit

Permalink
move jndi view to runtime category
Browse files Browse the repository at this point in the history
  • Loading branch information
heiko-braun committed Aug 7, 2012
1 parent 1ed7134 commit 16df2cd
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@
import org.jboss.as.console.client.shared.subsys.logging.HandlerListManager;
import org.jboss.as.console.client.shared.subsys.logging.LoggingPresenter;
import org.jboss.as.console.client.shared.subsys.mail.MailPresenter;
import org.jboss.as.console.client.shared.subsys.messaging.CommonMsgPresenter;
import org.jboss.as.console.client.shared.subsys.messaging.MsgDestinationsPresenter;
import org.jboss.as.console.client.shared.subsys.messaging.cluster.MsgClusteringPresenter;
import org.jboss.as.console.client.shared.subsys.messaging.connections.MsgConnectionsPresenter;
import org.jboss.as.console.client.shared.subsys.modcluster.ModclusterPresenter;
import org.jboss.as.console.client.shared.subsys.naming.JndiPresenter;
import org.jboss.as.console.client.shared.runtime.naming.JndiPresenter;
import org.jboss.as.console.client.shared.subsys.osgi.config.OSGiConfigurationPresenter;
import org.jboss.as.console.client.shared.subsys.osgi.runtime.OSGiRuntimePresenter;
import org.jboss.as.console.client.shared.subsys.security.SecurityDomainsPresenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@
import org.jboss.as.console.client.shared.subsys.messaging.connections.MsgConnectionsView;
import org.jboss.as.console.client.shared.subsys.modcluster.ModclusterPresenter;
import org.jboss.as.console.client.shared.subsys.modcluster.ModclusterView;
import org.jboss.as.console.client.shared.subsys.naming.JndiPresenter;
import org.jboss.as.console.client.shared.subsys.naming.JndiView;
import org.jboss.as.console.client.shared.runtime.naming.JndiPresenter;
import org.jboss.as.console.client.shared.runtime.naming.JndiView;
import org.jboss.as.console.client.shared.subsys.osgi.config.OSGiConfigurationPresenter;
import org.jboss.as.console.client.shared.subsys.osgi.config.OSGiSubsystemView;
import org.jboss.as.console.client.shared.subsys.osgi.runtime.OSGiRuntimePresenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ public Widget asWidget()
LHSNavTreeItem web = new LHSNavTreeItem("Web", NameTokens.WebMetricPresenter);
LHSNavTreeItem tx = new LHSNavTreeItem("Transactions", NameTokens.TXMetrics);
LHSNavTreeItem jpa = new LHSNavTreeItem("JPA", NameTokens.JPAMetricPresenter);
LHSNavTreeItem naming = new LHSNavTreeItem("JNDI View", NameTokens.JndiPresenter);


metricPredicates.add(new Predicate("datasources", datasources));
metricPredicates.add(new Predicate("messaging", jmsQueues));
metricPredicates.add(new Predicate("web", web));
metricPredicates.add(new Predicate("transactions", tx));
metricPredicates.add(new Predicate("jpa", jpa));
metricPredicates.add(new Predicate("naming", naming));

// ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.subsys.naming;
package org.jboss.as.console.client.shared.runtime.naming;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.subsys.naming;
package org.jboss.as.console.client.shared.runtime.naming;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.cellview.client.CellTree;
Expand All @@ -31,27 +31,35 @@
import com.gwtplatform.mvp.client.proxy.Proxy;
import org.jboss.as.console.client.Console;
import org.jboss.as.console.client.core.NameTokens;
import org.jboss.as.console.client.domain.model.ServerInstance;
import org.jboss.as.console.client.domain.model.SimpleCallback;
import org.jboss.as.console.client.shared.BeanFactory;
import org.jboss.as.console.client.shared.dispatch.DispatchAsync;
import org.jboss.as.console.client.shared.dispatch.impl.DMRAction;
import org.jboss.as.console.client.shared.dispatch.impl.DMRResponse;
import org.jboss.as.console.client.shared.runtime.RuntimeBaseAddress;
import org.jboss.as.console.client.shared.state.CurrentServerSelection;
import org.jboss.as.console.client.shared.state.ServerSelectionEvent;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.as.console.client.shared.subsys.RevealStrategy;
import org.jboss.dmr.client.ModelNode;

import java.util.Collections;

import static org.jboss.dmr.client.ModelDescriptionConstants.*;

/**
* @author Heiko Braun
* @date 7/20/11
*/
public class JndiPresenter extends Presenter<JndiPresenter.MyView, JndiPresenter.MyProxy> {
public class JndiPresenter extends Presenter<JndiPresenter.MyView, JndiPresenter.MyProxy>
implements ServerSelectionEvent.ServerSelectionListener {

private final PlaceManager placeManager;
private RevealStrategy revealStrategy;
private DispatchAsync dispatcher;
private BeanFactory factory;
private CurrentServerSelection serverSelection;

@ProxyCodeSplit
@NameToken(NameTokens.JndiPresenter)
Expand All @@ -61,29 +69,44 @@ public interface MyProxy extends Proxy<JndiPresenter>, Place {
public interface MyView extends View {
void setPresenter(JndiPresenter presenter);
void setJndiTree(CellTree tree, SingleSelectionModel<JndiEntry> selectionModel);

void clearValues();
}

@Inject
public JndiPresenter(
EventBus eventBus, MyView view, MyProxy proxy,
PlaceManager placeManager, RevealStrategy revealStrategy,
DispatchAsync dispatcher, BeanFactory factory) {
DispatchAsync dispatcher, BeanFactory factory,
CurrentServerSelection serverSelection) {

super(eventBus, view, proxy);

this.placeManager = placeManager;
this.revealStrategy = revealStrategy;
this.dispatcher = dispatcher;
this.factory = factory;
this.serverSelection = serverSelection;

}

@Override
public void onServerSelection(String hostName, ServerInstance server) {
if(isVisible())
{
System.out.println(hostName+">"+server.getName());

loadJndiTree();
}
}

@Override
protected void onBind() {
super.onBind();
getView().setPresenter(this);
}
getEventBus().addHandler(ServerSelectionEvent.TYPE, this);

}

@Override
protected void onReset() {
Expand All @@ -92,12 +115,19 @@ protected void onReset() {
}

private void loadJndiTree() {

getView().clearValues();

if(!serverSelection.isActive()) {
Console.warning(Console.CONSTANTS.common_err_server_not_active());
return;
}

ModelNode operation = new ModelNode();
operation.get(OP).set("jndi-view");
operation.get(ADDRESS).set(Baseadress.get());
operation.get(ADDRESS).set(RuntimeBaseAddress.get());
operation.get(ADDRESS).add("subsystem", "naming");


dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() {
@Override
public void onSuccess(DMRResponse dmrResponse) {
Expand Down Expand Up @@ -126,6 +156,6 @@ public void onSuccess(DMRResponse dmrResponse) {

@Override
protected void revealInParent() {
revealStrategy.revealInParent(this);
revealStrategy.revealInRuntimeParent(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.subsys.naming;
package org.jboss.as.console.client.shared.runtime.naming;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.subsys.naming;
package org.jboss.as.console.client.shared.runtime.naming;

import com.google.gwt.user.cellview.client.CellTree;
import com.google.gwt.user.cellview.client.TreeNode;
Expand Down Expand Up @@ -107,4 +107,9 @@ private void walk(TreeNode node) {
}
}
}

@Override
public void clearValues() {
container.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ public Widget asWidget()
LHSNavTreeItem tx = new LHSNavTreeItem("Transactions", "tx-metrics");
LHSNavTreeItem jpa = new LHSNavTreeItem("JPA", NameTokens.JPAMetricPresenter);
LHSNavTreeItem ws = new LHSNavTreeItem("Webservices", NameTokens.WebServiceRuntimePresenter);
LHSNavTreeItem naming = new LHSNavTreeItem("JNDI View", NameTokens.JndiPresenter);

metricPredicates.add(new Predicate("datasources", datasources));
metricPredicates.add(new Predicate("messaging", jmsQueues));
metricPredicates.add(new Predicate("web", web));
metricPredicates.add(new Predicate("transactions", tx));
metricPredicates.add(new Predicate("jpa", jpa));
metricPredicates.add(new Predicate("webservices", ws));
metricPredicates.add(new Predicate("naming", naming));

navigation.addItem(metricLeaf);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jboss.as.console.client.shared.subsys.naming;
package org.jboss.as.console.client.shared.runtime.naming;

import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.cellview.client.CellTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;

import org.jboss.as.console.client.shared.subsys.naming.JndiTreeParserTest;
import org.jboss.as.console.client.shared.runtime.naming.JndiTreeParserTest;
import org.jboss.as.console.client.shared.viewframework.EntityToDmrBridgeImplTest;

/**
Expand Down

0 comments on commit 16df2cd

Please sign in to comment.