protected Workspace(Session jcrSession) throws RepositoryException { this.session = jcrSession; this.name = this.session.getWorkspace().getName(); ExecutionContext connectorContext = getExecutionContext(); NamespaceRegistry connectorRegistry = connectorContext.getNamespaceRegistry(); this.context = connectorContext.with( new JcrNamespaceRegistry(getSourceName(), this.session, connectorRegistry)); this.factories = context.getValueFactories(); this.propertyFactory = context.getPropertyFactory(); this.nameFactory = this.factories.getNameFactory(); this.stringFactory = this.factories.getStringFactory(); this.jcrValueFactory = this.session.getValueFactory(); }
protected Map<Name, Property> load(File propertiesFile, ExecutionContext context) throws RepositorySourceException { if (!propertiesFile.exists() || !propertiesFile.canRead()) return NO_PROPERTIES_MAP; try { String content = IoUtil.read(propertiesFile); ValueFactories factories = context.getValueFactories(); PropertyFactory propFactory = context.getPropertyFactory(); Map<Name, Property> result = new HashMap<Name, Property>(); for (String line : StringUtil.splitLines(content)) { // Parse each line ... Property property = parse(line, factories, propFactory); if (property != null) { result.put(property.getName(), property); } } return result; } catch (IOException e) { throw new RepositorySourceException(sourceName, e); } }