Search in sources :

Example 1 with AuthLobcderComponents

use of nl.uva.cs.lobcder.auth.AuthLobcderComponents in project lobcder by skoulouzis.

the class MyMiltonConfigurator method build.

// public MyMiltonConfigurator() {
// super();
// try {
// // Attempt to use Enterprise edition build if available
// Class builderClass = Class.forName("nl.uva.cs.webdav.HttpManagerBuilderExt");
// builder = (HttpManagerBuilder) builderClass.newInstance();
// log.log(Level.INFO, "Using enterprise builder: {0}", builder.getClass());
// } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) {
// log.info("Couldnt instantiate enterprise builder, DAV level 2 and beyond features will not be available");
// builder = new HttpManagerBuilder();
// }
// Class handlerHelper = Class.forName("io.milton.http.HandlerHelper");
// if (handlerHelper != null) {
// throw new RuntimeException("HandlerHelper is not an instance of io.milton.http.HandlerHelper");
// }
// builder = new HttpManagerBuilderExt();
// }
@Override
protected void build() {
    builder.setEnableCompression(false);
    builder.setEnableOptionsAuth(true);
    builder.setEnableBasicAuth(true);
    super.build();
    try {
        Context ctx = new InitialContext();
        if (ctx == null) {
            throw new Exception("JNDI could not create InitalContext ");
        }
        Context envContext = (Context) ctx.lookup("java:/comp/env");
        catalogue = (JDBCatalogue) envContext.lookup("bean/JDBCatalog");
        catalogue.startSweep();
        // workerAuth = (AuthLobcderComponents) envContext.lookup("bean/authWorker");
        List<String> workers = PropertiesHelper.getWorkers();
        if (workers != null && workers.size() > 0) {
            workerAuth = new AuthLobcderComponents();
        }
        webDataResourceFactory = (WebDataResourceFactory) builder.getMainResourceFactory();
        webDataResourceFactory.setCatalogue(catalogue);
        List<AuthI> authList = SingletonesHelper.getInstance().getAuth();
        // if(workerAuth!=null){
        // authList.add(workerAuth);
        // }
        webDataResourceFactory.setAuthList(authList);
    // /            webDataResourceFactory.setAuth1(authRemote);
    // webDataResourceFactory.setAuth2(localDbAuth);
    // webDataResourceFactory.setAuth3(workerAuth);
    // loadOptimizers(envContext);
    } catch (Exception e) {
        Logger.getLogger(MyMiltonConfigurator.class.getName()).log(Level.SEVERE, null, e);
    }
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) AuthLobcderComponents(nl.uva.cs.lobcder.auth.AuthLobcderComponents) AuthI(nl.uva.cs.lobcder.auth.AuthI) InitialContext(javax.naming.InitialContext) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Context (javax.naming.Context)1 InitialContext (javax.naming.InitialContext)1 AuthI (nl.uva.cs.lobcder.auth.AuthI)1 AuthLobcderComponents (nl.uva.cs.lobcder.auth.AuthLobcderComponents)1