Skip to content

Commit

Permalink
#61 prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed May 24, 2021
1 parent 49def21 commit 185db67
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@
* @author conwaymc
*
*/
public abstract class PluginApiRequest {
public abstract class PluggableApiRequest {

// api number
// <AtomicMetadataOperation, AtomicMetadataResponse>
// AtomicMetadataResponse resp = execApi()

/**
*
*/
public PluginApiRequest() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
* @author conwaymc
*
*/
public abstract class PluginApiResponse {

/**
*
*/
public PluginApiResponse() {
}
public abstract class PluggableApiResponse {

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ public class BytesBuff extends AbstractIRODSPackingInstruction {

private final String buffer;

public static final BytesBuff instance(final String buffer) throws JargonException {
return new BytesBuff(buffer);
public static final BytesBuff instance(final String buffer, final int apiNumber) throws JargonException {
return new BytesBuff(buffer, apiNumber);
}

private BytesBuff(final String buffer) throws JargonException {
private BytesBuff(final String buffer, final int apiNumber) throws JargonException {
super();
if (buffer == null) {
throw new JargonException("buffer is null");
}
this.buffer = buffer;
this.setApiNumber(apiNumber);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
*/
package org.irods.jargon.core.pub;

import org.irods.jargon.core.apiplugin.PluggableApiRequest;
import org.irods.jargon.core.apiplugin.PluggableApiResponse;
import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.connection.IRODSSession;
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.packinstr.BytesBuff;
import org.irods.jargon.core.packinstr.Tag;
import org.irods.jargon.core.pub.domain.ObjStat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -16,7 +21,7 @@
* @author conwaymc
*
*/
class ApiPluginExecutorImpl<InputType, OutputType> extends IRODSGenericAO {
class ApiPluginExecutorImpl<I extends PluggableApiRequest, O extends PluggableApiResponse> extends IRODSGenericAO {

private static Logger log = LoggerFactory.getLogger(ApiPluginExecutorImpl.class);
private ObjectMapper mapper = new ObjectMapper();
Expand All @@ -30,22 +35,31 @@ public ApiPluginExecutorImpl(IRODSSession irodsSession, IRODSAccount irodsAccoun
super(irodsSession, irodsAccount);
}

public OutputType callPluggableApi(int apiNumber, InputType input) throws JargonException {
public O callPluggableApi(int apiNumber, I request) throws JargonException {
log.info("callPluggableApi())");

if (apiNumber <= 0) {
throw new IllegalArgumentException("invalid api number");
}
if (input == null) {

if (request == null) {
throw new IllegalArgumentException("null input");
}

log.info("apiNumber:{}", apiNumber);
log.info("input:{}", input);
log.info("input:{}", request);

try {
String jsonInput = mapper.writeValueAsString(input);
String jsonInput = mapper.writeValueAsString(request);
log.debug("jsonInput:{}", jsonInput);
return (OutputType) new Object(); // FIXME: temp shim
BytesBuff bytesBuff = BytesBuff.instance(jsonInput, apiNumber);
Tag response;
ObjStat objStat;
response = this.getIRODSAccessObjectFactory().getIrodsSession().currentConnection(this.getIRODSAccount())
.irodsFunction(bytesBuff);

log.debug("response from objStat: {}", response.parseTag());
return null;

} catch (JsonProcessingException e) {
log.error("Invalid json", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
*
*/
package org.irods.jargon.core.pub.apiplugin.domain;
package org.irods.jargon.core.pub.apiplugin.atomicmetadata;

import com.fasterxml.jackson.annotation.JsonGetter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/**
*
*/
package org.irods.jargon.core.pub.apiplugin.domain;
package org.irods.jargon.core.pub.apiplugin.atomicmetadata;

import java.util.ArrayList;
import java.util.List;

import org.irods.jargon.core.apiplugin.PluggableApiRequest;

import com.fasterxml.jackson.annotation.JsonGetter;

/**
Expand All @@ -14,7 +16,7 @@
* @author conwaymc
*
*/
public class AtomicMetadataInput {
public class AtomicMetadataRequest extends PluggableApiRequest {

/**
* Name of the entity (e.g. path) to be decorated as {@code String}
Expand All @@ -27,14 +29,14 @@ public class AtomicMetadataInput {

/**
* Individual metadata operations as
* {@link AtomicMetadataInput.AtomicMetadataOperation}
* {@link AtomicMetadataRequest.AtomicMetadataOperation}
*/
private List<AtomicMetadataOperation> operations = new ArrayList<>();

/**
*
*/
public AtomicMetadataInput() {
public AtomicMetadataRequest() {
}

@JsonGetter("entity_name")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.irods.jargon.core.pub.apiplugin.atomicmetadata;

import org.irods.jargon.core.apiplugin.PluggableApiResponse;

public class AtomicMetadataResponse extends PluggableApiResponse {

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* @author conwaymc
*
*/
package org.irods.jargon.core.pub.apiplugin.domain;
package org.irods.jargon.core.pub.apiplugin.atomicmetadata;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.Properties;

import org.irods.jargon.core.pub.IRODSFileSystem;
import org.irods.jargon.core.pub.apiplugin.atomicmetadata.AtomicMetadataOperation;
import org.irods.jargon.core.pub.apiplugin.atomicmetadata.AtomicMetadataRequest;
import org.irods.jargon.testutils.AssertionHelper;
import org.irods.jargon.testutils.IRODSTestSetupUtilities;
import org.irods.jargon.testutils.TestingPropertiesHelper;
Expand Down Expand Up @@ -53,7 +55,7 @@ public void afterEach() throws Exception {
public void testCreateJsonRequest() throws Exception {
String entityName = "entityName";
String entityType = "collection";
AtomicMetadataInput atomicMetadataInput = new AtomicMetadataInput();
AtomicMetadataRequest atomicMetadataInput = new AtomicMetadataRequest();
atomicMetadataInput.setEntityName(entityName);
atomicMetadataInput.setEntityType(entityType);

Expand All @@ -67,7 +69,7 @@ public void testCreateJsonRequest() throws Exception {
String actual = mapper.writeValueAsString(atomicMetadataInput);
Assert.assertNotNull("null atomicMetadataInput", atomicMetadataInput);

AtomicMetadataInput remapped = mapper.readValue(actual, AtomicMetadataInput.class);
AtomicMetadataRequest remapped = mapper.readValue(actual, AtomicMetadataRequest.class);
Assert.assertNotNull("did not get remapped object back", remapped);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.irods.jargon.core.unittest;

import org.irods.jargon.core.pub.ApiPluginExecutorImplTest;
import org.irods.jargon.core.pub.BulkFileOperationsAOImplTest;
import org.irods.jargon.core.pub.CollectionAOImplForSoftLinkTest;
import org.irods.jargon.core.pub.CollectionAOImplTest;
Expand Down Expand Up @@ -80,7 +79,7 @@
IRODSFileSystemSingletonWrapperTest.class, ResourceAOHelperTest.class, CollectionPagerAOImplTest.class,
DataObjectChecksumUtilitiesAOImplTest.class, CollectionListingUtilsTest.class,
FederatedDataObjectAOImplTest.class, DataObjectChecksumUtilitiesAOImplTest.class, TrashOperationsTest.class,
TrashOperationsAOImplTest.class, FederatedUserGroupAOTest.class, ApiPluginExecutorImplTest.class })
TrashOperationsAOImplTest.class, FederatedUserGroupAOTest.class })

/**
* Suite to run Access Object tests in org.irods.jargon.pub.*
Expand Down

0 comments on commit 185db67

Please sign in to comment.