001
014
015 package com.liferay.portal.module.framework;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.util.ClassLoaderUtil;
019
020 import java.io.InputStream;
021
022 import java.net.URL;
023
024 import java.util.List;
025 import java.util.Map;
026
027
035 public class ModuleFrameworkUtilAdapter {
036
037 public static Object addBundle(String location) throws PortalException {
038 return _moduleFramework.addBundle(location);
039 }
040
041 public static Object addBundle(String location, InputStream inputStream)
042 throws PortalException {
043
044 return _moduleFramework.addBundle(location, inputStream);
045 }
046
047 public static Map<String, List<URL>> getExtraPackageMap() {
048 return _moduleFramework.getExtraPackageMap();
049 }
050
051 public static Object getFramework() {
052 return _moduleFramework.getFramework();
053 }
054
055 public static String getState(long bundleId) throws PortalException {
056 return _moduleFramework.getState(bundleId);
057 }
058
059 public static void registerContext(Object context) {
060 _moduleFramework.registerContext(context);
061 }
062
063 public static void setBundleStartLevel(long bundleId, int startLevel)
064 throws PortalException {
065
066 _moduleFramework.setBundleStartLevel(bundleId, startLevel);
067 }
068
069 public static void setModuleFramework(ModuleFramework moduleFramework) {
070 _moduleFramework = moduleFramework;
071
072 _moduleFrameworkAdapterHelper.exec(
073 "setModuleFramework", new Class[] {ModuleFramework.class},
074 _moduleFramework);
075 }
076
077 public static void startBundle(long bundleId) throws PortalException {
078 _moduleFramework.startBundle(bundleId);
079 }
080
081 public static void startBundle(long bundleId, int options)
082 throws PortalException {
083
084 _moduleFramework.startBundle(bundleId, options);
085 }
086
087 public static void startFramework() throws Exception {
088 ClassLoader classLoader = ClassLoaderUtil.getContextClassLoader();
089
090 ClassLoaderUtil.setContextClassLoader(
091 ModuleFrameworkAdapterHelper.getClassLoader());
092
093 try {
094 _moduleFramework.startFramework();
095 }
096 finally {
097 ClassLoaderUtil.setContextClassLoader(classLoader);
098 }
099 }
100
101 public static void startRuntime() throws Exception {
102 _moduleFramework.startRuntime();
103 }
104
105 public static void stopBundle(long bundleId) throws PortalException {
106 _moduleFramework.stopBundle(bundleId);
107 }
108
109 public static void stopBundle(long bundleId, int options)
110 throws PortalException {
111
112 _moduleFramework.stopBundle(bundleId, options);
113 }
114
115 public static void stopFramework() throws Exception {
116 _moduleFramework.stopFramework();
117 }
118
119 public static void stopRuntime() throws Exception {
120 _moduleFramework.stopRuntime();
121 }
122
123 public static void uninstallBundle(long bundleId) throws PortalException {
124 _moduleFramework.uninstallBundle(bundleId);
125 }
126
127 public static void updateBundle(long bundleId) throws PortalException {
128 _moduleFramework.updateBundle(bundleId);
129 }
130
131 public static void updateBundle(long bundleId, InputStream inputStream)
132 throws PortalException {
133
134 _moduleFramework.updateBundle(bundleId, inputStream);
135 }
136
137 private static ModuleFramework _moduleFramework;
138 private static ModuleFrameworkAdapterHelper _moduleFrameworkAdapterHelper =
139 new ModuleFrameworkAdapterHelper(
140 "com.liferay.osgi.bootstrap.ModuleFrameworkUtil");
141
142 static {
143 _moduleFramework =
144 (ModuleFramework)_moduleFrameworkAdapterHelper.execute(
145 "getModuleFramework");
146 }
147
148 }