1 11 package org.eclipse.equinox.http.jetty; 12 13 import java.security.Permission ; 14 import java.util.Dictionary ; 15 import org.osgi.framework.Constants; 16 import org.osgi.service.cm.ConfigurationPermission; 17 import org.eclipse.equinox.http.jetty.internal.Activator; 18 19 46 public class JettyConfigurator { 47 private static final String PID_PREFIX = "org.eclipse.equinox.http.jetty.JettyConfigurator."; private static Permission configurationPermission = new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE); 50 56 public static void startServer(String id, Dictionary settings) throws Exception { 57 checkConfigurationPermission(); 58 String pid = PID_PREFIX + id; 59 settings.put(Constants.SERVICE_PID, pid); 60 Activator.startServer(pid, settings); 61 } 62 63 68 public static void stopServer(String id) throws Exception { 69 checkConfigurationPermission(); 70 Activator.stopServer(PID_PREFIX + id); 71 } 72 73 private static void checkConfigurationPermission() throws SecurityException { 74 SecurityManager sm = System.getSecurityManager(); 75 if (sm != null) 76 sm.checkPermission(configurationPermission); 77 } 78 } 79 | Popular Tags |