diff -r 41d5a0f1bef2 glassfish.javaee/nbproject/project.xml --- a/glassfish.javaee/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/glassfish.javaee/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -100,7 +100,7 @@ 4 - 1.59 + 1.65 diff -r 41d5a0f1bef2 glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java Wed Feb 17 14:22:39 2010 +0100 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java Wed Feb 17 20:14:39 2010 +0100 @@ -109,6 +109,7 @@ * @param uri * @return */ + // also check the urlPattern in layer.xml when changing this public boolean handlesURI(String uri) { if (uri == null) { return false; diff -r 41d5a0f1bef2 glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -25,8 +25,10 @@ - - + + + + @@ -56,8 +58,10 @@ - - + + + + diff -r 41d5a0f1bef2 ide.kit/test/qa-functional/data/whitelist_3.txt --- a/ide.kit/test/qa-functional/data/whitelist_3.txt Wed Feb 17 14:22:39 2010 +0100 +++ b/ide.kit/test/qa-functional/data/whitelist_3.txt Wed Feb 17 20:14:39 2010 +0100 @@ -141,33 +141,15 @@ org.netbeans.modules.j2ee.deployment.plugins.spi.ServerInstanceDescriptor org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer org.netbeans.modules.j2ee.deployment.plugins.spi.TargetModuleIDResolver -org.netbeans.modules.j2ee.genericserver.GSDeploymentFactory +org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory org.netbeans.modules.j2ee.genericserver.ide.GSOptionalDeploymentManagerFactory -org.netbeans.modules.j2ee.jboss4.JBDeploymentFactory org.netbeans.modules.j2ee.jboss4.ide.JBOptionalDeploymentManagerFactory -org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils -org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils$Version org.netbeans.modules.j2ee.sun.api.ServerLocationManager -org.netbeans.modules.j2ee.sun.ide.dm.Bundle -org.netbeans.modules.j2ee.sun.ide.dm.Bundle_en -org.netbeans.modules.j2ee.sun.ide.dm.Bundle_en_US -org.netbeans.modules.j2ee.sun.ide.dm.Constants -org.netbeans.modules.j2ee.sun.ide.dm.SunDeploymentFactory -org.netbeans.modules.j2ee.sun.ide.j2ee.Constants org.netbeans.modules.j2ee.sun.ide.j2ee.OptionalFactory -org.netbeans.modules.j2ee.sun.ide.j2ee.PluginProperties org.netbeans.modules.j2ee.sun.ide.j2ee.RunTimeDDCatalog -org.netbeans.modules.j2ee.sun.share.CharsetMapping -org.netbeans.modules.j2ee.sun.share.SecurityMasterListModel -org.netbeans.modules.j2ee.weblogic9.WLBaseDeploymentManager -org.netbeans.modules.j2ee.weblogic9.WLDeploymentFactory -org.netbeans.modules.j2ee.weblogic9.optional.WLOptionalDeploymentManagerFactory +org.netbeans.modules.j2ee.weblogic9.optional.WLOptionalFactory org.netbeans.modules.tomcat5.TomcatManager$TomcatVersion org.netbeans.modules.tomcat5.ide.OptionalFactory -org.netbeans.modules.glassfish.javaee.Hk2OptionalFactory -org.netbeans.modules.glassfish.javaee.Hk2DeploymentFactory -org.netbeans.modules.glassfish.javaee.Hk2OptionalFactory -org.netbeans.modules.tomcat5.TomcatFactory #IZ 177644 org.netbeans.modules.schema2beans.AttrProp diff -r 41d5a0f1bef2 j2ee.genericserver/nbproject/project.xml --- a/j2ee.genericserver/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.genericserver/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -84,7 +84,7 @@ 4 - 1.23 + 1.65 diff -r 41d5a0f1bef2 j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml --- a/j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -48,8 +48,10 @@ - - + + + + diff -r 41d5a0f1bef2 j2ee.jboss4/nbproject/project.xml --- a/j2ee.jboss4/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.jboss4/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -122,7 +122,7 @@ 4 - 1.52 + 1.65 diff -r 41d5a0f1bef2 j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -49,8 +49,10 @@ - - + + + + diff -r 41d5a0f1bef2 j2ee.sun.appsrv81/nbproject/project.xml --- a/j2ee.sun.appsrv81/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.sun.appsrv81/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -189,7 +189,7 @@ 4 - 1.51 + 1.65 diff -r 41d5a0f1bef2 j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/dm/SunDeploymentFactory.java --- a/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/dm/SunDeploymentFactory.java Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/dm/SunDeploymentFactory.java Wed Feb 17 20:14:39 2010 +0100 @@ -175,6 +175,7 @@ * @param uri * @return boolean value */ + // also check the urlPattern in layer.xml when changing this public boolean handlesURI(String uri) { if (uri==null){ return false; diff -r 41d5a0f1bef2 j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml --- a/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -54,8 +54,10 @@ - - + + + + @@ -108,8 +110,10 @@ - - + + + + @@ -162,8 +166,10 @@ - - + + + + @@ -216,8 +222,10 @@ - - + + + + diff -r 41d5a0f1bef2 j2ee.weblogic9/nbproject/project.xml --- a/j2ee.weblogic9/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.weblogic9/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -110,7 +110,7 @@ 4 - 1.23 + 1.65 diff -r 41d5a0f1bef2 j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml --- a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -60,8 +60,10 @@ plugin --> - - + + + + diff -r 41d5a0f1bef2 j2eeserver/api/doc/org/netbeans/modules/j2ee/deployment/plugins/api/doc-files/plugin-layer-file.html --- a/j2eeserver/api/doc/org/netbeans/modules/j2ee/deployment/plugins/api/doc-files/plugin-layer-file.html Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/api/doc/org/netbeans/modules/j2ee/deployment/plugins/api/doc-files/plugin-layer-file.html Wed Feb 17 20:14:39 2010 +0100 @@ -39,8 +39,11 @@ style="font-family: courier new,courier,monospace;">     </file>
-
+ style="font-family: courier new,courier,monospace;">
+ +See also org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory. +
+
3.  NetBeans instance class declaration of RegistryNodeFactory:
    diff -r 41d5a0f1bef2 j2eeserver/apichanges.xml --- a/j2eeserver/apichanges.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/apichanges.xml Wed Feb 17 20:14:39 2010 +0100 @@ -107,12 +107,37 @@ J2EE Server Common API - Server Integration Plugin SPI Support + Server Integration Plugin SPI Support + + + + Added class proxying the DeploymentFactory and adding + the optional urlPattern attribute. + + + + + + +

+ Added class ProxyDeploymentFactory which delegates all calls + to configured delegate. Via urlPattern it is possible to do + precheck of server instance uri. The uri has to mach the pattern + otherwise the instance is rejected as not supported but + the factory. +

+

+ Designed to be used from XML Layer. +

+
+ + +
diff -r 41d5a0f1bef2 j2eeserver/arch.xml --- a/j2eeserver/arch.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/arch.xml Wed Feb 17 20:14:39 2010 +0100 @@ -70,10 +70,22 @@ +

+ There are two separate api/spi sets in j2eeserver. The devmodules + api/spi is for j2ee development modules (web, j2ee app, etc). The + plugins api/spi is for server plugins. +

+ + + The spi classes are to be subclassed by dev modules and to be provided + as cookies on the development nodes. The api classes are to be used to + add actions/properties/additional cookies to those nodes. + + J2EE Server module serves as an integration point between two kinds of netbeans modules:
    -
  • server plugins (or simply plugins) that integrate various J2EE servers in IDE, and
  • +
  • server plugins (or simply plugins) that integrate various J2EE servers in IDE
  • devmodules - netbeans modules that provide support for development of J2EE modules (web module, EJB module, J2EE Application, etc.) and need to deploy and debug them on J2EE servers.
  • diff -r 41d5a0f1bef2 j2eeserver/nbproject/project.properties --- a/j2eeserver/nbproject/project.properties Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/nbproject/project.properties Wed Feb 17 20:14:39 2010 +0100 @@ -39,9 +39,8 @@ is.autoload=true javac.source=1.6 -spec.version.base=1.64.0 +spec.version.base=1.65.0 -javadoc.overview=${basedir}/api/doc/overview.html javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml javadoc.docfiles=${basedir}/api/doc diff -r 41d5a0f1bef2 j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/support/ProxyDeploymentFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/support/ProxyDeploymentFactory.java Wed Feb 17 20:14:39 2010 +0100 @@ -0,0 +1,132 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2010 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 2010 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.support; + +import java.util.Map; +import java.util.regex.Pattern; +import javax.enterprise.deploy.spi.DeploymentManager; +import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException; +import javax.enterprise.deploy.spi.factories.DeploymentFactory; +import org.openide.util.Parameters; + +/** + * Provides a proxying implementation of {@link DeploymentFactory}. Handles + * optional urlPattern attribute as precheck for url the plugin + * can handle. Designed to be used via XML layer filesystem. + *

    + * The urlPattern attribute is expected to be regexp string. + * If it is present the server instance uri must match the regexp otherwise + * {@link #handlesURI(java.lang.String)} will automatically return false + * (before querying the delegate). + * + * @author Petr Hejl + */ +public final class ProxyDeploymentFactory implements DeploymentFactory { + + private final Map attributes; + + private final Pattern urlPattern; + + private DeploymentFactory delegate; + + private ProxyDeploymentFactory(Map attributes) { + this.attributes = attributes; + + String pattern = (String) attributes.get("urlPattern"); // NOI18N + if (pattern != null) { + urlPattern = Pattern.compile(pattern); + } else { + urlPattern = null; + } + } + + public static ProxyDeploymentFactory create(Map map) { + return new ProxyDeploymentFactory(map); + } + + @Override + public boolean handlesURI(String string) { + if (string == null) { + return false; + } + if (urlPattern != null && !urlPattern.matcher(string).matches()) { + return false; + } + return getDelegate().handlesURI(string); + } + + @Override + public String getProductVersion() { + return getDelegate().getProductVersion(); + } + + @Override + public String getDisplayName() { + return getDelegate().getDisplayName(); + } + + @Override + public DeploymentManager getDisconnectedDeploymentManager(String string) throws DeploymentManagerCreationException { + return getDelegate().getDisconnectedDeploymentManager(string); + } + + @Override + public DeploymentManager getDeploymentManager(String string, String string1, String string2) throws DeploymentManagerCreationException { + return getDelegate().getDeploymentManager(string, string1, string2); + } + + private DeploymentFactory getDelegate() { + synchronized (this) { + if (delegate != null) { + return delegate; + } + } + + DeploymentFactory factory = (DeploymentFactory) attributes.get("delegate"); // NOI18N + Parameters.notNull("delegate", factory); // NOI18N + + synchronized (this) { + if (delegate == null) { + delegate = factory; + } + return delegate; + } + } +} diff -r 41d5a0f1bef2 j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/plugins/api/InstancePropertiesTest.java --- a/j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/plugins/api/InstancePropertiesTest.java Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/plugins/api/InstancePropertiesTest.java Wed Feb 17 20:14:39 2010 +0100 @@ -197,9 +197,8 @@ private static class MockDF extends org.netbeans.tests.j2eeserver.plugin.jsr88.TestDeploymentFactory { - @Override - public boolean handlesURI(String arg0) { - return arg0.startsWith("unknown:"); + public MockDF() { + super("unknown:"); } } diff -r 41d5a0f1bef2 j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/plugins/spi/UrlPatternTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/j2eeserver/test/unit/src/org/netbeans/modules/j2ee/deployment/plugins/spi/UrlPatternTest.java Wed Feb 17 20:14:39 2010 +0100 @@ -0,0 +1,75 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2010 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 2010 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; +import org.netbeans.modules.j2ee.deployment.impl.ServerRegistryTestBase; +import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException; +import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; + +/** + * + * @author Petr Hejl + */ +public class UrlPatternTest extends ServerRegistryTestBase { + + private static final String TEST_URL_PREFIX_PERMITTED = "permittedfooservice:"; + + private static final String TEST_URL_PREFIX_FORBIDDEN = "forbiddenfooservice:"; + + public UrlPatternTest(String name) { + super(name); + } + + public void testPermittedPattern() throws InstanceCreationException { + InstanceProperties.createInstanceProperties( + TEST_URL_PREFIX_PERMITTED + "testPermitted", "test", "password", "Permitted instance"); + } + + public void testForbiddenPattern() throws InstanceCreationException { + try { + InstanceProperties.createInstanceProperties( + TEST_URL_PREFIX_FORBIDDEN + "testForbidden", "test", "password", "Forbidden instance"); + fail("Forbidden instance registered"); + } catch (InstanceCreationException ex) { + // expected + } + } +} diff -r 41d5a0f1bef2 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/TestDeploymentFactory.java --- a/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/TestDeploymentFactory.java Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/jsr88/TestDeploymentFactory.java Wed Feb 17 20:14:39 2010 +0100 @@ -47,14 +47,22 @@ /** * - * @author gfink + * @author Petr Hejl */ public class TestDeploymentFactory implements DeploymentFactory { - + private Map managers = new HashMap(); + private final String prefix; + /** Creates a new instance of DepFactory */ - public TestDeploymentFactory() { + protected TestDeploymentFactory(String prefix) { + assert prefix != null; + this.prefix = prefix; + } + + public static TestDeploymentFactory create(Map map) { + return new TestDeploymentFactory((String) map.get("prefix")); } public synchronized javax.enterprise.deploy.spi.DeploymentManager getDeploymentManager(String str, String str1, String str2) throws javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException { @@ -84,7 +92,7 @@ } public boolean handlesURI(String str) { - return (str != null && str.startsWith("fooservice")); + return (str != null && str.startsWith(prefix)); } } diff -r 41d5a0f1bef2 j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml --- a/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/j2eeserver/test/unit/src/org/netbeans/tests/j2eeserver/plugin/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -52,7 +52,8 @@ - + + @@ -87,12 +88,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + diff -r 41d5a0f1bef2 tomcat5/nbproject/project.xml --- a/tomcat5/nbproject/project.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/tomcat5/nbproject/project.xml Wed Feb 17 20:14:39 2010 +0100 @@ -155,7 +155,7 @@ 4 - 1.51 + 1.65 diff -r 41d5a0f1bef2 tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml --- a/tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml Wed Feb 17 14:22:39 2010 +0100 +++ b/tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml Wed Feb 17 20:14:39 2010 +0100 @@ -48,9 +48,11 @@ - - - + + + + + @@ -81,9 +83,11 @@ - - - + + + + + @@ -114,9 +118,11 @@ - - - + + + + +