diff -r e816be79dee1 core.netigso/arch.xml
--- a/core.netigso/arch.xml Tue Nov 22 13:17:20 2011 +0100
+++ b/core.netigso/arch.xml Wed Nov 23 09:41:11 2011 +0100
@@ -643,6 +643,14 @@
Only modules with lower or equal start level than value of this
key will be started.
+
+ Bundles that don't provide own start level (via config/Modules/*.xml files),
+ get no start level by default in the NetBeans Platform,
+ however that can be changed by branding the DEFAULT_BUNDLE_START_LEVEL
key in
+ org/netbeans/core/netigso/Bundle.properties
. NetBeans IDE
+ brands it to 4.
+
diff -r e816be79dee1 core.netigso/nbproject/project.xml
--- a/core.netigso/nbproject/project.xml Tue Nov 22 13:17:20 2011 +0100
+++ b/core.netigso/nbproject/project.xml Wed Nov 23 09:41:11 2011 +0100
@@ -55,7 +55,7 @@
1
- 2.43
+ 2.44.2
diff -r e816be79dee1 core.netigso/src/org/netbeans/core/netigso/Bundle.properties
--- a/core.netigso/src/org/netbeans/core/netigso/Bundle.properties Tue Nov 22 13:17:20 2011 +0100
+++ b/core.netigso/src/org/netbeans/core/netigso/Bundle.properties Wed Nov 23 09:41:11 2011 +0100
@@ -45,4 +45,5 @@
FRAMEWORK_START_LEVEL=
# NOI18N
MODULE_START_LEVEL=
-
+# NOI18N
+DEFAULT_BUNDLE_START_LEVEL=0
diff -r e816be79dee1 core.netigso/src/org/netbeans/core/netigso/Netigso.java
--- a/core.netigso/src/org/netbeans/core/netigso/Netigso.java Tue Nov 22 13:17:20 2011 +0100
+++ b/core.netigso/src/org/netbeans/core/netigso/Netigso.java Wed Nov 23 09:41:11 2011 +0100
@@ -101,6 +101,7 @@
private Framework framework;
private ClassLoader frameworkLoader;
private NetigsoActivator activator;
+ private Integer defaultStartLevel;
Framework getFramework() {
return framework;
@@ -223,6 +224,14 @@
}
@Override
+ protected int defaultStartLevel() {
+ if (defaultStartLevel == null) {
+ defaultStartLevel = Integer.parseInt(NbBundle.getMessage(Netigso.class, "DEFAULT_BUNDLE_START_LEVEL"));
+ }
+ return defaultStartLevel;
+ }
+
+ @Override
protected Set createLoader(ModuleInfo m, ProxyClassLoader pcl, File jar) throws IOException {
try {
assert registered.containsKey(m.getCodeNameBase()) : m.getCodeNameBase();
diff -r e816be79dee1 core.netigso/test/unit/src/org/netbeans/core/netigso/Bundle_def.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core.netigso/test/unit/src/org/netbeans/core/netigso/Bundle_def.properties Wed Nov 23 09:41:11 2011 +0100
@@ -0,0 +1,45 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2011 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 2011 Sun Microsystems, Inc.
+
+# NOI18N
+FRAMEWORK_START_LEVEL=10
+# NOI18N
+DEFAULT_BUNDLE_START_LEVEL=20
+
diff -r e816be79dee1 core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoDefaultModuleStartLevelTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoDefaultModuleStartLevelTest.java Wed Nov 23 09:41:11 2011 +0100
@@ -0,0 +1,104 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 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]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.netbeans.core.netigso;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import org.netbeans.Module;
+import org.netbeans.ModuleManager;
+import org.netbeans.SetupHid;
+import org.netbeans.core.startup.Main;
+import org.netbeans.core.startup.ModuleSystem;
+
+/**
+ * Do we correctly call the BundleActivators?
+ *
+ * @author Jaroslav Tulach
+ */
+public class NetigsoDefaultModuleStartLevelTest extends SetupHid {
+ private static Module m1;
+ private static ModuleManager mgr;
+ private int cnt;
+ private File simpleModule;
+
+ public NetigsoDefaultModuleStartLevelTest(String name) {
+ super(name);
+ }
+
+ protected @Override void setUp() throws Exception {
+ Locale.setDefault(new Locale("def", "ST"));
+ clearWorkDir();
+ File ud = new File(getWorkDir(), "ud");
+ ud.mkdirs();
+ System.setProperty("netbeans.user", ud.getPath());
+
+ data = new File(getDataDir(), "jars");
+ jars = new File(getWorkDir(), "space in path");
+ jars.mkdirs();
+ simpleModule = createTestJAR("activate", null);
+ }
+
+ public void testActivation() throws Exception {
+ ModuleSystem ms = Main.getModuleSystem();
+ mgr = ms.getManager();
+ mgr.mutexPrivileged().enterWriteAccess();
+ try {
+ m1 = mgr.create(simpleModule, null, false, false, false);
+ mgr.enable(m1);
+
+ Class> main = m1.getClassLoader().loadClass("org.activate.Main");
+ Object s = main.getField("start").get(null);
+ assertNull("Bundle is not started, only modules with start level lower than 10 are", s);
+
+ mgr.disable(m1);
+ } finally {
+ mgr.mutexPrivileged().exitWriteAccess();
+ }
+ }
+ private File createTestJAR(String name, String srcdir, File... classpath) throws IOException {
+ return createTestJAR(data, jars, name, srcdir, classpath);
+ }
+}
diff -r e816be79dee1 ide.branding/core.netigso/src/org/netbeans/core/netigso/Bundle_nb.properties
--- a/ide.branding/core.netigso/src/org/netbeans/core/netigso/Bundle_nb.properties Tue Nov 22 13:17:20 2011 +0100
+++ b/ide.branding/core.netigso/src/org/netbeans/core/netigso/Bundle_nb.properties Wed Nov 23 09:41:11 2011 +0100
@@ -1,2 +1,4 @@
#NOI18N
FRAMEWORK_START_LEVEL=10
+#NOI18N
+DEFAULT_BUNDLE_START_LEVEL=4
diff -r e816be79dee1 nbbuild/templates/projectized.xml
--- a/nbbuild/templates/projectized.xml Tue Nov 22 13:17:20 2011 +0100
+++ b/nbbuild/templates/projectized.xml Wed Nov 23 09:41:11 2011 +0100
@@ -231,11 +231,6 @@
-
-
-
-
-
diff -r e816be79dee1 o.n.bootstrap/src/org/netbeans/NetigsoFramework.java
--- a/o.n.bootstrap/src/org/netbeans/NetigsoFramework.java Tue Nov 22 13:17:20 2011 +0100
+++ b/o.n.bootstrap/src/org/netbeans/NetigsoFramework.java Wed Nov 23 09:41:11 2011 +0100
@@ -116,6 +116,15 @@
return getClass().getClassLoader();
}
+ /** Default start level for all bundles that don't specify any own.
+ *
+ * @since 2.44.2
+ * @return
+ */
+ protected int defaultStartLevel() {
+ return 0;
+ }
+
//
// Access to Archive
//
diff -r e816be79dee1 o.n.bootstrap/src/org/netbeans/NetigsoModule.java
--- a/o.n.bootstrap/src/org/netbeans/NetigsoModule.java Tue Nov 22 13:17:20 2011 +0100
+++ b/o.n.bootstrap/src/org/netbeans/NetigsoModule.java Wed Nov 23 09:41:11 2011 +0100
@@ -65,7 +65,7 @@
private final File jar;
private final Manifest manifest;
- private int startLevel;
+ private int startLevel = -1;
public NetigsoModule(Manifest mani, File jar, ModuleManager mgr, Events ev, Object history, boolean reloadable, boolean autoload, boolean eager) throws IOException {
super(mgr, ev, history, reloadable, autoload, eager);
@@ -224,7 +224,7 @@
@Override
final int getStartLevelImpl() {
- return startLevel;
+ return startLevel == -1 ? NetigsoFramework.getDefault().defaultStartLevel() : startLevel;
}
final void setStartLevel(int startLevel) {