blob: 4de4964ae82abe578fde5f5c0168fa9e27e987b9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*******************************************************************************
* Copyright (c) 2013 Boeing.
* 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:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.orcs.account.admin.internal;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.jdbc.JdbcClientConfig;
import org.eclipse.osee.jdbc.JdbcSchemaResource;
/**
* @author Roberto E. Escobar
*/
public class AccountSessionSchemaResource implements JdbcSchemaResource {
private static final String SCHEMA_PATH = "schema/ACCOUNT.DS.SCHEMA.xml";
@Override
public InputStream getContent() throws OseeCoreException {
InputStream inputStream = null;
try {
URL url = getResourceURL();
inputStream = new BufferedInputStream(url.openStream());
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
return inputStream;
}
@Override
public boolean isApplicable(JdbcClientConfig config) {
return true;
}
@Override
public URI getLocation() throws OseeCoreException {
try {
return getResourceURL().toURI();
} catch (URISyntaxException ex) {
throw new OseeCoreException(ex, "Error finding [%s] schema resource", SCHEMA_PATH);
}
}
private URL getResourceURL() {
return getClass().getResource(SCHEMA_PATH);
}
}
|