2018-02-15 18:13:50 +01:00
package org.gcube.data.access.fs ;
import java.io.BufferedInputStream ;
import java.io.File ;
2018-07-05 12:31:52 +02:00
import java.io.FileInputStream ;
2018-02-15 18:13:50 +01:00
import java.io.FileOutputStream ;
2021-04-29 16:58:14 +02:00
import java.io.InputStream ;
2018-07-05 12:31:52 +02:00
import java.net.URI ;
2018-02-15 18:13:50 +01:00
import java.nio.file.Files ;
2018-06-29 15:03:05 +02:00
import java.util.Arrays ;
2018-10-15 15:39:02 +02:00
import java.util.HashMap ;
2018-06-29 15:03:05 +02:00
import java.util.HashSet ;
2018-03-14 16:21:13 +01:00
import java.util.List ;
2021-04-29 16:58:14 +02:00
import java.util.Properties ;
2018-09-13 18:10:36 +02:00
import java.util.regex.Matcher ;
import java.util.regex.Pattern ;
2018-02-15 18:13:50 +01:00
2018-07-05 15:37:29 +02:00
import javax.ws.rs.client.Client ;
import javax.ws.rs.client.ClientBuilder ;
import javax.ws.rs.client.Entity ;
import javax.ws.rs.client.WebTarget ;
import javax.ws.rs.core.MediaType ;
2021-10-28 15:49:12 +02:00
import javax.ws.rs.core.Response ;
2018-07-05 15:37:29 +02:00
2018-02-15 18:13:50 +01:00
import org.gcube.common.authorization.library.provider.SecurityTokenProvider ;
import org.gcube.common.scope.api.ScopeProvider ;
import org.gcube.common.storagehub.client.StreamDescriptor ;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin ;
2019-10-14 10:18:54 +02:00
import org.gcube.common.storagehub.client.proxies.GroupManagerClient ;
2018-02-15 18:13:50 +01:00
import org.gcube.common.storagehub.client.proxies.ItemManagerClient ;
2021-04-29 16:58:14 +02:00
import org.gcube.common.storagehub.client.proxies.MessageManagerClient ;
2018-02-15 18:13:50 +01:00
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient ;
2018-10-15 15:39:02 +02:00
import org.gcube.common.storagehub.model.Metadata ;
2018-05-07 18:05:54 +02:00
import org.gcube.common.storagehub.model.Paths ;
2018-05-25 18:05:44 +02:00
import org.gcube.common.storagehub.model.acls.ACL ;
2018-06-29 15:03:05 +02:00
import org.gcube.common.storagehub.model.acls.AccessType ;
2019-10-14 10:18:54 +02:00
import org.gcube.common.storagehub.model.exceptions.StorageHubException ;
2018-04-20 18:26:44 +02:00
import org.gcube.common.storagehub.model.expressions.GenericSearchableItem ;
2018-05-14 16:14:52 +02:00
import org.gcube.common.storagehub.model.expressions.OrderField ;
2018-04-20 18:26:44 +02:00
import org.gcube.common.storagehub.model.expressions.SearchableItem ;
2018-05-07 18:05:54 +02:00
import org.gcube.common.storagehub.model.expressions.logical.ISDescendant ;
2018-05-14 16:14:52 +02:00
import org.gcube.common.storagehub.model.items.AbstractFileItem ;
2018-10-26 11:04:32 +02:00
import org.gcube.common.storagehub.model.items.GCubeItem ;
2018-03-14 16:21:13 +01:00
import org.gcube.common.storagehub.model.items.Item ;
2018-04-20 18:26:44 +02:00
import org.gcube.common.storagehub.model.query.Queries ;
import org.gcube.common.storagehub.model.query.Query ;
2018-07-05 15:37:29 +02:00
import org.glassfish.jersey.client.ClientProperties ;
2018-02-15 18:13:50 +01:00
import org.junit.BeforeClass ;
import org.junit.Test ;
2019-03-13 18:33:58 +01:00
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
2018-02-15 18:13:50 +01:00
public class TestCall {
2019-03-13 18:33:58 +01:00
private static Logger log = LoggerFactory . getLogger ( TestCall . class ) ;
2022-02-07 10:24:33 +01:00
private static final String propFile = " /home/lucio/tokens.properties " ;
2021-04-29 16:58:14 +02:00
private static final String tokens = " dev-root " ;
2018-02-15 18:13:50 +01:00
@BeforeClass
public static void setUp ( ) {
2021-04-29 16:58:14 +02:00
try ( InputStream is = new FileInputStream ( new File ( propFile ) ) ) {
Properties prop = new Properties ( ) ;
prop . load ( is ) ;
String value = ( String ) prop . get ( tokens ) ;
String [ ] splitValue = value . split ( " , " ) ;
String context = splitValue [ 0 ] ;
String token = splitValue [ 1 ] ;
SecurityTokenProvider . instance . set ( token ) ;
ScopeProvider . instance . set ( context ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
2018-02-15 18:13:50 +01:00
}
2021-04-29 16:58:14 +02:00
2021-10-28 15:49:12 +02:00
2019-10-14 10:18:54 +02:00
@Test
2021-10-15 19:53:14 +02:00
public void sendMessagesWithAttachment ( ) throws Exception {
2021-04-29 16:58:14 +02:00
MessageManagerClient client = AbstractPlugin . messages ( ) . build ( ) ;
2021-10-15 19:53:14 +02:00
client . sendMessage ( Arrays . asList ( " massimiliano.assante " ) , " subject encodato ? è " , " è econdato ?? " , Arrays . asList ( " 4827dd33-6eea-4bba-b78b-b98e2fd2ddfa " ) ) ;
2019-10-14 10:18:54 +02:00
}
2021-10-28 15:49:12 +02:00
2021-10-15 19:53:14 +02:00
@Test
public void setUnread ( ) throws Exception {
MessageManagerClient client = AbstractPlugin . messages ( ) . build ( ) ;
client . setRead ( " f3b7ce40-28df-40b3-ad17-f0b9bd658016 " , false ) ;
}
2021-10-28 15:49:12 +02:00
2019-10-14 10:18:54 +02:00
public void addUserToGroup ( ) throws StorageHubException {
GroupManagerClient client = AbstractPlugin . groups ( ) . build ( ) ;
client . addUserToGroup ( " andrea.rossi " , " gcube-devsec-devVRE " ) ;
}
2021-04-29 16:58:14 +02:00
2019-05-07 11:41:57 +02:00
public void createNotAuthorized ( ) throws Exception {
2018-03-14 16:21:13 +01:00
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
2019-05-07 11:41:57 +02:00
itemclient . createFolder ( " 3bc977be-37f0-4518-888f-a7cb96c9be8e " , " cannot create " , " " , false ) ;
2018-02-15 18:13:50 +01:00
}
2018-03-07 18:42:10 +01:00
2019-03-13 18:33:58 +01:00
2018-09-13 18:10:36 +02:00
public void createFolderAndShare ( ) throws Exception {
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
2019-03-13 18:33:58 +01:00
2019-03-29 10:40:09 +01:00
itemclient . createFolder ( " fakeId " , " test " , " test " , false ) ;
2021-04-29 16:58:14 +02:00
2019-03-29 10:40:09 +01:00
/ * WorkspaceManagerClient client = AbstractPlugin . workspace ( ) . build ( ) ;
2018-09-13 18:10:36 +02:00
Item ws = client . getWorkspace ( ) ;
2018-09-24 15:21:20 +02:00
String id = itemclient . createFolder ( ws . getId ( ) , " ok7SharingTest " , " shared folder for test SHM " ) ;
2019-03-13 18:33:58 +01:00
2018-09-18 14:54:11 +02:00
String sharedId = itemclient . shareFolder ( id , new HashSet < String > ( Arrays . asList ( " giancarlo.panichi " ) ) , AccessType . WRITE_OWNER ) ;
2018-09-13 18:10:36 +02:00
itemclient . uploadFile ( new FileInputStream ( " /home/lucio/Downloads/upload.pdf " ) , sharedId , " sharedFile.pdf " , " shared file in a shared folder " ) ;
2021-04-29 16:58:14 +02:00
* /
2018-09-13 18:10:36 +02:00
}
2019-03-13 18:33:58 +01:00
public void shareAnAlreadySharedFolder ( ) throws Exception {
2018-09-13 18:10:36 +02:00
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
2018-09-18 14:54:11 +02:00
itemclient . shareFolder ( " 86e8472a-6f66-4608-9d70-20102c9172ce " , new HashSet < > ( Arrays . asList ( " costantino.perciante " ) ) , AccessType . READ_ONLY ) ;
2018-09-13 18:10:36 +02:00
}
2019-03-13 18:33:58 +01:00
2020-04-10 13:50:37 +02:00
public void restore ( ) throws Exception {
2018-09-20 14:52:23 +02:00
WorkspaceManagerClient client = AbstractPlugin . workspace ( ) . build ( ) ;
2020-04-15 10:30:46 +02:00
System . out . println ( client . restoreFromTrash ( " 4fc0a9df-9a51-42ef-98f2-06c21bd0669b " , " f3d336cc-cd00-48ba-8339-2bffcbef825e " ) ) ;
2018-09-20 14:52:23 +02:00
}
2021-10-28 15:49:12 +02:00
2019-03-13 18:33:58 +01:00
2018-09-13 18:10:36 +02:00
public void unshareFolder ( ) throws Exception {
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
2018-09-18 14:54:11 +02:00
itemclient . unshareFolder ( " 86e8472a-6f66-4608-9d70-20102c9172ce " , new HashSet < > ( Arrays . asList ( " giancarlo.panichi " ) ) ) ;
2019-03-13 18:33:58 +01:00
2018-09-13 18:10:36 +02:00
}
2019-03-13 18:33:58 +01:00
2018-06-25 16:50:43 +02:00
public void delete ( ) throws Exception {
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
2018-09-18 14:54:11 +02:00
itemclient . delete ( " 7af3d5cb-5e74-4a80-be81-acb2fec74cd9 " ) ;
2019-03-13 18:33:58 +01:00
2018-06-25 16:50:43 +02:00
}
2019-03-13 18:33:58 +01:00
2018-02-15 18:13:50 +01:00
public void getById ( ) throws Exception {
2018-03-07 18:42:10 +01:00
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
2018-05-23 18:26:06 +02:00
List < ? extends Item > items = client . getAnchestors ( " 29b417e2-dc2f-419a-be0b-7f49e76c9d7c " , " hl:accounting " , " jcr:content " ) ;
2018-05-30 18:15:56 +02:00
2018-03-14 16:21:13 +01:00
System . out . println ( " items are " + items . size ( ) ) ;
2018-05-30 18:15:56 +02:00
2018-05-23 18:26:06 +02:00
for ( Item item : items )
System . out . println ( item . getName ( ) + " " + item . getPath ( ) ) ;
2018-05-30 18:15:56 +02:00
2018-03-07 18:42:10 +01:00
System . in . read ( ) ;
2018-02-15 18:13:50 +01:00
}
2018-05-30 18:15:56 +02:00
2019-03-13 18:33:58 +01:00
public void setMetadata ( ) throws Exception {
2018-10-15 15:39:02 +02:00
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
Metadata meta = new Metadata ( ) ;
HashMap < String , Object > prop = new HashMap < > ( ) ;
prop . put ( " folderProp " , " test2 " ) ;
prop . put ( " folderProp2 " , " test2 " ) ;
2018-12-03 11:10:55 +01:00
meta . setMap ( prop ) ;
2018-10-15 15:39:02 +02:00
client . setMetadata ( " 8822478a-4fd3-41d5-87de-9ff161d0935e " , meta ) ;
2018-10-26 11:04:32 +02:00
}
2019-03-13 18:33:58 +01:00
public void createGcubeItem ( ) throws Exception {
2018-10-26 11:04:32 +02:00
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
GCubeItem item = new GCubeItem ( ) ;
item . setName ( " itemTest " ) ;
item . setDescription ( " test descr " ) ;
item . setScopes ( new String [ ] { " /gcube " , " /gcube/devsec " } ) ;
item . setItemType ( " myType " ) ;
item . setCreator ( " me " ) ;
2019-03-13 18:33:58 +01:00
2018-10-26 11:04:32 +02:00
WorkspaceManagerClient wsc = AbstractPlugin . workspace ( ) . build ( ) ;
Item ws = wsc . getWorkspace ( ) ;
2019-03-13 18:33:58 +01:00
2018-10-26 11:04:32 +02:00
client . createGcubeItem ( ws . getId ( ) , item ) ;
2018-10-15 15:39:02 +02:00
}
2019-03-13 18:33:58 +01:00
2021-10-28 15:49:12 +02:00
2021-10-15 19:53:14 +02:00
@Test
2018-07-05 12:31:52 +02:00
public void upload ( ) throws Exception {
2022-02-07 10:24:33 +01:00
System . setProperty ( " sun.net.http.allowRestrictedHeaders " , " true " ) ;
long start = System . currentTimeMillis ( ) ;
2021-10-15 19:53:14 +02:00
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
2022-02-07 10:24:33 +01:00
File file = new File ( " /home/lucio/Downloads/cali4gif.gif " ) ;
System . out . println ( " file length is " + file . length ( ) ) ;
client . uploadFile ( new FileInputStream ( file ) , " e532a011-081a-4bbd-879a-f90394c40af1 " , " cali4gif.gif " , " description " , file . length ( ) ) ;
2019-03-13 18:33:58 +01:00
2022-02-07 10:24:33 +01:00
System . out . println ( " took " + ( System . currentTimeMillis ( ) - start ) ) ;
2019-03-13 18:33:58 +01:00
2018-07-05 12:31:52 +02:00
}
2019-03-13 18:33:58 +01:00
2022-02-07 10:24:33 +01:00
@Test
2018-07-30 12:38:34 +02:00
public void uploadArchive ( ) throws Exception {
2022-02-07 10:24:33 +01:00
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
2019-03-13 18:33:58 +01:00
2022-02-07 10:24:33 +01:00
client . uploadArchive ( new FileInputStream ( " /home/lucio/Downloads/Presentazioni utili.zip " ) , " bc1c9525-43f7-4565-b5ea-0a0f9d7853a0 " , " filezillaTar1 " ) ;
2019-03-13 18:33:58 +01:00
2018-07-30 12:38:34 +02:00
}
2019-03-13 18:33:58 +01:00
2018-05-25 18:05:44 +02:00
public void getACL ( ) throws Exception {
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
try {
2018-05-30 18:15:56 +02:00
List < ACL > acls = client . getACL ( " 790e4c52-fbca-48e9-b267-67ea2ce708c0 " ) ;
System . out . println ( " items are " + acls . size ( ) ) ;
for ( ACL acl : acls )
System . out . println ( acl . getPricipal ( ) + " " + acl . getAccessTypes ( ) ) ;
2018-05-25 18:05:44 +02:00
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
}
2018-03-07 18:42:10 +01:00
2018-02-15 18:13:50 +01:00
public void download ( ) throws Exception {
ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
2018-09-26 15:24:21 +02:00
StreamDescriptor streamDescr = client . download ( " 6875651d-6510-4b82-a0f3-cc3356c1a143 " ) ;
2018-02-15 18:13:50 +01:00
File output = Files . createTempFile ( " down " , streamDescr . getFileName ( ) ) . toFile ( ) ;
try ( BufferedInputStream bi = new BufferedInputStream ( streamDescr . getStream ( ) ) ; FileOutputStream fo = new FileOutputStream ( output ) ) {
byte [ ] buf = new byte [ 2048 ] ;
int read = - 1 ;
while ( ( read = bi . read ( buf ) ) ! = - 1 ) {
fo . write ( buf , 0 , read ) ;
}
}
2018-03-07 18:42:10 +01:00
2018-02-15 18:13:50 +01:00
System . out . println ( " file written " + output . getAbsolutePath ( ) ) ;
}
2018-03-07 18:42:10 +01:00
2018-03-14 16:21:13 +01:00
public void getCount ( ) throws Exception {
final ItemManagerClient client = AbstractPlugin . item ( ) . build ( ) ;
long start = System . currentTimeMillis ( ) ;
2018-09-27 17:31:36 +02:00
System . out . println ( " found " + client . childrenCount ( " bc1c9525-43f7-4565-b5ea-0a0f9d7853a0 " ) + " children " ) ;
2018-05-30 18:15:56 +02:00
2018-03-14 16:21:13 +01:00
System . out . println ( " count took: " + ( System . currentTimeMillis ( ) - start ) ) ;
2018-05-30 18:15:56 +02:00
2018-03-14 16:21:13 +01:00
System . in . read ( ) ;
}
2018-05-30 18:15:56 +02:00
2018-04-18 15:55:20 +02:00
public void getVreFolder ( ) {
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
WorkspaceManagerClient wsclient = AbstractPlugin . workspace ( ) . build ( ) ;
2019-01-03 12:16:53 +01:00
List < ? extends Item > folders = wsclient . getVreFolders ( " hl:accounting " ) ;
for ( Item item : folders ) {
System . out . println ( item . getTitle ( ) ) ;
}
2019-03-13 18:33:58 +01:00
2018-04-18 15:55:20 +02:00
}
2019-03-13 18:33:58 +01:00
2021-10-15 19:53:14 +02:00
@Test
2018-06-15 17:33:13 +02:00
public void getRecents ( ) {
2021-10-28 15:49:12 +02:00
2018-06-15 17:33:13 +02:00
WorkspaceManagerClient wsclient = AbstractPlugin . workspace ( ) . build ( ) ;
List < ? extends Item > items = wsclient . getRecentModifiedFilePerVre ( ) ;
2019-03-13 18:33:58 +01:00
2018-06-15 17:33:13 +02:00
System . out . println ( " items are " + items . size ( ) ) ;
for ( Item item : items )
2021-10-15 19:53:14 +02:00
System . out . println ( item . getName ( ) + " " + item . getLastModificationTime ( ) . getTimeInMillis ( ) ) ;
2018-06-15 17:33:13 +02:00
}
2018-05-30 18:15:56 +02:00
2019-03-13 18:33:58 +01:00
public void createFolder ( ) throws Exception {
2018-05-25 18:05:44 +02:00
long start = System . currentTimeMillis ( ) ;
2018-05-23 18:26:06 +02:00
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
WorkspaceManagerClient wsclient = AbstractPlugin . workspace ( ) . build ( ) ;
2018-05-25 18:05:44 +02:00
String id = wsclient . getWorkspace ( " hl:accounting " , " jcr:content " ) . getId ( ) ;
System . out . println ( " getting the WS id took " + ( System . currentTimeMillis ( ) - start ) ) ;
2019-03-13 18:33:58 +01:00
2018-06-11 16:58:02 +02:00
itemclient . createFolder ( id , " sesto tentativo " , " 6 tentativo " ) ;
2018-05-25 18:05:44 +02:00
System . out . println ( " creating folder took total " + ( System . currentTimeMillis ( ) - start ) ) ;
2018-05-23 18:26:06 +02:00
}
2019-03-13 18:33:58 +01:00
public void share ( ) throws Exception {
2018-06-29 15:03:05 +02:00
ItemManagerClient itemclient = AbstractPlugin . item ( ) . build ( ) ;
itemclient . shareFolder ( " 4fd4a4ca-c615-4076-8eaa-70268e4f6166 " , new HashSet < > ( Arrays . asList ( " francesco.mangiacrapa " , " massimiliano.assante " , " giancarlo.panichi " ) ) , AccessType . WRITE_OWNER ) ;
2019-03-13 18:33:58 +01:00
2018-06-29 15:03:05 +02:00
}
2019-03-13 18:33:58 +01:00
2018-04-20 18:26:44 +02:00
@Test
public void search ( ) {
2018-05-30 18:15:56 +02:00
2018-05-14 16:14:52 +02:00
Query < SearchableItem < ? > > query = Queries . queryFor ( AbstractFileItem . class ) ;
/ *
2018-05-07 18:05:54 +02:00
Calendar calendar = Calendar . getInstance ( ) ;
calendar . set ( Calendar . YEAR , 2015 ) ;
2018-05-30 18:15:56 +02:00
* /
2018-04-20 18:26:44 +02:00
WorkspaceManagerClient wsclient = AbstractPlugin . workspace ( ) . build ( ) ;
2018-06-11 16:58:02 +02:00
//String path = wsclient.getVreFolder("hl:accounting").getPath();
//System.out.println("path is "+path);
2019-07-25 17:47:18 +02:00
query . setExpression ( new ISDescendant ( Paths . getPath ( " /Home/lucio.lelii/Workspace/ " ) ) ) ;
2018-05-14 16:14:52 +02:00
query . setLimit ( 10 ) ;
2018-06-26 10:51:34 +02:00
query . setOrder ( new OrderField ( GenericSearchableItem . get ( ) . title ) ) ;
2018-04-20 18:26:44 +02:00
List < ? extends Item > items = wsclient . search ( query , " hl:accounting " , " jcr:content " ) ;
2018-05-14 16:14:52 +02:00
for ( Item item : items ) {
2018-12-11 17:58:49 +01:00
System . out . println ( item . getName ( ) + " " + item . getPath ( ) + " " + item . getLastModificationTime ( ) . getTimeInMillis ( ) ) ;
2018-05-14 16:14:52 +02:00
}
2018-04-20 18:26:44 +02:00
System . out . println ( " items are " + items . size ( ) ) ;
2018-05-30 18:15:56 +02:00
2018-04-20 18:26:44 +02:00
}
2019-03-13 18:33:58 +01:00
2018-03-07 18:42:10 +01:00
/ *
2018-02-15 18:13:50 +01:00
@Test
public void createFolder ( ) throws Exception {
Items . createFolder ( ) ;
}
2018-03-07 18:42:10 +01:00
2018-02-15 18:13:50 +01:00
@Test
public void createFile ( ) throws Exception {
Items . create ( ) ;
} * /
2018-03-07 18:42:10 +01:00
2018-09-13 18:10:36 +02:00
@Test
public void isValidName ( ) {
String name = " Chart focused on Quantities - Overall mean and standard deviation of the quantity_GENERIC_CHARTS_ID_bdba343e-0e33-4fae-8cca-4e4140610a76.png " ;
Pattern p = Pattern . compile ( " [^a-z0-9 \\ s_ \\ - \\ .] " , Pattern . CASE_INSENSITIVE ) ;
Matcher m = p . matcher ( name ) ;
boolean b = m . find ( ) ;
System . out . println ( " result: " + ! b ) ;
}
2021-04-29 16:58:14 +02:00
2019-03-13 18:33:58 +01:00
/ * private InputStream getThumbnailAsPng ( ImagePlus img , int thumbWidth ,
2018-10-26 11:04:32 +02:00
int thumbHeight ) throws IOException {
InputStream stream = null ;
ImageProcessor processor = img . getProcessor ( ) ;
try {
Image thumb = processor . resize ( thumbWidth , thumbHeight ) . createImage ( ) ;
thumb = thumb . getScaledInstance ( thumbWidth , thumbHeight , Image . SCALE_SMOOTH ) ;
FileSaver fs = new FileSaver ( new ImagePlus ( " " , thumb ) ) ;
File tmpThumbFile = File . createTempFile ( " THUMB " , " TMP " ) ;
tmpThumbFile . deleteOnExit ( ) ;
fs . saveAsPng ( tmpThumbFile . getAbsolutePath ( ) ) ;
stream = new FileInputStream ( tmpThumbFile ) ;
} catch ( Exception e ) {
throw new RuntimeException ( e ) ;
}
return stream ;
}
2019-03-13 18:33:58 +01:00
2018-10-26 11:04:32 +02:00
public static ImagePlus getImgePlus ( String pathOrURL ) throws IOException {
//necessary to run without WINDOWS X11
System . setProperty ( " java.awt.headless " , " true " ) ;
ImagePlus img = null ;
try {
img = new ImagePlus ( pathOrURL ) ;
} catch ( Exception e ) {
throw new RuntimeException ( e ) ;
}
return img ;
} * /
2018-03-07 18:42:10 +01:00
2018-02-15 18:13:50 +01:00
}