mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-02-01 07:43:18 +00:00
POM now packages SystemSchema.json and SystemSchema class now loads the packaged SystemSchema.json
This commit is contained in:
51
java/pom.xml
51
java/pom.xml
@@ -10,7 +10,7 @@ Licensed under the MIT License.
|
|||||||
|
|
||||||
<groupId>com.azure.data</groupId>
|
<groupId>com.azure.data</groupId>
|
||||||
<artifactId>azure-cosmos-serialization</artifactId>
|
<artifactId>azure-cosmos-serialization</artifactId>
|
||||||
<version>2.9.5-SNAPSHOT</version>
|
<version>2.9.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Microsoft Azure Cosmos Serialization API</name>
|
<name>Microsoft Azure Cosmos Serialization API</name>
|
||||||
@@ -250,29 +250,6 @@ Licensed under the MIT License.
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>copy-resources</id>
|
|
||||||
<phase>validate</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>copy-resources</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>${project.basedir}/../schemas</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
@@ -286,24 +263,16 @@ Licensed under the MIT License.
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!--plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
|
||||||
<version>1.8</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase/>
|
|
||||||
<id>default-cli</id>
|
|
||||||
<configuration>
|
|
||||||
<target/>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<directory>${project.basedir}/../schemas</directory>
|
||||||
|
<includes>
|
||||||
|
<include>SystemSchema.json</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -45,12 +45,14 @@ public final class SystemSchema {
|
|||||||
try (final InputStream stream = getResourceAsStream("SystemSchema.json")) {
|
try (final InputStream stream = getResourceAsStream("SystemSchema.json")) {
|
||||||
namespace = Namespace.parse(stream);
|
namespace = Namespace.parse(stream);
|
||||||
} catch (IOException cause) {
|
} catch (IOException cause) {
|
||||||
String message = lenientFormat("failed to initialize %s due to %s", cause);
|
String message = lenientFormat("failed to initialize %s due to %s", SystemSchema.class, cause);
|
||||||
throw new IllegalStateException(message, cause);
|
throw new IllegalStateException(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LayoutResolverNamespace(namespace.orElseThrow(() -> {
|
return new LayoutResolverNamespace(namespace.orElseThrow(() -> {
|
||||||
String message = lenientFormat("failed to initialize %s due to system schema parse error");
|
String message = lenientFormat(
|
||||||
|
"failed to initialize %s due to system schema parse error",
|
||||||
|
SystemSchema.class);
|
||||||
return new IllegalStateException(message);
|
return new IllegalStateException(message);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -73,11 +75,11 @@ public final class SystemSchema {
|
|||||||
|
|
||||||
while (urls.hasMoreElements()) {
|
while (urls.hasMoreElements()) {
|
||||||
final URL url = urls.nextElement();
|
final URL url = urls.nextElement();
|
||||||
if (url.toString().startsWith(location)) {
|
if (url.getFile().endsWith(name)) {
|
||||||
return url.openStream();
|
return url.openStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FileNotFoundException(lenientFormat("cannot find resource at code source location %s", location));
|
throw new FileNotFoundException(lenientFormat("cannot find %s at %s", name, location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user