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.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014-2016 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.hk2.xml.jaxb.internal;
import java.beans.PropertyChangeEvent;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.glassfish.hk2.api.ActiveDescriptor;
import org.glassfish.hk2.api.DynamicConfiguration;
import org.glassfish.hk2.configuration.hub.api.Hub;
import org.glassfish.hk2.configuration.hub.api.WriteableBeanDatabase;
import org.glassfish.hk2.configuration.hub.api.WriteableType;
import org.glassfish.hk2.utilities.general.GeneralUtilities;
import org.glassfish.hk2.utilities.reflection.BeanReflectionHelper;
import org.glassfish.hk2.utilities.reflection.ClassReflectionHelper;
import org.glassfish.hk2.utilities.reflection.Logger;
import org.glassfish.hk2.utilities.reflection.ReflectionHelper;
import org.glassfish.hk2.xml.api.XmlHk2ConfigurationBean;
import org.glassfish.hk2.xml.api.XmlHubCommitMessage;
import org.glassfish.hk2.xml.api.annotations.Customizer;
import org.glassfish.hk2.xml.internal.ChildType;
import org.glassfish.hk2.xml.internal.DynamicChangeInfo;
import org.glassfish.hk2.xml.internal.ParentedModel;
import org.glassfish.hk2.xml.internal.Utilities;
/**
* @author jwells
*
*/
public abstract class BaseHK2JAXBBean implements XmlHk2ConfigurationBean, Serializable {
private static final long serialVersionUID = 8149986319033910297L;
private final static boolean DEBUG_GETS_AND_SETS = AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Boolean run() {
return Boolean.parseBoolean(
System.getProperty("org.jvnet.hk2.properties.xmlservice.jaxb.getsandsets", "false"));
}
});
private final static String EMPTY = "";
public final static char XML_PATH_SEPARATOR = '/';
/**
* All fields, including child lists and direct children
*/
private final HashMap beanLikeMap = new HashMap();
/**
* All children whose type has an identifier. First key is the xml parameter name, second
* key is the identifier of the specific child. Used in lookup operations. Works
* as a cache, may not be completely accurate and must be flushed on remove
* operations
*/
private final Map> keyedChildrenCache = new HashMap>();
/** The model for this, including lists of all children property names */
// private UnparentedNode model;
/** The parent of this instance, or null if this is a root (or has not been fully initialized yet) */
private Object parent;
/** My own XmlTag, which is determined either by my parent or by my root value */
private String selfXmlTag;
/** The full instance name this takes, with names from keyed children or ids from unkeyed multi children */
private String instanceName;
/** The value of my key field, if I have one */
private String keyValue;
/** The global classReflectionHelper, which minimizes reflection */
private ClassReflectionHelper classReflectionHelper;
/** My own full xmlPath from root */
private String xmlPath = EMPTY;
/**
* This object contains the tree locks
* Once this has been set then all other fields should have been set,
* and at that point this object is ready for its life as an
* in-memory node in a tree hierarchy
*/
private volatile transient DynamicChangeInfo changeControl;
/**
* If true this bean has been given to the user to
* add/remove or call getters or setters. This can
* happen in two ways, the first being via being parsed
* from an XML file, the other is via dynamic creation
*/
private boolean active = false;
/**
* The descriptor that this bean is advertised with
*/
private transient ActiveDescriptor> selfDescriptor;
/**
* For JAXB and Serialization
*/
public BaseHK2JAXBBean() {
}
public void _setProperty(String propName, Object propValue) {
_setProperty(propName, propValue, true);
}
@SuppressWarnings("unchecked")
public void _setProperty(String propName, Object propValue, boolean changeInHub) {
if (propName == null) throw new IllegalArgumentException("properyName may not be null");
if (DEBUG_GETS_AND_SETS) {
// Hidden behind static because of potential expensive toString costs
Logger.getLogger().debug("XmlService setting property " + propName + " to " + propValue + " in " + this);
}
if (propValue != null && (propValue instanceof List)) {
// All lists are unmodifiable and ArrayLists
if (propValue instanceof ArrayList) {
propValue = Collections.unmodifiableList((ArrayList