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