Package edu.indiana.dlib.metsnav.config

Examples of edu.indiana.dlib.metsnav.config.CollectionConfig


        String metsConfDir = servletConfig.getInitParameter("metsnav-conf");
        if (!metsConfDir.endsWith("/")) {
            metsConfDir += "/";
        }
        String metsConfPath = context.getRealPath(metsConfDir);
        CollectionConfig collConfig = null;
        String confFile = null;
        String[] files = new File(metsConfPath).list();
        for (int i = 0; i < files.length; i++) {
            String file = files[i];
            if (!file.endsWith(".xml")) {
                continue;
            }
            confFile = context.getRealPath(metsConfDir + file);
            try {
                collConfig = (CollectionConfig) Configurator.configure(confFile);

                String prefix = collConfig.getPrefix();
                context.setAttribute(Globals.INTERFACE_KEY + prefix, collConfig.getUserInterface());
                DataSourceConfig dsc = collConfig.getDataSource();
                dsc.setPathPrefix(context.getRealPath("/"));
                context.setAttribute(Globals.DATA_SOURCE_KEY + prefix, dsc);
                ParameterMapFactory pmf = ParameterMapFactory.newInstance();
                pmf.registerParameterMap(Globals.NAVIGATE_ACTION, collConfig.getDigitalImage());

                // TODO: generalize this
                pmf.registerParameterMap(Globals.DATA_STREAM_KEY + prefix, collConfig
                        .getDataStream());
                context.setAttribute(Globals.PARAMETER_MAP_FACTORY_KEY + prefix, pmf);

                context.setAttribute(Globals.COLLECTION_CONFIG_KEY + prefix, collConfig);
View Full Code Here


     * @throws DAOException
     */
    public MetsObjectDAO getMetsObjectDAO(String col) throws ConfigurationException, DAOException {
        MetsObjectDAO dao = (MetsObjectDAO)servletContext.getAttribute(Globals.DAO_KEY + "/" + col);
        if (dao == null) {
            CollectionConfig config = getConfig(col);
            MetsObjectDAOFactory factory = MetsObjectDAOFactory.instance();
            MetsObjectDAO wrappedDao = factory.createMetsObjectDAO(config.getDataSource().getDaoType());
            dao = new CacheMetsObjectDAO(wrappedDao);
            dao.init(config);
            servletContext.setAttribute(Globals.DAO_KEY + "/" + col, dao);
        }
        return dao;
View Full Code Here

     * Returns the configuration of a collection
     * @param coll
     * @return
     */
  public CollectionConfig getConfig(String coll) {
        CollectionConfig cc = (CollectionConfig)servletContext.getAttribute(Globals.COLLECTION_CONFIG_KEY + "/" + coll);
        return cc;
  }
View Full Code Here

        MetsObjectController controller = null;
        String json = null;
    try {
        DataSourceConfig dsConfig = new URLDataSource();
        dsConfig.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        CollectionConfig config = new CollectionConfig();
        config.setDataSource(dsConfig);
        controller = new MetsObjectController(config);       
          MetsObject metsObj = controller.getMetsObject(oid);

          JSONObject ret = new JSONObject();
         
View Full Code Here

    @GET
    @Path("/config")
    @Produces("text/plain")
    public String loadConfig(@DefaultValue("default") @QueryParam("coll") String coll,
            @DefaultValue("") @QueryParam("callback") String callback) {
        CollectionConfig config = (CollectionConfig)servletContext.getAttribute(Globals.COLLECTION_CONFIG_KEY + "/" + coll);
        if (config == null) {
            // TODO return an error message
            return "";
        } else {
            if (StringUtils.isBlank(callback)) {
                return config.toJson().toString();
            } else {
                return callback + "(" + config.toJson().toString() + ");";
            }      
        }
    }
View Full Code Here

        String path = new MetsNavTestCase().getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
        FileSystemDataSource dsConfig_1_6 = new FileSystemDataSource();
        dsConfig_1_6.setAbsolutePath(path);
        dsConfig_1_6.setMetsVersion("1.6");
        dsConfig_1_6.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        config_1_6 = new CollectionConfig();
        config_1_6.setDataSource(dsConfig_1_6);

        FileSystemDataSource dsConfig_1_5 = new FileSystemDataSource();
        dsConfig_1_5.setAbsolutePath(path);
        dsConfig_1_5.setMetsVersion("1.5");
        dsConfig_1_5.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        config_1_5 = new CollectionConfig();
        config_1_5.setDataSource(dsConfig_1_5);

        FileSystemDataSource dsConfig_1_4 = new FileSystemDataSource();
        dsConfig_1_4.setAbsolutePath(path);
        dsConfig_1_4.setMetsVersion("1.4");
        dsConfig_1_4.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        config_1_4 = new CollectionConfig();
        config_1_4.setDataSource(dsConfig_1_4);

        FileSystemDataSource dsConfig_ead = new FileSystemDataSource();
        dsConfig_ead.setAbsolutePath(path);
        dsConfig_ead.setMetsVersion("ead");
        dsConfig_ead.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        config_ead = new CollectionConfig();
        config_ead.setDataSource(dsConfig_ead);

        CompositeCacheManager cacheMgr = null;
        System.out.println(path);
        root = path.substring(0, path.indexOf("/build/"));
View Full Code Here

        String path = PersistentIUFA2MetsFileDAOTest.class.getProtectionDomain().getCodeSource().getLocation().getPath();
      FileSystemDataSource dsConfig_ead = new FileSystemDataSource();
        dsConfig_ead.setAbsolutePath(path);
        dsConfig_ead.setMetsVersion("ead");
        dsConfig_ead.setDaoType("edu.indiana.dlib.metsnav.dao.PersistentMetsFileDAO");
        config_ead = new CollectionConfig();
        config_ead.setDataSource(dsConfig_ead);
    }
View Full Code Here

        log.debug("Initializting NavigationController for collection: " + prefix);
        // Data source configuration will not be implemented in this version
        this.context = context;
        this.prefix = prefix;
        String key = Globals.COLLECTION_CONFIG_KEY + prefix;
        CollectionConfig config = (CollectionConfig) context.getAttribute(key);
        MetsObjectDAO childDao = MetsObjectDAOFactory.instance().createMetsObjectDAO(
                config.getDataSource().getDaoType());
        dao = new CacheMetsObjectDAO(childDao);
        dao.init(config);

        log.debug("Finished initializing NavigationController for collection: " + prefix);
    }
View Full Code Here

TOP

Related Classes of edu.indiana.dlib.metsnav.config.CollectionConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.