Skip to content

Commit

Permalink
create a public dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagovent committed Jun 3, 2022
1 parent 5a173dc commit 20de5f4
Show file tree
Hide file tree
Showing 29 changed files with 1,301 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.DS_Store
.classpath
.project
.settings/
target/
test-output/
*.class
*.iml
*.log
.idea/
.gitattributes
.metadata/
.metadata
bin/
*/MANIFEST.MF
*.launch
.recommenders/
*.jshintrc
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,39 @@
Exemplo de como criar um componente que permite acesso público a um determinado dataset sem expor o usuário e senha do fluig.

Criado com base no sample-component (https://git.fluig.com/projects/SAMPLES/repos/projetos/browse/sample-component)

* **public-dataset-pack**: projeto responsável por empacotar todo o public-dataset em um arquivo do tipo .ear.

O package do projeto deve ser do tipo **.EAR** (Enterprise Application Archive).
Para essa configuração, no arquivo public-dataset/public-dataset-pack/pom.xml a tag <packing> deve estar assim: **<packaging>ear</packaging>**.
---


* **public-dataset-config**: projeto onde estão os arquivos de configuração do componente:

Para que o componente seja instalado corretamente, é necessário o arquivo **component.xml**.
Esse arquivo se encontra em public-dataset-config/src/main/resources/component.xml.
É obrigatório que o **component code** seja único: **component code="public_dataset_app"**.
---


* **public-dataset-rest**: projeto responsável em disponibilizar as API Rest para os Services das tabelas do app


Para testar o Rest SEM autenticação, acesse o endpoint:

- FLUIG_URL/publicdataset/api/v1/{tenantId}/aws/{instanceCode}
---


Para empacotar o projeto e gerar o arquivo **EAR**, será necessário utilizar o Maven. Entre com o seguinte comando na raiz do projeto:

- mvn clean install
- Você pode também utilzar o Eclipse for Java EE Developers para executar o comando mvn install.

Ao gerar o pacote, o próximo passo é fazer o upload através da Central de Componentes. Após enviar o .EAR, será necessário ativar o componente. Procure pelo código, que está no component.xml, faça a ativação, atualize a página(F5) e acesse as páginas criadas. (Essa etapa é necessária apenas no desenvolvimento do app).


Para acessar o rest é necessário criar um OAuth Provider e um OAuth App bem como um usuário integrador no cadastro do OAuth.

Também é necessário criar o dataset aws-instances que receba a constraint INSTANCE_CODE
112 changes: 112 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.fluig</groupId>
<artifactId>public-dataset</artifactId>
<version>1.0.3</version>
<packaging>pom</packaging>

<name>Public Dataset</name>
<description>Public Dataset description</description>

<repositories>
<repository>
<id>nexus</id>
<name>fluig Nexus Repository</name>
<url>http://nexus.fluig.com/content/groups/public</url>
</repository>
</repositories>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<fluig.version>1.7.1</fluig.version>
</properties>

<modules>
<module>public-dataset-config</module>
<module>public-dataset-rest</module>
<module>public-dataset-pack</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>fluig-api-tools</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-core</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<warSourceExcludes>**/.js,**/.css</warSourceExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>com.fluig.common</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
<force>true</force>
<linebreakpos>-1</linebreakpos>
<disableOptimizations>false</disableOptimizations>
<gzip>false</gzip>
<jswarn>false</jswarn>
<nomunge>true</nomunge>
<preserveAllSemiColons>false</preserveAllSemiColons>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>

</project>
33 changes: 33 additions & 0 deletions public-dataset-config/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fluig</groupId>
<artifactId>public-dataset</artifactId>
<version>1.0.3</version>
</parent>
<artifactId>public-dataset-config</artifactId>
<packaging>war</packaging>

<name>Public Dataset - config</name>
<description>This is a sample config</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Para o Fluig 1.6.5, deve ser alterado para versão 1.8 -->
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
13 changes: 13 additions & 0 deletions public-dataset-config/src/main/resources/component.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<component code="public_dataset_app">
<title>Public Dataset</title>
<description>Public Dataset</description>
<version>1.0.0</version>
<category>Store</category>
<icon>icon.png</icon>
<developerCode>Thiago</developerCode>
<developerName>Thiago</developerName>
<developerURL>https://www.linkedin.com/in/thiagoventurelli/</developerURL>
<activationClass>activator/publicdataset</activationClass>
</component>
7 changes: 7 additions & 0 deletions public-dataset-config/src/main/resources/pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<pages>
<page>
</page>

</pages>
5 changes: 5 additions & 0 deletions public-dataset-config/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
22 changes: 22 additions & 0 deletions public-dataset-config/src/main/webapp/WEB-INF/jboss-web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/publicdatasetconfig</context-root>
<disable-cross-context>false</disable-cross-context>
<security-domain>TOTVSTech</security-domain>
<security-role>
<role-name>user</role-name>
<principal-name>totvstech</principal-name>
</security-role>
<security-role>
<role-name>totvstech</role-name>
<principal-name>totvstech</principal-name>
</security-role>
<security-role>
<role-name>sysadmin</role-name>
<principal-name>wcmadmin</principal-name>
</security-role>
<security-role>
<role-name>admin</role-name>
<principal-name>wcmadmin</principal-name>
</security-role>
</jboss-web>
7 changes: 7 additions & 0 deletions public-dataset-config/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
</web-app>
120 changes: 120 additions & 0 deletions public-dataset-pack/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fluig</groupId>
<artifactId>public-dataset</artifactId>
<version>1.0.3</version>
</parent>
<artifactId>public-dataset-pack</artifactId>
<packaging>ear</packaging>

<name>Public Dataset - pack</name>
<description>Modulo para empacotar o projeto Public Dataset</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>foundation-common</artifactId>
<version>${fluig.version}</version>
</dependency>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>foundation-cache-module</artifactId>
<version>${fluig.version}</version>
</dependency>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>public-dataset-config</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>public-dataset-rest</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</dependency>
<dependency>
<groupId>com.fluig</groupId>
<artifactId>fluig-api-tools</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/application/META-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
<finalName>public-dataset</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<version>6</version>
<applicationName>Public_Dataset</applicationName>
<generateModuleId>false</generateModuleId>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<initializeInOrder>true</initializeInOrder>
<fileNameMapping>no-version</fileNameMapping>
<security>
<security-role>
<role-name>sysadmin</role-name>
</security-role>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
</security>
<modules>
<webModule>
<groupId>com.fluig</groupId>
<artifactId>public-dataset-rest</artifactId>
<contextRoot>/publicdataset</contextRoot>
</webModule>
<webModule>
<groupId>com.fluig</groupId>
<artifactId>public-dataset-config</artifactId>
<contextRoot>/publicdatasetconfig</contextRoot>
</webModule>
</modules>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Dependencies>com.fluig.common</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${java.src.dir}</sourceDirectory>
</build>
</project>
Loading

0 comments on commit 20de5f4

Please sign in to comment.