Commit dbb47cb6 authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

Reviewing Studio <-> IdM <-> EE interfaces

parent 2ccaf36d
......@@ -16,8 +16,30 @@
package eu.chorevolution.idm.common.types;
public enum ChoreographyAction {
PAUSE,
RESUME,
SHUTDOWN,
RELEASE;
/**
* User requests start to be accepted.
* Only available after given choreography was subjected to {@link STOP}..
*/
START,
/**
* No more user requests are accepted.
* Only available after given choreography was subjected to {@link START}..
*/
STOP,
/**
* Frezees all choreography resources.
* Each node is put in a frozen state.
* Only available after given choreography was subjected to {@link START}..
*/
FREEZE,
/**
* Unfreezes all choreography resources.
* Only available after given choreography was subjected to {@link FREEZE}..
* Each node is back available again.
*/
UNFREEZE,
/**
* Sets the minimum number of nodes running each service group of the given choreography.
*/
RESIZE;
}
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 eu.chorevolution.idm.common.types;
public enum ChoreographyOperation {
CREATE,
UPDATE,
DELETE;
}
......@@ -16,10 +16,14 @@
package eu.chorevolution.idm.common.types;
public enum ServiceAction {
SCALE_UP,
SCALE_DOWN,
SCALE_UP_ACROSS,
SCALE_DOWN_ACROSS,
REPLACE_SERVICE;
/**
* Starts non-legacy service.
*/
START,
/**
* Stops non-legacy service.
*/
STOP,
REPLACE;
}
......@@ -16,6 +16,7 @@
package org.apache.syncope.common.rest.api.service;
import eu.chorevolution.idm.common.types.ChoreographyAction;
import eu.chorevolution.idm.common.types.ChoreographyOperation;
import eu.chorevolution.idm.common.types.ServiceAction;
import java.io.InputStream;
import javax.validation.constraints.NotNull;
......@@ -25,55 +26,83 @@ import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
/**
* REST services to be invoked by - and to - the Enactment Engine.
* REST services to be invoked by the Studio for operating on choreographies and / or their services.
*/
@Path("chors/{id}")
@Path("chors")
public interface ChoreographyService extends JAXRSService {
/**
* This operation will be invoked after a newly created choreography is enacted.
* Enact a new choreography.
*
* @param id choreography id
* @param in ChorSpec XML representation
* @param enactmentEngineKey target enactment engine instance
* @param chorSpec ChorSpec XML representation
* @return the choreography deployment id as generateed by the enactment engine
*/
@POST
@Consumes({ MediaType.APPLICATION_XML })
void create(@NotNull @PathParam("id") String id, InputStream in);
String enact(@NotNull @QueryParam("enactmentEngineKey") String enactmentEngineKey, InputStream chorSpec);
/**
* This operation will used to notify that a modification of a choreography’s concrete ChorSpec occurred.
* Such modifications may occur after performing an action on a whole running choreography or on a single service of
* it.
* Enact an existing choreography, with updated specification.
*
* @param id choreography id
* @param in ChorSpec XML representation
* @param enactmentEngineKey target enactment engine instance
* @param chorSpec ChorSpec XML representation
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML })
void update(@NotNull @PathParam("id") String id, InputStream in);
void enact(
@NotNull @PathParam("id") String id,
@NotNull @QueryParam("enactmentEngineKey") String enactmentEngineKey,
InputStream chorSpec);
/**
* This operation can be invoked when a choreography is retired.
* Retire the given choreography.
*
* @param id choreography id
* @param enactmentEngineKey target enactment engine instance
*/
@DELETE
void delete(@NotNull @PathParam("id") String id);
@Path("{id}")
void delete(
@NotNull @PathParam("id") String id,
@NotNull @QueryParam("enactmentEngineKey") String enactmentEngineKey);
/**
* This operation will used to notify that an enactment operation was completed, providing the
* related concrete ChorSpec.
*
* @param id choreography id
* @param operation the operation performed by the enactment engine on the given choreography
* @param message execution message - reporting success or failure (for example)
* @param enactedChorSpec ChorSpec XML representation, as enacted by the enactment engine
*/
@POST
@Path("{id}/{operation}/notifyCompletion")
void notifyCompletion(
@NotNull @PathParam("id") String id,
@NotNull @PathParam("operation") ChoreographyOperation operation,
@NotNull String message,
InputStream enactedChorSpec);
/**
* Performs the given action on the given choreography.
*
* @param id choreography id
* @param action action to be performed
* @param newSize (normally ignored, required if {@code action} is {@link ChoreographyAction#RESIZE}
* minimum number of nodes running each service group of the given choreography
*/
@POST
@Path("{action}")
@Path("{id}")
void onChoreography(
@NotNull @PathParam("id") String id,
@NotNull @PathParam("action") ChoreographyAction action);
@NotNull @QueryParam("action") ChoreographyAction action,
Integer newSize);
/**
* Performs the given action on the given choreography's service.
......@@ -81,12 +110,15 @@ public interface ChoreographyService extends JAXRSService {
* @param id choreography id
* @param serviceId choreography service id
* @param action action to be performed
* @param newServiceURL (normally ignored, required if {@code action} is {@link ServiceAction#REPLACE}
* service URL to replace the current set for the given service id
*/
@POST
@Path("{serviceId}/{action}")
@Path("{id}/{serviceId}")
void onChoreographyService(
@NotNull @PathParam("id") String id,
@NotNull @PathParam("serviceId") String serviceId,
@NotNull @PathParam("action") ServiceAction action);
@NotNull @QueryParam("action") ServiceAction action,
String newServiceURL);
}
......@@ -30,7 +30,7 @@ public class ChoreographyServiceImpl extends AbstractServiceImpl implements Chor
private ChoreographyLogic logic;
@Override
public void create(final String id, final InputStream in) {
public void enact(final String id, final InputStream in) {
logic.create(id, in);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment