Skip to content

Commit

Permalink
Merge branch 'release/1.44.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-gallagher committed Oct 30, 2024
2 parents 21fd211 + 194c70c commit 49abd16
Show file tree
Hide file tree
Showing 29 changed files with 207 additions and 21 deletions.
2 changes: 1 addition & 1 deletion domino-jnx-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
</parent>
<artifactId>domino-jnx-api</artifactId>
<name>HCL Domino API</name>
Expand Down
18 changes: 18 additions & 0 deletions domino-jnx-api/src/main/java/com/hcl/domino/admin/ServerAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,22 @@ void registerCrossCertificate(String certFilePath, String certPW, String certLog
*/
String sendConsoleCommand(String server, String command);


/**
* Retrieves the current addin's default status line.
*
* @return a {@link ServerStatusLine} for the current addin's default
* @since 1.44.0
*/
ServerStatusLine getDefaultServerStatusLine();

/**
* Sets the provided status line as the default for the current addin.
*
* @param statusLine a {@link ServerStatusLine} to make the default,
* must be non-null
* @since 1.44.0
*/
void setDefaultServerStatusLine(ServerStatusLine statusLine);

}
27 changes: 27 additions & 0 deletions domino-jnx-api/src/main/java/com/hcl/domino/constants/Nif.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* ==========================================================================
* Copyright (C) 2019-2024 HCL America, Inc. ( http://www.hcl.com/ )
* All rights reserved.
* ==========================================================================
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. You may obtain a
* copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* ==========================================================================
*/
package com.hcl.domino.constants;

/**
* Represents constants originally from the {@code editods.h} header file.
*
* @author Jesse Gallagher
* @since 1.44.0
*/
public interface Nif {
int PERCENTILE_COUNT = 11;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;

import com.hcl.domino.data.structures.CollectionData;
import com.hcl.domino.misc.DominoClientDescendant;
import com.hcl.domino.misc.Loop;

Expand Down Expand Up @@ -95,6 +95,17 @@ public enum Direction {
* @return sorted set of note ids
*/
Set<Integer> getAllIdsByKey(Set<Find> findFlags, Object key);

/**
* Retrieve detailed information about the collection itself, such
* as the number of documents in the collection and the total size
* of the document entries in the collection.
*
* @return a {@link CollectionData} instance representing information
* about the collection
* @since 1.44.0
*/
CollectionData getCollectionData();

List<CollectionColumn> getColumns();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* ==========================================================================
* Copyright (C) 2019-2024 HCL America, Inc. ( http://www.hcl.com/ )
* All rights reserved.
* ==========================================================================
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. You may obtain a
* copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* ==========================================================================
*/
package com.hcl.domino.data.structures;

import com.hcl.domino.misc.NotesConstants;
import com.hcl.domino.richtext.annotation.StructureDefinition;
import com.hcl.domino.richtext.annotation.StructureGetter;
import com.hcl.domino.richtext.annotation.StructureMember;
import com.hcl.domino.richtext.structures.MemoryStructure;

/**
* Represents aggregate data about a view or folder.
*
* @since 1.44.0
*/
@StructureDefinition(
name = "COLLECTIONDATA",
members = {
@StructureMember(name = "DocCount", type = int.class, unsigned = true),
@StructureMember(name = "DocTotalSize", type = int.class, unsigned = true),
@StructureMember(name = "BTreeLeafNodes", type = int.class, unsigned = true),
@StructureMember(name = "BTreeDepth", type = short.class, unsigned = true),
@StructureMember(name = "Spare", type = short.class),
@StructureMember(name = "KeyOffset", type = int[].class, unsigned = true, length = NotesConstants.PERCENTILE_COUNT)
}
)
public interface CollectionData extends MemoryStructure {
@StructureGetter("DocCount")
long getDocCount();

@StructureGetter("DocTotalSize")
long getDocTotalSize();

@StructureGetter("BTreeLeafNodes")
long getLeafNodeCount();

@StructureGetter("BTreeDepth")
int getDepth();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

import com.hcl.domino.constants.Bsafe;
import com.hcl.domino.constants.EditOds;
import com.hcl.domino.constants.Nif;
import com.hcl.domino.constants.OleOds;
import com.hcl.domino.constants.QueryOds;
import com.hcl.domino.constants.Stats;
import com.hcl.domino.constants.StdNames;
import com.hcl.domino.constants.VmOds;

public interface NotesConstants extends ViewFormatConstants, StdNames, QueryOds, EditOds, OleOds, VmOds, Bsafe, Stats {
public interface NotesConstants extends ViewFormatConstants, StdNames, QueryOds, EditOds, OleOds, VmOds, Bsafe, Stats, Nif {

public enum AgentCheck {
CheckRights(0),
Expand Down
2 changes: 1 addition & 1 deletion domino-jnx-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
</parent>
<artifactId>domino-jnx-commons</artifactId>
<name>HCL Domino API Common Code</name>
Expand Down
2 changes: 1 addition & 1 deletion domino-jnx-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
</parent>
<artifactId>domino-jnx-console</artifactId>
<name>HCL Domino API Server Controller Connector</name>
Expand Down
2 changes: 1 addition & 1 deletion domino-jnx-jna/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
</parent>
<artifactId>domino-jnx-jna</artifactId>
<name>HCL Domino API, JNA Implementation</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

import com.hcl.domino.DominoClient;
Expand Down Expand Up @@ -83,6 +84,7 @@
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.ptr.ShortByReference;

Expand Down Expand Up @@ -490,6 +492,29 @@ public ServerStatusLine createServerStatusLine(String taskName) {
long hDesc = NotesCAPI.get().AddInCreateStatusLine(NotesStringUtils.toLMBCS(taskName, true));
return new JNAServerStatusLine(getParentDominoClient(), hDesc);
}

@Override
public ServerStatusLine getDefaultServerStatusLine() {
LongByReference rethModule = new LongByReference();
LongByReference rethDesc = new LongByReference();
NotesCAPI.get().AddInQueryDefaults(rethModule, rethDesc);
return new JNAServerStatusLine(getParentDominoClient(), rethDesc.getValue());
}

@Override
public void setDefaultServerStatusLine(ServerStatusLine statusLine) {
Objects.requireNonNull(statusLine, "statusLine cannot be null");
if(!(statusLine instanceof JNAServerStatusLine)) {
throw new IllegalArgumentException(MessageFormat.format("Unable to handle ServerStatusLine of type {0}", statusLine.getClass().getName()));
}
JNAServerStatusLine jnaLine = (JNAServerStatusLine)statusLine;

LongByReference rethModule = new LongByReference();
LongByReference rethDesc = new LongByReference();
NotesCAPI.get().AddInQueryDefaults(rethModule, rethDesc);
rethDesc.setValue(jnaLine.getAdapter(long.class));
NotesCAPI.get().AddInSetDefaults(rethModule.getValue(), rethDesc.getValue());
}

@Override
public void openServerConsole(String serverName, ConsoleHandler handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.hcl.domino.jna.data;

import java.lang.ref.ReferenceQueue;
import java.nio.ByteBuffer;
import java.text.Collator;
import java.text.MessageFormat;
import java.util.ArrayList;
Expand Down Expand Up @@ -46,6 +47,7 @@
import com.hcl.domino.commons.gc.APIObjectAllocations;
import com.hcl.domino.commons.gc.IAPIObject;
import com.hcl.domino.commons.gc.IGCDominoClient;
import com.hcl.domino.commons.structures.MemoryStructureUtil;
import com.hcl.domino.commons.util.NotesErrorUtils;
import com.hcl.domino.commons.util.PlatformUtils;
import com.hcl.domino.commons.util.StringTokenizerExt;
Expand All @@ -59,6 +61,7 @@
import com.hcl.domino.data.CollectionSearchQuery.CollectionEntryProcessor;
import com.hcl.domino.data.Database;
import com.hcl.domino.data.Database.Action;
import com.hcl.domino.data.structures.CollectionData;
import com.hcl.domino.data.Document;
import com.hcl.domino.data.DominoCollection;
import com.hcl.domino.data.DominoDateTime;
Expand All @@ -71,6 +74,7 @@
import com.hcl.domino.jna.JNADominoClient;
import com.hcl.domino.jna.data.CollectionDataCache.CacheState;
import com.hcl.domino.jna.data.JNACollectionEntry.CacheableViewEntryData;
import com.hcl.domino.jna.internal.Mem;
import com.hcl.domino.jna.internal.callbacks.NotesCallbacks;
import com.hcl.domino.jna.internal.callbacks.Win32NotesCallbacks;
import com.hcl.domino.jna.internal.capi.NotesCAPI;
Expand Down Expand Up @@ -1734,6 +1738,33 @@ private short getCollation() {
return retCollationNum.getValue();
}

@Override
public CollectionData getCollectionData() {
checkDisposed();

final DHANDLE.ByReference rethCollData = DHANDLE.newInstanceByReference();

LockUtil.lockHandle(getAllocations().getCollectionHandle(), hCollectionByVal ->
NotesCAPI.get().NIFGetCollectionData(hCollectionByVal, rethCollData)
);

return LockUtil.lockHandle(rethCollData, hCollData -> {
CollectionData result = Mem.OSLockObject(hCollData, ptr -> {
int len = MemoryStructureUtil.sizeOf(CollectionData.class);
byte[] data = new byte[len];
ptr.read(0, data, 0, len);

ByteBuffer buf = ByteBuffer.wrap(data);

return MemoryStructureUtil.forStructure(CollectionData.class, () -> buf);
});

Mem.OSMemFree(hCollData);

return result;
});
}

@Override
public LinkedHashSet<Integer> getAllIds(boolean withDocuments, boolean withCategories) {
if (!withDocuments && !withCategories) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@ short NIFOpenCollectionWithUserNameList (HANDLE.ByValue hViewDB, HANDLE.ByValue

short NIFGetCollation(DHANDLE.ByValue hCollection, ShortByReference retCollationNum);
short NIFSetCollation(DHANDLE.ByValue hCollection, short CollationNum);
/**
* Retrieve detailed information about the collection itself, such as the number of documents
* in the collection and the total size of the document entries in the collection.
*
* @since Notes/Domino 4.0
* @since 1.44.0
*/
short NIFGetCollectionData(DHANDLE.ByValue hCollection, DHANDLE.ByReference rethCollData);
short NIFUpdateCollection(DHANDLE.ByValue hCollection);

@UndocumentedAPI
Expand Down Expand Up @@ -2205,6 +2213,8 @@ default boolean AddInMinutesHaveElapsed(int Minutes) {
boolean AddInShouldTerminate();
long AddInCreateStatusLine(Memory TaskName);
void AddInDeleteStatusLine(long hDesc);
void AddInQueryDefaults(LongByReference rethModule, LongByReference rethDesc);
void AddInSetDefaults(long hNewModule, long hDesc);
void AddInSetStatusLine(long hDesc, Memory string);
void OSPreemptOccasionally();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,14 @@ public void setLine(String line) {
Memory string = NotesStringUtils.toLMBCS(line, true);
NotesCAPI.get().AddInSetStatusLine(hDesc, string);
}

@SuppressWarnings("unchecked")
@Override
protected <T> T getAdapterLocal(Class<T> clazz) {
if(long.class.equals(clazz) || Long.class.equals(clazz)) {
return (T)Long.valueOf(getAllocations().getLineHandle());
}
return super.getAdapterLocal(clazz);
}

}
2 changes: 1 addition & 1 deletion example/jnx-example-domino-servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-domino-servlet</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-domino-webapp-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-domino-webapp-admin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-gluon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-gluon</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-graalvm-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-graalvm-native</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-runjava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-runjava</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-swt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-swt</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/jnx-example-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.hcl.domino</groupId>
<artifactId>domino-jnx</artifactId>
<version>1.43.0</version>
<version>1.44.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>jnx-example-webapp</artifactId>
Expand Down
Loading

0 comments on commit 49abd16

Please sign in to comment.