-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor plugins to allow reducing dependencies to ddk.xtext and ddk.xtext.builder #998
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 83 additions & 83 deletions
166
...xt/builder/DerivedObjectAssociations.java → ...t/resource/DerivedObjectAssociations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Avaloq Group AG 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: | ||
* Avaloq Group AG - initial API and implementation | ||
*******************************************************************************/ | ||
package com.avaloq.tools.ddk.xtext.builder; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import com.google.common.collect.Maps; | ||
import com.google.common.collect.Sets; | ||
/** | ||
* Derived objects associated with resource description. | ||
* <p> | ||
* Instances of this class are attached to resource descriptions or resource description delta. | ||
* </p> | ||
* <p> | ||
* Main purpose of the associations is to manage life cycle of the derived resources. | ||
* Associations enable generators to identify what derived objects (sources) should be dropped. | ||
* </p> | ||
* <p> | ||
* There can be many producers of derived objects, where generators executed by builder participants | ||
* are the most common kind. Objects produced by generators may be other sources, but could also be some | ||
* entities specific to the business application of a DSL (i.e. database objects). Derived objects | ||
* could also be valid Xtext resources visible to the builder. Therefore the framework in not trying | ||
* to interpret the information about the derived objects, but stores it grouped by the producer (generator id). | ||
* </p> | ||
* <p> | ||
* For simplicity we will refer to all producers of derived objects as to generators. | ||
* </p> | ||
*/ | ||
public class DerivedObjectAssociations { | ||
private final Map<String, Set<String>> derivedObjects = Maps.newHashMap(); | ||
/** | ||
* Adds the association for a derived object created the given generator. | ||
* | ||
* @param generatorType | ||
* an identifier of the generator that created the object, must not be {@code null} | ||
* @param derivedObjectUri | ||
* the URI of the derived object (freely defined by the generator), must not be {@code null} | ||
*/ | ||
public void add(final String generatorType, final String derivedObjectUri) { | ||
derivedObjects.computeIfAbsent(generatorType, s -> Sets.newHashSet()).add(derivedObjectUri); | ||
} | ||
/** | ||
* Returns identifiers of all generators that created derived objects for the given resource. | ||
* | ||
* @return identifiers of generators that created derived objects, never {@code null} | ||
*/ | ||
public Set<String> getGeneratorTypes() { | ||
return derivedObjects.keySet(); | ||
} | ||
/** | ||
* Returns set of derived object URIs for the given generator. | ||
* | ||
* @param generatorType | ||
* the identifier of the generator, must not be {@code null} | ||
* @return set of URIs of derived objects, never {@code null} | ||
*/ | ||
public Set<String> getDerivedObjects(final String generatorType) { | ||
return derivedObjects.getOrDefault(generatorType, Collections.emptySet()); | ||
} | ||
@Override | ||
public String toString() { | ||
return derivedObjects.toString(); | ||
} | ||
} | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Avaloq Group AG 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: | ||
* Avaloq Group AG - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package com.avaloq.tools.ddk.xtext.resource; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.google.common.collect.Maps; | ||
import com.google.common.collect.Sets; | ||
|
||
|
||
/** | ||
* Derived objects associated with resource description. | ||
* <p> | ||
* Instances of this class are attached to resource descriptions or resource description delta. | ||
* </p> | ||
* <p> | ||
* Main purpose of the associations is to manage life cycle of the derived resources. | ||
* Associations enable generators to identify what derived objects (sources) should be dropped. | ||
* </p> | ||
* <p> | ||
* There can be many producers of derived objects, where generators executed by builder participants | ||
* are the most common kind. Objects produced by generators may be other sources, but could also be some | ||
* entities specific to the business application of a DSL (i.e. database objects). Derived objects | ||
* could also be valid Xtext resources visible to the builder. Therefore the framework in not trying | ||
* to interpret the information about the derived objects, but stores it grouped by the producer (generator id). | ||
* </p> | ||
* <p> | ||
* For simplicity we will refer to all producers of derived objects as to generators. | ||
* </p> | ||
*/ | ||
public class DerivedObjectAssociations { | ||
|
||
private final Map<String, Set<String>> derivedObjects = Maps.newHashMap(); | ||
|
||
/** | ||
* Adds the association for a derived object created the given generator. | ||
* | ||
* @param generatorType | ||
* an identifier of the generator that created the object, must not be {@code null} | ||
* @param derivedObjectUri | ||
* the URI of the derived object (freely defined by the generator), must not be {@code null} | ||
*/ | ||
public void add(final String generatorType, final String derivedObjectUri) { | ||
derivedObjects.computeIfAbsent(generatorType, s -> Sets.newHashSet()).add(derivedObjectUri); | ||
} | ||
|
||
/** | ||
* Returns identifiers of all generators that created derived objects for the given resource. | ||
* | ||
* @return identifiers of generators that created derived objects, never {@code null} | ||
*/ | ||
public Set<String> getGeneratorTypes() { | ||
return derivedObjects.keySet(); | ||
} | ||
|
||
/** | ||
* Returns set of derived object URIs for the given generator. | ||
* | ||
* @param generatorType | ||
* the identifier of the generator, must not be {@code null} | ||
* @return set of URIs of derived objects, never {@code null} | ||
*/ | ||
public Set<String> getDerivedObjects(final String generatorType) { | ||
return derivedObjects.getOrDefault(generatorType, Collections.emptySet()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return derivedObjects.toString(); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewL-avlq , all this files look fine in my workspace. Do you know if the old ones have the wrong format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They look fine in my workspace too, so not sure what formatting has changed (although I would guess the line endings).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think it is just recording the files that have moved as full diffs.