esoe
1 year ago
13 changed files with 113 additions and 9 deletions
@ -0,0 +1,50 @@ |
|||||||
|
package ru.molokoin.storage.services; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import jakarta.ejb.Singleton; |
||||||
|
import jakarta.persistence.EntityManager; |
||||||
|
import jakarta.persistence.PersistenceContext; |
||||||
|
import jakarta.ws.rs.core.Response; |
||||||
|
import ru.molokoin.storage.entities.ContentEntity; |
||||||
|
|
||||||
|
@Singleton |
||||||
|
public class Storage implements StorageFace{ |
||||||
|
@PersistenceContext (unitName="Storage") |
||||||
|
private EntityManager em; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<ContentEntity> getInfo() { |
||||||
|
List<ContentEntity> list = new ArrayList<>(); |
||||||
|
System.out.println("getInfo()"); |
||||||
|
//Обращаемся к базе и запрашиваем сведения
|
||||||
|
|
||||||
|
|
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void save(String filename, byte[] content) { |
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'save'"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void delete(Long id) { |
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'delete'"); |
||||||
|
} |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
new Storage().getInfo(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Response findContentById(Integer id) { |
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'findContentById'"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemalocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> |
||||||
|
<persistence-unit name="Storage" transaction-type="JTA"> |
||||||
|
<description>Подключение к базе molokoin.ru:3306/home</description> |
||||||
|
<jta-data-source>java:/home</jta-data-source> |
||||||
|
<class>ru.molokoin.storage.entities.ContentEntity</class> |
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes> |
||||||
|
</persistence-unit> |
||||||
|
</persistence> |
@ -0,0 +1,5 @@ |
|||||||
|
create table home.Storage ( |
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT, |
||||||
|
filename varchar(50) not null, |
||||||
|
location varchar(1000) not null |
||||||
|
); |
@ -0,0 +1,9 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemalocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> |
||||||
|
<persistence-unit name="Storage" transaction-type="JTA"> |
||||||
|
<description>Подключение к базе molokoin.ru:3306/home</description> |
||||||
|
<jta-data-source>java:/home</jta-data-source> |
||||||
|
<class>ru.molokoin.storage.entities.ContentEntity</class> |
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes> |
||||||
|
</persistence-unit> |
||||||
|
</persistence> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue