use of com.helger.pd.indexer.clientcert.ClientCertificateValidationResult in project phoss-directory by phax.
the class IndexerResource method createOrUpdateParticipant.
@PUT
public Response createOrUpdateParticipant(@Context @Nonnull final HttpServletRequest aHttpServletRequest, @Nonnull final String sParticipantID) {
final String sLogPrefix = "[createOrUpdateParticipant] ";
final ClientCertificateValidationResult aResult = _checkClientCertificate(aHttpServletRequest, sLogPrefix);
if (aResult.isFailure())
return Response.status(Response.Status.FORBIDDEN).build();
final String sRealParticipantID = _unifyPID(sParticipantID);
if (LOGGER.isInfoEnabled())
LOGGER.info(sLogPrefix + "'" + sRealParticipantID + "'");
// Parse identifier
final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();
final IParticipantIdentifier aPI = aIdentifierFactory.parseParticipantIdentifier(sRealParticipantID);
if (aPI == null) {
if (LOGGER.isErrorEnabled())
LOGGER.error(sLogPrefix + "Failed to parse participant identifier '" + sRealParticipantID + "'");
return Response.status(Status.BAD_REQUEST).build();
}
// Queue for handling
if (PDMetaManager.getIndexerMgr().queueWorkItem(aPI, EIndexerWorkItemType.CREATE_UPDATE, aResult.getClientID(), _getRequestingHost(aHttpServletRequest)).isUnchanged()) {
if (LOGGER.isInfoEnabled())
LOGGER.info(sLogPrefix + "Ignoring duplicate CREATE/UPDATE request for '" + aPI.getURIEncoded() + "'");
}
// And done
return Response.noContent().build();
}
use of com.helger.pd.indexer.clientcert.ClientCertificateValidationResult in project phoss-directory by phax.
the class IndexerResource method deleteParticipant.
@DELETE
@Path("{participantID}")
public Response deleteParticipant(@Context @Nonnull final HttpServletRequest aHttpServletRequest, @PathParam("participantID") @Nonnull final String sParticipantID) {
final String sLogPrefix = "[deleteParticipant] ";
final ClientCertificateValidationResult aResult = _checkClientCertificate(aHttpServletRequest, sLogPrefix);
if (aResult.isFailure())
return Response.status(Response.Status.FORBIDDEN).build();
final String sRealParticipantID = _unifyPID(sParticipantID);
if (LOGGER.isInfoEnabled())
LOGGER.info(sLogPrefix + "'" + sRealParticipantID + "'");
// Parse identifier
final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();
final IParticipantIdentifier aPI = aIdentifierFactory.parseParticipantIdentifier(sRealParticipantID);
if (aPI == null) {
if (LOGGER.isErrorEnabled())
LOGGER.error(sLogPrefix + "Failed to parse participant identifier '" + sRealParticipantID + "'");
return Response.status(Status.BAD_REQUEST).build();
}
// Queue for handling
if (PDMetaManager.getIndexerMgr().queueWorkItem(aPI, EIndexerWorkItemType.DELETE, aResult.getClientID(), _getRequestingHost(aHttpServletRequest)).isUnchanged()) {
if (LOGGER.isInfoEnabled())
LOGGER.info(sLogPrefix + "Ignoring duplicate DELETE request for '" + aPI.getURIEncoded() + "'");
}
// And done
return Response.noContent().build();
}
use of com.helger.pd.indexer.clientcert.ClientCertificateValidationResult in project phoss-directory by phax.
the class IndexerResource method checkParticipantExistence.
@GET
@Path("{participantID}")
public Response checkParticipantExistence(@Context @Nonnull final HttpServletRequest aHttpServletRequest, @PathParam("participantID") @Nonnull final String sParticipantID) throws IOException {
final String sLogPrefix = "[checkParticipantExistence] ";
final ClientCertificateValidationResult aResult = _checkClientCertificate(aHttpServletRequest, sLogPrefix);
if (aResult.isFailure())
return Response.status(Response.Status.FORBIDDEN).build();
final String sRealParticipantID = _unifyPID(sParticipantID);
if (LOGGER.isInfoEnabled())
LOGGER.info(sLogPrefix + "'" + sRealParticipantID + "'");
// Parse identifier
final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();
final IParticipantIdentifier aPI = aIdentifierFactory.parseParticipantIdentifier(sRealParticipantID);
if (aPI == null)
if (LOGGER.isErrorEnabled())
LOGGER.error(sLogPrefix + "Failed to parse participant identifier '" + sRealParticipantID + "'");
// Queue for handling
if (!PDMetaManager.getStorageMgr().containsEntry(aPI))
return Response.status(Response.Status.NOT_FOUND).build();
// And done
return Response.noContent().build();
}
Aggregations