/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* 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
* 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.
*/
/**
* @author Jagadish Ramu
*/
new LocalStringManagerImpl(ResourceManager.class);
//Listen to config changes of resource refs.
//@Inject
//private ResourceRef[] resourceRefs;
//private Server server;
public void postConstruct() {
}
private void addListenerToResources(){
bean.addListener(this);
}
private void addListenerToServer() {
bean.addListener(this);
}
private void bindConnectorDescriptors() {
}
}
//these proxies are needed as appclient container may lookup descriptors
try {
} catch (NamingException e) {
}
}
/**
* deploy resources
* @param resources list
*/
if(resource instanceof BindableResource){
}
} else if (resource instanceof ResourcePool) {
// ignore, as they are loaded lazily
} else{
// only other resource types left are RAC, CWSM
try{
}catch(Exception e){
}
}
}
/* TODO V3
will there be a chance of double listener registration for a resource ?
eg: allresources added during startup, resources of a particular
connector during connector startup / redeploy ?
*/
}
boolean resourceEnabled = false;
}
boolean refEnabled = false;
if(resourceEnabled){
}
}
return resourceEnabled && refEnabled;
}
return domain.getResources();
}
/**
* Do cleanup of system-resource-adapter, resources, pools
*/
public void preDestroy() {
if (isConnectorRuntimeInitialized()) {
Collection<Resource> resources = ConnectorsUtil.getAllSystemRAResourcesAndPools(domain.getResources());
// clean up will take care of any system RA resources, pools
// (including pools via datasource-definition)
}
} else {
"resource-adapters shutdown, resources, pools cleanup");
}
}
}
private void removeListenerForServer() {
bean.removeListener(this);
}
}
return runtime;
}
/**
* undeploy the given set of resources<br>
* <b>care has to be taken for the case of dependent resources<br>
* eg : all resources need to be undeployed <br>
* before undeploying the pool that they refer to</b>
* @param resources list of resources
*/
try{
}catch(Exception e){
}finally{
}
}
}
/**
* Notification that @Configured objects that were injected have changed
*
* @param events list of changes
*/
}
/**
* Check whether connector-runtime is initialized.
* @return boolean representing connector-runtime initialization status.
*/
public boolean isConnectorRuntimeInitialized() {
// there will be only one implementation of connector-runtime
return inhabitant.isInstantiated();
}
return true; // to be safe
}
}
/**
* Notification of a change on a configuration object
*
* @param type type of change : ADD mean the changedInstance was added to the parent
* REMOVE means the changedInstance was removed from the parent, CHANGE means the
* changedInstance has mutated.
* @param changedType type of the configuration object
* @param changedInstance changed instance.
*/
public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> changedType, T changedInstance) {
try {
//use connector-classloader so as to get access to classes from resource-adapters
switch (type) {
case ADD:
}
break;
case CHANGE:
}
break;
case REMOVE:
}
break;
default:
break;
}
return np;
} finally {
}
}
//TODO V3 handle enabled / disabled / resource-ref / redeploy ?
try {
boolean enabledAttributeChange = false;
if (instance instanceof BindableResource) {
//method on deployer.
enabledAttributeChange = true;
if (newValue) {
} else {
}
}
}
}
}
}
if (!enabledAttributeChange) {
}
//Added in case of a property change
//check for validity of the property's parent and redeploy
} else if (instance instanceof ResourceRef) {
//method on deployer.
//both cannot be true or false
if (newValue) {
} else {
}
}
}
}
}
}
np = new NotProcessed(
"resources.resource-manager.change-event-failed",
"Change event failed"));
}
return np;
}
//Add listener to the changed instance object
if (instance instanceof BindableResource) {
//ignore - as bindable-resources are handled during resource-ref creation
} else if (instance instanceof ResourcePool) {
//ignore - as pools are handled lazily
//only resource type left are RAC and CWSM
try {
} catch (Exception e) {
}
//Property is not handled here. It is handled as part of the
//Change event of the resource.
} else if (instance instanceof ResourceRef) {
//create-resource-ref
}
}
return np;
}
try {
//this check ensures that a valid resource is handled
if (instance instanceof BindableResource) {
//ignore as bindable-resources will have resource-ref.
//Remove listener from the removed instance
//get appropriate deployer and undeploy resource
//Added in case of a property remove
//check for validity of the property's parent and redeploy
} else if (instance instanceof ResourceRef) {
//delete-resource-ref
//get appropriate deployer and undeploy resource
//Remove listener from the removed instance
}
np = new NotProcessed(
"resources.resource-manager.remove-event-failed",
"Remove event failed"));
}
return np;
}
}
/**
* Invoked from postConstruct()
* @param resources list of resources for which listeners will be registered.
*/
}
}
private void addListenerToResourceRefs() {
}
}
//Instead of injecting ResourceRef[] config array (which will inject all resource-refs in domain.xml
//including the ones in other server instances), get appropriate instance's resource-refs alone.
}
/**
* Add listener to a generic resource
* Used in the case of create asadmin command when listeners have to
* be added to the specific resource
* @param instance instance to which listener will be registered
*/
//add listener to all types of Resource
bean.addListener(this);
} else if(instance instanceof ResourceRef) {
bean.addListener(this);
}
}
/**
* Used in the case of delete asadmin command
* @param instance remove the resource from listening to resource events
*/
bean.removeListener(this);
} else if(instance instanceof ResourceRef) {
bean.removeListener(this);
}
}
/**
* Remove listener from all resource refs.
* Invoked from preDestroy().
*/
private void removeListenerForResourceRefs() {
}
}
private void removeListenerForResources(){
ObservableBean bean = (ObservableBean)ConfigSupport.getImpl((ConfigBeanProxy)domain.getResources());
bean.removeListener(this);
}
/**
* Connector Connection Pools/ Connector Resources.
* Invoked from preDestroy()
*/
private void removeListenerForAllResources() {
}
}
/**
* Given a <i>resource</i> instance, appropriate deployer will be provided
*
* @param resource resource instance
* @return ResourceDeployer
*/
return deployer;
}
}
return null;
}
}