-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
363 additions
and
75 deletions.
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
40 changes: 40 additions & 0 deletions
40
java/dev/enola/thing/gen/ThingsIntoAppendableConverter.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2024 The Enola <https://enola.dev> Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package dev.enola.thing.gen; | ||
|
||
import dev.enola.common.convert.ConversionException; | ||
import dev.enola.common.convert.ConverterIntoAppendable; | ||
import dev.enola.common.io.metadata.Metadata; | ||
import dev.enola.common.io.resource.WritableResource; | ||
import dev.enola.thing.Thing; | ||
|
||
import java.io.IOException; | ||
|
||
public interface ThingsIntoAppendableConverter extends ConverterIntoAppendable<Iterable<Thing>> { | ||
|
||
default void convertIntoOrThrow(Iterable<Thing> things, WritableResource into) | ||
throws ConversionException, IOException { | ||
try (var out = into.charSink().openBufferedStream()) { | ||
convertIntoOrThrow(things, out); | ||
} | ||
} | ||
|
||
default String label(Metadata metadata) { | ||
return metadata.emoji() + metadata.label(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2024 The Enola <https://enola.dev> Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package dev.enola.thing.gen.gexf; | ||
|
||
import dev.enola.common.io.mediatype.MediaTypes; | ||
import dev.enola.common.io.resource.ReadableResource; | ||
import dev.enola.common.io.resource.WritableResource; | ||
import dev.enola.common.io.resource.convert.CatchingResourceConverter; | ||
import dev.enola.thing.io.Loader; | ||
import dev.enola.thing.io.UriIntoThingConverters; | ||
|
||
public class GexfResourceConverter implements CatchingResourceConverter { | ||
|
||
private final GexfGenerator gexfGenerator; | ||
|
||
public GexfResourceConverter(GexfGenerator gexfGenerator) { | ||
this.gexfGenerator = gexfGenerator; | ||
} | ||
|
||
@Override | ||
public boolean convertIntoThrows(ReadableResource from, WritableResource into) | ||
throws Exception { | ||
if (!MediaTypes.normalizedNoParamsEquals(into.mediaType(), GexfMediaType.GEXF)) | ||
return false; | ||
|
||
var things = new Loader(new UriIntoThingConverters()).loadAtLeastOneThing(from.uri()); | ||
gexfGenerator.convertIntoOrThrow(things, into); | ||
return true; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- | ||
SPDX-License-Identifier: Apache-2.0 | ||
Copyright 2024 The Enola <https://enola.dev> Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# GEXF Java API | ||
|
||
The classes in this directory are a Java API for the | ||
[Graph Exchange XML Format](https://gexf.net) (GEXF). | ||
|
||
These were generated using `xjc` from JAXB RI Tools like this: | ||
|
||
xjc ??? | ||
|
||
## How to get `xjc` | ||
|
||
git clone https://github.com/eclipse-ee4j/jaxb-ri.git && cd jaxb-ri/jaxb-ri | ||
git checkout 4.0.5-RI | ||
mvn package | ||
|
||
??? | ||
|
||
## ToDo | ||
|
||
1. Add link to this on https://github.com/francesco-ficarola/gexf4j/tree/master (which is for GEXF 1.2 whereas we want 1.3) |
Oops, something went wrong.