Package org.dspace.services

Examples of org.dspace.services.ConfigurationService


        return false;
    }
   
    public static boolean isContentNegotiationEnabled()
    {
        ConfigurationService configurationService =
                new DSpace().getConfigurationService();
        return configurationService.getPropertyAsType(CONTENT_NEGOTIATION_KEY,
                false);
    }
View Full Code Here


                false);
    }
   
    public static String getPublicSparqlEndpointAddress()
    {
        ConfigurationService configurationService =
                    new DSpace().getConfigurationService();
        return configurationService.getProperty(SPARQL_ENDPOINT_KEY);
    }
View Full Code Here

        return configurationService.getProperty(SPARQL_ENDPOINT_KEY);
    }
   
    public static String getInternalSparqlEndpointAddress()
    {
        ConfigurationService configurationService =
                new DSpace().getConfigurationService();
        String internalSparqlEndpoint =
                configurationService.getProperty(STORAGE_SPARQL_ENDPOINT_KEY);
        String externalSparqlEndpoint =
                configurationService.getProperty(SPARQL_ENDPOINT_KEY);
        return StringUtils.isEmpty(internalSparqlEndpoint) ?
                externalSparqlEndpoint : internalSparqlEndpoint;

    }
View Full Code Here

    }
   
    public static String getDSpaceRDFModuleURI()
    {
        ConfigurationService configurationService =
                    new DSpace().getConfigurationService();
        return configurationService.getProperty(CONTEXT_PATH_KEY);
    }
View Full Code Here

       
    protected static RDFConverter getRDFConverter()
    {
        if (converter == null)
        {
            ConfigurationService configurationService =
                    new DSpace().getConfigurationService();
            converter = (RDFConverter) initializeClass(configurationService,
                    RDFCONVERTER_KEY, "RDFConverter");
        }
        return converter;
View Full Code Here

     */
    protected static URIGenerator getURIGenerator()
    {
        if (generator == null)
        {
            ConfigurationService configurationService =
                    new DSpace().getConfigurationService();
            generator = (URIGenerator) initializeClass(configurationService,
                    URIGENERATOR_KEY, "URIGenerator");
        }
        return generator;
View Full Code Here

     */
    protected static RDFStorage getRDFStorage()
    {
        if (storage == null)
        {
            ConfigurationService configurationService =
                    new DSpace().getConfigurationService();
            storage = (RDFStorage) initializeClass(configurationService,
                            RDFSTORAGE_KEY, "RDFStorage");
        }
        return storage;
View Full Code Here

    }



    protected Date getOldestWorkflowItemDate() throws SolrServerException {
        ConfigurationService configurationService = new DSpace().getConfigurationService();
        String workflowStartDate = configurationService.getProperty("usage-statistics.workflow-start-date");
        if(workflowStartDate == null){
            //Query our solr for it !
            QueryResponse oldestRecord = SolrLogger.query(getQuery(), null, null, 1, 0, null, null, null, null, "time", true);
            if(0 < oldestRecord.getResults().getNumFound()){
                SolrDocument solrDocument = oldestRecord.getResults().get(0);
                Date oldestDate = (Date) solrDocument.getFieldValue("time");
                //Store the date, we only need to retrieve this once !
                try {
                    //Also store it in the solr-statics configuration file, the reason for this being that the sort query
                    //can be very time consuming & we do not want this delay each time we want to see workflow statistics
                    String solrConfigDir = configurationService.getProperty("dspace.dir") + File.separator + "config"
                            + File.separator + "modules" + File.separator + "usage-statistics.cfg";
                    PropertiesConfiguration config = new PropertiesConfiguration(solrConfigDir);
                    config.setProperty("workflow-start-date", new DCDate(oldestDate));
                    config.save();
                } catch (ConfigurationException e) {
                    log.error("Error while storing workflow start date", e);
                }
                //ALso store it in our local config !
                configurationService.setProperty("usage-statistics.workflow-start-date", new DCDate(oldestDate).toString());

                //Write to file
                return oldestDate;
            }else{
                return null;
View Full Code Here

        }

    }

    protected boolean displayStatsType(Context context, DSpaceObject dso) throws SQLException {
        ConfigurationService cs = new DSpace().getConfigurationService();
        return !cs.getPropertyAsType("google-analytics.authorization.admin.usage", Boolean.TRUE) || AuthorizeManager.isAdmin(context, dso);

    }
View Full Code Here

     */
    @Test
    public void testGetPasswordAuthentication()
    {
        System.out.println("getPasswordAuthentication");
        ConfigurationService cfg = getKernel().getConfigurationService();

        // Save existing values.
        String oldUsername = cfg.getProperty(CFG_USERNAME);
        String oldPassword = cfg.getProperty(CFG_PASSWORD);

        // Set known values.
        cfg.setProperty(CFG_USERNAME, USERNAME);
        cfg.setProperty(CFG_PASSWORD, PASSWORD);

        EmailServiceImpl instance = (EmailServiceImpl) getService(EmailServiceImpl.class);

        PasswordAuthentication result = instance.getPasswordAuthentication();
        assertNotNull(" null returned", result);
        assertEquals(" username does not match configuration", result.getUserName(), USERNAME);
        assertEquals(" password does not match configuration", result.getPassword(), PASSWORD);

        // Restore old values, if any.
        cfg.setProperty(CFG_USERNAME, oldUsername);
        cfg.setProperty(CFG_PASSWORD, oldPassword);
    }
View Full Code Here

TOP

Related Classes of org.dspace.services.ConfigurationService

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.