protected void initializeConnector( Connector connector, NamespaceRegistry registry, org.modeshape.jcr.api.nodetype.NodeTypeManager nodeTypeManager ) throws IOException, RepositoryException { // Set the execution context instance ... Reflection.setValue(connector, "context", repository.context()); // Set the execution context instance ... Reflection.setValue(connector, "translator", getDocumentTranslator()); // Set the MIME type detector ... Reflection.setValue(connector, "mimeTypeDetector", repository.mimeTypeDetector()); // Set the transaction manager Reflection.setValue(connector, "transactionManager", repository.txnManager()); // Set the ConnectorChangedSet factory Reflection.setValue(connector, "connectorChangedSetFactory", createConnectorChangedSetFactory(connector)); // Set the Environment Reflection.setValue(connector, "environment", repository.environment()); // Set the ExtraPropertiesStore instance, which is unique to this connector ... LocalDocumentStore store = repository.documentStore().localStore(); String name = connector.getSourceName(); String sourceKey = NodeKey.keyForSourceName(name); DocumentTranslator translator = getDocumentTranslator(); ExtraPropertiesStore defaultExtraPropertiesStore = new LocalDocumentStoreExtraProperties(store, sourceKey, translator); Reflection.setValue(connector, "extraPropertiesStore", defaultExtraPropertiesStore); connector.initialize(registry, nodeTypeManager); // If successful, call the 'postInitialize' method reflectively (due to inability to call directly) ... Method postInitialize = Reflection.findMethod(Connector.class, "postInitialize"); Reflection.invokeAccessibly(connector, postInitialize, new Object[] {}); }
protected void initializeConnector( Connector connector, NamespaceRegistry registry, org.modeshape.jcr.api.nodetype.NodeTypeManager nodeTypeManager ) throws IOException, RepositoryException { // Set the execution context instance ... Reflection.setValue(connector, "context", repository.context()); // Set the execution context instance ... Reflection.setValue(connector, "translator", getDocumentTranslator()); // Set the MIME type detector ... Reflection.setValue(connector, "mimeTypeDetector", repository.mimeTypeDetector()); // Set the transaction manager Reflection.setValue(connector, "transactionManager", repository.txnManager()); // Set the ConnectorChangedSet factory Reflection.setValue(connector, "connectorChangedSetFactory", createConnectorChangedSetFactory(connector)); // Set the Environment Reflection.setValue(connector, "environment", repository.environment()); // Set the ExtraPropertiesStore instance, which is unique to this connector ... LocalDocumentStore store = repository.documentStore().localStore(); String name = connector.getSourceName(); String sourceKey = NodeKey.keyForSourceName(name); DocumentTranslator translator = getDocumentTranslator(); ExtraPropertiesStore defaultExtraPropertiesStore = new LocalDocumentStoreExtraProperties(store, sourceKey, translator); Reflection.setValue(connector, "extraPropertiesStore", defaultExtraPropertiesStore); connector.initialize(registry, nodeTypeManager); // If successful, call the 'postInitialize' method reflectively (due to inability to call directly) ... Method postInitialize = Reflection.findMethod(Connector.class, "postInitialize"); Reflection.invokeAccessibly(connector, postInitialize, new Object[] {}); }