Initializes OJB for the purposes of this task.

@return The metadata manager used by OJB
436190
private MetadataManager initOJB()
    {
        try
        {
            if (_ojbPropertiesFile == null)
            {
                _ojbPropertiesFile = new File("OJB.properties");
                if (!_ojbPropertiesFile.exists())
                {
                    throw new BuildException("Could not find OJB.properties, please specify it via the ojbpropertiesfile attribute");
                }
            }
            else
            {
                if (!_ojbPropertiesFile.exists())
                {
                    throw new BuildException("Could not load the specified OJB properties file "+_ojbPropertiesFile);
                }
                log("Using properties file "+_ojbPropertiesFile.getAbsolutePath(), Project.MSG_INFO);
                System.setProperty("OJB.properties", _ojbPropertiesFile.getAbsolutePath());
            }

            MetadataManager     metadataManager = MetadataManager.getInstance();
            RepositoryPersistor persistor       = new RepositoryPersistor();

            if (_repositoryFile != null)
            {
                if (!_repositoryFile.exists())
                {
                    throw new BuildException("Could not load the specified repository file "+_repositoryFile);
                }
                log("Loading repository file "+_repositoryFile.getAbsolutePath(), Project.MSG_INFO);

                // this will load the info from the specified repository file
                // and merge it with the existing info (if it has been loaded)
                metadataManager.mergeConnectionRepository(persistor.readConnectionRepository(_repositoryFile.getAbsolutePath()));
                metadataManager.mergeDescriptorRepository(persistor.readDescriptorRepository(_repositoryFile.getAbsolutePath()));
            }
            else if (metadataManager.connectionRepository().getAllDescriptor().isEmpty() &&
                     metadataManager.getGlobalRepository().getDescriptorTable().isEmpty())
            {
                // Seems nothing was loaded, probably because we're not starting in the directory
                // that the properties file is in, and the repository file path is relative
                // So lets try to resolve this path and load the repository info manually
                Properties props = new Properties();

                props.load(new FileInputStream(_ojbPropertiesFile));
    
                String repositoryPath = props.getProperty("repositoryFile", "repository.xml");
                File   repositoryFile = new File(repositoryPath);
    
                if (!repositoryFile.exists())
                {
                    repositoryFile = new File(_ojbPropertiesFile.getParentFile(), repositoryPath);
                }
                metadataManager.mergeConnectionRepository(persistor.readConnectionRepository(repositoryFile.getAbsolutePath()));
                metadataManager.mergeDescriptorRepository(persistor.readDescriptorRepository(repositoryFile.getAbsolutePath()));
            }
            // we might have to determine the default pb key ourselves
            if (metadataManager.getDefaultPBKey() == null)
            {
                for (Iterator it = metadataManager.connectionRepository().getAllDescriptor().iterator(); it.hasNext();)
                {
                    JdbcConnectionDescriptor descriptor = (JdbcConnectionDescriptor)it.next();

                    if (descriptor.isDefaultConnection())
                    {
                        metadataManager.setDefaultPBKey(new PBKey(descriptor.getJcdAlias(), descriptor.getUserName(), descriptor.getPassWord()));
                        break;
                    }
                }
            }
            return metadataManager;
        }
        catch (Exception ex)
        {
            if (ex instanceof BuildException)
            {
                throw (BuildException)ex;
            }
            else
            {
                throw new BuildException(ex);
            }
        }
    }
1019442
protected Object getCacheManager() {
        CacheManager cacheManager = CacheManager.getInstance();
        if (cacheManager != null)
            return cacheManager;
        return CacheManager.newInstance();
    }
690096
protected <T> ManagedObjectFactory<T> getManagedBeanManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
        ManagedObjectFactory<T> factory = null;
        ManagedObjectService managedObjectService = getManagedObjectService();
        if (managedObjectService != null) {
            try {
                factory = managedObjectService.createManagedObjectFactory(bmd._moduleMetaData, klass, true);
                //TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
                if (!factory.isManaged()) {
                    factory = null;
                }
            } catch (ManagedObjectException e) {
                throw new EJBConfigurationException(e);
            }
        }

        return factory;
    }
1344985
public static PluginManager getInstance() {
        if (_instance == null) {
            _instance = new PluginManager();
            _instance.classInformation = new HashMap<String, ClassInformation>();
            _instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>();
            _instance.jarInformation = new ArrayList<String>();

            if (_instance.proxyLibPath == null) {
                //Get the System Classloader
                ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();

                //Get the URLs
                URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();

                for (int i = 0; i < urls.length; i++) {
                    if (urls[i].getFile().contains("proxylib")) {
                        // store the path to the proxylib
                        _instance.proxyLibPath = urls[i].getFile();
                        break;
                    }
                }
            }
            _instance.initializePlugins();
        }
        return _instance;
    }
27051
public static ClassLoadInfo classLoadManager() {
        ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
        int nowLoadedClassCount = classLoadingMXBean.getLoadedClassCount();
        long totalLoadedClassCount = classLoadingMXBean.getTotalLoadedClassCount();
        long unloadedClassCount = classLoadingMXBean.getUnloadedClassCount();
        return new ClassLoadInfo(nowLoadedClassCount, totalLoadedClassCount, unloadedClassCount);
    }
860746
@Override
    public ManagedObjectContext createContext() {
        Bean<T> bean = null;

        EjbDescriptor<T> ejbDescriptor = getEjbDescriptor();
        //in the case of an MDB, the bean should be null, in which case the creational context will be non-contextual
        if (!ejbDescriptor.isMessageDriven()) {
            bean = getBean();
        }

        WeldManager beanManager = getBeanManager();
        WeldCreationalContext<T> creationalContext = beanManager.createCreationalContext(bean);

        ManagedObjectContext managedObjectContext = new CDIManagedObjectState(creationalContext);

        return managedObjectContext;
    }
817418
@Override
    public EntityManager createEntityManager()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "createEntityManager : " + this);

        EntityManager em = getEntityManager(false, false);
        JPAPooledEntityManager pem = new JPAPooledEntityManager(this, em, ivAbstractJpaComponent, true);
        return pem;
    }
1258730
@Override
    public MetaData getMetaData() throws CDIException {
        MetaData metaData = null;
        if (isModule()) {
            metaData = getModuleMetaData();
        } else {
            metaData = application.getApplicationMetaData();
        }
        return metaData;
    }
986818
public BshClassManager getClassManager() {
        if (this.classManager != null)
            return this.classManager;
        if (this.parent != null && this.parent != JAVACODE)
            return this.parent.getClassManager();
        this.setClassManager(BshClassManager
                .createClassManager(null/* interp */));
        // Interpreter.debug("No class manager namespace:" +this);
        return this.classManager;
    }
726092
@Override
  public Metadata createMetadata() {
    Metadata metadata = new Metadata();
    try {
      for (DataSet ds : iimFile.getDataSets()) {
        Object value = "";
        try {
          value = ds.getValue();
        } catch (Exception ex) {

        }
        DataSetInfo info = ds.getInfo();
        //System.out.println(info.toString() + " " + info.getName() + ": " + value);

        metadata.add(info.getName(), new Text(value.toString()));
      }
    } catch (Exception ex) {
      /*Nothing to be shown*/
    }

    return metadata;
  }
802900
public Metadata createMetadata() {
    Metadata metadata = new Metadata();
    for (TagValue tag : getMetadata().getTags()) {
      if (tag.getCardinality() == 1) {
        abstractTiffType t = tag.getValue().get(0);
        if (t.isIFD()) {
          Metadata metadata2 = ((IFD) t).createMetadata();
          for (String key : metadata2.keySet()) {
            metadata.add(key, metadata2.get(key));
          }
        } else if (t.containsMetadata()) {
          try {
            Metadata meta = t.createMetadata();
            metadata.addMetadata(meta);
          } catch (Exception ex) {
            // TODO: What?
          }
        }
      }
    }
    return metadata;
  }
626332
public ConfigurationProvider build() {
    LOG.info("Initializing ConfigurationProvider with "
        + configurationSource.getClass().getCanonicalName() + " source, "
        + reloadStrategy.getClass().getCanonicalName() + " reload strategy and "
        + environment.getClass().getCanonicalName() + " environment");

    final CachedConfigurationSource cachedConfigurationSource = new CachedConfigurationSource(configurationSource);
    if (metricRegistry != null) {
      configurationSource = new MeteredConfigurationSource(metricRegistry, prefix, cachedConfigurationSource);
    }
    cachedConfigurationSource.init();

    Reloadable reloadable = () -> cachedConfigurationSource.reload(environment);

    if (metricRegistry != null) {
      reloadable = new MeteredReloadable(metricRegistry, prefix, reloadable);
    }
    reloadable.reload();
    reloadStrategy.register(reloadable);

    SimpleConfigurationProvider configurationProvider = new SimpleConfigurationProvider(cachedConfigurationSource, environment);
    if (metricRegistry != null) {
      return new MeteredConfigurationProvider(metricRegistry, prefix, configurationProvider);
    }

    return configurationProvider;
  }
137900
public static BpsimFactory init() {
		try {
			BpsimFactory theBpsimFactory = (BpsimFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.bpsim.org/schemas/1.0"); 
			if (theBpsimFactory != null) {
				return theBpsimFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new BpsimFactoryImpl();
	}
1084837
private Model initModel() {
        OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, ModelFactory.createDefaultModel());
        try {
            schemaReader.read(m);
        } catch (RdfReaderException e) {
            log.error("Cannot load ontology: {} ", getSchema(), e);
        }
        return m;
    }
1061082
public static PropertyManager getInstance() {
        if (instance == null) {
            try {
                initializePropertyManager();
            }
            catch (StartupException e) {
                // should not reach here, as the property manager should be
                // initialized by now
                throw new RuntimeException(e);
            }
            // container property manager will never hit this
        }
        return instance;
    }
1066814
public ManagedConnectionMetaData getMetaData() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getMetaData");
        }

        if (_metaData == null) {

            _metaData = new SibRaMetaData();
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "getMetaData", _metaData);
        }
        return _metaData;

    }
590346
public static void initJMXBean(JawrApplicationConfigManager appConfigMgr, ServletContext servletContext,
			String resourceType, String mBeanPrefix) {

		try {

			MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

			if (mbs != null) {

				ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType,
						mBeanPrefix);

				// register the jawrApplicationConfigManager if it's not already
				// done
				ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix);
				if (!mbs.isRegistered(appJawrMgrObjectName)) {
					mbs.registerMBean(appConfigMgr, appJawrMgrObjectName);
				}

				if (mbs.isRegistered(jawrConfigMgrObjName)) {
					LOGGER.warn("The MBean '" + jawrConfigMgrObjName.getCanonicalName()
							+ "' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean.");
					mbs.unregisterMBean(jawrConfigMgrObjName);
				}
				JawrConfigManagerMBean configMgr = appConfigMgr.getConfigMgr(resourceType);
				mbs.registerMBean(configMgr, jawrConfigMgrObjName);
			}

		} catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException
				| InstanceNotFoundException e) {
			LOGGER.error("Unable to instanciate the Jawr MBean for resource type '" + resourceType + "'", e);
		}

	}