Skip to content

Commit

Permalink
removed unnecessary ResourceSetFactory reference in generated code
Browse files Browse the repository at this point in the history
Signed-off-by: Juergen Albert <[email protected]>
  • Loading branch information
juergen-albert committed Aug 1, 2023
1 parent 5a6d001 commit ec7b136
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,52 +25,49 @@ public static synchronized ConfigurationComponentClass create(String lineSeparat
protected final String TEXT_4 = NL + " */" + NL + "package ";
protected final String TEXT_5 = ".configuration;" + NL;
protected final String TEXT_6 = NL + NL + "/**" + NL + " * The <b>PackageConfiguration</b> for the model." + NL + " * The package will be registered into a OSGi base model registry." + NL + " * " + NL + " * @generated" + NL + " */" + NL + "@Component(name = \"";
protected final String TEXT_7 = "Configurator\"," + NL + " \treference = @";
protected final String TEXT_8 = "( name = \"ResourceSetFactory\", service = ";
protected final String TEXT_9 = ".class, cardinality = ";
protected final String TEXT_10 = ".MANDATORY)" + NL + " )" + NL + "@";
protected final String TEXT_11 = "( namespace = \"osgi.service\", attribute = { \"objectClass:List<String>=\\\"";
protected final String TEXT_12 = ", org.eclipse.emf.ecore.EFactory\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_13 = "\" })" + NL + "@";
protected final String TEXT_14 = ", org.eclipse.emf.ecore.EPackage\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_15 = "\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_16 = "\\\"\" , \"uses:=org.osgi.service.condition\" })" + NL + "public class ";
protected final String TEXT_17 = "ConfigurationComponent" + NL + "{" + NL + "\t" + NL + "\tprivate ";
protected final String TEXT_18 = "<?> packageRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_19 = "<";
protected final String TEXT_20 = "> ePackageConfiguratorRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_21 = "<?> eFactoryRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_22 = "<?> conditionRegistration = null;" + NL + "" + NL + "\t/**" + NL + "\t * Activates the Configuration Component." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\t@";
protected final String TEXT_23 = NL + "\tpublic void activate(BundleContext ctx) {" + NL + "\t\t";
protected final String TEXT_24 = " ePackage = ";
protected final String TEXT_25 = ".eINSTANCE;" + NL + "\t\t" + NL + "\t\t";
protected final String TEXT_26 = "EPackageConfigurator packageConfigurator = registerEPackageConfiguratorService(ePackage, ctx);" + NL + "\t\tregisterEPackageService(ePackage, packageConfigurator, ctx);" + NL + "\t\tregisterEFactoryService(ePackage, packageConfigurator, ctx);" + NL + "\t\tregisterConditionService(packageConfigurator, ctx);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_27 = "EPackageConfigurator as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
protected final String TEXT_28 = "EPackageConfigurator registerEPackageConfiguratorService(";
protected final String TEXT_29 = " ePackage, BundleContext ctx){" + NL + "\t\t";
protected final String TEXT_30 = "EPackageConfigurator packageConfigurator = new ";
protected final String TEXT_31 = "EPackageConfigurator(ePackage);" + NL + "\t\t// register the EPackageConfigurator" + NL + "\t\t";
protected final String TEXT_32 = "<String, Object> properties = new ";
protected final String TEXT_33 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tePackageConfiguratorRegistration = ctx.registerService(";
protected final String TEXT_34 = ".class, packageConfigurator, properties);" + NL + "" + NL + "\t\treturn packageConfigurator;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_35 = " as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void registerEPackageService(";
protected final String TEXT_36 = " ePackage, ";
protected final String TEXT_37 = "EPackageConfigurator packageConfigurator, BundleContext ctx){" + NL + "\t\t";
protected final String TEXT_38 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tString[] serviceClasses = new String[] {";
protected final String TEXT_39 = ".class.getName(), ";
protected final String TEXT_40 = ".class.getName()};" + NL + "\t\tpackageRegistration = ctx.registerService(serviceClasses, ePackage, properties);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_41 = " as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void registerEFactoryService(";
protected final String TEXT_42 = ".class.getName()};" + NL + "\t\teFactoryRegistration = ctx.registerService(serviceClasses, ePackage.get";
protected final String TEXT_43 = "(), properties);" + NL + "\t}" + NL + "" + NL + "\tprivate void registerConditionService(";
protected final String TEXT_44 = "EPackageConfigurator packageConfigurator, BundleContext ctx){" + NL + "\t\t// register the EPackage" + NL + "\t\t";
protected final String TEXT_45 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tproperties.put(";
protected final String TEXT_46 = ".CONDITION_ID, ";
protected final String TEXT_47 = ".eNS_URI);" + NL + "\t\tconditionRegistration = ctx.registerService(";
protected final String TEXT_48 = ".class, ";
protected final String TEXT_49 = ".INSTANCE, properties);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Deactivates and unregisters everything." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\t@";
protected final String TEXT_50 = NL + "\tpublic void deactivate() {" + NL + "\t\tconditionRegistration.unregister();" + NL + "\t\teFactoryRegistration.unregister();" + NL + "\t\tpackageRegistration.unregister();" + NL + "\t\tePackageConfiguratorRegistration.unregister();" + NL + "\t\tEPackage.Registry.INSTANCE.remove(";
protected final String TEXT_51 = ".eNS_URI);" + NL + "\t}" + NL + "}";
protected final String TEXT_52 = NL;
protected final String TEXT_7 = "Configurator\")" + NL + "@";
protected final String TEXT_8 = "( namespace = \"osgi.service\", attribute = { \"objectClass:List<String>=\\\"";
protected final String TEXT_9 = ", org.eclipse.emf.ecore.EFactory\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_10 = "\" })" + NL + "@";
protected final String TEXT_11 = ", org.eclipse.emf.ecore.EPackage\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_12 = "\\\"\" , \"uses:=org.eclipse.emf.ecore,";
protected final String TEXT_13 = "\\\"\" , \"uses:=org.osgi.service.condition\" })" + NL + "public class ";
protected final String TEXT_14 = "ConfigurationComponent" + NL + "{" + NL + "\t" + NL + "\tprivate ";
protected final String TEXT_15 = "<?> packageRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_16 = "<";
protected final String TEXT_17 = "> ePackageConfiguratorRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_18 = "<?> eFactoryRegistration = null;" + NL + "\tprivate ";
protected final String TEXT_19 = "<?> conditionRegistration = null;" + NL + "" + NL + "\t/**" + NL + "\t * Activates the Configuration Component." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\t@";
protected final String TEXT_20 = NL + "\tpublic void activate(BundleContext ctx) {" + NL + "\t\t";
protected final String TEXT_21 = " ePackage = ";
protected final String TEXT_22 = ".eINSTANCE;" + NL + "\t\t" + NL + "\t\t";
protected final String TEXT_23 = "EPackageConfigurator packageConfigurator = registerEPackageConfiguratorService(ePackage, ctx);" + NL + "\t\tregisterEPackageService(ePackage, packageConfigurator, ctx);" + NL + "\t\tregisterEFactoryService(ePackage, packageConfigurator, ctx);" + NL + "\t\tregisterConditionService(packageConfigurator, ctx);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_24 = "EPackageConfigurator as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
protected final String TEXT_25 = "EPackageConfigurator registerEPackageConfiguratorService(";
protected final String TEXT_26 = " ePackage, BundleContext ctx){" + NL + "\t\t";
protected final String TEXT_27 = "EPackageConfigurator packageConfigurator = new ";
protected final String TEXT_28 = "EPackageConfigurator(ePackage);" + NL + "\t\t// register the EPackageConfigurator" + NL + "\t\t";
protected final String TEXT_29 = "<String, Object> properties = new ";
protected final String TEXT_30 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tePackageConfiguratorRegistration = ctx.registerService(";
protected final String TEXT_31 = ".class, packageConfigurator, properties);" + NL + "" + NL + "\t\treturn packageConfigurator;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_32 = " as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void registerEPackageService(";
protected final String TEXT_33 = " ePackage, ";
protected final String TEXT_34 = "EPackageConfigurator packageConfigurator, BundleContext ctx){" + NL + "\t\t";
protected final String TEXT_35 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tString[] serviceClasses = new String[] {";
protected final String TEXT_36 = ".class.getName(), ";
protected final String TEXT_37 = ".class.getName()};" + NL + "\t\tpackageRegistration = ctx.registerService(serviceClasses, ePackage, properties);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Registers the ";
protected final String TEXT_38 = " as a service." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void registerEFactoryService(";
protected final String TEXT_39 = ".class.getName()};" + NL + "\t\teFactoryRegistration = ctx.registerService(serviceClasses, ePackage.get";
protected final String TEXT_40 = "(), properties);" + NL + "\t}" + NL + "" + NL + "\tprivate void registerConditionService(";
protected final String TEXT_41 = "EPackageConfigurator packageConfigurator, BundleContext ctx){" + NL + "\t\t// register the EPackage" + NL + "\t\t";
protected final String TEXT_42 = "<String, Object>();" + NL + "\t\tproperties.putAll(packageConfigurator.getServiceProperties());" + NL + "\t\tproperties.put(";
protected final String TEXT_43 = ".CONDITION_ID, ";
protected final String TEXT_44 = ".eNS_URI);" + NL + "\t\tconditionRegistration = ctx.registerService(";
protected final String TEXT_45 = ".class, ";
protected final String TEXT_46 = ".INSTANCE, properties);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Deactivates and unregisters everything." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\t@";
protected final String TEXT_47 = NL + "\tpublic void deactivate() {" + NL + "\t\tconditionRegistration.unregister();" + NL + "\t\teFactoryRegistration.unregister();" + NL + "\t\tpackageRegistration.unregister();" + NL + "\t\tePackageConfiguratorRegistration.unregister();" + NL + "\t\tEPackage.Registry.INSTANCE.remove(";
protected final String TEXT_48 = ".eNS_URI);" + NL + "\t}" + NL + "}";
protected final String TEXT_49 = NL;

public String generate(Object argument)
{
Expand All @@ -95,120 +92,114 @@ public String generate(Object argument)
stringBuffer.append(TEXT_6);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_7);
stringBuffer.append(genModel.getImportedName("org.osgi.service.component.annotations.Reference"));
stringBuffer.append(TEXT_8);
stringBuffer.append(ResourceSetFactory.class.getName());
stringBuffer.append(TEXT_9);
stringBuffer.append(genModel.getImportedName("org.osgi.service.component.annotations.ReferenceCardinality"));
stringBuffer.append(TEXT_10);
stringBuffer.append(genModel.getImportedName("org.osgi.annotation.bundle.Capability"));
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_8);
stringBuffer.append(genPackage.getQualifiedFactoryInterfaceName());
stringBuffer.append(TEXT_12);
stringBuffer.append(TEXT_9);
stringBuffer.append(genPackage.getInterfacePackageName());
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_10);
stringBuffer.append(genModel.getImportedName("org.osgi.annotation.bundle.Capability"));
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_8);
stringBuffer.append(genPackage.getQualifiedPackageInterfaceName());
stringBuffer.append(TEXT_14);
stringBuffer.append(TEXT_11);
stringBuffer.append(genPackage.getInterfacePackageName());
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_10);
stringBuffer.append(genModel.getImportedName("org.osgi.annotation.bundle.Capability"));
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_8);
stringBuffer.append(EPackageConfigurator.class.getName());
stringBuffer.append(TEXT_15);
stringBuffer.append(TEXT_12);
stringBuffer.append(genPackage.getInterfacePackageName());
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_10);
stringBuffer.append(genModel.getImportedName("org.osgi.annotation.bundle.Capability"));
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_8);
stringBuffer.append(Condition.class.getName());
stringBuffer.append(TEXT_16);
stringBuffer.append(TEXT_13);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_14);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(TEXT_15);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(TEXT_16);
stringBuffer.append(genModel.getImportedName("org.gecko.emf.osgi.EPackageConfigurator"));
stringBuffer.append(TEXT_17);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(TEXT_18);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(TEXT_19);
stringBuffer.append(genModel.getImportedName("org.gecko.emf.osgi.EPackageConfigurator"));
stringBuffer.append(genModel.getImportedName("org.osgi.service.component.annotations.Activate"));
stringBuffer.append(TEXT_20);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_21);
stringBuffer.append(genModel.getImportedName("org.osgi.framework.ServiceRegistration"));
stringBuffer.append(genModel.getImportedName(genPackage.getQualifiedPackageClassName()));
stringBuffer.append(TEXT_22);
stringBuffer.append(genModel.getImportedName("org.osgi.service.component.annotations.Activate"));
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_23);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_24);
stringBuffer.append(genModel.getImportedName(genPackage.getQualifiedPackageClassName()));
stringBuffer.append(TEXT_25);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_25);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_26);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_27);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_28);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_29);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_30);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_31);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_32);
stringBuffer.append(TEXT_29);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_33);
stringBuffer.append(TEXT_30);
stringBuffer.append(genModel.getImportedName(EPackageConfigurator.class.getName()));
stringBuffer.append(TEXT_34);
stringBuffer.append(TEXT_31);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_35);
stringBuffer.append(TEXT_32);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_36);
stringBuffer.append(TEXT_33);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_37);
stringBuffer.append(TEXT_34);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_32);
stringBuffer.append(TEXT_29);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_38);
stringBuffer.append(TEXT_35);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_39);
stringBuffer.append(TEXT_36);
stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
stringBuffer.append(TEXT_40);
stringBuffer.append(TEXT_37);
stringBuffer.append(genPackage.getFactoryInterfaceName());
stringBuffer.append(TEXT_41);
stringBuffer.append(TEXT_38);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_36);
stringBuffer.append(TEXT_33);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_37);
stringBuffer.append(TEXT_34);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_32);
stringBuffer.append(TEXT_29);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_38);
stringBuffer.append(TEXT_35);
stringBuffer.append(genPackage.getFactoryInterfaceName());
stringBuffer.append(TEXT_39);
stringBuffer.append(TEXT_36);
stringBuffer.append(genModel.getImportedName(EFactory.class.getName()));
stringBuffer.append(TEXT_42);
stringBuffer.append(TEXT_39);
stringBuffer.append(genPackage.getFactoryName());
stringBuffer.append(TEXT_43);
stringBuffer.append(TEXT_40);
stringBuffer.append(genPackage.getPrefix());
stringBuffer.append(TEXT_44);
stringBuffer.append(TEXT_41);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_32);
stringBuffer.append(TEXT_29);
stringBuffer.append(genModel.getImportedName(Hashtable.class.getName()));
stringBuffer.append(TEXT_45);
stringBuffer.append(TEXT_42);
stringBuffer.append(genModel.getImportedName(Condition.class.getName()));
stringBuffer.append(TEXT_46);
stringBuffer.append(TEXT_43);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_47);
stringBuffer.append(TEXT_44);
stringBuffer.append(genModel.getImportedName(Condition.class.getName()));
stringBuffer.append(TEXT_48);
stringBuffer.append(TEXT_45);
stringBuffer.append(genModel.getImportedName(Condition.class.getName()));
stringBuffer.append(TEXT_49);
stringBuffer.append(TEXT_46);
stringBuffer.append(genModel.getImportedName("org.osgi.service.component.annotations.Deactivate"));
stringBuffer.append(TEXT_50);
stringBuffer.append(TEXT_47);
stringBuffer.append(genPackage.getPackageInterfaceName());
stringBuffer.append(TEXT_51);
stringBuffer.append(TEXT_48);
genModel.emitSortedImports();
stringBuffer.append(TEXT_52);
stringBuffer.append(TEXT_49);
return stringBuffer.toString();
}
}
Loading

0 comments on commit ec7b136

Please sign in to comment.