try {
serviceFactoryClass = Class.forName(factoryClassName).asSubclass(ServiceFactory.class);
} catch (ClassNotFoundException e1) {
throw new RuntimeException(e1);
}
ServiceFactory serviceFactory;
try {
serviceFactory = serviceFactoryClass.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
Set<Source> trustedSources = getTrustedSources(serviceResource);
Source identity = new SourceImpl(serviceResource.getRequiredProperty(SERVICES.identity).getResource().getURI());
trustedSources.add(identity); //trust yourself
NamedNode configuration = new NamedNodeImpl(serviceResource.getRequiredProperty(SERVICES.configuration).getResource().getURI());
final Service service = serviceFactory.getService(store, identity, trustedSources, configuration);
new Thread() {
public void run() {
service.start();
}
}.start();