diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
index e409bce4fa..ef2abe73f4 100644
--- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF
+++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
@@ -49,7 +49,7 @@ Require-Bundle: org.adempiere.report.jasper;bundle-version="1.0.0",
org.adempiere.ui;bundle-version="1.0.0",
org.zkoss.zk.library;bundle-version="6.0.0"
Bundle-Activator: org.adempiere.webui.WebUIActivator
-Bundle-ActivationPolicy: lazy
Eclipse-ExtensibleAPI: true
Eclipse-RegisterBuddy: org.zkoss.zk.library
Web-ContextPath: webui
+Service-Component: OSGI-INF/resourceLocator.xml
diff --git a/org.adempiere.ui.zk/OSGI-INF/resourceLocator.xml b/org.adempiere.ui.zk/OSGI-INF/resourceLocator.xml
new file mode 100644
index 0000000000..a96a21340f
--- /dev/null
+++ b/org.adempiere.ui.zk/OSGI-INF/resourceLocator.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java
index ea9407d22e..2e64d88562 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java
@@ -17,13 +17,14 @@ import java.net.URL;
import org.adempiere.base.IResourceFinder;
import org.adempiere.webui.WebUIActivator;
+import org.zkoss.util.resource.IResourceLocator;
/**
*
* @author hengsin
*
*/
-public class WebUIResourceFinder implements IResourceFinder {
+public class WebUIResourceFinder implements IResourceFinder, IResourceLocator {
@Override
public URL getResource(String name) {
@@ -34,5 +35,4 @@ public class WebUIResourceFinder implements IResourceFinder {
}
return url;
}
-
}
diff --git a/org.adempiere.ui.zk/build.properties b/org.adempiere.ui.zk/build.properties
index 4d4a3b21ac..9c964d585f 100644
--- a/org.adempiere.ui.zk/build.properties
+++ b/org.adempiere.ui.zk/build.properties
@@ -14,7 +14,10 @@ bin.includes = META-INF/,\
WEB-INF/lib/atmosphere-runtime-0.9.jar,\
WEB-INF/lib/atmosphere-compat-jbossweb-0.9.jar,\
WEB-INF/lib/atmosphere-compat-tomcat-0.9.jar,\
- WEB-INF/lib/atmosphere-compat-tomcat7-0.9.jar
+ WEB-INF/lib/atmosphere-compat-tomcat7-0.9.jar,\
+ OSGI-INF/,\
+ metainfo/
+jars.compile.order =
src.includes = WEB-INF/classes/,\
WEB-INF/tld/,\
WEB-INF/web.xml,\
@@ -26,8 +29,7 @@ src.includes = WEB-INF/classes/,\
js/,\
theme/,\
theme.zs,\
- zul/
+ zul/,\
+ metainfo/
bin.excludes = WEB-INF/src/,\
WEB-INF/web-2.5.xml
-jars.compile.order =
-
diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/metainfo/zk/lang-addon.xml
similarity index 96%
rename from org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
rename to org.adempiere.ui.zk/metainfo/zk/lang-addon.xml
index 94cfdf2c4a..db1312dc3a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
+++ b/org.adempiere.ui.zk/metainfo/zk/lang-addon.xml
@@ -13,7 +13,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
- ADempiere WebUI
+ iDempiere
xul/html
diff --git a/org.zkoss.zk.library/.project b/org.zkoss.zk.library/.project
index 9d1e7dcb23..c094032ca5 100644
--- a/org.zkoss.zk.library/.project
+++ b/org.zkoss.zk.library/.project
@@ -20,6 +20,11 @@
+
+ org.eclipse.pde.ds.core.builder
+
+
+
org.eclipse.pde.PluginNature
diff --git a/org.zkoss.zk.library/META-INF/MANIFEST.MF b/org.zkoss.zk.library/META-INF/MANIFEST.MF
index 4380ef1e59..36710d2d36 100644
--- a/org.zkoss.zk.library/META-INF/MANIFEST.MF
+++ b/org.zkoss.zk.library/META-INF/MANIFEST.MF
@@ -97,7 +97,8 @@ Import-Package: bsh,
org.codehaus.groovy.vmplugin,
org.codehaus.groovy.vmplugin.v4,
org.codehaus.groovy.vmplugin.v5,
- org.osgi.framework;version="1.3.0"
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.component;version="1.1.0"
Bundle-ClassPath: .,
lib/asm.jar,
lib/cglib.jar,
@@ -952,3 +953,4 @@ Export-Package: Lib,
Bundle-Activator: org.zkoss.zk.library.Activator
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
+Service-Component: OSGI-INF/locatorRegistry.xml
diff --git a/org.zkoss.zk.library/OSGI-INF/locatorRegistry.xml b/org.zkoss.zk.library/OSGI-INF/locatorRegistry.xml
new file mode 100644
index 0000000000..d7bef8be43
--- /dev/null
+++ b/org.zkoss.zk.library/OSGI-INF/locatorRegistry.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/org.zkoss.zk.library/build.properties b/org.zkoss.zk.library/build.properties
index f1325c918e..ea8d7ebd2a 100644
--- a/org.zkoss.zk.library/build.properties
+++ b/org.zkoss.zk.library/build.properties
@@ -1,4 +1,3 @@
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
@@ -15,7 +14,6 @@ bin.includes = META-INF/,\
lib/junit.jar,\
lib/jxl.jar,\
lib/jython.jar,\
- lib/keylistener.jar,\
lib/mvel.jar,\
lib/ognl.jar,\
lib/timelinez.jar,\
@@ -25,9 +23,10 @@ bin.includes = META-INF/,\
lib/zhtml.jar,\
lib/zk.jar,\
lib/zkplus.jar,\
- lib/zml.jar,\
lib/zul.jar,\
lib/zweb.jar,\
lib/ckez.jar,\
lib/zel.jar,\
- lib/zkbind.jar
+ lib/zkbind.jar,\
+ OSGI-INF/
+source.. = src/
diff --git a/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java b/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java
index d1c949141b..a895044845 100644
--- a/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java
+++ b/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java
@@ -57,22 +57,43 @@ public class ClassLocator implements XMLResourcesLocator {
//XMLResourcesLocator//
public Enumeration getResources(String name) throws IOException {
+ List list = null;
name = resolveName(name);
if (Activator.getContext() != null) {
final Enumeration en = Activator.getContext().getBundle().getResources(name);
- if (en != null && en.hasMoreElements()) return en;
+ if (en != null && en.hasMoreElements())
+ list = Collections.list(en);
}
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl != null) {
- final Enumeration en = cl.getResources(name);
- if (en.hasMoreElements()) return en;
+ if (list == null) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl != null) {
+ final Enumeration en = cl.getResources(name);
+ if (en.hasMoreElements())
+ list = Collections.list(en);
+ }
}
- cl = ClassLocator.class.getClassLoader();
- if (cl != null) {
- final Enumeration en = cl.getResources(name);
- if (en.hasMoreElements()) return en;
+ if (list == null) {
+ ClassLoader cl = ClassLocator.class.getClassLoader();
+ if (cl != null) {
+ final Enumeration en = cl.getResources(name);
+ if (en.hasMoreElements())
+ list = Collections.list(en);
+ }
}
- return ClassLoader.getSystemResources(name);
+ if (list == null) {
+ final Enumeration en = ClassLoader.getSystemResources(name);
+ list = Collections.list(en);
+ }
+ List locators = ResourceLocatorRegistry.getLocators();
+ if (locators != null) {
+ for (IResourceLocator locator : locators) {
+ URL url = locator.getResource(name);
+ if (url != null) {
+ list.add(url);
+ }
+ }
+ }
+ return Collections.enumeration(list);
}
public List getDependentXMLResources(String name, String elName,
String elDepends) throws IOException {
@@ -84,6 +105,11 @@ public class ClassLocator implements XMLResourcesLocator {
if (old != null)
log.warning("Replicate resource: "+xr.name
+"\nOverwrite "+old.url+"\nwith "+xr.url);
+ else {
+ if (log.infoable()) {
+ log.info(xr);
+ }
+ }
//it is possible if zcommon.jar is placed in both
//WEB-INF/lib and shared/lib, i.e., appear twice in the class path
//We overwrite because the order is the parent class loader first
diff --git a/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java b/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java
new file mode 100644
index 0000000000..6ec65055f9
--- /dev/null
+++ b/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * Copyright (C) 2012 Heng Sin Low *
+ * Copyright (C) 2012 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.zkoss.util.resource;
+
+import java.net.URL;
+
+/**
+ *
+ * @author hengsin
+ *
+ */
+public interface IResourceLocator {
+
+ /**
+ * @param name
+ * @return resource url
+ */
+ public URL getResource(String name);
+
+}
diff --git a/org.zkoss.zk.library/src/org/zkoss/util/resource/ResourceLocatorRegistry.java b/org.zkoss.zk.library/src/org/zkoss/util/resource/ResourceLocatorRegistry.java
new file mode 100644
index 0000000000..5a7cb0a9f9
--- /dev/null
+++ b/org.zkoss.zk.library/src/org/zkoss/util/resource/ResourceLocatorRegistry.java
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * Copyright (C) 2012 Heng Sin Low *
+ * Copyright (C) 2012 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.zkoss.util.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author hengsin
+ *
+ */
+public class ResourceLocatorRegistry {
+
+ private List locators = new ArrayList();
+
+ private static ResourceLocatorRegistry INSTANCE = null;
+
+ /**
+ *
+ * @param locator
+ */
+ public synchronized void addLocator(IResourceLocator locator) {
+ System.err.println("addLocator " + locator);
+ locators.add(locator);
+ if (INSTANCE == null) {
+ INSTANCE = this;
+ }
+ }
+
+ /**
+ *
+ * @param locator
+ */
+ public synchronized void removeLocator(IResourceLocator locator) {
+ locators.remove(locator);
+ }
+
+ /**
+ * @return list of resource locator
+ */
+ public synchronized static List getLocators() {
+ return INSTANCE != null ? INSTANCE.locators : null;
+ }
+}