All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.encomendaz.services.ServicesClient Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
/*
 * EncomendaZ
 * 
 * Copyright (c) 2011, EncomendaZ .
 * All rights reserved.
 * 
 * EncomendaZ is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 3 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see 
 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA  02110-1301, USA.
 */
package net.encomendaz.services;

import java.util.ResourceBundle;

import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
import org.jboss.resteasy.client.ProxyFactory;
import org.jboss.resteasy.spi.ResteasyProviderFactory;

public class ServicesClient {

	private static ResourceBundle bundle;

	private static TrackingService trackingService;

	static {
		ResteasyProviderFactory.setRegisterBuiltinByDefault(false);
		ResteasyProviderFactory.getInstance().registerProvider(JacksonJsonProvider.class);
	}

	private ServicesClient() {
	}

	private static ResourceBundle getBundle() {
		if (bundle == null) {
			bundle = ResourceBundle.getBundle("encomendaz");
		}

		return bundle;
	}

	private static String getBaseURL() {
		return getBundle().getString("base-url");
	}

	public static TrackingService tracking() {
		if (trackingService == null) {
			trackingService = ProxyFactory.create(TrackingService.class, getBaseURL());
		}

		return trackingService;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy