001/*
002 * Copyright (c) 2006-2012 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 *   Stephane Lacoin
011 */
012package org.nuxeo.runtime.jtajca;
013
014import javax.naming.NamingException;
015
016import org.nuxeo.runtime.model.ComponentContext;
017import org.nuxeo.runtime.model.DefaultComponent;
018
019/**
020 * If this bundle is present in the running platform it should automatically install the NuxeoContainer.
021 *
022 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
023 */
024public class JtaActivator extends DefaultComponent {
025
026    public static final String AUTO_ACTIVATION = "null";
027
028    @Override
029    public void activate(ComponentContext context) {
030        try {
031            NuxeoContainer.install();
032        } catch (NamingException e) {
033            throw new RuntimeException(e);
034        }
035    }
036
037    @Override
038    public void deactivate(ComponentContext context) {
039        try {
040            NuxeoContainer.uninstall();
041        } catch (NamingException e) {
042            throw new RuntimeException(e);
043        }
044    }
045
046}