summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ri/src/main/resources')
-rw-r--r--cps-ri/src/main/resources/hibernate.properties1
-rw-r--r--cps-ri/src/main/resources/logback-spring.xml48
-rw-r--r--cps-ri/src/main/resources/schema.sql63
3 files changed, 112 insertions, 0 deletions
diff --git a/cps-ri/src/main/resources/hibernate.properties b/cps-ri/src/main/resources/hibernate.properties
new file mode 100644
index 0000000000..a22fe63cfa
--- /dev/null
+++ b/cps-ri/src/main/resources/hibernate.properties
@@ -0,0 +1 @@
+hibernate.types.print.banner=false \ No newline at end of file
diff --git a/cps-ri/src/main/resources/logback-spring.xml b/cps-ri/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000000..8a4ae07c5b
--- /dev/null
+++ b/cps-ri/src/main/resources/logback-spring.xml
@@ -0,0 +1,48 @@
+<configuration scan="true" debug="false">
+ <include resource="org/springframework/boot/logging/logback/base.xml" />
+
+ <property name="queueSize" value="256" />
+ <property name="maxFileSize" value="20MB" />
+ <property name="maxHistory" value="30" />
+ <property name="totalSizeCap" value="20MB" />
+
+ <!-- log file names -->
+ <property name="logName" value="cps" />
+
+ <property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
+
+ <property name="debugPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%thread|%X{RequestID}| %logger{50} - %msg%n" />
+
+ <appender name="Debug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>../log/${logName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Debug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <logger name="org.onap.cps" level="DEBUG" additivity="false">
+ <appender-ref ref="asyncDebug" />
+ </logger>
+
+
+ <root level="INFO">
+ <appender-ref ref="asyncDebug" />
+ </root>
+
+</configuration> \ No newline at end of file
diff --git a/cps-ri/src/main/resources/schema.sql b/cps-ri/src/main/resources/schema.sql
new file mode 100644
index 0000000000..6a76fbd191
--- /dev/null
+++ b/cps-ri/src/main/resources/schema.sql
@@ -0,0 +1,63 @@
+CREATE TABLE IF NOT EXISTS RELATION_TYPE
+(
+ RELATION_TYPE TEXT NOT NULL,
+ ID SERIAL PRIMARY KEY
+);
+
+CREATE TABLE IF NOT EXISTS DATASPACE
+(
+ ID SERIAL PRIMARY KEY,
+ NAME TEXT NOT NULL,
+ CONSTRAINT "UQ_NAME" UNIQUE (NAME)
+);
+
+CREATE TABLE IF NOT EXISTS SCHEMA_NODE
+(
+ SCHEMA_NODE_IDENTIFIER TEXT NOT NULL,
+ ID SERIAL PRIMARY KEY
+);
+
+CREATE TABLE IF NOT EXISTS FRAGMENT
+(
+ ID BIGSERIAL PRIMARY KEY,
+ XPATH TEXT NOT NULL,
+ DATASPACE_ID INTEGER NOT NULL REFERENCES DATASPACE(ID),
+ ATTRIBUTES JSONB,
+ ANCHOR_ID BIGINT REFERENCES FRAGMENT(ID),
+ PARENT_ID BIGINT REFERENCES FRAGMENT(ID),
+ MODULE_SET_ID INTEGER REFERENCES MODULE_SET(ID),
+ SCHEMA_NODE_ID INTEGER REFERENCES SCHEMA_NODE(ID)
+);
+
+CREATE TABLE IF NOT EXISTS RELATION
+(
+ FROM_FRAGMENT_ID BIGINT NOT NULL REFERENCES FRAGMENT(ID),
+ TO_FRAGMENT_ID BIGINT NOT NULL REFERENCES FRAGMENT(ID),
+ RELATION_TYPE_ID INTEGER NOT NULL REFERENCES RELATION_TYPE(ID),
+ FROM_REL_XPATH TEXT NOT NULL,
+ TO_REL_XPATH TEXT NOT NULL,
+ CONSTRAINT RELATION_PKEY PRIMARY KEY (TO_FRAGMENT_ID, FROM_FRAGMENT_ID, RELATION_TYPE_ID)
+);
+
+CREATE TABLE IF NOT EXISTS MODULE
+(
+ NAMESPACE TEXT NOT NULL,
+ REVISION TEXT NOT NULL,
+ MODULE_CONTENT TEXT NOT NULL,
+ DATASPACE_ID BIGINT NOT NULL,
+ ID SERIAL PRIMARY KEY,
+ UNIQUE (NAMESPACE, REVISION),
+ CONSTRAINT module_dataspace FOREIGN KEY (DATASPACE_ID) REFERENCES DATASPACE (id) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_DATASPACE_ID_FK" ON FRAGMENT USING BTREE(DATASPACE_ID) ;
+CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_MODULE_SET_ID_FK" ON FRAGMENT USING BTREE(MODULE_SET_ID) ;
+CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_PARENT_ID_FK" ON FRAGMENT USING BTREE(PARENT_ID) ;
+CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_ANCHOR_ID_FK" ON FRAGMENT USING BTREE(ANCHOR_ID) ;
+CREATE INDEX IF NOT EXISTS "PERF_SCHEMA_NODE_SCHEMA_NODE_ID" ON SCHEMA_NODE USING BTREE(SCHEMA_NODE_IDENTIFIER) ;
+CREATE INDEX IF NOT EXISTS "FKI_SCHEMA_NODE_ID_TO_ID" ON FRAGMENT USING BTREE(SCHEMA_NODE_ID) ;
+CREATE INDEX IF NOT EXISTS "FKI_RELATION_TYPE_ID_FK" ON RELATION USING BTREE(RELATION_TYPE_ID);
+CREATE INDEX IF NOT EXISTS "FKI_RELATIONS_FROM_ID_FK" ON RELATION USING BTREE(FROM_FRAGMENT_ID);
+CREATE INDEX IF NOT EXISTS "FKI_RELATIONS_TO_ID_FK" ON RELATION USING BTREE(TO_FRAGMENT_ID);
+CREATE INDEX IF NOT EXISTS "PERF_MODULE_SET_MODULE_SET_REFERENCE" ON MODULE_SET USING BTREE(MODULE_SET_REFERENCE) ;
+CREATE UNIQUE INDEX IF NOT EXISTS "UQ_FRAGMENT_XPATH"ON FRAGMENT USING btree(xpath COLLATE pg_catalog."default" text_pattern_ops, dataspace_id); \ No newline at end of file