Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.loader;
import org.apache.openejb.loader.event.ComponentAdded;
import org.apache.openejb.loader.event.ComponentRemoved;
import org.apache.openejb.observer.ObserverManager;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* This class aims to be the one and only static in the entire system
* A static, singleton, instance of this class can be created with the {@link #init(Properties)} method
*
* It is assumed that only one singleton per classloader is possible in any given VM
* Thus loading this instance in a classloader will mean there can only be one OpenEJB
* instance for that classloader and all children classloaders.
*
* @version $Revision$ $Date$
* @org.apache.xbean.XBean element="system"
*/
public final class SystemInstance {
private static final String PROFILE_PROP = "openejb.profile";
private static final String DEFAULT_PROFILE = "development";
private final long startTime = System.currentTimeMillis();
/**
* Properties that have to be away from System (i.e. {@link System#setProperty(String, String)} must not be called)
*/
private final Properties internalProperties = new Properties(System.getProperties());
private final Options options;
/**
* Properties that need to be set to System via {@link System#setProperty(String, String)}
* FIXME: Some properties are doubled in internal and external prop sets, but it simplifies get's
*/
private final Properties externalProperties = new Properties();
private final FileUtils home;
private final FileUtils base;
private final ClassLoader classLoader;
private final HashMap components;
private final ClassPath classPath;
private final ObserverManager observerManager = new ObserverManager();
// FIXME: Why is Exception thrown at all? It's almost impossible that it'll happen.
private SystemInstance(final Properties properties) throws Exception {
this.components = new HashMap();
// import JVM system property config (if a resource/container/... is set through this way)
final Properties clonedSystemProperties = (Properties) System.getProperties().clone();
for (final Map.Entry