Orientdb-studio in the embedded server

Hello!
I am using an embeded server and want my users to use orientdb-studio. The only option I found is to put an orientdb-studio jar file in the application resource directory (jar inside
jar!) and copy it from the application resource to the server /plugins directory before the embedded server starts. It works but looks ugly.
Are there any other approaches?

Hi @arch7tect

currently there is no other way. Studio is a plugin which contains only static files.

The plugins in OrientDB server are stored inside ${ORIENTDB_ HOME}/plugins and loaded at server boot time

Thanks

1 Like

I managed to make it work with classpath:
pom.xml:

...
       <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-studio</artifactId>
            <version>3.0.26</version>
        </dependency>
...
server.activate();
registerWwwAsStudio();
public void registerWwwAsStudio() {
    OCallable oCallable = new OCallable<Object, String>() {
        @Override
        public Object call(final String iArgument) {
            String fileName = "www/" + iArgument;
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            final URL url = classLoader.getResource(fileName);

            if (url != null) {
                final OServerCommandGetStaticContent.OStaticContent content = new OServerCommandGetStaticContent.OStaticContent();
                content.is = new BufferedInputStream(classLoader.getResourceAsStream(fileName));
                content.contentSize = -1;
                content.type = OServerCommandGetStaticContent.getContentType(url.getFile());
                return content;
            }
            return null;
        }
    };
    final OServerNetworkListener httpListener = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
    final OServerCommandGetStaticContent command = (OServerCommandGetStaticContent) httpListener
            .getCommand(OServerCommandGetStaticContent.class);
    command.registerVirtualFolder("studio", oCallable);
}
1 Like