webidor/src/main/java/cz/xelfi/quoridor/webidor/JAXBContextResolver.java
changeset 256 1758a7727278
parent 255 9ecd02d694cd
child 257 03762a20a808
child 258 935118a5831a
     1.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/JAXBContextResolver.java	Sun Sep 05 22:34:43 2010 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,70 +0,0 @@
     1.4 -/*
     1.5 - *
     1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.7 - * 
     1.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     1.9 - * 
    1.10 - * The contents of this file are subject to the terms of either the GNU
    1.11 - * General Public License Version 2 only ("GPL") or the Common Development
    1.12 - * and Distribution License("CDDL") (collectively, the "License").  You
    1.13 - * may not use this file except in compliance with the License. You can obtain
    1.14 - * a copy of the License at https://jersey.dev.java.net/CDDL+GPL.html
    1.15 - * or jersey/legal/LICENSE.txt.  See the License for the specific
    1.16 - * language governing permissions and limitations under the License.
    1.17 - * 
    1.18 - * When distributing the software, include this License Header Notice in each
    1.19 - * file and include the License file at jersey/legal/LICENSE.txt.
    1.20 - * Sun designates this particular file as subject to the "Classpath" exception
    1.21 - * as provided by Sun in the GPL Version 2 section of the License file that
    1.22 - * accompanied this code.  If applicable, add the following below the License
    1.23 - * Header, with the fields enclosed by brackets [] replaced by your own
    1.24 - * identifying information: "Portions Copyrighted [year]
    1.25 - * [name of copyright owner]"
    1.26 - * 
    1.27 - * Contributor(s):
    1.28 - * 
    1.29 - * If you wish your version of this file to be governed by only the CDDL or
    1.30 - * only the GPL Version 2, indicate your decision by adding "[Contributor]
    1.31 - * elects to include this software in this distribution under the [CDDL or GPL
    1.32 - * Version 2] license."  If you don't indicate a single choice of license, a
    1.33 - * recipient has the option to distribute your version of this file under
    1.34 - * either the CDDL, the GPL Version 2 or to extend the choice of license to
    1.35 - * its licensees as provided above.  However, if you add GPL Version 2 code
    1.36 - * and therefore, elected the GPL Version 2 license, then the option applies
    1.37 - * only if the new code is made subject to such option by the copyright
    1.38 - * holder.
    1.39 - */
    1.40 -
    1.41 -package cz.xelfi.quoridor.webidor;
    1.42 -
    1.43 -import com.sun.jersey.api.json.JSONConfiguration;
    1.44 -import com.sun.jersey.api.json.JSONJAXBContext;
    1.45 -import java.util.Arrays;
    1.46 -import java.util.HashSet;
    1.47 -import java.util.Set;
    1.48 -import javax.ws.rs.ext.ContextResolver;
    1.49 -import javax.ws.rs.ext.Provider;
    1.50 -import javax.xml.bind.JAXBContext;
    1.51 -
    1.52 -/**
    1.53 - *
    1.54 - * @author japod
    1.55 - */
    1.56 -@Provider
    1.57 -public final class JAXBContextResolver implements ContextResolver<JAXBContext> {
    1.58 -    
    1.59 -    private final JAXBContext context;
    1.60 -    
    1.61 -    private final Set<Class> types;
    1.62 -    
    1.63 -    private final Class[] cTypes = {Game.class, GameId.class, GameStatus.class };
    1.64 -    
    1.65 -    public JAXBContextResolver() throws Exception {
    1.66 -        this.types = new HashSet(Arrays.asList(cTypes));
    1.67 -        this.context = new JSONJAXBContext(JSONConfiguration.natural().build(), cTypes);
    1.68 -    }
    1.69 -    
    1.70 -    public JAXBContext getContext(Class<?> objectType) {
    1.71 -        return (types.contains(objectType)) ? context : null;
    1.72 -    }
    1.73 -}
    1.74 \ No newline at end of file