conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
=======
import de.schildbach.wallet.R;
>>>>>>>
<<<<<<<
public static final String MIMETYPE_TRANSACTION = "application/x-" + CoinDefinition.coinTicker.toLowerCase() + "tx";
=======
public static final String MIMETYPE_PAYMENTREQUEST = "application/bitcoin-paymentrequest"; // BIP 71
public static final String MIMETYPE_PAYMENT = "application/bitcoin-payment"; // BIP 71
public static final String MIMETYPE_PAYMENTACK = "application/bitcoin-paymentack"; // BIP 71
public static final String MIMETYPE_TRANSACTION = "application/x-btctx";
>>>>>>>
public static final String MIMETYPE_PAYMENTREQUEST = "application/"+ CoinDefinition.coinTicker.toLowerCase() +"-paymentrequest"; // BIP 71
public static final String MIMETYPE_PAYMENT = "application/"+ CoinDefinition.coinTicker.toLowerCase() +"-payment"; // BIP 71
public static final String MIMETYPE_PAYMENTACK = "application/"+ CoinDefinition.coinTicker.toLowerCase() +"-paymentack"; // BIP 71
public static final String MIMETYPE_TRANSACTION = "application/x-" + CoinDefinition.coinTicker.toLowerCase() + "tx"; |
<<<<<<<
import org.schabi.newpipe.extractor.ServiceList;
=======
import org.schabi.newpipe.extractor.NewPipe;
>>>>>>>
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ServiceList; |
<<<<<<<
final boolean lastOrientationWasLandscape = defaultPreferences.getBoolean(
getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
=======
final boolean lastOrientationWasLandscape = defaultPreferences
.getBoolean(getString(R.string.last_orientation_landscape_key), false);
>>>>>>>
final boolean lastOrientationWasLandscape = defaultPreferences
.getBoolean(getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
<<<<<<<
boolean lastOrientationWasLandscape = defaultPreferences.getBoolean(
getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
=======
boolean lastOrientationWasLandscape = defaultPreferences
.getBoolean(getString(R.string.last_orientation_landscape_key), false);
>>>>>>>
boolean lastOrientationWasLandscape = defaultPreferences
.getBoolean(getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
<<<<<<<
public void safeHideControls(long duration, long delay) {
if (DEBUG) Log.d(TAG, "safeHideControls() called with: delay = [" + delay + "]");
View controlsRoot = getControlsRoot();
if (controlsRoot.isInTouchMode()) {
getControlsVisibilityHandler().removeCallbacksAndMessages(null);
getControlsVisibilityHandler().postDelayed(
() -> animateView(controlsRoot, false, duration, 0, MainVideoPlayer.this::hideSystemUi), delay);
}
}
@Override
public void hideControls(final long duration, long delay) {
if (DEBUG) Log.d(TAG, "hideControls() called with: delay = [" + delay + "]");
=======
public void hideControls(final long duration, final long delay) {
if (DEBUG) {
Log.d(TAG, "hideControls() called with: delay = [" + delay + "]");
}
>>>>>>>
public void safeHideControls(long duration, final long delay) {
if (DEBUG) {
Log.d(TAG, "safeHideControls() called with: delay = [" + delay + "]");
}
View controlsRoot = getControlsRoot();
if (controlsRoot.isInTouchMode()) {
getControlsVisibilityHandler().removeCallbacksAndMessages(null);
getControlsVisibilityHandler().postDelayed(
() -> animateView(controlsRoot, false, duration, 0, MainVideoPlayer.this::hideSystemUi), delay);
}
}
@Override
public void hideControls(final long duration, final long delay) {
if (DEBUG) {
Log.d(TAG, "hideControls() called with: delay = [" + delay + "]");
} |
<<<<<<<
=======
import de.schildbach.wallet_test.R;
import android.app.ListFragment;
>>>>>>>
import android.app.ListFragment;
<<<<<<<
import hashengineering.darkcoin.wallet.R;
=======
>>>>>>>
import de.schildbach.wallet_test.R; |
<<<<<<<
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import hashengineering.darkcoin.wallet.R;
=======
import android.view.Menu;
import android.view.MenuItem;
import de.schildbach.wallet_test.R;
>>>>>>>
import android.view.Menu;
import android.view.MenuItem;
import hashengineering.darkcoin.wallet.R; |
<<<<<<<
=======
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
>>>>>>>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
<<<<<<<
public final class Constants
{
public static final boolean TEST = BuildConfig.APPLICATION_ID.contains("_test");
=======
public final class Constants {
public static final boolean TEST = R.class.getPackage().getName().contains("_test");
/** Network this wallet is on (e.g. testnet or mainnet). */
public static final NetworkParameters NETWORK_PARAMETERS = TEST ? TestNet3Params.get() : MainNetParams.get();
/** Bitcoinj global context. */
public static final Context CONTEXT = new Context(NETWORK_PARAMETERS);
public final static class Files {
private static final String FILENAME_NETWORK_SUFFIX = NETWORK_PARAMETERS.getId()
.equals(NetworkParameters.ID_MAINNET) ? "" : "-testnet";
/** Filename of the wallet. */
public static final String WALLET_FILENAME_PROTOBUF = "wallet-protobuf" + FILENAME_NETWORK_SUFFIX;
/** How often the wallet is autosaved. */
public static final long WALLET_AUTOSAVE_DELAY_MS = 5 * DateUtils.SECOND_IN_MILLIS;
/** Filename of the automatic key backup (old format, can only be read). */
public static final String WALLET_KEY_BACKUP_BASE58 = "key-backup-base58" + FILENAME_NETWORK_SUFFIX;
/** Filename of the automatic wallet backup. */
public static final String WALLET_KEY_BACKUP_PROTOBUF = "key-backup-protobuf" + FILENAME_NETWORK_SUFFIX;
>>>>>>>
public final class Constants
{
public static final boolean TEST = BuildConfig.APPLICATION_ID.contains("_test");
/** Network this wallet is on (e.g. testnet or mainnet). */
public static final NetworkParameters NETWORK_PARAMETERS = TEST ? TestNet3Params.get() : MainNetParams.get();
/** Bitcoinj global context. */
public static final Context CONTEXT = new Context(NETWORK_PARAMETERS);
public final static class Files {
private static final String FILENAME_NETWORK_SUFFIX = NETWORK_PARAMETERS.getId()
.equals(NetworkParameters.ID_MAINNET) ? "" : "-testnet";
/** Filename of the wallet. */
public static final String WALLET_FILENAME_PROTOBUF = "wallet-protobuf" + FILENAME_NETWORK_SUFFIX;
/** How often the wallet is autosaved. */
public static final long WALLET_AUTOSAVE_DELAY_MS = 5 * DateUtils.SECOND_IN_MILLIS;
/** Filename of the automatic key backup (old format, can only be read). */
public static final String WALLET_KEY_BACKUP_BASE58 = "key-backup-base58" + FILENAME_NETWORK_SUFFIX;
/** Filename of the automatic wallet backup. */
public static final String WALLET_KEY_BACKUP_PROTOBUF = "key-backup-protobuf" + FILENAME_NETWORK_SUFFIX; |
<<<<<<<
import de.schildbach.wallet.util.GenericUtils;
import de.schildbach.wallet.util.WalletUtils;
import hashengineering.darkcoin.wallet.R;
=======
import de.schildbach.wallet.util.MonetarySpannable;
import de.schildbach.wallet_test.R;
>>>>>>>
import hashengineering.darkcoin.wallet.R;
import de.schildbach.wallet.util.MonetarySpannable; |
<<<<<<<
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.params.MainNetParams;
import com.google.bitcoin.params.TestNet3Params;
import org.bitcoinj.core.CoinDefinition;
=======
import de.schildbach.wallet_test.R;
>>>>>>>
import org.bitcoinj.core.CoinDefinition;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.TestNet3Params;
import org.bitcoinj.utils.MonetaryFormat;
import java.io.File;
<<<<<<<
public static final File EXTERNAL_WALLET_BACKUP_DIR = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
public static final String EXTERNAL_WALLET_KEY_BACKUP = CoinDefinition.coinName +"-wallet-keys" + FILENAME_NETWORK_SUFFIX;
=======
/** Filename of the manual wallet backup. */
public static final String EXTERNAL_WALLET_BACKUP = "bitcoin-wallet-backup" + FILENAME_NETWORK_SUFFIX;
>>>>>>>
/** Filename of the manual wallet backup. */
public static final String EXTERNAL_WALLET_BACKUP = CoinDefinition.coinName +"bitcoin-wallet-backup" + FILENAME_NETWORK_SUFFIX;
<<<<<<<
private static final String EXPLORE_BASE_URL_PROD = CoinDefinition.BLOCKEXPLORER_BASE_URL_PROD;
private static final String EXPLORE_BASE_URL_TEST = CoinDefinition.BLOCKEXPLORER_BASE_URL_TEST;
=======
private static final String EXPLORE_BASE_URL_PROD = "https://www.biteasy.com/";
private static final String EXPLORE_BASE_URL_TEST = "https://www.biteasy.com/testnet/";
/** Base URL for browsing transactions, blocks or addresses. */
>>>>>>>
private static final String EXPLORE_BASE_URL_PROD = CoinDefinition.BLOCKEXPLORER_BASE_URL_PROD;
private static final String EXPLORE_BASE_URL_TEST = CoinDefinition.BLOCKEXPLORER_BASE_URL_TEST;
/** Base URL for browsing transactions, blocks or addresses. */
<<<<<<<
=======
private static final String BITEASY_API_URL_PROD = "https://api.biteasy.com/blockchain/v1/";
private static final String BITEASY_API_URL_TEST = "https://api.biteasy.com/testnet/v1/";
/** Base URL for blockchain API. */
public static final String BITEASY_API_URL = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? BITEASY_API_URL_PROD
: BITEASY_API_URL_TEST;
/** URL to fetch version alerts from. */
public static final String VERSION_URL = "http://wallet.schildbach.de/version";
/** MIME type used for transmitting single transactions. */
public static final String MIMETYPE_TRANSACTION = "application/x-btctx";
>>>>>>>
private static final String BITEASY_API_URL_PROD = "https://api.biteasy.com/blockchain/v1/";
private static final String BITEASY_API_URL_TEST = "https://api.biteasy.com/testnet/v1/";
/** Base URL for blockchain API. */
public static final String BITEASY_API_URL = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? BITEASY_API_URL_PROD
: BITEASY_API_URL_TEST;
/** URL to fetch version alerts from. */
public static final String VERSION_URL = "http://wallet.schildbach.de/version";
/** MIME type used for transmitting single transactions. */
public static final String MIMETYPE_TRANSACTION = "application/x-" + CoinDefinition.coinTicker.toLowerCase() + "tx";
<<<<<<<
public static final String USER_AGENT = CoinDefinition.coinName +" Wallet";
=======
/** User-agent to use for network access. */
public static final String USER_AGENT = "Bitcoin Wallet";
/** Default currency to use if all default mechanisms fail. */
>>>>>>>
/** User-agent to use for network access. */
public static final String USER_AGENT = CoinDefinition.coinName +" Wallet";
/** Default currency to use if all default mechanisms fail. */
<<<<<<<
public static final String CURRENCY_CODE_BTC = CoinDefinition.coinTicker;
public static final String CURRENCY_CODE_MBTC = "m" + CoinDefinition.coinTicker;
public static final String CURRENCY_CODE_UBTC = "µ" + CoinDefinition.coinTicker;
=======
/** Donation address for tip/donate action. */
public static final String DONATION_ADDRESS = "18CK5k1gajRKKSC7yVSTXT9LUzbheh1XY4";
/** Recipient e-mail address for reports. */
public static final String REPORT_EMAIL = "[email protected]";
/** Subject line for manually reported issues. */
public static final String REPORT_SUBJECT_ISSUE = "Reported issue";
/** Subject line for crash reports. */
public static final String REPORT_SUBJECT_CRASH = "Crash report";
>>>>>>>
/** Donation address for tip/donate action. */
public static final String DONATION_ADDRESS = CoinDefinition.DONATION_ADDRESS;
/** Recipient e-mail address for reports. */
public static final String REPORT_EMAIL = "[email protected]";
/** Subject line for manually reported issues. */
public static final String REPORT_SUBJECT_ISSUE = "Reported issue";
/** Subject line for crash reports. */
public static final String REPORT_SUBJECT_CRASH = "Crash report";
<<<<<<<
public static final String MARKET_PUBLISHER_URL = "market://search?q=pub:\"Hash Engineering Solutions\"";
=======
>>>>>>> |
<<<<<<<
import hashengineering.darkcoin.wallet.R;
=======
import android.view.WindowManager;
import de.schildbach.wallet_test.R;
>>>>>>>
import hashengineering.darkcoin.wallet.R;
import android.view.WindowManager; |
<<<<<<<
private static Object getCoinValueBTC()
{
Date date = new Date();
long now = date.getTime();
//final Map<String, ExchangeRate> rates = new TreeMap<String, ExchangeRate>();
// Keep the LTC rate around for a bit
Double btcRate = 0.0;
String currencyCryptsy = CoinDefinition.cryptsyMarketCurrency;
String urlCryptsy = "http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid="+ CoinDefinition.cryptsyMarketId;
try {
// final String currencyCode = currencies[i];
final URL URLCryptsy = new URL(urlCryptsy);
final URLConnection connectionCryptsy = URLCryptsy.openConnection();
connectionCryptsy.setConnectTimeout(Constants.HTTP_TIMEOUT_MS * 2);
connectionCryptsy.setReadTimeout(Constants.HTTP_TIMEOUT_MS * 2);
connectionCryptsy.connect();
final StringBuilder contentCryptsy = new StringBuilder();
Reader reader = null;
try
{
reader = new InputStreamReader(new BufferedInputStream(connectionCryptsy.getInputStream(), 1024));
Io.copy(reader, contentCryptsy);
final JSONObject head = new JSONObject(contentCryptsy.toString());
JSONObject returnObject = head.getJSONObject("return");
JSONObject markets = returnObject.getJSONObject("markets");
JSONObject coinInfo = markets.getJSONObject(CoinDefinition.coinTicker);
JSONArray recenttrades = coinInfo.getJSONArray("recenttrades");
double btcTraded = 0.0;
double coinTraded = 0.0;
for(int i = 0; i < recenttrades.length(); ++i)
{
JSONObject trade = (JSONObject)recenttrades.get(i);
btcTraded += trade.getDouble("total");
coinTraded += trade.getDouble("quantity");
}
Double averageTrade = btcTraded / coinTraded;
//Double lastTrade = GLD.getDouble("lasttradeprice");
//String euros = String.format("%.7f", averageTrade);
// Fix things like 3,1250
//euros = euros.replace(",", ".");
//rates.put(currencyCryptsy, new ExchangeRate(currencyCryptsy, Utils.toNanoCoins(euros), URLCryptsy.getHost()));
if(currencyCryptsy.equalsIgnoreCase("BTC")) btcRate = averageTrade;
}
finally
{
if (reader != null)
reader.close();
}
return btcRate;
}
catch (final IOException x)
{
x.printStackTrace();
}
catch (final JSONException x)
{
x.printStackTrace();
}
return null;
}
private static Map<String, ExchangeRate> getBitcoinCharts()
=======
private static Map<String, ExchangeRate> requestExchangeRates(final URL url, final String... fields)
>>>>>>>
private static Object getCoinValueBTC()
{
Date date = new Date();
long now = date.getTime();
//final Map<String, ExchangeRate> rates = new TreeMap<String, ExchangeRate>();
// Keep the LTC rate around for a bit
Double btcRate = 0.0;
String currencyCryptsy = CoinDefinition.cryptsyMarketCurrency;
String urlCryptsy = "http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid="+ CoinDefinition.cryptsyMarketId;
try {
// final String currencyCode = currencies[i];
final URL URLCryptsy = new URL(urlCryptsy);
final URLConnection connectionCryptsy = URLCryptsy.openConnection();
connectionCryptsy.setConnectTimeout(Constants.HTTP_TIMEOUT_MS * 2);
connectionCryptsy.setReadTimeout(Constants.HTTP_TIMEOUT_MS * 2);
connectionCryptsy.connect();
final StringBuilder contentCryptsy = new StringBuilder();
Reader reader = null;
try
{
reader = new InputStreamReader(new BufferedInputStream(connectionCryptsy.getInputStream(), 1024));
Io.copy(reader, contentCryptsy);
final JSONObject head = new JSONObject(contentCryptsy.toString());
JSONObject returnObject = head.getJSONObject("return");
JSONObject markets = returnObject.getJSONObject("markets");
JSONObject coinInfo = markets.getJSONObject(CoinDefinition.coinTicker);
JSONArray recenttrades = coinInfo.getJSONArray("recenttrades");
double btcTraded = 0.0;
double coinTraded = 0.0;
for(int i = 0; i < recenttrades.length(); ++i)
{
JSONObject trade = (JSONObject)recenttrades.get(i);
btcTraded += trade.getDouble("total");
coinTraded += trade.getDouble("quantity");
}
Double averageTrade = btcTraded / coinTraded;
//Double lastTrade = GLD.getDouble("lasttradeprice");
//String euros = String.format("%.7f", averageTrade);
// Fix things like 3,1250
//euros = euros.replace(",", ".");
//rates.put(currencyCryptsy, new ExchangeRate(currencyCryptsy, Utils.toNanoCoins(euros), URLCryptsy.getHost()));
if(currencyCryptsy.equalsIgnoreCase("BTC")) btcRate = averageTrade;
}
finally
{
if (reader != null)
reader.close();
}
return btcRate;
}
catch (final IOException x)
{
x.printStackTrace();
}
catch (final JSONException x)
{
x.printStackTrace();
}
return null;
}
private static Map<String, ExchangeRate> requestExchangeRates(final URL url, final String... fields)
<<<<<<<
Double btcRate = 0.0;
Object result = getCoinValueBTC();
if(result == null)
return null;
else btcRate = (Double)result;
final URL URL = new URL("http://api.bitcoincharts.com/v1/weighted_prices.json");
final HttpURLConnection connection = (HttpURLConnection) URL.openConnection();
=======
connection = (HttpURLConnection) url.openConnection();
>>>>>>>
Double btcRate = 0.0;
Object result = getCoinValueBTC();
if(result == null)
return null;
else btcRate = (Double)result;
connection = (HttpURLConnection) url.openConnection();
<<<<<<<
rates.put(currencyCode, new ExchangeRate(currencyCode, Utils.toNanoCoins(rate.replace(",", ".")), URL.getHost()));
=======
rates.put(currencyCode, new ExchangeRate(currencyCode, GenericUtils.toNanoCoins(rate, 0), url.getHost()));
>>>>>>>
rates.put(currencyCode, new ExchangeRate(currencyCode, GenericUtils.toNanoCoins(rate.replace(",", "."), 0), url.getHost())); |
<<<<<<<
import org.bitcoinj.core.CoinDefinition;
=======
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.protocols.payments.PaymentProtocol;
import org.bitcoinj.uri.BitcoinURI;
>>>>>>>
import org.bitcoinj.core.CoinDefinition;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.protocols.payments.PaymentProtocol;
import org.bitcoinj.uri.BitcoinURI; |
<<<<<<<
PreferenceManager.setDefaultValues(this, R.xml.preference_settings, false);
config = new Configuration(PreferenceManager.getDefaultSharedPreferences(this));
=======
config = new Configuration(PreferenceManager.getDefaultSharedPreferences(this), getResources());
>>>>>>>
PreferenceManager.setDefaultValues(this, R.xml.preference_settings, false);
config = new Configuration(PreferenceManager.getDefaultSharedPreferences(this), getResources()); |
<<<<<<<
import de.schildbach.wallet.digitalcoin.R;
=======
import de.schildbach.wallet.R;
>>>>>>>
import de.schildbach.wallet.digitalcoin.R;
<<<<<<<
private static final String KEY_ABOUT_CREDITS_WEBSITE = "about_credits_website";
private static final String KEY_ABOUT_CREDITS_FORUM = "about_credits_forum";
=======
private static final String KEY_ABOUT_CREDITS_BITCOINJ = "about_credits_bitcoinj";
private static final String KEY_ABOUT_CREDITS_ZXING = "about_credits_zxing";
private static final String KEY_ABOUT_CREDITS_ICON = "about_credits_icon";
>>>>>>>
private static final String KEY_ABOUT_CREDITS_WEBSITE = "about_credits_website";
private static final String KEY_ABOUT_CREDITS_FORUM = "about_credits_forum";
private static final String KEY_ABOUT_CREDITS_BITCOINJ = "about_credits_bitcoinj";
private static final String KEY_ABOUT_CREDITS_ZXING = "about_credits_zxing";
private static final String KEY_ABOUT_CREDITS_ICON = "about_credits_icon";
<<<<<<<
findPreference(KEY_ABOUT_SOURCE).setSummary(Constants.FORKED_FROM_SOURCE +Constants.SOURCE_URL);
=======
findPreference(KEY_ABOUT_SOURCE).setSummary(Constants.SOURCE_URL);
findPreference(KEY_ABOUT_MARKET_PUBLISHER).setSummary(Constants.MARKET_PUBLISHER_URL);
>>>>>>>
findPreference(KEY_ABOUT_SOURCE).setSummary(Constants.FORKED_FROM_SOURCE +Constants.SOURCE_URL);
findPreference(KEY_ABOUT_MARKET_PUBLISHER).setSummary(Constants.MARKET_PUBLISHER_URL);
<<<<<<<
//findPreference(KEY_ABOUT_CREDITS_ICON).setSummary(Constants.CREDITS_ICON_URL);
//findPreference(KEY_ABOUT_MARKET_APP).setSummary(String.format(Constants.MARKET_APP_URL, getPackageName()));
//findPreference(KEY_ABOUT_MARKET_PUBLISHER).setSummary(Constants.MARKET_PUBLISHER_URL);
findPreference(KEY_ABOUT_CREDITS_WEBSITE).setSummary(Constants.CREDITS_WEBSITE_URL);
findPreference(KEY_ABOUT_CREDITS_FORUM).setSummary(Constants.CREDITS_FORUM_URL);
=======
findPreference(KEY_ABOUT_CREDITS_ICON).setSummary(Constants.CREDITS_ICON_URL);
>>>>>>>
//findPreference(KEY_ABOUT_CREDITS_ICON).setSummary(Constants.CREDITS_ICON_URL);
findPreference(KEY_ABOUT_MARKET_APP).setSummary(String.format(Constants.MARKET_APP_URL, getPackageName()));
//findPreference(KEY_ABOUT_MARKET_PUBLISHER).setSummary(Constants.MARKET_PUBLISHER_URL);
findPreference(KEY_ABOUT_CREDITS_WEBSITE).setSummary(Constants.CREDITS_WEBSITE_URL);
findPreference(KEY_ABOUT_CREDITS_FORUM).setSummary(Constants.CREDITS_FORUM_URL);
<<<<<<<
}*/
/*else if (KEY_ABOUT_MARKET_APP.equals(key))
=======
}
else if (KEY_ABOUT_MARKET_PUBLISHER.equals(key))
>>>>>>>
}
else if (KEY_ABOUT_MARKET_PUBLISHER.equals(key)) |
<<<<<<<
=======
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
import com.aricneto.twistytimer.utils.Broadcaster;
>>>>>>>
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
<<<<<<<
import butterknife.Unbinder;
import static com.aricneto.twistytimer.utils.TTIntent.*;
=======
import co.mobiwise.materialintro.shape.FocusGravity;
import co.mobiwise.materialintro.view.MaterialIntroView;
>>>>>>>
import butterknife.Unbinder;
import co.mobiwise.materialintro.shape.FocusGravity;
import co.mobiwise.materialintro.view.MaterialIntroView;
import static com.aricneto.twistytimer.utils.TTIntent.*;
<<<<<<<
public MaterialSheetFab<Fab> materialSheetFab;
=======
private static final String SHOWCASE_FAB_ID = "SHOWCASE_FAB_ID";
private static final int TASK_LOADER_ID = 14;
private MaterialSheetFab<Fab> materialSheetFab;
DatabaseHandler dbHandler;
>>>>>>>
private static final String SHOWCASE_FAB_ID = "SHOWCASE_FAB_ID";
private MaterialSheetFab<Fab> materialSheetFab;
<<<<<<<
View.OnClickListener clickListener = new View.OnClickListener() {
=======
private TimeTaskLoader timeTaskLoader;
private Context mContext;
private View.OnClickListener clickListener = new View.OnClickListener() {
>>>>>>>
private View.OnClickListener clickListener = new View.OnClickListener() {
<<<<<<<
// Receives broadcasts after changes have been made to time data or the selection of that data.
private TTFragmentBroadcastReceiver mTimeDataChangedReceiver
= new TTFragmentBroadcastReceiver(this, CATEGORY_TIME_DATA_CHANGES) {
@Override
public void onReceiveWhileAdded(Context context, Intent intent) {
switch (intent.getAction()) {
case ACTION_TIME_ADDED:
// When "history" is enabled, the list of times does not include times from
// the current session. Times are only added to the current session, so
// there is no need to refresh the "history" list on adding a session time.
if (! history)
reloadList();
break;
case ACTION_TIMES_MODIFIED:
reloadList();
break;
case ACTION_HISTORY_TIMES_SHOWN:
history = true;
reloadList();
break;
case ACTION_SESSION_TIMES_SHOWN:
history = false;
reloadList();
break;
}
}
};
// Receives broadcasts about UI interactions that require actions to be taken.
private TTFragmentBroadcastReceiver mUIInteractionReceiver
= new TTFragmentBroadcastReceiver(this, CATEGORY_UI_INTERACTIONS) {
=======
// Receives broadcasts from the timer
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
>>>>>>>
// Receives broadcasts after changes have been made to time data or the selection of that data.
private TTFragmentBroadcastReceiver mTimeDataChangedReceiver
= new TTFragmentBroadcastReceiver(this, CATEGORY_TIME_DATA_CHANGES) {
@Override
public void onReceiveWhileAdded(Context context, Intent intent) {
switch (intent.getAction()) {
case ACTION_TIME_ADDED:
// When "history" is enabled, the list of times does not include times from
// the current session. Times are only added to the current session, so
// there is no need to refresh the "history" list on adding a session time.
if (! history)
reloadList();
break;
case ACTION_TIMES_MODIFIED:
reloadList();
break;
case ACTION_HISTORY_TIMES_SHOWN:
history = true;
reloadList();
break;
case ACTION_SESSION_TIMES_SHOWN:
history = false;
reloadList();
break;
}
}
};
// Receives broadcasts about UI interactions that require actions to be taken.
private TTFragmentBroadcastReceiver mUIInteractionReceiver
= new TTFragmentBroadcastReceiver(this, CATEGORY_UI_INTERACTIONS) {
<<<<<<<
public void onDestroyView() {
super.onDestroyView();
mUnbinder.unbind();
}
@Override
=======
public void setUserVisibleHint(boolean isVisibleToUser) {
if (DEBUG_ME) Log.d(TAG, "setUserVisibleHint(isVisibleToUser=" + isVisibleToUser);
super.setUserVisibleHint(isVisibleToUser);
if (isResumed()) {
if (isVisibleToUser) {
if (fabButton != null) {
// Show FAB and intro (if intro was not already dismissed by the user in a
// previous session) if the fragment has become visible.
fabButton.show();
new MaterialIntroView.Builder(getActivity())
.enableDotAnimation(false)
.setFocusGravity(FocusGravity.CENTER)
.setDelayMillis(600)
.enableFadeAnimation(true)
.enableIcon(false)
.performClick(true)
.dismissOnTouch(true)
.setInfoText(getString(R.string.showcase_fab_average))
.setTarget(fabButton)
.setUsageId(SHOWCASE_FAB_ID)
.show();
}
} else if (materialSheetFab != null) {
// Hide sheet and FAB if the fragment is no longer visible.
materialSheetFab.hideSheetThenFab();
}
}
}
/**
* Hides the sheet for the floating action button, if the sheet is currently open.
*
* @return
* {@code true} if the "Back" button press was consumed to close the sheet; or
* {@code false} if the sheet is not showing and the "Back" button press was ignored.
*/
@Override
public boolean onBackPressedInFragment() {
if (DEBUG_ME) Log.d(TAG, "onBackPressedInFragment()");
if (isResumed() && materialSheetFab != null && materialSheetFab.isSheetVisible()) {
materialSheetFab.hideSheet();
return true;
}
return false;
}
@Override
public void onDestroyView() {
if (DEBUG_ME) Log.d(TAG, "onDestroyView()");
super.onDestroyView();
ButterKnife.unbind(this);
}
@Override
>>>>>>>
public void onDestroyView() {
if (DEBUG_ME) Log.d(TAG, "onDestroyView()");
super.onDestroyView();
mUnbinder.unbind();
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
if (DEBUG_ME) Log.d(TAG, "setUserVisibleHint(isVisibleToUser=" + isVisibleToUser);
super.setUserVisibleHint(isVisibleToUser);
if (isResumed()) {
if (isVisibleToUser) {
if (fabButton != null) {
// Show FAB and intro (if intro was not already dismissed by the user in a
// previous session) if the fragment has become visible.
fabButton.show();
new MaterialIntroView.Builder(getActivity())
.enableDotAnimation(false)
.setFocusGravity(FocusGravity.CENTER)
.setDelayMillis(600)
.enableFadeAnimation(true)
.enableIcon(false)
.performClick(true)
.dismissOnTouch(true)
.setInfoText(getString(R.string.showcase_fab_average))
.setTarget(fabButton)
.setUsageId(SHOWCASE_FAB_ID)
.show();
}
} else if (materialSheetFab != null) {
// Hide sheet and FAB if the fragment is no longer visible.
materialSheetFab.hideSheetThenFab();
}
}
}
/**
* Hides the sheet for the floating action button, if the sheet is currently open.
*
* @return
* {@code true} if the "Back" button press was consumed to close the sheet; or
* {@code false} if the sheet is not showing and the "Back" button press was ignored.
*/
@Override
public boolean onBackPressedInFragment() {
if (DEBUG_ME) Log.d(TAG, "onBackPressedInFragment()");
if (isResumed() && materialSheetFab != null && materialSheetFab.isSheetVisible()) {
materialSheetFab.hideSheet();
return true;
}
return false;
}
@Override
<<<<<<<
return new TimeTaskLoader(currentPuzzle, currentPuzzleSubtype, history);
=======
if (DEBUG_ME) Log.d(TAG, "onOnCreateLoader()");
return timeTaskLoader;
>>>>>>>
if (DEBUG_ME) Log.d(TAG, "onOnCreateLoader()");
return new TimeTaskLoader(currentPuzzle, currentPuzzleSubtype, history);
<<<<<<<
}
=======
}
>>>>>>>
} |
<<<<<<<
GL.glDeleteTexturesEXT(n, textures, getPosition(textures));
=======
GL.glDeleteTextures(n, textures, Memory.getPosition(textures));
>>>>>>>
GL.glDeleteTextures(n, textures, getPosition(textures));
<<<<<<<
GL.glGenTexturesEXT(n, textures, getPosition(textures));
=======
GL.glGenTextures(n, textures, Memory.getPosition(textures));
>>>>>>>
GL.glGenTextures(n, textures, getPosition(textures));
<<<<<<<
GL.glTexSubImage2DEXT(target, level, xoffset, yoffset, width, height, format, type, pixels, getPosition(pixels));
=======
GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, Memory.getPosition(pixels));
>>>>>>>
GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, getPosition(pixels)); |
<<<<<<<
int size = json.readValue("size", int.class, -1, jsonData);
=======
Boolean flip = json.readValue("flip", Boolean.class, false, jsonData);
>>>>>>>
int size = json.readValue("size", int.class, -1, jsonData);
Boolean flip = json.readValue("flip", Boolean.class, false, jsonData);
<<<<<<<
font = new BitmapFont(fontFile, region, false);
=======
return new BitmapFont(fontFile, region, flip);
>>>>>>>
font = new BitmapFont(fontFile, region, flip);
<<<<<<<
font = new BitmapFont(fontFile, imageFile, false);
=======
return new BitmapFont(fontFile, imageFile, flip);
>>>>>>>
font = new BitmapFont(fontFile, imageFile, flip);
<<<<<<<
font = new BitmapFont(fontFile, false);
=======
return new BitmapFont(fontFile, flip);
>>>>>>>
font = new BitmapFont(fontFile, flip); |
<<<<<<<
setScaling(Scaling.fit);
this.setWorldSize(minWorldWidth, minWorldHeight);
=======
setWorldSize(minWorldWidth, minWorldHeight);
>>>>>>>
setScaling(Scaling.fit);
setWorldSize(minWorldWidth, minWorldHeight);
<<<<<<<
if (screenWidth > maxWorldWidth || screenHeight > maxWorldHeight) {
setScaling(Scaling.fit);
setWorldSize(maxWorldWidth, maxWorldWidth / screenAspectRatio);
} else if (screenWidth < minWorldWidth || screenHeight < minWorldHeight) {
setScaling(Scaling.fit);
setWorldSize(minWorldWidth, minWorldWidth / screenAspectRatio);
} else {
setScaling(Scaling.fill);
setWorldSize(screenWidth, screenHeight);
}
=======
setWorldSize(maxWorldWidth, maxWorldWidth / screenAspectRatio);
>>>>>>>
setScaling(Scaling.fill);
setWorldSize(screenWidth, screenHeight); |
<<<<<<<
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
final boolean inspectionEnabled = sharedPreferences.getBoolean("inspectionEnabled", false);
final int inspectionTime = sharedPreferences.getInt("inspectionTime", 15);
final boolean advancedEnabled = sharedPreferences.getBoolean("enableAdvanced", false);
final float scrambleTextSize = ((float) sharedPreferences.getInt("scrambleTextSize", 100)) / 100f;
final boolean quickActionLarge = sharedPreferences.getBoolean("quickActionLarge", false);
final float timerTextSize = ((float) sharedPreferences.getInt("timerTextSize", 100)) / 100f;
final float scrambleImageSize = ((float) sharedPreferences.getInt("scrambleImageSize", 100)) / 100f;
final int timerTextOffset = sharedPreferences.getInt("timerTextOffset", 0);
=======
final boolean inspectionEnabled = Prefs.getBoolean(R.string.pk_inspection_enabled, false);
final int inspectionTime = Prefs.getInt(R.string.pk_inspection_time, 15);
final boolean quickActionLarge
= Prefs.getBoolean(R.string.pk_large_quick_actions_enabled, false);
final float timerTextSize = Prefs.getInt(R.string.pk_timer_text_size, 100) / 100f;
final int timerTextOffset = Prefs.getInt(R.string.pk_timer_text_offset, 0);
float scrambleImageSize = Prefs.getInt(R.string.pk_scramble_image_size, 100) / 100f;
scrambleTextSize = Prefs.getInt(R.string.pk_scramble_text_size, 100) / 100f;
advancedEnabled = Prefs.getBoolean(R.string.pk_advanced_timer_settings_enabled, false);
>>>>>>>
final boolean inspectionEnabled = Prefs.getBoolean(R.string.pk_inspection_enabled, false);
final int inspectionTime = Prefs.getInt(R.string.pk_inspection_time, 15);
final boolean quickActionLarge
= Prefs.getBoolean(R.string.pk_large_quick_actions_enabled, false);
final float timerTextSize = Prefs.getInt(R.string.pk_timer_text_size, 100) / 100f;
final int timerTextOffset = Prefs.getInt(R.string.pk_timer_text_offset, 0);
float scrambleImageSize = Prefs.getInt(R.string.pk_scramble_image_size, 100) / 100f;
final float scrambleTextSize = Prefs.getInt(R.string.pk_scramble_text_size, 100) / 100f;
final boolean advancedEnabled
= Prefs.getBoolean(R.string.pk_advanced_timer_settings_enabled, false); |
<<<<<<<
AnimationTest.class, AccelerometerTest.class, ActionTest.class, ActionSequenceTest.class, LetterBoxTest3.class,
GroupTest.class, AlphaTest.class, AtlasIssueTest.class, AssetManagerTest.class, FilterPerformanceTest.class,
AudioDeviceTest.class, AudioRecorderTest.class, BitmapFontAlignmentTest.class, BitmapFontDistanceFieldTest.class, BitmapFontFlipTest.class,
GroupCullingTest.class, GestureDetectorTest.class, LabelTest.class, BitmapFontMetricsTest.class, BlitTest.class, TableTest.class,
BobTest.class, ImageScaleTest.class, TableLayoutTest.class, Box2DTest.class, BulletTestCollection.class, InterpolationTest.class, TouchpadTest.class,
Box2DTestCollection.class, BufferUtilsTest.class, ImageTest.class, CompassTest.class, ComplexActionTest.class,
CullTest.class, DeltaTimeTest.class, EarClippingTriangulatorTest.class, EdgeDetectionTest.class, ETC1Test.class, ExitTest.class, FilesTest.class,
ScrollPaneTest.class, FloatTest.class, FloatTextureTest.class, FrameBufferTest.class, FramebufferToTextureTest.class, FrustumTest.class,
FullscreenTest.class, Gdx2DTest.class, GroupFadeTest.class, ImmediateModeRendererTest.class, Scene2dTest.class,
ImmediateModeRendererAlphaTest.class, IndexBufferObjectClassTest.class, TreeTest.class, IndexBufferObjectShaderTest.class,
InputTest.class, IntegerBitmapFontTest.class, InverseKinematicsTest.class, IsometricTileTest.class,
KinematicBodyTest.class, LifeCycleTest.class, LineDrawingTest.class, ScrollPane2Test.class, ManagedTest.class,
ManualBindTest.class, MaterialTest.class, MatrixJNITest.class, MeshMultitextureTest.class, MeshShaderTest.class, MeshTest.class,
MipMapTest.class, MultitouchTest.class, MusicTest.class, MyFirstTriangle.class, ObjTest.class, OnscreenKeyboardTest.class,
OrthoCamBorderTest.class, ParallaxTest.class, ParticleEmitterTest.class, PickingTest.class, PixelsPerInchTest.class,
PixmapBlendingTest.class, PixmapTest.class, PixmapPackerTest.class, PolygonRegionTest.class, PolygonSpriteTest.class, PreferencesTest.class,
ProjectiveTextureTest.class, Pong.class, ProjectTest.class, RemoteTest.class, RotationTest.class, DragAndDropTest.class,
=======
// @off
AccelerometerTest.class,
ActionSequenceTest.class,
ActionTest.class,
AlphaTest.class,
Animation3DTest.class,
AnimationTest.class,
AssetManagerTest.class,
AtlasIssueTest.class,
AudioDeviceTest.class,
AudioRecorderTest.class,
Basic3DSceneTest.class,
Basic3DTest.class,
BitmapFontAlignmentTest.class,
BitmapFontDistanceFieldTest.class,
BitmapFontFlipTest.class,
BitmapFontMetricsTest.class,
BitmapFontTest.class,
BlitTest.class,
BobTest.class,
Box2DTest.class,
Box2DTestCollection.class,
Bresenham2Test.class,
BufferUtilsTest.class,
BulletTestCollection.class,
CompassTest.class,
ComplexActionTest.class,
CullTest.class,
DelaunayTriangulatorTest.class,
DeltaTimeTest.class,
DirtyRenderingTest.class,
DragAndDropTest.class,
ETC1Test.class,
EarClippingTriangulatorTest.class,
EdgeDetectionTest.class,
ExitTest.class,
ExternalMusicTest.class,
FilesTest.class,
FilterPerformanceTest.class,
FloatTest.class,
FloatTextureTest.class,
FogTest.class,
FrameBufferTest.class,
FramebufferToTextureTest.class,
FrustumTest.class,
FullscreenTest.class,
GamepadTest.class,
Gdx2DTest.class,
GestureDetectorTest.class,
GroupCullingTest.class,
GroupFadeTest.class,
GroupTest.class,
HelloTriangle.class,
HexagonalTiledMapTest.class,
ImageScaleTest.class,
ImageTest.class,
ImmediateModeRendererAlphaTest.class,
ImmediateModeRendererTest.class,
IndexBufferObjectClassTest.class,
IndexBufferObjectShaderTest.class,
InputTest.class,
IntegerBitmapFontTest.class,
InterpolationTest.class,
InverseKinematicsTest.class,
IsoCamTest.class,
IsometricTileTest.class,
KinematicBodyTest.class,
LabelScaleTest.class,
LabelTest.class,
LetterBoxTest1.class,
LetterBoxTest2.class,
LetterBoxTest3.class,
LifeCycleTest.class,
LineDrawingTest.class,
ManagedTest.class,
ManualBindTest.class,
MaterialTest.class,
MatrixJNITest.class,
MeshMultitextureTest.class,
MeshShaderTest.class,
MeshTest.class,
MipMapTest.class,
ModelTest.class,
MoveSpriteExample.class,
MultitouchTest.class,
MusicTest.class,
MyFirstTriangle.class,
NetAPITest.class,
NinePatchTest.class,
ObjTest.class,
OnscreenKeyboardTest.class,
OrthoCamBorderTest.class,
ParallaxTest.class,
ParticleEmitterTest.class,
PathTest.class,
PickingTest.class,
PixelsPerInchTest.class,
PixmapBlendingTest.class,
PixmapPackerTest.class,
PixmapTest.class,
PolygonRegionTest.class,
PolygonSpriteTest.class,
Pong.class,
PreferencesTest.class,
ProjectTest.class,
ProjectiveTextureTest.class,
RemoteTest.class,
RotationTest.class,
RunnablePostTest.class,
Scene2dTest.class,
ScreenCaptureTest.class,
ScrollPane2Test.class,
ScrollPaneScrollBarsTest.class,
ScrollPaneTest.class,
>>>>>>>
// @off
AccelerometerTest.class,
ActionSequenceTest.class,
ActionTest.class,
AlphaTest.class,
Animation3DTest.class,
AnimationTest.class,
AssetManagerTest.class,
AtlasIssueTest.class,
AudioDeviceTest.class,
AudioRecorderTest.class,
Basic3DSceneTest.class,
Basic3DTest.class,
BitmapFontAlignmentTest.class,
BitmapFontDistanceFieldTest.class,
BitmapFontFlipTest.class,
BitmapFontMetricsTest.class,
BitmapFontTest.class,
BlitTest.class,
BobTest.class,
Box2DTest.class,
Box2DTestCollection.class,
Bresenham2Test.class,
BufferUtilsTest.class,
BulletTestCollection.class,
CompassTest.class,
ComplexActionTest.class,
CullTest.class,
DelaunayTriangulatorTest.class,
DeltaTimeTest.class,
DirtyRenderingTest.class,
DragAndDropTest.class,
ETC1Test.class,
EarClippingTriangulatorTest.class,
EdgeDetectionTest.class,
ExitTest.class,
ExternalMusicTest.class,
FilesTest.class,
FilterPerformanceTest.class,
FloatTest.class,
FloatTextureTest.class,
FogTest.class,
FrameBufferTest.class,
FramebufferToTextureTest.class,
FrustumTest.class,
FullscreenTest.class,
GamepadTest.class,
Gdx2DTest.class,
GestureDetectorTest.class,
GroupCullingTest.class,
GroupFadeTest.class,
GroupTest.class,
HelloTriangle.class,
HexagonalTiledMapTest.class,
ImageScaleTest.class,
ImageTest.class,
ImmediateModeRendererAlphaTest.class,
ImmediateModeRendererTest.class,
IndexBufferObjectClassTest.class,
IndexBufferObjectShaderTest.class,
InputTest.class,
IntegerBitmapFontTest.class,
InterpolationTest.class,
InverseKinematicsTest.class,
IsometricTileTest.class,
KinematicBodyTest.class,
LabelScaleTest.class,
LabelTest.class,
LetterBoxTest1.class,
LetterBoxTest2.class,
LetterBoxTest3.class,
LifeCycleTest.class,
LineDrawingTest.class,
ManagedTest.class,
ManualBindTest.class,
MaterialTest.class,
MatrixJNITest.class,
MeshMultitextureTest.class,
MeshShaderTest.class,
MeshTest.class,
MipMapTest.class,
ModelTest.class,
MoveSpriteExample.class,
MultitouchTest.class,
MusicTest.class,
MyFirstTriangle.class,
NetAPITest.class,
NinePatchTest.class,
ObjTest.class,
OnscreenKeyboardTest.class,
OrthoCamBorderTest.class,
ParallaxTest.class,
ParticleEmitterTest.class,
PathTest.class,
PickingTest.class,
PixelsPerInchTest.class,
PixmapBlendingTest.class,
PixmapPackerTest.class,
PixmapTest.class,
PolygonRegionTest.class,
PolygonSpriteTest.class,
Pong.class,
PreferencesTest.class,
ProjectTest.class,
ProjectiveTextureTest.class,
RemoteTest.class,
RotationTest.class,
RunnablePostTest.class,
Scene2dTest.class,
ScreenCaptureTest.class,
ScrollPane2Test.class,
ScrollPaneScrollBarsTest.class,
ScrollPaneTest.class, |
<<<<<<<
=======
private static final String OPEN_EXPORT_IMPORT_DIALOG = "open_export_import_dialog";
/**
* The fragment tag identifying the export/import dialog fragment.
*/
private static final String FRAG_TAG_EXIM_DIALOG = "export_import_dialog";
>>>>>>>
/**
* The fragment tag identifying the export/import dialog fragment.
*/
private static final String FRAG_TAG_EXIM_DIALOG = "export_import_dialog";
<<<<<<<
} else {
Cursor cursor = handler.getAllSolvesFrom(exportImportPuzzle, exportImportCategory);
try {
publishProgress(0, cursor.getCount());
=======
} else if (mFileFormat == ExportImportDialog.EXIM_FORMAT_EXTERNAL) {
Cursor cursor = handler.getAllSolvesFrom(mPuzzleType, mPuzzleCategory);
publishProgress(0, cursor.getCount());
if (cursor != null) {
>>>>>>>
} else if (mFileFormat == ExportImportDialog.EXIM_FORMAT_EXTERNAL) {
Cursor cursor = handler.getAllSolvesFrom(mPuzzleType, mPuzzleCategory);
try {
publishProgress(0, cursor.getCount());
<<<<<<<
}
if (tag.equals("import_external")) {
final long now = DateTime.now().getMillis();
=======
} else if (mFileFormat == ExportImportDialog.EXIM_FORMAT_EXTERNAL) {
>>>>>>>
} else if (mFileFormat == ExportImportDialog.EXIM_FORMAT_EXTERNAL) {
final long now = DateTime.now().getMillis();
<<<<<<<
solveList.add(new Solve(
time, exportImportPuzzle, exportImportCategory,
date, scramble, penalty, "", true));
=======
solveList.add(new Solve(time, mPuzzleType, mPuzzleCategory, date,
scramble, PuzzleUtils.NO_PENALTY, "", true));
>>>>>>>
solveList.add(new Solve(
time, mPuzzleType, mPuzzleCategory,
date, scramble, penalty, "", true)); |
<<<<<<<
import com.badlogic.gdx.tests.extensions.GLEEDTest;
import com.badlogic.gdx.tests.g3d.BatchRenderTest;
import com.badlogic.gdx.tests.g3d.JsonModelLoaderTest;
=======
>>>>>>>
import com.badlogic.gdx.tests.g3d.BatchRenderTest;
import com.badlogic.gdx.tests.g3d.JsonModelLoaderTest;
<<<<<<<
ScreenCaptureTest.class, BitmapFontTest.class, LabelScaleTest.class, GLEEDTest.class, GamepadTest.class, NetAPITest.class,
JsonModelLoaderTest.class, BatchRenderTest.class, RunnablePostTest.class, Vector2dTest.class));
=======
ScreenCaptureTest.class, BitmapFontTest.class, LabelScaleTest.class, GamepadTest.class, NetAPITest.class, TideMapAssetManagerTest.class, TideMapDirectLoaderTest.class, TiledMapAssetManagerTest.class, TiledMapBench.class,
RunnablePostTest.class, Vector2dTest.class, SuperKoalio.class, NinePatchTest.class));
>>>>>>>
ScreenCaptureTest.class, BitmapFontTest.class, LabelScaleTest.class, GamepadTest.class, NetAPITest.class, TideMapAssetManagerTest.class, TideMapDirectLoaderTest.class, TiledMapAssetManagerTest.class, TiledMapBench.class,
RunnablePostTest.class, Vector2dTest.class, SuperKoalio.class, NinePatchTest.class,
JsonModelLoaderTest.class, BatchRenderTest.class)); |
<<<<<<<
import com.badlogic.gdx.tests.extensions.GLEEDTest;
import com.badlogic.gdx.tests.g3d.BatchRenderTest;
import com.badlogic.gdx.tests.g3d.JsonModelLoaderTest;
=======
>>>>>>>
import com.badlogic.gdx.tests.g3d.BatchRenderTest;
import com.badlogic.gdx.tests.g3d.JsonModelLoaderTest; |
<<<<<<<
empty = maxIndices == 0;
if (empty) {
maxIndices = 1; // avoid allocating a zero-sized buffer because of bug in Android's ART
}
=======
buffer = byteBuffer.asShortBuffer();
buffer.flip();
byteBuffer.flip();
bufferHandle = Gdx.gl20.glGenBuffer();
usage = isStatic ? GL20.GL_STATIC_DRAW : GL20.GL_DYNAMIC_DRAW;
}
>>>>>>>
empty = maxIndices == 0;
if (empty) {
maxIndices = 1; // avoid allocating a zero-sized buffer because of bug in Android's ART
}
<<<<<<<
bufferHandle = createBufferObject();
usage = isStatic ? GL20.GL_STATIC_DRAW : GL20.GL_DYNAMIC_DRAW;
=======
bufferHandle = Gdx.gl20.glGenBuffer();
usage = GL20.GL_STATIC_DRAW;
>>>>>>>
bufferHandle = Gdx.gl20.glGenBuffer();
usage = isStatic ? GL20.GL_STATIC_DRAW : GL20.GL_DYNAMIC_DRAW; |
<<<<<<<
import static com.badlogic.gdx.graphics.g2d.SpriteBatch.*;
=======
/**
* @brief Logic for rendering TiledMap objects
*
* Includes several optimisations such as SpriteCache usage, fustrum culling etc.
*/
>>>>>>>
import static com.badlogic.gdx.graphics.g2d.SpriteBatch.*;
/**
* @brief Logic for rendering TiledMap objects
*
* Includes several optimisations such as SpriteCache usage, fustrum culling etc.
*/ |
<<<<<<<
=======
private Context mContext;
/**
* An interface for notification of the progress of bulk database operations.
*/
public interface ProgressListener {
/**
* Notifies the listener of the progress of a bulk operation. This may be called many
* times during the operation.
*
* @param numCompleted
* The number of sub-operations of the bulk operation that have been completed.
* @param total
* The total number of sub-operations that must be completed before the the bulk
* operation is complete.
*/
void onProgress(int numCompleted, int total);
}
>>>>>>>
/**
* An interface for notification of the progress of bulk database operations.
*/
public interface ProgressListener {
/**
* Notifies the listener of the progress of a bulk operation. This may be called many
* times during the operation.
*
* @param numCompleted
* The number of sub-operations of the bulk operation that have been completed.
* @param total
* The total number of sub-operations that must be completed before the the bulk
* operation is complete.
*/
void onProgress(int numCompleted, int total);
}
<<<<<<<
// Adding new solve
=======
/**
* Adds a new solve to the database.
*
* @param solve The solve to be added to the database.
* @return The new ID of the stored solve record.
*/
>>>>>>>
/**
* Adds a new solve to the database.
*
* @param solve The solve to be added to the database.
* @return The new ID of the stored solve record.
*/
<<<<<<<
// Delete an entry with an id
public int deleteFromId(long id) {
SQLiteDatabase db = this.getWritableDatabase();
return db.delete(TABLE_TIMES, KEY_ID + " = ?", new String[] { String.valueOf(id) });
=======
/**
* Deletes a single solve matching the given ID from the database.
*
* @param solveID
* The ID of the solve record in the "times" table of the database.
*
* @return
* The number of records deleted. If no record matches {@code solveID}, the result is zero.
*/
public int deleteSolveByID(long solveID) {
return deleteSolveByIDInternal(getWritableDatabase(), solveID);
}
/**
* Deletes a single solve from the database.
*
* @param solve
* The solve to be deleted. The corresponding database record to be deleted from the "times"
* table is matched using the ID returned from {@link Solve#getId()}.
*
* @return
* The number of records deleted. If no record matches the ID of the solve, the result is
* zero.
*/
public int deleteSolve(Solve solve) {
return deleteSolveByIDInternal(getWritableDatabase(), solve.getId());
>>>>>>>
/**
* Deletes a single solve matching the given ID from the database.
*
* @param solveID
* The ID of the solve record in the "times" table of the database.
*
* @return
* The number of records deleted. If no record matches {@code solveID}, the result is zero.
*/
public int deleteSolveByID(long solveID) {
return deleteSolveByIDInternal(getWritableDatabase(), solveID);
}
/**
* Deletes a single solve from the database.
*
* @param solve
* The solve to be deleted. The corresponding database record to be deleted from the "times"
* table is matched using the ID returned from {@link Solve#getId()}.
*
* @return
* The number of records deleted. If no record matches the ID of the solve, the result is
* zero.
*/
public int deleteSolve(Solve solve) {
return deleteSolveByIDInternal(getWritableDatabase(), solve.getId()); |
<<<<<<<
=======
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
>>>>>>>
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
<<<<<<<
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
=======
if(Build.VERSION.SDK_INT >= 11)
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
>>>>>>>
if(Build.VERSION.SDK_INT >= 11)
getWindow().requestFeature(Window.FEATURE_ACTION_BAR); |
<<<<<<<
private StrongTrustManager sTrustManager;
=======
private X509TrustManager mTrustManager;
>>>>>>>
private StrongTrustManager sTrustManager;
private X509TrustManager mTrustManager;
<<<<<<<
sTrustManager = new StrongTrustManager(aContext);//, domain, requestedServer, config);
sTrustManager.setDomain(domain);
sTrustManager.setServer(requestedServer);
sslContext.init(kms, new javax.net.ssl.TrustManager[] { sTrustManager },
=======
ServerTrustManager sTrustManager = new ServerTrustManager(aContext, domain, requestedServer, config);
mTrustManager = new MemorizingTrustManager(aContext, sTrustManager, null);
sslContext.init(kms, new javax.net.ssl.TrustManager[] { mTrustManager },
>>>>>>>
sTrustManager = new StrongTrustManager(aContext);//, domain, requestedServer, config);
sTrustManager.setDomain(domain);
sTrustManager.setServer(requestedServer);
mTrustManager = new MemorizingTrustManager(aContext, sTrustManager, null);
sslContext.init(kms, new javax.net.ssl.TrustManager[] { mTrustManager }, |
<<<<<<<
=======
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
import com.aricneto.twistytimer.utils.Broadcaster;
>>>>>>>
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
<<<<<<<
private static final String SHOWCASE_FAB_ID = "SHOWCASE_FAB_ID";
private Unbinder mUnbinder;
@BindView(R.id.toolbar) Toolbar mToolbar;
@BindView(R.id.pager) LockedViewPager viewPager;
@BindView(R.id.main_tabs) TabLayout tabLayout;
@BindView(R.id.toolbarLayout) LinearLayout toolbarLayout;
=======
@Bind(R.id.toolbar) Toolbar mToolbar;
@Bind(R.id.pager) LockedViewPager viewPager;
@Bind(R.id.main_tabs) TabLayout tabLayout;
@Bind(R.id.toolbarLayout) LinearLayout toolbarLayout;
DatabaseHandler dbHandler;
>>>>>>>
private Unbinder mUnbinder;
@BindView(R.id.toolbar) Toolbar mToolbar;
@BindView(R.id.pager) LockedViewPager viewPager;
@BindView(R.id.main_tabs) TabLayout tabLayout;
@BindView(R.id.toolbarLayout) LinearLayout toolbarLayout;
<<<<<<<
int currentPage = 0;
=======
int currentPage = TIMER_PAGE;
>>>>>>>
int currentPage = TIMER_PAGE;
<<<<<<<
}
});
activateTabLayout(true);
if (pagerEnabled)
viewPager.setPagingEnabled(true);
else
viewPager.setPagingEnabled(false);
break;
case ACTION_SELECTION_MODE_ON:
selectCount = 0;
actionMode = mToolbar.startActionMode(actionModeCallback);
break;
case ACTION_SELECTION_MODE_OFF:
selectCount = 0;
if (actionMode != null)
actionMode.finish();
break;
case ACTION_TIME_SELECTED:
selectCount += 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
case ACTION_TIME_UNSELECTED:
selectCount -= 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
case ACTION_GO_BACK:
boolean timerRunning = currentTimerFragmentInstance.isRunning;
boolean panelShowing =
currentTimerFragmentInstance.slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED ||
currentTimerFragmentInstance.slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.ANCHORED ||
currentTimerFragmentInstance.slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.DRAGGING;
boolean sheetShowing = currentTimerListFragmentInstance.materialSheetFab.isSheetVisible();
if (timerRunning || panelShowing || sheetShowing) {
if (timerRunning)
currentTimerFragmentInstance.cancelChronometer();
if (panelShowing)
currentTimerFragmentInstance.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
if (sheetShowing)
currentTimerListFragmentInstance.materialSheetFab.hideSheet();
} else {
// Propagate up to the application/main-activity level and exit app.
broadcast(CATEGORY_APP_LEVEL_EVENTS, ACTION_GO_BACK);
}
break;
=======
});
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(showToolbar);
animatorSet.start();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (toolbarLayout != null) {
if (toolbarLayout.getTranslationY() == 0) {
LinearLayout.LayoutParams params =
(LinearLayout.LayoutParams) viewPager.getLayoutParams();
params.height = originalContentHeight;
viewPager.setLayoutParams(params);
Intent sendIntent = new Intent("TIMELIST");
sendIntent.putExtra("action", "TOOLBAR ENDED");
LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(sendIntent);
}
}
}
});
activateTabLayout(true);
if (pagerEnabled)
viewPager.setPagingEnabled(true);
else
viewPager.setPagingEnabled(false);
break;
case "SELECTIONMODE TRUE":
selectCount = 0;
actionMode = mToolbar.startActionMode(actionModeCallback);
break;
case "SELECTIONMODE FALSE":
selectCount = 0;
if (actionMode != null)
actionMode.finish();
break;
case "LISTITEM SELECTED":
selectCount += 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
case "LISTITEM UNSELECTED":
selectCount -= 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
}
>>>>>>>
}
});
activateTabLayout(true);
if (pagerEnabled)
viewPager.setPagingEnabled(true);
else
viewPager.setPagingEnabled(false);
break;
case ACTION_SELECTION_MODE_ON:
selectCount = 0;
actionMode = mToolbar.startActionMode(actionModeCallback);
break;
case ACTION_SELECTION_MODE_OFF:
selectCount = 0;
if (actionMode != null)
actionMode.finish();
break;
case ACTION_TIME_SELECTED:
selectCount += 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
case ACTION_TIME_UNSELECTED:
selectCount -= 1;
actionMode.setTitle(selectCount + " " + getString(R.string.selected_list));
break;
<<<<<<<
=======
>>>>>>>
<<<<<<<
return new TimerFragmentMain();
=======
final TimerFragmentMain fragment = new TimerFragmentMain();
if (DEBUG_ME) Log.d(TAG, "newInstance() -> " + fragment);
return fragment;
>>>>>>>
final TimerFragmentMain fragment = new TimerFragmentMain();
if (DEBUG_ME) Log.d(TAG, "newInstance() -> " + fragment);
return fragment;
<<<<<<<
=======
if (tabLayout.getTabCount() == NUM_PAGES) {
tabLayout.getTabAt(TIMER_PAGE).setIcon(R.drawable.ic_timer_white_24dp);
tabLayout.getTabAt(LIST_PAGE).setIcon(R.drawable.ic_format_list_bulleted_white_24dp);
tabLayout.getTabAt(GRAPH_PAGE).setIcon(R.drawable.ic_timeline_white_24dp);
}
>>>>>>>
<<<<<<<
registerReceiver(mUIInteractionReceiver);
=======
LocalBroadcastManager.getInstance(getContext()).registerReceiver(mReceiver, new IntentFilter("TIMER"));
>>>>>>>
registerReceiver(mUIInteractionReceiver);
<<<<<<<
Log.d("TIMER MAIN FRAG", "Creating item for position " + position);
if (position == 2) {
try {
throw new Throwable();
} catch (Throwable t) {
Log.d("TIMER MAIN FRAG", Log.getStackTraceString(t));
}
}
=======
if (DEBUG_ME) Log.d(TAG, "NavigationAdapter.createItem(" + position + ")");
>>>>>>>
if (DEBUG_ME) Log.d(TAG, "NavigationAdapter.createItem(" + position + ")"); |
<<<<<<<
=======
import info.guardianproject.otr.app.im.ui.TabbedContainer;
import info.guardianproject.otr.app.im.R;
import info.guardianproject.otr.app.im.IChatSession;
import info.guardianproject.otr.app.im.IChatSessionManager;
import info.guardianproject.otr.app.im.IConnectionListener;
import info.guardianproject.otr.app.im.IImConnection;
>>>>>>>
import info.guardianproject.otr.app.im.ui.TabbedContainer;
<<<<<<<
mAccountId = mConn.getAccountId();
=======
long accountId = mConn.getAccountId();
/*#############################################################################
* This (see below) intent is the one that needs to be passed to the tab Event
*/
>>>>>>>
mAccountId = mConn.getAccountId();
/*#############################################################################
* This (see below) intent is the one that needs to be passed to the tab Event
*/
<<<<<<<
intent = new Intent(this, ContactListActivity.class);
intent.putExtra(ImServiceConstants.EXTRA_INTENT_ACCOUNT_ID, mAccountId);
=======
intent = new Intent(this, TabbedContainer.class);
intent.putExtra(ImServiceConstants.EXTRA_INTENT_ACCOUNT_ID, accountId);
>>>>>>>
intent = new Intent(this, TabbedContainer.class);
intent.putExtra(ImServiceConstants.EXTRA_INTENT_ACCOUNT_ID, mAccountId); |
<<<<<<<
import android.content.Context;
=======
import android.content.Context;
import android.content.DialogInterface;
>>>>>>>
import android.content.Context;
import android.content.DialogInterface;
<<<<<<<
import android.provider.MediaStore;
=======
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
>>>>>>>
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
<<<<<<<
import android.view.View.OnLongClickListener;
=======
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
>>>>>>>
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
<<<<<<<
import android.widget.EditText;
=======
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
>>>>>>>
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
<<<<<<<
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
=======
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
>>>>>>>
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
<<<<<<<
case R.id.menu_send_image:
startImagePicker();
return true;
case R.id.menu_send_file:
startFilePicker();
return true;
case R.id.menu_view_otr:
switchOtrState();
=======
case R.id.menu_secure_call:
sendCallInvite ();
>>>>>>>
case R.id.menu_send_image:
startImagePicker();
return true;
case R.id.menu_send_file:
startFilePicker();
return true;
case R.id.menu_secure_call:
sendCallInvite ();
<<<<<<<
}
private void startImagePicker() {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_SEND_IMAGE);
}
private void startFilePicker() {
Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT);
selectFile.setType("file/*");
startActivityForResult(Intent.createChooser(selectFile, "Select File"), REQUEST_SEND_FILE);
}
public String getRealPathFromURI(Context aContext, Uri uri) {
if (uri.getScheme().equals("file")) {
return uri.getPath();
}
if (uri.toString().startsWith("content://org.openintents.filemanager/")) {
// Work around URI escaping brokenness
return uri.toString().replaceFirst("content://org.openintents.filemanager", "");
}
Cursor cursor = aContext.getContentResolver().query(uri, null, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
=======
}*/
>>>>>>>
}*/
private void startImagePicker() {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_SEND_IMAGE);
}
private void startFilePicker() {
Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT);
selectFile.setType("file/*");
startActivityForResult(Intent.createChooser(selectFile, "Select File"), REQUEST_SEND_FILE);
}
public String getRealPathFromURI(Context aContext, Uri uri) {
if (uri.getScheme().equals("file")) {
return uri.getPath();
}
if (uri.toString().startsWith("content://org.openintents.filemanager/")) {
// Work around URI escaping brokenness
return uri.toString().replaceFirst("content://org.openintents.filemanager", "");
}
Cursor cursor = aContext.getContentResolver().query(uri, null, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
} |
<<<<<<<
import android.view.KeyEvent;
=======
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
>>>>>>>
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
<<<<<<<
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
=======
import android.widget.TextView;
>>>>>>>
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
<<<<<<<
=======
mEditUserAccount.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (! hasFocus) {
String username = mEditUserAccount.getText().toString();
//Log.i(TAG, "Username changed: " + mOriginalUserAccount + " != " + username);
if (parseAccount(username)) {
if (username != mOriginalUserAccount) {
settingsForDomain(mDomain, mPort);
mHaveSetUseTor = false;
}
} else {
// TODO if bad account name, bump back to the account EditText
//mEditUserAccount.requestFocus();
}
}
}
});
>>>>>>>
mEditUserAccount.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (! hasFocus) {
String username = mEditUserAccount.getText().toString();
//Log.i(TAG, "Username changed: " + mOriginalUserAccount + " != " + username);
if (parseAccount(username)) {
if (username != mOriginalUserAccount) {
settingsForDomain(mDomain, mPort);
mHaveSetUseTor = false;
}
} else {
// TODO if bad account name, bump back to the account EditText
//mEditUserAccount.requestFocus();
}
}
}
}); |
<<<<<<<
private static final int CONTACT_LIST_LOADER_ID = 4444;
private static final int CHAT_LIST_LOADER_ID = 4445;
=======
private static final int REQUEST_SEND_AUDIO = REQUEST_SEND_FILE + 1;
>>>>>>>
private static final int REQUEST_SEND_AUDIO = REQUEST_SEND_FILE + 1;
private static final int CONTACT_LIST_LOADER_ID = 4444;
private static final int CHAT_LIST_LOADER_ID = 4445; |
<<<<<<<
=======
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
import com.aricneto.twistytimer.utils.Broadcaster;
>>>>>>>
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
<<<<<<<
BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case ACTION_GO_BACK:
goBack = true;
onBackPressed();
break;
}
}
};
=======
>>>>>>>
<<<<<<<
TTIntent.registerReceiver(mReceiver, CATEGORY_APP_LEVEL_EVENTS);
=======
>>>>>>>
<<<<<<<
} else if (goBack) {
super.onBackPressed();
goBack = false;
} else if (fragmentManager.findFragmentByTag("fragment_main") != null) { // If the main fragment is open
broadcast(CATEGORY_UI_INTERACTIONS, ACTION_GO_BACK); // This broadcast goes to TimerFragmentMain
} else {
super.onBackPressed();
=======
return;
}
final Fragment mainFragment = fragmentManager.findFragmentByTag("fragment_main");
if (mainFragment instanceof OnBackPressedInFragmentListener) { // => not null
// If the main fragment is open, let it and its "child" fragments consume the "Back"
// button press if necessary.
if (((OnBackPressedInFragmentListener) mainFragment).onBackPressedInFragment()) {
// Button press was consumed. Stop here.
return;
}
>>>>>>>
return;
}
final Fragment mainFragment = fragmentManager.findFragmentByTag("fragment_main");
if (mainFragment instanceof OnBackPressedInFragmentListener) { // => not null
// If the main fragment is open, let it and its "child" fragments consume the "Back"
// button press if necessary.
if (((OnBackPressedInFragmentListener) mainFragment).onBackPressedInFragment()) {
// Button press was consumed. Stop here.
return;
}
<<<<<<<
TTIntent.unregisterReceiver(mReceiver);
=======
handler.closeDB();
>>>>>>> |
<<<<<<<
public void sendPacket(final org.jivesoftware.smack.packet.Packet packet) {
execute(new Runnable() {
@Override
public void run() {
if (mConnection == null) {
Log.w(TAG, "dropped packet to " + packet.getTo() + " because we are not connected");
return;
}
if (!mConnection.isConnected()) {
Log.w(TAG, "dropped packet to " + packet.getTo() + " because socket is disconnected");
}
mConnection.sendPacket(packet);
}
});
=======
if (mConnection != null)
mConnection.sendPacket(msg);
>>>>>>>
public void sendPacket(final org.jivesoftware.smack.packet.Packet packet) {
execute(new Runnable() {
@Override
public void run() {
if (mConnection == null) {
Log.w(TAG, "dropped packet to " + packet.getTo() + " because we are not connected");
return;
}
if (!mConnection.isConnected()) {
Log.w(TAG, "dropped packet to " + packet.getTo() + " because socket is disconnected");
}
mConnection.sendPacket(packet);
}
});
//if (mConnection != null)
// mConnection.sendPacket(msg);
<<<<<<<
mConfig.setReconnectionAllowed(false);
=======
mConfig.setReconnectionAllowed(false);
>>>>>>>
mConfig.setReconnectionAllowed(false);
<<<<<<<
// We are not using the reconnection manager
throw new UnsupportedOperationException();
=======
//Log.i(TAG, "reconnection failed", e);
//forced_disconnect(new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
mExecutor.execute(new Runnable() {
@Override
public void run() {
reconnect();
}
});
>>>>>>>
// We are not using the reconnection manager
throw new UnsupportedOperationException();
//Log.i(TAG, "reconnection failed", e);
//forced_disconnect(new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
/*
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
mExecutor.execute(new Runnable() {
@Override
public void run() {
reconnect();
}
});
*/
<<<<<<<
if (getState() == LOGGED_IN)
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
maybe_reconnect();
=======
reconnect();
>>>>>>>
if (getState() == LOGGED_IN)
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, e.getMessage()));
maybe_reconnect();
// reconnect();
<<<<<<<
public void reestablishSessionAsync(Map<String, String> sessionContext) {
execute(new Runnable() {
@Override
public void run() {
if (getState() == SUSPENDED) {
debug(TAG, "reestablish");
setState(LOGGING_IN, null);
maybe_reconnect();
}
}
});
=======
public void reestablishSessionAsync(HashMap<String, String> sessionContext) {
mExecutor.execute(new Runnable() {
@Override
public void run() {
reconnect();
}
});
>>>>>>>
/*
public void reestablishSessionAsync(Map<String, String> sessionContext) {
execute(new Runnable() {
@Override
public void run() {
if (getState() == SUSPENDED) {
debug(TAG, "reestablish");
setState(LOGGING_IN, null);
maybe_reconnect();
}
*/
public void reestablishSessionAsync(HashMap<String, String> sessionContext) {
mExecutor.execute(new Runnable() {
@Override
public void run() {
reconnect();
}
});
<<<<<<<
execute(new Runnable() {
@Override
public void run() {
debug(TAG, "suspend");
setState(SUSPENDED, null);
mNeedReconnect = false;
clearPing();
// Do not try to reconnect anymore if we were asked to suspend
//mConnection.shutdown();
}
});
=======
mConnection.shutdown();
>>>>>>>
execute(new Runnable() {
@Override
public void run() {
debug(TAG, "suspend");
setState(SUSPENDED, null);
mNeedReconnect = false;
clearPing();
// Do not try to reconnect anymore if we were asked to suspend
//mConnection.shutdown();
}
});
<<<<<<<
IQ result = (IQ)mPingCollector.pollResult();
=======
IQ result = (IQ)mPingCollector.nextResult(SOTIMEOUT);
>>>>>>>
IQ result = (IQ)mPingCollector.pollResult();
// IQ result = (IQ)mPingCollector.nextResult(SOTIMEOUT);
<<<<<<<
=======
//android.os.Debug.waitForDebugger();
Log.w(TAG, "reconnect on network change");
/*
if (getState() == LOGGED_IN)
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, "network changed"));
if (getState() != LOGGED_IN && getState() != LOGGING_IN)
return;
if (mNeedReconnect)
return;
Log.w(TAG, "reconnect on network change");
force_reconnect();
*/
>>>>>>>
//android.os.Debug.waitForDebugger();
Log.w(TAG, "reconnect on network change");
/*
if (getState() == LOGGED_IN)
setState(LOGGING_IN, new ImErrorInfo(ImErrorInfo.NETWORK_ERROR, "network changed"));
if (getState() != LOGGED_IN && getState() != LOGGING_IN)
return;
if (mNeedReconnect)
return;
Log.w(TAG, "reconnect on network change");
force_reconnect();
*/
<<<<<<<
mNeedReconnect = true;
if (mConnection != null)
=======
try
>>>>>>>
mNeedReconnect = true;
if (mConnection != null)
try
<<<<<<<
reconnect();
=======
mNeedReconnect = true;
do_login();
>>>>>>>
reconnect();
mNeedReconnect = true;
do_login(); |
<<<<<<<
CommandBean command = deviceDb.readCommand(commandId);
ArrayList<String> placeholders = parsePlaceholders(command.getCommand());
LOGGER.info("placeholders: {}", placeholders);
if (!placeholders.isEmpty()) {
DialogFragment placeholderDialog = new CommandPlaceholdersDialog();
Bundle args2 = new Bundle();
args2.putStringArrayList(
CommandPlaceholdersDialog.ARG_PLACEHOLDERS, placeholders);
args2.putSerializable(CommandPlaceholdersDialog.ARG_COMMAND,
command);
args2.putString(CommandPlaceholdersDialog.ARG_PASSPHRASE,
keyPassphrase);
placeholderDialog.setArguments(args2);
placeholderDialog.show(getSupportFragmentManager(), "placeholders");
return;
}
args.putSerializable("cmd", command);
if (keyPassphrase != null) {
args.putString("passphrase", keyPassphrase);
}
runCommandDialog.setArguments(args);
runCommandDialog.show(getSupportFragmentManager(), "runCommand");
=======
new AsyncTask<Void, Void, CommandBean>() {
@Override
protected CommandBean doInBackground(Void... params) {
return deviceDb.readCommand(commandId);
}
@Override
protected void onPostExecute(CommandBean command) {
args.putSerializable("cmd", command);
if (keyPassphrase != null) {
args.putString("passphrase", keyPassphrase);
}
runCommandDialog.setArguments(args);
runCommandDialog.show(getSupportFragmentManager(), "runCommand");
}
}.execute();
>>>>>>>
CommandBean command = deviceDb.readCommand(commandId);
ArrayList<String> placeholders = parsePlaceholders(command.getCommand());
LOGGER.info("placeholders: {}", placeholders);
if (!placeholders.isEmpty()) {
DialogFragment placeholderDialog = new CommandPlaceholdersDialog();
Bundle args2 = new Bundle();
args2.putStringArrayList(
CommandPlaceholdersDialog.ARG_PLACEHOLDERS, placeholders);
args2.putSerializable(CommandPlaceholdersDialog.ARG_COMMAND,
command);
args2.putString(CommandPlaceholdersDialog.ARG_PASSPHRASE,
keyPassphrase);
placeholderDialog.setArguments(args2);
placeholderDialog.show(getSupportFragmentManager(), "placeholders");
return;
}
new AsyncTask<Void, Void, CommandBean>() {
@Override
protected CommandBean doInBackground(Void... params) {
return deviceDb.readCommand(commandId);
}
@Override
protected void onPostExecute(CommandBean command) {
args.putSerializable("cmd", command);
if (keyPassphrase != null) {
args.putString("passphrase", keyPassphrase);
}
runCommandDialog.setArguments(args);
runCommandDialog.show(getSupportFragmentManager(), "runCommand");
}
}.execute(); |
<<<<<<<
import org.tinystruct.data.tools.Generator;
import org.tinystruct.data.tools.MySQLGenerator;
import org.tinystruct.handle.Report;
=======
>>>>>>>
<<<<<<<
public void generate_with_user_table(){
try {
String[] list=new String[]{"User"};
for(String className:list)
{
Generator generator=new MySQLGenerator();
generator.setFileName("src/custom/objects/");
generator.setPackageName("custom.objects");
generator.importPackages("java.util.Date");
generator.create(className,className);
System.out.println("class:"+className+" table:"+className);
System.out.println("Done!");
}
} catch (ApplicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
=======
>>>>>>> |
<<<<<<<
import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
=======
import org.mockito.ArgumentMatcher;
>>>>>>>
import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
import org.mockito.ArgumentMatcher;
<<<<<<<
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(_recoveryHandler);
verify(_recoveryHandler).configuredObject(eq(queueId), eq(queueType), eq(queueAttr));
_store.closeConfigurationStore();
=======
_store.configureConfigStore(_virtualHost, _recoveryHandler);
verify(_recoveryHandler).configuredObject(matchesRecord(queueId, queueType, queueAttr));
_store.close();
>>>>>>>
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(mock(ConfiguredObject.class), _recoveryHandler);
verify(_recoveryHandler).configuredObject(matchesRecord(queueId, queueType, queueAttr));
_store.closeConfigurationStore();
<<<<<<<
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(_recoveryHandler);
verify(_recoveryHandler, never()).configuredObject(any(UUID.class), anyString(), anyMap());
_store.closeConfigurationStore();
=======
_store.configureConfigStore(_virtualHost, _recoveryHandler);
verify(_recoveryHandler, never()).configuredObject(any(ConfiguredObjectRecord.class));
_store.close();
>>>>>>>
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(mock(ConfiguredObject.class), _recoveryHandler);
verify(_recoveryHandler, never()).configuredObject(any(ConfiguredObjectRecord.class));
_store.closeConfigurationStore();
<<<<<<<
_store.create(id, "Queue", Collections.<String, Object>emptyMap());
_store.closeConfigurationStore();
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
=======
_store.create(new ConfiguredObjectRecordImpl(id, "Queue", Collections.<String, Object>emptyMap()));
_store.close();
_store.configureConfigStore(_virtualHost, _recoveryHandler);
>>>>>>>
_store.create(new ConfiguredObjectRecordImpl(id, "Queue", Collections.<String, Object>emptyMap()));
_store.closeConfigurationStore();
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
<<<<<<<
_store.create(queueId, "Queue", EMPTY_ATTR);
_store.create(queue2Id, "Queue", EMPTY_ATTR);
_store.create(exchangeId, "Exchange", EMPTY_ATTR);
_store.update(true,
new ConfiguredObjectRecord(bindingId, "Binding", bindingAttributes),
new ConfiguredObjectRecord(binding2Id, "Binding", binding2Attributes));
_store.closeConfigurationStore();
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(_recoveryHandler);
verify(_recoveryHandler).configuredObject(eq(queueId), eq("Queue"), eq(EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(eq(queue2Id), eq("Queue"), eq(EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(eq(exchangeId), eq("Exchange"), eq(EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(eq(bindingId),eq("Binding"), eq(bindingAttributes));
verify(_recoveryHandler).configuredObject(eq(binding2Id),eq("Binding"), eq(binding2Attributes));
_store.closeConfigurationStore();
=======
final ConfiguredObjectRecordImpl queueRecord = new ConfiguredObjectRecordImpl(queueId, "Queue", EMPTY_ATTR);
_store.create(queueRecord);
final ConfiguredObjectRecordImpl queue2Record = new ConfiguredObjectRecordImpl(queue2Id, "Queue", EMPTY_ATTR);
_store.create(queue2Record);
final ConfiguredObjectRecordImpl exchangeRecord = new ConfiguredObjectRecordImpl(exchangeId, "Exchange", EMPTY_ATTR);
_store.create(exchangeRecord);
Map<String,ConfiguredObjectRecord> bindingParents = new HashMap<String, ConfiguredObjectRecord>();
bindingParents.put("Exchange", exchangeRecord);
bindingParents.put("Queue", queueRecord);
final ConfiguredObjectRecordImpl bindingRecord =
new ConfiguredObjectRecordImpl(bindingId, "Binding", EMPTY_ATTR, bindingParents);
Map<String,ConfiguredObjectRecord> binding2Parents = new HashMap<String, ConfiguredObjectRecord>();
binding2Parents.put("Exchange", exchangeRecord);
binding2Parents.put("Queue", queue2Record);
final ConfiguredObjectRecordImpl binding2Record =
new ConfiguredObjectRecordImpl(binding2Id, "Binding", EMPTY_ATTR, binding2Parents);
_store.update(true, bindingRecord, binding2Record);
_store.close();
_store.configureConfigStore(_virtualHost, _recoveryHandler);
verify(_recoveryHandler).configuredObject(matchesRecord(queueId, "Queue", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(queue2Id, "Queue", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(exchangeId, "Exchange", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(bindingId, "Binding", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(binding2Id, "Binding", EMPTY_ATTR));
_store.close();
>>>>>>>
final ConfiguredObjectRecordImpl queueRecord = new ConfiguredObjectRecordImpl(queueId, "Queue", EMPTY_ATTR);
_store.create(queueRecord);
final ConfiguredObjectRecordImpl queue2Record = new ConfiguredObjectRecordImpl(queue2Id, "Queue", EMPTY_ATTR);
_store.create(queue2Record);
final ConfiguredObjectRecordImpl exchangeRecord = new ConfiguredObjectRecordImpl(exchangeId, "Exchange", EMPTY_ATTR);
_store.create(exchangeRecord);
Map<String,ConfiguredObjectRecord> bindingParents = new HashMap<String, ConfiguredObjectRecord>();
bindingParents.put("Exchange", exchangeRecord);
bindingParents.put("Queue", queueRecord);
final ConfiguredObjectRecordImpl bindingRecord =
new ConfiguredObjectRecordImpl(bindingId, "Binding", EMPTY_ATTR, bindingParents);
Map<String,ConfiguredObjectRecord> binding2Parents = new HashMap<String, ConfiguredObjectRecord>();
binding2Parents.put("Exchange", exchangeRecord);
binding2Parents.put("Queue", queue2Record);
final ConfiguredObjectRecordImpl binding2Record =
new ConfiguredObjectRecordImpl(binding2Id, "Binding", EMPTY_ATTR, binding2Parents);
_store.update(true, bindingRecord, binding2Record);
_store.closeConfigurationStore();
_store.openConfigurationStore(_virtualHostName, _configurationStoreSettings);
_store.recoverConfigurationStore(mock(ConfiguredObject.class), _recoveryHandler);
verify(_recoveryHandler).configuredObject(matchesRecord(queueId, "Queue", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(queue2Id, "Queue", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(exchangeId, "Exchange", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(bindingId, "Binding", EMPTY_ATTR));
verify(_recoveryHandler).configuredObject(matchesRecord(binding2Id, "Binding", EMPTY_ATTR));
_store.closeConfigurationStore(); |
<<<<<<<
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
=======
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
>>>>>>>
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
<<<<<<<
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to work around bug in its implementation
=======
OCFile currFile = getFile();
if (mStorageManager != null) {
while(currFile != null && currFile.getFileName() != OCFile.PATH_SEPARATOR) {
if (currFile.isDirectory()) {
mDirectories.add(currFile.getFileName());
}
currFile = mStorageManager.getFileById(currFile.getParentId());
}
}
mDirectories.add(OCFile.PATH_SEPARATOR);
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to workaround bug in its implementation
>>>>>>>
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to work around bug in its implementation
<<<<<<<
mDirectories.clear();
OCFile fileIt = file;
while(fileIt != null && fileIt.getFileName() != OCFile.PATH_SEPARATOR) {
if (fileIt.isDirectory()) {
mDirectories.add(fileIt.getFileName());
}
fileIt = mStorageManager.getFileById(fileIt.getParentId());
}
mDirectories.add(OCFile.PATH_SEPARATOR);
if (!stateWasRecovered) {
=======
if (findViewById(android.R.id.content) != null && !stateWasRecovered) {
>>>>>>>
mDirectories.clear();
OCFile fileIt = file;
while(fileIt != null && fileIt.getFileName() != OCFile.PATH_SEPARATOR) {
if (fileIt.isDirectory()) {
mDirectories.add(fileIt.getFileName());
}
fileIt = mStorageManager.getFileById(fileIt.getParentId());
}
mDirectories.add(OCFile.PATH_SEPARATOR);
if (!stateWasRecovered) {
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
@Override
protected void onStart() {
super.onStart();
FileFragment second = getSecondFragment();
updateFragmentsVisibility(second != null);
updateNavigationElementsInActionBar((second == null) ? null : second.getFile());
}
>>>>>>>
<<<<<<<
=======
// List current directory
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) {
listOfFiles.listDirectory(getCurrentDir()); // TODO we should find the way to avoid the need of this (maybe it's not necessary yet; to check)
}
>>>>>>>
<<<<<<<
=======
/**
* {@inheritDoc}
*/
@Override
public OCFile getInitialDirectory() {
return getCurrentDir();
}
>>>>>>> |
<<<<<<<
=======
if (verboseBoot >= 1) VM.sysWriteln("Booting DynamicLibrary");
DynamicLibrary.boot();
>>>>>>> |
<<<<<<<
// TODO get thread local state working
if (!VM.BuildForOpenJDK) {
// This line was commented out for OpenJDK which led to a checkstyle
// failure because of an unused import. It is better to leave the line
// in. Removing and re-adding the import is error-prone as ThreadLocalState
// is using ArchitectureSpecific.
ThreadLocalState.boot();
}
=======
if (VM.BuildForIA32) {
org.jikesrvm.ia32.ThreadLocalState.boot();
} else {
if (VM.VerifyAssertions) VM._assert(VM.BuildForPowerPC);
org.jikesrvm.ppc.ThreadLocalState.boot();
}
>>>>>>>
// TODO get thread local state working
if (!VM.BuildForOpenJDK) {
if (VM.BuildForIA32) {
org.jikesrvm.ia32.ThreadLocalState.boot();
} else {
if (VM.VerifyAssertions) VM._assert(VM.BuildForPowerPC);
org.jikesrvm.ppc.ThreadLocalState.boot();
}
} |
<<<<<<<
/*
public static class When_a_piece_is_dropped extends TestCase {
=======
>>>>>>>
<<<<<<<
/*
public static class When_a_piece_reaches_the_bottom extends TestCase {
private Board board;
=======
public class When_a_piece_reaches_the_bottom {
>>>>>>>
/*
public class When_a_piece_reaches_the_bottom {
<<<<<<<
// public void test_It_stops_when_it_hits_the_other_piece() {
// board.tick();
// assertFalse(board.hasFalling());
// assertEquals("" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// }
=======
@Test
public void it_stops_when_it_hits_the_other_piece() {
board.tick();
assertFalse(board.hasFalling());
assertEquals("" +
"........\n" +
"........\n" +
"....T...\n" +
"...TTT..\n" +
"....T...\n" +
"...TTT..\n", board.toString());
}
>>>>>>>
// @Test
// public void it_stops_when_it_hits_the_other_piece() {
// board.tick();
// assertFalse(board.hasFalling());
// assertEquals("" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// } |
<<<<<<<
// @Test
// public void it_stops_when_it_hits_the_bottom() {
// board.tick();
// assertFalse(board.hasFalling());
// assertEquals("" +
// "........\n" +
// "........\n" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// }
=======
@Test
public void it_stops_when_it_hits_the_bottom() {
board.tick();
assertEquals("" +
"........\n" +
"........\n" +
"........\n" +
"........\n" +
"....T...\n" +
"...TTT..\n", board.toString());
assertFalse(board.hasFalling());
}
>>>>>>>
// @Test
// public void it_stops_when_it_hits_the_bottom() {
// board.tick();
// assertEquals("" +
// "........\n" +
// "........\n" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// assertFalse(board.hasFalling());
// }
<<<<<<<
// @Test
// public void it_stops_when_it_hits_the_other_piece() {
// board.tick();
// assertFalse(board.hasFalling());
// assertEquals("" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// }
=======
@Test
public void it_stops_when_it_hits_the_other_piece() {
board.tick();
assertEquals("" +
"........\n" +
"........\n" +
"....T...\n" +
"...TTT..\n" +
"....T...\n" +
"...TTT..\n", board.toString());
assertFalse(board.hasFalling());
}
>>>>>>>
// @Test
// public void it_stops_when_it_hits_the_other_piece() {
// board.tick();
// assertEquals("" +
// "........\n" +
// "........\n" +
// "....T...\n" +
// "...TTT..\n" +
// "....T...\n" +
// "...TTT..\n", board.toString());
// assertFalse(board.hasFalling());
// } |
<<<<<<<
/*
public static class A_piece_of_3x3_blocks extends TestCase {
=======
>>>>>>>
<<<<<<<
// public void test_Can_be_rotated_right() {
// piece = piece.rotateRight();
// assertEquals("" +
// "...\n" +
// ".XX\n" +
// "...\n", piece.toString());
// }
// public void test_Can_be_rotated_left() {
// piece = piece.rotateLeft();
// assertEquals("" +
// "...\n" +
// "XX.\n" +
// "...\n", piece.toString());
// }
=======
@Test
public void can_be_rotated_right() {
piece = piece.rotateRight();
assertEquals("" +
"...\n" +
".XX\n" +
"...\n", piece.toString());
}
@Test
public void can_be_rotated_left() {
piece = piece.rotateLeft();
assertEquals("" +
"...\n" +
"XX.\n" +
"...\n", piece.toString());
}
>>>>>>>
// @Test
// public void can_be_rotated_right() {
// piece = piece.rotateRight();
// assertEquals("" +
// "...\n" +
// ".XX\n" +
// "...\n", piece.toString());
// }
// @Test
// public void can_be_rotated_left() {
// piece = piece.rotateLeft();
// assertEquals("" +
// "...\n" +
// "XX.\n" +
// "...\n", piece.toString());
// }
<<<<<<<
/*
public static class A_piece_of_5x5_blocks extends TestCase {
private Piece piece;
=======
public class A_piece_of_5x5_blocks {
>>>>>>>
/*
public class A_piece_of_5x5_blocks {
<<<<<<<
// public void test_Can_be_rotated_right() {
// piece = piece.rotateRight();
// assertEquals("" +
// ".....\n" +
// ".....\n" +
// "..XXX\n" +
// "...XX\n" +
// "....X\n", piece.toString());
// }
// public void test_Can_be_rotated_left() {
// piece = piece.rotateLeft();
// assertEquals("" +
// "X....\n" +
// "XX...\n" +
// "XXX..\n" +
// ".....\n" +
// ".....\n", piece.toString());
// }
=======
@Test
public void can_be_rotated_right() {
piece = piece.rotateRight();
assertEquals("" +
".....\n" +
".....\n" +
"..XXX\n" +
"...XX\n" +
"....X\n", piece.toString());
}
@Test
public void can_be_rotated_left() {
piece = piece.rotateLeft();
assertEquals("" +
"X....\n" +
"XX...\n" +
"XXX..\n" +
".....\n" +
".....\n", piece.toString());
}
>>>>>>>
// @Test
// public void can_be_rotated_right() {
// piece = piece.rotateRight();
// assertEquals("" +
// ".....\n" +
// ".....\n" +
// "..XXX\n" +
// "...XX\n" +
// "....X\n", piece.toString());
// }
// @Test
// public void can_be_rotated_left() {
// piece = piece.rotateLeft();
// assertEquals("" +
// "X....\n" +
// "XX...\n" +
// "XXX..\n" +
// ".....\n" +
// ".....\n", piece.toString());
// } |
<<<<<<<
import net.minecraft.block.BlockState;
=======
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IItemColor;
>>>>>>>
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
<<<<<<<
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
=======
import net.minecraftforge.common.ForgeHooks;
>>>>>>>
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks; |
<<<<<<<
=======
BlockPos pos = blockVec.toBlockPos();
PieceTrickBreakBlock.removeBlockWithDrops(context, context.caster, context.caster.getEntityWorld(), tool, pos, true);
>>>>>>> |
<<<<<<<
Double d4 = d3 != null ? (d1 / (d2 * d3)) : (d1 / d2);
if (d4<0)
return Math.ceil(d4);
return Math.floor(d4);
=======
return d3 != null ? (int) (d1 / (d2.doubleValue() * d3.doubleValue())) : (int) (d1 / d2.doubleValue());
>>>>>>>
Double d4 = d3 != null ? (d1 / (d2.doubleValue() * d3.doubleValue())) : (d1 / d2.doubleValue());
if (d4<0)
return Math.ceil(d4);
return Math.floor(d4); |
<<<<<<<
import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation;
=======
import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFolderOperation;
import com.owncloud.android.oc_framework.operations.RemoteFile;
>>>>>>>
import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation;
import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFolderOperation;
import com.owncloud.android.oc_framework.operations.RemoteFile; |
<<<<<<<
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
=======
import com.google.common.collect.Lists;
>>>>>>>
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.collect.Lists;
<<<<<<<
if (article.getPublicationDate() != null) {
this.publicationDate = new DateTime(article.getPublicationDate().getTime(), tenantZone);
}
=======
this.publicationDate = article.getPublicationDate();
if (article.getAddons().isLoaded()) {
List<AddonRepresentation> addons = Lists.newArrayList();
for (Addon a : article.getAddons().get()) {
addons.add(new AddonRepresentation(a));
}
this.addons = addons;
}
>>>>>>>
if (article.getPublicationDate() != null) {
this.publicationDate = new DateTime(article.getPublicationDate().getTime(), tenantZone);
}
if (article.getAddons().isLoaded()) {
List<AddonRepresentation> addons = Lists.newArrayList();
for (Addon a : article.getAddons().get()) {
addons.add(new AddonRepresentation(a));
}
this.addons = addons;
} |
<<<<<<<
private SecureGroovyScript secureGroovyScript;
=======
private final String groovyScriptContent;
/**
* If enabled, Jenkins will try taking scripts and property files from the master instead of the agent.
* @since 2.0 Enabled if and only if the global setting allows it.
* @see EnvInjectPluginConfiguration#enableLoadingFromMaster
*/
>>>>>>>
private SecureGroovyScript secureGroovyScript;
/**
* If enabled, Jenkins will try taking scripts and property files from the master instead of the agent.
* @since 2.0 Enabled if and only if the global setting allows it.
* @see EnvInjectPluginConfiguration#enableLoadingFromMaster
*/ |
<<<<<<<
import com.cloud.storage.Storage.StoragePoolType;
=======
import com.cloud.storage.Storage;
>>>>>>>
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.StoragePoolType;
<<<<<<<
import com.cloud.storage.Volume;
=======
import com.cloud.storage.Storage.StoragePoolType;
>>>>>>> |
<<<<<<<
import com.cloud.network.dao.FirewallRulesCidrsDao;
=======
import com.cloud.network.NetworkVO;
>>>>>>>
import com.cloud.network.dao.FirewallRulesCidrsDao;
import com.cloud.network.NetworkVO;
<<<<<<<
@Inject
FirewallRulesCidrsDao _firewallCidrsDao;
=======
@Inject
ElasticLoadBalancerManager _elbMgr;
@Inject
NetworkDao _networkDao;
>>>>>>>
@Inject
FirewallRulesCidrsDao _firewallCidrsDao;
@Inject
ElasticLoadBalancerManager _elbMgr;
@Inject
NetworkDao _networkDao;
<<<<<<<
@Override @DB
=======
@Override
>>>>>>>
@Override @DB |
<<<<<<<
@Override
public List<DomainRouterVO> findByNetworkOutsideThePod(long networkId, long podId, State state) {
SearchCriteria<DomainRouterVO> sc = OutsidePodSearch.create();
sc.setParameters("network", networkId);
sc.setParameters("podId", podId);
sc.setParameters("state", state);
return listBy(sc);
}
=======
@Override
public List<DomainRouterVO> listByNetworkAndState(long networkId, State state) {
SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
sc.setParameters("network", networkId);
if (state != null) {
sc.setParameters("state", state);
}
return listBy(sc);
}
>>>>>>>
@Override
public List<DomainRouterVO> findByNetworkOutsideThePod(long networkId, long podId, State state) {
SearchCriteria<DomainRouterVO> sc = OutsidePodSearch.create();
sc.setParameters("network", networkId);
sc.setParameters("podId", podId);
sc.setParameters("state", state);
return listBy(sc);
}
@Override
public List<DomainRouterVO> listByNetworkAndState(long networkId, State state) {
SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
sc.setParameters("network", networkId);
if (state != null) {
sc.setParameters("state", state);
}
return listBy(sc);
} |
<<<<<<<
import java.util.UUID;
=======
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
>>>>>>>
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
<<<<<<<
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering")
private String availability;
@Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the network offering, integer")
private Integer sortKey;
=======
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Supported values are Required, Optional and Unavailable")
private String availability;
@Parameter(name=ApiConstants.DHCP_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dhcp service")
private Boolean dhcpService;
@Parameter(name=ApiConstants.DNS_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dns service")
private Boolean dnsService;
@Parameter(name=ApiConstants.GATEWAY_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports gateway service")
private Boolean gatewayService;
@Parameter(name=ApiConstants.FIREWALL_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports firewall service")
private Boolean firewallService;
@Parameter(name=ApiConstants.LB_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports lb service")
private Boolean lbService;
@Parameter(name=ApiConstants.USERDATA_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports user data service")
private Boolean userdataService;
@Parameter(name=ApiConstants.SOURCE_NAT_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports source nat service")
private Boolean sourceNatService;
@Parameter(name=ApiConstants.STATIC_NAT_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports static nat service")
private Boolean staticNatService;
@Parameter(name=ApiConstants.PORT_FORWARDING_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports port forwarding service")
private Boolean portForwardingService;
@Parameter(name=ApiConstants.VPN_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports vpn service")
private Boolean vpnService;
@Parameter(name=ApiConstants.SECURITY_GROUP_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports security service")
private Boolean securityGroupService;
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
private Map serviceCapabilistList;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
private String state;
>>>>>>>
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering")
private String availability;
@Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the network offering, integer")
private Integer sortKey;
@Parameter(name=ApiConstants.DHCP_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dhcp service")
private Boolean dhcpService;
@Parameter(name=ApiConstants.DNS_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dns service")
private Boolean dnsService;
@Parameter(name=ApiConstants.GATEWAY_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports gateway service")
private Boolean gatewayService;
@Parameter(name=ApiConstants.FIREWALL_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports firewall service")
private Boolean firewallService;
@Parameter(name=ApiConstants.LB_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports lb service")
private Boolean lbService;
@Parameter(name=ApiConstants.USERDATA_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports user data service")
private Boolean userdataService;
@Parameter(name=ApiConstants.SOURCE_NAT_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports source nat service")
private Boolean sourceNatService;
@Parameter(name=ApiConstants.STATIC_NAT_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports static nat service")
private Boolean staticNatService;
@Parameter(name=ApiConstants.PORT_FORWARDING_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports port forwarding service")
private Boolean portForwardingService;
@Parameter(name=ApiConstants.VPN_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports vpn service")
private Boolean vpnService;
@Parameter(name=ApiConstants.SECURITY_GROUP_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports security service")
private Boolean securityGroupService;
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
private Map serviceCapabilistList;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
private String state; |
<<<<<<<
=======
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Start2Answer;
import com.cloud.agent.api.Start2Command;
import com.cloud.agent.api.to.NicTO;
>>>>>>>
import com.cloud.agent.api.Start2Answer;
import com.cloud.agent.api.Start2Command;
import com.cloud.agent.api.to.NicTO;
<<<<<<<
import com.cloud.agent.manager.AgentManager;
=======
import com.cloud.agent.api.to.VolumeTO;
>>>>>>>
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.agent.manager.AgentManager; |
<<<<<<<
@SerializedName("id") @Param(description="the id of the network offering")
private IdentityProxy id = new IdentityProxy("network_offerings");
=======
@SerializedName(ApiConstants.ID) @Param(description="the id of the network offering")
private Long id;
>>>>>>>
@SerializedName("id") @Param(description="the id of the network offering")
private final IdentityProxy id = new IdentityProxy("network_offerings");
<<<<<<<
public Long getId() {
return id.getValue();
}
=======
@SerializedName(ApiConstants.STATE) @Param(description="state of the network offering. Can be Disabled/Enabled/Inactive")
private String state;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest type of the network offering, can be Shared or Isolated")
private String guestIpType;
@SerializedName("service") @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@SerializedName(ApiConstants.IS_SHARED) @Param(description="true if load balncer service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isLbShared;
@SerializedName(ApiConstants.IS_SHARED) @Param(description="true if soruce NAT service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isSourceNatShared;
>>>>>>>
public Long getId() {
return id.getValue();
}
@SerializedName(ApiConstants.STATE) @Param(description="state of the network offering. Can be Disabled/Enabled/Inactive")
private String state;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest type of the network offering, can be Shared or Isolated")
private String guestIpType;
@SerializedName("service") @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@SerializedName(ApiConstants.IS_SHARED) @Param(description="true if load balncer service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isLbShared;
@SerializedName(ApiConstants.IS_SHARED) @Param(description="true if soruce NAT service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isSourceNatShared; |
<<<<<<<
import com.cloud.offering.ServiceOffering.GuestIpType;
=======
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.GuestIpType;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.VolumeVO;
>>>>>>>
import com.cloud.offering.NetworkOffering; |
<<<<<<<
import com.owncloud.android.db.UploadDbHandler;
=======
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.DbHandler;
>>>>>>>
import com.owncloud.android.db.UploadDbHandler;
import com.owncloud.android.datamodel.OCFile;
<<<<<<<
private UploadDbHandler mDbHandler;
=======
private static final int ACTION_SELECT_UPLOAD_PATH = 1;
private static final int ACTION_SELECT_UPLOAD_VIDEO_PATH = 2;
private DbHandler mDbHandler;
>>>>>>>
private UploadDbHandler mDbHandler;
private static final int ACTION_SELECT_UPLOAD_PATH = 1;
private static final int ACTION_SELECT_UPLOAD_VIDEO_PATH = 2; |
<<<<<<<
=======
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.VMTemplateHostVO;
>>>>>>>
import com.cloud.hypervisor.Hypervisor.HypervisorType; |
<<<<<<<
@Override @SuppressWarnings("unchecked")
public ResponseObject getResponse() {
List<VolumeVO> volumes = (List<VolumeVO>)getResponseObject();
ListResponse response = new ListResponse();
List<VolumeResponse> volResponses = new ArrayList<VolumeResponse>();
=======
Long accountId = null;
boolean isAdmin = false;
if ((account == null) || isAdmin(account.getType())) {
isAdmin = true;
if (domainId != null) {
if ((account != null) && !getManagementServer().isChildDomain(account.getDomainId(), domainId)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid domain id (" + domainId + ") given, unable to list volumes.");
}
if (accountName != null) {
Account userAccount = getManagementServer().findActiveAccount(accountName, domainId);
if (userAccount != null) {
accountId = userAccount.getId();
} else {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "could not find account " + accountName + " in domain " + domainId);
}
}
} else {
domainId = ((account == null) ? DomainVO.ROOT_DOMAIN : account.getDomainId());
}
} else {
accountId = account.getId();
}
Long[] accountIds = null;
if (accountId != null) {
accountIds = new Long[1];
accountIds[0] = accountId;
}
Long startIndex = Long.valueOf(0);
int pageSizeNum = 50;
if (pageSize != null) {
pageSizeNum = pageSize.intValue();
}
if (page != null) {
int pageNum = page.intValue();
if (pageNum > 0) {
startIndex = Long.valueOf(pageSizeNum * (pageNum-1));
}
}
Criteria c = new Criteria("created", Boolean.FALSE, startIndex, Long.valueOf(pageSizeNum));
c.addCriteria(Criteria.ACCOUNTID, accountIds);
if (keyword != null) {
c.addCriteria(Criteria.KEYWORD, keyword);
} else {
c.addCriteria(Criteria.ID, id);
c.addCriteria(Criteria.INSTANCEID, vmId);
c.addCriteria(Criteria.NAME, name);
c.addCriteria(Criteria.VTYPE, type);
if (isAdmin) {
c.addCriteria(Criteria.DATACENTERID, zoneId);
c.addCriteria(Criteria.PODID, podId);
c.addCriteria(Criteria.HOSTID, hostId);
c.addCriteria(Criteria.DOMAINID, domainId);
}
}
List<VolumeVO> volumes = getManagementServer().searchForVolumes(c);
if (volumes == null) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "unable to find volumes");
}
List<Pair<String, Object>> volumeTags = new ArrayList<Pair<String, Object>>();
Object[] vTag = new Object[volumes.size()];
int i = 0;
>>>>>>>
@Override @SuppressWarnings("unchecked")
public ResponseObject getResponse() {
List<VolumeVO> volumes = (List<VolumeVO>)getResponseObject();
ListResponse response = new ListResponse();
List<VolumeResponse> volResponses = new ArrayList<VolumeResponse>();
<<<<<<<
volResponse.setZoneId(volume.getDataCenterId());
volResponse.setZoneName(ApiDBUtils.findZoneById(volume.getDataCenterId()).getName());
volResponse.setVolumeType(volume.getVolumeType().toString());
volResponse.setDeviceId(volume.getDeviceId());
Long instanceId = volume.getInstanceId();
if (instanceId != null) {
VMInstanceVO vm = ApiDBUtils.findVMInstanceById(instanceId);
volResponse.setVirtualMachineId(vm.getId());
volResponse.setVirtualMachineName(vm.getName());
volResponse.setVirtualMachineDisplayName(vm.getName());
volResponse.setVirtualMachineState(vm.getState().toString());
}
// Show the virtual size of the volume
volResponse.setSize(volume.getSize());
volResponse.setCreated(volume.getCreated());
volResponse.setState(volume.getStatus().toString());
Account accountTemp = ApiDBUtils.findAccountById(volume.getAccountId());
if (accountTemp != null) {
volResponse.setAccountName(accountTemp.getAccountName());
volResponse.setDomainId(accountTemp.getDomainId());
volResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
}
String storageType;
=======
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(volume.getDataCenterId()).toString()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().findDataCenterById(volume.getDataCenterId()).getName()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.TYPE.getName(), volume.getVolumeType()));
//volumeData.add(new Pair<String, Object>(BaseCmd.Properties.HOST_NAME.getName(), getManagementServer().getHostBy(volume.getHostId()).getName()));
// //volume.getDeviceId() might be null
// if(volume.getDeviceId() != null)
// volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DEVICE_ID.getName(), Long.valueOf(volume.getDeviceId()).toString()));
Long instanceId = volume.getInstanceId();
if (instanceId != null) {
VMInstanceVO vm = getManagementServer().findVMInstanceById(instanceId);
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.VIRTUAL_MACHINE_ID.getName(), vm.getId()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.VIRTUAL_MACHINE_NAME.getName(), vm.getName()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.VIRTUAL_MACHINE_DISPLAYNAME.getName(), vm.getName()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.VIRTUAL_MACHINE_STATE.getName(), vm.getState()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DEVICE_ID.getName(), volume.getDeviceId()));
}
// Show the virtual size of the volume
long virtualSizeInBytes = volume.getSize();
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.SIZE.getName(), virtualSizeInBytes));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(volume.getCreated())));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.ATTACHED.getName(), getDateString(volume.getAttached())));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.STATE.getName(),volume.getStatus()));
Account accountTemp = getManagementServer().findAccountById(volume.getAccountId());
if (accountTemp != null) {
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), accountTemp.getAccountName()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), accountTemp.getDomainId()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(accountTemp.getDomainId()).getName()));
}
String storageType;
>>>>>>>
volResponse.setZoneId(volume.getDataCenterId());
volResponse.setZoneName(ApiDBUtils.findZoneById(volume.getDataCenterId()).getName());
volResponse.setVolumeType(volume.getVolumeType().toString());
volResponse.setDeviceId(volume.getDeviceId());
Long instanceId = volume.getInstanceId();
if (instanceId != null) {
VMInstanceVO vm = ApiDBUtils.findVMInstanceById(instanceId);
volResponse.setVirtualMachineId(vm.getId());
volResponse.setVirtualMachineName(vm.getName());
volResponse.setVirtualMachineDisplayName(vm.getName());
volResponse.setVirtualMachineState(vm.getState().toString());
}
// Show the virtual size of the volume
volResponse.setSize(volume.getSize());
volResponse.setCreated(volume.getCreated());
volResponse.setState(volume.getStatus().toString());
Account accountTemp = ApiDBUtils.findAccountById(volume.getAccountId());
if (accountTemp != null) {
volResponse.setAccountName(accountTemp.getAccountName());
volResponse.setDomainId(accountTemp.getDomainId());
volResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
}
String storageType;
<<<<<<<
volResponse.setDiskOfferingId(volume.getDiskOfferingId());
if (volume.getDiskOfferingId() != null) {
DiskOfferingVO diskOffering = ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
volResponse.setDiskOfferingName(diskOffering.getName());
volResponse.setDiskOfferingDisplayText(diskOffering.getDisplayText());
}
=======
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DISK_OFFERING_ID.getName(),volume.getDiskOfferingId()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DISK_OFFERING_NAME.getName(),getManagementServer().findDiskOfferingById(volume.getDiskOfferingId()).getName()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.DISK_OFFERING_DISPLAY_TEXT.getName(),getManagementServer().findDiskOfferingById(volume.getDiskOfferingId()).getDisplayText()));
>>>>>>>
volResponse.setDiskOfferingId(volume.getDiskOfferingId());
DiskOfferingVO diskOffering = ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
volResponse.setDiskOfferingName(diskOffering.getName());
volResponse.setDiskOfferingDisplayText(diskOffering.getDisplayText());
<<<<<<<
String poolName = (poolId == null) ? "none" : ApiDBUtils.findStoragePoolById(poolId).getName();
volResponse.setStoragePoolName(poolName);
volResponse.setResponseName("volume");
volResponses.add(volResponse);
}
response.setResponses(volResponses);
response.setResponseName(getName());
return response;
=======
String poolName = (poolId == null) ? "none" : getManagementServer().findPoolById(poolId).getName();
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.STORAGE.getName(), poolName));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.SOURCE_ID.getName(),volume.getSourceId()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.SOURCE_TYPE.getName(),volume.getSourceType().toString()));
vTag[i++] = volumeData;
}
Pair<String, Object> volumeTag = new Pair<String, Object>("volume", vTag);
volumeTags.add(volumeTag);
return volumeTags;
>>>>>>>
String poolName = (poolId == null) ? "none" : ApiDBUtils.findStoragePoolById(poolId).getName();
volResponse.setStoragePoolName(poolName);
volResponse.setResponseName("volume");
volResponses.add(volResponse);
}
response.setResponses(volResponses);
response.setResponseName(getName());
return response; |
<<<<<<<
import java.sql.Connection;
import java.sql.SQLException;
=======
import java.util.ArrayList;
>>>>>>>
import java.util.ArrayList;
<<<<<<<
import com.cloud.utils.component.Inject;
import com.cloud.utils.db.ConnectionConcierge;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GlobalLock;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
=======
import com.cloud.utils.db.DB;
import com.cloud.utils.time.InaccurateClock;
>>>>>>>
import com.cloud.utils.db.DB;
import com.cloud.utils.time.InaccurateClock;
<<<<<<<
private AlertManager _alertMgr;
private long _msId;
private ConnectionConcierge _concierge;
@Inject
ClusterDao _clusterDao;
protected AgentMonitor() {
}
=======
private AlertManager _alertMgr;
private long _msId;
// private ConnectionConcierge _concierge;
private Map<Long, Long> _pingMap;
protected AgentMonitor() {
}
>>>>>>>
private AlertManager _alertMgr;
private long _msId;
// private ConnectionConcierge _concierge;
private Map<Long, Long> _pingMap;
protected AgentMonitor() {
}
<<<<<<<
} finally {
lock.unlock();
=======
>>>>>>>
<<<<<<<
Transaction txn = Transaction.currentTxn();
txn.transitToUserManagedConnection(_concierge.conn());
try {
HostVO host = _hostDao.findById(agentId);
if( host == null ) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Cant not find host " + agentId);
}
} else {
_hostDao.updateStatus(host, Event.Ping, _msId);
}
processed = true;
} finally {
txn.transitToAutoManagedConnection(Transaction.CLOUD_DB);
}
=======
pingBy(agentId);
>>>>>>>
pingBy(agentId);
<<<<<<<
=======
protected List<Long> findAgentsBehindOnPing() {
List<Long> agentsBehind = new ArrayList<Long>();
long cutoffTime = InaccurateClock.getTimeInSeconds() - _pingTimeout;
for (Map.Entry<Long, Long> entry : _pingMap.entrySet()) {
if (entry.getValue() < cutoffTime) {
agentsBehind.add(entry.getKey());
}
}
if (agentsBehind.size() > 0) {
s_logger.info("Found the following agents behind on ping: " + agentsBehind);
}
return agentsBehind;
}
/**
* @deprecated We're using the in-memory
*/
@Deprecated
protected List<HostVO> findHostsBehindOnPing() {
long time = (System.currentTimeMillis() >> 10) - _pingTimeout;
List<HostVO> hosts = _hostDao.findLostHosts(time);
if (s_logger.isInfoEnabled()) {
s_logger.info("Found " + hosts.size() + " hosts behind on ping. pingTimeout : " + _pingTimeout +
", mark time : " + time);
}
for (HostVO host : hosts) {
if (host.getType().equals(Host.Type.ExternalFirewall) ||
host.getType().equals(Host.Type.ExternalLoadBalancer) ||
host.getType().equals(Host.Type.TrafficMonitor) ||
host.getType().equals(Host.Type.SecondaryStorage)) {
continue;
}
if (host.getManagementServerId() == null || host.getManagementServerId() == _msId) {
if (s_logger.isInfoEnabled()) {
s_logger.info("Asking agent mgr to investgate why host " + host.getId() +
" is behind on ping. last ping time: " + host.getLastPinged());
}
_agentMgr.disconnect(host.getId(), Event.PingTimeout, true);
}
}
return hosts;
}
>>>>>>>
protected List<Long> findAgentsBehindOnPing() {
List<Long> agentsBehind = new ArrayList<Long>();
long cutoffTime = InaccurateClock.getTimeInSeconds() - _pingTimeout;
for (Map.Entry<Long, Long> entry : _pingMap.entrySet()) {
if (entry.getValue() < cutoffTime) {
agentsBehind.add(entry.getKey());
}
}
if (agentsBehind.size() > 0) {
s_logger.info("Found the following agents behind on ping: " + agentsBehind);
}
return agentsBehind;
}
/**
* @deprecated We're using the in-memory
*/
@Deprecated
protected List<HostVO> findHostsBehindOnPing() {
long time = (System.currentTimeMillis() >> 10) - _pingTimeout;
List<HostVO> hosts = _hostDao.findLostHosts(time);
if (s_logger.isInfoEnabled()) {
s_logger.info("Found " + hosts.size() + " hosts behind on ping. pingTimeout : " + _pingTimeout +
", mark time : " + time);
}
for (HostVO host : hosts) {
if (host.getType().equals(Host.Type.ExternalFirewall) ||
host.getType().equals(Host.Type.ExternalLoadBalancer) ||
host.getType().equals(Host.Type.TrafficMonitor) ||
host.getType().equals(Host.Type.SecondaryStorage)) {
continue;
}
if (host.getManagementServerId() == null || host.getManagementServerId() == _msId) {
if (s_logger.isInfoEnabled()) {
s_logger.info("Asking agent mgr to investgate why host " + host.getId() +
" is behind on ping. last ping time: " + host.getLastPinged());
}
_agentMgr.disconnect(host.getId(), Event.PingTimeout, true);
}
}
return hosts;
}
<<<<<<<
=======
if (host.getType().equals(Host.Type.ExternalFirewall) ||
host.getType().equals(Host.Type.ExternalLoadBalancer) ||
host.getType().equals(Host.Type.TrafficMonitor) ||
host.getType().equals(Host.Type.SecondaryStorage)) {
return;
}
// NOTE: We don't use pingBy here because we're initiating.
_pingMap.put(host.getId(), InaccurateClock.getTimeInSeconds());
>>>>>>>
if (host.getType().equals(Host.Type.ExternalFirewall) ||
host.getType().equals(Host.Type.ExternalLoadBalancer) ||
host.getType().equals(Host.Type.TrafficMonitor) ||
host.getType().equals(Host.Type.SecondaryStorage)) {
return;
}
// NOTE: We don't use pingBy here because we're initiating.
_pingMap.put(host.getId(), InaccurateClock.getTimeInSeconds());
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import com.cloud.api.Identity;
import com.cloud.network.Network.GuestIpType;
=======
import com.cloud.network.Network;
>>>>>>>
import com.cloud.api.Identity;
import com.cloud.network.Network;
<<<<<<<
boolean sharedSourceNatService;
@Column(name="guest_type")
GuestIpType guestType;
@Column(name="redundant_router")
boolean redundantRouter;
@Column(name="sort_key")
int sortKey;
=======
boolean sharedSourceNat;
>>>>>>>
boolean sharedSourceNatService;
@Column(name="redundant_router")
boolean redundantRouter;
@Column(name="sort_key")
int sortKey;
boolean sharedSourceNat;
<<<<<<<
this.uuid = UUID.randomUUID().toString();
=======
this.tags = tags;
this.guestType = guestType;
this.dedicatedLB = true;
this.sharedSourceNat =false;
}
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections,
boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean dedicatedLb, boolean sharedSourceNat) {
this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, concurrentConnections, isDefault, availability, tags, guestType);
this.dedicatedLB = dedicatedLb;
this.sharedSourceNat = sharedSourceNat;
}
public NetworkOfferingVO() {
>>>>>>>
this.uuid = UUID.randomUUID().toString();
this.tags = tags;
this.guestType = guestType;
this.dedicatedLB = true;
this.sharedSourceNat =false;
}
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections,
boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean dedicatedLb, boolean sharedSourceNat) {
this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, concurrentConnections, isDefault, availability, tags, guestType);
this.dedicatedLB = dedicatedLb;
this.sharedSourceNat = sharedSourceNat;
}
public NetworkOfferingVO() { |
<<<<<<<
import com.cloud.agent.api.storage.CreatePrivateTemplateCommand;
import com.cloud.agent.manager.AgentManager;
=======
>>>>>>>
import com.cloud.agent.manager.AgentManager;
<<<<<<<
=======
@Override
public VMTemplateVO createPrivateTemplateRecord(Long userId, long volumeId, String name, String description, long guestOSId, Boolean requiresHvm, Integer bits, Boolean passwordEnabled, boolean isPublic, boolean featured)
throws InvalidParameterValueException {
>>>>>>>
<<<<<<<
if (!isAdmin) {
if (account.getId() != volume.getAccountId()) {
throw new PermissionDeniedException("Unable to create a template from volume with id " + volumeId + ", permission denied.");
}
} else if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(), volume.getDomainId())) {
throw new PermissionDeniedException("Unable to create a template from volume with id " + volumeId + ", permission denied.");
}
String name = cmd.getTemplateName();
if ((name == null) || (name.length() > 32)) {
throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
}
if (!name.matches("^[\\p{Alnum} ._-]+")) {
throw new InvalidParameterValueException("Only alphanumeric, space, dot, dashes and underscore characters allowed");
}
String uniqueName = Long.valueOf((userId == null)?1:userId).toString() + Long.valueOf(volumeId).toString() + UUID.nameUUIDFromBytes(name.getBytes()).toString();
VMTemplateVO existingTemplate = _templateDao.findByTemplateNameAccountId(name, volume.getAccountId());
if (existingTemplate != null) {
throw new InvalidParameterValueException("Failed to create private template " + name + ", a template with that name already exists.");
}
// do some parameter defaulting
Integer bits = cmd.getBits();
Boolean requiresHvm = cmd.getRequiresHvm();
Boolean passwordEnabled = cmd.isPasswordEnabled();
Boolean isPublic = cmd.isPublic();
Boolean featured = cmd.isFeatured();
=======
HypervisorType hyperType = _volsDao.getHypervisorType(volumeId);
>>>>>>>
if (!isAdmin) {
if (account.getId() != volume.getAccountId()) {
throw new PermissionDeniedException("Unable to create a template from volume with id " + volumeId + ", permission denied.");
}
} else if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(), volume.getDomainId())) {
throw new PermissionDeniedException("Unable to create a template from volume with id " + volumeId + ", permission denied.");
}
String name = cmd.getTemplateName();
if ((name == null) || (name.length() > 32)) {
throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
}
if (!name.matches("^[\\p{Alnum} ._-]+")) {
throw new InvalidParameterValueException("Only alphanumeric, space, dot, dashes and underscore characters allowed");
}
String uniqueName = Long.valueOf((userId == null)?1:userId).toString() + Long.valueOf(volumeId).toString() + UUID.nameUUIDFromBytes(name.getBytes()).toString();
VMTemplateVO existingTemplate = _templateDao.findByTemplateNameAccountId(name, volume.getAccountId());
if (existingTemplate != null) {
throw new InvalidParameterValueException("Failed to create private template " + name + ", a template with that name already exists.");
}
// do some parameter defaulting
Integer bits = cmd.getBits();
Boolean requiresHvm = cmd.getRequiresHvm();
Boolean passwordEnabled = cmd.isPasswordEnabled();
Boolean isPublic = cmd.isPublic();
Boolean featured = cmd.isFeatured();
HypervisorType hyperType = _volsDao.getHypervisorType(volumeId); |
<<<<<<<
List<HostVO> listSecondaryStorageHosts(long dataCenterId);
boolean directConnect(HostVO host, long msId);
List<HostVO> listDirectHostsBy(long msId, Status status);
List<HostVO> listManagedDirectAgents();
List<HostVO> listManagedRoutingAgents();
HostVO findTrafficMonitorHost();
List<HostVO> listLocalSecondaryStorageHosts();
List<HostVO> listLocalSecondaryStorageHosts(long dataCenterId);
List<HostVO> listAllSecondaryStorageHosts(long dataCenterId);
List<HostVO> listByManagementServer(long msId);
List<HostVO> listSecondaryStorageVM(long dcId);
List<HostVO> listAllRoutingAgents();
List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
=======
List<HostVO> listSecondaryStorageHosts(long dataCenterId);
List<HostVO> listByInAllStatus(Type type, Long clusterId, Long podId, long dcId);
>>>>>>>
List<HostVO> listSecondaryStorageHosts(long dataCenterId);
boolean directConnect(HostVO host, long msId);
List<HostVO> listDirectHostsBy(long msId, Status status);
List<HostVO> listManagedDirectAgents();
List<HostVO> listManagedRoutingAgents();
HostVO findTrafficMonitorHost();
List<HostVO> listLocalSecondaryStorageHosts();
List<HostVO> listLocalSecondaryStorageHosts(long dataCenterId);
List<HostVO> listAllSecondaryStorageHosts(long dataCenterId);
List<HostVO> listByManagementServer(long msId);
List<HostVO> listSecondaryStorageVM(long dcId);
List<HostVO> listAllRoutingAgents();
List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
List<HostVO> listByInAllStatus(Type type, Long clusterId, Long podId, long dcId); |
<<<<<<<
private String description;
@Column(name="allocation_state")
@Enumerated(value=EnumType.STRING)
AllocationState allocationState;
=======
private String description;
@Column(name = "external_dhcp")
private Boolean externalDhcp;
>>>>>>>
private String description;
@Column(name="allocation_state")
@Enumerated(value=EnumType.STRING)
AllocationState allocationState;
@Column(name = "external_dhcp")
private Boolean externalDhcp;
<<<<<<<
this.description = description;
this.allocationState = Grouping.AllocationState.Enabled;
}
=======
this.description = description;
this.externalDhcp = false;
}
>>>>>>>
this.description = description;
this.allocationState = Grouping.AllocationState.Enabled;
this.externalDhcp = false;
} |
<<<<<<<
import com.cloud.agent.manager.AgentManager;
=======
import com.cloud.api.commands.CreateNetworkGroupCmd;
>>>>>>>
import com.cloud.agent.manager.AgentManager;
import com.cloud.api.commands.CreateNetworkGroupCmd; |
<<<<<<<
import com.owncloud.android.files.services.FileUploadService;
=======
>>>>>>>
import com.owncloud.android.files.services.FileUploadService;
<<<<<<<
import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder;
=======
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
>>>>>>>
import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder;
<<<<<<<
bindService(new Intent(this, FileUploadService.class), mUploadServiceConnection, Context.BIND_AUTO_CREATE);
=======
bindService(new Intent(this, FileUploader.class), mUploadServiceConnection,
Context.BIND_AUTO_CREATE);
}
}
@Override
protected void onNewIntent (Intent intent) {
Log_OC.v(TAG, "onNewIntent() start");
Account current = AccountUtils.getCurrentOwnCloudAccount(this);
if (current != null && mAccount != null && !mAccount.name.equals(current.name)) {
mAccount = current;
>>>>>>>
bindService(new Intent(this, FileUploadService.class), mUploadServiceConnection,
Context.BIND_AUTO_CREATE);
}
}
@Override
protected void onNewIntent (Intent intent) {
Log_OC.v(TAG, "onNewIntent() start");
Account current = AccountUtils.getCurrentOwnCloudAccount(this);
if (current != null && mAccount != null && !mAccount.name.equals(current.name)) {
mAccount = current; |
<<<<<<<
@Inject
protected HypervisorGuruManager _hvGuruMgr;
=======
@Inject SecondaryStorageVmManager _ssvmMgr;
>>>>>>>
@Inject
protected HypervisorGuruManager _hvGuruMgr;
@Inject SecondaryStorageVmManager _ssvmMgr;
<<<<<<<
@Override
@DB
public boolean deleteHost(long hostId, boolean isForced, boolean forceDestroy, User caller) {
// Check if the host exists
HostVO host = _hostDao.findById(hostId);
if (host == null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Host: " + hostId + " does not even exist. Delete call is ignored.");
}
return true;
}
AgentAttache attache = findAttache(hostId);
// Get storage pool host mappings here because they can be removed as a part of handleDisconnect later
List<StoragePoolHostVO> pools = _storagePoolHostDao.listByHostIdIncludingRemoved(hostId);
try {
if (host.getType() == Type.Routing) {
// Check if host is ready for removal
Status currentState = host.getStatus();
Status nextState = currentState.getNextStatus(Status.Event.Remove);
if (nextState == null) {
s_logger.debug("There is no transition from state " + currentState + " to state " + Status.Event.Remove);
return false;
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Deleting Host: " + hostId + " Guid:" + host.getGuid());
}
if (forceDestroy) {
//put local storage into mainenance mode, will set all the VMs on this local storage into stopped state
StoragePool storagePool = _storageMgr.findLocalStorageOnHost(host.getId());
if (storagePool != null) {
if (storagePool.getStatus() == StoragePoolStatus.Up || storagePool.getStatus() == StoragePoolStatus.ErrorInMaintenance) {
try {
storagePool = _storageSvr.preparePrimaryStorageForMaintenance(storagePool.getId());
if (storagePool == null) {
s_logger.debug("Failed to set primary storage into maintenance mode");
return false;
}
} catch (Exception e) {
s_logger.debug("Failed to set primary storage into maintenance mode, due to: " + e.toString());
return false;
}
}
List<VMInstanceVO> vmsOnLocalStorage = _storageMgr.listByStoragePool(storagePool.getId());
for (VMInstanceVO vm : vmsOnLocalStorage) {
if(!_vmMgr.destroy(vm, caller, _accountMgr.getAccount(vm.getAccountId()))) {
String errorMsg = "There was an error Destory the vm: " + vm + " as a part of hostDelete id=" + hostId;
s_logger.warn(errorMsg);
throw new CloudRuntimeException(errorMsg);
}
}
}
} else {
// Check if there are vms running/starting/stopping on this host
List<VMInstanceVO> vms = _vmDao.listByHostId(hostId);
if (!vms.isEmpty()) {
if (isForced) {
// Stop HA disabled vms and HA enabled vms in Stopping state
// Restart HA enabled vms
for (VMInstanceVO vm : vms) {
if (!vm.isHaEnabled() || vm.getState() == State.Stopping) {
s_logger.debug("Stopping vm: " + vm + " as a part of deleteHost id=" + hostId);
if (!_vmMgr.advanceStop(vm, true, caller, _accountMgr.getAccount(vm.getAccountId()))) {
String errorMsg = "There was an error stopping the vm: " + vm + " as a part of hostDelete id=" + hostId;
s_logger.warn(errorMsg);
throw new CloudRuntimeException(errorMsg);
}
} else if (vm.isHaEnabled() && (vm.getState() == State.Running || vm.getState() == State.Starting)) {
s_logger.debug("Scheduling restart for vm: " + vm + " " + vm.getState() + " on the host id=" + hostId);
_haMgr.scheduleRestart(vm, false);
}
}
} else {
throw new CloudRuntimeException("Unable to delete the host as there are vms in " + vms.get(0).getState() + " state using this host and isForced=false specified");
}
}
}
if (host.getHypervisorType() == HypervisorType.XenServer) {
if (host.getClusterId() != null) {
List<HostVO> hosts = _hostDao.listBy(Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
hosts.add(host);
boolean success = true;
for (HostVO thost : hosts) {
long thostId = thost.getId();
PoolEjectCommand eject = new PoolEjectCommand(host.getGuid());
Answer answer = easySend(thostId, eject);
if (answer != null && answer.getResult()) {
s_logger.debug("Eject Host: " + hostId + " from " + thostId + " Succeed");
success = true;
break;
} else {
success = false;
s_logger.warn("Eject Host: " + hostId + " from " + thostId + " failed due to " + (answer != null ? answer.getDetails() : "no answer"));
}
}
if (!success) {
String msg = "Unable to eject host " + host.getGuid() + " due to there is no host up in this cluster, please execute xe pool-eject host-uuid=" + host.getGuid()
+ "in this host " + host.getPrivateIpAddress();
s_logger.warn(msg);
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Unable to eject host " + host.getGuid(), msg);
}
}
} else if (host.getHypervisorType() == HypervisorType.KVM) {
try {
ShutdownCommand cmd = new ShutdownCommand(ShutdownCommand.DeleteHost, null);
send(host.getId(), cmd);
} catch (AgentUnavailableException e) {
s_logger.warn("Sending ShutdownCommand failed: ", e);
} catch (OperationTimedoutException e) {
s_logger.warn("Sending ShutdownCommand failed: ", e);
}
} else if (host.getHypervisorType() == HypervisorType.BareMetal) {
List<VMInstanceVO> deadVms = _vmDao.listByLastHostId(hostId);
for (VMInstanceVO vm : deadVms) {
if (vm.getState() == State.Running || vm.getHostId() != null) {
throw new CloudRuntimeException("VM " + vm.getId() + "is still running on host " + hostId);
}
_vmDao.remove(vm.getId());
}
}
}
Transaction txn = Transaction.currentTxn();
txn.start();
_dcDao.releasePrivateIpAddress(host.getPrivateIpAddress(), host.getDataCenterId(), null);
if (attache != null) {
handleDisconnect(attache, Status.Event.Remove, false);
}
// delete host details
_hostDetailsDao.deleteDetails(hostId);
host.setGuid(null);
Long clusterId = host.getClusterId();
host.setClusterId(null);
_hostDao.update(host.getId(), host);
_hostDao.remove(hostId);
if (clusterId != null) {
List<HostVO> hosts = _hostDao.listByCluster(clusterId);
if (hosts.size() == 0) {
ClusterVO cluster = _clusterDao.findById(clusterId);
cluster.setGuid(null);
_clusterDao.update(clusterId, cluster);
}
}
// Delete the associated entries in host ref table
_storagePoolHostDao.deletePrimaryRecordsForHost(hostId);
// For pool ids you got, delete local storage host entries in pool table where
for (StoragePoolHostVO pool : pools) {
Long poolId = pool.getPoolId();
StoragePoolVO storagePool = _storagePoolDao.findById(poolId);
if (storagePool.isLocal() && forceDestroy) {
storagePool.setUuid(null);
storagePool.setClusterId(null);
_storagePoolDao.update(poolId, storagePool);
_storagePoolDao.remove(poolId);
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_LOCAL_STORAGE, null, null, null, poolId);
s_logger.debug("Local storage id=" + poolId + " is removed as a part of host removal id=" + hostId);
}
}
//Delete op_host_capacity entries
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_MEMORY, null, null, null, hostId);
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_CPU, null, null, null, hostId);
txn.commit();
return true;
} catch (Throwable t) {
s_logger.error("Unable to delete host: " + hostId, t);
return false;
}
}
@Override
public boolean updateHostPassword(UpdateHostPasswordCmd upasscmd) {
if (upasscmd.getClusterId() == null) {
//update agent attache password
AgentAttache agent = this.findAttache(upasscmd.getHostId());
if (!(agent instanceof DirectAgentAttache)) {
return false;
}
UpdateHostPasswordCommand cmd = new UpdateHostPasswordCommand(upasscmd.getUsername(), upasscmd.getPassword());
agent.updatePassword(cmd);
}
else {
// get agents for the cluster
List<HostVO> hosts = _hostDao.listByCluster(upasscmd.getClusterId());
for (HostVO h : hosts) {
AgentAttache agent = this.findAttache(h.getId());
if (!(agent instanceof DirectAgentAttache)) {
continue;
}
UpdateHostPasswordCommand cmd = new UpdateHostPasswordCommand(upasscmd.getUsername(), upasscmd.getPassword());
agent.updatePassword(cmd);
}
}
return true;
}
=======
>>>>>>> |
<<<<<<<
List<? extends Swift> discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
=======
List<HypervisorType> getSupportedHypervisorTypes(long zoneId);
>>>>>>>
List<? extends Swift> discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
List<HypervisorType> getSupportedHypervisorTypes(long zoneId); |
<<<<<<<
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countZoneVlans;
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countAllocatedZoneVlans;
public List<DataCenterVnetVO> listAllocatedVnets(long dcId) {
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
sc.setParameters("dc", dcId);
return listBy(sc);
=======
public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
return listBy(sc);
>>>>>>>
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countZoneVlans;
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countAllocatedZoneVlans;
public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
return listBy(sc);
<<<<<<<
public int countZoneVlans(long dcId, boolean onlyCountAllocated){
SearchCriteria<Integer> sc = onlyCountAllocated ? countAllocatedZoneVlans.create() : countZoneVlans.create();
sc.setParameters("dc", dcId);
return customSearch(sc, null).get(0);
}
=======
public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
sc.setParameters("dc", dcId);
sc.setParameters("physicalNetworkId", physicalNetworkId);
sc.setParameters("vnet", vnet);
return listBy(sc);
}
>>>>>>>
public int countZoneVlans(long dcId, boolean onlyCountAllocated){
SearchCriteria<Integer> sc = onlyCountAllocated ? countAllocatedZoneVlans.create() : countZoneVlans.create();
sc.setParameters("dc", dcId);
return customSearch(sc, null).get(0);
}
public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet) {
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
sc.setParameters("dc", dcId);
sc.setParameters("physicalNetworkId", physicalNetworkId);
sc.setParameters("vnet", vnet);
return listBy(sc);
} |
<<<<<<<
public void onServiceConnected(ComponentName component, IBinder service) {
if (component.equals(new ComponentName(FileDisplayActivity.this, FileDownloader.class))) {
Log.d(TAG, "Download service connected");
mDownloaderBinder = (FileDownloaderBinder) service;
} else if (component.equals(new ComponentName(FileDisplayActivity.this, FileUploader.class))) {
Log.d(TAG, "Upload service connected");
mUploaderBinder = (FileUploaderBinder) service;
} else {
return;
}
// a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS
mFileList.listDirectory();
=======
public void onServiceConnected(ComponentName className, IBinder service) {
mDownloaderBinder = (FileDownloaderBinder) service;
// a new chance to get the mDownloadBinder through getDownloadBinder() - THIS IS A MESS
if (mFileList != null)
mFileList.listDirectory();
>>>>>>>
public void onServiceConnected(ComponentName component, IBinder service) {
if (component.equals(new ComponentName(FileDisplayActivity.this, FileDownloader.class))) {
Log.d(TAG, "Download service connected");
mDownloaderBinder = (FileDownloaderBinder) service;
} else if (component.equals(new ComponentName(FileDisplayActivity.this, FileUploader.class))) {
Log.d(TAG, "Upload service connected");
mUploaderBinder = (FileUploaderBinder) service;
} else {
return;
}
// a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS
if (mFileList != null)
mFileList.listDirectory(); |
<<<<<<<
AllocationState getAllocationState();
=======
boolean getExternalDhcp();
>>>>>>>
AllocationState getAllocationState();
boolean getExternalDhcp(); |
<<<<<<<
import com.cloud.network.firewall.FirewallManagerImpl;
=======
import com.cloud.network.firewall.FirewallManagerImpl;
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl;
>>>>>>>
import com.cloud.network.firewall.FirewallManagerImpl;
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl;
<<<<<<<
import com.cloud.projects.ProjectManagerImpl;
import com.cloud.projects.dao.ProjectDaoImpl;
import com.cloud.resource.ResourceManagerImpl;
=======
import com.cloud.resource.ResourceManagerImpl;
>>>>>>>
import com.cloud.projects.ProjectManagerImpl;
import com.cloud.projects.dao.ProjectDaoImpl;
import com.cloud.resource.ResourceManagerImpl;
<<<<<<<
addDao("DcDetailsDao", DcDetailsDaoImpl.class);
addDao("SwiftDao", SwiftDaoImpl.class);
addDao("AgentTransferMapDao", HostTransferMapDaoImpl.class);
addDao("ProjectDao", ProjectDaoImpl.class);
addDao("InlineLoadBalancerNicMapDao", InlineLoadBalancerNicMapDaoImpl.class);
=======
addDao("DcDetailsDao", DcDetailsDaoImpl.class);
addDao("SwiftDao", SwiftDaoImpl.class);
addDao("AgentTransferMapDao", HostTransferMapDaoImpl.class);
addDao("ElasticLbVmMap", ElasticLbVmMapDaoImpl.class);
>>>>>>>
addDao("DcDetailsDao", DcDetailsDaoImpl.class);
addDao("SwiftDao", SwiftDaoImpl.class);
addDao("AgentTransferMapDao", HostTransferMapDaoImpl.class);
addDao("ProjectDao", ProjectDaoImpl.class);
addDao("InlineLoadBalancerNicMapDao", InlineLoadBalancerNicMapDaoImpl.class);
addDao("ElasticLbVmMap", ElasticLbVmMapDaoImpl.class);
<<<<<<<
addManager("ResourceManager", ResourceManagerImpl.class);
=======
addManager("ResourceManager", ResourceManagerImpl.class);
addManager("FirewallManager", FirewallManagerImpl.class);
>>>>>>>
addManager("ResourceManager", ResourceManagerImpl.class);
<<<<<<<
addManager("FirewallManager", FirewallManagerImpl.class);
=======
>>>>>>>
addManager("FirewallManager", FirewallManagerImpl.class);
<<<<<<<
addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);
addManager("ProjectManager", ProjectManagerImpl.class);
=======
addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);
addManager("ElasticLoadBalancerManager", ElasticLoadBalancerManagerImpl.class);
>>>>>>>
addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);
addManager("ProjectManager", ProjectManagerImpl.class);
addManager("ElasticLoadBalancerManager", ElasticLoadBalancerManagerImpl.class);
addManager("ElasticLoadBalancerManager", ElasticLoadBalancerManagerImpl.class); |
<<<<<<<
=======
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
>>>>>>>
<<<<<<<
=======
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
static {
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.URL, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.BITS, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.FORMAT, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.HYPERVISOR, Boolean.TRUE));
}
>>>>>>>
<<<<<<<
}
@Override @SuppressWarnings("unchecked")
public ListResponse<TemplateResponse> getResponse() {
VMTemplateVO template = (VMTemplateVO)getResponseObject();
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
List<DataCenterVO> zones = null;
if (zoneId != null) {
zones = new ArrayList<DataCenterVO>();
zones.add(ApiDBUtils.findZoneById(zoneId));
} else {
zones = ApiDBUtils.listZones();
=======
}
@Override
public List<Pair<Enum, Boolean>> getProperties() {
return s_properties;
}
@Override
public List<Pair<String, Object>> execute(Map<String, Object> params) {
Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName());
Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName());
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
String name = (String)params.get(BaseCmd.Properties.NAME.getName());
String displayText = (String)params.get(BaseCmd.Properties.DISPLAY_TEXT.getName());
Integer bits = (Integer)params.get(BaseCmd.Properties.BITS.getName());
Boolean passwordEnabled = (Boolean)params.get(BaseCmd.Properties.PASSWORD_ENABLED.getName());
Boolean requiresHVM = (Boolean)params.get(BaseCmd.Properties.REQUIRES_HVM.getName());
String url = (String)params.get(BaseCmd.Properties.URL.getName());
Boolean isPublic = (Boolean)params.get(BaseCmd.Properties.IS_PUBLIC.getName());
Boolean featured = (Boolean)params.get(BaseCmd.Properties.IS_FEATURED.getName());
String format = (String)params.get(BaseCmd.Properties.FORMAT.getName());
Long guestOSId = (Long) params.get(BaseCmd.Properties.OS_TYPE_ID.getName());
Long zoneId = (Long) params.get(BaseCmd.Properties.ZONE_ID.getName());
HypervisorType hyperType = HypervisorType.getType((String)params.get(BaseCmd.Properties.HYPERVISOR.getName()));
//parameters verification
if (bits == null) {
bits = Integer.valueOf(64);
}
if (passwordEnabled == null) {
passwordEnabled = false;
}
if (requiresHVM == null) {
requiresHVM = true;
}
if (isPublic == null) {
isPublic = Boolean.FALSE;
}
if (zoneId.longValue() == -1) {
zoneId = null;
}
Long accountId = null;
if ((account == null) || isAdmin(account.getType())) {
if (domainId != null) {
if ((account != null) && !getManagementServer().isChildDomain(account.getDomainId(), domainId)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid domain id (" + domainId + ") ");
}
if (accountName != null) {
Account userAccount = getManagementServer().findActiveAccount(accountName, domainId);
if (userAccount == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find account " + accountName + " in domain " + domainId);
}
accountId = userAccount.getId();
}
} else {
accountId = ((account != null) ? account.getId() : null);
}
} else {
accountId = account.getId();
}
if (accountId == null) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "No valid account specified for registering template.");
}
boolean isAdmin = getManagementServer().findAccountById(accountId).getType() == Account.ACCOUNT_TYPE_ADMIN;
if (!isAdmin && zoneId == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid zone Id.");
}
if(url.toLowerCase().contains("file://")){
throw new ServerApiException(BaseCmd.PARAM_ERROR, "File:// type urls are currently unsupported");
}
if((!url.toLowerCase().endsWith("vhd"))&&(!url.toLowerCase().endsWith("vhd.zip"))
&&(!url.toLowerCase().endsWith("vhd.bz2"))&&(!url.toLowerCase().endsWith("vhd.gz")
&&(!url.toLowerCase().endsWith("qcow2"))&&(!url.toLowerCase().endsWith("qcow2.zip"))
&&(!url.toLowerCase().endsWith("qcow2.bz2"))&&(!url.toLowerCase().endsWith("qcow2.gz")))){
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid "+format.toLowerCase());
}
boolean allowPublicUserTemplates = Boolean.parseBoolean(getManagementServer().getConfigurationValue("allow.public.user.templates"));
if (!isAdmin && !allowPublicUserTemplates && isPublic) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Only private templates can be created.");
}
if (!isAdmin || featured == null) {
featured = Boolean.FALSE;
}
//If command is executed via 8096 port, set userId to the id of System account (1)
if (userId == null) {
userId = Long.valueOf(1);
}
Long templateId;
try {
templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic, featured, format, null, url, null, requiresHVM, bits, passwordEnabled, guestOSId, true, hyperType);
} catch (InvalidParameterValueException ipve) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + ipve.getMessage());
} catch (IllegalArgumentException iae) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + iae.getMessage());
} catch (ResourceAllocationException rae) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error registering template " + name + "; " + rae.getMessage());
} catch (Exception ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error registering template " + name);
}
VMTemplateVO template = getManagementServer().findTemplateById(templateId);
List<Pair<String, Object>> templateTags = new ArrayList<Pair<String, Object>>();
List<Object> tTagList = new ArrayList<Object>();
if (template != null) {
List<DataCenterVO> zones = null;
if (zoneId != null) {
zones = new ArrayList<DataCenterVO>();
zones.add(getManagementServer().findDataCenterById(zoneId));
} else {
zones = getManagementServer().listDataCenters();
}
for (DataCenterVO zone : zones) {
VMTemplateHostVO templateHostRef = getManagementServer().findTemplateHostRef(templateId, zone.getId());
// Use embeded object for response
List<Pair<String, Object>> listForEmbeddedObject = new ArrayList<Pair<String, Object>>();
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), template.getId().toString()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), template.getName()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString()));
if (templateHostRef != null) {
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated())));
}
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.IS_READY.getName(), (templateHostRef != null && templateHostRef.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED)));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.IS_FEATURED.getName(), Boolean.valueOf(template.isFeatured()).toString()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), template.getFormat().toString()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.TEMPLATE_STATUS.getName(), "Processing"));
GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId());
if (os != null) {
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), os.getId()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_NAME.getName(), os.getDisplayName()));
} else {
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), -1));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_NAME.getName(), ""));
}
Account owner = getManagementServer().findAccountById(template.getAccountId());
if (owner != null) {
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT_ID.getName(), owner.getId()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), owner.getAccountName()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), owner.getDomainId()));
}
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_ID.getName(), zone.getId()));
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), zone.getName()));
tTagList.add(listForEmbeddedObject);
}
}
Object[] tTag = new Object[tTagList.size()];
for (int i = 0; i < tTagList.size(); i++) {
tTag[i] = tTagList.get(i);
>>>>>>>
}
@Override @SuppressWarnings("unchecked")
public ListResponse<TemplateResponse> getResponse() {
VMTemplateVO template = (VMTemplateVO)getResponseObject();
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
List<DataCenterVO> zones = null;
if (zoneId != null) {
zones = new ArrayList<DataCenterVO>();
zones.add(ApiDBUtils.findZoneById(zoneId));
} else {
zones = ApiDBUtils.listZones(); |
<<<<<<<
import com.cloud.agent.manager.AgentManager;
=======
import com.cloud.agent.api.to.NicTO;
>>>>>>>
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.manager.AgentManager;
<<<<<<<
import com.cloud.dc.VlanVO;
import com.cloud.dc.dao.AccountVlanMapDao;
=======
import com.cloud.dc.VlanVO;
>>>>>>>
import com.cloud.dc.VlanVO;
import com.cloud.dc.dao.AccountVlanMapDao;
<<<<<<<
import com.cloud.network.dao.LoadBalancerVMMapDao;
import com.cloud.network.dao.NetworkRuleConfigDao;
import com.cloud.network.dao.SecurityGroupDao;
=======
import com.cloud.network.dao.NetworkConfigurationDao;
>>>>>>>
import com.cloud.network.dao.LoadBalancerVMMapDao;
import com.cloud.network.dao.NetworkConfigurationDao;
import com.cloud.network.dao.NetworkRuleConfigDao;
import com.cloud.network.dao.SecurityGroupDao;
<<<<<<<
=======
import com.cloud.vm.VirtualMachineProfile;
>>>>>>>
import com.cloud.vm.VirtualMachineProfile;
<<<<<<<
@Inject UserStatisticsDao _statsDao;
@Inject UserVmDao _userVmDao;
@Inject FirewallRulesDao _firewallRulesDao;
@Inject NetworkRuleConfigDao _networkRuleConfigDao;
@Inject AccountVlanMapDao _accountVlanMapDao;
=======
@Inject UserStatisticsDao _statsDao = null;
@Inject NetworkOfferingDao _networkOfferingDao = null;
@Inject NetworkConfigurationDao _networkProfileDao = null;
@Inject NicDao _nicDao;
@Inject(adapter=NetworkGuru.class)
Adapters<NetworkGuru> _networkGurus;
@Inject(adapter=NetworkElement.class)
Adapters<NetworkElement> _networkElements;
>>>>>>>
@Inject UserVmDao _userVmDao;
@Inject FirewallRulesDao _firewallRulesDao;
@Inject NetworkRuleConfigDao _networkRuleConfigDao;
@Inject AccountVlanMapDao _accountVlanMapDao;
@Inject UserStatisticsDao _statsDao = null;
@Inject NetworkOfferingDao _networkOfferingDao = null;
@Inject NetworkConfigurationDao _networkProfileDao = null;
@Inject NicDao _nicDao;
@Inject(adapter=NetworkGuru.class)
Adapters<NetworkGuru> _networkGurus;
@Inject(adapter=NetworkElement.class)
Adapters<NetworkElement> _networkElements; |
<<<<<<<
import com.cloud.storage.DiskOfferingVO;
=======
import com.cloud.server.Criteria;
import com.cloud.storage.Volume;
>>>>>>>
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.Volume;
<<<<<<<
storageType = "unknown";
} else {
storageType = ApiDBUtils.volumeIsOnSharedStorage(volume.getId()) ? "shared" : "local";
}
} catch (InvalidParameterValueException e) {
s_logger.error(e.getMessage(), e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Volume " + volume.getName() + " does not have a valid ID");
}
volResponse.setStorageType(storageType);
=======
if (volume.getState() == Volume.State.Allocated) {
/*set it as shared, so the UI can attach it to VM*/
storageType = "shared";
} else {
storageType = "unknown";
}
} else {
storageType = getManagementServer().volumeIsOnSharedStorage(volume.getId()) ? "shared" : "local";
}
} catch (InvalidParameterValueException e) {
s_logger.error(e.getMessage(), e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Volume " + volume.getName() + " does not have a valid ID");
}
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.STORAGE_TYPE.getName(), storageType));
>>>>>>>
if (volume.getState() == Volume.State.Allocated) {
/*set it as shared, so the UI can attach it to VM*/
storageType = "shared";
} else {
storageType = "unknown";
}
} else {
storageType = ApiDBUtils.volumeIsOnSharedStorage(volume.getId()) ? "shared" : "local";
}
} catch (InvalidParameterValueException e) {
s_logger.error(e.getMessage(), e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Volume " + volume.getName() + " does not have a valid ID");
}
volResponse.setStorageType(storageType);
<<<<<<<
String poolName = (poolId == null) ? "none" : ApiDBUtils.findStoragePoolById(poolId).getName();
volResponse.setStoragePoolName(poolName);
volResponse.setResponseName("volume");
volResponses.add(volResponse);
}
response.setResponses(volResponses);
response.setResponseName(getName());
return response;
=======
String poolName = (poolId == null) ? "none" : getManagementServer().findPoolById(poolId).getName();
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.STORAGE.getName(), poolName));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.SOURCE_ID.getName(),volume.getSourceId()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.SOURCE_TYPE.getName(),volume.getSourceType().toString()));
volumeData.add(new Pair<String, Object>(BaseCmd.Properties.HYPERVISOR.getName(), getManagementServer().getVolumeHyperType(volume.getId())));
vTag[i++] = volumeData;
}
Pair<String, Object> volumeTag = new Pair<String, Object>("volume", vTag);
volumeTags.add(volumeTag);
return volumeTags;
>>>>>>>
String poolName = (poolId == null) ? "none" : ApiDBUtils.findStoragePoolById(poolId).getName();
volResponse.setStoragePoolName(poolName);
volResponse.setSourceId(volume.getSourceId());
volResponse.setSourceType(volume.getSourceType().toString());
volResponse.setHypervisor(ApiDBUtils.getVolumeHyperType(volume.getId()).toString());
volResponse.setResponseName("volume");
volResponses.add(volResponse);
}
response.setResponses(volResponses);
response.setResponseName(getName());
return response; |
<<<<<<<
@Inject
SecondaryStorageVmManager _ssvmMgr;
=======
@Inject
NetworkOfferingServiceMapDao _ntwkOffServiceMapDao;
@Inject PhysicalNetworkDao _physicalNetworkDao;
>>>>>>>
@Inject
SecondaryStorageVmManager _ssvmMgr;
@Inject
NetworkOfferingServiceMapDao _ntwkOffServiceMapDao;
@Inject PhysicalNetworkDao _physicalNetworkDao;
<<<<<<<
//delete all capacity records for the zone
_capacityDao.removeBy(null, zoneId, null, null, null);
=======
// delete all capacity records for the zone
_capacityDao.removeBy(null, zoneId, null, null);
>>>>>>>
//delete all capacity records for the zone
_capacityDao.removeBy(null, zoneId, null, null, null);
<<<<<<<
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
isAscending = (isAscending == null ? true : isAscending);
Filter searchFilter = new Filter(NetworkOfferingVO.class, "sortKey", isAscending, cmd.getStartIndex(), cmd.getPageSizeVal());
=======
Account caller = UserContext.current().getCaller();
Filter searchFilter = new Filter(NetworkOfferingVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());
>>>>>>>
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
isAscending = (isAscending == null ? true : isAscending);
Filter searchFilter = new Filter(NetworkOfferingVO.class, "sortKey", isAscending, cmd.getStartIndex(), cmd.getPageSizeVal());
Account caller = UserContext.current().getCaller(); |
<<<<<<<
import org.apache.log4j.Logger;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd.Manager;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ResponseObject;
import com.cloud.api.response.SuccessResponse;
@Implementation(method="resetVMPassword", manager=Manager.UserVmManager)
public class ResetVMPasswordCmd extends BaseAsyncCmd {
=======
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.cloud.api.BaseCmd;
import com.cloud.api.ServerApiException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
import com.cloud.vm.UserVmVO;
public class ResetVMPasswordCmd extends BaseCmd {
>>>>>>>
import org.apache.log4j.Logger;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd.Manager;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ResponseObject;
import com.cloud.api.response.SuccessResponse;
@Implementation(method="resetVMPassword", manager=Manager.UserVmManager)
public class ResetVMPasswordCmd extends BaseAsyncCmd {
<<<<<<<
=======
@Override
public List<Pair<String, Object>> execute(Map<String, Object> params) {
Long vmId = (Long)params.get(BaseCmd.Properties.ID.getName());
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
String password = null;
//Verify input parameters
UserVmVO vmInstance = getManagementServer().findUserVMInstanceById(vmId.longValue());
if (vmInstance == null) {
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
}
if (account != null) {
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to reset password.");
}
}
// If command is executed via 8096 port, set userId to the id of System account (1)
if (userId == null) {
userId = Long.valueOf(1);
}
VMTemplateVO template = getManagementServer().findTemplateById(vmInstance.getTemplateId());
if (template.getEnablePassword()) {
password = getManagementServer().generateRandomPassword();
} else {
password = "saved_password";
}
long jobId = getManagementServer().resetVMPasswordAsync(userId.longValue(), vmId, password);
if(jobId == 0) {
s_logger.warn("Unable to schedule async-job for ResetVMPassword comamnd");
} else {
if(s_logger.isDebugEnabled())
s_logger.debug("ResetVMPassword command has been accepted, job id: " + jobId);
}
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
return returnValues;
}
>>>>>>> |
<<<<<<<
public static final long VirtualMachineMigrationException = Base | 0x24;
=======
public static final long HttpCallException = Base | 0x23;
>>>>>>>
public static final long HttpCallException = Base | 0x23;
public static final long VirtualMachineMigrationException = Base | 0x24; |
<<<<<<<
import com.cloud.dc.VlanVO;
=======
import com.cloud.dc.dao.AccountVlanMapDao;
>>>>>>>
import com.cloud.dc.VlanVO;
import com.cloud.dc.dao.AccountVlanMapDao;
<<<<<<<
@Inject InstanceGroupDao _vmGroupDao;
@Inject InstanceGroupVMMapDao _groupVMMapDao;
=======
>>>>>>>
@Inject InstanceGroupDao _vmGroupDao;
@Inject InstanceGroupVMMapDao _groupVMMapDao; |
<<<<<<<
private final long _msId;
=======
private final long _msId;
>>>>>>>
private final long _msId;
<<<<<<<
ConnectionConcierge _concierge = null;
=======
private ConnectionConcierge _concierge = null;
private static ThreadLocal<Count> s_tls = new ThreadLocal<Count>();
>>>>>>>
private ConnectionConcierge _concierge = null;
private static ThreadLocal<Count> s_tls = new ThreadLocal<Count>();
<<<<<<<
=======
protected void incrCount() {
Count count = s_tls.get();
if (count == null) {
count = new Count();
s_tls.set(count);
}
count.count++;
}
protected void decrCount() {
Count count = s_tls.get();
if (count == null) {
return;
}
count.count--;
}
>>>>>>>
protected void incrCount() {
Count count = s_tls.get();
if (count == null) {
count = new Count();
s_tls.set(count);
}
count.count++;
}
protected void decrCount() {
Count count = s_tls.get();
if (count == null) {
return;
}
count.count--;
}
<<<<<<<
pstmt = _concierge.conn().prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
pstmt.setLong(1, msId);
=======
pstmt = _concierge.conn().prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
pstmt.setLong(1, _msId);
>>>>>>>
pstmt = _concierge.conn().prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
pstmt.setLong(1, msId);
<<<<<<<
=======
protected static class Count {
public int count = 0;
}
>>>>>>>
protected static class Count {
public int count = 0;
} |
<<<<<<<
@Inject
private ResourceManager _resourceMgr;
=======
@Inject
private SwiftDao _swiftDao;
>>>>>>>
@Inject
private ResourceManager _resourceMgr;
private SwiftDao _swiftDao;
<<<<<<<
public void handleTemplateSync(long dcId) {
List<HostVO> ssHosts = _ssvmMgr.listSecondaryStorageHostsInOneZone(dcId);
for ( HostVO ssHost : ssHosts ) {
handleTemplateSync(ssHost);
=======
public void handleTemplateSync(Long dcId) {
if ( dcId != null ) {
List<HostVO> ssHosts = _hostDao.listSecondaryStorageHosts(dcId);
for ( HostVO ssHost : ssHosts ) {
handleTemplateSync(ssHost);
}
}
Boolean swiftEnable = Boolean.getBoolean(_configDao.getValue(Config.SwiftEnable.key()));
if (swiftEnable) {
List<SwiftVO> swifts = _swiftDao.listAll();
for (SwiftVO swift : swifts) {
handleTemplateSync(swift);
}
>>>>>>>
public void handleTemplateSync(Long dcId) {
if ( dcId != null ) {
List<HostVO> ssHosts = _ssvmMgr.listSecondaryStorageHostsInOneZone(dcId);
for ( HostVO ssHost : ssHosts ) {
handleTemplateSync(ssHost);
}
}
Boolean swiftEnable = Boolean.getBoolean(_configDao.getValue(Config.SwiftEnable.key()));
if (swiftEnable) {
List<SwiftVO> swifts = _swiftDao.listAll();
for (SwiftVO swift : swifts) {
handleTemplateSync(swift);
} |
<<<<<<<
import com.cloud.resource.ResourceManager;
=======
>>>>>>>
import com.cloud.resource.ResourceManager;
<<<<<<<
@Inject ResourceManager _resourceMgr;
=======
@Inject NetworkServiceMapDao _ntwkSrvcProviderDao;
>>>>>>>
@Inject ResourceManager _resourceMgr;
@Inject NetworkServiceMapDao _ntwkSrvcProviderDao;
<<<<<<<
ExternalLoadBalancerDeviceVO device = _externalLoadBalancerDeviceDao.findById(externalLoadBalancerId);
externalLoadBalancer = _hostDao.findById(device.getHostId());
=======
// mark device to be in use
ExternalLoadBalancerDeviceVO lbDevice = _externalLoadBalancerDeviceDao.findById(lbDeviceId);
lbDevice.setAllocationState(dedicatedLB ? LBDeviceAllocationState.InDedicatedUse : LBDeviceAllocationState.InSharedUse);
_externalLoadBalancerDeviceDao.update(lbDeviceId, lbDevice);
// return the HostVO for the lb device
externalLoadBalancer = _hostDao.findById(lbDevice.getHostId());
txn.commit();
>>>>>>>
// mark device to be in use
ExternalLoadBalancerDeviceVO lbDevice = _externalLoadBalancerDeviceDao.findById(lbDeviceId);
lbDevice.setAllocationState(dedicatedLB ? LBDeviceAllocationState.InDedicatedUse : LBDeviceAllocationState.InSharedUse);
_externalLoadBalancerDeviceDao.update(lbDeviceId, lbDevice);
// return the HostVO for the lb device
externalLoadBalancer = _hostDao.findById(lbDevice.getHostId());
txn.commit(); |
<<<<<<<
private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM };
private Integer mSortOrder;
public static final Integer SORT_NAME = 0;
public static final Integer SORT_DATE = 1;
public static final Integer SORT_SIZE = 2;
private Boolean mSortAscending;
=======
>>>>>>>
private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM };
private Integer mSortOrder;
public static final Integer SORT_NAME = 0;
public static final Integer SORT_DATE = 1;
public static final Integer SORT_SIZE = 2;
private Boolean mSortAscending;
<<<<<<<
mTransferServiceGetter = transferServiceGetter;
=======
mTransferServiceGetter = transferServiceGetter;
>>>>>>>
mTransferServiceGetter = transferServiceGetter;
<<<<<<<
final AsyncDrawable asyncDrawable = new AsyncDrawable(
mContext.getResources(),
thumbnail,
=======
final ThumbnailsCacheManager.AsyncDrawable asyncDrawable =
new ThumbnailsCacheManager.AsyncDrawable(
mContext.getResources(),
thumbnail,
>>>>>>>
final ThumbnailsCacheManager.AsyncDrawable asyncDrawable =
new ThumbnailsCacheManager.AsyncDrawable(
mContext.getResources(),
thumbnail,
<<<<<<<
} else if (file.isShareByLink()) {
// If folder is sharedByLink, icon folder must be changed to
// folder-public one
=======
sharedWithMeIconV.setVisibility(View.VISIBLE);
} else {
fileIcon.setImageResource(
DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())
);
}
// If folder is sharedByLink, icon folder must be changed to
// folder-public one
if (file.isShareByLink()) {
>>>>>>>
} else if (file.isShareByLink()) {
// If folder is sharedByLink, icon folder must be changed to
// folder-public one
<<<<<<<
/**
* Sorts list by Date
* @param sortAscending true: ascending, false: descending
*/
private void sortByDate(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
Long obj1 = o1.getModificationTimestamp();
return val * obj1.compareTo(o2.getModificationTimestamp());
}
else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
} else if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){
return 0;
} else {
Long obj1 = o1.getModificationTimestamp();
return val * obj1.compareTo(o2.getModificationTimestamp());
}
}
});
}
/**
* Sorts list by Size
* @param sortAscending true: ascending, false: descending
*/
private void sortBySize(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
Long obj1 = getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1)));
return val * obj1.compareTo(getFolderSize(
new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2))));
}
else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
} else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){
return 0;
} else {
Long obj1 = o1.getFileLength();
return val * obj1.compareTo(o2.getFileLength());
}
}
});
}
/**
* Sorts list by Name
* @param sortAscending true: ascending, false: descending
*/
private void sortByName(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
return val * o1.getRemotePath().toLowerCase().compareTo(o2.getRemotePath().toLowerCase());
} else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
}
return val * new AlphanumComparator().compare(o1, o2);
}
});
}
=======
>>>>>>>
/**
* Sorts list by Date
* @param sortAscending true: ascending, false: descending
*/
private void sortByDate(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
Long obj1 = o1.getModificationTimestamp();
return val * obj1.compareTo(o2.getModificationTimestamp());
}
else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
} else if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){
return 0;
} else {
Long obj1 = o1.getModificationTimestamp();
return val * obj1.compareTo(o2.getModificationTimestamp());
}
}
});
}
/**
* Sorts list by Size
* @param sortAscending true: ascending, false: descending
*/
private void sortBySize(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
Long obj1 = getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1)));
return val * obj1.compareTo(getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2))));
}
else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
} else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){
return 0;
} else {
Long obj1 = o1.getFileLength();
return val * obj1.compareTo(o2.getFileLength());
}
}
});
}
/**
* Sorts list by Name
* @param sortAscending true: ascending, false: descending
*/
private void sortByName(boolean sortAscending){
final Integer val;
if (sortAscending){
val = 1;
} else {
val = -1;
}
Collections.sort(mFiles, new Comparator<OCFile>() {
public int compare(OCFile o1, OCFile o2) {
if (o1.isFolder() && o2.isFolder()) {
return val * o1.getRemotePath().toLowerCase().compareTo(o2.getRemotePath().toLowerCase());
} else if (o1.isFolder()) {
return -1;
} else if (o2.isFolder()) {
return 1;
}
return val * new AlphanumComparator().compare(o1, o2);
}
});
}
<<<<<<<
sortDirectory();
}
=======
mFiles = FileStorageUtils.sortFolder(mFiles);
notifyDataSetChanged();
}
>>>>>>>
mFiles = FileStorageUtils.sortFolder(mFiles);
notifyDataSetChanged();
}
sortDirectory();
} |
<<<<<<<
@Column(name="uuid")
private String uuid;
=======
@Column(name="physical_network_id")
private Long physicalNetworkId;
>>>>>>>
@Column(name="uuid")
private String uuid;
@Column(name="physical_network_id")
private Long physicalNetworkId;
<<<<<<<
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
=======
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
>>>>>>>
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
} |
<<<<<<<
@Inject SSHKeyPairDao _sshKeyPairDao;
@Inject UserVmDetailsDao _vmDetailsDao;
=======
@Inject OvsNetworkManager _ovsNetworkMgr;
>>>>>>>
@Inject SSHKeyPairDao _sshKeyPairDao;
@Inject UserVmDetailsDao _vmDetailsDao;
@Inject OvsNetworkManager _ovsNetworkMgr;
<<<<<<<
UserVmVO vm = new UserVmVO(id, instanceName, cmd.getDisplayName(),
template.getId(), template.getGuestOSId(), offering.getOfferHA(), domainId, owner.getId(), offering.getId(),
userData, hostName, sshPublicKey);
=======
HypervisorType hypervisorType = null;
if (template == null || template.getHypervisorType() == null || template.getHypervisorType() == HypervisorType.None) {
hypervisorType = cmd.getHypervisor();
} else {
hypervisorType = template.getHypervisorType();
}
UserVmVO vm = new UserVmVO(id, instanceName, cmd.getDisplayName(), template.getId(), hypervisorType,
template.getGuestOSId(), offering.getOfferHA(), domainId, owner.getId(), offering.getId(), userData, hostName);
>>>>>>>
HypervisorType hypervisorType = null;
if (template == null || template.getHypervisorType() == null || template.getHypervisorType() == HypervisorType.None) {
hypervisorType = cmd.getHypervisor();
} else {
hypervisorType = template.getHypervisorType();
}
UserVmVO vm = new UserVmVO(id, instanceName, cmd.getDisplayName(), template.getId(), hypervisorType,
template.getGuestOSId(), offering.getOfferHA(), domainId, owner.getId(), offering.getId(), userData, hostName, sshPublicKey); |
<<<<<<<
DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterIdToDeployIn());
HostPodVO pod = _podDao.findById(vm.getPodIdToDeployIn());
=======
DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterId());
HostPodVO pod = _podDao.findById(rootVolumeOfVm.getPodId());
>>>>>>>
DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterIdToDeployIn());
HostPodVO pod = _podDao.findById(vm.getPodIdToDeployIn());
<<<<<<<
template = _templateDao.findById(vm.getIsoId());
}
if (template != null && template.getFormat() == ImageFormat.ISO && vm.getIsoId() != null) {
String isoPath = null;
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vm.getDataCenterIdToDeployIn());
=======
String isoPath = null;
VirtualMachineTemplate template = _templateDao.findById(vm.getIsoId());
if (template == null || template.getFormat() != ImageFormat.ISO) {
throw new CloudRuntimeException("Can not find ISO in vm_template table for id " + vm.getIsoId());
}
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vm.getDataCenterId());
>>>>>>>
String isoPath = null;
VirtualMachineTemplate template = _templateDao.findById(vm.getIsoId());
if (template == null || template.getFormat() != ImageFormat.ISO) {
throw new CloudRuntimeException("Can not find ISO in vm_template table for id " + vm.getIsoId());
}
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vm.getDataCenterIdToDeployIn()); |
<<<<<<<
=======
@Override
>>>>>>>
@Override
<<<<<<<
String userData,
String name,
String sshPublicKey) {
super(id, serviceOfferingId, name, instanceName, Type.User, templateId, guestOsId, domainId, accountId, haEnabled);
=======
String userData, String name) {
super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled);
>>>>>>>
String userData,
String name,
String sshPublicKey) {
super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled);
<<<<<<<
public UserVmVO(long id,
String name,
long templateId,
long guestOSId,
long accountId,
long domainId,
long serviceOfferingId,
String guestMacAddress,
String guestIpAddress,
String guestNetMask,
String externalIpAddress,
String externalMacAddress,
Long vlanDbId,
Long routerId,
long podId,
long dcId,
boolean haEnabled,
String displayName,
String userData) {
super(id, serviceOfferingId, name, name, Type.User, templateId, guestOSId, guestMacAddress, guestIpAddress, guestNetMask, dcId, podId, domainId, accountId, haEnabled, null);
this.domainRouterId = routerId;
this.guestIpAddress = guestIpAddress;
this.guestNetmask = guestNetMask;
this.guestMacAddress = guestMacAddress;
this.externalIpAddress = externalIpAddress;
this.externalMacAddress = externalMacAddress;
this.setUserData(userData);
this.setExternalVlanDbId(vlanDbId);
this.isoId = null;
this.displayName = displayName;
}
=======
>>>>>>> |
<<<<<<<
import java.util.List;
import java.util.UUID;
=======
>>>>>>>
import java.util.List;
import java.util.UUID;
import javax.persistence.CollectionTable;
<<<<<<<
@Column(name="is_security_group_enabled")
boolean securityGroupEnabled;
@ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
@Column(name="tag")
@CollectionTable(name="network_tags", joinColumns=@JoinColumn(name="network_id"))
List<String> tags;
@Column(name="uuid")
String uuid;
=======
@Column(name="guest_type")
@Enumerated(value=EnumType.STRING)
Network.GuestType guestType;
>>>>>>>
@Column(name="is_security_group_enabled")
boolean securityGroupEnabled;
@ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
@Column(name="tag")
@CollectionTable(name="network_tags", joinColumns=@JoinColumn(name="network_id"))
List<String> tags;
@Column(name="uuid")
String uuid;
@Column(name="guest_type")
@Enumerated(value=EnumType.STRING)
Network.GuestType guestType;
<<<<<<<
this.guestType = guestType;
this.uuid = UUID.randomUUID().toString();
=======
>>>>>>>
this.guestType = guestType;
this.uuid = UUID.randomUUID().toString();
<<<<<<<
this.uuid = UUID.randomUUID().toString();
=======
this.guestType = guestType;
this.isShared = isShared;
>>>>>>>
this.uuid = UUID.randomUUID().toString();
this.guestType = guestType;
this.isShared = isShared;
<<<<<<<
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
=======
@Override
public boolean getIsShared() {
return isShared;
}
>>>>>>>
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public boolean getIsShared() {
return isShared;
} |
<<<<<<<
=======
Long podId = dest.getPod().getId();
// In Basic zone and Guest network we have to start domR per pod, not per network
if ((dc.getNetworkType() == NetworkType.Basic || guestNetwork.isSecurityGroupEnabled()) && guestNetwork.getTrafficType() == TrafficType.Guest) {
List<DomainRouterVO> dhcpServers = _routerDao.listByNetworkAndPodAndRole(guestNetwork.getId(), podId, Role.DHCP_USERDATA);
if (dhcpServers != null && dhcpServers.size() > 0) {
router = dhcpServers.get(0);
}
plan = new DataCenterDeployment(dcId, podId, null, null, null);
} else {
router = _routerDao.findByNetwork(guestNetwork.getId());
plan = new DataCenterDeployment(dcId);
}
if (router != null) {
return router;
}
>>>>>>>
<<<<<<<
if (isPodBased) {
routers = _routerDao.findByNetworkAndPod(guestNetwork.getId(), podId);
=======
if ((dc.getNetworkType() == NetworkType.Basic || guestNetwork.isSecurityGroupEnabled()) && guestNetwork.getTrafficType() == TrafficType.Guest) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndPodAndRole(guestNetwork.getId(), podId, Role.DHCP_USERDATA);
if (routers != null && routers.size() > 0)
router = routers.get(0);
>>>>>>>
if (isPodBased) {
routers = _routerDao.listByNetworkAndPodAndRole(guestNetwork.getId(), podId, Role.DHCP_USERDATA); |
<<<<<<<
import com.cloud.vm.State;
=======
import com.cloud.vm.SecondaryStorageVmVO;
>>>>>>>
import com.cloud.vm.SecondaryStorageVmVO;
import com.cloud.vm.State;
<<<<<<<
@Inject DataCenterDao _dcDao;
@Inject HostPodDao _hostPodDao;
@Inject AccountManager _accountMgr;
@Inject NetworkManager _networkMgr;
=======
@Inject ConsoleProxyDao _consoleDao;
@Inject SecondaryStorageVmDao _secStorageDao;
>>>>>>>
@Inject DataCenterDao _dcDao;
@Inject HostPodDao _hostPodDao;
@Inject AccountManager _accountMgr;
@Inject NetworkManager _networkMgr;
@Inject ConsoleProxyDao _consoleDao;
@Inject SecondaryStorageVmDao _secStorageDao;
<<<<<<<
@Override
public HostPodVO createPod(CreatePodCmd cmd) throws InvalidParameterValueException, InternalErrorException {
String cidr = cmd.getCidr();
String endIp = cmd.getEndIp();
String gateway = cmd.getGateway();
String name = cmd.getPodName();
String startIp = cmd.getStartIp();
Long zoneId = cmd.getZoneId();
//verify input parameters
DataCenterVO zone = _zoneDao.findById(zoneId);
if (zone == null) {
throw new InvalidParameterValueException("Failed to create pod " + name + " -- unable to find zone " + zoneId);
}
if (endIp != null && startIp == null) {
throw new InvalidParameterValueException("Failed to create pod " + name + " -- if an end IP is specified, a start IP must be specified.");
}
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
}
return createPod(userId.longValue(), name, zoneId, gateway, cidr, startIp, endIp);
}
@Override @DB
=======
@Override
@DB
>>>>>>>
@Override
public HostPodVO createPod(CreatePodCmd cmd) throws InvalidParameterValueException, InternalErrorException {
String cidr = cmd.getCidr();
String endIp = cmd.getEndIp();
String gateway = cmd.getGateway();
String name = cmd.getPodName();
String startIp = cmd.getStartIp();
Long zoneId = cmd.getZoneId();
//verify input parameters
DataCenterVO zone = _zoneDao.findById(zoneId);
if (zone == null) {
throw new InvalidParameterValueException("Failed to create pod " + name + " -- unable to find zone " + zoneId);
}
if (endIp != null && startIp == null) {
throw new InvalidParameterValueException("Failed to create pod " + name + " -- if an end IP is specified, a start IP must be specified.");
}
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
}
return createPod(userId.longValue(), name, zoneId, gateway, cidr, startIp, endIp);
}
@Override @DB
<<<<<<<
@Override @DB
=======
@Override
@DB
>>>>>>>
@Override @DB
<<<<<<<
@Override
// public VlanVO createVlanAndPublicIpRange(long userId, VlanType vlanType, Long zoneId, Long accountId, Long podId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) throws InvalidParameterValueException, InternalErrorException {
public VlanVO createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InvalidParameterValueException, InternalErrorException, InsufficientCapacityException {
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
}
// If forVirtualNetworks isn't specified, default it to true
Boolean forVirtualNetwork = cmd.isForVirtualNetwork();
if (forVirtualNetwork == null) {
forVirtualNetwork = Boolean.TRUE;
}
// If the VLAN id is null, default it to untagged
String vlanId = cmd.getVlan();
if (vlanId == null) {
vlanId = Vlan.UNTAGGED;
}
// If an account name and domain ID are specified, look up the account
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
Account account = null;
if ((accountName != null) && (domainId != null)) {
account = _accountDao.findActiveAccount(accountName, domainId);
if (account == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid account.");
}
}
VlanType vlanType = forVirtualNetwork ? VlanType.VirtualNetwork : VlanType.DirectAttached;
Long zoneId = cmd.getZoneId();
Long podId = cmd.getPodId();
String startIP = cmd.getStartIp();
String endIP = cmd.getEndIp();
String vlanGateway = cmd.getGateway();
String vlanNetmask = cmd.getNetmask();
=======
@Override
public VlanVO createVlanAndPublicIpRange(long userId, VlanType vlanType, Long zoneId, Long accountId, Long podId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) throws InvalidParameterValueException, InternalErrorException {
>>>>>>>
@Override
public VlanVO createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InvalidParameterValueException, InternalErrorException, InsufficientCapacityException {
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
}
// If forVirtualNetworks isn't specified, default it to true
Boolean forVirtualNetwork = cmd.isForVirtualNetwork();
if (forVirtualNetwork == null) {
forVirtualNetwork = Boolean.TRUE;
}
// If the VLAN id is null, default it to untagged
String vlanId = cmd.getVlan();
if (vlanId == null) {
vlanId = Vlan.UNTAGGED;
}
// If an account name and domain ID are specified, look up the account
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
Account account = null;
if ((accountName != null) && (domainId != null)) {
account = _accountDao.findActiveAccount(accountName, domainId);
if (account == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid account.");
}
}
VlanType vlanType = forVirtualNetwork ? VlanType.VirtualNetwork : VlanType.DirectAttached;
Long zoneId = cmd.getZoneId();
Long podId = cmd.getPodId();
String startIP = cmd.getStartIp();
String endIP = cmd.getEndIp();
String vlanGateway = cmd.getGateway();
String vlanNetmask = cmd.getNetmask();
<<<<<<<
=======
//if we have an ip range for vlan id=x, vlantype=y; we should
//only allow adding another range with id=x for same type y
if(!vlanId.equals(Vlan.UNTAGGED))
{
VlanVO vlanHandle = _vlanDao.findByZoneAndVlanId(zoneId, vlanId);
if(vlanHandle!=null && !vlanHandle.getVlanType().equals(vlanType))
throw new InvalidParameterValueException("This vlan id is already associated with the vlan type "+vlanHandle.getVlanType().toString()
+",whilst you are trying to associate it with vlan type "+vlanType.toString());
}
>>>>>>>
//if we have an ip range for vlan id=x, vlantype=y; we should
//only allow adding another range with id=x for same type y
if (!vlanId.equals(Vlan.UNTAGGED)) {
VlanVO vlanHandle = _vlanDao.findByZoneAndVlanId(zoneId, vlanId);
if (vlanHandle!=null && !vlanHandle.getVlanType().equals(vlanType))
throw new InvalidParameterValueException("This vlan id is already associated with the vlan type "+vlanHandle.getVlanType().toString()
+",whilst you are trying to associate it with vlan type "+vlanType.toString());
} |
<<<<<<<
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
import com.cloud.network.dao.VpnUserDaoImpl;
=======
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl;
>>>>>>>
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
import com.cloud.network.dao.VpnUserDaoImpl;
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl; |
<<<<<<<
import com.cloud.network.NetworkManager;
=======
import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
>>>>>>>
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.NetworkManager;
<<<<<<<
vnetStart = Integer.parseInt(tokens[0]);
if (tokens.length == 1) {
vnetEnd = vnetStart + 1;
} else {
vnetEnd = Integer.parseInt(tokens[1]);
}
=======
vnetStart = Integer.parseInt(tokens[0]);
if (tokens.length == 1) {
vnetEnd = vnetStart;
} else {
vnetEnd = Integer.parseInt(tokens[1]);
}
>>>>>>>
vnetStart = Integer.parseInt(tokens[0]);
if (tokens.length == 1) {
vnetEnd = vnetStart;
} else {
vnetEnd = Integer.parseInt(tokens[1]);
}
<<<<<<<
@Override
public DataCenterVO createZone(CreateZoneCmd cmd) throws InvalidParameterValueException, InternalErrorException {
// grab parameters from the command
Long userId = UserContext.current().getUserId();
String zoneName = cmd.getZoneName();
String dns1 = cmd.getDns1();
String dns2 = cmd.getDns2();
String internalDns1 = cmd.getInternalDns1();
String internalDns2 = cmd.getInternalDns2();
String vnetRange = cmd.getVlan();
String guestCidr = cmd.getGuestCidrAddress();
if (userId == null) {
userId = User.UID_SYSTEM;
}
return createZone(userId, zoneName, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr);
}
@Override
public ServiceOfferingVO createServiceOffering(CreateServiceOfferingCmd cmd) throws InvalidParameterValueException {
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = User.UID_SYSTEM;
}
String name = cmd.getServiceOfferingName();
if ((name == null) || (name.length() == 0)) {
throw new InvalidParameterValueException("Failed to create service offering: specify the name that has non-zero length");
}
String displayText = cmd.getDisplayText();
if ((displayText == null) || (displayText.length() == 0)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the display text that has non-zero length");
}
Long cpuNumber = cmd.getCpuNumber();
if ((cpuNumber == null) || (cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647");
}
Long cpuSpeed = cmd.getCpuSpeed();
if ((cpuSpeed == null) || (cpuSpeed.intValue() <= 0) || (cpuSpeed.intValue() > 2147483647)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647");
}
Long memory = cmd.getMemory();
if ((memory == null) || (memory.intValue() <= 0) || (memory.intValue() > 2147483647)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to create service offering " + name + ": specify the memory value between 1 and 2147483647");
}
boolean localStorageRequired = false;
String storageType = cmd.getStorageType();
if (storageType == null) {
localStorageRequired = false;
} else if (storageType.equals("local")) {
localStorageRequired = true;
} else if (storageType.equals("shared")) {
localStorageRequired = false;
} else {
throw new InvalidParameterValueException("Invalid storage type " + storageType + " specified, valid types are: 'local' and 'shared'");
}
Boolean offerHA = cmd.getOfferHa();
if (offerHA == null) {
offerHA = false;
}
Boolean useVirtualNetwork = cmd.getUseVirtualNetwork();
if (useVirtualNetwork == null) {
useVirtualNetwork = Boolean.TRUE;
}
return createServiceOffering(userId, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
localStorageRequired, offerHA, useVirtualNetwork, cmd.getTags());
}
@Override
=======
>>>>>>>
@Override
public DataCenterVO createZone(CreateZoneCmd cmd) throws InvalidParameterValueException, InternalErrorException {
// grab parameters from the command
Long userId = UserContext.current().getUserId();
String zoneName = cmd.getZoneName();
String dns1 = cmd.getDns1();
String dns2 = cmd.getDns2();
String internalDns1 = cmd.getInternalDns1();
String internalDns2 = cmd.getInternalDns2();
String vnetRange = cmd.getVlan();
String guestCidr = cmd.getGuestCidrAddress();
if (userId == null) {
userId = User.UID_SYSTEM;
}
return createZone(userId, zoneName, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr);
}
@Override
public ServiceOfferingVO createServiceOffering(CreateServiceOfferingCmd cmd) throws InvalidParameterValueException {
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = User.UID_SYSTEM;
}
String name = cmd.getServiceOfferingName();
if ((name == null) || (name.length() == 0)) {
throw new InvalidParameterValueException("Failed to create service offering: specify the name that has non-zero length");
}
String displayText = cmd.getDisplayText();
if ((displayText == null) || (displayText.length() == 0)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the display text that has non-zero length");
}
Long cpuNumber = cmd.getCpuNumber();
if ((cpuNumber == null) || (cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647");
}
Long cpuSpeed = cmd.getCpuSpeed();
if ((cpuSpeed == null) || (cpuSpeed.intValue() <= 0) || (cpuSpeed.intValue() > 2147483647)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647");
}
Long memory = cmd.getMemory();
if ((memory == null) || (memory.intValue() <= 0) || (memory.intValue() > 2147483647)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to create service offering " + name + ": specify the memory value between 1 and 2147483647");
}
boolean localStorageRequired = false;
String storageType = cmd.getStorageType();
if (storageType == null) {
localStorageRequired = false;
} else if (storageType.equals("local")) {
localStorageRequired = true;
} else if (storageType.equals("shared")) {
localStorageRequired = false;
} else {
throw new InvalidParameterValueException("Invalid storage type " + storageType + " specified, valid types are: 'local' and 'shared'");
}
Boolean offerHA = cmd.getOfferHa();
if (offerHA == null) {
offerHA = false;
}
Boolean useVirtualNetwork = cmd.getUseVirtualNetwork();
if (useVirtualNetwork == null) {
useVirtualNetwork = Boolean.TRUE;
}
return createServiceOffering(userId, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
localStorageRequired, offerHA, useVirtualNetwork, cmd.getTags());
}
@Override |
<<<<<<<
=======
VMTemplateVO iso = getManagementServer().findTemplateById(isoId);
if (iso == null) {
throw new ServerApiException (BaseCmd.PARAM_ERROR, "Unable to find an ISO with id " + isoId);
}
if (account != null) {
if (!isAdmin(account.getType())) {
if (account.getId() != vmInstanceCheck.getAccountId()) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName() + " for this account");
}
if (!iso.isPublicTemplate() && (account.getId() != iso.getAccountId()) && (!iso.getName().startsWith("xs-tools"))) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName() + " for this account");
}
} else {
if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstanceCheck.getDomainId())) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName());
}
// FIXME: if ISO owner is null we probably need to throw some kind of exception
Account isoOwner = getManagementServer().findAccountById(iso.getAccountId());
if ((isoOwner != null) && !getManagementServer().isChildDomain(account.getDomainId(), isoOwner.getDomainId())) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName());
}
}
}
// If command is executed via 8096 port, set userId to the id of System account (1)
if (userId == null)
userId = new Long(1);
try {
long jobId = getManagementServer().attachISOToVMAsync(vmId.longValue(), userId, isoId.longValue());
if (jobId == 0) {
s_logger.warn("Unable to schedule async-job for AttachIsoCmd");
} else {
if (s_logger.isDebugEnabled())
s_logger.debug("AttachIsoCmd has been accepted, job id: " + jobId);
}
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
return returnValues;
} catch (ServerApiException apiEx) {
s_logger.error("Exception attaching ISO", apiEx);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach ISO: " + apiEx.getDescription());
} catch (Exception ex) {
s_logger.error("Exception attaching ISO", ex);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach ISO: " + ex.getMessage());
}
>>>>>>> |
<<<<<<<
ConfigManager, ManagementServer, NetworkManager, StorageManager, UserVmManager, AccountManager
=======
ConfigManager, ManagementServer, NetworkGroupManager, NetworkManager, StorageManager, UserVmManager
>>>>>>>
ConfigManager, ManagementServer, NetworkGroupManager, NetworkManager, StorageManager, UserVmManager, AccountManager |
<<<<<<<
=======
String skuJson = "{"
+ "\"productId\" = \"id1\","
+ "\"title\" = \"My item\","
+ "\"description\" = \"Some description.\","
+ "\"price\" = \"123.45\","
+ "\"price_amount_micros\" = \"123450000\","
+ "\"price_currency_code\" = \"GBP\""
+ "}";
>>>>>>> |
<<<<<<<
private final Set<String> websites = new HashSet<>();
=======
private final Set<Address> addresses = new HashSet<>();
>>>>>>>
private final Set<String> websites = new HashSet<>();
private final Set<Address> addresses = new HashSet<>();
<<<<<<<
ContactsContract.CommonDataKinds.Event.LABEL),
Website(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.Website.URL);
=======
ContactsContract.CommonDataKinds.Event.LABEL),
Address(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS),
AddressType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.TYPE),
AddressStreet(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.STREET),
AddressCity(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.CITY),
AddressRegion(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.REGION),
AddressPostcode(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE),
AddressCountry(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY),
AddressLabel(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.LABEL);
>>>>>>>
ContactsContract.CommonDataKinds.Event.LABEL),
Website(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.Website.URL);
Address(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS),
AddressType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.TYPE),
AddressStreet(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.STREET),
AddressCity(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.CITY),
AddressRegion(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.REGION),
AddressPostcode(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE),
AddressCountry(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY),
AddressLabel(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredPostal.LABEL);
<<<<<<<
Contact addWebsite(String website) {
websites.add(website);
return this;
}
=======
Contact addAddress(Address address) {
addresses.add(address);
return this;
}
>>>>>>>
Contact addWebsite(String website) {
websites.add(website);
return this;
}
Contact addAddress(Address address) {
addresses.add(address);
return this;
}
<<<<<<<
/**
* Gets the list of all websites the contact has
*
* @return A list of websites
*/
public List<String> getWebsites() {
return Arrays.asList(websites.toArray(new String[websites.size()]));
}
=======
/**
* Gets the list of addresses
*
* @return A list of addresses
*/
public List<Address> getAddresses() {
return Arrays.asList(addresses.toArray(new Address[addresses.size()]));
}
>>>>>>>
/**
* Gets the list of all websites the contact has
*
* @return A list of websites
*/
public List<String> getWebsites() {
return Arrays.asList(websites.toArray(new String[websites.size()]));
}
/**
* Gets the list of addresses
*
* @return A list of addresses
*/
public List<Address> getAddresses() {
return Arrays.asList(addresses.toArray(new Address[addresses.size()]));
} |
<<<<<<<
String getCompanyName() {
return getString(c, ContactsContract.CommonDataKinds.Organization.COMPANY);
}
String getCompanyTitle() {
return getString(c, ContactsContract.CommonDataKinds.Organization.TITLE);
}
=======
String getWebsite() {
return getString(c, ContactsContract.CommonDataKinds.Website.URL);
}
Address getAddress() {
String address = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS);
if (address == null) {
return null;
}
Integer typeValue = getInt(c, ContactsContract.CommonDataKinds.StructuredPostal.TYPE);
Address.Type type = typeValue == null ? Address.Type.UNKNOWN : Address.Type.fromValue(typeValue);
String street = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.STREET);
String city = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.CITY);
String region = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.REGION);
String postcode = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE);
String country = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY);
if (!type.equals(Address.Type.CUSTOM)) {
return new Address(address, street, city, region, postcode, country, type);
}
String label = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.LABEL);
return new Address(address, street, city, region, postcode, country, label);
}
>>>>>>>
String getCompanyName() {
return getString(c, ContactsContract.CommonDataKinds.Organization.COMPANY);
}
String getCompanyTitle() {
return getString(c, ContactsContract.CommonDataKinds.Organization.TITLE);
}
String getWebsite() {
return getString(c, ContactsContract.CommonDataKinds.Website.URL);
}
Address getAddress() {
String address = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS);
if (address == null) {
return null;
}
Integer typeValue = getInt(c, ContactsContract.CommonDataKinds.StructuredPostal.TYPE);
Address.Type type = typeValue == null ? Address.Type.UNKNOWN : Address.Type.fromValue(typeValue);
String street = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.STREET);
String city = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.CITY);
String region = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.REGION);
String postcode = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE);
String country = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY);
if (!type.equals(Address.Type.CUSTOM)) {
return new Address(address, street, city, region, postcode, country, type);
}
String label = getString(c, ContactsContract.CommonDataKinds.StructuredPostal.LABEL);
return new Address(address, street, city, region, postcode, country, label);
} |
<<<<<<<
=======
String commit_message = call.get("changelog", null);
if(commit_message==null){
JSONObject error = new JSONObject();
error.put("accepted", false);
return new ServiceResponse(error);
}
>>>>>>>
String commit_message = call.get("changelog", null);
if(commit_message==null){
JSONObject error = new JSONObject();
error.put("accepted", false);
return new ServiceResponse(error);
}
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>>
<<<<<<<
json.put("accepted", true);
return new ServiceResponse(json);
=======
JSONObject success = new JSONObject();
success.put("accepted", true);
//Add to git
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = null;
try {
repository = builder.setGitDir((DAO.susi_skill_repo))
.readEnvironment() // scan environment GIT_* variables
.findGitDir() // scan up the file system tree
.build();
try (Git git = new Git(repository)) {
git.add()
.addFilepattern(expert_name)
.call();
// and then commit the changes
git.commit()
.setMessage(commit_message)
.call();
} catch (GitAPIException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
return new ServiceResponse(success);
>>>>>>>
//Add to git
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = null;
try {
repository = builder.setGitDir((DAO.susi_skill_repo))
.readEnvironment() // scan environment GIT_* variables
.findGitDir() // scan up the file system tree
.build();
try (Git git = new Git(repository)) {
git.add()
.addFilepattern(expert_name)
.call();
// and then commit the changes
git.commit()
.setMessage(commit_message)
.call();
json.put("accepted", true);
return new ServiceResponse(json);
} catch (GitAPIException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
} |
<<<<<<<
import org.loklak.api.server.ImportProfileServlet;
=======
import org.loklak.api.server.FossasiaPushServlet;
>>>>>>>
import org.loklak.api.server.FossasiaPushServlet;
import org.loklak.api.server.ImportProfileServlet; |
<<<<<<<
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;
=======
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
>>>>>>>
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
<<<<<<<
String keystorePath;
String keystorePass;
String keystoreManagerPass;
=======
KeyStore keyStore;
String keystoreManagerPass;
>>>>>>>
KeyStore keyStore;
String keystoreManagerPass;
<<<<<<<
=======
TopMenuService.class,
>>>>>>>
<<<<<<<
RSSReaderService.class,
SusiService.class,
WordpressCrawlerService.class
// tools
// vis
=======
WordpressCrawlerService.class,
PublicKeyRegistrationService.class
>>>>>>>
RSSReaderService.class,
SusiService.class,
WordpressCrawlerService.class
// tools
// vis |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.