New post

Find

Article
· Nov 10, 2024 2m read

Java External Language Gateway

If you like Java and have a thriving Java ecosystem at work into which you need to incorporate IRIS, it's not a problem. Java External Language Gateway will do it seamlessly, almost. This gateway serves as a bridge between Java and Object Script in IRIS. You can create objects of Java classes in IRIS and call their methods. You just need a jar file to do this.

Connection diagram: proxy object <-> Gateway object <-> TCP/IP <-> External server <-> target object

The first thing you need to do is set up the environment. To start using the Java Gateway, ensure you have the following:

  1. InterSystems IRIS: Installed and running.
  2. Java Development Kit (JDK): Installed and configured.

The second requirement may sound simple, since you're already using Java in your work, but it isn't. Thanks to this question, it turned out that you need to use JDK version 11 at the most. Which means that you need to change the version in your IDE which may case quite a bit of trouble.

Next step, we can check that everything works and try to instantiate the object of a Java system class. To do this, you have to start a connection, creat a proxy object, and call a method. Sounds like a lot of code, but in reality it's just one statement:

write $system.external.getJavaGateway().new("java.util.Date").toString()

This will print the current date and time on screen.

To go further, we can create our own Java class:


public class Dish {
	private String name;
	private String description;
	private String category;
	private Float price;
	private String currency;
	private Integer calories;
	
	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setCalories(Integer calories) {
		this.calories = calories;
	}
	
	public String describe() {
		return "The dish "+this.name+" costs "+this.price.toString()+
				this.currency+" and contains "+this.calories+" calories!";
	}
}

and call it's methods from Object Script:

 set javaGate = $SYSTEM.external.getJavaGateway()
 do javaGate.addToPath("D:\Temp\GatewayTest.jar")
 set dish = javaGate.new("Dish")
 do dish.setCalories(1000)
 do dish.setCategory("salad")
 do dish.setCurrency("GBP")
 do dish.setDescription("Very tasty greek salad")
 do dish.setName("Greek salad")
 do dish.setPrice(15.2)
 write dish.describe()

As a result we will get a string with the description of the created dish:

The dish Greek salad costs 15.2GBP and contains 1000 calories!

Quite neat, don't you think?

Anyway, learn more about using Gateways from the Documentation and good luck implementing this knowledge in your projects!

Discussion (0)1
Log in or sign up to continue
Article
· Nov 10, 2024 1m read

Levereging InterSystems IRIS database to quickly find possible resistence genes in DNA

Speeding Up Antibiotic Resistance Detection with InterSystems IRIS

Antibiotic resistance is a critical health challenge, requiring rapid detection to inform effective treatments. We worked on developing a solution that leverages InterSystems IRIS vector database technology that would quickly identify resistance genes in DNA.

How It Works

Using vector embeddings, DNA sequences are transformed into numerical representations that capture essential genetic information. InterSystems IRIS then enables high-speed searching and matching of these vectors, identifying possible resistance genes.

The Benefits

This approach should in practice reduce diagnostic time, helping healthcare providers quickly detect resistant infections and choose appropriate treatments. As resistance genes evolve, the system can be updated, ensuring long-term effectiveness in combating antibiotic resistance.

Our work highlights how innovative database and machine learning tools can tackle real-world health challenges. 😁

4 Comments
Discussion (4)1
Log in or sign up to continue
Announcement
· Nov 10, 2024

Key Questions of the Month: October 2024

Hey Community,

It's time for the new batch of #KeyQuestions from the previous month.

Key Questions: How Do I Stand Up to My Inexplicably Cruel HOA? | Apartment  Therapy

Here are the Key Questions of October chosen by InterSystems Experts within all Communities:

📌 What is the entity for Event Source in User Audit Event? by @Dmitrij Vladimirov (EN)

📌 Using the other unit testing frameworks with IPM? by @Jani Hurskainen (EN)

📌 Execute a routine with argument by name - Without using Xecute! by @omer (EN)

These questions will be highlighted with the #Key Question tag, and their authors will get the Key Question badge on Global Masters.

If you find the key question(s) from other communities interesting, just drop us a line in the comments and we will translate the question(s) and the accepted answer(s).

Congrats, and thank you all for your interesting questions. Keep them coming!

See you next month😉

Discussion (0)1
Log in or sign up to continue
Article
· Nov 10, 2024 1m read

Como obter programaticamente uma lista de namesaces configurados

Rubrica InterSystems FAQ 

Isso pode ser obtido com uma query de lista da classe %SYS.Namespace

1. Crie uma rotina assim:

getnsp
   set statement=##class(%SQL.Statement).%New()
   set status=statement.%PrepareClassQuery("%SYS.Namespace","List")
   set resultset=statement.%Execute()
   while resultset.%Next() {
       write resultset.%Get("Nsp"),!
   }
   quit

2. Rode no seu terminal

USER>do ^getnsp
%SYS
DOCBOOK
SAMPLES
USER

O método de executar queries de classe introduzido nesse artigo pode ser aplicado em uma variedade de classes

Você pode ver várias queries de classe na referência de classe. Por exemplo,
 %SYS.DatabaseQuery: GetFreeSpace() Espaço livre na base de dados
 %SYS.GlobalQuery: DirectoryList          Lista de nomes de globais na base de dados
 %SYS.GlobalQuery: Size                           Lista de tamanhos de globais na base de dados
 %SYS.ProcessQuery: SS                        Informações de processos (o mesmo que a lista pode ser confirmado com a utilidade ^%SS)
e assim por diante.

Há muitas outras opções disponíveis, então fique à vontade para usá-las.

Discussion (0)1
Log in or sign up to continue
Article
· Nov 10, 2024 3m read

IKO & IAM - remember to include a sidecar

IAM - InterSystems API Manager is a great tool for monitoring your traffic. If you are trying to use it in your Kubernetes cluster you may have tried doing a deployment similar to this one:

apiVersion: intersystems.com/v1alpha1
kind: IrisCluster
metadata:
  name: iris
spec:
  licenseKeySecret:
    name: iris-key-secret
  configSource:
    name: iris-cpf
  imagePullSecrets:
    - name: intersystems-pull-secret
  topology:
    data:
      image: containers.intersystems.com/intersystems/iris-arm64:2024.1
      compatibilityVersion: "2024.1.2"
      mirrored: false

    webgateway:
      replicas: 1
      image: containers.intersystems.com/intersystems/webgateway-nginx-arm64:2024.1
      type: nginx
      applicationPaths:
        - /csp/sys
        - /csp/broker
        - /api
        - /isc
        - /oauth2
        - /ui
        - /csp/healthshare
      alternativeServers: LoadBalancing
      loginSecret:
        name: iris-webgateway-secret

    iam: 
      image: containers.intersystems.com/intersystems/iam-arm64:3.4
      replicas: 1
  serviceTemplate:
    spec:
      type: LoadBalancer

However, upon going to the IAM Dashboard you'll see:

 

You're in free mode. The IRIS License did not get passed on to Kong. In order to do that you need to make sure you have a sidecar in place. You can add a sidecar:

apiVersion: intersystems.com/v1alpha1
kind: IrisCluster
metadata:
  name: iris
spec:
  licenseKeySecret:
    name: iris-key-secret
  configSource:
    name: iris-cpf
  imagePullSecrets:
    - name: intersystems-pull-secret
  topology:
    data:
      image: containers.intersystems.com/intersystems/iris-arm64:2024.1
      compatibilityVersion: "2024.1.2"
      mirrored: false

      webgateway:
        image: containers.intersystems.com/intersystems/webgateway-nginx-arm64:2024.1
        type: nginx
        applicationPaths:
          - /csp/sys
          - /csp/broker
          - /api
          - /isc
          - /oauth2
          - /ui
          - /csp/healthshare
        loginSecret:
          name: iris-webgateway-secret

    webgateway:
      replicas: 1
      image: containers.intersystems.com/intersystems/webgateway-nginx-arm64:2024.1
      type: nginx
      applicationPaths:
        - /csp/sys
        - /csp/broker
        - /api
        - /isc
        - /oauth2
        - /ui
        - /csp/healthshare
      alternativeServers: LoadBalancing
      loginSecret:
        name: iris-webgateway-secret
        
    iam: 
      image: containers.intersystems.com/intersystems/iam-arm64:3.4
      replicas: 1
  serviceTemplate:
    spec:
      type: LoadBalancer

or you can even decide that your stand-alone Web Gateway is not necessary, and that all work can be carried out by the sidecar:

apiVersion: intersystems.com/v1alpha1
kind: IrisCluster
metadata:
  name: iris
spec:
  licenseKeySecret:
    name: iris-key-secret
  configSource:
    name: iris-cpf
  imagePullSecrets:
    - name: intersystems-pull-secret
  topology:
    data:
      image: containers.intersystems.com/intersystems/iris-arm64:2024.1
      compatibilityVersion: "2024.1.2"
      mirrored: false

      webgateway:
        image: containers.intersystems.com/intersystems/webgateway-nginx-arm64:2024.1
        type: nginx
        applicationPaths:
          - /csp/sys
          - /csp/broker
          - /api
          - /isc
          - /oauth2
          - /ui
          - /csp/healthshare
        loginSecret:
          name: iris-webgateway-secret
        
    iam: 
      image: containers.intersystems.com/intersystems/iam-arm64:3.4
      replicas: 1
  serviceTemplate:
    spec:
      type: LoadBalancer

The result in terms of IAM is the same, though note that there are advantages and disadvantages to each approach. Whichever approach you choose, you should now see a working license in IAM:

1 Comment
Discussion (1)2
Log in or sign up to continue