001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Florent Guillaume
011 */
012
013package org.nuxeo.ecm.core.storage.sql.ra;
014
015import javax.resource.spi.ActivationSpec;
016import javax.resource.spi.BootstrapContext;
017import javax.resource.spi.ResourceAdapter;
018import javax.resource.spi.endpoint.MessageEndpointFactory;
019import javax.transaction.xa.XAResource;
020
021import org.apache.commons.logging.Log;
022import org.apache.commons.logging.LogFactory;
023
024/**
025 * This is the singleton representing the resource adapter, created by the application server.
026 * <p>
027 * It is the central point where all non-local state (network endpoints, etc.) is registered.
028 *
029 * @author Florent Guillaume
030 */
031public class ResourceAdapterImpl implements ResourceAdapter {
032
033    private static final Log log = LogFactory.getLog(ResourceAdapterImpl.class);
034
035    private String name;
036
037    /*
038     * ----- Java Bean-----
039     */
040
041    public void setName(String name) {
042        this.name = name;
043    }
044
045    public String getName() {
046        return name;
047    }
048
049    /*
050     * ----- javax.resource.spi.ResourceAdapter -----
051     */
052
053    @Override
054    public void start(BootstrapContext serverContext) {
055        log.debug("----------- starting resource adapter");
056    }
057
058    @Override
059    public void stop() {
060        log.debug("----------- stopping resource adapter");
061    }
062
063    @Override
064    public void endpointActivation(MessageEndpointFactory factory, ActivationSpec spec) {
065        throw new UnsupportedOperationException("Message endpoints not supported");
066    }
067
068    @Override
069    public void endpointDeactivation(MessageEndpointFactory factory, ActivationSpec spec) {
070        throw new UnsupportedOperationException("Message endpoints not supported");
071    }
072
073    /*
074     * Used during crash recovery.
075     */
076    @Override
077    public XAResource[] getXAResources(ActivationSpec[] specs) {
078        return new XAResource[0];
079    }
080
081}