Package org.apache.stanbol.entityhub.servicesapi.site

Examples of org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration


    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Site) {
            SiteConfiguration osc = ((Site) obj).getConfiguration();
            // this will return false if one of the two sites is not activated
            // -> this should be OK
            return siteConfiguration != null && osc != null && getId().equals(osc.getId());
        } else {
            return false;
        }
    }
View Full Code Here


    private void importEntity(Entity remoteEntity,
                              Site site,
                              Entity localEntity,
                              ValueFactory valueFactory) {
       
        SiteConfiguration siteConfig = site.getConfiguration();
        ManagedEntityState state;
        state = siteConfig.getDefaultManagedEntityState();
        if(state == null){
            state =  config.getDefaultManagedEntityState();
        }
        //this wrapper allows to use an API to write metadata
        ManagedEntity managedEntity = ManagedEntity.init(localEntity, state);
View Full Code Here

                                           Site site,
                                           Entity entityMappingEntity) {
        EntityMapping entityMapping = EntityMapping.init(entityMappingEntity);
        //now init the mappingState and the expireDate based on the config of the
        //ReferencedSite of the source entity (considering also the defaults of the entityhub)
        SiteConfiguration siteConfig = site.getConfiguration();
        MappingState mappingState = siteConfig.getDefaultMappedEntityState();
        if(mappingState == null){
            mappingState = config.getDefaultMappingState();
        }
        entityMapping.setState(mappingState);
        long expireDuration = siteConfig.getDefaultExpireDuration();
        if(expireDuration > 0){
            Date expireDate = new Date(System.currentTimeMillis()+expireDuration);
            entityMapping.setExpires(expireDate);
        }
        entityMapping.setSourceId(remoteEntity.getId());
View Full Code Here

    private void importEntity(Entity remoteEntity,
                              Site site,
                              Entity localEntity,
                              ValueFactory valueFactory) {
       
        SiteConfiguration siteConfig = site.getConfiguration();
        ManagedEntityState state;
        state = siteConfig.getDefaultManagedEntityState();
        if(state == null){
            state =  config.getDefaultManagedEntityState();
        }
        //this wrapper allows to use an API to write metadata
        ManagedEntity managedEntity = ManagedEntity.init(localEntity, state);
View Full Code Here

                                           Site site,
                                           Entity entityMappingEntity) {
        EntityMapping entityMapping = EntityMapping.init(entityMappingEntity);
        //now init the mappingState and the expireDate based on the config of the
        //ReferencedSite of the source entity (considering also the defaults of the entityhub)
        SiteConfiguration siteConfig = site.getConfiguration();
        MappingState mappingState = siteConfig.getDefaultMappedEntityState();
        if(mappingState == null){
            mappingState = config.getDefaultMappingState();
        }
        entityMapping.setState(mappingState);
        long expireDuration = siteConfig.getDefaultExpireDuration();
        if(expireDuration > 0){
            Date expireDate = new Date(System.currentTimeMillis()+expireDuration);
            entityMapping.setExpires(expireDate);
        }
        entityMapping.setSourceId(remoteEntity.getId());
View Full Code Here

        RdfValueFactory valueFactory = RdfValueFactory.getInstance();
        RdfRepresentation rep = valueFactory.createRepresentation(id);
        String namespace = NamespaceEnum.entityhub.getNamespace();
        rep.add(namespace+"localMode", site.supportsLocalMode());
        rep.add(namespace+"supportsSearch", site.supportsSearch());
        SiteConfiguration config = site.getConfiguration();
        rep.add("http://www.w3.org/2000/01/rdf-schema#label", config.getName());
        rep.add("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", valueFactory.createReference(namespace+"ReferencedSite"));
        if(config.getDescription() != null){
            rep.add("http://www.w3.org/2000/01/rdf-schema#description", config.getDescription());
        }
        if(config.getAttribution() != null){
            rep.add("http://creativecommons.org/ns#attributionName", config.getAttribution());
        }
        if(config.getAttributionUrl() != null){
            rep.add("http://creativecommons.org/ns#attributionURL", config.getAttributionUrl());
        }
        //add the licenses
        if(config.getLicenses() != null){
            int count = 0;
            for(License license : config.getLicenses()){
                String licenseUrl;
                if(license.getUrl() != null){
                    licenseUrl = license.getUrl();
                } else {
                   
                    licenseUrl = id+(!id.endsWith("/")?"/":"")+
                        LICENSE_PATH+'/'+LICENSE_NAME+(count>0?count:"");
                    count++;
                }
                //if defined add the name to dc:license
                if(license.getName() != null){
                    rep.add("http://purl.org/dc/terms/license", licenseUrl);
                }
                //link to the license via cc:license
                rep.add("http://creativecommons.org/ns#license", licenseUrl);
            }
        }
        if(config.getEntityPrefixes() != null){
            for(String prefix : config.getEntityPrefixes()){
                rep.add(namespace+"entityPrefix", prefix);
            }
        } else { //all entities are allowed/processed
            rep.add(namespace+"entityPrefix", "*");
        }
View Full Code Here

    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Site) {
            SiteConfiguration osc = ((Site) obj).getConfiguration();
            // this will return false if one of the two sites is not activated
            // -> this should be OK
            return siteConfiguration != null && osc != null && getId().equals(osc.getId());
        } else {
            return false;
        }
    }
View Full Code Here

        RdfValueFactory valueFactory = RdfValueFactory.getInstance();
        RdfRepresentation rep = valueFactory.createRepresentation(id);
        String namespace = NamespaceEnum.entityhub.getNamespace();
        rep.add(namespace+"localMode", site.supportsLocalMode());
        rep.add(namespace+"supportsSearch", site.supportsSearch());
        SiteConfiguration config = site.getConfiguration();
        rep.add(NamespaceEnum.rdfs+"label", config.getName());
        rep.add(NamespaceEnum.rdf+"type", valueFactory.createReference(namespace+"ReferencedSite"));
        if(config.getDescription() != null){
            rep.add(NamespaceEnum.rdfs+"description", config.getDescription());
        }
        if(config.getCacheStrategy() != null){
            rep.add(namespace+"cacheStrategy", valueFactory.createReference(namespace+"cacheStrategy-"+config.getCacheStrategy().name()));
        }
        //add the accessUri and queryUri
        if(config.getAccessUri() != null){
            rep.add(namespace+"accessUri", valueFactory.createReference(config.getAccessUri()));
        }
        if(config.getQueryUri() != null){
            rep.add(namespace+"queryUri", valueFactory.createReference(config.getQueryUri()));
        }
        if(config.getAttribution() != null){
            rep.add(NamespaceEnum.cc.getNamespace()+"attributionName", config.getAttribution());
        }
        if(config.getAttributionUrl() != null){
            rep.add(NamespaceEnum.cc.getNamespace()+"attributionURL", config.getAttributionUrl());
        }
        //add the licenses
        if(config.getLicenses() != null){
            int count = 0;
            for(License license : config.getLicenses()){
                String licenseUrl;
                if(license.getUrl() != null){
                    licenseUrl = license.getUrl();
                } else {
                   
                    licenseUrl = id+(!id.endsWith("/")?"/":"")+
                        LICENSE_PATH+'/'+LICENSE_NAME+(count>0?count:"");
                    count++;
                }
                //if defined add the name to dc:license
                if(license.getName() != null){
                    rep.add(NamespaceEnum.dcTerms.getNamespace()+"license", licenseUrl);
                }
                //link to the license via cc:license
                rep.add(NamespaceEnum.cc.getNamespace()+"license", licenseUrl);
            }
        }
        if(config.getEntityPrefixes() != null){
            for(String prefix : config.getEntityPrefixes()){
                rep.add(namespace+"entityPrefix", prefix);
            }
        } else { //all entities are allowed/processed
            rep.add(namespace+"entityPrefix", "*");
        }
View Full Code Here

        return siteConfiguration!=null?getId().hashCode():-1;
    }
    @Override
    public boolean equals(Object obj) {
        if(obj instanceof ReferencedSite) {
            SiteConfiguration osc = ((ReferencedSite)obj).getConfiguration();
            //this will return false if one of the two sites is not activated
            // -> this should be OK
            return siteConfiguration != null && osc != null &&
                getId().equals(osc.getId());
        } else {
            return false;
        }
    }
View Full Code Here

        RdfValueFactory valueFactory = RdfValueFactory.getInstance();
        RdfRepresentation rep = valueFactory.createRepresentation(id);
        String namespace = NamespaceEnum.entityhubModel.getNamespace();
        rep.add(namespace+"localMode", site.supportsLocalMode());
        rep.add(namespace+"supportsSearch", site.supportsSearch());
        SiteConfiguration config = site.getConfiguration();
        rep.add(NamespaceEnum.rdfs+"label", config.getName());
        rep.add(NamespaceEnum.rdf+"type", valueFactory.createReference(namespace+"ReferencedSite"));
        if(config.getDescription() != null){
            rep.add(NamespaceEnum.rdfs+"description", config.getDescription());
        }
        if(config.getCacheStrategy() != null){
            rep.add(namespace+"cacheStrategy", valueFactory.createReference(namespace+"cacheStrategy-"+config.getCacheStrategy().name()));
        }
        //add the accessUri and queryUri
        if(config.getAccessUri() != null){
            rep.add(namespace+"accessUri", valueFactory.createReference(config.getAccessUri()));
        }
        if(config.getQueryUri() != null){
            rep.add(namespace+"queryUri", valueFactory.createReference(config.getQueryUri()));
        }
        if(config.getAttribution() != null){
            rep.add(NamespaceEnum.cc.getNamespace()+"attributionName", config.getAttribution());
        }
        if(config.getAttributionUrl() != null){
            rep.add(NamespaceEnum.cc.getNamespace()+"attributionURL", config.getAttributionUrl());
        }
        //add the licenses
        if(config.getLicenses() != null){
            int count = 0;
            for(License license : config.getLicenses()){
                String licenseUrl;
                if(license.getUrl() != null){
                    licenseUrl = license.getUrl();
                } else {
                   
                    licenseUrl = id+(!id.endsWith("/")?"/":"")+
                        LICENSE_PATH+'/'+LICENSE_NAME+(count>0?count:"");
                    count++;
                }
                //if defined add the name to dc:license
                if(license.getName() != null){
                    rep.add(NamespaceEnum.dcTerms.getNamespace()+"license", licenseUrl);
                }
                //link to the license via cc:license
                rep.add(NamespaceEnum.cc.getNamespace()+"license", licenseUrl);
            }
        }
        if(config.getEntityPrefixes() != null){
            for(String prefix : config.getEntityPrefixes()){
                rep.add(namespace+"entityPrefix", prefix);
            }
        } else { //all entities are allowed/processed
            rep.add(namespace+"entityPrefix", "*");
        }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration

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.