/*
* 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.
*/
/**
* Resource manager to bind various application or module scoped resources during
* @author Jagadish Ramu
*/
public class ApplicationScopedResourcesManager implements PostStartup, PostConstruct, PreDestroy, ConfigListener {
private static final Logger _logger = LogDomains.getLogger(ResourceManager.class,LogDomains.RESOURCE_BUNDLE);
public void postConstruct() {
}
if(moduleResources != null){
}
}
}
}
}
}
return app.getResources();
}
return null;
}
if(appScopedResources != null){
}
if(moduleScopedResources != null){
}
}
}
}
}
/**
* deploy resources
* @param resources list
*/
if(parentObject instanceof Application){
}else if(parentObject instanceof Module){
}
if (resource instanceof BindableResource) {
} else if (resource instanceof ResourcePool) {
// ignore, as they are loaded lazily
} else {
// only other resources left are RAC, CWSM
try {
} catch (Exception e) {
}
}
}
}
}
/**
* 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
}
/**
* Do cleanup of system-resource-adapter, resources, pools
*/
public void preDestroy() {
if (isConnectorRuntimeInitialized()) {
}
if(moduleScopedResources != null){
}
}
}
}
}
} else {
"resource-adapters shutdown, resources, pools cleanup");
}
}
}
if(moduleScopedResources != null){
}
}
}
if(appScopedResources != null){
}
}
}
}
}
}
}
/**
* undeploy the given set of resources<br>
* resources (bindable) are removed first and then the pools
* @param resources list of resources
*/
//destroy all resources first and then pools
// no need to undeploy resource-adapter-config as it (config) will be removed by the end of undeploy
// operation of the application.
}
}
}
}
try{
}catch(Exception e){
}finally{
}
}
}
}
}
}
bean.addListener(this);
}
/**
* Connector Connection Pools/ Connector Resources.
* Invoked from preDestroy()
*/
}
}
}
/**
* Used in the case of delete asadmin command
* @param instance remove the resource from listening to resource events
*/
bean.removeListener(this);
}
/**
* Given a <i>resource</i> instance, appropriate deployer will be provided
*
* @param resource resource instance
* @return ResourceDeployer
*/
return deployer;
}
}
return null;
}
}
return runtime;
}
}
}
/**
* Notification that @Configured objects that were injected have changed
*
* @param events list of changes
*/
}
//TODO no need to store events ?
}
/**
* Notification of a change on a configuration object
*
* @param type CHANGE means the changedInstance has mutated.
* @param changedType type of the configuration object
* @param changedInstance changed instance.
*/
T changedInstance) {
try {
//use connector-class-loader 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 {
}
}
if(instance instanceof Application){
}
}
}
}
}
return np;
}
if(instance instanceof Application){
}
}
}
}
return np;
}
//TODO V3 handle enabled / disabled /redeploy ?
debug("handling change event");
try {
}
}
//Added in case of a property change
//check for validity of the property's parent and redeploy
}
"Error while handling change Event";
}
return np;
}
}
if(resource instanceof ResourcePool){
boolean ping = false;
if(pool instanceof JdbcConnectionPool){
}else if (pool instanceof ConnectorConnectionPool) {
}
if(ping){
}else{
}
}
}
}
}
}
}
}