List of usage examples for java.lang System getSecurityManager
public static SecurityManager getSecurityManager()
From source file:org.wso2.carbon.core.internal.CarbonCoreActivator.java
public void start(BundleContext context) throws Exception { // Need permissions in order to activate Carbon Core SecurityManager secMan = System.getSecurityManager(); if (secMan != null) { secMan.checkPermission(new ManagementPermission("control")); }/*from w w w . j a v a 2s . co m*/ // We assume it's super tenant during the deployment time PrivilegedCarbonContext privilegedCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); privilegedCarbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); privilegedCarbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID); dataHolder.setBundleContext(context); log.info("Starting WSO2 Carbon..."); log.info("Operating System : " + System.getProperty("os.name") + " " + System.getProperty("os.version") + ", " + System.getProperty("os.arch")); log.info("Java Home : " + System.getProperty("java.home")); log.info("Java Version : " + System.getProperty("java.version")); log.info("Java VM : " + System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version") + "," + System.getProperty("java.vendor")); String carbonHome; if ((carbonHome = System.getProperty("carbon.home")).equals(".")) { carbonHome = new File(".").getAbsolutePath(); } log.info("Carbon Home : " + carbonHome); log.info("Java Temp Dir : " + System.getProperty("java.io.tmpdir")); log.info( "User : " + System.getProperty("user.name") + ", " + System.getProperty("user.language") + "-" + System.getProperty("user.country") + ", " + System.getProperty("user.timezone")); Security.addProvider(new BouncyCastleProvider()); if (log.isDebugEnabled()) { log.debug("BouncyCastle security provider is successfully registered in JVM."); } }
From source file:org.vaadin.spring.events.support.VaadinEventBusAwareProcessor.java
@Override public Object postProcessBeforeInitialization(final Object bean, String beanName) throws BeansException { AccessControlContext acc = null; if (System.getSecurityManager() != null && (bean instanceof EventBusAware)) { acc = this.applicationContext.getBeanFactory().getAccessControlContext(); }//from w w w .j a v a 2 s . c o m if (acc != null) { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { invokeAwareInterfaces(bean); return null; } }, acc); } else { invokeAwareInterfaces(bean); } return bean; }
From source file:org.wso2.carbon.appfactory.ext.authorization.SystemResourceProtectionHandler.java
private void checkRequestIsFromTenantCode() throws RegistryException { SecurityManager secMan = System.getSecurityManager(); if (secMan != null) { secMan.checkPermission(new AppFactorySecurityPermission("RegistryPermission")); }/*from w w w. ja va 2s . c o m*/ }
From source file:org.apache.oozie.tools.TestOozieSharelibCLI.java
@Override protected void setUp() throws Exception { SECURITY_MANAGER = System.getSecurityManager(); new LauncherSecurityManager(); tmpFolder.create();//from w w w.ja v a 2s.co m super.setUp(false); }
From source file:com.soteradefense.dga.DGACommandLineUtilTest.java
@Before public void setUp() throws Exception { defaultManager = System.getSecurityManager(); System.setSecurityManager(new NoExitSecurityManager()); }
From source file:edu.clemson.cs.nestbed.server.Server.java
public static void main(String[] args) throws Exception { RMI_BASE_URL = System.getProperty("testbed.rmi.baseurl"); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }/*from w ww.j a va 2 s . c o m*/ PropertyConfigurator.configure(Server.class.getClassLoader().getResource("serverLog.conf")); try { Server server = new Server(); } catch (RemoteException e) { log.fatal("Remote Exception occured!", e); System.exit(1); } }
From source file:com.jaspersoft.jasperserver.api.engine.jasperreports.util.PermissionsListProtectionDomainProvider.java
public void afterPropertiesSet() throws Exception { if (System.getSecurityManager() == null) { log.warn("A security manager has not been configured for the JVM. " + "The protection domain set for the reports will NOT be effective."); }/*from w w w.j ava2s . com*/ protectionDomain = createProtectionDomain(); }
From source file:org.mule.transport.rmi.RmiMessageReceiver.java
@SuppressWarnings("unchecked") @Override// ww w .java 2 s. co m protected void doConnect() throws Exception { System.setProperty("java.security.policy", connector.getSecurityPolicy()); // Set security manager if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } // Get methodName String methodName = MapUtils.getString(endpoint.getEndpointURI().getParams(), MuleProperties.MULE_METHOD_PROPERTY, null); if (null == methodName) { methodName = (String) endpoint.getProperty(MuleProperties.MULE_METHOD_PROPERTY); if (null == methodName) { throw new ConnectException(RmiMessages.messageParamServiceMethodNotSet(), this); } } // Get remoteObject remoteObject = connector.getRemoteObject(getEndpoint()); // Set methodArguments List<Object> args = (List<Object>) endpoint.getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST); Class[] argTypes = new Class[] {}; if (args == null) { logger.info(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST + " not set on endpoint, assuming method call has no arguments"); methodArguments = ClassUtils.NO_ARGS; } else { argTypes = connector.getArgTypes(endpoint.getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES), RequestContext.getEvent()); methodArguments = new Object[args.size()]; methodArguments = args.toArray(methodArguments); } // Set invokeMethod invokeMethod = remoteObject.getClass().getMethod(methodName, argTypes); }
From source file:org.jboss.instrument.classloading.JBoss5ClassLoader.java
protected JBoss5ClassLoader(BaseClassLoader classLoader) { Assert.notNull(classLoader, "ClassLoader must not be null"); this.classLoader = classLoader; try {/*from w w w. j av a2 s . c om*/ SecurityManager sm = System.getSecurityManager(); if (sm != null) { AccessController.doPrivileged(new InstantiationAction()); } else { doInstantiate(); } } catch (Exception e) { throw new IllegalStateException( "Could not initialize JBoss ClassLoader because JBoss5 API classes are not available", e); } }
From source file:com.cloudera.sqoop.util.SubprocessSecurityManager.java
/** * Install this SecurityManager and retain a reference to any * previously-installed SecurityManager. */// w w w.j a va2s. c o m public void install() { LOG.debug("Installing subprocess security manager"); this.parentSecurityManager = System.getSecurityManager(); System.setSecurityManager(this); this.installed = true; }