Author: rob.stryker(a)jboss.com
Date: 2011-11-25 07:35:34 -0500 (Fri, 25 Nov 2011)
New Revision: 36658
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.project
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.settings/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/jboss-management-service.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/build.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-dmr-1.1.0.Final.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-logging-3.1.0.CR2.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-marshalling-1.3.4.GA.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-remoting-3.2.0.CR3.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-sasl-1.0.0.Beta6.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-threads-2.0.0.GA.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/pom.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71ManagementActivator.java
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/AS7Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandLineException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DeploymentOperationResult.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.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ModelDescriptionConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ValidatingOperationCallbackHandler.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/util/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/util/AS7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-api-3.0.0.CR4.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-nio-3.0.0.CR4.jar
Modified:
trunk/as/plugins/pom.xml
Log:
JBIDE-10253 - clone management for as7.1
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.classpath
(rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.classpath 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib"
path="jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar"
sourcepath="/home/rob/code/jboss/as7/jboss-as/controller-client"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar"
sourcepath="/home/rob/code/jboss/as7/jboss-as/protocol"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-dmr-1.1.0.Final.jar"
sourcepath="/home/rob/code/jboss/as7/jboss-dmr"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-logging-3.1.0.CR2.jar"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-marshalling-1.3.4.GA.jar"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-remoting-3.2.0.CR3.jar"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-sasl-1.0.0.Beta6.jar"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-threads-2.0.0.GA.jar"/>
+ <classpathentry exported="true" kind="lib"
path="xnio-api-3.0.0.CR4.jar"/>
+ <classpathentry exported="true" kind="lib"
path="xnio-nio-3.0.0.CR4.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.project
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.project
(rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.project 2011-11-25 12:35:34
UTC (rev 36658)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.management.as71</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/.settings/org.eclipse.jdt.core.prefs 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,8 @@
+#Fri Apr 15 16:21:37 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/MANIFEST.MF 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss AS7.1 management API
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as71
+Bundle-Version: 2.3.0.qualifier
+Bundle-Activator:
org.jboss.ide.eclipse.as.internal.management.as71.AS71ManagementActivator
+Require-Bundle: org.jboss.ide.eclipse.as.core;bundle-version="2.3.0",
+ org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="1.1.302"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: .,
+ jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar,
+ jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar,
+ jboss-dmr-1.1.0.Final.jar,
+ jboss-logging-3.1.0.CR2.jar,
+ jboss-marshalling-1.3.4.GA.jar,
+ jboss-remoting-3.2.0.CR3.jar,
+ jboss-sasl-1.0.0.Beta6.jar,
+ jboss-threads-2.0.0.GA.jar,
+ xnio-api-3.0.0.CR4.jar,
+ xnio-nio-3.0.0.CR4.jar
+Service-Component: META-INF/jboss-management-service.xml
+Export-Package:
org.jboss.ide.eclipse.as.internal.management.as71;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests"
+Bundle-Vendor: JBoss by Red Hat
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/jboss-management-service.xml
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/jboss-management-service.xml
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/META-INF/jboss-management-service.xml 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component
xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="org.jboss.ide.eclipse.as.management.as7.service">
+ <implementation
class="org.jboss.ide.eclipse.as.internal.management.as71.JBoss71ManagerService"/>
+ <service>
+ <provide
interface="org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService"/>
+ </service>
+ <property name="as.version" type="String"
value="710.beta1"/>
+</scr:component>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/build.properties
(rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/build.properties 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,19 @@
+# reminder, when updating to something newer, also update:
+# ~/trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/
+# ~/trunk/requirements/jbossas/build.properties
+# latest downloads:
http://www.jboss.org/jbossas/downloads
+# current:
http://download.jboss.org/jbossas/7.0/jboss-7.0.0.Beta3/jboss-7.0.0.Beta3...
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar,\
+ jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar,\
+ jboss-dmr-1.1.0.Final.jar,\
+ jboss-logging-3.1.0.CR2.jar,\
+ jboss-marshalling-1.3.4.GA.jar,\
+ jboss-remoting-3.2.0.CR3.jar,\
+ jboss-sasl-1.0.0.Beta6.jar,\
+ jboss-threads-2.0.0.GA.jar,\
+ xnio-api-3.0.0.CR4.jar,\
+ xnio-nio-3.0.0.CR4.jar
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-controller-client-7.1.0.CR1-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-dmr-1.1.0.Final.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-dmr-1.1.0.Final.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-logging-3.1.0.CR2.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-logging-3.1.0.CR2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-marshalling-1.3.4.GA.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-marshalling-1.3.4.GA.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-remoting-3.2.0.CR3.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-remoting-3.2.0.CR3.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-sasl-1.0.0.Beta6.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-sasl-1.0.0.Beta6.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-threads-2.0.0.GA.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/jboss-threads-2.0.0.GA.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/pom.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/pom.xml
(rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/pom.xml 2011-11-25 12:35:34
UTC (rev 36658)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.as</groupId>
+ <artifactId>plugins</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.as.plugins</groupId>
+ <artifactId>org.jboss.ide.eclipse.as.management.as71</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71ManagementActivator.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71ManagementActivator.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71ManagementActivator.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.as.internal.management.as71;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class AS71ManagementActivator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID =
"org.jboss.ide.eclipse.as.management.as7"; //$NON-NLS-1$
+
+ // The shared instance
+ private static AS71ManagementActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public AS71ManagementActivator() {
+ }
+
+ public static BundleContext getContext() {
+ return plugin.getBundle().getBundleContext();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static AS71ManagementActivator getDefault() {
+ return plugin;
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * 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.internal.management.as71;
+
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.ADDRESS;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.CHILD_TYPE;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.DEPLOYMENT;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.ENABLED;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.NAME;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.OP;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.OP_ADDR;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.RESULT;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.SERVER_STATE;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.SHUTDOWN;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.ModelControllerClient;
+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.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.core.server.v7.management.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.internal.management.as71.util.AS7ManagerUtil;
+
+/**
+ * @author André Dietisheim
+ */
+public class AS71Manager {
+
+ public static final int MGMT_PORT = 9999;
+
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+
+ public AS71Manager(String host) throws UnknownHostException {
+ this(host, MGMT_PORT);
+ }
+
+ public AS71Manager(String host, int port) throws UnknownHostException {
+ this.client = ModelControllerClient.Factory.create(host, port);
+ this.manager = ServerDeploymentManager.Factory.create(client);
+ System.out.println("71 client class: " + client.getClass());
+ System.out.println("71 client class: " + manager.getClass());
+ }
+
+ public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
+ throws JBoss7ManangerException {
+ IJBoss7DeploymentResult result = undeploy(name);
+ result.getStatus();
+ return result;
+ }
+
+ public IJBoss7DeploymentResult deploySync(String name, File file, IProgressMonitor
monitor)
+ throws JBoss7ManangerException {
+ IJBoss7DeploymentResult result = deploy(name, file);
+ result.getStatus();
+ return result;
+ }
+
+ public IJBoss7DeploymentResult undeploy(String name) throws JBoss7ManangerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.undeploy(name).andRemoveUndeployed();
+ return new DeploymentOperationResult(builder.getLastAction(),
manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult remove(String name) throws JBoss7ManangerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.remove(name);
+ return new DeploymentOperationResult(builder.getLastAction(),
manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult deploy(File file) throws JBoss7ManangerException {
+ return deploy(file.getName(), file);
+ }
+
+ public IJBoss7DeploymentResult add(String name, File file) throws
JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file));
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult deploy(String name, File file) throws
JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult replace(File file) throws JBoss7ManangerException {
+ return replace(file.getName(), file);
+ }
+
+ public IJBoss7DeploymentResult replace(String name, File file) throws
JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().replace(name, file));
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ /**
+ * Get the deployment state
+ * This API may cause additional management requests, but it prevents exceptions
+ * from being thrown on the server.
+ *
+ * @param name
+ * @return
+ * @throws JBoss7ManangerException
+ */
+ public JBoss7DeploymentState getDeploymentStateSafe(String name) throws
JBoss7ManangerException {
+ if( hasDeployment(name)) {
+ return JBoss7DeploymentState.NOT_FOUND;
+ }
+ return getDeploymentState(name);
+ }
+
+ /**
+ * Get the deployment state.
+ * This may cause exceptions to be thrown on the server side if the deployment has not
yet
+ * been found or started to register.
+ *
+ *
+ * @param name
+ * @return
+ * @throws JBoss7ManangerException
+ */
+ public JBoss7DeploymentState getDeploymentState(String name) throws
JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_RESOURCE_OPERATION);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
+ ModelNode result = null;
+ try {
+ result = execute(request);
+ } catch( JBoss7ManangerException j7me ) {
+ return JBoss7DeploymentState.NOT_FOUND;
+ }
+
+ Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, result);
+ if (enabled == null) {
+ throw new JBoss7ManangerException(
+ NLS.bind(AS7Messages.ModuleStateEvaluationFailed, name));
+ } else if (enabled) {
+ return JBoss7DeploymentState.STARTED;
+ } else {
+ return JBoss7DeploymentState.STOPPED;
+ }
+ }
+
+ public void addDeploymentDirectory(String path) {
+
+ }
+
+
+ /**
+ * Shuts the server down.
+ *
+ * @throws JBoss7ManangerException
+ */
+ public void stopServer() throws JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(SHUTDOWN);
+ quietlyExecute(request);
+ }
+
+ public JBoss7ServerState getServerState() throws JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_ATTRIBUTE_OPERATION);
+ request.get(NAME).set(SERVER_STATE);
+ ModelNode response = execute(request);
+ return toJBoss7ServerState(response);
+ }
+
+ public boolean isRunning() {
+ try {
+ return getServerState() == JBoss7ServerState.RUNNING;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ private JBoss7ServerState toJBoss7ServerState(ModelNode response) throws
JBoss7ManangerException {
+ try {
+ return JBoss7ServerState.valueOfIgnoreCase(response.asString());
+ } catch (IllegalArgumentException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public void dispose() {
+ StreamUtils.safeClose(client);
+ }
+
+ private ModelNode execute(ModelNode node) throws JBoss7ManangerException {
+ try {
+ ModelNode response = client.execute(node);
+ if (!AS7ManagerUtil.isSuccess(response)) {
+ throw new JBoss7ManangerException(
+ NLS.bind(AS7Messages.OperationOnAddressFailed,
+ new Object[] { node.get(OP),
+ node.get(ADDRESS),
+ response.get(FAILURE_DESCRIPTION) }
+ ));
+ }
+ return response.get(RESULT);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
+ try {
+ client.execute(node);
+ } catch (Exception e) {
+ if (!isConnectionCloseException(e)) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+ }
+
+ private boolean isConnectionCloseException(Exception e) {
+ return e instanceof IOException
+ && e.getMessage() != null
+ && e.getMessage().indexOf("Channel closed") > -1;
+ }
+
+ private IJBoss7DeploymentResult execute(DeploymentPlanBuilder builder) throws
JBoss7ManangerException {
+ try {
+ DeploymentAction action = builder.getLastAction();
+ Future<ServerDeploymentPlanResult> planResult =
manager.execute(builder.build());
+ return new DeploymentOperationResult(action, planResult);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public static ModelNode getEmptyOperation(String operationName, ModelNode address) {
+ ModelNode op = new ModelNode();
+ op.get(OP).set(operationName);
+ if (address != null) {
+ op.get(OP_ADDR).set(address);
+ }
+ else {
+ // Just establish the standard structure; caller can fill in address later
+ op.get(OP_ADDR);
+ }
+ return op;
+ }
+
+ public boolean hasDeployment(String name) throws JBoss7ManangerException {
+ return getDeploymentNames().contains(name);
+ }
+
+ private Set<String> getDeploymentNames() throws JBoss7ManangerException {
+ final ModelNode op = getEmptyOperation(READ_CHILDREN_NAMES_OPERATION, new
ModelNode());
+ op.get(CHILD_TYPE).set(DEPLOYMENT);
+ ModelNode response = execute(op);
+ ModelNode result = response.get(RESULT);
+ Set<String> deploymentNames = new HashSet<String>();
+ if (result.isDefined()) {
+ final List<ModelNode> deploymentNodes = result.asList();
+ for (ModelNode node : deploymentNodes) {
+ deploymentNames.add(node.asString());
+ }
+ }
+ return deploymentNames;
+ }
+
+
+}
\ No newline at end of file
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.internal.management.as71;
+
+import org.eclipse.osgi.util.NLS;
+
+public class AS7Messages extends NLS {
+ public static String ModuleStateEvaluationFailed;
+ public static String OperationOnAddressFailed;
+ public static String FailedToBuildOperation;
+ public static String OperationOutcomeToString;
+ public static String OperationOnUnitNotExecuted;
+ public static String OperationOnUnitFailed;
+ public static String OperationOnUnitRolledBack;
+ public static String OperationNotExecConfigRequiresRestart;
+ static {
+ NLS.initializeMessages("org.jboss.ide.eclipse.as.management.as7.AS7Messages",
//$NON-NLS-1$
+ AS7Messages.class);
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.properties
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS7Messages.properties 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,8 @@
+ModuleStateEvaluationFailed=Could not evaluate state for deployment {0}
+OperationOnAddressFailed=Could not execute {0} for {1}. Failure was {2}.
+FailedToBuildOperation=Failed to build operation.
+OperationOutcomeToString=Operation outcome is {0}.
+OperationOnUnitNotExecuted=The operation {0} was not executed on unit {1}
+OperationOnUnitFailed=The operation {0} failed for unit {1}
+OperationOnUnitRolledBack=The operation {0} for unit {1} was rolled back
+OperationNotExecConfigRequiresRestart=The operation {0} was not executed on unit {1}. The
server configuration was changed though and the server needs to be restarted.
\ No newline at end of file
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandFormatException.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandFormatException.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandFormatException.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,53 @@
+/*
+ * 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.internal.management.as71;
+
+/**
+ * @author Alexey Loubyansky
+ *
+ */
+public class CommandFormatException extends CommandLineException {
+
+ private static final long serialVersionUID = -5802389813870206943L;
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public CommandFormatException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public CommandFormatException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public CommandFormatException(Throwable cause) {
+ super(cause);
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandLineException.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandLineException.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/CommandLineException.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,43 @@
+/*
+ * 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.internal.management.as71;
+
+/**
+ * @author Alexey Loubyansky
+ *
+ */
+public class CommandLineException extends Exception {
+
+ private static final long serialVersionUID = 423938082439473323L;
+
+ public CommandLineException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CommandLineException(String message) {
+ super(message);
+ }
+
+ public CommandLineException(Throwable cause) {
+ super(cause);
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestAddress.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestAddress.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestAddress.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,258 @@
+/*
+ * 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.internal.management.as71;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This implementation is not thread-safe.
+ *
+ * @author Alexey Loubyansky
+ */
+public class DefaultOperationRequestAddress implements OperationRequestAddress {
+
+ private final List<NodeImpl> nodes = new ArrayList<NodeImpl>();
+
+ public DefaultOperationRequestAddress() {
+ }
+
+ /**
+ * Creates a prefix and initializes it to the value of the argument.
+ * @param initial the initial value
+ */
+ public DefaultOperationRequestAddress(OperationRequestAddress initial) {
+ if(!initial.isEmpty()) {
+ for(Node node : initial) {
+ toNode(node.getType(), node.getName());
+ }
+ }
+ }
+
+ @Override
+ public void toNodeType(String nodeType) {
+
+ nodes.add(new NodeImpl(nodeType, null));
+ }
+
+ @Override
+ public void toNode(String nodeName) {
+
+ if(nodes.isEmpty())
+ throw new IllegalStateException("The prefix should end with the node
type before going to a specific node name.");
+
+ nodes.get(nodes.size() - 1).name = nodeName;
+ }
+
+ @Override
+ public void toNode(String nodeType, String nodeName) {
+
+ if(endsOnType()) {
+ throw new IllegalStateException("The prefix ends on a type. A node name
must be specified before this method can be invoked.");
+ }
+ nodes.add(new NodeImpl(nodeType, nodeName));
+ }
+
+ @Override
+ public String toNodeType() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ String name = nodes.get(nodes.size() - 1).name;
+ nodes.get(nodes.size() - 1).name = null;
+ return name;
+ }
+
+ @Override
+ public Node toParentNode() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.remove(nodes.size() - 1);
+ }
+
+ @Override
+ public void reset() {
+ nodes.clear();
+ }
+
+ @Override
+ public boolean endsOnType() {
+ if(nodes.isEmpty()) {
+ return false;
+ }
+
+ NodeImpl node = nodes.get(nodes.size() - 1);
+ return node.name == null;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return nodes.isEmpty();
+ }
+
+ @Override
+ public Iterator<Node> iterator() {
+
+ final Node[] array = nodes.toArray(new Node[nodes.size()]);
+ return new Iterator<Node>() {
+
+ int i = 0;
+
+ @Override
+ public boolean hasNext() {
+ return i < array.length;
+ }
+
+ @Override
+ public Node next() {
+ return array[i++];
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ @Override
+ public String getNodeType() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.get(nodes.size() - 1).type;
+ }
+
+ @Override
+ public String getNodeName() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.get(nodes.size() - 1).name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((nodes == null) ? 0 : nodes.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof OperationRequestAddress))
+ return false;
+
+ OperationRequestAddress other = (OperationRequestAddress) obj;
+
+ if(isEmpty() != other.isEmpty())
+ return false;
+
+ Iterator<Node> thisIterator = iterator();
+ Iterator<Node> otherIterator = other.iterator();
+ boolean result = true;
+ while(result) {
+ if(!thisIterator.next().equals(otherIterator.next())) {
+ result = false;
+ } else {
+ if (!thisIterator.hasNext()) {
+ if (otherIterator.hasNext()) {
+ result = false;
+ }
+ break;
+ }
+ if (!otherIterator.hasNext()) {
+ if (thisIterator.hasNext()) {
+ result = false;
+ }
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static final class NodeImpl implements Node {
+
+ String type;
+ String name;
+
+ NodeImpl(String type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+
+ if(!(obj instanceof Node))
+ return false;
+
+ Node other = (Node) obj;
+ if (name == null) {
+ if (other.getName() != null)
+ return false;
+ } else if (!name.equals(other.getName()))
+ return false;
+ if (type == null) {
+ if (other.getType() != null)
+ return false;
+ } else if (!type.equals(other.getType()))
+ return false;
+ return true;
+ }
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestBuilder.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestBuilder.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DefaultOperationRequestBuilder.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,234 @@
+/*
+ * 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.internal.management.as71;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.internal.management.as71.OperationRequestAddress.Node;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class DefaultOperationRequestBuilder extends ValidatingOperationCallbackHandler
implements OperationRequestBuilder {
+
+ private ModelNode request = new ModelNode();
+ private OperationRequestAddress prefix;
+
+ public DefaultOperationRequestBuilder() {
+ this.prefix = new DefaultOperationRequestAddress();
+ }
+
+ public DefaultOperationRequestBuilder(OperationRequestAddress prefix) {
+ if(prefix == null) {
+ throw new IllegalArgumentException("Prefix can't be null");
+ }
+ this.prefix = new DefaultOperationRequestAddress(prefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#rootNode()
+ */
+ public void rootNode() {
+ prefix.reset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#parentNode()
+ */
+ public void parentNode() {
+ prefix.toParentNode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeType()
+ */
+ public void nodeType() {
+ prefix.toNodeType();
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeTypeNameSeparator(int)
+ */
+ public void nodeTypeNameSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeSeparator(int)
+ */
+ public void nodeSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#addressOperationSeparator(int)
+ */
+ public void addressOperationSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#operationName(java.lang.String)
+ */
+ @Override
+ public void validatedOperationName(String operationName) {
+ this.setOperationName(operationName);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyListStart(int)
+ */
+ public void propertyListStart(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyNameValueSeparator(int)
+ */
+ public void propertyNameValueSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertySeparator(int)
+ */
+ public void propertySeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyListEnd(int)
+ */
+ public void propertyListEnd(int index) {
+ }
+
+ @Override
+ protected void validatedNodeType(String nodeType)
+ throws OperationFormatException {
+ this.addNodeType(nodeType);
+ }
+
+ @Override
+ protected void validatedNodeName(String nodeName)
+ throws OperationFormatException {
+ this.addNodeName(nodeName);
+ }
+
+ @Override
+ protected void validatedPropertyName(String propertyName)
+ throws OperationFormatException {
+ throw new OperationFormatException("Property '" + propertyName +
"' is missing the value.");
+ }
+
+ @Override
+ protected void validatedProperty(String name, String value,
+ int nameValueSeparatorIndex) throws OperationFormatException {
+ this.addProperty(name, value);
+ }
+
+ public void nodeTypeOrName(String typeOrName)
+ throws OperationFormatException {
+
+ if(prefix.endsOnType()) {
+ this.addNodeName(typeOrName);
+ } else {
+ this.addNodeType(typeOrName);
+ }
+ }
+
+ /**
+ * Makes sure that the operation name and the address have been set and returns a
ModelNode
+ * representing the operation request.
+ */
+ public ModelNode buildRequest() throws OperationFormatException {
+
+ ModelNode address = request.get("address");
+ if(prefix.isEmpty()) {
+ address.setEmptyList();
+ } else {
+ Iterator<Node> iterator = prefix.iterator();
+ while (iterator.hasNext()) {
+ OperationRequestAddress.Node node = iterator.next();
+ if (node.getName() != null) {
+ address.add(node.getType(), node.getName());
+ } else if (iterator.hasNext()) {
+ throw new OperationFormatException(
+ "The node name is not specified for type '"
+ + node.getType() + "'");
+ }
+ }
+ }
+
+ if(!request.hasDefined("operation")) {
+ throw new OperationFormatException("The operation name is missing or the
format of the operation request is wrong.");
+ }
+
+ return request;
+ }
+
+ @Override
+ public void setOperationName(String name) {
+ request.get("operation").set(name);
+ }
+
+ @Override
+ public void addNode(String type, String name) {
+ prefix.toNode(type, name);
+ }
+
+ @Override
+ public void addNodeType(String type) {
+ prefix.toNodeType(type);
+ }
+
+ @Override
+ public void addNodeName(String name) {
+ prefix.toNode(name);
+ }
+
+ @Override
+ public void addProperty(String name, String value) {
+
+ if(name == null || name.trim().isEmpty())
+ throw new IllegalArgumentException("The argument name is not specified:
'" + name + "'");
+ if(value == null || value.trim().isEmpty())
+ throw new IllegalArgumentException("The argument value is not specified:
'" + value + "'");
+ ModelNode toSet = null;
+ try {
+ toSet = ModelNode.fromString(value);
+ } catch (Exception e) {
+ // just use the string
+ toSet = new ModelNode().set(value);
+ }
+ request.get(name).set(toSet);
+ }
+
+ public ModelNode getModelNode() {
+ return request;
+ }
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ // TODO Auto-generated method stub
+
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DeploymentOperationResult.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DeploymentOperationResult.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/DeploymentOperationResult.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -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.internal.management.as71;
+
+import java.text.MessageFormat;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ManangerException;
+
+/**
+ * A class that holds the status of a deployment operation.
+ *
+ * @author André Dietisheim
+ *
+ */
+public class DeploymentOperationResult implements IJBoss7DeploymentResult {
+
+ private Future<ServerDeploymentPlanResult> planResult;
+ private DeploymentAction action;
+
+ DeploymentOperationResult(DeploymentAction action,
Future<ServerDeploymentPlanResult> planResult) {
+ Assert.isNotNull(action);
+ this.action = action;
+ Assert.isNotNull(planResult);
+ this.planResult = planResult;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.ide.eclipse.as.management.as7.deployment.IDeploymentResult#getStatus()
+ */
+ @Override
+ public IStatus getStatus() throws JBoss7ManangerException {
+ try {
+ ServerDeploymentActionResult actionResult =
planResult.get().getDeploymentActionResult(action.getId());
+ return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(),
actionResult);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ private IStatus createStatus(String deploymentName, String actionName,
ServerDeploymentActionResult actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
+ IStatus status = null;
+ switch (actionResult.getResult()) {
+ case NOT_EXECUTED:
+ status = createStatus(IStatus.ERROR, NLS.bind(
+ AS7Messages.OperationOnUnitNotExecuted,
+ actionName, deploymentName));
+ break;
+ case EXECUTED:
+ status = Status.OK_STATUS;
+ break;
+ case FAILED:
+ status = createStatus(IStatus.ERROR, NLS.bind(AS7Messages.OperationOnUnitFailed,
+ actionName, deploymentName));
+ break;
+ case ROLLED_BACK:
+ status = createStatus(IStatus.ERROR,
+ NLS.bind(AS7Messages.OperationOnUnitRolledBack,
+ actionName, deploymentName));
+ break;
+ case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
+ status = createStatus(
+ IStatus.WARNING,
+ NLS.bind(AS7Messages.OperationNotExecConfigRequiresRestart,
+ actionName, deploymentName));
+ break;
+ }
+ return status;
+ }
+
+ private IStatus createStatus(int severity, String messagePattern, Object...
messageArguments) {
+ return new Status(severity,
AS71ManagementActivator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
+ messagePattern, messageArguments));
+ }
+}
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.internal.management.as71;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ServerState;
+
+/**
+ * @author Rob Stryker
+ */
+public class JBoss71ManagerService implements IJBoss7ManagerService {
+
+ public IJBoss7DeploymentResult deployAsync(String host, int port, String
deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ IJBoss7DeploymentResult result = manager.deploy(deploymentName, file);
+ return result;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ IJBoss7DeploymentResult result = manager.deploySync(deploymentName, file, monitor);
+ return result;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ public IJBoss7DeploymentResult undeployAsync(String host, int port, String
deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ IJBoss7DeploymentResult result = manager.undeploy(deploymentName);
+ return result;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ public IJBoss7DeploymentResult syncUndeploy(String host, int port, String
deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ IJBoss7DeploymentResult result = manager.undeploySync(deploymentName, monitor);
+ return result;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String
deploymentName) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ JBoss7DeploymentState result = manager.getDeploymentStateSafe(deploymentName);
+ return result;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ @Deprecated
+ public JBoss7ServerState getServerState(String host) throws Exception {
+ return getServerState(host, AS71Manager.MGMT_PORT);
+ }
+
+ public JBoss7ServerState getServerState(String host, int port) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ JBoss7ServerState state = manager.getServerState();
+ return state;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ public boolean isRunning(String host, int port) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ boolean ret = manager.isRunning();
+ return ret;
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ @Deprecated
+ public void stop(String host) throws Exception {
+ stop(host, AS71Manager.MGMT_PORT);
+ }
+
+ public void stop(String host, int port) throws Exception {
+ AS71Manager manager = new AS71Manager(host, port);
+ try {
+ manager.stopServer();
+ } finally {
+ manager.dispose();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ModelDescriptionConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ModelDescriptionConstants.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ModelDescriptionConstants.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -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.internal.management.as71;
+
+
+/**
+ * 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";
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationFormatException.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationFormatException.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationFormatException.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,61 @@
+/*
+ * 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.internal.management.as71;
+
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class OperationFormatException extends CommandFormatException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3481664048439674648L;
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public OperationFormatException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param message
+ */
+ public OperationFormatException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param cause
+ */
+ public OperationFormatException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestAddress.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestAddress.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestAddress.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,110 @@
+/*
+ * 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.internal.management.as71;
+
+
+
+/**
+ * An instance of this interface represents a prefix for the operation request address
part.
+ *
+ * @author Alexey Loubyansky
+ */
+public interface OperationRequestAddress extends
Iterable<OperationRequestAddress.Node> {
+
+ /**
+ * Appends the node type to the prefix.
+ * Note, the current prefix must end on the node name before this method
+ * is invoked.
+ *
+ * @param nodeType the node type to append to the prefix.
+ */
+ void toNodeType(String nodeType);
+
+ /**
+ * Appends the node name to the prefix.
+ * Note, the current prefix must end on the node type before this method
+ * is invoked.
+ *
+ * @param nodeName the node name to append to the prefix.
+ */
+ void toNode(String nodeName);
+
+ /**
+ * Appends the node to the prefix.
+ * Note, the current prefix must end on the node (i.e. node name) before
+ * this method is invoked.
+ *
+ * @param nodeType the node type of the node to append to the prefix
+ * @param nodeName the node name of the node to append to the prefix
+ */
+ void toNode(String nodeType, String nodeName);
+
+ /**
+ * Sets the current prefix to the node type of the current node,
+ * i.e. the node name is removed from the end of the prefix.
+ * @return the node name the prefix ended on
+ */
+ String toNodeType();
+
+ /**
+ * Removes the last node in the prefix, i.e. moves the value a node up.
+ * @return the node the prefix ended on
+ */
+ Node toParentNode();
+
+ /**
+ * Resets the prefix, i.e. this will make the prefix empty.
+ */
+ void reset();
+
+ /**
+ * Checks whether the prefix ends on a node type or a node name.
+ * @return true if the prefix ends on a node type, otherwise false.
+ */
+ boolean endsOnType();
+
+ /**
+ * Checks whether the prefix is empty.
+ * @return true if the prefix is empty, otherwise false.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns the node type of the last node.
+ * @return the node type of the last node or null if the prefix is empty.
+ */
+ String getNodeType();
+
+ /**
+ * Returns the node name of the last node.
+ * @return the node name of the last node or null if the prefix ends
+ * on a type or is empty.
+ */
+ String getNodeName();
+
+ interface Node {
+
+ String getType();
+
+ String getName();
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestBuilder.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestBuilder.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/OperationRequestBuilder.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,77 @@
+/*
+ * 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.internal.management.as71;
+
+import org.jboss.dmr.ModelNode;
+
+/**
+ * TODO this is not used for now...
+ *
+ * @author Alexey Loubyansky
+ */
+public interface OperationRequestBuilder {
+
+ /**
+ * Sets the name operation to be invoked.
+ *
+ * @param name the name of the operation to invoke.
+ */
+ void setOperationName(String name);
+
+ /**
+ * The address is specified as a path to the target node. Each element of the path is
a node
+ * and is identified by its type and name.
+ *
+ * @param type the type of the node
+ * @param name the name of the node
+ */
+ void addNode(String type, String name);
+
+ /**
+ * This method is supposed to be invoked from applying the prefix with ends on a node
type.
+ * @param type the type of the node.
+ */
+ void addNodeType(String type);
+
+ /**
+ * This method assumes there is a non-empty prefix which ends on a node type.
+ * Otherwise, this method will result in an exception.
+ * @param name the name of the node for the type specified by the prefix.
+ */
+ void addNodeName(String name);
+
+ /**
+ * Adds an argument.
+ *
+ * @param name the name of the argument
+ * @param value the value of the argument
+ */
+ void addProperty(String name, String value);
+
+ /**
+ * Builds the operation request based on the collected operation name, address and
arguments.
+ *
+ * @return an instance of ModelNode representing the operation request
+ * @throws OperationFormatException
+ */
+ ModelNode buildRequest() throws OperationFormatException;
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ValidatingOperationCallbackHandler.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ValidatingOperationCallbackHandler.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/ValidatingOperationCallbackHandler.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,131 @@
+/*
+ * 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.internal.management.as71;
+
+import java.util.regex.Pattern;
+
+import javax.security.auth.callback.CallbackHandler;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public abstract class ValidatingOperationCallbackHandler implements CallbackHandler {
+
+ private static final Pattern ALPHANUMERICS_PATTERN =
Pattern.compile("[_a-zA-Z](?:[-_a-zA-Z0-9]*[_a-zA-Z0-9])?");
+ private static final Pattern NODE_NAME_PATTERN =
Pattern.compile("\\*|[^*\\p{Space}\\p{Cntrl}]+");
+
+
+ protected String operationStr;
+
+ public void start(String operationString) {
+ this.operationStr = operationString;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeType(java.lang.String)
+ */
+ public void nodeType(String nodeType) throws OperationFormatException {
+
+ assertValidType(nodeType);
+ validatedNodeType(nodeType);
+ }
+
+ protected abstract void validatedNodeType(String nodeType) throws
OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeName(java.lang.String)
+ */
+ public void nodeName(String nodeName) throws OperationFormatException {
+
+ assertValidNodeName(nodeName);
+ validatedNodeName(nodeName);
+ }
+
+ protected abstract void validatedNodeName(String nodeName) throws
OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#operationName(java.lang.String)
+ */
+ public void operationName(String operationName)
+ throws OperationFormatException {
+
+ if (operationName == null ||
!ALPHANUMERICS_PATTERN.matcher(operationName).matches()) {
+ throw new OperationFormatException("'" + operationName +
"' is not a valid operation name.");
+ }
+
+ validatedOperationName(operationName);
+ }
+
+ protected abstract void validatedOperationName(String operationName) throws
OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyName(java.lang.String)
+ */
+ public void propertyName(String propertyName)
+ throws OperationFormatException {
+
+ assertValidParameterName(propertyName);
+ validatedPropertyName(propertyName);
+ }
+
+ protected abstract void validatedPropertyName(String propertyName) throws
OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.cli.operation.OperationParser.CallbackHandler#property(java.lang.String,
java.lang.String, int)
+ */
+ public void property(String name, String value, int nameValueSeparatorIndex)
+ throws OperationFormatException {
+
+ assertValidParameterName(name);
+
+ if (value.isEmpty()) {
+ throw new OperationFormatException("Parameter '" + value +
"' is missing value.");
+ }
+
+ validatedProperty(name, value, nameValueSeparatorIndex);
+ }
+
+ protected abstract void validatedProperty(String name, String value, int
nameValueSeparatorIndex) throws OperationFormatException;
+
+ protected void assertValidType(String nodeType)
+ throws OperationFormatException {
+ if (nodeType == null || !ALPHANUMERICS_PATTERN.matcher(nodeType).matches()) {
+ throw new OperationFormatException("'" + nodeType + "'
is not a valid node type name.");
+ }
+ }
+
+ protected void assertValidNodeName(String nodeName)
+ throws OperationFormatException {
+ if (nodeName == null || !NODE_NAME_PATTERN.matcher(nodeName).matches()) {
+ throw new OperationFormatException("'" + nodeName + "'
is not a valid node name.");
+ }
+ }
+
+ protected void assertValidParameterName(String name)
+ throws OperationFormatException {
+ if (name == null || !ALPHANUMERICS_PATTERN.matcher(name).matches()) {
+ throw new OperationFormatException("'" + name + "' is
not a valid parameter name.");
+ }
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/util/AS7ManagerUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/util/AS7ManagerUtil.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/util/AS7ManagerUtil.java 2011-11-25
12:35:34 UTC (rev 36658)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.internal.management.as71.util;
+
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.CHILD_TYPE;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.DEPLOYMENT;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.OUTCOME;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.RESULT;
+import static
org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.SUCCESS;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.Operation;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.dmr.Property;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.internal.management.as71.AS7Messages;
+import org.jboss.ide.eclipse.as.internal.management.as71.DefaultOperationRequestBuilder;
+import org.jboss.ide.eclipse.as.internal.management.as71.OperationFormatException;
+
+/**
+ * Various utility methods to deal with the as7 management api.
+ *
+ * @author Alexey Loubyansky
+ * @author André Dietisheim
+ */
+public class AS7ManagerUtil {
+
+ 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(AS7Messages.FailedToBuildOperation, e);
+ }
+
+ try {
+ ModelNode outcome = client.execute(request);
+ if (isSuccess(outcome)) {
+ return getList(outcome);
+ }
+ } catch (Exception e) {
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static Boolean getBooleanProperty(String propertyName, ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ ModelNode valueNode = node.get(propertyName);
+ if (valueNode == null) {
+ return null;
+ }
+ String value = valueNode.toString();
+ if (value == null
+ || valueNode.getType() != ModelType.BOOLEAN) {
+ return null;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ public static ModelNode execute(Operation operation, ModelControllerClient client)
throws JBoss7ManangerException {
+ 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 JBoss7ManangerException(result.get(FAILURE_DESCRIPTION).toString());
+ }
+ else {
+ throw new JBoss7ManangerException(NLS.bind(
+ AS7Messages.OperationOutcomeToString, result.get(OUTCOME).asString()));
+ }
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-api-3.0.0.CR4.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-api-3.0.0.CR4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-nio-3.0.0.CR4.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/xnio-nio-3.0.0.CR4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/as/plugins/pom.xml
===================================================================
--- trunk/as/plugins/pom.xml 2011-11-25 11:15:47 UTC (rev 36657)
+++ trunk/as/plugins/pom.xml 2011-11-25 12:35:34 UTC (rev 36658)
@@ -24,6 +24,7 @@
<module>org.jboss.ide.eclipse.as.rse.ui</module>
<module>org.jboss.ide.eclipse.as.jmx.integration</module>
<module>org.jboss.ide.eclipse.as.management.as7</module>
+ <module>org.jboss.ide.eclipse.as.management.as71</module>
</modules>
</project>