Changeset 1215


Ignore:
Timestamp:
12/05/11 22:40:11 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-mua/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/src/main/config/mua-core.xml

    r1205 r1215  
    1818 
    1919    <!-- WEB SERVICE ENDPOINT INTERFACE (SEI) SETUP --> 
    20     <jaxws:endpoint id="muaEndpoint" implementor="#muaEndpointInterface" address="/MultiUnitAggregator"> 
     20    <jaxws:endpoint id="muaEndpoint"  
     21            implementor="#muaEndpointInterface" address="/MultiUnitAggregator"> 
    2122        <jaxws:serviceFactory> 
    2223            <ref bean='jaxws-and-aegis-service-factory' /> 
  • raptor-mua/trunk/src/main/config/statistical-processors.xml

    r1211 r1215  
    118118                                        class="org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider"> 
    119119                                        <constructor-arg index="0" 
    120                                                 value="http://metadata.ukfederation.org.uk/ukfederation-metadata.xml" /> 
     120                                                value="http://iam.cf.ac.uk/cufederation/metadata.cufederation.xml" /> 
    121121                                        <constructor-arg index="1" value="5000" /> 
    122122                                        <constructor-arg index="2" value="/tmp/metadata-uk-fed.xml" /> 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/AbstractStatisticRegistry.java

    r1205 r1215  
    7373        List<StatisticPostProcessor> postProcessors = 
    7474                initialisePostProcessors(statisticalUnitInformation.getPostprocessors()); 
    75         for (StatisticPostProcessor postProcessor : postProcessors) { 
    76             log.debug("Setting post processor {}", postProcessor); 
    77         } 
     75 
    7876        statistic.setPostprocessor(postProcessors); 
    7977    } 
     
    9290            try { 
    9391                StatisticPostProcessor processor = processorRegistry.getProcessor(information); 
     92                log.debug("Initialise post processor with friendlyname [{}]", processor.getFriendlyName()); 
    9493                initlialisedPostProcessors.add(processor); 
    9594            } catch (StatisticPostProcessorFactoryException e) { 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/DefaultStatisticProcessorRegistry.java

    r1211 r1215  
    22package uk.ac.cardiff.raptormua.engine.statistics; 
    33 
    4 import java.util.HashMap; 
    54import java.util.List; 
    6 import java.util.Map; 
    75 
    86import org.slf4j.Logger; 
     
    2321    /** Factory used to construct processors from templates */ 
    2422    private StatisticProcessorFactory processorFactory; 
    25      
    2623 
    2724    /** 
     
    3633    public synchronized StatisticPostProcessor getProcessor(ProcessorInformation processorInformation) 
    3734            throws ProcessorRegistryException, StatisticPostProcessorFactoryException { 
    38          
    3935 
    4036        for (ProcessorTemplate processorTemplate : postprocessors) { 
    4137            if (processorTemplate.getProcessorClass().getCanonicalName() 
    4238                    .equals(processorInformation.getProcessorClass())) { 
    43                  
    44                 //check singleton 
    45                 if (processorTemplate.getScope().equals(SCOPE.SINGLETON)){ 
    46                     log.debug("Returning singleton bean reference [{}] for [{}]",processorTemplate.getSingletonBeanReference(),processorTemplate.getProcessorFriendlyName()); 
    47                     StatisticPostProcessor processor =  processorTemplate.getSingletonBeanReference(); 
     39 
     40                // check singleton 
     41                if (processorTemplate.getScope().equals(SCOPE.SINGLETON)) { 
     42                    log.debug("Returning singleton bean reference [{}] for [{}]", 
     43                            processorTemplate.getSingletonBeanReference(), processorTemplate.getProcessorFriendlyName()); 
     44                    StatisticPostProcessor processor = processorTemplate.getSingletonBeanReference(); 
    4845                    processor.setFriendlyName(processorTemplate.getProcessorFriendlyName()); 
     46                    processorInformation.setFriendlyName(processorTemplate.getProcessorFriendlyName()); 
    4947                    return processor; 
    5048                } 
    51                 //check else, create new (almost prototype) instance 
     49                // check else, create new (almost prototype) instance 
    5250                processorInformation.setFriendlyName(processorTemplate.getProcessorFriendlyName()); 
    5351                return processorFactory.getPostProcessor(processorTemplate, processorInformation.getMethodParameters()); 
     
    5755 
    5856    } 
    59      
    60    
     57 
    6158    /** 
    6259     * @param postprocessors the postprocessors to set 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/SamlMetadataNameFormatter.java

    r1211 r1215  
    2020package uk.ac.cardiff.raptormua.engine.statistics.processor; 
    2121 
    22 import java.io.File; 
    23 import java.util.ArrayList; 
    2422import java.util.List; 
    2523 
    2624import org.opensaml.DefaultBootstrap; 
    27 import org.opensaml.saml2.metadata.EntityDescriptor; 
    2825import org.opensaml.saml2.metadata.OrganizationDisplayName; 
    29 import org.opensaml.saml2.metadata.OrganizationName; 
    3026import org.opensaml.saml2.metadata.provider.ChainingMetadataProvider; 
    3127import org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider; 
    32 import org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider; 
    3328import org.opensaml.saml2.metadata.provider.MetadataProvider; 
    3429import org.opensaml.saml2.metadata.provider.MetadataProviderException; 
    35 import org.opensaml.util.resource.Resource; 
    3630import org.opensaml.xml.ConfigurationException; 
    3731import org.opensaml.xml.parse.BasicParserPool; 
     
    5145    /** Parser manager used to parse XML. */ 
    5246    protected static BasicParserPool parser; 
    53      
     47 
    5448    /** ChainingMetadataProvider to allow 1..* types of metadata providers. */ 
    5549    protected ChainingMetadataProvider metadataProvider; 
     
    6660     */ 
    6761    public SamlMetadataNameFormatter() { 
    68          
     62 
    6963    } 
    70      
    71     public ChainingMetadataProvider getProvider(){ 
    72         return metadataProvider; 
    73     } 
    74      
    75     public SamlMetadataNameFormatter(List<MetadataProvider> providers){ 
     64 
     65    public SamlMetadataNameFormatter(List<MetadataProvider> providers) { 
    7666        metadataProvider = new ChainingMetadataProvider(); 
    7767        try { 
     
    8474    } 
    8575 
    86      
    8776    /** 
    8877     * Takes a <code>List</code> of SAML 
     
    10190        for (MetadataProvider providerGeneric : SAMLMetadataProviders) { 
    10291            FileBackedHTTPMetadataProvider provider = (FileBackedHTTPMetadataProvider) providerGeneric; 
    103 //            provider.setMinRefreshDelay(1000); 
    104 //            provider.setMaxRefreshDelay(2000);             
     92            // provider.setMinRefreshDelay(1000); 
     93            // provider.setMaxRefreshDelay(2000); 
    10594            log.info("Loading SAML metadata [{}]", provider.getMetadataURI()); 
    10695            provider.setParserPool(parser); 
     
    10998            log.debug("Loaded SAML metatada {}", provider.getMetadataURI()); 
    11099        } 
    111         List<MetadataProvider> providers = metadataProvider.getProviders(); 
    112         log.debug("This class is {}",this); 
    113         for (MetadataProvider provider : providers){ 
    114             log.debug("Provider is {}",((OrganizationDisplayName)provider.getEntityDescriptor("https://www.internurse.com/shibboleth").getOrganization().getDisplayNames().get(0)).getName().getLocalString()); 
    115         } 
     100 
    116101    } 
    117102 
    118103    public Observation[] process(Observation[] observations) throws PostprocessorException { 
    119         log.debug("This class is {}",this); 
    120104        log.debug("{} post processor called, entries into postprocessor: {}", this.getClass(), observations.length); 
    121         List<MetadataProvider> providers = metadataProvider.getProviders(); 
    122         log.debug("Providers {}", providers.size()); 
    123         for (MetadataProvider provider : providers){ 
    124             try { 
    125                 log.debug("Provider is {}",((OrganizationDisplayName)provider.getEntityDescriptor("https://www.internurse.com/shibboleth").getOrganization().getDisplayNames().get(0)).getName().getLocalString()); 
    126             } catch (MetadataProviderException e) { 
    127                log.error("{}",e); 
    128             } 
    129         } 
    130105        for (Observation obs : observations) { 
    131106            if (obs instanceof Group) { 
     
    157132     */ 
    158133    private String getOrganisationDisplayName(String entityID) throws MetadataProviderException, NullPointerException { 
    159         log.debug("EntityId {}",entityID); 
    160134        OrganizationDisplayName orgName = 
    161                 (OrganizationDisplayName) metadataProvider.getEntityDescriptor(entityID).getOrganization().getDisplayNames().get(0); 
    162         log.debug("EntityId {} has {}",entityID, orgName); 
     135                (OrganizationDisplayName) metadataProvider.getEntityDescriptor(entityID).getOrganization() 
     136                        .getDisplayNames().get(0); 
    163137        return orgName.getName().getLocalString(); 
    164138    } 
    165  
    166  
    167  
    168139 
    169140    public void registerAndSetMethodParameters(List<MethodParameter> methodParameters) { 
  • raptor-mua/trunk/src/test/java/uk/ac/cardiff/raptormua/engine/statistics/processor/SamlMetadataNameFormatterTest.java

    r1211 r1215  
    22 *  
    33 */ 
     4 
    45package uk.ac.cardiff.raptormua.engine.statistics.processor; 
    56 
     
    78import java.util.List; 
    89 
    9 import org.opensaml.saml2.metadata.OrganizationDisplayName; 
    1010import org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider; 
    1111import org.opensaml.saml2.metadata.provider.MetadataProvider; 
    12 import org.opensaml.saml2.metadata.provider.MetadataProviderException; 
    1312import org.testng.Assert; 
    1413import org.testng.annotations.Test; 
     
    1615/** 
    1716 * @author philsmart 
    18  * 
     17 *  
    1918 */ 
    2019public class SamlMetadataNameFormatterTest { 
    21      
    22      
     20 
    2321    SamlMetadataNameFormatter samlNameFormatter; 
    24      
     22 
    2523    @Test 
    26     public void instantiateSamlMetadataTest() throws Exception{ 
     24    public void instantiateSamlMetadataTest() throws Exception { 
    2725        List<MetadataProvider> providers = new ArrayList<MetadataProvider>(); 
    28         FileBackedHTTPMetadataProvider provider = new FileBackedHTTPMetadataProvider("http://metadata.ukfederation.org.uk/ukfederation-metadata.xml",50000, "/tmp/metadata.xml"); 
     26        FileBackedHTTPMetadataProvider provider = 
     27                new FileBackedHTTPMetadataProvider("http://metadata.ukfederation.org.uk/ukfederation-metadata.xml", 
     28                        50000, "/tmp/metadata.xml"); 
    2929        providers.add(provider); 
    3030        samlNameFormatter = new SamlMetadataNameFormatter(providers); 
    3131        Assert.assertNotNull(samlNameFormatter); 
    32         System.out.println(((OrganizationDisplayName)samlNameFormatter.getProvider().getEntityDescriptor("https://www.ingentaconnect.com/shibboleth").getOrganization().getDisplayNames().get(0)).getName().getLocalString()); 
    3332    } 
    3433 
Note: See TracChangeset for help on using the changeset viewer.