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