{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Dataloaders","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":false}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"dataloaders","__idx":0},"children":["Dataloaders"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"data-loader-extension","__idx":1},"children":["Data Loader Extension"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Netbeans has a pluggable architecture called DataLoader that allows you to implement your own loading mechanism of ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["data files"]},". Datasets instantiated through the DataLoader architecture will be cached automatically by NetBeans."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"registering-a-data-loader","__idx":2},"children":["Registering a Data Loader"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A registered Data Loader associates a file type with your own class implementing org.openide.loaders.MultiDataObject. Part of the contract of a MultiDataObject is that its lookup provides an instance of a class implementing IData. For instance:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"MultiDataObject obj = ...\nobj.getLookup(IData.class) will return an IData instance.\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There are three things that you have to do to plug in your own DataLoader."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1. Register your DataLoader in the layer.xml"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["LAYER.XML"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<folder name=\"Loaders\">\n        <folder name=\"seismic\">\n            <folder name=\"x-demo2d\">\n                <folder name=\"Factories\">\n                    <file name=\"Demo2DSeismicDataLoader.instance\">\n                        <attr name=\"dataObjectClass\" stringvalue=\"com.interactive.intviewer.demoseismicdata.twod.DemoTwoDSeismicDataObject\"/>\n                        <attr name=\"instanceCreate\" methodvalue=\"org.openide.loaders.DataLoaderPool.factory\"/>\n                    </file>\n                </folder>\n            </folder>\n        </folder>\n    </folder>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this example, the file name \"Demo2DSeismicDataLoader\" is a unique name. The \"dataObjectClass\" attribute needs to be the fully qualified name of your MultiDataObject class. The \"instanceCreate\" attribute must be org.openide.loaders.DataLoaderPool.factory."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The \"x-demo2d\" folder in this example indicates the MIME type that this DataLoader should handle."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["2. Implement a data object class, which extends org.openide.loaders.MultiDataObject"]},". In addition to the constructor, there is only one method that must be implemented, which is the getLookup method."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["3. Implement a data class, which implements com.interactive.intviewerapi.data.IData"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"registering-a-mime-type","__idx":3},"children":["Registering a MIME type"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You will also need to implement your own MIME type. This is a very simple process, as all it takes is another layer.xml entry."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["LAYER.XML"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<folder name=\"MimeTypes\">\n    <folder name=\"seismic\">\n        <folder name=\"x-demo2d\">\n            <attr name=\"name\" stringvalue=\"Demo2D\"/>\n            <attr name=\"ext\" stringvalue=\"demo2d DEMO2D\"/>\n        </folder>\n    </folder>\n</folder>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The \"name\" attribute is just the name for your MIME type. It will be displayed in file choosers. The \"ext\" attribute is a list of all of the valid extensions for your MIME type. More information on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/other-useful-intviewer-apis/mime-types"},"children":["how to handle mime types"]}," is available."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"examples","__idx":4},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Follow this ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/other-useful-intviewer-apis/dataloaders/implementing-your-own-seismic-format-loading"},"children":["link"]}," for a sample implementation of seismic data loader that reads a custom seismic file format."]}]},"headings":[{"value":"Dataloaders","id":"dataloaders","depth":1},{"value":"Data Loader Extension","id":"data-loader-extension","depth":2},{"value":"Registering a Data Loader","id":"registering-a-data-loader","depth":3},{"value":"Registering a MIME type","id":"registering-a-mime-type","depth":3},{"value":"Examples","id":"examples","depth":3}],"frontmatter":{"title":"Dataloaders","pageId":"other-useful-intviewer-apis/dataloaders","seo":{"title":"Dataloaders"}},"lastModified":"2026-10-22T14:32:05.579Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/other-useful-intviewer-apis/dataloaders","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}