Commit a406309d authored by Claudio Pompilio's avatar Claudio Pompilio

added the uses cases elements needed to replicate the experiment

parent cd5e5310
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2015 The CHOReVOLUTION project 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. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.chorevolution.syncope.utility</groupId>
<artifactId>publish-services</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<prerequisites>
<maven>3.0</maven>
</prerequisites>
<organization>
<name>The CHOReVOLUTION project</name>
<url>http://www.chorevolution.eu</url>
</organization>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<all.java.dependencies.target-folder>${project.build.directory}/all-java-dependencies</all.java.dependencies.target-folder>
<syncope.version>2.0.3</syncope.version>
<commons-io.version>2.5</commons-io.version>
<slf4j-api.version>1.7.12</slf4j-api.version>
<slf4j-log4j12.version>1.7.12</slf4j-log4j12.version>
</properties>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>ow2-snapshots</id>
<url>http://repository.ow2.org/nexus/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>ow2-releases</id>
<url>http://repository.ow2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>eu.chorevolution.modelingnotations</groupId>
<artifactId>eu.chorevolution.modelingnotations.security</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
<!-- org.eclipse.emf -->
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.syncope.client</groupId>
<artifactId>syncope-client-lib</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-rest-api</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<!-- logs -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-log4j12.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>clean</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${all.java.dependencies.target-folder}</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<stripVersion>false</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>wsdl</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>eu.chorevolution.syncope.utility.createservice.serviceinventory.CreateServiceIntoServiceInventoryWSDL</mainClass>
<outputFile>${project.build.directory}/log/exec.log</outputFile>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</execution>
<execution>
<id>gidl</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>eu.chorevolution.syncope.utility.createservice.serviceinventory.CreateServiceIntoServiceInventoryGidl</mainClass>
<outputFile>${project.build.directory}/log/exec.log</outputFile>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</execution>
<execution>
<id>gidlwithpwssecurity</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>eu.chorevolution.syncope.utility.createservice.serviceinventory.CreateServiceIntoServiceInventoryGidlWithPwsSecurity</mainClass>
<outputFile>${project.build.directory}/log/exec.log</outputFile>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.syncope.utility.createservice.serviceinventory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import org.apache.cxf.helpers.IOUtils;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.InterfaceDescriptionType;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.Service;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.ServiceRole;
public class CreateServiceIntoServiceInventoryGidl {
private static final Logger LOG = LoggerFactory.getLogger(CreateServiceIntoServiceInventoryGidl.class);
public static String URL = "http://localhost:9080/syncope/rest/";
public static String USERNAME = "admin";
public static String PASSWORD = "password";
public static String DOMAIN = "Master";
private static final String INPUT_RESOURCES = "." + File.separatorChar + "src" + File.separatorChar + "main"
+ File.separatorChar + "resources" + File.separatorChar;
private static final String INTERFACE_INPUT_RESOURCES = INPUT_RESOURCES + "interface" + File.separatorChar;
private static ApacheSyncopeUtilities syncopeUtilities;
public static void main(String[] args) throws FileNotFoundException, IOException {
syncopeUtilities = new ApacheSyncopeUtilities(URL, USERNAME, PASSWORD, DOMAIN);
addProviderServices();
/*
* syncopeUtilities.createChoreography("wp5", new
* FileInputStream(CHOREOGRAPHY_DEPLOYMENT_INPUT_RESOURCES + "wp5.xml"),
* new EnactmentEngine("ef028fc9-23bb-491b-828f-c923bb791bf5",
* "Default"));
*/
}
private static void addProviderServices() {
try {
Service service = new Service("JourneyPlanner", "http://ge-srv.e-mixer.com/Rest/JourneyPlanningService.svc/trips",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "journeyplanner.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("JourneyPlanner_role", ""));
syncopeUtilities.createService(service);
service = new Service("News", "http://srvwebri.softeco.it/t-cube/Rest/NewsService.svc/paged",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "news.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("News_role", ""));
syncopeUtilities.createService(service);
service = new Service("Parking", "http://srvwebri.softeco.it/t-cube/Rest/park.svc/pagedparking",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "parking.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Parking_role", ""));
syncopeUtilities.createService(service);
service = new Service("Poi", "http://srvwebri.softeco.it/t-cube/Rest/pws.svc/pageditems",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "poi.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Poi_role", ""));
syncopeUtilities.createService(service);
service = new Service("PublicTransportation", "http://cho-noauth-srv.e-mixer.com/services/Rest/newsService.svc/latest",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "publictransportation.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("PublicTransportation_role", ""));
syncopeUtilities.createService(service);
service = new Service("Personal Weather Stations", "http://cho-srv.e-mixer.com/services/Rest/ItemService.svc/items",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "personalweatherstations.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("PersonalWeatherStations_role", ""));
syncopeUtilities.createService(service);
service = new Service("Traffic", "http://cho-noauth-srv.e-mixer.com/services/Rest/trafficService.svc/scheduled",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "traffic.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Traffic_role", ""));
syncopeUtilities.createService(service);
} catch (IOException e) {
LOG.error("While loading provider services", e);
}
}
private static ServiceRole createRole(String roleName, String description) {
AnyObjectTO role = syncopeUtilities.createRole(roleName, description);
ServiceRole serviceRole = new ServiceRole();
serviceRole.setKey(role.getKey());
serviceRole.setName(role.getName());
Iterator<AttrTO> iterator = role.getPlainAttrs().iterator();
while (iterator.hasNext()) {
AttrTO attr = iterator.next();
if (attr.getSchema().equalsIgnoreCase(ApacheSyncopeUtilities.SERVICE_ROLE_DESCRIPTION)) {
serviceRole.setDescription(attr.getValues().get(0));
}
}
return serviceRole;
}
}
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.syncope.utility.createservice.serviceinventory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import org.apache.cxf.helpers.IOUtils;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.InterfaceDescriptionType;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.SecurityDescriptionType;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.Service;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.ServiceAuthenticationType;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.ServiceRole;
public class CreateServiceIntoServiceInventoryGidlWithPwsSecurity {
private static final Logger LOG = LoggerFactory.getLogger(CreateServiceIntoServiceInventoryGidlWithPwsSecurity.class);
public static String URL = "http://localhost:9080/syncope/rest/";
public static String USERNAME = "admin";
public static String PASSWORD = "password";
public static String DOMAIN = "Master";
private static final String INPUT_RESOURCES = "." + File.separatorChar + "src" + File.separatorChar + "main"
+ File.separatorChar + "resources" + File.separatorChar;
private static final String INTERFACE_INPUT_RESOURCES = INPUT_RESOURCES + "interface" + File.separatorChar;
private static final String SECURITY_INPUT_RESOURCES = INPUT_RESOURCES + "security" + File.separatorChar;
private static ApacheSyncopeUtilities syncopeUtilities;
public static void main(String[] args) throws FileNotFoundException, IOException {
syncopeUtilities = new ApacheSyncopeUtilities(URL, USERNAME, PASSWORD, DOMAIN);
addProviderServices();
}
private static void addProviderServices() {
try {
Service service = new Service("JourneyPlanner",
"http://ge-srv.e-mixer.com/Rest/JourneyPlanningService.svc/trips",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "journeyplanner.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("JourneyPlanner_role", ""));
syncopeUtilities.createService(service);
service = new Service("News", "http://srvwebri.softeco.it/t-cube/Rest/NewsService.svc/paged",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "news.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("News_role", ""));
syncopeUtilities.createService(service);
service = new Service("Parking", "http://srvwebri.softeco.it/t-cube/Rest/park.svc/pagedparking",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "parking.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Parking_role", ""));
syncopeUtilities.createService(service);
service = new Service("Poi", "http://srvwebri.softeco.it/t-cube/Rest/pws.svc/pageditems",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "poi.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Poi_role", ""));
syncopeUtilities.createService(service);
service = new Service("PublicTransportation",
"http://cho-noauth-srv.e-mixer.com/services/Rest/newsService.svc/latest",
IOUtils.readBytesFromStream(
new FileInputStream(INTERFACE_INPUT_RESOURCES + "publictransportation.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("PublicTransportation_role", ""));
syncopeUtilities.createService(service);
service = new Service("PersonalWeatherStations",
"http://cho-srv.e-mixer.com/services/Rest/ItemService.svc/items",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "personalweatherstations.gidl")),
InterfaceDescriptionType.GIDL);
service.setSecurityDescriptionContent(IOUtils.readBytesFromStream(new FileInputStream(SECURITY_INPUT_RESOURCES + "personalweatherstations.security")));
service.setSecurityDescriptionType(SecurityDescriptionType.SECURITY);
service.setServiceAuthenticationType(ServiceAuthenticationType.CUSTOM);
service.setCustomAuthFileJAR(IOUtils.readBytesFromStream(new FileInputStream(SECURITY_INPUT_RESOURCES + "personalweatherstations-plugin.zip")));
service.addServiceRole(createRole("PersonalWeatherStations_role", ""));
syncopeUtilities.createService(service);
service = new Service("Traffic",
"http://cho-noauth-srv.e-mixer.com/services/Rest/trafficService.svc/scheduled",
IOUtils.readBytesFromStream(new FileInputStream(INTERFACE_INPUT_RESOURCES + "traffic.gidl")),
InterfaceDescriptionType.GIDL);
service.addServiceRole(createRole("Traffic_role", ""));
syncopeUtilities.createService(service);
} catch (IOException e) {
LOG.error("While loading provider services", e);
}
}
private static ServiceRole createRole(String roleName, String description) {
AnyObjectTO role = syncopeUtilities.createRole(roleName, description);
ServiceRole serviceRole = new ServiceRole();
serviceRole.setKey(role.getKey());
serviceRole.setName(role.getName());
Iterator<AttrTO> iterator = role.getPlainAttrs().iterator();
while (iterator.hasNext()) {
AttrTO attr = iterator.next();
if (attr.getSchema().equalsIgnoreCase(ApacheSyncopeUtilities.SERVICE_ROLE_DESCRIPTION)) {
serviceRole.setDescription(attr.getValues().get(0));
}
}
return serviceRole;
}
}
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.syncope.utility.createservice.serviceinventory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import org.apache.cxf.helpers.IOUtils;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.InterfaceDescriptionType;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.Service;
import eu.chorevolution.syncope.utility.createservice.serviceinventory.model.ServiceRole;
public class CreateServiceIntoServiceInventoryWSDL {
private static final Logger LOG = LoggerFactory.getLogger(CreateServiceIntoServiceInventoryGidl.class);
public static String URL = "http://localhost:9080/syncope/rest/";
public static String USERNAME = "admin";
public static String PASSWORD = "password";
public static String DOMAIN = "Master";
private static final String INPUT_RESOURCES = "." + File.separatorChar + "src" + File.separatorChar + "main"
+ File.separatorChar + "resources" + File.separatorChar;