======================
LOOK! LICENSING TERMS
======================
look! is licensed under the BSD 3-Clause (also known as "BSD New" or
"BSD Simplified"), as follows:
Copyright (c) 2010-2012, Look...
If you think the Android project Look listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
*-----------------------------------------------------------------------------
* Copyright (c) 2012, Look! Development Team
* All rights reserved./*fromwww.java2s.com*/
*
* Distributed under the terms of the BSD Simplified License.
*
* The full license is in the LICENSE file, distributed with this software.
*-----------------------------------------------------------------------------
*/package es.ucm.look.data.remote;
/**
* To configure the data remote service. Need a URL for connect the server and
* another one to download the binaries files.
*
* @author Sergio
*
*/publicclass ConfigNet {
privateboolean connected = false;
private String serverURL;
private String filesURL;
privatestatic ConfigNet instance;
/**
* Constructor class
*
* @param connected
* If the server will be connected
* @param serverURL
* URL from Server
* @param filesURL
* URL from Files, where its are downloads
*/private ConfigNet(boolean connected, String serverURL, String filesURL) {
this.connected = connected;
this.serverURL = serverURL;
this.filesURL = filesURL;
}
/**
* Sets the server configuration
*
* @param serverUrl
* server url
* @param filesURL
* url where files will be downloaded
*/publicstaticvoid setNetConfiguration(String serverUrl, String filesURL) {
instance = new ConfigNet(true, serverUrl, filesURL);
}
/**
* Get an unique instance, Singleton class.
* @return
*/publicstatic ConfigNet getInstance() {
if (instance == null)
instance = new ConfigNet(false, null, null);
return instance;
}
/**
* Returns if it exists a server for the app
*
* @return if it exists a server for the app
*/publicboolean isConnected() {
return connected;
}
/**
* To change the server url.
*
* @param URL
*/publicvoid setServerURL(String URL) {
serverURL = URL;
}
/**
* To change the URL files directory.
*
* @param URL
* New URL
*/publicvoid setFilesURL(String URL) {
filesURL = URL;
}
/**
* Retrieve the URL of an element from Server
*
* @param suburl
* Suburl to know the main URL
* @return
* The complete URL
*
*/public String getURL(String suburl) {
return serverURL + suburl;
}
/**
* Retrieve the URL of an element from Files
*
* @param suburl
* Suburl to know the main URL
* @return
* The complete URL
*
*/public String getFilesURL(String suburl) {
return filesURL + suburl;
}
}