cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Mao <james....@iona.com>
Subject Re: svn commit: r573429 [1/2] - in /incubator/cxf/branches/jliu: ./ maven_repo/ maven_repo/javax/ maven_repo/javax/rs/ maven_repo/javax/rs/jsr311-api/ maven_repo/javax/rs/jsr311-api/0.9/ rt/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/
Date Fri, 07 Sep 2007 03:42:56 GMT
But from http://people.apache.org/~cliffs/3party.html, looks like the 
binary form is OK?



> Looks like it's in CDDL  https://jsr311.dev.java.net/
>
>
>
>> To be honest, I am really not sure about this. The Jersey is CDDL, 
>> but the jsr311 spec's API jar should not be CDDL, should it? I didn't 
>> find any license declarations inside the jar file.
>>
>>  
>>> -----Original Message-----
>>> From: Daniel Kulp [mailto:dkulp@apache.org]
>>> Sent: 2007年9月7日 11:00
>>> To: cxf-dev@incubator.apache.org
>>> Subject: Re: svn commit: r573429 [1/2] - in
>>> /incubator/cxf/branches/jliu: ./ maven_repo/ maven_repo/javax/
>>> maven_repo/javax/rs/ maven_repo/javax/rs/jsr311-api/
>>> maven_repo/javax/rs/jsr311-api/0.9/ rt/
>>> rt/core/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/
>>>
>>>
>>>
>>> Jervis,
>>>
>>> Is the jsr311-api jar CDDL?    If so, I don't believe it can be 
>>> checked into Apache's svn.
>>>
>>> Dan
>>>
>>>
>>>
>>> On Thursday 06 September 2007, jliu@apache.org wrote:
>>>    
>>>> Author: jliu
>>>> Date: Thu Sep  6 19:44:44 2007
>>>> New Revision: 573429
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=573429&view=rev
>>>> Log: (empty)
>>>>
>>>> Added:
>>>>     incubator/cxf/branches/jliu/maven_repo/
>>>>     incubator/cxf/branches/jliu/maven_repo/javax/
>>>>     incubator/cxf/branches/jliu/maven_repo/javax/rs/
>>>>     incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/
>>>>     incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/
>>>>   
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar.sha1
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom.sha1
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java   (with props)
>>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml   (with
>>>> props) incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/
>>>>   
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/JAXBElementProvider.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/ProviderFactoryImpl.java   (with props)
>>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/bus-extensions.xml   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/cxf/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/cxf/cxf-extension-jaxrs-binding.xml   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/cxf/cxf.extension
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/services/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-
>>>    
>>>> INF/services/javax.ws.rs.ext.ProviderFactory
>>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/java/
>>>>     incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/java/org/
>>>>   
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/java/org/apache
>>>    
>>>> /
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/java/org/apache
>>>    
>>>> /cxf/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/test/java/org/apache
>>>    
>>>> /cxf/rs/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/Book.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/BookServer.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/BookStore.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/CD.java   (with props)
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/syst
>>>    
>>>> est/jaxrs/JAXRSClientServerBookTest.java   (with props) Modified:
>>>>     incubator/cxf/branches/jliu/pom.xml
>>>>   
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/ManagedEndpoint.java
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/trans
>>>    
>>>> port/ChainInitiationObserver.java
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/databinding/aegis/src/test/java/org/apa
>>>    
>>>> che/cxf/aegis/AbstractAegisTest.java
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apach
>>>    
>>>> e/cxf/frontend/AbstractServiceFactory.java
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apach
>>>    
>>>> e/cxf/frontend/ClientFactoryBean.java
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apach
>>>    
>>>> e/cxf/frontend/ServerFactoryBean.java
>>>> incubator/cxf/branches/jliu/rt/pom.xml
>>>>     incubator/cxf/branches/jliu/systests/pom.xml
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven_repo/ja
>>>    
>>>> vax/rs/jsr311-api/0.9/jsr311-api-0.9.jar?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== Binary file - no diff available.
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:mime-type = application/octet-stream
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar.sha1 URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven_repo/ja
>>>    
>>>> vax/rs/jsr311-api/0.9/jsr311-api-0.9.jar.sha1?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar.sha1 (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.jar.sha1 Thu Sep  6 19:44:44 2007 @@ -0,0 +1 @@
>>>> +efb2ae8fdef14a34ae4161bcdac1a145e335745f  jsr311-api-0.9.jar
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven_repo/ja
>>>    
>>>> vax/rs/jsr311-api/0.9/jsr311-api-0.9.pom?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom Thu Sep  6 19:44:44 2007 @@ -0,0 +1,11 @@
>>>> +<?xml version="1.0" encoding="UTF-8"?><project>
>>>> +  <modelVersion>4.0.0</modelVersion>
>>>> +  <groupId>javax.rs</groupId>
>>>> +  <artifactId>jsr311-api</artifactId>
>>>> +  <version>0.9</version>
>>>> +  <description>Web Service Annotations</description>
>>>> +  <url>https://jax-ws.dev.java.net/</url>
>>>> +  <distributionManagement>
>>>> +  
>>>>       
>>> <downloadUrl>https://jax-ws.dev.java.net/jax-ws-ea3/</downloadUrl> + 
>>>    
>>>> </distributionManagement>
>>>> +</project>
>>>> \ No newline at end of file
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom.sha1 URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven_repo/ja
>>>    
>>>> vax/rs/jsr311-api/0.9/jsr311-api-0.9.pom.sha1?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom.sha1 (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/maven_repo/javax/rs/jsr311-api/0.9/jsr311-
>>>    
>>>> api-0.9.pom.sha1 Thu Sep  6 19:44:44 2007 @@ -0,0 +1 @@
>>>> +04be00a0d964c572f4b6471263ba166db9b5496c jsr311-api-0.9.pom
>>>>
>>>> Modified: incubator/cxf/branches/jliu/pom.xml
>>>> URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/pom.xml?rev=5
>>>    
>>>> 73429&r1=573428&r2=573429&view=diff
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== --- incubator/cxf/branches/jliu/pom.xml (original)
>>>> +++ incubator/cxf/branches/jliu/pom.xml Thu Sep  6 19:44:44 2007
>>>> @@ -42,6 +42,7 @@
>>>>      </prerequisites>
>>>>
>>>>      <properties>
>>>> +            <topDirectoryLocation>.</topDirectoryLocation>
>>>>           <compiler.fork>false</compiler.fork>
>>>>       </properties>
>>>>
>>>> @@ -139,7 +140,29 @@
>>>>          <module>maven-plugins/archetypes</module>
>>>>          <module>maven-plugins/eclipse-plugin-generator</module>
>>>>      </modules>
>>>> +
>>>>
>>>> +    <repositories>
>>>> +        <repository>
>>>> +            <id>private-repo</id>
>>>> +            <name>private repo</name>
>>>> +          
>>>>       
>>> <url>file:${basedir}/${topDirectoryLocation}/maven_repo</url> 
>>> +          
>>>>     <releases>
>>>> +                <enabled>true</enabled>
>>>> +            </releases>
>>>> +            <snapshots>
>>>> +                <enabled>true</enabled>
>>>> +            </snapshots>
>>>> +        </repository>
>>>> +        <repository>
>>>> +            <id>java.net</id>
>>>> +            <name>java.net Maven Repository</name>
>>>> +          
>>>>       
>>> <url>https://maven-repository.dev.java.net/nonav/repository/</url> 
>>> +     
>>>>          <layout>legacy</layout>
>>>> +        </repository>
>>>> +    </repositories>
>>>> +
>>>> +
>>>>      <profiles>
>>>>          <profile>
>>>>              <!-- default profile enables checkstyle and Xlint stuff
>>>> -->
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/m
>>>    
>>>> ain/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java
>>>>       
>>> ?rev=57342
>>>    
>>>> 9&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java Thu Sep  6 19:44:44 2007 @@ -0,0
>>>> +1,167 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.apache.cxf.endpoint;
>>>> +
>>>> +import java.util.ArrayList;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +
>>>> +import javax.xml.namespace.QName;
>>>> +
>>>> +import org.apache.cxf.Bus;
>>>> +import org.apache.cxf.BusException;
>>>> +import org.apache.cxf.BusFactory;
>>>> +import org.apache.cxf.binding.BindingConfiguration;
>>>> +import org.apache.cxf.binding.BindingFactory;
>>>> +import org.apache.cxf.databinding.DataBinding;
>>>> +import org.apache.cxf.feature.AbstractFeature;
>>>> +import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
>>>> +import org.apache.cxf.service.model.BindingInfo;
>>>> +import org.apache.cxf.service.model.EndpointInfo;
>>>> +import org.apache.cxf.transport.DestinationFactory;
>>>> +import org.apache.cxf.ws.addressing.EndpointReferenceType;
>>>> +
>>>> +public abstract class AbstractEndpointFactory extends
>>>> AbstractBasicInterceptorProvider { +    protected Bus bus;
>>>> +    protected String address;
>>>> +    protected String transportId;
>>>> +    protected String bindingId;
>>>> +    protected DataBinding dataBinding;
>>>> +    protected BindingFactory bindingFactory;
>>>> +    protected DestinationFactory destinationFactory;
>>>> +    protected QName endpointName;
>>>> +    protected Map<String, Object> properties;
>>>> +    protected List<AbstractFeature> features;
>>>> +    protected BindingConfiguration bindingConfig;
>>>> +    protected EndpointReferenceType endpointReference;
>>>> +    protected ConduitSelector conduitSelector;
>>>> +
>>>> +    protected abstract Endpoint createEndpoint() throws       
>>> BusException,
>>>    
>>>> EndpointException; +
>>>> +    protected abstract EndpointInfo createEndpointInfo() throws
>>>> BusException; +
>>>> +    protected abstract BindingInfo createBindingInfo();
>>>> +
>>>> +    public String getAddress() {
>>>> +        return address;
>>>> +    }
>>>> +
>>>> +    public void setAddress(String address) {
>>>> +        this.address = address;
>>>> +    }
>>>> +
>>>> +    public Bus getBus() {
>>>> +        if (bus == null) {
>>>> +            bus = BusFactory.getThreadDefaultBus();
>>>> +        }
>>>> +        return bus;
>>>> +    }
>>>> +
>>>> +    public void setBus(Bus bus) {
>>>> +        this.bus = bus;
>>>> +    }
>>>> +
>>>> +    public String getTransportId() {
>>>> +        return transportId;
>>>> +    }
>>>> +
>>>> +    public void setTransportId(String transportId) {
>>>> +        this.transportId = transportId;
>>>> +    }
>>>> +
>>>> +    public void setBindingId(String bind) {
>>>> +        bindingId = bind;
>>>> +    }
>>>> +
>>>> +    public String getBindingId() {
>>>> +        return bindingId;
>>>> +    }
>>>> +
>>>> +    public void setBindingConfig(BindingConfiguration obj) {
>>>> +        bindingConfig = obj;
>>>> +    }
>>>> +
>>>> +    public BindingConfiguration getBindingConfig() {
>>>> +        return bindingConfig;
>>>> +    }
>>>> +
>>>> +    public DestinationFactory getDestinationFactory() {
>>>> +        return destinationFactory;
>>>> +    }
>>>> +
>>>> +    public void setDestinationFactory(DestinationFactory
>>>> destinationFactory) { +        this.destinationFactory =
>>>> destinationFactory;
>>>> +    }
>>>> +
>>>> +    public QName getEndpointName() {
>>>> +        return endpointName;
>>>> +    }
>>>> +
>>>> +    public void setEndpointName(QName endpointName) {
>>>> +        this.endpointName = endpointName;
>>>> +    }
>>>> +
>>>> +    public void setEndpointReference(EndpointReferenceType epr) {
>>>> +        endpointReference = epr;
>>>> +    }
>>>> +
>>>> +    public Map<String, Object> getProperties() {
>>>> +        return properties;
>>>> +    }
>>>> +
>>>> +    public void setProperties(Map<String, Object> properties) {
>>>> +        this.properties = properties;
>>>> +    }
>>>> +
>>>> +    public List<AbstractFeature> getFeatures() {
>>>> +        if (features == null) {
>>>> +            features = new ArrayList<AbstractFeature>();
>>>> +        }
>>>> +        return features;
>>>> +    }
>>>> +
>>>> +    public void setFeatures(List<AbstractFeature> features) {
>>>> +        this.features = features;
>>>> +    }
>>>> +
>>>> +    public BindingFactory getBindingFactory() {
>>>> +        return bindingFactory;
>>>> +    }
>>>> +
>>>> +    public void setBindingFactory(BindingFactory bf) {
>>>> +        this.bindingFactory  = bf;
>>>> +    }
>>>> +
>>>> +    public ConduitSelector getConduitSelector() {
>>>> +        return conduitSelector;
>>>> +    }
>>>> +
>>>> +    public void setConduitSelector(ConduitSelector selector) {
>>>> +        conduitSelector = selector;
>>>> +    }
>>>> +
>>>> +    public DataBinding getDataBinding() {
>>>> +        return dataBinding;
>>>> +    }
>>>> +
>>>> +    public void setDataBinding(DataBinding dataBinding) {
>>>> +        this.dataBinding = dataBinding;
>>>> +    }
>>>> +
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/AbstractEndpointFactory.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Modified:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/ManagedEndpoint.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/m
>>>    
>>>> ain/java/org/apache/cxf/endpoint/ManagedEndpoint.java?rev=573
>>>>       
>>> 429&r1=573
>>>    
>>>> 428&r2=573429&view=diff
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/ManagedEndpoint.java (original) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpo
>>>    
>>>> int/ManagedEndpoint.java Thu Sep  6 19:44:44 2007 @@ -86,7 +86,7 @@
>>>>          buffer.append(ManagementConstants.TYPE_PROP + "=" +
>>>> "Bus.Service.Endpoint,");
>>>>
>>>>
>>>> -        String serviceName =
>>>>
>>>>       
>>> ObjectName.quote(endpoint.getEndpointInfo().getService().getName().toS
>>>    
>>>> tring()); +        String serviceName =
>>>> ObjectName.quote(endpoint.getService().getName().toString());
>>>> buffer.append(ManagementConstants.SERVICE_NAME_PROP + "=" +
>>>> serviceName + ","); String endpointName =
>>>> ObjectName.quote(endpoint.getEndpointInfo().getName().toString());
>>>> buffer.append(ManagementConstants.PORT_NAME_PROP + "=" +
>>>> endpointName);
>>>>
>>>> Modified:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/trans
>>>    
>>>> port/ChainInitiationObserver.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/m
>>>    
>>>> ain/java/org/apache/cxf/transport/ChainInitiationObserver.jav
>>>>       
>>> a?rev=5734
>>>    
>>>> 29&r1=573428&r2=573429&view=diff
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/trans
>>>    
>>>> port/ChainInitiationObserver.java (original) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/trans
>>>    
>>>> port/ChainInitiationObserver.java Thu Sep  6 19:44:44 2007 @@ -35,6
>>>> +35,7 @@
>>>>  import org.apache.cxf.phase.PhaseInterceptorChain;
>>>>  import org.apache.cxf.phase.PhaseManager;
>>>>  import org.apache.cxf.service.Service;
>>>> +import org.apache.cxf.service.ServiceImpl;
>>>>  import org.apache.cxf.service.model.EndpointInfo;
>>>>
>>>>  public class ChainInitiationObserver implements MessageObserver {
>>>> @@ -86,7 +87,7 @@
>>>>          if (exchange.getDestination() == null) {
>>>>              exchange.setDestination(m.getDestination());
>>>>          }
>>>> -        if (endpoint != null) {
>>>> +        if (endpoint != null && (endpoint.getService() instanceof
>>>> ServiceImpl)) {
>>>>
>>>>              EndpointInfo endpointInfo = endpoint.getEndpointInfo();
>>>>
>>>>
>>>> Modified:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/databinding/aegis/src/test/java/org/apa
>>>    
>>>> che/cxf/aegis/AbstractAegisTest.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/databindin
>>>    
>>>> g/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.
>>>>       
>>> java?rev=5
>>>    
>>>> 73429&r1=573428&r2=573429&view=diff
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/databinding/aegis/src/test/java/org/apa
>>>    
>>>> che/cxf/aegis/AbstractAegisTest.java (original) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/databinding/aegis/src/test/java/org/apa
>>>    
>>>> che/cxf/aegis/AbstractAegisTest.java Thu Sep  6 19:44:44       
>>> 2007 @@ -42,7
>>>    
>>>> +42,7 @@
>>>>  import org.apache.cxf.bus.extension.ExtensionManagerBus;
>>>>  import org.apache.cxf.endpoint.Server;
>>>>  import org.apache.cxf.endpoint.ServerRegistry;
>>>> -import org.apache.cxf.frontend.AbstractEndpointFactory;
>>>> +import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
>>>>  import org.apache.cxf.frontend.ServerFactoryBean;
>>>>  import org.apache.cxf.service.Service;
>>>>  import org.apache.cxf.test.AbstractCXFTest;
>>>> @@ -128,7 +128,7 @@
>>>>          return sf;
>>>>      }
>>>>
>>>> -    protected void setupAegis(AbstractEndpointFactory sf) {
>>>> +    protected void       
>>> setupAegis(AbstractWSDLBasedEndpointFactory sf) {
>>>    
>>>>                
>>> sf.getServiceFactory().getServiceConfigurations().add(0, new
>>>    
>>>> AegisServiceConfiguration());
>>>> sf.getServiceFactory().setDataBinding(new AegisDatabinding()); }
>>>>
>>>> Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml
>>>> URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/pom.xml?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml
>>>> (added) +++       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml Thu
>>>    
>>>> Sep  6 19:44:44 2007 @@ -0,0 +1,94 @@
>>>> +<!--
>>>> +  Licensed to the Apache Software Foundation (ASF) under one
>>>> +  or more contributor license agreements. See the NOTICE file
>>>> +  distributed with this work for additional information
>>>> +  regarding copyright ownership. The ASF licenses this file
>>>> +  to you under the Apache License, Version 2.0 (the
>>>> +  "License"); you may not use this file except in compliance
>>>> +  with the License. You may obtain a copy of the License at
>>>> +
>>>> +  http://www.apache.org/licenses/LICENSE-2.0
>>>> +
>>>> +  Unless required by applicable law or agreed to in writing,
>>>> +  software distributed under the License is distributed on an
>>>> +  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> +  KIND, either express or implied. See the License for the
>>>> +  specific language governing permissions and limitations
>>>> +  under the License.
>>>> +-->
>>>> +<project xmlns="http://maven.apache.org/POM/4.0.0"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>> http://maven.apache.org/maven-v4_0_0.xsd"> +   
>>>> <modelVersion>4.0.0</modelVersion>
>>>> +    <groupId>org.apache.cxf</groupId>
>>>> +    <artifactId>cxf-rt-frontend-jaxrs</artifactId>
>>>> +    <packaging>jar</packaging>
>>>> +    <version>2.1-incubator-SNAPSHOT</version>
>>>> +    <name>Apache CXF Runtime JAX-RS Frontend</name>
>>>> +    <url>http://cwiki.apache.org/CXF</url>
>>>> +
>>>> +    <parent>
>>>> +        <groupId>org.apache.cxf</groupId>
>>>> +        <artifactId>cxf-parent</artifactId>
>>>> +        <version>2.1-incubator-SNAPSHOT</version>
>>>> +        <relativePath>../../../parent/pom.xml</relativePath>
>>>> +    </parent>
>>>> +
>>>> +    <dependencies>
>>>> +        <dependency>
>>>> +            <groupId>junit</groupId>
>>>> +            <artifactId>junit</artifactId>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.cxf</groupId>
>>>> +            <artifactId>cxf-common-utilities</artifactId>
>>>> +            <version>${project.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.cxf</groupId>
>>>> +            <artifactId>cxf-api</artifactId>
>>>> +            <version>${project.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.cxf</groupId>
>>>> +            <artifactId>cxf-rt-core</artifactId>
>>>> +            <version>${project.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.springframework</groupId>
>>>> +            <artifactId>spring-core</artifactId>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>javax.rs</groupId>
>>>> +            <artifactId>jsr311-api</artifactId>
>>>> +            <version>0.9</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +                <groupId>org.apache.cxf</groupId>
>>>> +                <artifactId>cxf-rt-frontend-jaxws</artifactId>
>>>> +                <version>${project.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>javax.rs</groupId>
>>>> +            <artifactId>jsr311-api</artifactId>
>>>> +            <version>0.9</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.cxf</groupId>
>>>> +            <artifactId>cxf-testutils</artifactId>
>>>> +            <version>${project.version}</version>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.easymock</groupId>
>>>> +            <artifactId>easymockclassextension</artifactId>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>> +    </dependencies>
>>>> +
>>>> +    <scm>
>>>> +      
>>>>       
>>> <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trun
>>>    
>>>> k/rt/rs</connection> +      
>>>>       
>>> <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubato
>>>    
>>>> r/cxf/trunk/rt/rs</developerConnection> +    
>>>>       
>>> <url>http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-r
>>>    
>>>> t-rs</url> +  </scm>
>>>> +
>>>> +</project>
>>>>
>>>> Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/pom.xml
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:mime-type = text/xml
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.j
>>>>       
>>> ava?rev=57
>>>    
>>>> 3429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java Thu Sep  6 19:44:44 2007 @@ -0,0
>>>> +1,96 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.apache.cxf.jaxrs;
>>>> +
>>>> +
>>>> +import org.apache.cxf.binding.AbstractBindingFactory;
>>>> +import org.apache.cxf.binding.Binding;
>>>> +
>>>> +import org.apache.cxf.binding.xml.XMLBinding;
>>>> +import org.apache.cxf.jaxrs.interceptor.JAXRSDispatchInterceptor;
>>>> +import org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor;
>>>> +import org.apache.cxf.service.Service;
>>>> +import org.apache.cxf.service.model.BindingInfo;
>>>> +
>>>> +public class JAXRSBindingFactory extends AbstractBindingFactory {
>>>> +
>>>> +    public static final String JAXRS_BINDING_ID =
>>>> "http://apache.org/cxf/binding/jaxrs"; +
>>>> +    public JAXRSBindingFactory() {
>>>> +    }
>>>> +
>>>> +    public Binding createBinding(BindingInfo bi) {
>>>> +        XMLBinding binding = new XMLBinding(bi);
>>>> +
>>>> +        binding.getInInterceptors().add(new
>>>> JAXRSDispatchInterceptor()); +       
>>>> binding.getOutInterceptors().add(new JAXRSOutInterceptor()); +
>>>> +/*
>>>> +        binding.getInFaultInterceptors().add(new
>>>> XMLFaultInInterceptor()); +
>>>> +        binding.getOutFaultInterceptors().add(new
>>>> ContentTypeOutInterceptor()); +       
>>>> binding.getOutFaultInterceptors().add(new       
>>> StaxOutInterceptor()); +       
>>>>    binding.getOutFaultInterceptors().add(new
>>>> XMLFaultOutInterceptor());*/ +
>>>> +        return binding;
>>>> +    }
>>>> +
>>>> +
>>>> +    public BindingInfo createBindingInfo(Service service, String
>>>> namespace, Object obj) { +        BindingInfo info = new
>>>> BindingInfo(null,
>>>> +                                          
>>>> JAXRSBindingFactory.JAXRS_BINDING_ID); +
>>>> +        return info;
>>>> +
>>>> +/*        ServiceInfo si = service.getServiceInfos().get(0);
>>>> +        BindingInfo info = new BindingInfo(si,
>>>> +                                          
>>>> RESTBindingFactory.REST_BINDING_ID); +        info.setName(new
>>>> QName(si.getName().getNamespaceURI(), +                           
>>>             
>>>> si.getName().getLocalPart() + "HttpBinding")); +
>>>> +        //service.put(URIMapper.class.getName(), mapper);
>>>> +        MethodDispatcher md = (MethodDispatcher)
>>>> service.get(MethodDispatcher.class.getName()); +
>>>> +        for (OperationInfo o : si.getInterface().getOperations()) {
>>>> +            BindingOperationInfo bop =
>>>> info.buildOperation(o.getName(), o.getInputName(),       
>>> o.getOutputName());
>>>    
>>>> +
>>>> +            info.addOperation(bop);
>>>> +
>>>> +            Method m = md.getMethod(bop);
>>>> +
>>>> +            try {
>>>> +                Class c = (Class)
>>>> service.get(ReflectionServiceFactoryBean.ENDPOINT_CLASS); +       
>>>              
>>>>     if (c != null) {
>>>> +                    m = c.getMethod(m.getName(),
>>>> m.getParameterTypes()); +                }
>>>> +            } catch (SecurityException e) {
>>>> +                throw new ServiceConstructionException(e);
>>>> +            } catch (NoSuchMethodException e) {
>>>> +                throw new ServiceConstructionException(e);
>>>> +            }
>>>> +
>>>> +        }
>>>> +
>>>> +        return info;*/
>>>> +
>>>> +        //return null;
>>>> +    }
>>>> +
>>>> +
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSBindingFactory.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev
>>>>       
>>> =573429&vi
>>>    
>>>> ew=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java Thu Sep  6 19:44:44 2007 @@       
>>> -0,0 +1,70 @@
>>>    
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs;
>>>> +
>>>> +
>>>> +import java.lang.reflect.Method;
>>>> +import java.util.List;
>>>> +
>>>> +import org.apache.cxf.helpers.CastUtils;
>>>> +import org.apache.cxf.jaxrs.model.ClassResourceInfo;
>>>> +import org.apache.cxf.jaxrs.model.OperationResourceInfo;
>>>> +import org.apache.cxf.message.Exchange;
>>>> +import org.apache.cxf.message.MessageContentsList;
>>>> +import org.apache.cxf.service.invoker.AbstractInvoker;
>>>> +
>>>> +public class JAXRSInvoker extends AbstractInvoker {
>>>> +    public JAXRSInvoker() {
>>>> +    }
>>>> +
>>>> +    public Object invoke(Exchange exchange, Object o) {
>>>> +        OperationResourceInfo ori =
>>>> exchange.get(OperationResourceInfo.class); +
>>>> +        ClassResourceInfo classResourceInfo =
>>>> ori.getClassResourceInfo(); +        Method m =
>>>> classResourceInfo.getMethodDispatcher().getMethod(ori); +       
>>>> Object serviceObject = null;
>>>> +        try {
>>>> +            serviceObject =
>>>> classResourceInfo.getResourceClass().newInstance(); +        } catch
>>>> (Exception e) {
>>>> +            e.printStackTrace();
>>>> +        }
>>>> +
>>>> +
>>>> +/*        MethodDispatcher md = (MethodDispatcher)
>>>> +          
>>>>       
>>> exchange.get(Service.class).get(MethodDispatcher.class.getName()); 
>>> +     
>>>>      Method m = md.getMethod(bop);*/
>>>> +        //Method m =
>>>>
>>>>       
>>> (Method)bop.getOperationInfo().getProperty(Method.class.getName()); 
>>> +    
>>>>       //m = matchMethod(m, serviceObject);
>>>> +
>>>> +        List<Object> params = null;
>>>> +        if (o instanceof List) {
>>>> +            params = CastUtils.cast((List<?>)o);
>>>> +        } else if (o != null) {
>>>> +            params = new MessageContentsList(o);
>>>> +        }
>>>> +
>>>> +        return invoke(exchange, serviceObject, m, params);
>>>> +    }
>>>> +
>>>> +    public Object getServiceObject(Exchange ex) {
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSInvoker.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBea
>>>>       
>>> n.java?rev
>>>    
>>>> =573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java Thu Sep  6 19:44:44       
>>> 2007 @@ -0,0
>>>    
>>>> +1,220 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.apache.cxf.jaxrs;
>>>> +
>>>> +import java.io.IOException;
>>>> +import java.util.List;
>>>> +
>>>> +import org.apache.cxf.BusException;
>>>> +import org.apache.cxf.binding.BindingConfiguration;
>>>> +import org.apache.cxf.binding.BindingFactory;
>>>> +import org.apache.cxf.binding.BindingFactoryManager;
>>>> +import org.apache.cxf.endpoint.AbstractEndpointFactory;
>>>> +import org.apache.cxf.endpoint.Endpoint;
>>>> +import org.apache.cxf.endpoint.EndpointException;
>>>> +import org.apache.cxf.endpoint.EndpointImpl;
>>>> +import org.apache.cxf.endpoint.Server;
>>>> +import org.apache.cxf.endpoint.ServerImpl;
>>>> +import org.apache.cxf.feature.AbstractFeature;
>>>> +import org.apache.cxf.service.Service;
>>>> +import org.apache.cxf.service.factory.ServiceConstructionException;
>>>> +import org.apache.cxf.service.invoker.Invoker;
>>>> +import org.apache.cxf.service.model.BindingInfo;
>>>> +import org.apache.cxf.service.model.EndpointInfo;
>>>> +import org.apache.cxf.transport.DestinationFactory;
>>>> +import org.apache.cxf.transport.DestinationFactoryManager;
>>>> +
>>>> +
>>>> +/**
>>>> + * Bean to help easily create Server endpoints for JAX-RS. Example:
>>>> + * <pre>
>>>> + * JAXRSServerFactoryBean sf = JAXRSServerFactoryBean();
>>>> + * sf.setServiceClass(Book.class);
>>>> + * sf.setAddress("http://acme.com/myService");
>>>> + * sf.create();
>>>> + * </pre>
>>>> + * This will start a server for you and register it with the
>>>> ServerManager. + */
>>>> +public class JAXRSServerFactoryBean extends       
>>> AbstractEndpointFactory {
>>>    
>>>> +    protected boolean doInit;
>>>> +    private Server server;
>>>> +    private Invoker invoker;
>>>> +    private boolean start = true;
>>>> +    private JAXRSServiceFactoryBean serviceFactory;
>>>> +
>>>> +    public JAXRSServerFactoryBean() {
>>>> +        this(new JAXRSServiceFactoryBean());
>>>> +        doInit = true;
>>>> +    }
>>>> +    public JAXRSServerFactoryBean(JAXRSServiceFactoryBean sf) {
>>>> +        this.serviceFactory = sf;
>>>> +        doInit = true;
>>>> +    }
>>>> +
>>>> +    public Server create() {
>>>> +        try {
>>>> +            Endpoint ep = createEndpoint();
>>>> +            server = new ServerImpl(getBus(),
>>>> +                                    ep,
>>>> +                                    getDestinationFactory(),
>>>> +                                    getBindingFactory());
>>>> +
>>>> +            if (invoker == null) {
>>>> +                ep.getService().setInvoker(createInvoker());
>>>> +            } else {
>>>> +                ep.getService().setInvoker(invoker);
>>>> +            }
>>>> +
>>>> +            if (start) {
>>>> +                server.start();
>>>> +            }
>>>> +        } catch (EndpointException e) {
>>>> +            throw new ServiceConstructionException(e);
>>>> +        } catch (BusException e) {
>>>> +            throw new ServiceConstructionException(e);
>>>> +        } catch (IOException e) {
>>>> +            throw new ServiceConstructionException(e);
>>>> +        }
>>>> +
>>>> +        applyFeatures();
>>>> +        return server;
>>>> +    }
>>>> +
>>>> +    protected void applyFeatures() {
>>>> +        if (getFeatures() != null) {
>>>> +            for (AbstractFeature feature : getFeatures()) {
>>>> +                feature.initialize(server, getBus());
>>>> +            }
>>>> +        }
>>>> +    }
>>>> +
>>>> +    protected Invoker createInvoker() {
>>>> +        return new JAXRSInvoker();
>>>> +    }
>>>> +
>>>> +    protected Endpoint createEndpoint() throws BusException,
>>>> EndpointException { +        Service service =
>>>> serviceFactory.getService();
>>>> +
>>>> +        if (service == null) {
>>>> +            service = serviceFactory.create();
>>>> +        }
>>>> +
>>>> +        EndpointInfo ei = createEndpointInfo();
>>>> +        Endpoint ep = new EndpointImpl(getBus(),
>>>> getServiceFactory().getService(), ei); +
>>>> +        if (properties != null) {
>>>> +            ep.putAll(properties);
>>>> +        }
>>>> +
>>>> +        if (getInInterceptors() != null) {
>>>> +            ep.getInInterceptors().addAll(getInInterceptors());
>>>> +        }
>>>> +        if (getOutInterceptors() != null) {
>>>> +            ep.getOutInterceptors().addAll(getOutInterceptors());
>>>> +        }
>>>> +        if (getInFaultInterceptors() != null) {
>>>> +          
>>>>       
>>> ep.getInFaultInterceptors().addAll(getInFaultInterceptors()); 
>>> +          
>>>> }
>>>> +        if (getOutFaultInterceptors() != null) {
>>>> +          
>>>>       
>>> ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors()); 
>>> +        
>>>>   }
>>>> +        return ep;
>>>> +    }
>>>> +
>>>> +    /*
>>>> +     * WSDL based EndpointInfo contains WSDL's physical part info,
>>>> for JAX-RS +     * based EndpointInfo, we set everything manually.
>>>> +     */
>>>> +    protected EndpointInfo createEndpointInfo() throws       
>>> BusException {
>>>    
>>>> +        String transportId = getTransportId();
>>>> +        if (transportId == null && getAddress() != null) {
>>>> +            DestinationFactory df = getDestinationFactory();
>>>> +            if (df == null) {
>>>> +                DestinationFactoryManager dfm =
>>>> getBus().getExtension(DestinationFactoryManager.class); +         
>>>              
>>>>   df = dfm.getDestinationFactoryForUri(getAddress()); +            }
>>>> +
>>>> +            if (df != null) {
>>>> +                transportId = df.getTransportIds().get(0);
>>>> +            }
>>>> +        }
>>>> +
>>>> +        BindingInfo bindingInfo = createBindingInfo();
>>>> +
>>>> +        //default to http transport
>>>> +        if (transportId == null) {
>>>> +            transportId =
>>>> "http://schemas.xmlsoap.org/wsdl/soap/http"; +        }
>>>> +
>>>> +        setTransportId(transportId);
>>>> +
>>>> +        EndpointInfo ei = new EndpointInfo();
>>>> +        ei.setTransportId(transportId);
>>>> +        ei.setName(serviceFactory.getService().getName());
>>>> +        ei.setAddress(getAddress());
>>>> +        ei.setBinding(bindingInfo);
>>>> +
>>>> +        return ei;
>>>> +    }
>>>> +
>>>> +    protected BindingInfo createBindingInfo() {
>>>> +        BindingFactoryManager mgr =
>>>> getBus().getExtension(BindingFactoryManager.class); +        String
>>>> binding = getBindingId();
>>>> +        BindingConfiguration bindingConfig = getBindingConfig();
>>>> +
>>>> +        if (binding == null && bindingConfig != null) {
>>>> +            binding = bindingConfig.getBindingId();
>>>> +        }
>>>> +
>>>> +        if (binding == null) {
>>>> +            binding = JAXRSBindingFactory.JAXRS_BINDING_ID;
>>>> +        }
>>>> +
>>>> +        try {
>>>> +            BindingFactory bindingFactory =
>>>> mgr.getBindingFactory(binding); +           
>>>> setBindingFactory(bindingFactory);
>>>> +            return
>>>>
>>>>       
>>> bindingFactory.createBindingInfo(serviceFactory.getService(), 
>>> +          
>>>>                                             binding,       
>>> bindingConfig); +
>>>    
>>>>        } catch (BusException ex) {
>>>> +            ex.printStackTrace();
>>>> +            //do nothing
>>>> +        }
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    public JAXRSServiceFactoryBean getServiceFactory() {
>>>> +        return serviceFactory;
>>>> +    }
>>>> +
>>>> +    public void setServiceFactory(JAXRSServiceFactoryBean
>>>> serviceFactory) { +        this.serviceFactory = serviceFactory;
>>>> +    }
>>>> +
>>>> +    public List<Class> getResourceClasses() {
>>>> +        return serviceFactory.getResourceClasses();
>>>> +    }
>>>> +
>>>> +    public void setResourceClasses(List<Class> classes) {
>>>> +        serviceFactory.setResourceClasses(classes);
>>>> +    }
>>>> +
>>>> +    public void setResourceClasses(Class... classes) {
>>>> +        serviceFactory.setResourceClasses(classes);
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServerFactoryBean.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBe
>>>>       
>>> an.java?re
>>>    
>>>> v=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java Thu Sep  6 19:44:44 2007 @@
>>>> -0,0 +1,199 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs;
>>>> +
>>>> +import java.lang.reflect.Method;
>>>> +import java.util.ArrayList;
>>>> +import java.util.Arrays;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +import java.util.concurrent.Executor;
>>>> +
>>>> +import javax.ws.rs.HttpMethod;
>>>> +import javax.ws.rs.UriTemplate;
>>>> +
>>>> +import org.apache.cxf.jaxrs.model.ClassResourceInfo;
>>>> +import org.apache.cxf.jaxrs.model.MethodDispatcher;
>>>> +import org.apache.cxf.jaxrs.model.OperationResourceInfo;
>>>> +import org.apache.cxf.jaxrs.model.URITemplate;
>>>> +import org.apache.cxf.service.Service;
>>>> +import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
>>>> +import org.apache.cxf.service.invoker.Invoker;
>>>> +
>>>> +
>>>> +/**
>>>> + * Build a JAX-RS service model from resource classes.
>>>> + */
>>>> +public class JAXRSServiceFactoryBean extends
>>>> AbstractServiceFactoryBean { +
>>>> +    //private static final Logger LOG =
>>>> Logger.getLogger(JAXRSServiceFactoryBean.class.getName()); +   
>>>> //private static final ResourceBundle BUNDLE =
>>>> BundleUtils.getBundle(JAXRSServiceFactoryBean.class); +
>>>> +    protected List<ClassResourceInfo> classResourceInfos;
>>>> +    protected List<Class> resourceClasses;
>>>> +
>>>> +    private Invoker invoker;
>>>> +    private Executor executor;
>>>> +    private Map<String, Object> properties;
>>>> +
>>>> +    public JAXRSServiceFactoryBean() {
>>>> +    }
>>>> +
>>>> +    @Override
>>>> +    public Service create() {
>>>> +        initializeServiceModel();
>>>> +
>>>> +        initializeDefaultInterceptors();
>>>> +
>>>> +        if (invoker != null) {
>>>> +            getService().setInvoker(getInvoker());
>>>> +        } else {
>>>> +            getService().setInvoker(createInvoker());
>>>> +        }
>>>> +
>>>> +        if (getExecutor() != null) {
>>>> +            getService().setExecutor(getExecutor());
>>>> +        }
>>>> +        if (getDataBinding() != null) {
>>>> +            getService().setDataBinding(getDataBinding());
>>>> +        }
>>>> +
>>>> +        return getService();
>>>> +    }
>>>> +
>>>> +    public Executor getExecutor() {
>>>> +        return executor;
>>>> +    }
>>>> +
>>>> +    public void setExecutor(Executor executor) {
>>>> +        this.executor = executor;
>>>> +    }
>>>> +
>>>> +    public Invoker getInvoker() {
>>>> +        return invoker;
>>>> +    }
>>>> +
>>>> +    public void setInvoker(Invoker invoker) {
>>>> +        this.invoker = invoker;
>>>> +    }
>>>> +
>>>> +    public List<Class> getResourceClasses() {
>>>> +        return resourceClasses;
>>>> +    }
>>>> +
>>>> +    public void setResourceClasses(List<Class> classes) {
>>>> +        this.resourceClasses = classes;
>>>> +    }
>>>> +
>>>> +    public void setResourceClasses(Class... classes) {
>>>> +        this.resourceClasses = new
>>>> ArrayList<Class>(Arrays.asList(classes)); +    }
>>>> +
>>>> +    protected void initializeServiceModel() {
>>>> +        classResourceInfos = new ArrayList<ClassResourceInfo>();
>>>> +
>>>> +        for (Class resourceClass : resourceClasses) {
>>>> +            ClassResourceInfo classResourceInfo =
>>>> createClassResourceInfo(resourceClass); +           
>>>> classResourceInfos.add(classResourceInfo);
>>>> +        }
>>>> +
>>>> +        JAXRSServiceImpl service = new
>>>> JAXRSServiceImpl(classResourceInfos); +
>>>> +        setService(service);
>>>> +
>>>> +        if (properties != null) {
>>>> +            service.putAll(properties);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    protected ClassResourceInfo createClassResourceInfo(final
>>>> Class<?> c) { +        final UriTemplate annotation =
>>>> c.getAnnotation(UriTemplate.class); +        if (annotation       
>>> == null) {
>>>    
>>>> +            return null;
>>>> +        }
>>>> +
>>>> +        ClassResourceInfo resourceClass = getClassResourceInfo(c);
>>>> +
>>>> +        MethodDispatcher md = createOperation(c, resourceClass);
>>>> +        resourceClass.setMethodDispatcher(md);
>>>> +
>>>> +        String annotationValue = annotation.value();
>>>> +        if (!annotationValue.startsWith("/")) {
>>>> +            annotationValue = "/" + annotationValue;
>>>> +        }
>>>> +        String rightHandPattern = (resourceClass.hasSubResources())
>>>> +            ? URITemplate.SUB_RESOURCE_REGEX_SUFFIX :
>>>> URITemplate.NONE_SUB_RESOURCE_REGEX_SUFFIX; +        URITemplate t =
>>>> new URITemplate(annotationValue, rightHandPattern); +       
>>>> resourceClass.setURITemplate(t);
>>>> +
>>>> +        return resourceClass;
>>>> +    }
>>>> +
>>>> +    protected ClassResourceInfo getClassResourceInfo(final Class<?>
>>>> c) { +        return new ClassResourceInfo(c);
>>>> +    }
>>>> +
>>>> +    protected MethodDispatcher createOperation(Class c,
>>>> ClassResourceInfo cri) { +        MethodDispatcher md = new
>>>> MethodDispatcher();
>>>> +        for (Method m : c.getMethods()) {
>>>> +            if (m.getAnnotation(UriTemplate.class) != null) {
>>>> +                OperationResourceInfo ori = new
>>>> OperationResourceInfo(m, cri); +                String uriTemplate =
>>>> m.getAnnotation(UriTemplate.class).value(); +                if
>>>> (!uriTemplate.startsWith("/")) {
>>>> +                    uriTemplate = "/" + uriTemplate;
>>>> +                }
>>>> +                if (m.getAnnotation(HttpMethod.class) != null) {
>>>> +                    /*
>>>> +                     * Sub-resource method, URI template created by
>>>> concatenating +                     * the URI template of       
>>> the resource
>>>    
>>>> class with the URI template +                     * of the method
>>>> +                     */
>>>> +                    ori.setURITemplate(new URITemplate(uriTemplate,
>>>> +                                                      
>>>> URITemplate.NONE_SUB_RESOURCE_REGEX_SUFFIX)); +
>>>> +                    String httpMethod =
>>>> m.getAnnotation(HttpMethod.class).value(); +                   
>>>> ori.setHttpMethod(httpMethod);
>>>> +                } else {
>>>> +                    //sub-resource locator
>>>> +                    cri.setHasSubResources(true);
>>>> +                    ori.setURITemplate(new URITemplate(uriTemplate,
>>>> +                                                      
>>>> URITemplate.SUB_RESOURCE_REGEX_SUFFIX)); +                }
>>>> +                md.bind(ori, m);
>>>> +            } else if (m.getAnnotation(HttpMethod.class) != null) {
>>>> +                //Sub-resource method
>>>> +                OperationResourceInfo ori = new
>>>> OperationResourceInfo(m, cri); +                      
>>> ori.setURITemplate(new
>>>    
>>>> URITemplate("/",
>>>> +                                                  
>>>> URITemplate.NONE_SUB_RESOURCE_REGEX_SUFFIX)); +
>>>> +                String httpMethod =
>>>> m.getAnnotation(HttpMethod.class).value(); +               
>>>> ori.setHttpMethod(httpMethod);
>>>> +                md.bind(ori, m);
>>>> +            }
>>>> +        }
>>>> +
>>>> +        return md;
>>>> +    }
>>>> +
>>>> +    protected Invoker createInvoker() {
>>>> +        return new JAXRSInvoker();
>>>> +    }
>>>> +
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceFactoryBean.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
>>>>       
>>> ?rev=57342
>>>    
>>>> 9&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java Thu Sep  6 19:44:44 2007 @@ -0,0
>>>> +1,120 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs;
>>>> +
>>>> +import java.util.HashMap;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +import java.util.concurrent.Executor;
>>>> +
>>>> +import javax.xml.namespace.QName;
>>>> +
>>>> +import org.apache.cxf.configuration.Configurable;
>>>> +import org.apache.cxf.databinding.DataBinding;
>>>> +import org.apache.cxf.endpoint.Endpoint;
>>>> +import
>>>> org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
>>>> +import org.apache.cxf.jaxrs.model.ClassResourceInfo;
>>>> +import org.apache.cxf.service.Service;
>>>> +import org.apache.cxf.service.invoker.Invoker;
>>>> +import org.apache.cxf.service.model.EndpointInfo;
>>>> +import org.apache.cxf.service.model.ServiceInfo;
>>>> +import org.apache.cxf.workqueue.SynchronousExecutor;
>>>> +
>>>> +public class JAXRSServiceImpl extends
>>>> AbstractAttributedInterceptorProvider implements Service,       
>>> Configurable
>>>    
>>>> { +    private List<ClassResourceInfo> classResourceInfos;
>>>> +    private DataBinding dataBinding;
>>>> +    private Executor executor;
>>>> +    private Invoker invoker;
>>>> +    private Map<QName, Endpoint> endpoints = new HashMap<QName,
>>>> Endpoint>(); +
>>>> +    public JAXRSServiceImpl() {
>>>> +    }
>>>> +
>>>> +    public JAXRSServiceImpl(List<ClassResourceInfo> cri) {
>>>> +        this.classResourceInfos = cri;
>>>> +        executor = SynchronousExecutor.getInstance();
>>>> +    }
>>>> +
>>>> +    public String getBeanName() {
>>>> +        return getName().toString();
>>>> +    }
>>>> +
>>>> +    public QName getName() {
>>>> +        Class primaryClass =
>>>> classResourceInfos.get(0).getResourceClass(); +        return new
>>>> QName("jaxrs", primaryClass.getSimpleName()); +    }
>>>> +
>>>> +    public List<ClassResourceInfo> getClassResourceInfos() {
>>>> +        return classResourceInfos;
>>>> +    }
>>>> +
>>>> +    public List<ServiceInfo> getServiceInfos() {
>>>> +        //NOT IMPLEMENTED
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    public EndpointInfo getEndpointInfo(QName endpoint) {
>>>> +/*        for (ServiceInfo inf : serviceInfos) {
>>>> +            EndpointInfo ef = inf.getEndpoint(endpoint);
>>>> +            if (ef != null) {
>>>> +                return ef;
>>>> +            }
>>>> +        }
>>>> +        return null;*/
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +
>>>> +    public Executor getExecutor() {
>>>> +        return executor;
>>>> +    }
>>>> +
>>>> +    public void setExecutor(Executor executor) {
>>>> +        this.executor = executor;
>>>> +    }
>>>> +
>>>> +    public Invoker getInvoker() {
>>>> +        return invoker;
>>>> +    }
>>>> +
>>>> +    public void setInvoker(Invoker invoker) {
>>>> +        this.invoker = invoker;
>>>> +    }
>>>> +
>>>> +    public DataBinding getDataBinding() {
>>>> +        return dataBinding;
>>>> +    }
>>>> +
>>>> +    public void setDataBinding(DataBinding dataBinding) {
>>>> +        this.dataBinding = dataBinding;
>>>> +    }
>>>> +
>>>> +    public Map<QName, Endpoint> getEndpoints() {
>>>> +        return endpoints;
>>>> +    }
>>>> +
>>>> +    public void setEndpoints(Map<QName, Endpoint> endpoints) {
>>>> +        this.endpoints = endpoints;
>>>> +    }
>>>> +
>>>> +    public void setProperties(Map<String, Object> properties) {
>>>> +        this.putAll(properties);
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/JAXRSServiceImpl.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSDisp
>>>>       
>>> atchInterc
>>>    
>>>> eptor.java?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java Thu Sep  6
>>>> 19:44:44 2007 @@ -0,0 +1,217 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.interceptor;
>>>> +
>>>> +import java.io.IOException;
>>>> +import java.io.InputStream;
>>>> +import java.lang.annotation.Annotation;
>>>> +import java.lang.reflect.Method;
>>>> +import java.lang.reflect.Type;
>>>> +import java.util.ArrayList;
>>>> +import java.util.HashMap;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +
>>>> +import javax.ws.rs.HeaderParam;
>>>> +import javax.ws.rs.MatrixParam;
>>>> +import javax.ws.rs.QueryParam;
>>>> +import javax.ws.rs.UriParam;
>>>> +import javax.ws.rs.core.HttpContext;
>>>> +import javax.ws.rs.ext.EntityProvider;
>>>> +import javax.ws.rs.ext.ProviderFactory;
>>>> +
>>>> +import org.apache.cxf.jaxrs.JAXRSServiceImpl;
>>>> +import org.apache.cxf.jaxrs.model.ClassResourceInfo;
>>>> +import org.apache.cxf.jaxrs.model.OperationResourceInfo;
>>>> +import org.apache.cxf.jaxrs.model.URITemplate;
>>>> +import org.apache.cxf.message.Message;
>>>> +import org.apache.cxf.phase.AbstractPhaseInterceptor;
>>>> +import org.apache.cxf.phase.Phase;
>>>> +import org.apache.cxf.service.Service;
>>>> +
>>>> +
>>>> +public class JAXRSDispatchInterceptor extends
>>>> AbstractPhaseInterceptor<Message> { +
>>>> +    public static final String RELATIVE_PATH = "relative.path";
>>>> +    //private static final Logger LOG =
>>>> Logger.getLogger(RESTDispatchInterceptor.class.getName()); +   
>>>> //private static final ResourceBundle BUNDLE =
>>>> BundleUtils.getBundle(RESTDispatchInterceptor.class); +
>>>> +    public JAXRSDispatchInterceptor() {
>>>> +        super(Phase.PRE_STREAM);
>>>> +    }
>>>> +
>>>> +    public void handleMessage(Message message) {
>>>> +        String path = (String)message.get(Message.PATH_INFO);
>>>> +        String address = (String)message.get(Message.BASE_PATH);
>>>> +        String httpMethod =
>>>> (String)message.get(Message.HTTP_REQUEST_METHOD); +
>>>> +        if (address.startsWith("http")) {
>>>> +            int idx = address.indexOf('/', 7);
>>>> +            if (idx != -1) {
>>>> +                address = address.substring(idx);
>>>> +            }
>>>> +        }
>>>> +
>>>> +        if (path.startsWith(address)) {
>>>> +            path = path.substring(address.length());
>>>> +            if (!path.startsWith("/")) {
>>>> +                path = "/" + path;
>>>> +            }
>>>> +        }
>>>> +
>>>> +        if (!path.endsWith("/")) {
>>>> +            //path = path.substring(0, path.length() - 1);
>>>> +            path = path + "/";
>>>> +        }
>>>> +        message.put(RELATIVE_PATH, path);
>>>> +
>>>> +
>>>> +        //1. Matching target resource classes and method
>>>> +        Service service = message.getExchange().get(Service.class);
>>>> +        List<ClassResourceInfo> resources =
>>>> ((JAXRSServiceImpl)service).getClassResourceInfos(); +
>>>> +        Map<String, String> values = new HashMap<String, String>();
>>>> +        OperationResourceInfo ori = findTargetResource(resources,
>>>> path, httpMethod, values); +
>>>> +        if (ori == null) {
>>>> +            //throw new Fault(new
>>>> org.apache.cxf.common.i18n.Message("NO_OP", BUNDLE, method,       
>>> path)); +    
>>>>       }
>>>> +              
>>> message.getExchange().put(OperationResourceInfo.class, ori);
>>>    
>>>> +
>>>> +
>>>> +        //2. Process parameters
>>>> +        InputStream is = message.getContent(InputStream.class);
>>>> +        List<Object> params = processParameters(ori.getMethod(),
>>>> path, httpMethod, values, is); +
>>>> +        message.setContent(List.class, params);
>>>> +
>>>> +    }
>>>> +
>>>> +    protected OperationResourceInfo
>>>> findTargetResource(List<ClassResourceInfo> resources,       
>>> String path, +     
>>>>                                                     String       
>>> httpMethod,
>>>    
>>>> Map<String, String> values) { +        for       
>>> (ClassResourceInfo resource
>>>    
>>>> : resources) {
>>>> +            URITemplate uriTemplate = resource.getURITemplate();
>>>> +            if (uriTemplate.match(path, values)) {
>>>> +                String subResourcePath =
>>>> values.values().iterator().next(); +               
>>>> OperationResourceInfo ori = findTargetMethod(resource,
>>>> subResourcePath, httpMethod, values); +                if (ori !=
>>>> null) {
>>>> +                    return ori;
>>>> +                }
>>>> +            }
>>>> +        }
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    protected OperationResourceInfo
>>>> findTargetMethod(ClassResourceInfo resource, String path, +       
>>>              
>>>>                                          String httpMethod,
>>>> Map<String, String> values) { +        for       
>>> (OperationResourceInfo ori
>>>    
>>>> :       
>>> resource.getMethodDispatcher().getOperationResourceInfos()) { +        
>>>>       URITemplate uriTemplate = ori.getURITemplate();
>>>> +            if (uriTemplate != null && uriTemplate.match(path,
>>>> values)) { +                return ori;
>>>> +            } /*
>>>> +                 * else { //URITemplate == null means match by
>>>> default if +                 *
>>>> (httpMethod.equalsIgnoreCase(ori.getHttpMethod())) { return       
>>> +            
>>>>        * ori; } }
>>>> +                 */
>>>> +        }
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    private List<Object> processParameters(Method method, String
>>>> path, String httpMethod, +                                          
>>>> Map<String, String> values, InputStream is) { +        Class[]
>>>> parameterTypes = method.getParameterTypes(); +        Type[]
>>>> genericParameterTypes = method.getGenericParameterTypes(); +       
>>>> Annotation[][] parameterAnnotations =
>>>> method.getParameterAnnotations(); +
>>>> +        boolean readFromEntityBody = false;
>>>> +        if ("PUT".equals(httpMethod) ||       
>>> "POST".equals(httpMethod)) {
>>>    
>>>> +            readFromEntityBody = true;
>>>> +        }
>>>> +
>>>> +        List<Object> params = new
>>>> ArrayList<Object>(parameterTypes.length); +
>>>> +        for (int i = 0; i < parameterTypes.length; i++) {
>>>> +            Object param = processParameter(parameterTypes[i],
>>>> genericParameterTypes[i], +                                       
>>>              
>>>> parameterAnnotations[i], readFromEntityBody, path, values, is); +
>>>> +            params.add(param);
>>>> +        }
>>>> +
>>>> +        return params;
>>>> +    }
>>>> +
>>>> +    private Object processParameter(Class<?> parameterClass, Type
>>>> parameterType, +                                    Annotation[]
>>>> parameterAnnotations, boolean readFromEntityBody, +               
>>>              
>>>>                 String path, Map<String, String> values, InputStream
>>>> is) { +        Object result = null;
>>>> +        if (parameterAnnotations == null ||
>>>> parameterAnnotations.length == 0) { +            if
>>>> (readFromEntityBody) {
>>>> +                result = readFromEntityBody(parameterClass, is);
>>>> +            }
>>>> +            return result;
>>>> +        }
>>>> +
>>>> +        Annotation annotation = parameterAnnotations[0];
>>>> +        if (annotation.annotationType() == UriParam.class) {
>>>> +            result = readFromUriParam((UriParam)annotation,
>>>> parameterClass, parameterType, +                                  
>>>             
>>>> parameterAnnotations, path, values); +        } else if
>>>> (annotation.annotationType() == QueryParam.class) { +           //TODO
>>>> +        } else if (annotation.annotationType() ==       
>>> MatrixParam.class)
>>>    
>>>> { +            //TODO
>>>> +        } else if (annotation.annotationType() ==       
>>> HeaderParam.class)
>>>    
>>>> { +            //TODO
>>>> +        } else if (annotation.annotationType() ==       
>>> HttpContext.class)
>>>    
>>>> { +            //TODO
>>>> +        }
>>>> +
>>>> +        return result;
>>>> +    }
>>>> +
>>>> +    private Object readFromEntityBody(Class<?> targetTypeClass,
>>>> InputStream is) { +        Object result = null;
>>>> +        EntityProvider provider =
>>>>
>>>>       
>>> ProviderFactory.getInstance().createEntityProvider(targetTypeClass); +
>>>    
>>>> +        try {
>>>> +            result = provider.readFrom(targetTypeClass, null, null,
>>>> is); +        } catch (IOException e) {
>>>> +            e.printStackTrace();
>>>> +        }
>>>> +
>>>> +        return result;
>>>> +    }
>>>> +
>>>> +    private String readFromUriParam(UriParam uriParamAnnotation,
>>>> +                                    Class<?> parameter,
>>>> +                                    Type parameterType,
>>>> +                                    Annotation[]
>>>> parameterAnnotations, +                                    String
>>>> path,
>>>> +                                    Map<String, String> values) {
>>>> +        String parameterName = uriParamAnnotation.value();
>>>> +        if (parameterName == null || parameterName.length() == 0) {
>>>> +            // Invalid URI parameter name
>>>> +            return null;
>>>> +        }
>>>> +
>>>> +        String result = values.get(parameterName);
>>>> +
>>>> +        return result;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSDispatchInterceptor.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutI
>>>>       
>>> nterceptor
>>>    
>>>> .java?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java Thu Sep  6 19:44:44
>>>> 2007 @@ -0,0 +1,77 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.interceptor;
>>>> +
>>>> +import java.io.IOException;
>>>> +import java.io.OutputStream;
>>>> +import java.util.List;
>>>> +
>>>> +import javax.ws.rs.ext.EntityProvider;
>>>> +import javax.ws.rs.ext.ProviderFactory;
>>>> +
>>>> +import       
>>> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
>>>    
>>>> +import org.apache.cxf.jaxrs.model.OperationResourceInfo;
>>>> +import org.apache.cxf.message.Exchange;
>>>> +import org.apache.cxf.message.Message;
>>>> +import org.apache.cxf.message.MessageContentsList;
>>>> +import org.apache.cxf.phase.Phase;
>>>> +
>>>> +public class JAXRSOutInterceptor extends
>>>> AbstractOutDatabindingInterceptor { +
>>>> +    public JAXRSOutInterceptor() {
>>>> +        super(Phase.MARSHAL);
>>>> +    }
>>>> +
>>>> +    public void handleMessage(Message message) {
>>>> +        Exchange exchange = message.getExchange();
>>>> +        OperationResourceInfo operation =
>>>>
>>>>       
>>> (OperationResourceInfo)exchange.get(OperationResourceInfo.class 
>>> +        
>>>>       .getName());
>>>> +
>>>> +        if (operation == null) {
>>>> +            return;
>>>> +        }
>>>> +
>>>> +        MessageContentsList objs =
>>>> MessageContentsList.getContentsList(message); +        if (objs ==
>>>> null || objs.size() == 0) {
>>>> +            return;
>>>> +        }
>>>> +
>>>> +        OutputStream out = message.getContent(OutputStream.class);
>>>> +
>>>> +        if (objs.get(0) != null) {
>>>> +            Class targetType = objs.get(0).getClass();
>>>> +            if (objs.get(0).getClass().isArray()) {
>>>> +                targetType =
>>>> objs.get(0).getClass().getComponentType(); +            } else if
>>>> (objs.get(0) instanceof List && ((List)objs.get(0)).get(0)       
>>> != null) {
>>>    
>>>> +                targetType =       
>>> ((List)objs.get(0)).get(0).getClass(); +
>>>    
>>>> +            }
>>>> +            EntityProvider provider =
>>>> ProviderFactory.getInstance().createEntityProvider(targetType); +
>>>> +            try {
>>>> +                provider.writeTo(objs.get(0), null, out);
>>>> +            } catch (IOException e) {
>>>> +                e.printStackTrace();
>>>> +            }
>>>> +        }
>>>> +
>>>> +    }
>>>> +
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceIn
>>>>       
>>> fo.java?re
>>>    
>>>> v=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java Thu Sep  6 19:44:44 2007 @@
>>>> -0,0 +1,60 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.model;
>>>> +
>>>> +
>>>> +public class ClassResourceInfo {
>>>> +    private Class resourceClass;
>>>> +    private URITemplate uriTemplate;
>>>> +    private MethodDispatcher methodDispatcher;
>>>> +    private boolean hasSubResources;
>>>> +
>>>> +    public ClassResourceInfo(Class theResourceClass) {
>>>> +        resourceClass = theResourceClass;
>>>> +    }
>>>> +
>>>> +    public Class getResourceClass() {
>>>> +        return resourceClass;
>>>> +    }
>>>> +
>>>> +    public URITemplate getURITemplate() {
>>>> +        return uriTemplate;
>>>> +    }
>>>> +
>>>> +    public void setURITemplate(URITemplate u) {
>>>> +        uriTemplate = u;
>>>> +    }
>>>> +
>>>> +    public MethodDispatcher getMethodDispatcher() {
>>>> +        return methodDispatcher;
>>>> +    }
>>>> +
>>>> +    public void setMethodDispatcher(MethodDispatcher md) {
>>>> +        methodDispatcher = md;
>>>> +    }
>>>> +
>>>> +    public boolean hasSubResources() {
>>>> +        return hasSubResources;
>>>> +    }
>>>> +
>>>> +    public void setHasSubResources(boolean flag) {
>>>> +        hasSubResources = flag;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/ClassResourceInfo.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/model/MethodDispatche
>>>>       
>>> r.java?rev
>>>    
>>>> =573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java Thu Sep  6 19:44:44       
>>> 2007 @@ -0,0
>>>    
>>>> +1,55 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.apache.cxf.jaxrs.model;
>>>> +
>>>> +import java.lang.reflect.Method;
>>>> +
>>>> +import java.util.Map;
>>>> +import java.util.Set;
>>>> +import java.util.concurrent.ConcurrentHashMap;
>>>> +
>>>> +
>>>> +public class MethodDispatcher {
>>>> +    private Map<OperationResourceInfo, Method> opToMethod =
>>>> +        new ConcurrentHashMap<OperationResourceInfo, Method>();
>>>> +    private Map<Method, OperationResourceInfo> methodToOp =
>>>> +        new ConcurrentHashMap<Method, OperationResourceInfo>();
>>>> +
>>>> +    public void bind(OperationResourceInfo o, Method... methods) {
>>>> +        Method primary = methods[0];
>>>> +
>>>> +        for (Method m : methods) {
>>>> +            methodToOp.put(m, o);
>>>> +        }
>>>> +
>>>> +        opToMethod.put(o, primary);
>>>> +    }
>>>> +
>>>> +    public OperationResourceInfo getOperationResourceInfo(Method
>>>> method) { +        return methodToOp.get(method);
>>>> +    }
>>>> +
>>>> +    public Set<OperationResourceInfo> getOperationResourceInfos() {
>>>> +        return opToMethod.keySet();
>>>> +    }
>>>> +
>>>> +    public Method getMethod(OperationResourceInfo op) {
>>>> +        return opToMethod.get(op);
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/MethodDispatcher.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResour
>>>>       
>>> ceInfo.jav
>>>    
>>>> a?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java Thu Sep  6       
>>> 19:44:44 2007 @@
>>>    
>>>> -0,0 +1,91 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.model;
>>>> +
>>>> +import java.lang.reflect.Method;
>>>> +import java.util.List;
>>>> +
>>>> +import javax.ws.rs.ext.EntityProvider;
>>>> +
>>>> +import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
>>>> +
>>>> +public class OperationResourceInfo {
>>>> +    private URITemplate uriTemplate;
>>>> +    private ClassResourceInfo classResourceInfo;
>>>> +    private Method method;
>>>> +    private List<Class> parameterTypeList;
>>>> +    private List<Class> annotatedParameterTypeList;
>>>> +    private List<EntityProvider> entityProviderList;
>>>> +    private String httpMethod;
>>>> +
>>>> +    public OperationResourceInfo(Method m, ClassResourceInfo cri) {
>>>> +        method = m;
>>>> +        classResourceInfo = cri;
>>>> +    }
>>>> +
>>>> +    public URITemplate getURITemplate() {
>>>> +        return uriTemplate;
>>>> +    }
>>>> +
>>>> +    public void setURITemplate(URITemplate u) {
>>>> +        uriTemplate = u;
>>>> +    }
>>>> +
>>>> +    public ClassResourceInfo getClassResourceInfo() {
>>>> +        return classResourceInfo;
>>>> +    }
>>>> +
>>>> +    public void setClassResourceInfo(ClassResourceInfo c) {
>>>> +        classResourceInfo = c;
>>>> +    }
>>>> +
>>>> +    public Method getMethod() {
>>>> +        return method;
>>>> +    }
>>>> +
>>>> +    public void setMethod(Method m) {
>>>> +        method = m;
>>>> +    }
>>>> +
>>>> +    public String getHttpMethod() {
>>>> +        return httpMethod;
>>>> +    }
>>>> +
>>>> +    public void setHttpMethod(String m) {
>>>> +        httpMethod = m;
>>>> +    }
>>>> +
>>>> +    public List<Class> getParameterTypeList() {
>>>> +        return parameterTypeList;
>>>> +    }
>>>> +
>>>> +    public List<Class> getAnnotatedParameterTypeList() {
>>>> +        return annotatedParameterTypeList;
>>>> +    }
>>>> +
>>>> +    public List<EntityProvider> getEntityProviderList() {
>>>> +        return entityProviderList;
>>>> +    }
>>>> +
>>>> +    protected EntityProvider findEntityProvider() {
>>>> +        return new JAXBElementProvider();
>>>> +
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/OperationResourceInfo.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.jav
>>>>       
>>> a?rev=5734
>>>    
>>>> 29&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java Thu Sep  6 19:44:44 2007 @@ -0,0
>>>> +1,157 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.model;
>>>> +
>>>> +
>>>> +import java.util.ArrayList;
>>>> +import java.util.Collections;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +import java.util.regex.Matcher;
>>>> +import java.util.regex.Pattern;
>>>> +
>>>> +public final class URITemplate {
>>>> +    /**
>>>> +     * Regex for sub-resource: For each resource class compute a
>>>> regular +     * expression from its URI template, If the resource
>>>> class has sub-resources +     * then append ¡®(/.*)?¡ˉ to the
>>>> resulting regular expression. +     */
>>>> +    public static final String SUB_RESOURCE_REGEX_SUFFIX =       
>>> "(/.*)?";
>>>    
>>>> +
>>>> +    /**
>>>> +     * Regex for none sub-resource: For each resource       
>>> class compute a
>>>    
>>>> regular +     * expression from its URI template, If the resource
>>>> class has no +     * sub-resources then append ¡®(/)?¡ˉ to the
>>>> resulting regular expression. +     */
>>>> +    public static final String NONE_SUB_RESOURCE_REGEX_SUFFIX =
>>>> "(/)?"; +
>>>> +    /**
>>>> +     * The regular expression for matching URI templates and names.
>>>> +     */
>>>> +    private static final Pattern TEMPLATE_NAMES_PATTERN =
>>>> Pattern.compile("\\{([\\w-\\._~]+?)\\}"); +
>>>> +    /**
>>>> +     * A URI template is converted into a regular expression by
>>>> substituting +     * ¡®(.*?)¡ˉ for each occurrence of {\([w- 14 \.
>>>> ]+?\)} within the URL +     * template
>>>> +     */
>>>> +    private static final String URITEMPLATE_REGEX = "(.*?)";
>>>> +
>>>> +    private final String template;
>>>> +    private final String regexSuffix;
>>>> +    private final boolean endsWithSlash;
>>>> +    private final List<String> templateVariables;
>>>> +    private final String templateRegex;
>>>> +    private final Pattern templateRegexPattern;
>>>> +
>>>> +    private URITemplate() {
>>>> +        this.template = "";
>>>> +        this.regexSuffix = null;
>>>> +        this.endsWithSlash = false;
>>>> +        this.templateVariables = Collections.emptyList();
>>>> +        this.templateRegex = "";
>>>> +        this.templateRegexPattern = null;
>>>> +    }
>>>> +
>>>> +    public URITemplate(String theTemplate) {
>>>> +        this(theTemplate, null);
>>>> +    }
>>>> +
>>>> +    public URITemplate(String theTemplate, String theRegexSuffix) {
>>>> +        this.template = theTemplate;
>>>> +        this.regexSuffix = theRegexSuffix;
>>>> +
>>>> +        StringBuilder stringBuilder = new StringBuilder();
>>>> +        List<String> names = new ArrayList<String>();
>>>> +
>>>> +        // compute a regular expression from URI template
>>>> +        Matcher matcher = TEMPLATE_NAMES_PATTERN.matcher(template);
>>>> +        int i = 0;
>>>> +        while (matcher.find()) {
>>>> +            copyURITemplateCharacters(template, i, matcher.start(),
>>>> stringBuilder); +                  
>>> stringBuilder.append(URITEMPLATE_REGEX);
>>>    
>>>> +            names.add(matcher.group(1));
>>>> +            i = matcher.end();
>>>> +        }
>>>> +        copyURITemplateCharacters(template, i, template.length(),
>>>> stringBuilder); +
>>>> +        templateVariables = Collections.unmodifiableList(names);
>>>> +
>>>> +        int endPos = stringBuilder.length() - 1;
>>>> +        this.endsWithSlash = (endPos >= 0) ?
>>>> stringBuilder.charAt(endPos) == '/' : false; +        if       
>>> (regexSuffix
>>>    
>>>> != null) {
>>>> +            if (endsWithSlash) {
>>>> +                stringBuilder.deleteCharAt(endPos);
>>>> +            }
>>>> +            stringBuilder.append(regexSuffix);
>>>> +        }
>>>> +
>>>> +        templateRegex = stringBuilder.toString();
>>>> +        templateRegexPattern = Pattern.compile(templateRegex);
>>>> +    }
>>>> +
>>>> +    private void copyURITemplateCharacters(String       
>>> templateValue, int
>>>    
>>>> start, int end, StringBuilder b) { +        for (int i = start; i <
>>>> end; i++) {
>>>> +            char c = templateValue.charAt(i);
>>>> +            if (c == '?') {
>>>> +                b.append("\\?");
>>>> +            } else {
>>>> +                b.append(c);
>>>> +            }
>>>> +        }
>>>> +    }
>>>> +
>>>> +    public boolean match(String uri, Map<String, String>
>>>> templateVariableToValue) { +        templateVariableToValue.clear();
>>>> +
>>>> +        if (uri == null) {
>>>> +            return (templateRegexPattern == null) ? true : false;
>>>> +        }
>>>> +
>>>> +        if (templateRegexPattern == null) {
>>>> +            return false;
>>>> +        }
>>>> +
>>>> +        Matcher m = templateRegexPattern.matcher(uri);
>>>> +        if (!m.matches()) {
>>>> +            return false;
>>>> +        }
>>>> +
>>>> +        // Assign the matched template values to template variables
>>>> +        int i = 1;
>>>> +        for (String name : templateVariables) {
>>>> +            String previousValue =       
>>> templateVariableToValue.get(name);
>>>    
>>>> +            String currentValue = m.group(i++);
>>>> +
>>>> +            if (previousValue != null &&
>>>> !previousValue.equals(currentValue)) { +                      
>>> return false;
>>>    
>>>> +            }
>>>> +
>>>> +            templateVariableToValue.put(name, currentValue);
>>>> +        }
>>>> +
>>>> +        // Assign the right hand side value to the null key
>>>> +        if (regexSuffix != null) {
>>>> +            templateVariableToValue.put(null, m.group(i));
>>>> +        }
>>>> +
>>>> +        return true;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:eol-style = native
>>>>
>>>> Propchange:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/model/URITemplate.java
>>>>
>>>>       
>>> ----------------------------------------------------------------------
>>>    
>>>> -------- svn:keywords = Rev Date
>>>>
>>>> Added:
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/JAXBElementProvider.java URL:
>>>>
>>>>       
>>> http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/j
>>>    
>>>> axrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementP
>>>>       
>>> rovider.ja
>>>    
>>>> va?rev=573429&view=auto
>>>>
>>>>       
>>> ======================================================================
>>>    
>>>> ======== ---
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/JAXBElementProvider.java (added) +++
>>>>
>>>>       
>>> incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache
>>>    
>>>> /cxf/jaxrs/provider/JAXBElementProvider.java Thu Sep  6 19:44:44 2007
>>>> @@ -0,0 +1,103 @@
>>>> +/**
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements. See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership. The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License. You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied. See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +
>>>> +package org.apache.cxf.jaxrs.provider;
>>>> +
>>>> +
>>>> +import java.io.InputStream;
>>>> +import java.io.OutputStream;
>>>> +import java.lang.reflect.Array;
>>>> +import java.util.List;
>>>> +import java.util.Map;
>>>> +import java.util.WeakHashMap;
>>>> +import javax.ws.rs.core.MultivaluedMap;
>>>> +import javax.ws.rs.ext.EntityProvider;
>>>> +import javax.xml.bind.JAXBContext;
>>>> +import javax.xml.bind.JAXBElement;
>>>> +import javax.xml.bind.JAXBException;
>>>> +import javax.xml.bind.Marshaller;
>>>> +import javax.xml.bind.Unmarshaller;
>>>> +import javax.xml.bind.annotation.XmlRootElement;
>>>> +import javax.xml.namespace.QName;
>>>> +
>>>> +public final class JAXBElementProvider implements
>>>> EntityProvider<Object>  { +
>>>> +    static Map<Class, JAXBContext> jaxbContexts = new
>>>> WeakHashMap<Class, JAXBContext>(); +
>>>> +    public boolean supports(Class<?> type) {
>>>> +        return type.getAnnotation(XmlRootElement.class) != null;
>>>> +    }
>>>> +
>>>> +    public Object readFrom(Class<Object> type, String mediaType,
>>>> MultivaluedMap<String, String> headers, +                          
>>>> InputStream is) {
>>>> +        try {
>>>> +            JAXBContext context = getJAXBContext(type);
>>>> +            Unmarshaller unmarshaller =       
>>> context.createUnmarshaller();
>>>    
>>>> +            return unmarshaller.unmarshal(is);
>>>> +        } catch (JAXBException e) {
>>>> +            e.printStackTrace();
>>>> +        }
>>>> +
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    public void writeTo(Object obj, MultivaluedMap<String, Object>
>>>> headers, OutputStream os) { +        try {
>>>> +            if (obj.getClass().isArray() || obj instanceof List) {
>>>> +                Class<?> cls = null;
>>>> +                Object objArray;
>>>> +                if (obj instanceof List) {
>>>> +                    List l = (List)obj;
>>>> +                    objArray = l.toArray(new Object[l.size()]);
>>>> +                    cls = null;
>>>> +                } else {
>>>> +                    objArray = obj;
>>>> +                    cls = objArray.getClass().getComponentType();
>>>> +                }
>>>> +                int len = Array.getLength(objArray);
>>>> +                for (int x = 0; x < len; x++) {
>>>> +                    Object o = Array.get(objArray, x);
>>>> +                    JAXBContext context =
>>>> getJAXBContext(o.getClass()); +                    Marshaller
>>>> marshaller = context.createMarshaller(); +                   
>>>> marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); +         
>>>              
>>>>       marshaller.marshal(new JAXBElement(new QName(null,
>>>> o.getClass().getSimpleName()), +                                  
>>>              
>>>>                 cls == null ? o.getClass() : cls, o), os);       
>>> +             
>>>>      }
>>>> +            } else {
>>>> +                JAXBContext context =       
>>> getJAXBContext(obj.getClass());
>>>    
>>>> +                Marshaller marshaller = context.createMarshaller();
>>>> +                marshaller.setProperty(Marshaller.JAXB_FRAGMENT,
>>>> true); +                marshaller.marshal(obj, os);
>>>> +            }
>>>> +        } catch (JAXBException e) {
>>>> +            e.printStackTrace();
>>>> +        }
>>>> +    }
>>>> +
>>>> +    private JAXBContext getJAXBContext(Class type) throws
>>>> JAXBException { +        synchronized (jaxbContexts) {
>>>> +            JAXBContext context = jaxbContexts.get(type);
>>>> +            if (context == null) {
>>>> +                context = JAXBContext.newInstance(type);
>>>> +                jaxbContexts.put(type, context);
>>>> +            }
>>>> +            return context;
>>>> +        }
>>>> +    }
>>>> +}
>>>>       
>>>
>>> -- 
>>> J. Daniel Kulp
>>> Principal Engineer
>>> IONA
>>> P: 781-902-8727    C: 508-380-7194
>>> daniel.kulp@iona.com
>>> http://www.dankulp.com/blog
>>>
>>>     
>>
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, 
>> Ireland
>>   
>

Mime
View raw message