Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 23bc477a31a998fb21af80c7489fbddcd429f100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/*****************************************************************************
 * Copyright (c) 2013 CEA LIST.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   CEA LIST - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.cdo.internal.core;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistryPopulator;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.NotAuthenticatedException;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.spi.cdo.CDOMergingConflictResolver;
import org.eclipse.equinox.security.storage.EncodingUtils;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.equinox.security.storage.StorageException;
import org.eclipse.net4j.signal.RemoteException;
import org.eclipse.net4j.util.container.Container;
import org.eclipse.net4j.util.container.ContainerEvent;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.util.lifecycle.LifecycleException;
import org.eclipse.net4j.util.security.CredentialsProviderFactory;
import org.eclipse.net4j.util.security.ICredentialsProvider2;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.cdo.core.CommitException;
import org.eclipse.papyrus.cdo.core.IPapyrusRepositoryListener;
import org.eclipse.papyrus.cdo.core.IResourceSetDisposalApprover;
import org.eclipse.papyrus.cdo.core.PapyrusRepositoryEvent;
import org.eclipse.papyrus.cdo.core.resource.CDOAwareModelSet;
import org.eclipse.papyrus.cdo.core.resource.PapyrusCDOResourceFactory;
import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
import org.eclipse.papyrus.cdo.internal.core.repositories.Repository;

import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;

/**
 * This is the PapyrusRepository type. Enjoy.
 */
public class PapyrusRepository extends Container<CDOResourceNode> implements IInternalPapyrusRepository, IAdaptable {

	private static final String SECURE_STORE_PATH = "/" + Activator.PLUGIN_ID //$NON-NLS-1$
		+ "/repositories"; //$NON-NLS-1$

	private static final CDOResourceNode[] NO_RESOURCE_NODES = new CDOResourceNode[0];

	private final IManagedContainer container;

	private final Repository model;

	private CDOSession session;

	private final BiMap<ResourceSet, CDOView> readOnlyViews = HashBiMap.create();

	private final BiMap<ResourceSet, CDOTransaction> transactions = HashBiMap.create();

	private IListener viewListener;

	private CDOView masterView;

	private volatile CDOResourceNode[] topResourceNodes;

	private IListener masterViewListener;

	private final CompositeResourceSetDisposalApprover approvers = new CompositeResourceSetDisposalApprover();

	private final CopyOnWriteArrayList<IPapyrusRepositoryListener> listeners = new CopyOnWriteArrayList<IPapyrusRepositoryListener>();

	public PapyrusRepository(IManagedContainer container, Repository model) {
		this.container = container;
		this.model = model;

		activate();
	}

	@Override
	public String getName() {
		return model.getName();
	}

	@Override
	public void setName(String name) {
		if(Strings.isNullOrEmpty(name)) {
			throw new IllegalArgumentException("null or empty name"); //$NON-NLS-1$
		}

		model.setName(name);
	}

	@Override
	public String getURL() {
		return model.getURL();
	}

	@Override
	public String getUsername() {
		return getSecureStorageValue("username"); //$NON-NLS-1$
	}

	@Override
	public void setUsername(String username) {
		if(username != null) {
			username = username.trim();
			if(username.length() == 0) {
				username = null;
			}
		}

		setSecureStorageValue("username", username, false); //$NON-NLS-1$
	}

	@Override
	public String getPassword() {
		return getSecureStorageValue("password"); //$NON-NLS-1$
	}

	private String getSecureStorageValue(String key) {
		String result = null;

		ISecurePreferences store = SecurePreferencesFactory.getDefault();
		String path = getSecureStorePath();
		if(store.nodeExists(path)) {
			store = store.node(path);

			try {
				result = store.get(key, null);
			} catch (StorageException e) {
				Activator.log.error(String.format("Failed to load repository %s from secure storage.", key), //$NON-NLS-1$
					e);
			}
		}

		return result;
	}

	private String getSecureStorePath() {
		return String.format("%s/%s", SECURE_STORE_PATH, //$NON-NLS-1$
			EncodingUtils.encodeSlashes(getURL()));
	}

	@Override
	public void setPassword(String password) {
		setSecureStorageValue("password", password, true); //$NON-NLS-1$
	}

	private void setSecureStorageValue(String key, String value, boolean encrypt) {
		ISecurePreferences store = SecurePreferencesFactory.getDefault().node(getSecureStorePath());
		try {
			if(value == null) {
				store.remove(key);
			} else {
				store.put(key, value, encrypt);
			}
		} catch (StorageException e) {
			Activator.log.error(String.format("Failed to store repository %s in secure storage.", key), e); //$NON-NLS-1$
		}
	}

	@Override
	public void clearCredentials() {
		ISecurePreferences store = SecurePreferencesFactory.getDefault();
		String path = getSecureStorePath();
		if(store.nodeExists(path)) {
			store.node(path).removeNode();
		}
	}

	@Override
	public boolean isConnected() {
		return (session != null) && !session.isClosed();
	}

	@Override
	public IStatus connect() {
		IStatus result = Status.OK_STATUS;

		if(!isConnected()) {
			ICredentialsProvider2 creds = getCredentialsProvider();
			Object oldCreds = null;
			if(creds != null) {
				oldCreds = container.putElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", //$NON-NLS-1$
					null, creds);
			}

			try {
				for(;;) {
					try {
						session = (CDOSession)container.getElement("org.eclipse.emf.cdo.sessions", "cdo", getURL()); //$NON-NLS-1$ //$NON-NLS-2$
					} catch (LifecycleException e) {
						// most probably we simply failed to connect to the repository
						result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PapyrusRepository_connectFailed, e);
					} catch (RemoteException e) {
						// most probably we connected to the CDO server but the repository is not available
						result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.PapyrusRepository_badRepo, getName()), e.getCause());
					} catch (NotAuthenticatedException e) {
						// user cancelled the credentials dialog. That's OK
						result = Status.CANCEL_STATUS;
						break;
					} catch (SecurityException e) {
						// wrong credentials. If the user stored them, purge and
						// try again
						clearCredentials();

						if(creds instanceof IInteractiveCredentialsProvider) {
							((IInteractiveCredentialsProvider)creds).reportCredentialsFailure(e);
						}

						continue;
					}
					break;
				}

				if(session != null) {
					configure(session);

					// open the master view for the UI
					createReadOnlyView(new ResourceSetImpl());

					fireRepositoryEvent(PapyrusRepositoryEvent.CONNECTED);

					// update the last known UUID in the model
					String uuid = session.getRepositoryInfo().getUUID();
					if(!Objects.equal(uuid, model.getUUID())) {
						model.setUUID(uuid);
						getManager().saveRepositories();
					}
				}
			} finally {
				if(creds != null) {
					if(oldCreds != null) {
						container.putElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", null, oldCreds); //$NON-NLS-1$
					} else {
						container.removeElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", null); //$NON-NLS-1$
					}
				}
			}
		}

		return result;
	}

	protected final IInternalPapyrusRepositoryManager getManager() {
		return (IInternalPapyrusRepositoryManager)container.getElement(IInternalPapyrusRepositoryManager.PRODUCT_GROUP, IInternalPapyrusRepositoryManager.MANAGER_FACTORY, null);
	}

	private ICredentialsProvider2 getCredentialsProvider() {
		ICredentialsProvider2 result = null;

		ICredentialsProviderFactory factory = getManager().getCredentialsProviderFactory();

		if(factory != null) {
			result = factory.createCredentialsProvider(this);
		}

		return result;
	}

	@Override
	public void disconnect() throws CommitException {
		if(isConnected()) {
			ImmutableList<ResourceSet> dirty = ImmutableList.copyOf(Iterables.filter(transactions.keySet(), new Predicate<ResourceSet>() {

				@Override
				public boolean apply(ResourceSet input) {
					return transactions.get(input).isDirty();
				}
			}));

			switch(approvers.disposalRequested(this, dirty)) {
			case SAVE:
				for(ResourceSet next : dirty) {
					commit(next);
				}

				// intentional fall-through (save then close)
			case CLOSE:
				for(CDOView next : ImmutableList.copyOf(transactions.values())) {

					doClose(next);
				}
				for(CDOView next : ImmutableList.copyOf(readOnlyViews.values())) {

					doClose(next);
				}

				session.close();
				session = null;

				fireRepositoryEvent(PapyrusRepositoryEvent.DISCONNECTED);
				break;
			default: // NONE
				break;
			}
		}
	}

	protected void checkConnected() {
		if(!isConnected()) {
			throw new IllegalStateException("not connected"); //$NON-NLS-1$
		}
	}

	@Override
	public Collection<ResourceSet> getReadOnlyViews() {
		return Collections.unmodifiableCollection(readOnlyViews.keySet());
	}

	@Override
	public ResourceSet createReadOnlyView(ResourceSet resourceSet) {
		checkConnected();

		CDOView view = session.openView(resourceSet);
		configure(view);
		ResourceSet result = view.getResourceSet();
		readOnlyViews.put(result, view);

		if(masterView == null) {
			masterView = view;
			topResourceNodes = getElements();
			adaptMasterView(view);

			if(topResourceNodes.length > 0) {
				fireElementsAddedEvent(topResourceNodes);
			} else {
				fireEvent(); // just refresh my presentation
			}
		}

		return result;
	}

	@Override
	public Collection<ResourceSet> getTransactions() {
		return Collections.unmodifiableCollection(transactions.keySet());
	}

	@Override
	public ResourceSet createTransaction(ResourceSet resourceSet) {
		checkConnected();

		CDOTransaction transaction = session.openTransaction(resourceSet);
		configure(transaction);
		ResourceSet result = transaction.getResourceSet();
		transactions.put(result, transaction);

		return result;
	}

	@Override
	public CDOSession getCDOSession() {
		return session;
	}

	@Override
	public CDOView getMasterView() {
		return masterView;
	}

	@Override
	public CDOView getCDOView(ResourceSet resourceSet) {
		CDOView result = readOnlyViews.get(resourceSet);

		if(result == null) {
			result = transactions.get(resourceSet);
		}

		return result;
	}

	protected void removeCDOView(ResourceSet resourceSet) {
		readOnlyViews.remove(resourceSet);
		transactions.remove(resourceSet);
	}

	CDOTransaction checkTransaction(CDOView view) {
		if(!(view instanceof CDOTransaction)) {
			throw new IllegalArgumentException("not a transaction"); //$NON-NLS-1$
		}

		return (CDOTransaction)view;
	}

	@Override
	public void commit(ResourceSet transaction) throws CommitException {
		CDOView cdoView = getCDOView(transaction);

		try {
			checkTransaction(cdoView).commit();
		} catch (org.eclipse.emf.cdo.util.CommitException e) {
			throw new CommitException(e);
		}
	}

	@Override
	public void rollback(ResourceSet transaction) {
		CDOView cdoView = getCDOView(transaction);
		checkTransaction(cdoView).rollback();
	}

	@Override
	public void close(ResourceSet view) {
		CDOView cdoView = getCDOView(view);

		if(cdoView != null) {
			doClose(cdoView);
		}
	}

	protected void doClose(CDOView view) {
		try {
			if(view == masterView) {
				unadaptMasterView(view);
				masterView = null;
				CDOResourceNode[] removedNodes = topResourceNodes;
				topResourceNodes = null;
				if((removedNodes != null) && (removedNodes.length > 0)) {
					fireElementsRemovedEvent(removedNodes);
				} else {
					fireEvent(); // just refresh my presentation
				}
			}
		} finally {
			unadaptView(view);
			removeCDOView(view.getResourceSet());
			view.close();
		}
	}

	public Repository getModel() {
		return model;
	}

	protected void configure(CDOSession newSession) {
		CDOPackageRegistry registry = newSession.getPackageRegistry();
		CDOPackageRegistryPopulator.populate(registry);

		if(registry instanceof InternalCDOPackageRegistry) {
			InternalCDOPackageRegistry internalRegistry = (InternalCDOPackageRegistry)registry;
			internalRegistry.setPackageProcessor(new GMFSafePackageProcessor(internalRegistry.getPackageProcessor()));
		}
	}

	protected void configure(CDOView newReadOnlyView) {
		adaptView(newReadOnlyView);

		commonViewConfiguration(newReadOnlyView);

		// TODO: Do we need to set any other options?
	}

	protected void commonViewConfiguration(CDOView newView) {
		// CDO's default resource factory inspects the current thread's stack
		// trace to see whether the getResource(...) method of a set of known
		// ResourceSet implementation classes is in progress. We have a
		// ResourceSet implementation that CDO doesn't know about, so we need
		// our own factory
		ResourceSet rset = newView.getResourceSet();
		if(rset instanceof CDOAwareModelSet) {
			rset.getResourceFactoryRegistry().getProtocolToFactoryMap().put(CDOProtocolConstants.PROTOCOL_NAME, new PapyrusCDOResourceFactory((CDOAwareModelSet)rset));
		}
	}

	protected void configure(CDOTransaction newTransaction) {
		adaptView(newTransaction);

		commonViewConfiguration(newTransaction);

		newTransaction.options().addConflictResolver(new CDOMergingConflictResolver());
		// TODO: Do we need to set any other options?
	}

	private IListener getViewListener() {
		if(viewListener == null) {
			viewListener = new LifecycleEventAdapter() {

				@Override
				protected void onDeactivated(ILifecycle lifecycle) {
					readOnlyViews.inverse().remove(lifecycle);
					transactions.inverse().remove(lifecycle);
				}
			};
		}

		return viewListener;
	}

	private void adaptView(CDOView view) {
		view.addListener(getViewListener());
	}

	private void unadaptView(CDOView view) {
		view.removeListener(getViewListener());
	}

	private IListener getMasterViewListener() {
		if(masterViewListener == null) {
			masterViewListener = new IListener() {

				@Override
				public void notifyEvent(IEvent event) {
					if(event instanceof CDOViewInvalidationEvent) {
						CDOViewInvalidationEvent inval = (CDOViewInvalidationEvent)event;
						translateMasterViewInvalidationEvent(inval);
					}
				}
			};
		}

		return masterViewListener;
	}

	private void adaptMasterView(CDOView view) {
		view.addListener(getMasterViewListener());
	}

	private void unadaptMasterView(CDOView view) {
		view.removeListener(getMasterViewListener());
	}

	@Override
	public void addResourceSetDisposalApprover(IResourceSetDisposalApprover approver) {
		approvers.addApprover(approver);
	}

	@Override
	public void removeResourceSetDisposalApprover(IResourceSetDisposalApprover approver) {
		approvers.removeApprover(approver);
	}

	@Override
	public void addPapyrusRepositoryListener(IPapyrusRepositoryListener listener) {
		listeners.addIfAbsent(listener);
	}

	@Override
	public void removePapyrusRepositoryListener(IPapyrusRepositoryListener listener) {
		listeners.remove(listener);
	}

	protected void fireRepositoryEvent(int eventType) {
		if(!listeners.isEmpty()) {
			PapyrusRepositoryEvent event = new PapyrusRepositoryEvent(this, eventType);
			for(IPapyrusRepositoryListener next : listeners) {
				try {
					next.papyrusRepositoryChanged(event);
				} catch (Exception e) {
					Activator.log.error("Uncaught exception in repository event listener.", e); //$NON-NLS-1$
				}
			}
		}
	}

	//
	// IContainer protocol
	//

	@Override
	public boolean isEmpty() {
		return !isActive() || !isConnected() || (masterView == null) || masterView.isEmpty();
	}

	@Override
	public CDOResourceNode[] getElements() {
		CDOResourceNode[] result = NO_RESOURCE_NODES;

		if(masterView != null) {
			if(topResourceNodes == null) {
				topResourceNodes = masterView.getElements();
			}
			result = topResourceNodes;
		}

		return result;
	}

	@Override
	protected void doAfterActivate() throws Exception {
		super.doAfterActivate();

		model.eAdapters().add(new AdapterImpl() {

			@Override
			public void notifyChanged(Notification msg) {
				fireEvent();
			}

			@Override
			public boolean isAdapterForType(Object type) {
				return type == PapyrusRepository.class;
			}
		});
	}

	@Override
	protected void doBeforeDeactivate() throws Exception {
		Adapter adapter = EcoreUtil.getExistingAdapter(model, PapyrusRepository.class);
		if(adapter != null) {
			model.eAdapters().remove(adapter);
		}

		super.doBeforeDeactivate();
	}

	private void translateMasterViewInvalidationEvent(CDOViewInvalidationEvent event) {
		for(Map.Entry<CDOObject, CDORevisionDelta> next : event.getRevisionDeltas().entrySet()) {

			if(next.getKey() instanceof CDOResourceNode) {
				CDOResourceNode resNode = (CDOResourceNode)next.getKey();

				if(resNode.isRoot()) {
					// the event doesn't provide a revision delta, so calculate
					// a delta

					Set<CDOResourceNode> currentNodes = Sets.newLinkedHashSet(Arrays.asList(getElements()));
					Set<CDOResourceNode> newNodes = Sets.newLinkedHashSet(Iterables.filter(((CDOResource)resNode).getContents(), CDOResourceNode.class));

					Set<CDOResourceNode> removed = Sets.difference(currentNodes, newNodes);
					Set<CDOResourceNode> added = Sets.difference(newNodes, currentNodes);

					ContainerEvent<CDOResourceNode> cEvent = new ContainerEvent<CDOResourceNode>(this);
					for(CDOResourceNode r : removed) {
						cEvent.addDelta(r, IContainerDelta.Kind.REMOVED);
					}
					for(CDOResourceNode a : added) {
						cEvent.addDelta(a, IContainerDelta.Kind.ADDED);
					}

					// re-calculate elements from the view
					topResourceNodes = resNode.cdoView().getElements();

					fireEvent(cEvent);
					break;
				}
			}
		}

	}

	//
	// IAdaptable protocol
	//

	@Override
	public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
		Object result = null;

		if((adapter == CDOResourceNode.class) || (adapter == CDOResource.class)) {
			CDOView view = getMasterView();
			if((view != null) && !view.isClosed()) {
				result = view.getRootResource();
			}
		} else {
			result = Platform.getAdapterManager().getAdapter(this, adapter);
		}

		return result;
	}
}

Back to the top