Middleware is an OSGI container which runs ‘plugins’. Plugin is an OSGI bundle which contains isolated(from other bundles) Java code and optionally a set of resources(js, css, and a description file), which will be discovered by the framework and dynamically loaded in the MC|UX UI environment. The middleware will go way with MediaCentral 2018.1.
New APIs
User Settings
User Settings will be stored in IAM now. IAM provides a PrincipalSettings API on the bus and as Upstream/Rest endpoint that can be used for this purpose.
‘Old’ APIs that use the avid.uss service cannot be used anymore. To use the new API from the Client (JS) side there is a JS API - User Settings API
Settings and Configuration Data
This kind of data has to be stored in the ‘avid.acs.attributes v3 Service’. This bus service also provides Upstream/Rest endpoints. The permission for writing of attributes is for administrators only though.
For the Client (JS) side a similar API for the ‘Settings API’ will be provided soon.
Building a service by re-using existing (OSGi) modules
We can provide a quite thin utility layer and allow to reuse implemented interplay modules to declare corresponding bus and upstream/rest endpoint.
Basically instead of using the JAX-RS exposure we can declare ACS bus service instances.
Code examples
DMS job creation and monitoring
Methods:
submitDeliveryJob (Submits a delivery job for given payload. Returns response back with information whether job submitted successfully or not)
Exposed endpoints:
/apis/avid.pam.dms;version=1;realm={$systemId}/submitDeliveryJob (POST call that kicks of delivery and reports job status into job-manager)
DMSBusService inteface:
1 2 3 4 5 6 7 8 9 10 11 12 13
@BusService(type = "avid.pam.dms", realm = "global", version = 1, desc = "DMS service based on Avid Connector API for Java") @Errors({ @Error(code = "ILLEGAL_STATE", severity = ErrorSeverity.ERROR, messageTemplate = "Illegal state for : %{deliveryRequestDTO}", status = 500), }) public interface DMSBusService extends InterplayBusService {
@Operation(name = "submitDeliveryJob", desc = "Submits a delivery job for given payload. Returns response back with information whether job submitted successfully or not") @Examples({ @Example(name = "submitDeliveryJob", file = "submitDeliveryJob.json"), }) @RestRequest(path = "submitDeliveryJob", method = RequestMethod.POST, queryParams = { "deliveryRequestDTO" }) void submitDeliveryJob(@Param("deliveryRequestDTO") String deliveryRequestDTOJson, final OperationContext<GenericResponse> context); }
public class DMSBusServiceImpl extends InterplayBusServiceImpl implements DMSBusService {
private static final Logger LOG = LoggerFactory.getLogger(DMSBusServiceImpl.class); private ProcessComponent bgService;
public DMSBusServiceImpl() { ProcessProvider processProvider = new SampleProcessProvider(); bgService = new ProcessComponent(); bgService.addProcessProvider(processProvider); }
@Override public void setBaseJXDKUtils(BaseJXDKUtils baseJXDKUtils) { super.setBaseJXDKUtils(baseJXDKUtils);
setupDMSBusRegistryService(baseJXDKUtils);
}
private void setupDMSBusRegistryService(BaseJXDKUtils baseJXDKUtils) { final IpcBusAccessFactory busAccessFactory = new IpcBusAccessFactory();
BusRegistryService dmsBusRegistryService = new BusRegistryService(); BusClientConfigResolver configResolver = new BusClientConfigResolver(); configResolver.setBusAccessFactory(busAccessFactory);
dmsBusRegistryService.setConfigResolver(configResolver); final UserSessionService sessionService = new UserSessionService() { @Override public void addUserSessionListener(UserSessionListener userSessionListener) { LOG.info("addUserSessionListener: {}", userSessionListener); }
@Override public void removeUserSessionListener(UserSessionListener userSessionListener) { LOG.info("removeUserSessionListener: {}", userSessionListener);
final InterplayComponent interplayComponent = BaseJXDKUtils.getInterplayComponent(baseJXDKUtils, userIdentity);
RestComponent dmsRestComponent = new RestComponent(); dmsRestComponent.setClientCache(interplayComponent);
ServerPush serverPush = new ServerPush() { @Override public void push(String userLogin, NotificationDTO notification) { LOG.info(">>>>>>>> push for user {} with data {} for recipient {}", userLogin, new ObjectData(notification.getData()).asJson(), notification.getRecipient()); }
@Override public void pushToParticularSession(String httpSessionId, NotificationDTO notification) { LOG.info("pushToParticularSession for userSessionId {} with data {}", httpSessionId, new ObjectData(notification).asJson()); }
@Override public void pushToAllClients(NotificationDTO notification) { LOG.info("pushToAllClients with data {}", new ObjectData(notification).asJson()); } }; UserProcessRegistry registry = new UserProcessRegistry() { @Override public void setupBusAccess() throws BusAccessException { setBusAccessFactory(busAccessFactory); super.setupBusAccess(); } };