<commit_before>/*******************************************************************************
 * Copyright (c) 2016 Composent, Inc. and others. 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: Composent, Inc. - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.providers.internal.py4j;

import java.util.Map;
import java.util.UUID;

import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.provider.direct.local.RSAClientContainer;
import org.eclipse.ecf.provider.direct.local.RSAHostContainer;
import org.eclipse.ecf.providers.py4j.Py4jConstants;
import org.eclipse.ecf.providers.py4j.identity.Py4jNamespace;
import org.eclipse.ecf.remoteservice.provider.IRemoteServiceDistributionProvider;
import org.eclipse.ecf.remoteservice.provider.RemoteServiceContainerInstantiator;
import org.eclipse.ecf.remoteservice.provider.RemoteServiceDistributionProvider;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

	@Override
	public void start(BundleContext context) throws Exception {
		context.registerService(Namespace.class, new Py4jNamespace(), null);
		context.registerService(IRemoteServiceDistributionProvider.class,
				new RemoteServiceDistributionProvider.Builder().setName(Py4jConstants.JAVA_HOST_CONFIG_TYPE)
						.setInstantiator(new RemoteServiceContainerInstantiator(Py4jConstants.JAVA_HOST_CONFIG_TYPE,
								Py4jConstants.JAVA_HOST_CONFIG_TYPE) {
							public IContainer createInstance(ContainerTypeDescription description,
									Map<String, ?> parameters) {
								return new RSAHostContainer(
										Py4jNamespace.INSTANCE.createInstance(new Object[] {
												"py4j://localhost:" + RSAComponent.getDefault().getPort() + "/java" }),
										RSAComponent.getDefault().getContainerExporter());
							}
						}).setServer(true).setHidden(false).build(),
				null);
		context.registerService(IRemoteServiceDistributionProvider.class,
				new RemoteServiceDistributionProvider.Builder().setName(Py4jConstants.JAVA_CONSUMER_CONFIG_TYPE)
						.setInstantiator(new RemoteServiceContainerInstantiator(Py4jConstants.PYTHON_HOST_CONFIG_TYPE,
								Py4jConstants.JAVA_CONSUMER_CONFIG_TYPE) {
							public IContainer createInstance(ContainerTypeDescription description,
									Map<String, ?> parameters) {
								ID clientID = Py4jNamespace.getInstance()
										.createInstance(new Object[] { "uuid:" + UUID.randomUUID().toString() });
								return new RSAClientContainer(clientID, RSAComponent.getDefault().getProxyMapper());
							}
						}).setServer(false).setHidden(false).build(),
				null);
	}

	@Override
	public void stop(BundleContext context) throws Exception {
	}

}
<commit_msg>Changed intents for Py4j provider to be passByReference rather than passByValue<commit_after>/*******************************************************************************
 * Copyright (c) 2016 Composent, Inc. and others. 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: Composent, Inc. - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.providers.internal.py4j;

import java.util.Map;
import java.util.UUID;

import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.provider.direct.local.RSAClientContainer;
import org.eclipse.ecf.provider.direct.local.RSAHostContainer;
import org.eclipse.ecf.providers.py4j.Py4jConstants;
import org.eclipse.ecf.providers.py4j.identity.Py4jNamespace;
import org.eclipse.ecf.remoteservice.provider.IRemoteServiceDistributionProvider;
import org.eclipse.ecf.remoteservice.provider.RemoteServiceContainerInstantiator;
import org.eclipse.ecf.remoteservice.provider.RemoteServiceDistributionProvider;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

	private static final String[] py4jSupportedIntents = { "passByReference", "exactlyOnce", "ordered" };
	@Override
	public void start(BundleContext context) throws Exception {
		context.registerService(Namespace.class, new Py4jNamespace(), null);
		context.registerService(IRemoteServiceDistributionProvider.class,
				new RemoteServiceDistributionProvider.Builder().setName(Py4jConstants.JAVA_HOST_CONFIG_TYPE)
						.setInstantiator(new RemoteServiceContainerInstantiator(Py4jConstants.JAVA_HOST_CONFIG_TYPE,
								Py4jConstants.JAVA_HOST_CONFIG_TYPE) {
							public IContainer createInstance(ContainerTypeDescription description,
									Map<String, ?> parameters) {
								return new RSAHostContainer(
										Py4jNamespace.INSTANCE.createInstance(new Object[] {
												"py4j://localhost:" + RSAComponent.getDefault().getPort() + "/java" }),
										RSAComponent.getDefault().getContainerExporter());
							}
							@Override
							public String[] getSupportedIntents(ContainerTypeDescription description) {
								return py4jSupportedIntents;
							}
						}).setServer(true).setHidden(false).build(),
				null);
		context.registerService(IRemoteServiceDistributionProvider.class,
				new RemoteServiceDistributionProvider.Builder().setName(Py4jConstants.JAVA_CONSUMER_CONFIG_TYPE)
						.setInstantiator(new RemoteServiceContainerInstantiator(Py4jConstants.PYTHON_HOST_CONFIG_TYPE,
								Py4jConstants.JAVA_CONSUMER_CONFIG_TYPE) {
							public IContainer createInstance(ContainerTypeDescription description,
									Map<String, ?> parameters) {
								ID clientID = Py4jNamespace.getInstance()
										.createInstance(new Object[] { "uuid:" + UUID.randomUUID().toString() });
								return new RSAClientContainer(clientID, RSAComponent.getDefault().getProxyMapper());
							}
							public String[] getSupportedIntents(ContainerTypeDescription description) {
								return py4jSupportedIntents;
							}
						}).setServer(false).setHidden(false).build(),
				null);
	}

	@Override
	public void stop(BundleContext context) throws Exception {
	}

}

{'fraction_non_alphanumeric': 0.13675340035481964, 'fraction_numerical': 0.007392075694855115, 'mean_word_length': 5.223551057957682, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6652836', 'n_tokens_mistral': 2207, 'n_tokens_neox': 1818, 'n_words': 327}