Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
PETALS - PETALS Services Platform. Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------- $Id$ -------------------------------------------------------------------------
 
 
 package org.ow2.petals.component.framework.su;
 
 import java.util.Map;
 
 
Handles useful information about a Service Unit like :
- the service unit description (jbi descriptor)
- links between Provides nodes and activated endpoints
- links between activated endpoints and corresponding service description
- links between Consumes nodes and corresponding addresses
- the installation root
- the service unit name - the message interceptor manager
A SUDataHandler is available for each SU.

Author(s):
ofabre - EBM WebSourcing
 
 public class ServiceUnitDataHandler {
 
     private Jbi descriptor;
 
     private Map<ServiceEndpointKeyProvidesepJBIDesc;
 
 
     private final Map<ServiceEndpointKeyServiceEndpointendpoints;

    
Map of service/MessageInterceptorManager
 
Map of service/ConfigurationExtensions
 
Map of Consumes/ExchangeProperties
 
 
     private String installRoot;
 
     private String name;

    
 
     private ServiceUnitDataHandler() {
         super();
         this. = new HashMap<ServiceEndpointKeyDocument>();
         this. = new HashMap<ServiceEndpointKeyProvides>();
         this. = new HashMap<ServiceEndpointKeyServiceEndpoint>();
         this. = new HashMap<ConsumesConfigurationExtensions>();
     }

    
    public ServiceUnitDataHandler(String suNameString installRootJbi jbiDescriptor) {
        this();
        this. = suName;
        this. = installRoot;
        this. = jbiDescriptor;
        for (Consumes consumes : this..getServices().getConsumes()) {
            this..put(consumesnew ConfigurationExtensions(consumes
                    .getAny()));
            if (consumes.getExchangeProperties() != null) {
                this..put(consumesnew ConfigurationExtensions(consumes
                        .getExchangeProperties().getExchangeProperty()));
            }
        }
        for (Provides provides : this..getServices().getProvides()) {
            this..put(providesnew ConfigurationExtensions(provides
                    .getAny()));
        }
    }

    
    public ServiceUnitDataHandler(String suNameString installRootJbi jbiDescriptor,
            String propertiesFilePaththrows PEtALSCDKException {
        this();
        this. = suName;
        this. = installRoot;
        this. = jbiDescriptor;
        for (Consumes consumes : this..getServices().getConsumes()) {
            this..put(consumesnew ConfigurationExtensions(consumes
                    .getAny(), propertiesFilePath));
            if (consumes.getExchangeProperties() != null) {
                this..put(consumesnew ConfigurationExtensions(consumes
                        .getExchangeProperties().getExchangeProperty(), propertiesFilePath));
            }
        }
        for (Provides provides : this..getServices().getProvides()) {
            this..put(providesnew ConfigurationExtensions(provides
                    .getAny(), propertiesFilePath));
        }
    }

    

Parameters:
endpoint
description
    public void addEndpointDescription(final QName serviceNamefinal String endpointName,
            final Document description) {
        this..put(new ServiceEndpointKey(serviceNameendpointName), description);
    }

    
Return wsdl description of the given endpoint

Parameters:
endpoint
    public Document getEndpointDescription(final ServiceEndpoint endpoint) {
        return this..get(new ServiceEndpointKey(endpoint.getServiceName(), endpoint
                .getEndpointName()));
    }

    

Parameters:
endpoint
provides
    public void addJBIDescription(final QName serviceNamefinal String endpointName,
            final Provides provides) {
        this..put(new ServiceEndpointKey(serviceNameendpointName), provides);
    }
    public void addServiceEndpoint(final ServiceEndpoint serviceEndpoint) {
        this..put(new ServiceEndpointKey(serviceEndpoint.getServiceName(), serviceEndpoint
                .getEndpointName()), serviceEndpoint);
    }
        return this.;
    }

    

Returns:
    public Jbi getDescriptor() {
        return this.;
    }

    

Returns:
        return this.;
    }

    

Returns:
        return this.;
    }

    

Returns:
    public String getInstallRoot() {
        return this.;
    }

    

Returns:
    public String getName() {
        return this.;
    }

    

Parameters:
endpoint
    public void removeEndpoint(final ServiceEndpoint endpoint) {
        final ServiceEndpointKey key = new ServiceEndpointKey(endpoint.getServiceName(), endpoint
                .getEndpointName());
        this..remove(key);
        this..remove(key);
        this..remove(key);
    }

    

Parameters:
epJBIDesc
    public void setEpJBIDesc(final Map<ServiceEndpointKeyProvidesepJBIDesc) {
        this. = epJBIDesc;
    }

    

Parameters:
epServiceDesc
    public void setEpServiceDesc(final Map<ServiceEndpointKeyDocumentepServiceDesc) {
        this. = epServiceDesc;
    }

    
Add an interceptor manager.

Parameters:
service A Consumes or Provides instance
manager
    public void addMessageInterceptorManager(Object serviceMessageInterceptorManager manager) {
        if (service instanceof Consumes || service instanceof Provides) {
            this..put(servicemanager);
        } else {
            throw new IllegalArgumentException(
                    "The parameter service  is not an instance of Provides or Consumes Classes");
        }
    }

    
Get the manager for the given provide/consume element.

Parameters:
extensible
Returns:
        return this..get(service);
    }

    
Return the map of Interceptor managers.

Returns:
the messageInterceptorManager map
        return this.;
    }

    
Return the extensions for the given Consumes/Provides service.

Parameters:
service
Returns:
        return this..get(service);
    }
New to GrepCode? Check out our FAQ X