Author: rob.stryker(a)jboss.com
Date: 2012-02-07 09:49:27 -0500 (Tue, 07 Feb 2012)
New Revision: 38466
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/ModelDescriptionConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributeNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributesContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContainerNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNodePropertyTester.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ErrorNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributeNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributesContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContainerNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContentNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IErrorNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IResourceNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ITypeNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/RefreshActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ResourceNode.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentTreeContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/TypeNode.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/IJBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
JBIDE-10799 - contribution by cernich
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -267,7 +267,7 @@
StreamUtils.safeClose(client);
}
- private ModelNode execute(ModelNode node) throws JBoss7ManangerException {
+ /*package*/ ModelNode execute(ModelNode node) throws JBoss7ManangerException {
try {
ModelNode response = client.execute(node);
if (!AS7ManagerUtil.isSuccess(response)) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -13,6 +13,7 @@
import java.io.File;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.management.core.IAS7ManagementDetails;
import org.jboss.ide.eclipse.as.management.core.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.management.core.IJBoss7ManagerService;
@@ -110,7 +111,16 @@
}
}
- @Override
+ public String execute(IAS7ManagementDetails details, String request) throws Exception
{
+ AS71Manager manager = new AS71Manager(details);
+ try {
+ return
manager.execute(ModelNode.fromJSONString(request)).toJSONString(true);
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ @Override
public void dispose() {
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/IJBoss7ManagerService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/IJBoss7ManagerService.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/IJBoss7ManagerService.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -124,6 +124,17 @@
* @throws Exception
*/
public void stop(IAS7ManagementDetails details) throws Exception;
+
+ /**
+ * Execute a management command. Note, this method returns the "result"
node
+ * from the execution.
+ *
+ * @param details connection details.
+ * @param request a JSON request to process.
+ * @return the JSON response from the server.
+ * @throws Exception
+ */
+ public String execute(IAS7ManagementDetails details, String request) throws Exception;
public void dispose();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -75,7 +75,11 @@
checkedGetService().stop(details);
}
- private IJBoss7ManagerService checkedGetService() throws JBoss7ManangerException {
+ public String execute(IAS7ManagementDetails details, String request) throws Exception
{
+ return checkedGetService().execute(details, request);
+ }
+
+ private IJBoss7ManagerService checkedGetService() throws JBoss7ManangerException {
IJBoss7ManagerService service = getService();
if (service == null) {
throw new JBoss7ManangerException("Could not acquire JBoss Management
service"); //$NON-NLS-1$
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/ModelDescriptionConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/ModelDescriptionConstants.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/ModelDescriptionConstants.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.management.core;
+
+
+/**
+ * String constants frequently used in model descriptions.
+ *
+ * @author Brian Stansberry
+ */
+public class ModelDescriptionConstants {
+
+ // KEEP THESE IN ALPHABETICAL ORDER!
+
+ /** The key for {@link AttributeAccess.AccessType} fields. */
+ public static final String ACCESS_TYPE = "access-type";
+ public static final String ADD = "add";
+ public static final String ADD_OPERATION = "add-operation";
+ public static final String ADDRESS = "address";
+ public static final String ANY = "any";
+ public static final String ANY_ADDRESS = "any-address";
+ public static final String ANY_IPV4_ADDRESS = "any-ipv4-address";
+ public static final String ANY_IPV6_ADDRESS = "any-ipv6-address";
+ public static final String ATTRIBUTES = "attributes";
+ public static final String AUTO_START = "auto-start";
+ public static final String BYTES = "bytes";
+ public static final String CANCELLED = "cancelled";
+ public static final String CHILD_TYPE = "child-type";
+ public static final String CHILDREN = "children";
+ public static final String COMPOSITE = "composite";
+ public static final String CONCURRENT_GROUPS = "concurrent-groups";
+ public static final String CPU_AFFINITY = "cpu-affinity";
+ public static final String CRITERIA = "criteria";
+ public static final String COMPENSATING_OPERATION =
"compensating-operation";
+ public static final String DEFAULT = "default";
+ public static final String DESCRIBE = "describe";
+ public static final String DEFAULT_INTERFACE = "default-interface";
+ public static final String DEPLOY = "deploy";
+ public static final String DEPLOYMENT = "deployment";
+ public static final String DEPLOYMENT_SCANNER = "deployment-scanner";
+ public static final String DESCRIPTION = "description";
+ public static final String DISABLE = "disable";
+ public static final String DOMAIN_CONTROLLER = "domain-controller";
+ public static final String DOMAIN_FAILURE_DESCRIPTION =
"domain-failure-description";
+ public static final String DOMAIN_RESULTS = "domain-results";
+ public static final String ENABLE = "enable";
+ public static final String ENABLED = "enabled";
+ public static final String EXTENSION = "extension";
+ public static final String FAILED = "failed";
+ public static final String FAILURE_DESCRIPTION = "failure-description";
+ public static final String FIXED_PORT = "fixed-port";
+ public static final String FULL_REPLACE_DEPLOYMENT =
"full-replace-deployment";
+ public static final String GRACEFUL_SHUTDOWN_TIMEOUT =
"graceful-shutdown-timeout";
+ public static final String GROUP = "group";
+ public static final String HASH = "hash";
+ public static final String HEAD_COMMENT_ALLOWED = "head-comment-allowed";
+ public static final String HTTP_INTERFACE = "http-interface";
+ public static final String HOST = "host";
+ public static final String HOST_FAILURE_DESCRIPTION =
"host-failure-description";
+ public static final String HOST_FAILURE_DESCRIPTIONS =
"host-failure-descriptions";
+ public static final String IGNORED = "ignored";
+ public static final String INCLUDE = "include";
+ public static final String INCLUDES = "includes";
+ public static final String INCLUDE_RUNTIME = "include-runtime";
+ public static final String INET_ADDRESS = "inet-address";
+ public static final String INPUT_STREAM_INDEX = "input-stream-index";
+ public static final String INTERFACE = "interface";
+ public static final String IN_SERIES = "in-series";
+ public static final String JVM = "jvm";
+ public static final String JVM_TYPE = "type";
+ public static final String LOCAL = "local";
+ public static final String LOCALE = "locale";
+ public static final String MANAGEMENT_INTERFACES =
"management-interfaces";
+ public static final String MASK = "mask";
+ public static final String MAX = "max";
+ public static final String MAX_FAILED_SERVERS = "max-failed-servers";
+ public static final String MAX_FAILURE_PERCENTAGE =
"max-failure-percentage";
+ public static final String MAX_LENGTH = "max-length";
+ public static final String MAX_OCCURS = "max-occurs";
+ public static final String MAX_THREADS = "max-threads";
+ public static final String MIN = "min";
+ public static final String MIN_LENGTH = "min-length";
+ public static final String MIN_OCCURS = "min-occurs";
+ public static final String MIN_VALUE = "min-value";
+ public static final String MODEL_DESCRIPTION = "model-description";
+ public static final String MULTICAST_ADDRESS = "multicast-address";
+ public static final String MULTICAST_PORT = "multicast-port";
+ public static final String NAME = "name";
+ public static final String NAMESPACE = "namespace";
+ public static final String NAMESPACES = "namespaces";
+ public static final String NATIVE_INTERFACE = "native-interface";
+ public static final String NETWORK = "network";
+ public static final String NILLABLE = "nillable";
+ public static final String NOT = "not";
+ /** Use this as the standard operation name field in the operation *request*
ModelNode */
+ public static final String OP = "operation";
+ /** Use this standard operation address field in the operation *request* ModelNode
*/
+ public static final String OP_ADDR = "address";
+ public static final String OPERATIONS = "operations";
+ public static final String OPERATION_HEADERS = "operation-headers";
+ /** Use this standard operation address field in the operation *description*
ModelNode */
+ public static final String OPERATION_NAME = "operation-name";
+ public static final String OUTCOME = "outcome";
+ public static final String PATH = "path";
+ public static final String PORT = "port";
+ public static final String PORT_OFFSET = "port-offset";
+ public static final String PRIORITY = "priority";
+ public static final String PROFILE = "profile";
+ public static final String PROFILE_NAME = "profile-name";
+ public static final String READ_ATTRIBUTE_OPERATION = "read-attribute";
+ public static final String READ_CHILDREN_NAMES_OPERATION =
"read-children-names";
+ public static final String READ_CHILDREN_TYPES_OPERATION =
"read-children-types";
+ public static final String READ_CHILDREN_RESOURCES_OPERATION =
"read-children-resources";
+ public static final String READ_CONFIG_AS_XML_OPERATION =
"read-config-as-xml";
+ public static final String READ_OPERATION_DESCRIPTION_OPERATION =
"read-operation-description";
+ public static final String READ_OPERATION_NAMES_OPERATION =
"read-operation-names";
+ public static final String READ_RESOURCE_DESCRIPTION_OPERATION =
"read-resource-description";
+ public static final String READ_RESOURCE_METRICS =
"read-resource-metrics";
+ public static final String READ_RESOURCE_OPERATION = "read-resource";
+ public static final String REDEPLOY = "redeploy";
+ public static final String RELATIVE_TO = "relative-to";
+ public static final String REMOVE = "remove";
+ public static final String REMOTE = "remote";
+ public static final String REPLACE_DEPLOYMENT = "replace-deployment";
+ public static final String REPLY_PROPERTIES = "reply-properties";
+ public static final String REQUEST_PROPERTIES = "request-properties";
+ public static final String RECURSIVE = "recursive";
+ public static final String REQUIRED = "required";
+ public static final String RESPONSE = "response";
+ public static final String RESULT = "result";
+ public static final String ROLLBACK_ACROSS_GROUPS =
"rollback-across-groups";
+ public static final String ROLLBACK_FAILURE_DESCRIPTION =
"rollback-failure-description";
+ public static final String ROLLBACK_ON_RUNTIME_FAILURE =
"rollback-on-runtime-failure";
+ public static final String ROLLED_BACK = "rolled-back";
+ public static final String ROLLING_TO_SERVERS = "rolling-to-servers";
+ public static final String ROLLOUT_PLAN = "rollout-plan";
+ public static final String RUNTIME_NAME = "runtime-name";
+ public static final String RUNNING_SERVER = "server";
+ public static final String SCANNER = "scanner";
+ public static final String SCAN_ENABLED = "scan-enabled";
+ public static final String SCAN_INTERVAL = "scan-interval";
+ public static final String SCHEMA_LOCATION = "schema-location";
+ public static final String SCHEMA_LOCATIONS = "schema-locations";
+ public static final String SERVER = "server";
+ public static final String SERVERS = "servers";
+ public static final String SERVER_CONFIG = "server-config";
+ public static final String SERVER_GROUP = "server-group";
+ public static final String SERVER_GROUPS = "server-groups";
+ public static final String SERVER_OPERATIONS = "server-operations";
+ public static final String SERVER_STATE = "server-state";
+ public static final String SHUTDOWN = "shutdown";
+ public static final String SOCKET_BINDING = "socket-binding";
+ public static final String SOCKET_BINDING_GROUP = "socket-binding-group";
+ public static final String SOCKET_BINDING_GROUP_NAME =
"socket-binding-group-name";
+ public static final String SOCKET_BINDING_PORT_OFFSET =
"socket-binding-port-offset";
+ public static final String START = "start";
+ public static final String STEPS = "steps";
+ /** The key for {@link AttributeAccess.Storage} fields. */
+ public static final String STORAGE = "storage";
+ public static final String SUBSYSTEM = "subsystem";
+ public static final String SUCCESS = "success";
+ public static final String SYSTEM_PROPERTY = "system-property";
+ public static final String SYSTEM_PROPERTIES = "system-properties";
+ public static final String TAIL_COMMENT_ALLOWED = "tail-comment-allowed";
+ public static final String TO_REPLACE = "to-replace";
+ public static final String TYPE = "type";
+ public static final String UNDEPLOY = "undeploy";
+ public static final String UPLOAD_DEPLOYMENT_BYTES =
"upload-deployment-bytes";
+ public static final String UPLOAD_DEPLOYMENT_URL =
"upload-deployment-url";
+ public static final String UPLOAD_DEPLOYMENT_STREAM =
"upload-deployment-stream";
+ public static final String URL = "url";
+ public static final String VALUE = "value";
+ public static final String VALUE_TYPE = "value-type";
+ public static final String WRITE_ATTRIBUTE_OPERATION = "write-attribute";
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2012-02-07 14:42:48
UTC (rev 38465)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2012-02-07 14:49:27
UTC (rev 38466)
@@ -56,7 +56,8 @@
org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0",
org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
- org.jboss.ide.eclipse.as.management.core;bundle-version="1.0.0"
+ org.jboss.ide.eclipse.as.management.core;bundle-version="1.0.0",
+ org.jboss.ide.eclipse.as.dmr;bundle-version="2.3.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.console,
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -270,6 +270,23 @@
public static String ServerJavaArgsSyncText;
public static String ServerJavaArgsSyncDesc;
+ public static String ServerContent_Type_root;
+ public static String ServerContent_Type_attributes;
+ public static String ServerContent_Type_core_service;
+ public static String ServerContent_Type_deployment;
+ public static String ServerContent_Type_extension;
+ public static String ServerContent_Type_interface;
+ public static String ServerContent_Type_path;
+ public static String ServerContent_Type_socket_binding_group;
+ public static String ServerContent_Type_subsystem;
+ public static String ServerContent_Type_system_property;
+ public static String ServerContent_Value_undefined;
+ public static String ServerContent_Label_Attribute_Value;
+ public static String ServerContent_Label_Loading;
+ public static String ServerContent_Label_Not_Connected;
+ public static String ServerContent_Label_Retrieval_Error;
+ public static String ServerContent_Job_Title;
+
static {
NLS.initializeMessages(BUNDLE_NAME,
Messages.class);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2012-02-07
14:49:27 UTC (rev 38466)
@@ -243,4 +243,22 @@
ServerAlreadyStartedDialog_Launch=Launch a new instance anyway
ServerJavaArgsSyncText=Always update arguments related to the runtime.
-ServerJavaArgsSyncDesc=Some values on this tab refer to the server's runtime
location. JBossTools may attempt to update some program and vm arguments.
\ No newline at end of file
+ServerJavaArgsSyncDesc=Some values on this tab refer to the server's runtime
location. JBossTools may attempt to update some program and vm arguments.
+
+#Server content labels
+ServerContent_Type_root=Server Details
+ServerContent_Type_attributes=Attributes
+ServerContent_Type_core_service=Core Services
+ServerContent_Type_deployment=Deployments
+ServerContent_Type_extension=Extensions
+ServerContent_Type_interface=Interfaces
+ServerContent_Type_path=Paths
+ServerContent_Type_socket_binding_group=Socket Binding Groups
+ServerContent_Type_subsystem=Subsystems
+ServerContent_Type_system_property=System Properties
+ServerContent_Value_undefined=<undefined>
+ServerContent_Label_Attribute_Value={0} \: {1}
+ServerContent_Label_Loading=Loading...
+ServerContent_Label_Not_Connected=Not Connected
+ServerContent_Label_Retrieval_Error=Error retrieving children
+ServerContent_Job_Title=Retrieving information from the server
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributeNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributeNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributeNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * AttributeNode
+ *
+ * <p/>
+ * Represents and attribute of a resource.
+ *
+ * @author Rob Cernich
+ */
+public class AttributeNode extends ContentNode<IAttributesContainer> implements
IAttributeNode {
+
+ private final String value;
+
+ protected AttributeNode(IAttributesContainer parent, String name, String value) {
+ super(parent, name);
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributesContainer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributesContainer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/AttributesContainer.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import static org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP_ADDR;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.core.server.v7.management.AS7ManagementDetails;
+import org.jboss.ide.eclipse.as.management.core.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.core.JBoss7ManagerUtil;
+
+/**
+ * AttributesContainer
+ *
+ * <p/>
+ * Container node for resource attributes.
+ *
+ * @author Rob Cernich
+ */
+public class AttributesContainer extends ContainerNode<IResourceNode> implements
IAttributesContainer {
+
+ private List<String> attributeNames;
+ private List<IAttributeNode> attributes;
+
+ /**
+ * Create a new AttributesContainer.
+ *
+ * @param parent
+ * @param name
+ */
+ protected AttributesContainer(IResourceNode parent, List<String>
attributeNames) {
+ super(parent, ATTRIBUTES_TYPE);
+ this.attributeNames = attributeNames;
+ }
+
+ protected List<IAttributeNode> delegateGetChildren() {
+ return attributes;
+ }
+
+ protected void delegateClearChildren() {
+ if (attributes != null) {
+ for (IAttributeNode attribute : attributes) {
+ attribute.dispose();
+ }
+ attributes.clear();
+ attributes = null;
+ }
+ }
+
+ public void dispose() {
+ attributeNames.clear();
+ super.dispose();
+ }
+
+ protected void delegateLoad() throws Exception {
+ String resultJSON = JBoss7ManagerUtil.executeWithService(new
JBoss7ManagerUtil.IServiceAware<String>() {
+ public String execute(IJBoss7ManagerService service) throws Exception {
+ return service.execute(new AS7ManagementDetails(getServer()),
createResourceRequest());
+ }
+ }, getServer());
+ ModelNode result = ModelNode.fromJSONString(resultJSON);
+ attributes = new ArrayList<IAttributeNode>(attributeNames.size());
+ for (String name : attributeNames) {
+ if (result.hasDefined(name)) {
+ attributes.add(new AttributeNode(this, name,
result.get(name).asString()));
+ } else {
+ attributes.add(new AttributeNode(this, name, null));
+ }
+ }
+ }
+
+ private String createResourceRequest() {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_RESOURCE_OPERATION);
+ request.get(OP_ADDR).set(getManagementAddress(getParent()));
+ return request.toJSONString(true);
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContainerNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContainerNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContainerNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+/**
+ * ContainerNode
+ *
+ * <p>
+ * Abstract implementation of a container node. Delegates loading and takes care
+ * of error handling.
+ *
+ * @author Rob Cernich
+ */
+public abstract class ContainerNode<T extends IContainerNode<?>> extends
ContentNode<T> implements IContainerNode<T> {
+
+ private IErrorNode error;
+
+ protected ContainerNode(IServer server, String name) {
+ super(server, name);
+ }
+
+ protected ContainerNode(T container, String name) {
+ super(container, name);
+ }
+
+ public final List<? extends IContentNode<?>> getChildren() {
+ if (error != null) {
+ return Collections.singletonList(error);
+ }
+ return delegateGetChildren();
+ }
+
+ public final void clearChildren() {
+ clearError();
+ delegateClearChildren();
+ }
+
+ protected void setError(IErrorNode error) {
+ clearError();
+ this.error = error;
+ }
+
+ @Override
+ public void dispose() {
+ clearChildren();
+ super.dispose();
+ }
+
+ public final void load() {
+ if (getServer().getServerState() != IServer.STATE_STARTED) {
+ setError(new ErrorNode(this, Messages.ServerContent_Label_Not_Connected));
+ return;
+ }
+ try {
+ delegateLoad();
+ clearError();
+ } catch (Exception e) {
+ setError(new ErrorNode(this, Messages.ServerContent_Label_Retrieval_Error));
+ }
+ }
+
+ protected abstract List<? extends IContentNode<?>>
delegateGetChildren();
+
+ protected abstract void delegateClearChildren();
+
+ protected abstract void delegateLoad() throws Exception;
+
+ private void clearError() {
+ if (error != null) {
+ error.dispose();
+ error = null;
+ }
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import java.util.Deque;
+import java.util.LinkedList;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * ContentNode
+ *
+ * <p/>
+ * Base implementation of IContentNode.
+ *
+ * @author Rob Cernich
+ */
+public class ContentNode<T extends IContainerNode<?>> implements
IContentNode<T> {
+
+ /** The path separator for addresses. */
+ public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
+
+ private final IServer server;
+ private IResourceNode parent;
+ private T container;
+ private final String name;
+
+ protected ContentNode(IServer server, String name) {
+ this.server = server;
+ this.parent = null;
+ this.container = null;
+ this.name = name;
+ }
+
+ protected ContentNode(T container, String name) {
+ this.server = container.getServer();
+ this.parent = container instanceof IResourceNode ? (IResourceNode) container :
container.getParent();
+ this.container = container;
+ this.name = name;
+ }
+
+ public IResourceNode getParent() {
+ return parent;
+ }
+
+ public T getContainer() {
+ return container;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getAddress() {
+ return getParent().getAddress() + PATH_SEPARATOR + getName();
+ }
+
+ public IServer getServer() {
+ return server;
+ }
+
+ public void dispose() {
+ container = null;
+ parent = null;
+ }
+
+ /**
+ * Constructs an address list that can be used in an operation request.
+ *
+ * @param resource the resource being addressed
+ * @return a model node containing the list of addresses to the resource.
+ */
+ protected static ModelNode getManagementAddress(IResourceNode resource) {
+ ModelNode address = new ModelNode();
+ Deque<IResourceNode> resources = new LinkedList<IResourceNode>();
+ resources.push(resource);
+ for (IResourceNode parent = resource.getParent(); parent != null; parent =
parent.getParent()) {
+ resources.push(parent);
+ }
+ do {
+ resource = resources.pop();
+ ITypeNode type = resource.getContainer();
+ if (type != null) {
+ address.add(type.getName(), resource.getName());
+ }
+ } while (!resources.isEmpty());
+ return address;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNodePropertyTester.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNodePropertyTester.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ContentNodePropertyTester.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import org.eclipse.core.expressions.PropertyTester;
+
+/**
+ * ContentNodePropertyTester
+ *
+ * <p/>
+ * A property tester for use with IContentNode.
+ *
+ * @author Rob Cernich
+ */
+public class ContentNodePropertyTester extends PropertyTester {
+
+ public boolean test(Object receiver, String property, Object[] args, Object
expectedValue) {
+ if (!(receiver instanceof IContentNode<?>) || expectedValue == null) {
+ return false;
+ }
+ IContentNode<?> node = (IContentNode<?>)receiver;
+ if ("nodeName".equals(property)) { //$NON-NLS-1$
+ return node.getName().matches(expectedValue.toString());
+ } else if ("nodeAddress".equals(property)) { //$NON-NLS-1$
+ return node.getAddress().matches(expectedValue.toString());
+ }
+ return false;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ErrorNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ErrorNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ErrorNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * ErrorNode
+ *
+ * <p/>
+ * Represents an error that occurred while attempting to retrieve a resource's
+ * children.
+ *
+ * @author Rob Cernich
+ */
+public class ErrorNode extends ContentNode<IContainerNode<?>> implements
IErrorNode {
+
+ public static final String ERROR_TYPE = "error"; //$NON-NLS-1$
+
+ private final String text;
+
+ protected ErrorNode(IContainerNode<?> container, String text) {
+ super(container, ERROR_TYPE);
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributeNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributeNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributeNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * IAttributeNode
+ *
+ * <p/>
+ * Represents an attribute in the management tree.
+ *
+ * @author Rob Cernich
+ */
+public interface IAttributeNode extends IContentNode<IAttributesContainer> {
+
+ /** Represents a value that is null. */
+ public static final String UNDEFINED_VALUE = "undefined"; //$NON-NLS-1$
+
+ /**
+ * @return the value of the attribute; may be null.
+ */
+ public String getValue();
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributesContainer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributesContainer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IAttributesContainer.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * IAttributesContainer
+ *
+ * <p/>
+ * Simple intermediary for a resource's attributes.
+ *
+ * @author Rob Cernich
+ */
+public interface IAttributesContainer extends IContainerNode<IResourceNode> {
+
+ /**
+ * Represents the type for the attributes container. Can be used in an
+ * address, e.g. /subsystem=foo/attributes.
+ */
+ public static final String ATTRIBUTES_TYPE = "attributes"; //$NON-NLS-1$
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContainerNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContainerNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContainerNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import java.util.List;
+
+/**
+ * IContainerNode
+ *
+ * <p/>
+ * Base interface for container (non-leaf) nodes.
+ *
+ * @author Rob Cernich
+ */
+public interface IContainerNode<T extends IContainerNode<?>> extends
IContentNode<T> {
+
+ /**
+ * @return the children of this container.
+ */
+ public List<? extends IContentNode<?>> getChildren();
+
+ /**
+ * Loads the content of this container. This method is invoked by the
+ * content provider if getChildren() returns null.
+ */
+ public void load();
+
+ /**
+ * Clears the children of this container. After this method has been
+ * invoked, getChildren() must return null. This method is called when a
+ * refresh is requested.
+ */
+ public void clearChildren();
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContentNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContentNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IContentNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * IContentNode
+ *
+ * <p/>
+ * Base type for server content.
+ *
+ * @author Rob Cernich
+ */
+public interface IContentNode<T extends IContainerNode<?>> {
+
+ /**
+ * @return returns the server containing this node.
+ */
+ public IServer getServer();
+
+ /**
+ * @return the resource containing this node, if any.
+ */
+ public IResourceNode getParent();
+
+ /**
+ * @return the containing node.
+ */
+ public T getContainer();
+
+ /**
+ * @return the name of this node.
+ */
+ public String getName();
+
+ /**
+ * @return this node's addres, e.g. /subsystem=foo
+ */
+ public String getAddress();
+
+ /**
+ * Frees any resources held by this node.
+ */
+ public void dispose();
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IErrorNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IErrorNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IErrorNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * IErrorNode
+ *
+ * <p/>
+ * Represents an error that occurred while loading a container's contents.
+ *
+ * @author Rob Cernich
+ */
+public interface IErrorNode extends IContentNode<IContainerNode<?>> {
+
+ /**
+ * @return the error text.
+ */
+ public String getText();
+
+}
\ No newline at end of file
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IResourceNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IResourceNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/IResourceNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * IResourceNode
+ *
+ * <p/>
+ * Represents a resource in the management tree. A resource may contain
+ * attributes, system metrics, as well as other types of resources.
+ *
+ * @author Rob Cernich
+ */
+public interface IResourceNode extends IContainerNode<ITypeNode> {
+
+ /** Represents the root of the management tree. */
+ public static final String ROOT_TYPE = "root"; //$NON-NLS-1$
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ITypeNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ITypeNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ITypeNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+/**
+ * ITypeNode
+ *
+ * <p/>
+ * Represents a container for a specific type of child resources.
+ *
+ * @author Rob Cernich
+ */
+public interface ITypeNode extends IContainerNode<IResourceNode> {
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/RefreshActionProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/RefreshActionProvider.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/RefreshActionProvider.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.ui.internal.WorkbenchMessages;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+
+/**
+ * RefreshActionProvider
+ *
+ * <p/>
+ * Provides a refresh action for IContainer nodes.
+ *
+ * @author Rob Cernich
+ */
+@SuppressWarnings("restriction")
+public class RefreshActionProvider extends CommonActionProvider {
+
+ private RefreshAction refreshAction;
+
+ public RefreshActionProvider() {
+ }
+
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ refreshAction = new RefreshAction(aSite.getStructuredViewer());
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ menu.add(refreshAction);
+ }
+
+ public void dispose() {
+ if (refreshAction != null) {
+ refreshAction.dispose();
+ refreshAction = null;
+ }
+ super.dispose();
+ }
+
+ private class RefreshAction extends SelectionProviderAction {
+
+ public RefreshAction(ISelectionProvider selectionProvider) {
+ super(selectionProvider, WorkbenchMessages.Workbench_refresh);
+ }
+
+ public void run() {
+ IStructuredSelection selection = getStructuredSelection();
+ if (selection == null || selection.isEmpty()) {
+ return;
+ }
+ IContainerNode<?> container = (IContainerNode<?>)
((IStructuredSelection) selection).getFirstElement();
+ container.clearChildren();
+
RefreshActionProvider.this.getActionSite().getStructuredViewer().refresh(container);
+ }
+
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ResourceNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ResourceNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ResourceNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.ATTRIBUTES;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.CHILDREN;
+import static org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP_ADDR;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.READ_RESOURCE_DESCRIPTION_OPERATION;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.core.server.v7.management.AS7ManagementDetails;
+import org.jboss.ide.eclipse.as.management.core.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.core.JBoss7ManagerUtil;
+
+/**
+ * ResourceNode
+ *
+ * <p/>
+ * Implementation of a resource node.
+ *
+ * @author Rob Cernich
+ */
+public class ResourceNode extends ContainerNode<ITypeNode> implements IResourceNode
{
+
+ private ArrayList<IContentNode<? extends IContainerNode<?>>>
children;
+
+ protected ResourceNode(ITypeNode parent, String name) {
+ super(parent, name);
+ }
+
+ protected ResourceNode(IServer server, String name) {
+ super(server, name);
+ }
+
+ public String getAddress() {
+ if (getParent() == null) {
+ // special handling for root node
+ return ""; //$NON-NLS-1$
+ }
+ return getParent().getAddress() + PATH_SEPARATOR + getContainer().getName() +
"=" + getName(); //$NON-NLS-1$
+ }
+
+ protected List<IContentNode<? extends IContainerNode<?>>>
delegateGetChildren() {
+ return children;
+ }
+
+ protected void delegateClearChildren() {
+ if (children != null) {
+ for (IContentNode<? extends IContainerNode<?>> child : children)
{
+ child.dispose();
+ }
+ children.clear();
+ children = null;
+ }
+ }
+
+ protected void delegateLoad() throws Exception {
+ String resultJSON = JBoss7ManagerUtil.executeWithService(new
JBoss7ManagerUtil.IServiceAware<String>() {
+ public String execute(IJBoss7ManagerService service) throws Exception {
+ return service.execute(new AS7ManagementDetails(getServer()),
createResourceDescriptionRequest());
+ }
+ }, getServer());
+ ModelNode result = ModelNode.fromJSONString(resultJSON);
+ children = new ArrayList<IContentNode<? extends
IContainerNode<?>>>();
+ if (result.hasDefined(ATTRIBUTES)) {
+ populateAttributes(result.get(ATTRIBUTES).asObject());
+ }
+ if (result.hasDefined(CHILDREN)) {
+ populateTypes(result.get(CHILDREN).asObject());
+ }
+ if (children.size() == 1) {
+ IContentNode<? extends IContainerNode<?>> child =
children.get(0);
+ if (child instanceof IAttributesContainer) {
+ // collapse the attributes container if it's the only child.
+ IAttributesContainer attributesContainer = (IAttributesContainer) child;
+ children.clear();
+ attributesContainer.load();
+ children.addAll(attributesContainer.getChildren());
+ }
+ }
+ }
+
+ private String createResourceDescriptionRequest() {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_RESOURCE_DESCRIPTION_OPERATION);
+ request.get(OP_ADDR).set(getManagementAddress(this));
+ return request.toJSONString(true);
+ }
+
+ private void populateAttributes(ModelNode result) {
+ Set<String> keys = result.keys();
+ if (keys.size() > 0) {
+ children.add(new AttributesContainer(this, new
ArrayList<String>(keys)));
+ }
+ }
+
+ private void populateTypes(ModelNode result) {
+ Set<String> keys = result.keys();
+ children.ensureCapacity(children.size() + keys.size());
+ for (String key : keys) {
+ children.add(new TypeNode(this, key));
+ }
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentLabelProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentLabelProvider.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentLabelProvider.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * ServerContentLabelProvider
+ *
+ * <p/>
+ * Label provider implementation for content nodes.
+ *
+ * @author Rob Cernich
+ */
+public class ServerContentLabelProvider extends LabelProvider {
+
+ /**
+ * Maps node names to any label that should be used.
+ * <p/>
+ * TODO: this should probably be contributed by an extension,, which should
+ * provide icons as well.
+ */
+ private static Map<String, String> LABELS;
+
+ public String getText(Object element) {
+ if (element instanceof IAttributeNode) {
+ IAttributeNode attrNode = (IAttributeNode) element;
+ String value = attrNode.getValue();
+ if (value == null || IAttributeNode.UNDEFINED_VALUE.equals(value)) {
+ value = Messages.ServerContent_Value_undefined;
+ }
+ return MessageFormat.format(Messages.ServerContent_Label_Attribute_Value,
attrNode.getName(), value);
+ } else if (element instanceof IErrorNode) {
+ return ((IErrorNode) element).getText();
+ } else if (element instanceof IContentNode) {
+ return getMappedName(((IContentNode<?>) element).getName());
+ } else if (element == ServerContentTreeContentProvider.PENDING) {
+ return Messages.ServerContent_Label_Loading;
+ }
+ return super.getText(element);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IContainerNode<?>) {
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ } else if (element instanceof IErrorNode) {
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ } else if (element instanceof IContentNode<?>) {
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+ return super.getImage(element);
+ }
+
+ private String getMappedName(String name) {
+ if (name == null) {
+ return Messages.ServerContent_Value_undefined;
+ }
+ if (LABELS.containsKey(name)) {
+ return LABELS.get(name);
+ }
+ return name;
+ }
+
+ static {
+ LABELS = new HashMap<String, String>();
+ LABELS.put(IAttributesContainer.ATTRIBUTES_TYPE,
Messages.ServerContent_Type_attributes);
+ LABELS.put("core-service", Messages.ServerContent_Type_core_service);
//$NON-NLS-1$
+ LABELS.put("deployment", Messages.ServerContent_Type_deployment);
//$NON-NLS-1$
+ LABELS.put("extension", Messages.ServerContent_Type_extension);
//$NON-NLS-1$
+ LABELS.put("interface", Messages.ServerContent_Type_interface);
//$NON-NLS-1$
+ LABELS.put("path", Messages.ServerContent_Type_path); //$NON-NLS-1$
+ LABELS.put(IResourceNode.ROOT_TYPE, Messages.ServerContent_Type_root);
+ LABELS.put("socket-binding-group",
Messages.ServerContent_Type_socket_binding_group); //$NON-NLS-1$
+ LABELS.put("subsystem", Messages.ServerContent_Type_subsystem);
//$NON-NLS-1$
+ LABELS.put("system-property",
Messages.ServerContent_Type_system_property); //$NON-NLS-1$
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentTreeContentProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentTreeContentProvider.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/ServerContentTreeContentProvider.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+/**
+ * ServerContentTreeContentProvider
+ *
+ * <p/>
+ * Content provider implementation for server management details.
+ *
+ * @author Rob Cernich
+ */
+public class ServerContentTreeContentProvider implements ITreeContentProvider {
+
+ /** Represents a pending request in the tree. */
+ static final Object PENDING = new Object();
+ private ConcurrentMap<IContainerNode<?>, Object> pendingUpdates = new
ConcurrentHashMap<IContainerNode<?>, Object>();
+ private transient TreeViewer viewer;
+
+ /**
+ * Loads content for specified nodes, then refreshes the content in the
+ * tree.
+ */
+ private Job loadElementJob = new Job(Messages.ServerContent_Job_Title) {
+ public boolean shouldRun() {
+ return pendingUpdates.size() > 0;
+ }
+
+ protected IStatus run(final IProgressMonitor monitor) {
+ monitor.beginTask(Messages.ServerContent_Job_Title,
IProgressMonitor.UNKNOWN);
+ try {
+ final List<IContainerNode<?>> updatedNodes = new
ArrayList<IContainerNode<?>>(pendingUpdates.size());
+ for (IContainerNode<?> node : pendingUpdates.keySet()) {
+ try {
+ node.load();
+ updatedNodes.add(node);
+ } catch (Exception e) {
+ }
+ if (monitor.isCanceled()) {
+ pendingUpdates.keySet().removeAll(updatedNodes);
+ return Status.CANCEL_STATUS;
+ }
+ }
+ final TreeViewer viewer = ServerContentTreeContentProvider.this.viewer;
+ if (viewer == null) {
+ pendingUpdates.keySet().clear();
+ } else {
+ viewer.getTree().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (viewer.getTree().isDisposed()) {
+ return;
+ }
+ for (IContainerNode<?> node : updatedNodes) {
+ pendingUpdates.remove(node);
+ viewer.refresh(node);
+ }
+ }
+ });
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ public void dispose() {
+ viewer = null;
+ loadElementJob.cancel();
+ pendingUpdates.clear();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (viewer instanceof TreeViewer) {
+ this.viewer = (TreeViewer) viewer;
+ } else {
+ viewer = null;
+ }
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IServer) {
+ return new Object[] {new ResourceNode((IServer) parentElement,
IResourceNode.ROOT_TYPE) };
+ } else if (parentElement instanceof IContainerNode) {
+ IContainerNode<?> container = (IContainerNode<?>) parentElement;
+ if (pendingUpdates.containsKey(container)) {
+ return new Object[] {PENDING };
+ }
+ List<? extends IContentNode<?>> children =
container.getChildren();
+ if (children == null) {
+ pendingUpdates.putIfAbsent(container, PENDING);
+ loadElementJob.schedule();
+ return new Object[] {PENDING };
+ }
+ return children.toArray();
+ }
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IContentNode) {
+ Object parent = ((IContentNode<?>) element).getContainer();
+ if (parent == null) {
+ parent = ((IContentNode<?>) element).getServer();
+ }
+ return parent;
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof IServer) {
+ return true;
+ } else if (element instanceof IContainerNode) {
+ return true;
+ }
+ return false;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/TypeNode.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/TypeNode.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/as7/management/content/TypeNode.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.views.as7.management.content;
+
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.CHILD_TYPE;
+import static org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.OP_ADDR;
+import static
org.jboss.ide.eclipse.as.management.core.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.core.server.v7.management.AS7ManagementDetails;
+import org.jboss.ide.eclipse.as.management.core.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.core.JBoss7ManagerUtil;
+
+/**
+ * TypeNode
+ *
+ * <p/>
+ * Implementation of ITypeNode. Loads child names for a specific resource
+ * child-type.
+ *
+ * @author Rob Cernich
+ */
+public class TypeNode extends ContainerNode<IResourceNode> implements ITypeNode {
+
+ private List<IResourceNode> resources;
+
+ protected TypeNode(IResourceNode container, String name) {
+ super(container, name);
+ }
+
+ protected List<IResourceNode> delegateGetChildren() {
+ return resources;
+ }
+
+ protected void delegateClearChildren() {
+ if (resources != null) {
+ for (IResourceNode resource : resources) {
+ resource.dispose();
+ }
+ resources.clear();
+ resources = null;
+ }
+ }
+
+ protected void delegateLoad() throws Exception {
+ String resultJSON = JBoss7ManagerUtil.executeWithService(new
JBoss7ManagerUtil.IServiceAware<String>() {
+ public String execute(IJBoss7ManagerService service) throws Exception {
+ return service.execute(new AS7ManagementDetails(getServer()),
createResourceNamesRequest());
+ }
+ }, getServer());
+ // process the results
+ ModelNode result = ModelNode.fromJSONString(resultJSON);
+ List<ModelNode> childResources = result.asList();
+ resources = new ArrayList<IResourceNode>(childResources.size());
+ for (ModelNode child : childResources) {
+ resources.add(new ResourceNode(this, child.asString()));
+ }
+ }
+
+ private String createResourceNamesRequest() {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_CHILDREN_NAMES_OPERATION);
+ request.get(CHILD_TYPE).set(getName());
+ request.get(OP_ADDR).set(getManagementAddress(getParent()));
+ return request.toJSONString(true);
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.properties 2012-02-07 14:42:48 UTC
(rev 38465)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.properties 2012-02-07 14:49:27 UTC
(rev 38466)
@@ -22,6 +22,7 @@
NavigatorContent_ServersViewDefaultContent=Servers View Default Content
NavigatorContent_XMLConfiguration=XML Configuration
NavigatorContent_JMX=JMX
+NavigatorContent_ServerContent=Server Content
# NEW_SERVER_ADAPTER Add the new server and runtime ids to the constants below this line
when applicable
AllJBossRuntimeTypes=org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.60,org.jboss.ide.eclipse.as.runtime.70,org.jboss.ide.eclipse.as.runtime.71,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50,org.jboss.ide.eclipse.as.runtime.eap.60
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2012-02-07 14:42:48 UTC (rev
38465)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2012-02-07 14:49:27 UTC (rev
38466)
@@ -499,4 +499,129 @@
</client>
</extension>
+ <!-- AS v7+ specific server content -->
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="true"
+
contentProvider="org.jboss.ide.eclipse.as.ui.views.as7.management.content.ServerContentTreeContentProvider"
+ id="org.jboss.ide.eclipse.as.ui.extensions.content"
+
labelProvider="org.jboss.ide.eclipse.as.ui.views.as7.management.content.ServerContentLabelProvider"
+ name="%NavigatorContent_ServerContent"
+ priority="normal">
+ <triggerPoints>
+ <and>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ <or>
+ <test
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.jboss.ide.eclipse.as.70">
+ </test>
+ <test
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.jboss.ide.eclipse.as.71">
+ </test>
+ <test
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.jboss.ide.eclipse.as.eap.60">
+ </test>
+ </or>
+ </and>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof
+
value="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContentNode">
+ </instanceof>
+ </possibleChildren>
+ </navigatorContent>
+ <actionProvider
+
class="org.jboss.ide.eclipse.as.ui.views.as7.management.content.RefreshActionProvider"
+ id="org.jboss.ide.eclipse.as.ui.extensions.content.container">
+ <enablement>
+ <instanceof
+
value="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContainerNode">
+ </instanceof>
+ </enablement>
+ </actionProvider>
+ <commonFilter
+ activeByDefault="true"
+
id="org.jboss.ide.eclipse.as.ui.extensions.content.filter.extensions"
+ name="JBoss AS7 Extensions Details"
+ visibleInUI="true">
+ <filterExpression>
+ <and>
+ <instanceof
+
value="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContentNode">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+
property="org.jboss.ide.eclipse.as.ui.extensions.content.nodeAddress"
+ value="/extension">
+ </test>
+ </and>
+ </filterExpression>
+ </commonFilter>
+ <commonFilter
+ activeByDefault="true"
+
id="org.jboss.ide.eclipse.as.ui.extensions.content.filter.deployment.artifact.details"
+ name="JBoss AS7 Deployment Artifact Details"
+ visibleInUI="true">
+ <filterExpression>
+ <and>
+ <instanceof
+
value="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContentNode">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+
property="org.jboss.ide.eclipse.as.ui.extensions.content.nodeAddress"
+
value="/deployment=.+/(subsystem|subdeployment|attributes)">
+ </test>
+ </and>
+ </filterExpression>
+ </commonFilter>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.wst.server.ui.ServersView">
+ <includes>
+ <contentExtension
+ isRoot="false"
+ pattern="org.jboss.ide.eclipse.as.ui.extensions.content">
+ </contentExtension>
+ <contentExtension
+ isRoot="false"
+
pattern="org.jboss.ide.eclipse.as.ui.extensions.content.filter.*">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding
+ viewerId="org.eclipse.wst.server.ui.ServersView">
+ <includes>
+ <actionExtension
+
pattern="org.jboss.ide.eclipse.as.ui.extensions.content.*"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+
class="org.jboss.ide.eclipse.as.ui.views.as7.management.content.ContentNodePropertyTester"
+ id="org.jboss.ide.eclipse.as.ui.extensions.content.propertyTester1"
+ namespace="org.jboss.ide.eclipse.as.ui.extensions.content"
+ properties="nodeName"
+
type="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContentNode">
+ </propertyTester>
+ <propertyTester
+
class="org.jboss.ide.eclipse.as.ui.views.as7.management.content.ContentNodePropertyTester"
+ id="org.jboss.ide.eclipse.as.ui.extensions.content.propertyTester2"
+ namespace="org.jboss.ide.eclipse.as.ui.extensions.content"
+ properties="nodeAddress"
+
type="org.jboss.ide.eclipse.as.ui.views.as7.management.content.IContentNode">
+ </propertyTester>
+ </extension>
</plugin>
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2012-02-07
14:42:48 UTC (rev 38465)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2012-02-07
14:49:27 UTC (rev 38466)
@@ -74,6 +74,9 @@
private static class JBoss71Manager implements IJBoss7ManagerService {
+ public String execute(IAS7ManagementDetails details, String request) throws Exception
{
+ throw new UnsupportedOperationException();
+ }
public IJBoss7DeploymentResult deployAsync(IAS7ManagementDetails details, String
deploymentName, File file,
IProgressMonitor monitor) throws JBoss7ManangerException {
throw new UnsupportedOperationException();