Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.tuscany.sca.databinding.jaxb;
import java.awt.Image;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.ref.SoftReference;
import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import javax.activation.DataHandler;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.transform.Source;
import org.apache.tuscany.sca.common.java.collection.LRUCache;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.extensibility.ClassLoaderContext;
/**
* @version $Rev: 909173 $ $Date: 2010-02-12 01:23:50 +0200 (Fri, 12 Feb 2010) $
*/
public class JAXBContextCache {
private static final int CACHE_SIZE = 128;
private static HashMap> loadClassMap = new HashMap>();
static {
loadClassMap.put("byte", byte.class);
loadClassMap.put("int", int.class);
loadClassMap.put("short", short.class);
loadClassMap.put("long", long.class);
loadClassMap.put("float", float.class);
loadClassMap.put("double", double.class);
loadClassMap.put("boolean", boolean.class);
loadClassMap.put("char", char.class);
loadClassMap.put("void", void.class);
}
protected static Class>[] JAXB_BUILTIN_CLASSES =
{byte[].class, boolean.class, byte.class, char.class, double.class, float.class, int.class, long.class,
short.class, void.class, java.awt.Image.class, java.io.File.class, java.lang.Boolean.class,
java.lang.Byte.class, java.lang.Character.class, java.lang.Class.class, java.lang.Double.class,
java.lang.Float.class, java.lang.Integer.class, java.lang.Long.class, java.lang.Object.class,
java.lang.Short.class, java.lang.String.class, java.lang.Void.class, java.math.BigDecimal.class,
java.math.BigInteger.class, java.net.URI.class, java.net.URL.class, java.util.Calendar.class,
java.util.Date.class, java.util.GregorianCalendar.class, java.util.UUID.class,
javax.activation.DataHandler.class, javax.xml.bind.JAXBElement.class, javax.xml.datatype.Duration.class,
javax.xml.datatype.XMLGregorianCalendar.class, javax.xml.namespace.QName.class,
javax.xml.transform.Source.class};
protected static final Set> BUILTIN_CLASSES_SET = new HashSet>(Arrays.asList(JAXB_BUILTIN_CLASSES));
/*
protected static Class>[] COMMON_ARRAY_CLASSES =
new Class[] {char[].class, short[].class, int[].class, long[].class, float[].class, double[].class,
String[].class
};
protected static final Set> COMMON_CLASSES_SET = new HashSet>(Arrays.asList(COMMON_ARRAY_CLASSES));
*/
protected LRUCache