initialize the schema manager and add the schema partition to diectory
service

@throws Exception
if the schema LDIF files are not found on the classpath
185710
private void initSchemaPartition() throws Exception {
        final InstanceLayout instanceLayout = this.service.getInstanceLayout();

        final File schemaPartitionDirectory = new File(instanceLayout.getPartitionsDirectory(), "schema");

        /*
         * Extract the schema on disk (a brand new one) and load the registries
         */
        if (schemaPartitionDirectory.exists()) {
            System.out.println("schema partition already exists, skipping schema extraction");
        } else {
            final SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(instanceLayout.getPartitionsDirectory());
            extractor.extractOrCopy();
        }

        final SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
        final SchemaManager schemaManager = new DefaultSchemaManager(loader);

        /*
         * We have to load the schema now, otherwise we won't be able
         * to initialize the Partitions, as we won't be able to parse
         * and normalize their suffix Dn
         */
        schemaManager.loadAllEnabled();

        final List<Throwable> errors = schemaManager.getErrors();

        if (errors.size() != 0) {
            throw new Exception(I18n.err(I18n.ERR_317,
                                         Exceptions.printErrors(errors)));
        }

        this.service.setSchemaManager(schemaManager);

        /*
         * Init the LdifPartition with schema
         */
        final LdifPartition schemaLdifPartition = new LdifPartition(schemaManager);
        schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());

        /*
         * The schema partition
         */
        final SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
        schemaPartition.setWrappedPartition(schemaLdifPartition);
        this.service.setSchemaPartition(schemaPartition);
    }
158493
public function create()
    {
        try {
            $schema = explode(';', str_replace(PHP_EOL, '', $this->getSchema()));
            array_pop($schema);

            # db structure
            $sql = array_shift($schema);
            $this->db->query($sql . ';');

            # indecies
            foreach($schema as $sql) {
                $this->db->query($sql . ';');
            }
        } catch(Exception $e) {
            throw new Exception($e->getMessage(), 1);
        }
    }
696180
public void build(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception {
		uriSet.clear();

		String dataSourceName = schema.getName();
		String dataSourceNameClazz = BindDataSourceBuilder.PREFIX + dataSourceName;
		String contentProviderName = PREFIX + dataSourceName.replace(BindDataSourceBuilder.SUFFIX, "") + SUFFIX;

		PackageElement pkg = elementUtils.getPackageOf(schema.getElement());
		String packageName = pkg.isUnnamed() ? null : pkg.getQualifiedName().toString();

		AnnotationProcessorUtilis.infoOnGeneratedClasses(BindContentProvider.class, packageName, contentProviderName);
		classBuilder = TypeSpec.classBuilder(contentProviderName).addModifiers(Modifier.PUBLIC).superclass(ContentProvider.class);

		classBuilder.addJavadoc("<p>This is the content provider generated for {@link $L}</p>\n\n", dataSourceName);

		classBuilder.addJavadoc("<h2>Content provider authority:</h2>\n");
		classBuilder.addJavadoc("<pre>$L</pre>\n\n", schema.contentProvider.authority);

		generateOnCreate(dataSourceNameClazz);
		generateOnShutdown(dataSourceNameClazz);

		// define static fields
		classBuilder.addField(FieldSpec.builder(String.class, "URI", Modifier.STATIC, Modifier.PUBLIC, Modifier.FINAL).initializer("$S", schema.contentProviderUri())
				.addJavadoc("<p>content provider's URI.</p>\n<pre>$L</pre>\n", schema.contentProviderUri()).build());

		// instance
		classBuilder.addField(FieldSpec.builder(className(dataSourceNameClazz), "dataSource", Modifier.PRIVATE, Modifier.STATIC).addJavadoc("<p>datasource singleton</p>\n").build());
		classBuilder.addField(FieldSpec.builder(String.class, "AUTHORITY", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).addJavadoc("<p>Content provider authority</p>\n")
				.initializer("$S", schema.contentProvider.authority).build());
		classBuilder.addField(FieldSpec.builder(UriMatcher.class, "sURIMatcher", Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL).addJavadoc("<p>URI matcher</p>\n")
				.initializer("new $T($T.NO_MATCH)", UriMatcher.class, UriMatcher.class).build());

		Builder staticBuilder = CodeBlock.builder();
		Converter<String, String> daoConstantConverter = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE);

		List<FieldSpec> listFieldUri = new ArrayList<>();
		List<FieldSpec> listFieldString = new ArrayList<>();
		List<FieldSpec> listFieldIndex = new ArrayList<>();
		List<FieldSpec> listFieldAlias = new ArrayList<>();

		for (SQLiteDaoDefinition daoDefinition : schema.getCollection()) {
			String pathConstantName = "PATH_" + daoConstantConverter.convert(daoDefinition.getEntitySimplyClassName());

			if (!daoDefinition.contentProviderEnabled)
				continue;

			// define content provider paths
			for (SQLiteModelMethod daoMethod : daoDefinition.getCollection()) {
				if (!daoMethod.contentProviderEntryPathEnabled)
					continue;

				ContentEntry entry = uriSet.get(daoMethod.contentProviderEntryPathTemplate);
				if (entry == null) {
					entry = new ContentEntry(daoMethod.contentProviderEntryPath);
					uriSet.put(daoMethod.contentProviderEntryPathTemplate, entry);

					entry.path = daoMethod.contentProviderEntryPath;
					entry.uriTemplate = daoMethod.contentProviderEntryPathTemplate;

					// we finish later
					entry.pathCostant = pathConstantName;
					entry.pathIndex = pathConstantName;
				}

				switch (daoMethod.jql.operationType) {
				case INSERT:
					AssertKripton.fail(entry.insert != null, String.format("In DAO '%s', there are more than one %s statement associated to content provider path '%s'",
							daoDefinition.getName().toString(), daoMethod.jql.operationType, entry.path));
					entry.insert = daoMethod;
					break;
				case UPDATE:
					AssertKripton.fail(entry.update != null, String.format("In DAO '%s', there are more than one %s statement associated to content provider path '%s'",
							daoDefinition.getName().toString(), daoMethod.jql.operationType, entry.path));
					entry.update = daoMethod;
					break;
				case SELECT:
					AssertKripton.fail(entry.select != null, String.format("In DAO '%s', there are more than one %s statement associated to content provider path '%s'",
							daoDefinition.getName().toString(), daoMethod.jql.operationType, entry.path));
					entry.select = daoMethod;
					break;
				case DELETE:
					AssertKripton.fail(entry.delete != null, String.format("In DAO '%s', there are more than one %s statement associated to content provider path '%s'",
							daoDefinition.getName().toString(), daoMethod.jql.operationType, entry.path));
					entry.delete = daoMethod;
					break;

				}
			}
		}

		// sort uri set by
		List<Pair<String, ContentEntry>> listUriSet = new ArrayList<>();
		Pair<String, ContentEntry> item;
		for (Entry<String, ContentEntry> entry : uriSet.entrySet()) {
			item = new Pair<String, ContentEntry>(entry.getKey(), entry.getValue());
			listUriSet.add(item);
		}

		Comparator<Pair<String, ContentEntry>> c = new Comparator<Pair<String, ContentEntry>>() {

			@Override
			public int compare(Pair<String, ContentEntry> lhs, Pair<String, ContentEntry> rhs) {
				return lhs.value0.compareTo(rhs.value0);
			}

		};
		Collections.sort(listUriSet, c);

		Set<String> alreadyUsedName = new HashSet<String>();
		Converter<String, String> format = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE);

		int i = 1;
		for (Pair<String, ContentEntry> entry : listUriSet) {
			// define ordered part of attributes (after sort)
			entry.value1.pathCostant += "_" + i;
			entry.value1.pathIndex += "_" + i + "_INDEX";
			entry.value1.pathValue = i;

			// build class attributes
			listFieldString.add(FieldSpec.builder(String.class, entry.value1.pathCostant, Modifier.STATIC, Modifier.FINAL).initializer(CodeBlock.of("$S", entry.value1.uriTemplate)).build());
			listFieldIndex.add(FieldSpec.builder(Integer.TYPE, entry.value1.pathIndex, Modifier.STATIC, Modifier.FINAL).initializer(CodeBlock.of("$L", entry.value1.pathValue)).build());

			listFieldUri.add(FieldSpec.builder(Uri.class, "URI_" + entry.value1.pathCostant, Modifier.STATIC, Modifier.FINAL, Modifier.PRIVATE).addJavadoc("<p>Uri</p>\n")
					.addJavadoc("<pre>$L/$L</pre>\n", schema.contentProviderUri().replace("*", "[*]"), entry.value1.uriTemplate.replace("*", "[*]"))
					.initializer(CodeBlock.of("Uri.parse(URI+\"/$L\")", entry.value1.uriTemplate)).build());

			generateURIForMethod(schema, listFieldAlias, alreadyUsedName, format, entry, entry.value1.delete);
			generateURIForMethod(schema, listFieldAlias, alreadyUsedName, format, entry, entry.value1.insert);
			generateURIForMethod(schema, listFieldAlias, alreadyUsedName, format, entry, entry.value1.select);
			generateURIForMethod(schema, listFieldAlias, alreadyUsedName, format, entry, entry.value1.update);

			staticBuilder.addStatement("sURIMatcher.addURI(AUTHORITY, $L, $L)", entry.value1.pathCostant, entry.value1.pathIndex);

			i++;
		}

		for (FieldSpec f : listFieldUri) {
			classBuilder.addField(f);
		}

		for (FieldSpec f : listFieldString) {
			classBuilder.addField(f);
		}

		for (FieldSpec f : listFieldIndex) {
			classBuilder.addField(f);
		}

		for (FieldSpec f : listFieldAlias) {
			classBuilder.addField(f);
		}

		classBuilder.addStaticBlock(staticBuilder.build());

		generateQuery(schema);

		generateInsert(schema);

		generateUpdate(schema);

		generateDelete(schema);

		generateGetType(schema);

		classBuilder.addJavadoc("\n\n");
		JavadocUtility.generateJavadocGeneratedBy(classBuilder);

		TypeSpec typeSpec = classBuilder.build();
		JavaWriterHelper.writeJava2File(filer, packageName, typeSpec);
	}
1170946
private void createHdfsFilesystem(Configuration conf) throws Exception {
    // Inits HDFS file system object
    mFileSystem = FileSystem.get(URI.create(conf.get("fs.defaultFS")), conf);
    mOutputFilePath = new Path("./MapReduceOutputFile");
    if (mFileSystem.exists(mOutputFilePath)) {
      mFileSystem.delete(mOutputFilePath, true);
    }
  }
695664
private void initMappings() throws Exception {
        checkClient();
        // We extract indexes and mappings to manage from mappings definition
        if (mappings != null && mappings.length > 0) {
            Map<String, Collection<String>> indices = getIndexMappings(mappings);

            // Let's initialize indexes and mappings if needed
            for (String index : indices.keySet()) {
                createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
                if (mergeSettings) {
                    updateSettings(client.getLowLevelClient(), classpathRoot, index);
                }

                createMapping(client, classpathRoot, index, mergeMapping);
            }
        }
    }
178535
@Override
    public void initialize(ExtensionContext context) {
        // IMPORTANT: Management API version != xsd version! Not all Management API changes result in XSD changes
        SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, InfinispanSchema.CURRENT.getVersion());
        // Create the path resolver handler
        final ResolvePathHandler resolvePathHandler;
        final PathManager pathManager;
        if (context.getProcessType().isServer()) {
            resolvePathHandler = ResolvePathHandler.Builder.of(context.getPathManager())
                    .setPathAttribute(FileStoreResource.PATH)
                    .setRelativeToAttribute(FileStoreResource.RELATIVE_TO)
                    .build();
            pathManager = context.getPathManager();
        } else {
            resolvePathHandler = null;
            pathManager = null;
        }

        subsystem.registerSubsystemModel(InfinispanSubsystemRootResource.create(resolvePathHandler, pathManager, context.isRuntimeOnlyRegistrationValid()));
        subsystem.registerXMLElementWriter(InfinispanSubsystemXMLWriter::new);
    }
570653
@Setup
    public void setUp() throws Exception {
        ClassByImplementationBenchmark classByImplementationBenchmark = new ClassByImplementationBenchmark();
        baselineInstance = classByImplementationBenchmark.baseline();
        byteBuddyInstance = classByImplementationBenchmark.benchmarkByteBuddy();
        cglibInstance = classByImplementationBenchmark.benchmarkCglib();
        javassistInstance = classByImplementationBenchmark.benchmarkJavassist();
        jdkProxyInstance = classByImplementationBenchmark.benchmarkJdkProxy();
    }
1165659
public function initializeObject()
    {
        if (!is_writable($this->path)) {
            Files::createDirectoryRecursively($this->path);
        }
        if (!is_dir($this->path) && !is_link($this->path)) {
            throw new StorageException('The directory "' . $this->path . '" which was configured as a resource storage does not exist.', 1361533189);
        }
        if (!is_writable($this->path)) {
            throw new StorageException('The directory "' . $this->path . '" which was configured as a resource storage is not writable.', 1361533190);
        }
    }
873897
public SchemaRepositoryModelBuilder addSchema(SchemaModel schema) {
        if (model.getSchemas() == null) {
            model.setSchemas(new SchemaRepositoryModel.Schemas());
        }

        model.getSchemas().getSchemas().add(schema);
        return this;
    }
154742
public function initialize()
    {
        if ((false === $this->exists($this->localPath)) && false === $this->filesystem->createDir($this->localPath)) {
            throw new RuntimeException(
                'Unable to create a local storage for temporary filesystem operations.'
            );
        }

        $this->initialized = true;
    }
191543
public function initialize()
    {
        $this->initializeShortAliases();
        $this->initializeDefaultAliases();
        foreach ($this->schemaManager->getSchemaTables() as $table) {
            $this->loadMetadataForTable($table);
        }
        $this->initialized = true;
    }
776397
private static void generateSchema(SQLiteDatabaseSchema schema) throws FileNotFoundException, IOException {
		// when we run in JUNIT of Kripton, we don't have to generate schemas
		// if (BindDataSourceSubProcessor.JUNIT_TEST_MODE)
		// return;
		if (!schema.generateSchema)
			return;

		// and now, write schema.create.v and schema.drop.v
		String schemaCreation = defineFileName(schema);

		String schemaLocation = KriptonOptions.getSchemaLocation();

		File schemaCreatePath = new File(schemaLocation).getAbsoluteFile();
		File schemaCreateFile = new File(schemaLocation, schemaCreation).getAbsoluteFile();
		schemaCreatePath.mkdirs();

		AnnotationProcessorUtilis.infoOnGeneratedFile(BindDataSource.class, schemaCreateFile);
		FileOutputStream fos = new FileOutputStream(schemaCreateFile);
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));

		bw.write("------------------------------------------------------------------------------------\n");
		bw.write("--\n");
		bw.write("-- Filename: " + schemaCreation + "\n");
		bw.write("--\n");
		bw.write(String.format("-- Date: %s", (new Date()).toString()) + "\n");
		bw.write("--\n");
		if (!BindDataSourceSubProcessor.JUNIT_TEST_MODE) {
			bw.write(String.format("-- This file was generated by Kripton Annotation Processor v. %s\n",
					Version.getVersion()));
			bw.write(String.format("--\n"));
		}
		bw.write("------------------------------------------------------------------------------------\n");
		bw.newLine();
		for (String sql : schema.sqlForCreate) {
			bw.write(sql);
			bw.newLine();
		}
		bw.close();
	}
151501
private void initFileSystem() throws IOException {
		if (fs == null) {
			Path path = new Path(basePath);
			fs = createHadoopFileSystem(path, fsConfig);
		}
	}
292828
public static void initialize() {
    String homeDirName = System.getProperty("jdcp.home");
    File homeDir;
    if (homeDirName != null) {
      homeDir = new File(homeDirName);
    } else {
      homeDir = FileUtil.getApplicationDataDirectory("jdcp");
      System.setProperty("jdcp.home", homeDir.getPath());
    }
    homeDir.mkdir();
    if (System.getProperty("derby.system.home") == null) {
      System.setProperty("derby.system.home", homeDir.getPath());
    }
  }
51643
private void setUp() throws Exception {
    try {
      fileSystem = (DistributedFileSystem) FileSystem.get(
          StorageServiceConfigKeys.translateToOldSchema(conf, nameserviceId), conf);
      InetSocketAddress nameNodeAddr = fileSystem.getClient().getNameNodeAddr();
      metaInfo = new RequestMetaInfo(clusterId, nameserviceId, RequestMetaInfo.NO_NAMESPACE_ID,
          RequestMetaInfo.NO_APPLICATION_ID, (UnixUserGroupInformation) UserGroupInformation.getUGI(
          this.conf));

      directClientProtocol = RPC.getProxy(ClientProtocol.class, ClientProtocol.versionID,
          nameNodeAddr, conf);

      directClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,
          ClientProxyProtocol.versionID, nameNodeAddr, conf);

      clientManager = new ThriftClientManager();
      FramedClientConnector connector = new FramedClientConnector(HostAndPort.fromParts(
          proxyHostname, proxyPortThrift));
      proxyTClientProxyProtocol = clientManager.createClient(connector, TClientProxyProtocol.class)
          .get();

      proxyClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,
          ClientProxyProtocol.versionID, new InetSocketAddress(proxyHostname, proxyPortRPC), conf);

      fileSystem.mkdirs(new Path(ROOT));
    } catch (Exception e) {
      tearDown();
      throw e;
    }
  }
1116742
@PostConstruct
    public void init() throws Exception {

        if (hosts == null) {
            throw new IllegalArgumentException("Hosts property not set ");
        }

        determineHostsAsProperty();

        /**
         * quick fix for integration tests. if hosts property set to "embedded" then a local node is start.
         * maven dependencies need to be defined correctly for this to work
         */

        if (hosts.startsWith("embedded")) {
            synchronized (SYNC) {
                if (node == null) {
                    node = new ElasticsearchEmbeddedNode();
                }
            }
            client = node.getClient();
        } else {
            String[] hostsArray = hosts.split(",");
            Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
            client = new TransportClient(settings);

            for (String aHostsArray : hostsArray) {
                String s = aHostsArray.trim();
                String[] host = s.split(":");

                if (log.isLoggable(Level.FINE)) {
                    log.fine(" Connecting to elasticsearch host. [" + host[0] + ":" + host[1] + "]");
                }

                client = ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(host[0],
                        new Integer(host[1])));
            }
        }
    }
1340133
public void init() throws ServletException {
        _application = ((ManagedPlatform)ServicePlatform.getService(ManagedPlatform.INSTANCE).first).getName();

/*
        ApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
        if (wac.containsBean("persistence")) { // persistence may not be there if persistent storage is not required
            _persistence = (Persistence)wac.getBean("persistence");
        }
*/
    }