001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019 020package org.nuxeo.ecm.core.storage.sql.ra; 021 022import javax.resource.spi.ActivationSpec; 023import javax.resource.spi.BootstrapContext; 024import javax.resource.spi.ResourceAdapter; 025import javax.resource.spi.endpoint.MessageEndpointFactory; 026import javax.transaction.xa.XAResource; 027 028import org.apache.commons.logging.Log; 029import org.apache.commons.logging.LogFactory; 030 031/** 032 * This is the singleton representing the resource adapter, created by the application server. 033 * <p> 034 * It is the central point where all non-local state (network endpoints, etc.) is registered. 035 * 036 * @author Florent Guillaume 037 */ 038public class ResourceAdapterImpl implements ResourceAdapter { 039 040 private static final Log log = LogFactory.getLog(ResourceAdapterImpl.class); 041 042 private String name; 043 044 /* 045 * ----- Java Bean----- 046 */ 047 048 public void setName(String name) { 049 this.name = name; 050 } 051 052 public String getName() { 053 return name; 054 } 055 056 /* 057 * ----- javax.resource.spi.ResourceAdapter ----- 058 */ 059 060 @Override 061 public void start(BootstrapContext serverContext) { 062 log.debug("----------- starting resource adapter"); 063 } 064 065 @Override 066 public void stop() { 067 log.debug("----------- stopping resource adapter"); 068 } 069 070 @Override 071 public void endpointActivation(MessageEndpointFactory factory, ActivationSpec spec) { 072 throw new UnsupportedOperationException("Message endpoints not supported"); 073 } 074 075 @Override 076 public void endpointDeactivation(MessageEndpointFactory factory, ActivationSpec spec) { 077 throw new UnsupportedOperationException("Message endpoints not supported"); 078 } 079 080 /* 081 * Used during crash recovery. 082 */ 083 @Override 084 public XAResource[] getXAResources(ActivationSpec[] specs) { 085 return new XAResource[0]; 086 } 087 088}