001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.fcrepo.http.commons;
019
020import org.fcrepo.http.commons.metrics.MicrometerFeature;
021import org.glassfish.jersey.jackson.JacksonFeature;
022import org.glassfish.jersey.logging.LoggingFeature;
023import org.glassfish.jersey.media.multipart.MultiPartFeature;
024import org.glassfish.jersey.server.ResourceConfig;
025
026import java.util.logging.Logger;
027
028import static org.slf4j.LoggerFactory.getLogger;
029
030/**
031 * @author cabeer
032 * @since 9/22/14
033 */
034public class FedoraApplication extends ResourceConfig {
035
036    private static final org.slf4j.Logger LOGGER = getLogger(FedoraApplication.class);
037
038    /**
039     * THIS IS OUR RESOURCE CONFIG!
040     */
041    public FedoraApplication() {
042        super();
043        packages("org.fcrepo");
044        register(MultiPartFeature.class);
045        register(JacksonFeature.class);
046        register(MicrometerFeature.class);
047
048        if (LOGGER.isDebugEnabled()) {
049            register(new LoggingFeature(Logger.getLogger(LoggingFeature.class.getName())));
050        }
051    }
052}