# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/java/NetBeansProjects/NBPlatform/j2ee.jboss7/src # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: jboss.patch --- jboss.patch Locally New +++ jboss.patch Locally New Index: org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java --- org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java Base (BASE) +++ org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java Locally Modified (Based On LOCAL) @@ -138,6 +138,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 @@ -161,7 +166,25 @@ 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(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(as, "ee" + sep + "deployment" + sep + "main" + sep + "jboss-as-ee-deployment-" + 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); @@ -252,8 +275,13 @@ jbossFactory = (DeploymentFactory) jbossFactories.get(jbossRoot); if ( jbossFactory == null ) { + Version version = JBPluginUtils.getServerVersion(new File(jbossRoot)); URLClassLoader loader = getJBClassLoader(jbossRoot, domainRoot); + if(version!= null && "7".equals(version.getMajorNumber())) { + 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 + } jbossFactories.put(jbossRoot, jbossFactory); } @@ -285,8 +313,8 @@ String jbURI = uri; try { jbURI = uri.substring(0, uri.indexOf("&")); // NOI18N - } - catch (Exception e) { + System.err.println("jbURI = " + jbURI); + } catch (Exception e) { LOGGER.log(Level.INFO, null, e); } Index: org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties --- org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties Base (BASE) +++ org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties Locally Modified (Based On LOCAL) @@ -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 Index: org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java --- org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java Base (BASE) +++ org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java Locally Modified (Based On LOCAL) @@ -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); Index: org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java --- org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java Base (BASE) +++ org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java Locally Modified (Based On LOCAL) @@ -53,6 +53,7 @@ import java.net.ServerSocket; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Hashtable; import java.util.List; @@ -98,6 +99,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 +198,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 +267,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 +292,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 +417,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 +487,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,9 +715,28 @@ 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) { if (!systemJarFile.exists()) { return null;