diff -r 4e33627b7c9d glassfish.javaee/nbproject/project.xml --- a/glassfish.javaee/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/glassfish.javaee/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -100,7 +100,7 @@ 4 - 1.59 + 1.65 diff -r 4e33627b7c9d glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java Thu Feb 11 12:29:03 2010 +0300 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java Mon Feb 15 11:56:38 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 4e33627b7c9d glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -25,6 +25,7 @@ + @@ -56,6 +57,7 @@ + diff -r 4e33627b7c9d ide.kit/test/qa-functional/data/whitelist_3.txt --- a/ide.kit/test/qa-functional/data/whitelist_3.txt Thu Feb 11 12:29:03 2010 +0300 +++ b/ide.kit/test/qa-functional/data/whitelist_3.txt Mon Feb 15 11:56:38 2010 +0100 @@ -141,33 +141,14 @@ 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.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 4e33627b7c9d j2ee.genericserver/nbproject/project.xml --- a/j2ee.genericserver/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.genericserver/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -84,7 +84,7 @@ 4 - 1.23 + 1.65 diff -r 4e33627b7c9d j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml --- a/j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.genericserver/src/org/netbeans/modules/j2ee/genericserver/resources/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -48,6 +48,7 @@ + diff -r 4e33627b7c9d j2ee.jboss4/nbproject/project.xml --- a/j2ee.jboss4/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.jboss4/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -122,7 +122,7 @@ 4 - 1.52 + 1.65 diff -r 4e33627b7c9d j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml --- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/resources/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -49,6 +49,7 @@ + diff -r 4e33627b7c9d j2ee.sun.appsrv81/nbproject/project.xml --- a/j2ee.sun.appsrv81/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.sun.appsrv81/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -189,7 +189,7 @@ 4 - 1.51 + 1.65 diff -r 4e33627b7c9d 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 Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/dm/SunDeploymentFactory.java Mon Feb 15 11:56:38 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 4e33627b7c9d 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 Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -54,6 +54,7 @@ + @@ -108,6 +109,7 @@ + @@ -162,6 +164,7 @@ + @@ -216,6 +219,7 @@ + diff -r 4e33627b7c9d j2ee.weblogic9/nbproject/project.xml --- a/j2ee.weblogic9/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.weblogic9/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -110,7 +110,7 @@ 4 - 1.23 + 1.65 diff -r 4e33627b7c9d j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml --- a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/resources/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -60,6 +60,7 @@ plugin --> + diff -r 4e33627b7c9d j2eeserver/apichanges.xml --- a/j2eeserver/apichanges.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/j2eeserver/apichanges.xml Mon Feb 15 11:56:38 2010 +0100 @@ -113,6 +113,24 @@ + + + + Optional attribute urlPattern for Factory.instance to prefilter + server instances on which server plugin is queried for support. + + + + + + +

+ Optional attribute urlPattern for Factory.instance may contain + regexp which the server instance url has to have. +

+
+ +
diff -r 4e33627b7c9d j2eeserver/nbproject/project.properties --- a/j2eeserver/nbproject/project.properties Thu Feb 11 12:29:03 2010 +0300 +++ b/j2eeserver/nbproject/project.properties Mon Feb 15 11:56:38 2010 +0100 @@ -39,7 +39,7 @@ 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 diff -r 4e33627b7c9d j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Server.java --- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Server.java Thu Feb 11 12:29:03 2010 +0300 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Server.java Mon Feb 15 11:56:38 2010 +0100 @@ -56,11 +56,11 @@ import org.netbeans.modules.j2ee.deployment.impl.ui.RegistryNodeProvider; import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory; import org.openide.util.Lookup; -import org.openide.cookies.InstanceCookie; import org.openide.nodes.Node; import org.openide.util.NbBundle; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.regex.Pattern; import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; import javax.enterprise.deploy.spi.DeploymentManager; import javax.xml.parsers.ParserConfigurationException; @@ -73,7 +73,6 @@ import org.netbeans.modules.j2ee.deployment.plugins.spi.RegistryNodeFactory; import org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport; import org.openide.filesystems.FileObject; -import org.openide.loaders.DataObject; import org.openide.util.lookup.Lookups; import org.xml.sax.SAXException; @@ -85,18 +84,22 @@ private static final String ATTR_NEEDS_FIND_SERVER_UI = "needsFindServerUI"; private final NetbeansDeployment dep; - private final Class factoryCls; private final String name; private final Lookup lkp; private final boolean needsFindServerUI; + private final Pattern urlPattern; + /** GuardedBy("this") */ private DeploymentFactory factory = null; /** GuardedBy("this") */ + private Class factoryCls = null; + /** GuardedBy("this") */ private DeploymentManager manager = null; /** GuardedBy("this") */ private RegistryNodeProvider nodeProvider = null; - + /** GuardedBy("this") */ + private boolean failed; public Server(FileObject fo) throws IOException, ParserConfigurationException, SAXException, ClassNotFoundException { @@ -112,43 +115,68 @@ needsFindServerUI = getBooleanValue(descriptor.getAttribute(ATTR_NEEDS_FIND_SERVER_UI), false); dep = NetbeansDeployment.createGraph(descriptor.getInputStream()); + FileObject factoryinstance = fo.getFileObject("Factory.instance"); + if (factoryinstance != null) { + Object regex = factoryinstance.getAttribute("urlPattern"); + if (regex != null) { + urlPattern = Pattern.compile(regex.toString()); + } else { + urlPattern = null; + } + } else { + urlPattern = null; + } lkp = Lookups.forPath(fo.getPath()); + + if (factoryinstance == null) { + String msg = NbBundle.getMessage(Server.class, "MSG_NoFactoryInstanceClass", name); + LOGGER.log(Level.SEVERE, msg); + } + } + + // not really sure about this code + private synchronized void initFactory() { + if ((factory != null && factoryCls != null) || failed) { + return; + } + factory = lkp.lookup(DeploymentFactory.class); if (factory != null) { factoryCls = factory.getClass(); + return; } else { - FileObject factoryinstance = fo.getFileObject("Factory.instance"); - if (factoryinstance == null) { - String msg = NbBundle.getMessage(Server.class, "MSG_NoFactoryInstanceClass", name); - LOGGER.log(Level.SEVERE, msg); - factoryCls = null; - return; - } - DataObject dobj = DataObject.find(factoryinstance); - InstanceCookie cookie = (InstanceCookie) dobj.getCookie(InstanceCookie.class); - if (cookie == null) { - String msg = NbBundle.getMessage(Server.class, "MSG_FactoryFailed", name); - LOGGER.log(Level.SEVERE, msg); - factoryCls = null; - return; - } - factoryCls = cookie.instanceClass(); + String msg = NbBundle.getMessage(Server.class, "MSG_FactoryFailed", name); + LOGGER.log(Level.SEVERE, msg); + failed = true; + return; - // speculative code depending on the DF implementation and if it registers - // itself with DFM or not - - try { - factory = (DeploymentFactory) cookie.instanceCreate(); - } catch (Exception e) { - LOGGER.log(Level.INFO, null, e); - } +// FIXME what is this crap? +// DataObject dobj = DataObject.find(factoryinstance); +// InstanceCookie cookie = (InstanceCookie) dobj.getCookie(InstanceCookie.class); +// if (cookie == null) { +// String msg = NbBundle.getMessage(Server.class, "MSG_FactoryFailed", name); +// LOGGER.log(Level.SEVERE, msg); +// factoryCls = null; +// return; +// } +// factoryCls = cookie.instanceClass(); +// +// // speculative code depending on the DF implementation and if it registers +// // itself with DFM or not +// +// try { +// factory = (DeploymentFactory) cookie.instanceCreate(); +// } catch (Exception e) { +// LOGGER.log(Level.INFO, null, e); +// } } } private synchronized DeploymentFactory getFactory() { + initFactory(); + if (factory == null) { - DeploymentFactory[] factories = DeploymentFactoryManager.getInstance().getDeploymentFactories(); for (int i = 0; i < factories.length; i++) { if (factoryCls.isInstance(factories[i])) { @@ -166,7 +194,7 @@ public synchronized DeploymentManager getDisconnectedDeploymentManager() throws DeploymentManagerCreationException { - if(manager == null) { + if (manager == null) { manager = getDisconnectedDeploymentManager(dep.getDisconnectedString()); } return manager; @@ -177,6 +205,12 @@ } public boolean handlesUri(String uri) { + if (uri != null && urlPattern != null) { + if (!urlPattern.matcher(uri).matches()) { + return false; + } + } + try { return getFactory().handlesURI(uri); } catch (Exception e) { diff -r 4e33627b7c9d tomcat5/nbproject/project.xml --- a/tomcat5/nbproject/project.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/tomcat5/nbproject/project.xml Mon Feb 15 11:56:38 2010 +0100 @@ -155,7 +155,7 @@ 4 - 1.51 + 1.65
diff -r 4e33627b7c9d tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml --- a/tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml Thu Feb 11 12:29:03 2010 +0300 +++ b/tomcat5/src/org/netbeans/modules/tomcat5/resources/layer.xml Mon Feb 15 11:56:38 2010 +0100 @@ -48,6 +48,7 @@ + @@ -81,6 +82,7 @@ + @@ -114,6 +116,7 @@ +