diff -r 0f802aba5996 j2eeserver/apichanges.xml --- a/j2eeserver/apichanges.xml Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/apichanges.xml Mon Apr 28 12:35:14 2008 +0200 @@ -111,6 +111,25 @@ is the proper place. + + + + Add Lookup to J2eePlatformImpl to make it extensible. + + + + + + +

+ J2eePlatform should provide Lookup containing support for + other technologies the server can provide (such as web services). +

+
+ + + +
diff -r 0f802aba5996 j2eeserver/nbproject/project.properties --- a/j2eeserver/nbproject/project.properties Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/nbproject/project.properties Mon Apr 28 12:35:14 2008 +0200 @@ -39,7 +39,7 @@ is.autoload=true javac.source=1.5 -spec.version.base=1.42.0 +spec.version.base=1.43.0 javadoc.overview=${basedir}/api/doc/overview.html javadoc.arch=${basedir}/arch.xml diff -r 0f802aba5996 j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java --- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java Mon Apr 28 12:35:14 2008 +0200 @@ -68,6 +68,7 @@ import org.openide.filesystems.FileObjec import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; +import org.openide.util.Lookup; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -301,6 +302,7 @@ public final class J2eePlatform { * * @param toolName tool name, for example {@link #TOOL_APP_CLIENT_RUNTIME}. * @return classpath for the specified tool. + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public File[] getToolClasspathEntries(String toolName) { return impl.getToolClasspathEntries(toolName); @@ -323,6 +325,7 @@ public final class J2eePlatform { * specified tool. * * @since 1.16 + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public String getToolProperty(String toolName, String propertyName) { return impl.getToolProperty(toolName, propertyName); @@ -335,6 +338,7 @@ public final class J2eePlatform { * @param toolName tool name, for example {@link #TOOL_APP_CLIENT_RUNTIME}. * @return true if platform supports tool of the given name, * false otherwise. + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public boolean isToolSupported(String toolName) { return impl.isToolSupported(toolName); @@ -548,6 +552,21 @@ public final class J2eePlatform { return manager.createURILibrary(ServerLibraryTypeProvider.LIBRARY_TYPE, libraryName, content); // NOI18N } + /** + * Lookup providing a way to find non mandatory technologies supported + * by the platform. + *

+ *

+ * The typical example of such support is a webservice stack. + *
+ * + * @return Lookup providing way to find other supported technologies + * @since 1.43 + */ + public Lookup getLookup() { + return impl.getLookup(); + } + private FileObject[] getVolumeContent(J2eePlatform platform, String volumeType) { LibraryImplementation[] libraries = platform.getLibraries(); List ret = new ArrayList(); diff -r 0f802aba5996 j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java --- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java Mon Apr 28 12:35:14 2008 +0200 @@ -49,6 +49,7 @@ import java.util.Set; import java.util.Set; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.spi.project.libraries.LibraryImplementation; +import org.openide.util.Lookup; /** * Base SPI interface for J2eePlatform. The J2eePlatform describes the target @@ -106,6 +107,7 @@ public abstract class J2eePlatformImpl { * * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}. * @return classpath for the specified tool. + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public abstract File[] getToolClasspathEntries(String toolName); @@ -117,6 +119,7 @@ public abstract class J2eePlatformImpl { * . * @return true if platform supports tool of the given name, * false otherwise. + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public abstract boolean isToolSupported(String toolName); @@ -229,8 +232,25 @@ public abstract class J2eePlatformImpl { * specified tool. * * @since 1.16 + * @deprecated {@link #getLookup()} should be used to obtain tool specifics */ public String getToolProperty(String toolName, String propertyName) { return null; } + + /** + * Lookup providing a way to find non mandatory technologies supported + * by the platform. + *

+ *

+ * The typical example of such support is a webservice stack. + *
+ * + * @return Lookup providing way to find other supported technologies + * @since 1.43 + */ + public Lookup getLookup() { + return Lookup.EMPTY; + } + } diff -r 0f802aba5996 j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatformTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatformTest.java Mon Apr 28 12:35:14 2008 +0200 @@ -0,0 +1,80 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.j2ee.deployment.devmodules.api; + +import java.util.HashMap; +import java.util.Map; +import org.netbeans.modules.j2ee.deployment.impl.ServerRegistryTestBase; +import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; +import org.netbeans.tests.j2eeserver.plugin.jsr88.DepManager; + +/** + * + * @author Petr Hejl + */ +public class J2eePlatformTest extends ServerRegistryTestBase { + + private static final String TEST_URL = "fooservice:j2eePlatformTest"; + + private static final String TEST_USERNAME = "username"; + + private static final String TEST_PASSWORD = "password"; + + private static final String TEST_DISPLAY_NAME = "j2eePlatformTest"; + + public J2eePlatformTest(String name) { + super(name); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + Map props = new HashMap(); + props.put(DepManager.PLATFORM_ROOT_PROPERTY, getWorkDirPath()); + + InstanceProperties.createInstanceProperties(TEST_URL, + TEST_USERNAME, TEST_PASSWORD, TEST_DISPLAY_NAME); + } + + public void testLookup() { + J2eePlatform platform = Deployment.getDefault().getJ2eePlatform(TEST_URL); + assertNotNull(platform.getLookup()); + } +} diff -r 0f802aba5996 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/TestPlatform.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/TestPlatform.java Mon Apr 28 12:35:14 2008 +0200 @@ -0,0 +1,126 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.tests.j2eeserver.plugin; + +import java.awt.Image; +import java.io.File; +import java.util.HashSet; +import java.util.Set; +import org.netbeans.api.java.platform.JavaPlatform; +import org.netbeans.api.java.platform.JavaPlatformManager; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl; +import org.netbeans.spi.project.libraries.LibraryImplementation; +import org.openide.util.Utilities; + +/** + * + * @author Petr Hejl + */ +public class TestPlatform extends J2eePlatformImpl { + + private final File platformRoot; + + public TestPlatform(File platformRoot) { + this.platformRoot = platformRoot; + } + + @Override + public String getDisplayName() { + return "Test platform"; + } + + @Override + public Image getIcon() { + return Utilities.loadImage("org/netbeans/tests/j2eeserver/plugin/registry/plugin.gif"); + } + + @Override + public JavaPlatform getJavaPlatform() { + return JavaPlatformManager.getDefault().getDefaultPlatform(); + } + + @Override + public LibraryImplementation[] getLibraries() { + return new LibraryImplementation[]{}; + } + + @Override + public File[] getPlatformRoots() { + return new File[] {platformRoot}; + } + + @Override + public Set getSupportedJavaPlatformVersions() { + Set versions = new HashSet(); + versions.add("1.4"); // NOI18N + versions.add("1.5"); // NOI18N + return versions; + } + + @Override + public Set getSupportedModuleTypes() { + Set moduleTypes = new HashSet(1); + moduleTypes.add(J2eeModule.WAR); + moduleTypes.add(J2eeModule.EJB); + moduleTypes.add(J2eeModule.EAR); + return moduleTypes; + } + + @Override + public Set getSupportedSpecVersions() { + Set specVersions = new HashSet(3); + specVersions.add(J2eeModule.J2EE_13); + specVersions.add(J2eeModule.J2EE_14); + specVersions.add(J2eeModule.JAVA_EE_5); + return specVersions; + } + + @Override + public File[] getToolClasspathEntries(String toolName) { + return new File[] {}; + } + + @Override + public boolean isToolSupported(String toolName) { + return false; + } + +} diff -r 0f802aba5996 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/TestPlatformFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/TestPlatformFactory.java Mon Apr 28 12:35:14 2008 +0200 @@ -0,0 +1,63 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.tests.j2eeserver.plugin; + +import java.io.File; +import javax.enterprise.deploy.spi.DeploymentManager; +import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory; +import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl; +import org.netbeans.tests.j2eeserver.plugin.jsr88.DepManager; + +/** + * + * @author Petr Hejl + */ +public class TestPlatformFactory extends J2eePlatformFactory { + + @Override + public J2eePlatformImpl getJ2eePlatformImpl(DeploymentManager dm) { + String property = ((DepManager) dm).getInstanceProperties().getProperty(DepManager.PLATFORM_ROOT_PROPERTY); + if (property == null) { + property = System.getProperty("java.io.tmpdir", null); + } + return new TestPlatform(new File(property)); + } + +} diff -r 0f802aba5996 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/DepManager.java --- a/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/DepManager.java Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/DepManager.java Mon Apr 28 12:35:14 2008 +0200 @@ -56,13 +56,20 @@ import org.netbeans.modules.j2ee.deploym * @author nn136682 */ public class DepManager implements DeploymentManager { - String name; + + public static final String PLATFORM_ROOT_PROPERTY = "platform"; + + private final String url; /** Creates a new instance of DepFactory */ public DepManager(String url, String user, String password) { - name = url; + this.url = url; } - public String getName() { return name ; } + public String getName() { return url ; } + + public InstanceProperties getInstanceProperties() { + return InstanceProperties.getInstanceProperties(url); + } public DeploymentConfiguration createConfiguration(DeployableObject deployableObject) throws InvalidModuleException { return null; diff -r 0f802aba5996 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml --- a/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml Mon Apr 28 11:37:56 2008 +0200 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml Mon Apr 28 12:35:14 2008 +0200 @@ -63,6 +63,10 @@ made subject to such option by the copyr + + + +