Author: adietish
Date: 2011-04-20 09:16:31 -0400 (Wed, 20 Apr 2011)
New Revision: 30675
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
Log:
[JBIDE-8690] moved from workspace to trunk, added tests
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-20
13:13:41 UTC (rev 30674)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-20
13:16:31 UTC (rev 30675)
@@ -17,3 +17,4 @@
jboss-threads-2.0.0.CR8.jar,
.
Service-Component: META-INF/jboss-management-service.xml
+Export-Package:
org.jboss.ide.eclipse.as.management.as7.deployment;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests"
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-20
13:13:41 UTC (rev 30674)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-20
13:16:31 UTC (rev 30675)
@@ -120,7 +120,7 @@
public static boolean isDeployed(String name, String host, int port) throws
CancellationException, IOException {
ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
try {
- return JbossManagementUtil.isDeployed(name, client);
+ return JBossManagementUtil.isDeployed(name, client);
} finally {
StreamUtils.safeClose(client);
}
@@ -128,12 +128,12 @@
public static List<String> getDeployments(String host, int port) throws
UnknownHostException {
ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
- return JbossManagementUtil.getDeployments(client);
+ return JBossManagementUtil.getDeployments(client);
}
private static void throwOnFailure(ModelNode result) throws DeployerException {
- if (!JbossManagementUtil.isSuccess(result)) {
- throw new DeployerException(JbossManagementUtil.getFailureDescription(result));
+ if (!JBossManagementUtil.isSuccess(result)) {
+ throw new DeployerException(JBossManagementUtil.getFailureDescription(result));
}
}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementUtil.java
(from rev 30660,
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementUtil.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementUtil.java 2011-04-20
13:16:31 UTC (rev 30675)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.CHILD_TYPE;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OUTCOME;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.SUCCESS;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.Operation;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.ide.eclipse.as.management.as7.internal.DefaultOperationRequestBuilder;
+import org.jboss.ide.eclipse.as.management.as7.internal.OperationFormatException;
+
+/**
+ * Various utility methods to deal with the as7 management api.
+ *
+ * @author Alexey Loubyansky
+ * @author André Dietisheim
+ */
+public class JBossManagementUtil {
+
+ public static boolean isSuccess(ModelNode operationResult) {
+ if (operationResult != null) {
+ ModelNode outcome = operationResult.get(OUTCOME);
+ return outcome != null && outcome.asString().equals(SUCCESS);
+ }
+ return false;
+ }
+
+ public static String getFailureDescription(ModelNode operationResult) {
+ if (operationResult == null) {
+ return null;
+ }
+
+ ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
+ if (descr == null) {
+ return null;
+ }
+
+ return descr.asString();
+ }
+
+ public static List<String> getList(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT))
+ return Collections.emptyList();
+
+ List<ModelNode> nodeList = operationResult.get(RESULT).asList();
+ if (nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for (ModelNode node : nodeList) {
+ list.add(node.asString());
+ }
+ return list;
+ }
+
+ public static List<String> getRequestPropertyNames(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT))
+ return Collections.emptyList();
+
+ ModelNode result = operationResult.get(RESULT);
+ if (!result.hasDefined(REQUEST_PROPERTIES))
+ return Collections.emptyList();
+
+ List<Property> nodeList = result.get(REQUEST_PROPERTIES).asPropertyList();
+ if (nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for (Property node : nodeList) {
+ list.add(node.getName());
+ }
+ return list;
+ }
+
+ public static boolean isDeployed(String name, ModelControllerClient client) {
+ return getDeployments(client).contains(name);
+ }
+
+ public static List<String> getDeployments(ModelControllerClient client) {
+
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.operationName(READ_CHILDREN_NAMES_OPERATION);
+ builder.addProperty(CHILD_TYPE, "deployment");
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException("Failed to build operation", e);
+ }
+
+ try {
+ ModelNode outcome = client.execute(request);
+ if (isSuccess(outcome)) {
+ return getList(outcome);
+ }
+ } catch (Exception e) {
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static ModelNode execute(Operation operation, ModelControllerClient client)
throws DeployerException {
+ try {
+ ModelNode result = client.execute(operation);
+ if (result.hasDefined(OUTCOME)
+ && SUCCESS.equals(result.get("outcome").asString())) {
+ return result.get(RESULT);
+ }
+ else if (result.hasDefined(FAILURE_DESCRIPTION)) {
+ throw new DeployerException(result.get(FAILURE_DESCRIPTION).toString());
+ }
+ else {
+ throw new DeployerException("Operation outcome is " +
result.get(OUTCOME).asString());
+ }
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java 2011-04-20
13:13:41 UTC (rev 30674)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java 2011-04-20
13:16:31 UTC (rev 30675)
@@ -1,166 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.Property;
-import org.jboss.ide.eclipse.as.management.as7.internal.DefaultOperationRequestBuilder;
-import org.jboss.ide.eclipse.as.management.as7.internal.OperationFormatException;
-
-/**
- *
- * @author Alexey Loubyansky
- */
-public class JbossManagementUtil {
-
- public static boolean isSuccess(ModelNode operationResult) {
- if(operationResult != null) {
- ModelNode outcome = operationResult.get("outcome");
- return outcome != null &&
outcome.asString().equals("success");
- }
- return false;
- }
-
- public static String getFailureDescription(ModelNode operationResult) {
- if(operationResult == null) {
- return null;
- }
-
- ModelNode descr = operationResult.get("failure-description");
- if(descr == null) {
- return null;
- }
-
- return descr.asString();
- }
-
- public static List<String> getList(ModelNode operationResult) {
- if(!operationResult.hasDefined("result"))
- return Collections.emptyList();
-
- List<ModelNode> nodeList =
operationResult.get("result").asList();
- if(nodeList.isEmpty())
- return Collections.emptyList();
-
- List<String> list = new ArrayList<String>(nodeList.size());
- for(ModelNode node : nodeList) {
- list.add(node.asString());
- }
- return list;
- }
-
- public static byte[] getHash(ModelNode operationResult) {
- if(!operationResult.hasDefined("result"))
- return null;
- return operationResult.get("result").asBytes();
- }
-
- public static List<String> getRequestPropertyNames(ModelNode operationResult)
{
- if(!operationResult.hasDefined("result"))
- return Collections.emptyList();
-
- ModelNode result = operationResult.get("result");
- if(!result.hasDefined("request-properties"))
- return Collections.emptyList();
-
- List<Property> nodeList =
result.get("request-properties").asPropertyList();
- if(nodeList.isEmpty())
- return Collections.emptyList();
-
- List<String> list = new ArrayList<String>(nodeList.size());
- for(Property node : nodeList) {
- list.add(node.getName());
- }
- return list;
- }
-
- public static boolean isDeployed(String name, ModelControllerClient client) {
- return getDeployments(client).contains(name);
- }
-
- public static List<String> getDeployments(ModelControllerClient client) {
-
- DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
- final ModelNode request;
- try {
- builder.operationName("read-children-names");
- builder.addProperty("child-type", "deployment");
- request = builder.buildRequest();
- } catch (OperationFormatException e) {
- throw new IllegalStateException("Failed to build operation", e);
- }
-
- try {
- ModelNode outcome = client.execute(request);
- if (isSuccess(outcome)) {
- return getList(outcome);
- }
- } catch (Exception e) {
- }
-
- return Collections.emptyList();
- }
-
- public static List<String> getJmsResources(ModelControllerClient client, String
type) {
-
- DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
- final ModelNode request;
- try {
- builder.addNode("subsystem", "jms");
- builder.operationName("read-children-names");
- builder.addProperty("child-type", type);
- request = builder.buildRequest();
- } catch (OperationFormatException e) {
- throw new IllegalStateException("Failed to build operation", e);
- }
-
- try {
- ModelNode outcome = client.execute(request);
- if (isSuccess(outcome)) {
- return getList(outcome);
- }
- } catch (Exception e) {
- }
-
- return Collections.emptyList();
- }
-
- public static boolean isTopic(ModelControllerClient client, String name) {
- List<String> topics = getJmsResources(client, "topic");
- return topics.contains(name);
- }
-
- public static boolean isQueue(ModelControllerClient client, String name) {
- List<String> queues = getJmsResources(client, "queue");
- return queues.contains(name);
- }
-
- public static boolean isConnectionFactory(ModelControllerClient client, String name)
{
- List<String> cf = getJmsResources(client, "connection-factory");
- return cf.contains(name);
- }
-}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java 2011-04-20
13:16:31 UTC (rev 30675)
@@ -0,0 +1,190 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+
+/**
+ * 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 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 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 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";
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java 2011-04-20
13:13:41 UTC (rev 30674)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java 2011-04-20
13:16:31 UTC (rev 30675)
@@ -21,6 +21,11 @@
*/
package org.jboss.ide.eclipse.as.management.as7.deployment;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.NAME;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
+import static
org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
+
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
@@ -32,12 +37,14 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.OperationBuilder;
import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.protocol.StreamUtils;
+import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.management.as7.Activator;
/**
@@ -110,32 +117,16 @@
}
}
- //
- // public static boolean isDeployed(String name, String host, int port)
- // throws CancellationException, IOException {
- // ModelControllerClient client = ModelControllerClient.Factory.create(host,
- // port);
- // try {
- // return Util.isDeployed(name, client);
- // } finally {
- // StreamUtils.safeClose(client);
- // }
- // }
- //
- // public static List<String> getDeployments(String host, int port) throws
- // UnknownHostException {
- // ModelControllerClient client = ModelControllerClient.Factory.create(host,
- // port);
- // return Util.getDeployments(client);
- // }
- //
- // private static void throwOnFailure(ModelNode result) throws
- // DeployerException {
- // if (!Util.isSuccess(result)) {
- // throw new DeployerException(Util.getFailureDescription(result));
- // }
- // }
+ public String getServerName() throws DeployerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_ATTRIBUTE_OPERATION);
+ request.get(ADDRESS).set(ADDRESS);
+ request.get(NAME).set(NAME);
+ ModelNode response =
JBossManagementUtil.execute(OperationBuilder.Factory.create(request).build(), client);
+ return response.asString();
+ }
+
public void dispose() {
StreamUtils.safeClose(client);
}