Java Code Examples for org.openrdf.repository.config.RepositoryImplConfig#getClass()

The following examples show how to use org.openrdf.repository.config.RepositoryImplConfig#getClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BigdataRepositoryFactory.java    From database with GNU General Public License v2.0 6 votes vote down vote up
public Repository getRepository(final RepositoryImplConfig config)
	throws RepositoryConfigException {

	if (!TYPE.equals(config.getType())) {
		throw new RepositoryConfigException(
                   "Invalid type: " + config.getType());
	}
	
	if (!(config instanceof BigdataRepositoryConfig)) {
		throw new RepositoryConfigException(
                   "Invalid type: " + config.getClass());
	}
	
       try {
           
		final BigdataRepositoryConfig bigdataConfig = (BigdataRepositoryConfig)config;
		final Properties properties = bigdataConfig.getProperties();
   		final BigdataSail sail = new BigdataSail(properties);
   		return new BigdataSailRepository(sail);
           
       } catch (Exception ex) {
           throw new RepositoryConfigException(ex);
       }
       
}
 
Example 2
Source File: ObjectRepositoryFactory.java    From anno4j with Apache License 2.0 5 votes vote down vote up
/**
 * Create an uninitialised ObjectRepository without a delegate.
 */
@Override
public ObjectRepository getRepository(RepositoryImplConfig configuration)
		throws RepositoryConfigException {
	if (!(configuration instanceof ObjectRepositoryConfig))
		throw new RepositoryConfigException("Invalid configuration class: "
				+ configuration.getClass());
	ObjectRepositoryConfig config = (ObjectRepositoryConfig) configuration;
	return getRepository(config, ValueFactoryImpl.getInstance());
}