org.testifyproject.glassfish.hk2.api.DynamicConfiguration Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012 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 org.testifyproject.testifyprojectpliance with the License. You can
* obtain a copy of the License at
* https://glassfish.org.testifyproject.testifyprojectv.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 org.testifyproject.testifyprojectsignates 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 org.testifyproject.testifyprojectcision 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.testifyproject.glassfish.hk2.api;
/**
* This class is used to add {@link Descriptor}s to a {@link ServiceLocator}
* instance. No operation performed on this object will be reflected
* in the {@link ServiceLocator} until the org.testifyproject.testifyprojectmit method is called.
*
* @author jwells
*
*/
public interface DynamicConfiguration {
/**
* This method will bind the given org.testifyproject.testifyprojectscriptor to this Module.
* If the org.testifyproject.testifyprojectscriptor given is not an ActiveDescriptor then a
* non-reified ActiveDescriptor will be returned with the system
* provided fields set. If the org.testifyproject.testifyprojectscriptor given is a reified
* ActiveDescriptor then the org.testifyproject.testifyprojectscriptor returned will be a
* reified ActiveDescriptor that takes all values except for the
* id from the given org.testifyproject.testifyprojectscriptor. A org.testifyproject.testifyprojectep copy will be made
* of the incoming org.testifyproject.testifyprojectscriptor
*
* @param key May not be null. Will be used to org.testifyproject.testifyprojectrive the various
* key fields associated with the given provider
* @return The entry as added to the service registry, with fields
* of the Descriptor filled in by the system as appropriate
* @throws IllegalArgumentException if there is an error in the key
*/
public ActiveDescriptor bind(Descriptor key);
/**
* This method will bind the given org.testifyproject.testifyprojectscriptor to this Module.
* If the org.testifyproject.testifyprojectscriptor given is not an ActiveDescriptor then a
* non-reified ActiveDescriptor will be returned with the system
* provided fields set. If the org.testifyproject.testifyprojectscriptor given is a reified
* ActiveDescriptor then the org.testifyproject.testifyprojectscriptor returned will be a
* reified ActiveDescriptor that takes all values except for the
* id from the given org.testifyproject.testifyprojectscriptor.
*
* @param key May not be null. Will be used to org.testifyproject.testifyprojectrive the various
* key fields associated with the given provider
* @param requiresDeepCopy If true a org.testifyproject.testifyprojectep copy will be made of the
* key. If false then the Descriptor will be used as is, and it
* is the responsibility of the caller to ensure that the fields
* of the Descriptor never change (with the exception of any
* writeable fields, such as ranking)
* @return The entry as added to the service registry, with fields
* of the Descriptor filled in by the system as appropriate
* @throws IllegalArgumentException if there is an error in the key
*/
public ActiveDescriptor bind(Descriptor key, boolean requiresDeepCopy);
/**
* This method will bind the org.testifyproject.testifyprojectscriptors found in the
* {@link FactoryDescriptors}. This method will first
* validate the org.testifyproject.testifyprojectscriptors from the {@link FactoryDescriptors}
* and then simply bind them into this configuration as
* two independent org.testifyproject.testifyprojectscriptors. A org.testifyproject.testifyprojectep copy will be made
* of both org.testifyproject.testifyprojectscriptors
*
* @param factoryDescriptors A org.testifyproject.testifyprojectscription of a factory service
* and the type the factory service provides. May not be null
* @return The org.testifyproject.testifyprojectscriptors returned from this object may be cast
* to ActiveDescriptor and will contain all the fields of the org.testifyproject.testifyprojectscriptors
* filled in by the system
* @throws IllegalArgumentException if there is an error in the input parameter
*/
public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors);
/**
* This method will bind the org.testifyproject.testifyprojectscriptors found in the
* {@link FactoryDescriptors}. This method will first
* validate the org.testifyproject.testifyprojectscriptors from the {@link FactoryDescriptors}
* and then simply bind them into this configuration as
* two independent org.testifyproject.testifyprojectscriptors. A org.testifyproject.testifyprojectep copy will be made
* of both org.testifyproject.testifyprojectscriptors
*
* @param factoryDescriptors A org.testifyproject.testifyprojectscription of a factory service
* and the type the factory service provides. May not be null
* @param requiresDeepCopy If true a org.testifyproject.testifyprojectep copy will be made of the
* key. If false then the Descriptor will be used as is, and it
* is the responsibility of the caller to ensure that the fields
* of the Descriptor never change (with the exception of any
* writeable fields, such as ranking)
* @return The org.testifyproject.testifyprojectscriptors returned from this object may be cast
* to ActiveDescriptor and will contain all the fields of the org.testifyproject.testifyprojectscriptors
* filled in by the system
* @throws IllegalArgumentException if there is an error in the input parameter
*/
public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors, boolean requiresDeepCopy);
/**
* This allows third party systems to add reified active org.testifyproject.testifyprojectscriptors to the system.
* The active org.testifyproject.testifyprojectscriptor given must be fully reified (isReified must return true) and
* the create and org.testifyproject.testifyprojectstroy methods must be implemented. A org.testifyproject.testifyprojectep copy will
* be made of the org.testifyproject.testifyprojectscriptor
*
* @param activeDescriptor The reified active org.testifyproject.testifyprojectscriptor to be added to the system. The
* system will not attempt to reify this org.testifyproject.testifyprojectscriptor itself
* @return The entry as added to the service registry, with fields
* of the Descriptor filled in by the system as appropriate
* @throws IllegalArgumentException if the org.testifyproject.testifyprojectscriptor is not reified
*/
public ActiveDescriptor addActiveDescriptor(ActiveDescriptor activeDescriptor)
throws IllegalArgumentException;
/**
* This allows third party systems to add reified active org.testifyproject.testifyprojectscriptors to the system.
* The active org.testifyproject.testifyprojectscriptor given must be fully reified (isReified must return true) and
* the create and org.testifyproject.testifyprojectstroy methods must be implemented. A org.testifyproject.testifyprojectep copy will
* be made of the org.testifyproject.testifyprojectscriptor
*
* @param activeDescriptor The reified active org.testifyproject.testifyprojectscriptor to be added to the system. The
* system will not attempt to reify this org.testifyproject.testifyprojectscriptor itself
* @param requiresDeepCopy If true a org.testifyproject.testifyprojectep copy will be made of the
* key. If false then the Descriptor will be used as is, and it
* is the responsibility of the caller to ensure that the fields
* of the Descriptor never change (with the exception of any
* writeable fields, such as ranking)
* @return The entry as added to the service registry, with fields
* of the Descriptor filled in by the system as appropriate
* @throws IllegalArgumentException if the org.testifyproject.testifyprojectscriptor is not reified
*/
public ActiveDescriptor addActiveDescriptor(ActiveDescriptor activeDescriptor, boolean requiresDeepCopy)
throws IllegalArgumentException;
/**
* This adds an active org.testifyproject.testifyprojectscriptor to the system based org.testifyproject.testifyprojectpletely on the analysis
* of the given class. The class itself and all interfaces marked contract will
* be in the list of advertised services. The scope and qualifiers will be taken
* from the annotations on the class.
*
* @param rawClass The class to analyze, must not be null
* @return The active (reified) org.testifyproject.testifyprojectscriptor that has been added to the system, with
* all fields filled in based on the rawClass
* @throws MultiException If this class cannot be a service
* @throws IllegalArgumentException if rawClass is null
*/
public ActiveDescriptor addActiveDescriptor(Class rawClass)
throws MultiException, IllegalArgumentException;
/**
* This filter will added to the list of filters in this Configuration that will
* org.testifyproject.testifyprojecttermine which Descriptors will be removed from the system. Only services directly
* from this Configuration objects' associated ServiceLocator will be given to this Filter
* (it will not be given org.testifyproject.testifyprojectscriptors from the ServiceLocators parent). The org.testifyproject.testifyprojectscriptors passed
* into this filter may be cast to {@link ActiveDescriptor}. The org.testifyproject.testifyprojectscriptors passed into this
* filter may or may not have been reified. This filter should not reify passed in org.testifyproject.testifyprojectscriptors.
*
* And org.testifyproject.testifyprojectscriptor for which this filter returns true will be removed from the
* {@link ServiceLocator} prior to any additions that are performed with this
* Configuration object. Hence a Configuration can remove and add a org.testifyproject.testifyprojectscriptor of the
* same type in one org.testifyproject.testifyprojectmit.
*
* In order to unbind a filter the caller of org.testifyproject.testifyprojectmit must pass the LOOKUP validators and the
* UNBIND validators.
*
* @param unbindFilter This filter will be added to the list of filters that this
* configuration object will use to org.testifyproject.testifyprojecttermine which org.testifyproject.testifyprojectscriptors to unbind from the system.
* May not be null
* @throws IllegalArgumentException if unbindFilter is null
*/
public void addUnbindFilter(Filter unbindFilter) throws IllegalArgumentException;
/**
* This causes the configuration to get org.testifyproject.testifyprojectmitted. This
* method may only be called once
*
* @throws MultiException If errors were found in the org.testifyproject.testifyprojectmit process
* @throws IllegalStateException if this method was called more than once
*/
public void org.testifyproject.testifyprojectmit() throws MultiException;
}