Skip to content

Commit

Permalink
[#1375] Revise public API
Browse files Browse the repository at this point in the history
move KeysResource and Factory to internal package
  • Loading branch information
eparovyshnaya committed May 28, 2024
1 parent 66e0bc9 commit 3272d9b
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";resolution:=opti
org.eclipse.emf.ecore;bundle-version="0.0.0";visibility:=reexport,
org.eclipse.passage.lic.emf;bundle-version="0.0.0",
org.eclipse.passage.lic.keys;bundle-version="0.0.0";visibility:=reexport
Export-Package: org.eclipse.passage.lic.keys.model.api,
Export-Package: org.eclipse.passage.lic.internal.keys.model.util;x-internal:=true,
org.eclipse.passage.lic.keys.model.api,
org.eclipse.passage.lic.keys.model.impl;x-internal:=true,
org.eclipse.passage.lic.keys.model.meta,
org.eclipse.passage.lic.keys.model.util
Expand Down
68 changes: 34 additions & 34 deletions bundles/org.eclipse.passage.lic.keys.model/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
Copyright (c) 2021, 2024 ArSysOp
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.
SPDX-License-Identifier: EPL-2.0
Contributors:
ArSysOp - initial API and implementation
ArSysOp - further support
-->
<plugin>


<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated keys -->
<package
uri="http://www.eclipse.org/passage/lic/keys/3.0.0"
class="org.eclipse.passage.lic.keys.model.meta.KeysPackage"
genModel="model/keys.genmodel"/>
</extension>

<extension point="org.eclipse.emf.ecore.extension_parser">
<!-- @generated keys -->
<parser
type="keys"
class="org.eclipse.passage.lic.keys.model.util.KeysResourceFactoryImpl"/>
</extension>

</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
Copyright (c) 2021, 2024 ArSysOp
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.
SPDX-License-Identifier: EPL-2.0
Contributors:
ArSysOp - initial API and implementation
ArSysOp - further support
-->
<plugin>


<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated keys -->
<package
uri="http://www.eclipse.org/passage/lic/keys/3.0.0"
class="org.eclipse.passage.lic.keys.model.meta.KeysPackage"
genModel="model/keys.genmodel"/>
</extension>

<extension point="org.eclipse.emf.ecore.extension_parser">
<!-- @generated keys -->
<parser
type="keys"
class="org.eclipse.passage.lic.internal.keys.model.util.KeysResourceFactoryImpl"/>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.internal.keys.model.migration;

import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.passage.lic.emf.migration.MigrationRoutes;
import org.eclipse.passage.lic.emf.migration.SimpleMigrationRoutes;
import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler;
import org.eclipse.passage.lic.keys.model.meta.KeysPackage;

public final class KeysResourceHandler extends MigratingResourceHandler {

@Override
protected void complete(XMLResource resource) {
// do nothing
}

@Override
protected void register() {
migrate200();
}

@Override
protected MigrationRoutes attributes() {
return new SimpleMigrationRoutes();
}

private void migrate200() {
String uri = "http://www.eclipse.org/passage/lic/keys/2.0.0"; //$NON-NLS-1$
KeysPackage delegate = KeysPackage.eINSTANCE;
EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate);
}

}
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.internal.keys.model.migration;

import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.passage.lic.emf.migration.MigrationRoutes;
import org.eclipse.passage.lic.emf.migration.SimpleMigrationRoutes;
import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler;
import org.eclipse.passage.lic.keys.model.meta.KeysPackage;

@SuppressWarnings("restriction")
public final class KeysResourceHandler extends MigratingResourceHandler {

@Override
protected void complete(XMLResource resource) {
// do nothing
}

@Override
protected void register() {
migrate200();
}

@Override
protected MigrationRoutes attributes() {
return new SimpleMigrationRoutes();
}

private void migrate200() {
String uri = "http://www.eclipse.org/passage/lic/keys/2.0.0"; //$NON-NLS-1$
KeysPackage delegate = KeysPackage.eINSTANCE;
EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate);
}

}
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.keys.model.util;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.passage.lic.emf.resource.BlindResourceFactory;

/**
* @since 3.0
*
* @generated NOT
*/
public final class KeysResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory {

/**
* @generated NOT
*/
@Override
public Resource createResource(URI uri) {
return new KeysResourceImpl(uri);
}

/**
* @generated NOT
*/
@Override
public Resource createResource() {
return new KeysResourceImpl();
}

}
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.internal.keys.model.util;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.passage.lic.emf.resource.BlindResourceFactory;

@SuppressWarnings("restriction")
public final class KeysResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory {

@Override
public Resource createResource(URI uri) {
return new KeysResourceImpl(uri);
}

@Override
public Resource createResource() {
return new KeysResourceImpl();
}

}
Original file line number Diff line number Diff line change
@@ -1,52 +1,39 @@
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.keys.model.util;

import java.util.Map;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
import org.eclipse.passage.lic.internal.keys.model.migration.KeysResourceHandler;

/**
* @generated NOT
* @since 3.0
*/
public class KeysResourceImpl extends XMIResourceImpl {
/**
* @generated
*/
public KeysResourceImpl(URI uri) {
super(uri);
}

/**
*
* @generated NOT
*/
public KeysResourceImpl() {
super();
}

/**
* @generated NOT
*/
@Override
protected void init() {
super.init();
Map<Object, Object> options = getDefaultLoadOptions();
options.put(OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
options.put(OPTION_RESOURCE_HANDLER, new KeysResourceHandler());
}

}
/*******************************************************************************
* Copyright (c) 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.lic.internal.keys.model.util;

import java.util.Map;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
import org.eclipse.passage.lic.internal.keys.model.migration.KeysResourceHandler;

public class KeysResourceImpl extends XMIResourceImpl {

public KeysResourceImpl(URI uri) {
super(uri);
}

public KeysResourceImpl() {
super();
}

@Override
protected void init() {
super.init();
Map<Object, Object> options = getDefaultLoadOptions();
options.put(OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
options.put(OPTION_RESOURCE_HANDLER, new KeysResourceHandler());
}

}

0 comments on commit 3272d9b

Please sign in to comment.