diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/Bundle.properties --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/Bundle.properties Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/Bundle.properties Fri Apr 13 17:11:53 2012 +0200 @@ -54,3 +54,5 @@ MSG_INVALID_URI=Invalid URI: {0} MSG_ERROR_CREATING_DM=Error during Deployment Manager creation. + +MSG_ApplicationStarted=Application started diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeployer.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeployer.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeployer.java Fri Apr 13 17:11:53 2012 +0200 @@ -265,7 +265,7 @@ // allow the thread to exit } - fireHandleProgressEvent(null, new JBDeploymentStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, StateType.COMPLETED, "Applicaton Deployed")); + fireHandleProgressEvent(null, new JBDeploymentStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, StateType.COMPLETED, "Application deployed")); } /** diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java Fri Apr 13 17:11:53 2012 +0200 @@ -156,6 +156,11 @@ // dom4j.jar library for JBoss Application Server 4.0.5 domFile = new File(domainRoot, JBPluginUtils.LIB + "dom4j.jar"); // NOI18N } + + String sep = File.separator; + if (!domFile.exists() && "7".equals(JBVer.getMajorNumber())) { + domFile = new File(serverRoot, JBPluginUtils.MODULES + "org" + sep + "dom4j" + sep + "main" + sep + "dom4j-1.6.1.jar"); // NOI18N + } if (!domFile.exists()) { domFile = null; LOGGER.log(Level.INFO, "No dom4j.jar availabale on classpath"); // NOI18N @@ -179,7 +184,29 @@ urlList.add(domFile.toURI().toURL()); } - if (version5Above) { + if ("7".equals(JBVer.getMajorNumber())) { + + File org = new File(serverRoot, JBPluginUtils.MODULES + "org"); + File jboss = new File(org, "jboss"); + File as = new File(jboss, "as"); + String versionString = JBVer.getMajorNumber()+"."+JBVer.getMinorNumber()+"."+JBVer.getMicroNumber()+"."+JBVer.getUpdate(); + + if (domFile.exists()) { + urlList.add(domFile.toURI().toURL()); + } + + urlList.add(new File(serverRoot, "jboss-modules.jar").toURI().toURL()); + urlList.add(new File(serverRoot, "bin"+sep+"client"+sep+"jboss-client.jar").toURI().toURL()); + urlList.add(new File(jboss, "logging" + sep + "main" + sep + "jboss-logging-3.1.0.GA.jar").toURI().toURL()); + urlList.add(new File(jboss, "threads" + sep + "main" + sep + "jboss-threads-2.0.0.GA.jar").toURI().toURL()); + urlList.add(new File(jboss, "remoting3" + sep + "main" + sep + "jboss-remoting-3.2.3.GA.jar").toURI().toURL()); + urlList.add(new File(jboss, "xnio" + sep + "main" + sep + "xnio-api-3.0.3.GA.jar").toURI().toURL()); + urlList.add(new File(jboss, "msc" + sep + "main" + sep + "jboss-msc-1.0.2.GA.jar").toURI().toURL()); + urlList.add(new File(as, "ee" + sep + "deployment" + sep + "main" + sep + "jboss-as-ee-deployment-" + versionString + ".jar").toURI().toURL()); + urlList.add(new File(as, "naming" + sep + "main" + sep + "jboss-as-naming-" + versionString + ".jar").toURI().toURL()); + urlList.add(new File(as, "controller-client" + sep + "main" + sep + "jboss-as-controller-client-" + versionString + ".jar").toURI().toURL()); + urlList.add(new File(as, "protocol" + sep + "main" + sep + "jboss-as-protocol-" + versionString + ".jar").toURI().toURL()); + } else if (version5Above) { // get lient class path for Jboss 5.0 List clientClassUrls = JBPluginUtils.getJB5ClientClasspath( serverRoot); @@ -274,9 +301,14 @@ jbossFactory = (DeploymentFactory) FACTORIES_CACHE.get(ip); } if (jbossFactory == null) { + Version version = JBPluginUtils.getServerVersion(new File(jbossRoot)); URLClassLoader loader = (ip != null) ? getJBClassLoader(ip) : createJBClassLoader(jbossRoot, domainRoot); - jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N + if (version != null && "7".equals(version.getMajorNumber())) { // NOI18N + jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.as.ee.deployment.spi.factories.DeploymentFactoryImpl").newInstance(); // NOI18N + } else { + jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance(); // NOI18N + } if (ip != null) { FACTORIES_CACHE.put(ip, jbossFactory); diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java Fri Apr 13 17:11:53 2012 +0200 @@ -59,15 +59,22 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.enterprise.deploy.model.DeployableObject; +import javax.enterprise.deploy.shared.ActionType; +import javax.enterprise.deploy.shared.CommandType; import javax.enterprise.deploy.shared.DConfigBeanVersionType; import javax.enterprise.deploy.shared.ModuleType; +import javax.enterprise.deploy.shared.StateType; import javax.enterprise.deploy.spi.DeploymentConfiguration; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.Target; import javax.enterprise.deploy.spi.TargetModuleID; import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException; import javax.enterprise.deploy.spi.exceptions.InvalidModuleException; +import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException; import javax.enterprise.deploy.spi.exceptions.TargetException; +import javax.enterprise.deploy.spi.status.ClientConfiguration; +import javax.enterprise.deploy.spi.status.DeploymentStatus; +import javax.enterprise.deploy.spi.status.ProgressListener; import javax.enterprise.deploy.spi.status.ProgressObject; import javax.management.MBeanServerConnection; import javax.management.remote.JMXConnector; @@ -76,8 +83,12 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import org.netbeans.modules.j2ee.jboss4.ide.JBDeploymentStatus; +import org.netbeans.modules.j2ee.jboss4.ide.JBFinishedProgressObject; import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties; import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils; +import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version; +import org.openide.util.NbBundle; /** * @@ -177,8 +188,10 @@ System.setProperty(JAVA_SEC_AUTH_LOGIN_CONF, securityConf.getAbsolutePath()); // NOI18N } - // Gets naming context - ctx = new InitialContext(env); + if(!props.isVersion(JBPluginUtils.JBOSS_7_0_0)) { + // Gets naming context + ctx = new InitialContext(env); + } //restore java.security.auth.login.config system property if (oldAuthConf != null) { @@ -189,23 +202,33 @@ MBeanServerConnection rmiServer = null; try { - conn = JMXConnectorFactory.connect(new JMXServiceURL( - "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi")); + JMXServiceURL url; + if(props.isVersion(JBPluginUtils.JBOSS_7_0_0)) { + // using management-native port + url = new JMXServiceURL( + System.getProperty("jmx.service.url","service:jmx:remoting-jmx://localhost:9999")); // NOI18N + } else { + url = new JMXServiceURL( + "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi"); // NOI18N + } + conn = JMXConnectorFactory.connect(url); rmiServer = conn.getMBeanServerConnection(); } catch (IOException ex) { LOGGER.log(Level.FINE, null, ex); } - if (rmiServer == null) { + if (rmiServer == null && ctx != null) { // Lookup RMI Adaptor rmiServer = (MBeanServerConnection) ctx.lookup("/jmx/invoker/RMIAdaptor"); // NOI18N } JBoss5ProfileServiceProxy profileService = null; - Object service = ctx.lookup("ProfileService"); // NOI18N - if (service != null) { - profileService = new JBoss5ProfileServiceProxy(service); + if (ctx != null) { + Object service = ctx.lookup("ProfileService"); // NOI18N + if (service != null) { + profileService = new JBoss5ProfileServiceProxy(service); + } } return action.action(rmiServer, profileService); @@ -288,8 +311,13 @@ return dm.stop(targetModuleID); } - public ProgressObject start(TargetModuleID[] targetModuleID) throws IllegalStateException { - return dm.start(targetModuleID); + public ProgressObject start(final TargetModuleID[] targetModuleID) throws IllegalStateException { + if (!getProperties().isVersion(JBPluginUtils.JBOSS_7_0_0)) { + return dm.start(targetModuleID); + } + // FIXME JBTargetModule is not accepted + return new JBFinishedProgressObject(CommandType.START, NbBundle.getMessage( + JBDeploymentManager.class, "MSG_ApplicationStarted"), targetModuleID); } public void setLocale(Locale locale) throws UnsupportedOperationException { diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBFinishedProgressObject.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBFinishedProgressObject.java Fri Apr 13 17:11:53 2012 +0200 @@ -0,0 +1,108 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.modules.j2ee.jboss4.ide; + +import javax.enterprise.deploy.shared.ActionType; +import javax.enterprise.deploy.shared.CommandType; +import javax.enterprise.deploy.shared.StateType; +import javax.enterprise.deploy.spi.TargetModuleID; +import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException; +import javax.enterprise.deploy.spi.status.ClientConfiguration; +import javax.enterprise.deploy.spi.status.DeploymentStatus; +import javax.enterprise.deploy.spi.status.ProgressListener; +import javax.enterprise.deploy.spi.status.ProgressObject; + +/** + * + * @author Petr Hejl + */ +public class JBFinishedProgressObject implements ProgressObject { + + private final JBDeploymentStatus status; + private final TargetModuleID[] ids; + + public JBFinishedProgressObject(CommandType command, String message, TargetModuleID[] ids) { + this.ids = ids; + this.status = new JBDeploymentStatus(ActionType.EXECUTE, command, StateType.COMPLETED, message); + } + + @Override + public DeploymentStatus getDeploymentStatus() { + return status; + } + + @Override + public TargetModuleID[] getResultTargetModuleIDs() { + return ids; + } + + @Override + public ClientConfiguration getClientConfiguration(TargetModuleID tmid) { + return null; + } + + @Override + public boolean isCancelSupported() { + return false; + } + + @Override + public void cancel() throws OperationUnsupportedException { + } + + @Override + public boolean isStopSupported() { + return false; + } + + @Override + public void stop() throws OperationUnsupportedException { + } + + @Override + public void addProgressListener(ProgressListener pl) { + } + + @Override + public void removeProgressListener(ProgressListener pl) { + } +} diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBOutputSupport.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBOutputSupport.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBOutputSupport.java Fri Apr 13 17:11:53 2012 +0200 @@ -309,10 +309,11 @@ || line.indexOf("Starting JBossAS") > -1) { // JBoss 6.0 message // NOI18N LOGGER.log(Level.FINER, "STARTING message fired"); // NOI18N //fireStartProgressEvent(StateType.RUNNING, createProgressMessage("MSG_START_SERVER_IN_PROGRESS")); // NOI18N - } else if ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N + } else if ( ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N || line.indexOf("JBoss (Microcontainer)") > -1 // JBoss 5.0 message // NOI18N || line.indexOf("JBossAS") > -1) // JBoss 6.0 message // NOI18N - && line.indexOf("Started in") > -1) { // NOI18N + && line.indexOf("Started in") > -1) + || line.indexOf("JBoss AS") > -1 && line.indexOf("started in") > -1) { // NOI18N LOGGER.log(Level.FINER, "STARTED message fired"); // NOI18N synchronized (JBOutputSupport.this) { diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Fri Apr 13 17:11:53 2012 +0200 @@ -79,6 +79,7 @@ import org.openide.util.Utilities; import org.openide.util.lookup.Lookups; import org.openide.windows.InputOutput; +import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version; /** * @@ -100,8 +101,12 @@ private final static String STARTUP_SH = File.separator + "bin" + File.separator + "run.sh"; // NOI18N + private final static String STANDALONE_SH = File.separator + + "bin" + File.separator + "standalone.sh"; // NOI18N private final static String STARTUP_BAT = File.separator + "bin" + File.separator + RUN_FILE_NAME; // NOI18N + private final static String STANDALONE_BAT = File.separator + + "bin" + File.separator + "standalone.bat"; // NOI18N private final static String CONF_BAT = File.separator + "bin" + File.separator + CONF_FILE_NAME; // NOI18N @@ -316,7 +321,7 @@ final String instanceName = ip.getProperty(JBPluginProperties.PROPERTY_SERVER); String args = ("all".equals(instanceName) ? "-b 127.0.0.1 " : "") + "-c " + instanceName; // NOI18N - return new NbProcessDescriptor(serverRunFileName, args); + return new NbProcessDescriptor(serverRunFileName, isJBoss7()? "" : args); } private String getRunFileName( InstanceProperties ip, String[] envp ){ @@ -351,13 +356,17 @@ Logger.getLogger("global").log(Level.INFO, null, ioe); final String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR); - final String serverRunFileName = serverLocation + (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH); + final String serverRunFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH); fireStartProgressEvent(StateType.FAILED, createProgressMessage("MSG_START_SERVER_FAILED_PD", serverRunFileName)); return null; } } + private boolean isJBoss7() { + return dm.getProperties().isVersion(JBPluginUtils.JBOSS_7_0_0); + } + private InputOutput openConsole() { InputOutput io = UISupport.getServerIO(dm.getUrl()); if (io == null) { @@ -414,7 +423,7 @@ String serverLocation = getProperties().getProperty( JBPluginProperties.PROPERTY_ROOT_DIR); String serverRunFileName = serverLocation + - (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH); + (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH); if ( needChange ){ String contentRun = readFile(serverRunFileName); String contentConf = readFile(serverLocation + CONF_BAT); diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java Fri Apr 13 17:11:53 2012 +0200 @@ -75,6 +75,8 @@ import javax.management.MBeanServerConnection; import org.netbeans.modules.j2ee.jboss4.JBRemoteAction; import org.netbeans.modules.j2ee.jboss4.JBoss5ProfileServiceProxy; +import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils; +import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version; import org.openide.util.NbBundle; import org.netbeans.modules.j2ee.jboss4.nodes.Util; @@ -249,22 +251,32 @@ @Override public Void action(MBeanServerConnection connection, JBoss5ProfileServiceProxy profileService) throws Exception { - Object serverName = Util.getMBeanParameter(connection, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N - Object serverHome = Util.getMBeanParameter(connection, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N - boolean isJBoss6 = serverHome != null; - if (!isJBoss6) { - serverHome = Util.getMBeanParameter(connection, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N - } - try { - if (serverHome != null) { - if (isJBoss6) { - serverHome = new File(((URL) serverHome).toURI()).getAbsolutePath(); - } else { - serverHome = ((File) serverHome).getAbsolutePath(); + Object serverName = null; + Object serverHome = null; + if (dm.getProperties().isVersion(JBPluginUtils.JBOSS_7_0_0)) { + serverHome = Util.getMBeanParameter(connection, "baseDir", "jboss.as:core-service=server-environment"); //NOI18N + serverName = Util.getMBeanParameter(connection, "launchType", "jboss.as:core-service=server-environment"); //NOI18N + if (serverName != null) { + serverName = serverName.toString().toLowerCase(); + } + } else { + serverName = Util.getMBeanParameter(connection, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N + serverHome = Util.getMBeanParameter(connection, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N + boolean isJBoss6 = serverHome != null; + if (!isJBoss6) { + serverHome = Util.getMBeanParameter(connection, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N + } + try { + if (serverHome != null) { + if (isJBoss6) { + serverHome = new File(((URL) serverHome).toURI()).getAbsolutePath(); + } else { + serverHome = ((File) serverHome).getAbsolutePath(); + } } + } catch (URISyntaxException use) { + LOGGER.log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N } - } catch (URISyntaxException use) { - LOGGER.log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N } if (serverName == null || serverHome == null) { diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStopRunnable.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStopRunnable.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStopRunnable.java Fri Apr 13 17:11:53 2012 +0200 @@ -77,7 +77,9 @@ private static final Logger LOGGER = Logger.getLogger(JBStopRunnable.class.getName()); private static final String SHUTDOWN_SH = "/bin/shutdown.sh"; // NOI18N + private static final String JBOSS_CLI_SH = "/bin/jboss-cli.sh"; // NOI18N private static final String SHUTDOWN_BAT = "/bin/shutdown.bat"; // NOI18N + private static final String JBOSS_CLI_BAT = "/bin/jboss-cli.bat"; // NOI18N private static final int TIMEOUT = 300000; @@ -89,6 +91,10 @@ this.startServer = startServer; } + private boolean isJBoss7() { + return dm.getProperties().isVersion(JBPluginUtils.JBOSS_7_0_0); + } + private String[] createEnvironment() { JBProperties properties = dm.getProperties(); @@ -120,7 +126,7 @@ String serverName = ip.getProperty(InstanceProperties.DISPLAY_NAME_ATTR); String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR); - String serverStopFileName = serverLocation + (Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH); + String serverStopFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? JBOSS_CLI_BAT : JBOSS_CLI_SH :Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH); File serverStopFile = new File(serverStopFileName); if (!serverStopFile.exists()){ @@ -131,6 +137,10 @@ JBProperties properties = dm.getProperties(); StringBuilder additionalParams = new StringBuilder(32); int jnpPort = JBPluginUtils.getJnpPortNumber(ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR)); + NbProcessDescriptor pd; + if(isJBoss7()) { + pd = new NbProcessDescriptor(serverStopFileName, "--connect --command=:shutdown"); // NOI18N + } else { if (dm.getProperties().getServerVersion().compareTo(JBPluginUtils.JBOSS_6_0_0) < 0) { additionalParams.append(" -s jnp://localhost:").append(jnpPort); // NOI18N } else { @@ -150,9 +160,9 @@ /* 2008-09-10 The usage of --halt doesn't solve the problem on Windows; it even creates another problem of NB Profiler not being notified about the fact that the server was stopped */ - NbProcessDescriptor pd = new NbProcessDescriptor( + pd = new NbProcessDescriptor( serverStopFileName, "--shutdown " + additionalParams); // NOI18N - + } Process stoppingProcess = null; try { String envp[] = createEnvironment(); diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties Fri Apr 13 17:11:53 2012 +0200 @@ -56,9 +56,9 @@ LBL_BrowseButton=Br&owse... -MSG_InvalidServerLocation=Provide a valid JBoss Application Server 6, 5 or 4 Location +MSG_InvalidServerLocation=Provide a valid JBoss Application Server 7, 6, 5 or 4 Location -MSG_SpecifyServerLocation=Please specify JBoss Application Server 6, 5 or 4 Location +MSG_SpecifyServerLocation=Please specify JBoss Application Server 7, 6, 5 or 4 Location LBL_ChooserName=Choose JBoss Server Location diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java Fri Apr 13 17:11:53 2012 +0200 @@ -146,15 +146,18 @@ Set result = new HashSet(); String displayName = (String)wizard.getProperty(PROP_DISPLAY_NAME); - - String url = JBDeploymentFactory.URI_PREFIX + host + ":" + port; // NOI18N + JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation)); + String url = JBDeploymentFactory.URI_PREFIX; + if(version != null && "7".equals(version.getMajorNumber())){ + url += "//"+host + ":" + port+"?targetType=as7&serverPort="+port; // NOI18N + } else { + url += host + ":" + port; // NOI18N + } if (server != null && !server.equals("")) // NOI18N url += "#" + server; // NOI18N url += "&"+ installLocation; // NOI18N try { - JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation)); - Map initialProperties = new HashMap(); initialProperties.put(JBPluginProperties.PROPERTY_SERVER, server); initialProperties.put(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir); diff -r f28f4261af1d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java Fri Apr 13 15:52:03 2012 +0200 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java Fri Apr 13 17:11:53 2012 +0200 @@ -91,6 +91,8 @@ public static final Version JBOSS_5_0_1 = new Version("5.0.1"); // NOI18N public static final Version JBOSS_6_0_0 = new Version("6.0.0"); // NOI18N + + public static final Version JBOSS_7_0_0 = new Version("7.0.0"); // NOI18N private static final Logger LOGGER = Logger.getLogger(JBPluginUtils.class.getName()); @@ -98,6 +100,8 @@ public static final String LIB = "lib" + File.separator; + public static final String MODULES = "modules" + File.separator; + public static final String CLIENT = "client" + File.separator; public static final String COMMON = "common" + File.separator; @@ -195,6 +199,21 @@ return domainRequirements6x; } + private static List domainRequirements7x; + + private static synchronized List getDomainRequirements7x() { + if (domainRequirements7x == null) { + domainRequirements7x = new ArrayList(11); + Collections.addAll(domainRequirements7x, + "configuration", // NOI18N + "deployments", // NOI18N + "lib" // NOI18N + ); + } + return domainRequirements7x; + } + + //--------------- checking for possible server directory ------------- private static List serverRequirements4x; @@ -249,6 +268,18 @@ return serverRequirements5And6x; } + private static List serverRequirements7x; + private static synchronized List getServerRequirements7x() { + if (serverRequirements7x == null) { + serverRequirements7x = new ArrayList(6); + Collections.addAll(serverRequirements7x, + "bin", // NOI18N + "modules", // NOI18N + "jboss-modules.jar"); // NOI18N + } + return serverRequirements7x; + } + //------------ getting exists servers--------------------------- /** * returns Hashmap @@ -262,14 +293,22 @@ File serverDirectory = new File(serverLocation); if (isGoodJBServerLocation(serverDirectory)) { - File file = new File(serverLocation + File.separator + "server"); // NOI18N - - String[] files = file.list(new FilenameFilter(){ + Version version = getServerVersion(serverDirectory); + File file; + String[] files; + if("7".equals(version.getMajorNumber())) { + files = new String[]{"standalone", "domain"}; + file = serverDirectory; + } else { + file = new File(serverLocation + File.separator + "server"); // NOI18N + files = file.list(new FilenameFilter(){ + @Override public boolean accept(File dir, String name){ if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true; return false; } }); + } for(int i = 0; i requirements){ @@ -372,19 +418,26 @@ return isGoodJBServerLocation(candidate, getServerRequirements5And6x()); } + private static boolean isGoodJBServerLocation7x(File candidate){ + return isGoodJBServerLocation(candidate, getServerRequirements7x()); + } + public static boolean isGoodJBServerLocation(File candidate) { Version version = getServerVersion(candidate); if (version == null || (!"4".equals(version.getMajorNumber()) && !"5".equals(version.getMajorNumber()) - && !"6".equals(version.getMajorNumber()))) { // NOI18N + && !"6".equals(version.getMajorNumber()) + && !"7".equals(version.getMajorNumber()))) { // NOI18N return JBPluginUtils.isGoodJBServerLocation4x(candidate) || JBPluginUtils.isGoodJBServerLocation5x(candidate) - || JBPluginUtils.isGoodJBServerLocation6x(candidate); + || JBPluginUtils.isGoodJBServerLocation5x(candidate) + || JBPluginUtils.isGoodJBServerLocation7x(candidate); } return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N - || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)); // NOI18N + || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)) // NOI18N + || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation7x(candidate)); // NOI18N } public static boolean isJB4(JBDeploymentManager dm) { @@ -435,6 +488,10 @@ * */ public static String getDeployDir(String domainDir){ + Version version = JBPluginUtils.getServerVersion(new File(JBPluginProperties.getInstance().getInstallLocation())); + if("7".equals(version.getMajorNumber())) { + return domainDir + File.separator + "deployments"; //NOI18N + } return domainDir + File.separator + "deploy"; //NOI18N //todo: get real deploy path } @@ -659,7 +716,26 @@ assert serverPath != null : "Can't determine version with null server path"; // NOI18N File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N - return getVersion(systemJarFile); + Version version = getVersion(systemJarFile); + if(version == null) { + // check for JBoss AS 7 + File serverDir = new File(serverPath, "modules/org/jboss/as/server/main"); + for (File jarFile : serverDir.listFiles(new JarFileFilter())) { + version = getVersion(jarFile); + if(version != null) { + break; + } + } + } + return version; + } + + static class JarFileFilter implements FilenameFilter { + + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".jar"); + } } private static Version getVersion(File systemJarFile) {