| /***************************************************************************** |
| * Copyright (c) 2017, 2020 CEA LIST and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * CEA LIST - Initial API and implementation |
| * CEA LIST - Bug 566942 |
| * |
| *****************************************************************************/ |
| |
| package org.eclipse.papyrus.cdo.core.resource; |
| |
| import java.io.IOException; |
| import java.util.HashMap; |
| import java.util.Map; |
| |
| import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl; |
| import org.eclipse.emf.common.util.URI; |
| import org.eclipse.uml2.common.util.CacheAdapter; |
| |
| public class PapyrusCDOResourceImpl extends CDOResourceImpl { |
| |
| /** |
| * Set this System property to true to avoid resource DEPTH_INFINITE prefetch. |
| */ |
| public static final String ORG_ECLIPSE_PAPYRUS_LAZY_CDO_RESOURCE_LOADING = "org.eclipse.papyrus.lazyCDOResourceLoading"; //$NON-NLS-1$ |
| |
| @Override |
| public void load(Map<?, ?> options) throws IOException { |
| if (!isLoaded()) { |
| Boolean lazy = Boolean.getBoolean(ORG_ECLIPSE_PAPYRUS_LAZY_CDO_RESOURCE_LOADING); |
| if (!lazy) { |
| CacheAdapter cacheAdapter = CacheAdapter.getInstance(); |
| if (cacheAdapter.getClass() != NonLazyPapyrusCDOCacheAdapter.class) { |
| NonLazyPapyrusCDOCacheAdapter.register(new NonLazyPapyrusCDOCacheAdapter()); |
| } |
| |
| } |
| |
| super.load(options); |
| } |
| } |
| |
| public PapyrusCDOResourceImpl(URI uri) { |
| super(uri); |
| } |
| |
| @Override |
| public Map<Object, Object> getDefaultSaveOptions() { |
| return new HashMap<Object, Object>(); |
| } |
| } |