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 startBundle(long bundleId) throws PortalException {
070 _moduleFramework.startBundle(bundleId);
071 }
072
073 public static void startBundle(long bundleId, int options)
074 throws PortalException {
075
076 _moduleFramework.startBundle(bundleId, options);
077 }
078
079 public static void startFramework() throws Exception {
080 ClassLoader classLoader = ClassLoaderUtil.getContextClassLoader();
081
082 ClassLoaderUtil.setContextClassLoader(
083 ModuleFrameworkAdapterHelper.getClassLoader());
084
085 try {
086 _moduleFramework.startFramework();
087 }
088 finally {
089 ClassLoaderUtil.setContextClassLoader(classLoader);
090 }
091 }
092
093 public static void startRuntime() throws Exception {
094 _moduleFramework.startRuntime();
095 }
096
097 public static void stopBundle(long bundleId) throws PortalException {
098 _moduleFramework.stopBundle(bundleId);
099 }
100
101 public static void stopBundle(long bundleId, int options)
102 throws PortalException {
103
104 _moduleFramework.stopBundle(bundleId, options);
105 }
106
107 public static void stopFramework() throws Exception {
108 _moduleFramework.stopFramework();
109 }
110
111 public static void stopRuntime() throws Exception {
112 _moduleFramework.stopRuntime();
113 }
114
115 public static void uninstallBundle(long bundleId) throws PortalException {
116 _moduleFramework.uninstallBundle(bundleId);
117 }
118
119 public static void updateBundle(long bundleId) throws PortalException {
120 _moduleFramework.updateBundle(bundleId);
121 }
122
123 public static void updateBundle(long bundleId, InputStream inputStream)
124 throws PortalException {
125
126 _moduleFramework.updateBundle(bundleId, inputStream);
127 }
128
129 private static ModuleFramework _moduleFramework;
130 private static ModuleFrameworkAdapterHelper _moduleFrameworkAdapterHelper =
131 new ModuleFrameworkAdapterHelper(
132 "com.liferay.osgi.bootstrap.ModuleFrameworkUtil");
133
134 static {
135 _moduleFramework =
136 (ModuleFramework)_moduleFrameworkAdapterHelper.execute(
137 "getModuleFramework");
138 }
139
140 }