Skip to content

Commit

Permalink
Merge pull request #26 from MDSD-Tools/improved_osgi
Browse files Browse the repository at this point in the history
Improved OSGi Support
  • Loading branch information
mazkatli authored Sep 1, 2023
2 parents 604d7b7 + 05060d5 commit 57658d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions jamopp.model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
</goals>
<configuration>
<instructions>
<Export-Package>tools.mdsd.*</Export-Package>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId};singleton:=true</Bundle-SymbolicName>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
//import org.apache.logging.log4j.Logger;
//import org.apache.logging.log4j.LogManager;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
Expand All @@ -52,8 +52,8 @@
import tools.mdsd.jamopp.resolution.resolver.CentralReferenceResolver;

public class JaMoPPJDTSingleFileParser implements JaMoPPParserAPI {
private static final Logger logger = LogManager.getLogger("jamopp."
+ JaMoPPJDTSingleFileParser.class.getSimpleName());
// private static final Logger logger = LogManager.getLogger("jamopp."
// + JaMoPPJDTSingleFileParser.class.getSimpleName());
private final String DEFAULT_ENCODING = StandardCharsets.UTF_8.toString();
private ResourceSet resourceSet;
private ArrayList<String> exclusionPatterns = new ArrayList<>();
Expand Down Expand Up @@ -113,19 +113,19 @@ public ResourceSet parseDirectory(Path dir) {
encodings[index] = DEFAULT_ENCODING;
}
String[] classpathEntries = findClasspathEntries(dir);
logger.debug("Parsing the directory " + dir.toString() + " with "
+ sources.length + " source files and " + classpathEntries.length
+ " classpath entries.");
// logger.debug("Parsing the directory " + dir.toString() + " with "
// + sources.length + " source files and " + classpathEntries.length
// + " classpath entries.");
this.parseFilesWithJDT(classpathEntries, sources, encodings);
logger.debug("Resolving the parsed files.");
// logger.debug("Resolving the parsed files.");
resolveBindings();
resolveEverything();
logger.debug("Resolved the parsed files.");
// logger.debug("Resolved the parsed files.");
} catch (IOException e) {
}
ResourceSet result = this.resourceSet;
this.resourceSet = null;
logger.debug("Parsed the directory.");
// logger.debug("Parsed the directory.");
return result;
}

Expand Down Expand Up @@ -254,7 +254,7 @@ public void resolveBindings() {

private void resolveEverything() {
if (ParserOptions.RESOLVE_EVERYTHING.isTrue()) {
logger.debug("Resolving everything.");
// logger.debug("Resolving everything.");
int oldSize;
do {
oldSize = resourceSet.getResources().size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
//import org.apache.logging.log4j.Logger;
//import org.apache.logging.log4j.LogManager;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
Expand Down Expand Up @@ -49,7 +49,7 @@

public class JavaResource2 extends XMIResourceImpl {
public static final String JAVAXMI_FILE_EXTENSION = LogicalJavaURIGenerator.JAVAXMI_FILE_EXTENSION_NAME;
private static final Logger LOGGER = LogManager.getLogger("jamopp." + JavaResource2.class.getSimpleName());
// private static final Logger LOGGER = LogManager.getLogger("jamopp." + JavaResource2.class.getSimpleName());
private Map<String, IJavaContextDependentURIFragment> internalURIFragmentMap =
IJavaContextDependentURIFragmentCollector.GLOBAL_INSTANCE
.getContextDependentURIFragmentMap();
Expand Down Expand Up @@ -77,10 +77,10 @@ public void doLoad(InputStream input, Map<?, ?> options) throws IOException {
physicalURI = JavaClasspath.get(this).getURIMap().get(this.getURI());
}
if (physicalURI == null) {
LOGGER.error(this.getURI() + " has no physical URI.");
// LOGGER.error(this.getURI() + " has no physical URI.");
throw new IllegalStateException("There has to be a physical URI.");
}
LOGGER.debug("Loading " + physicalURI);
// LOGGER.debug("Loading " + physicalURI);
String extension = physicalURI.fileExtension();
if (extension.equals("class")) {
try {
Expand Down

0 comments on commit 57658d2

Please sign in to comment.