Initializes the RestManager with the storageIO being optionally created outside of this implementation such as to use ZooKeeper instead of the local FS.
(SolrResourceLoader loader, NamedList<String> initArgs, StorageIO storageIO)
| 558 | * implementation such as to use ZooKeeper instead of the local FS. |
| 559 | */ |
| 560 | public void init(SolrResourceLoader loader, NamedList<String> initArgs, StorageIO storageIO) |
| 561 | throws SolrException { |
| 562 | log.debug("Initializing RestManager with initArgs: {}", initArgs); |
| 563 | |
| 564 | if (storageIO == null) |
| 565 | throw new IllegalArgumentException( |
| 566 | "Must provide a valid StorageIO implementation to the RestManager!"); |
| 567 | |
| 568 | this.storageIO = storageIO; |
| 569 | this.loader = loader; |
| 570 | |
| 571 | registry = loader.getManagedResourceRegistry(); |
| 572 | |
| 573 | // the RestManager provides metadata about managed resources via the /managed endpoint |
| 574 | // and allows you to create new ManagedResources dynamically by PUT'ing to this endpoint |
| 575 | endpoint = new RestManagerManagedResource(this); |
| 576 | endpoint.loadManagedDataAndNotify(null); // no observers for my endpoint |
| 577 | // responds to requests to /config/managed and /schema/managed |
| 578 | managed.put(SCHEMA_BASE_PATH + MANAGED_ENDPOINT, endpoint); |
| 579 | |
| 580 | // init registered managed resources |
| 581 | if (log.isDebugEnabled()) { |
| 582 | log.debug("Initializing {} registered ManagedResources", registry.registered.size()); |
| 583 | } |
| 584 | for (ManagedResourceRegistration reg : registry.registered.values()) { |
| 585 | // keep track of this for lookups during request processing |
| 586 | managed.put(reg.resourceId, createManagedResource(reg)); |
| 587 | } |
| 588 | |
| 589 | // this is for any new registrations that don't come through the API |
| 590 | // such as from adding a new fieldType to a managed schema that uses a ManagedResource |
| 591 | registry.initializedRestManager = this; |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * If not already registered, registers the given {@link ManagedResource} subclass at the given |