From ed73dbf357aff41edcbab401a94e5fbc266d9391 Mon Sep 17 00:00:00 2001 From: Mufaddal Makati Date: Fri, 7 Aug 2015 13:09:49 -0700 Subject: First Commit --- svc/pom.xml | 30 +++ svc/svcbase/pom.xml | 29 +++ .../vcpe/svc/svcbase/client/EplClient.java | 149 ++++++++++++++ .../com/cablelabs/vcpe/svc/svcbase/model/Epl.java | 104 ++++++++++ .../svc/svcbase/repository/EplRespository.java | 21 ++ .../svcbase/repository/EplRespositoryInMem.java | 91 +++++++++ .../vcpe/svc/svcbase/client/EplClientTest.java | 150 +++++++++++++++ .../svc/svcbase/repository/EplRepositoryTest.java | 126 ++++++++++++ .../vcpe/svc/svcbase/client/EplClient$1.class | Bin 0 -> 748 bytes .../vcpe/svc/svcbase/client/EplClient.class | Bin 0 -> 4184 bytes .../com/cablelabs/vcpe/svc/svcbase/model/Epl.class | Bin 0 -> 4747 bytes .../svc/svcbase/repository/EplRespository.class | Bin 0 -> 534 bytes .../svcbase/repository/EplRespositoryInMem.class | Bin 0 -> 3649 bytes svc/svcbase/target/maven-archiver/pom.properties | 5 + svc/svcbase/target/svcbase.jar | Bin 0 -> 9200 bytes .../vcpe/svc/svcbase/client/EplClientTest.class | Bin 0 -> 5005 bytes .../svc/svcbase/repository/EplRepositoryTest.class | Bin 0 -> 4317 bytes svc/svcmgr/pom.xml | 33 ++++ .../vcpe/svc/svcmgr/CORSResponseFilter.java | 24 +++ .../com/cablelabs/vcpe/svc/svcmgr/EplService.java | 213 +++++++++++++++++++++ .../vcpe/svc/svcmgr/SvcJaxRsApplication.java | 18 ++ svc/svcmgr/src/main/webapp/WEB-INF/web.xml | 22 +++ svc/svcmgr/src/main/webapp/index.jsp | 8 + .../vcpe/svc/svcmgr/CORSResponseFilter.class | Bin 0 -> 1384 bytes .../cablelabs/vcpe/svc/svcmgr/EplService$1.class | Bin 0 -> 905 bytes .../com/cablelabs/vcpe/svc/svcmgr/EplService.class | Bin 0 -> 6265 bytes .../vcpe/svc/svcmgr/SvcJaxRsApplication.class | Bin 0 -> 689 bytes svc/svcmgr/target/maven-archiver/pom.properties | 5 + svc/svcmgr/target/svcmgr.war | Bin 0 -> 9825987 bytes .../vcpe/svc/svcmgr/CORSResponseFilter.class | Bin 0 -> 1384 bytes .../cablelabs/vcpe/svc/svcmgr/EplService$1.class | Bin 0 -> 905 bytes .../com/cablelabs/vcpe/svc/svcmgr/EplService.class | Bin 0 -> 6265 bytes .../vcpe/svc/svcmgr/SvcJaxRsApplication.class | Bin 0 -> 689 bytes .../WEB-INF/lib/asm-all-repackaged-2.2.0-b14.jar | Bin 0 -> 320127 bytes .../target/svcmgr/WEB-INF/lib/cglib-2.2.0-b14.jar | Bin 0 -> 282815 bytes .../svcmgr/WEB-INF/lib/common-1.0-SNAPSHOT.jar | Bin 0 -> 2690 bytes .../svcmgr/WEB-INF/lib/cosbase-1.0-SNAPSHOT.jar | Bin 0 -> 9554 bytes .../svcmgr/WEB-INF/lib/evcbase-1.0-SNAPSHOT.jar | Bin 0 -> 13723 bytes .../target/svcmgr/WEB-INF/lib/guava-14.0.1.jar | Bin 0 -> 2189117 bytes .../svcmgr/WEB-INF/lib/hk2-api-2.2.0-b14.jar | Bin 0 -> 126233 bytes .../svcmgr/WEB-INF/lib/hk2-locator-2.2.0-b14.jar | Bin 0 -> 133345 bytes .../svcmgr/WEB-INF/lib/hk2-utils-2.2.0-b14.jar | Bin 0 -> 53381 bytes .../WEB-INF/lib/javax.annotation-api-1.2.jar | Bin 0 -> 26366 bytes .../svcmgr/WEB-INF/lib/javax.inject-2.2.0-b14.jar | Bin 0 -> 5987 bytes .../svcmgr/WEB-INF/lib/javax.ws.rs-api-2.0.jar | Bin 0 -> 112758 bytes .../svcmgr/WEB-INF/lib/jersey-client-2.2.jar | Bin 0 -> 117090 bytes .../svcmgr/WEB-INF/lib/jersey-common-2.2.jar | Bin 0 -> 600514 bytes .../lib/jersey-container-servlet-core-2.2.jar | Bin 0 -> 52819 bytes .../svcmgr/WEB-INF/lib/jersey-media-moxy-2.2.jar | Bin 0 -> 15591 bytes .../svcmgr/WEB-INF/lib/jersey-server-2.2.jar | Bin 0 -> 801094 bytes .../lib/org.eclipse.persistence.antlr-2.5.0.jar | Bin 0 -> 189645 bytes .../lib/org.eclipse.persistence.asm-2.5.0.jar | Bin 0 -> 271208 bytes .../lib/org.eclipse.persistence.core-2.5.0.jar | Bin 0 -> 4977121 bytes .../lib/org.eclipse.persistence.moxy-2.5.0.jar | Bin 0 -> 488045 bytes .../WEB-INF/lib/osgi-resource-locator-1.0.1.jar | Bin 0 -> 20235 bytes .../svcmgr/WEB-INF/lib/svcbase-1.0-SNAPSHOT.jar | Bin 0 -> 9200 bytes .../WEB-INF/lib/validation-api-1.1.0.Final.jar | Bin 0 -> 63777 bytes svc/svcmgr/target/svcmgr/WEB-INF/web.xml | 22 +++ svc/svcmgr/target/svcmgr/index.jsp | 8 + 59 files changed, 1058 insertions(+) create mode 100644 svc/pom.xml create mode 100644 svc/svcbase/pom.xml create mode 100644 svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/client/EplClient.java create mode 100644 svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/model/Epl.java create mode 100644 svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.java create mode 100644 svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.java create mode 100644 svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.java create mode 100644 svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.java create mode 100644 svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient$1.class create mode 100644 svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient.class create mode 100644 svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/model/Epl.class create mode 100644 svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.class create mode 100644 svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.class create mode 100644 svc/svcbase/target/maven-archiver/pom.properties create mode 100644 svc/svcbase/target/svcbase.jar create mode 100644 svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.class create mode 100644 svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.class create mode 100644 svc/svcmgr/pom.xml create mode 100644 svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.java create mode 100644 svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java create mode 100644 svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.java create mode 100644 svc/svcmgr/src/main/webapp/WEB-INF/web.xml create mode 100644 svc/svcmgr/src/main/webapp/index.jsp create mode 100644 svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class create mode 100644 svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class create mode 100644 svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class create mode 100644 svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class create mode 100644 svc/svcmgr/target/maven-archiver/pom.properties create mode 100644 svc/svcmgr/target/svcmgr.war create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/asm-all-repackaged-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/cglib-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/common-1.0-SNAPSHOT.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/cosbase-1.0-SNAPSHOT.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/evcbase-1.0-SNAPSHOT.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/guava-14.0.1.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-api-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-locator-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-utils-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.annotation-api-1.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.inject-2.2.0-b14.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.ws.rs-api-2.0.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-client-2.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-common-2.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-container-servlet-core-2.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-media-moxy-2.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-server-2.2.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/osgi-resource-locator-1.0.1.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/svcbase-1.0-SNAPSHOT.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/lib/validation-api-1.1.0.Final.jar create mode 100644 svc/svcmgr/target/svcmgr/WEB-INF/web.xml create mode 100644 svc/svcmgr/target/svcmgr/index.jsp (limited to 'svc') diff --git a/svc/pom.xml b/svc/pom.xml new file mode 100644 index 0000000..6e8f4de --- /dev/null +++ b/svc/pom.xml @@ -0,0 +1,30 @@ + + + + com.cablelabs.vcpe + vcpe-services + 1.0-SNAPSHOT + + + 4.0.0 + + com.cablelabs.vcpe + svc + pom + 1.0-SNAPSHOT + + + svcbase + svcmgr + + + + + com.cablelabs.vcpe + cosbase + 1.0-SNAPSHOT + + + + diff --git a/svc/svcbase/pom.xml b/svc/svcbase/pom.xml new file mode 100644 index 0000000..40982d6 --- /dev/null +++ b/svc/svcbase/pom.xml @@ -0,0 +1,29 @@ + + + + com.cablelabs.vcpe + svc + 1.0-SNAPSHOT + + + 4.0.0 + + com.cablelabs.vcpe + svcbase + jar + 1.0-SNAPSHOT + + + svcbase + + + + + com.cablelabs.vcpe + evcbase + 1.0-SNAPSHOT + + + + diff --git a/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/client/EplClient.java b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/client/EplClient.java new file mode 100644 index 0000000..9bc7368 --- /dev/null +++ b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/client/EplClient.java @@ -0,0 +1,149 @@ +package com.cablelabs.vcpe.svc.svcbase.client; + +import com.cablelabs.vcpe.svc.svcbase.model.Epl; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.List; + +/** + * Created by steve on 6/8/15. + */ +public class EplClient { + + private Client client; // provided by Jersey + + public EplClient() { + client = ClientBuilder.newClient(); + } + + //-------------------------------------------------------- + public Epl create(Epl epl) + //-------------------------------------------------------- + { + WebTarget target =client.target("http://localhost:9090/svcmgr/webapi/svc/"); + Response response = target.path("epl") + .request(MediaType.APPLICATION_JSON) + .post(Entity.entity(epl, MediaType.APPLICATION_JSON)); + + if (response.getStatus() != 200 ) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + return response.readEntity(Epl.class); + } + + //-------------------------------------------------------- + public Epl update(Epl epl) + //-------------------------------------------------------- + { + WebTarget target =client.target("http://localhost:9090/svcmgr/webapi/svc/"); + Response response = target.path("epl/"+ epl.getId()) + .request(MediaType.APPLICATION_JSON) + .put(Entity.entity(epl, MediaType.APPLICATION_JSON)); + + if (response.getStatus() != 200 ) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + return response.readEntity(Epl.class); + } + + //-------------------------------------------------------- + public Epl get(String eplId) + //-------------------------------------------------------- + // get Epl of specified ID + + { + WebTarget target = client.target("http://localhost:9090/svcmgr/webapi/svc"); + + Response response = target.path("epl/"+eplId).request(MediaType.APPLICATION_JSON).get(Response.class); + if (response.getStatus() != 200) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + + //return response; + return response.readEntity(Epl.class); + } + + //-------------------------------------------------------- + public List getAll() + //-------------------------------------------------------- + // get a list of all Epl instances + { + + WebTarget target = client.target("http://localhost:9090/svcmgr/webapi/svc/"); + + // Can I do this with a Response, so that I can check for errors + List response = target.path("epl/list") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() { + }); + if (response == null) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException("there was an error on the server."); + } + return response; + } + + //-------------------------------------------------------- + public void delete(String eplId) + //-------------------------------------------------------- + // delete Epl of specified ID + { + WebTarget target = client.target("http://localhost:9090/svcmgr/webapi/svc/"); + Response response = target.path("epl/"+eplId).request(MediaType.APPLICATION_JSON).delete(); + if (response.getStatus() != 200) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + } + + //-------------------------------------------------------- + public Epl testGet() + //-------------------------------------------------------- + // test marshaling of Epl class from server json + + { + WebTarget target = client.target("http://localhost:9090/svcmgr/webapi/svc/"); + + Response response = target.path("epl").request(MediaType.APPLICATION_JSON).get(Response.class); + if (response.getStatus() != 200) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + + //return response; + return response.readEntity(Epl.class); + } + + //-------------------------------------------------------- + public String ping() + //-------------------------------------------------------- + // test connectivity + { + + WebTarget target = client.target("http://localhost:9090/svcmgr/webapi/svc/"); + + Response response = target.path("epl").request(MediaType.TEXT_PLAIN).get(); + if (response.getStatus() != 200) // figure out how to use Status.OK + { + // in production you can be more specific based on reponse code, id, etc + throw new RuntimeException(response.getStatus() + ": there was an error on the server."); + } + + return response.readEntity(String.class); + } +} diff --git a/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/model/Epl.java b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/model/Epl.java new file mode 100644 index 0000000..254fb11 --- /dev/null +++ b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/model/Epl.java @@ -0,0 +1,104 @@ +package com.cablelabs.vcpe.svc.svcbase.model; + +import com.cablelabs.vcpe.common.Dbg; +import com.cablelabs.vcpe.evc.evcbase.model.Evc; +import com.cablelabs.vcpe.evc.evcbase.client.EvcClient; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +/** + * Created by steve on 5/24/15. + */ + +@XmlRootElement +public class Epl +{ + private String id; + private long numCustLocations; + private List custAddressList = null; + private List uniHostMacList = null; + private List uniHostIpList = null; + private String cos; + private String evcId; + + // zero argument constructor required for JAX-RS + public Epl() { + id = "unset"; + this.numCustLocations = -1; + this.custAddressList = null; + this.uniHostMacList = null; + this.uniHostIpList = null; + this.cos = "unset"; + this.evcId = "unset"; + } + + public void setAllProps (String id, long numCustLocations, + List custAddressList, + List uniHostMacList, List uniHostIpList, String cos, String evcId) { + this.id = id; + this.numCustLocations = numCustLocations; + this.custAddressList = custAddressList; + this.uniHostMacList = uniHostMacList; + this.uniHostIpList = uniHostIpList; + this.cos = cos; + this.evcId = evcId; + } + + public void dump() { dump(0); } + public void dump(int tab) { + + Dbg.p(tab, "id: " + this.id); + Dbg.p(tab, "numCustLocations: " + this.numCustLocations); + Dbg.p(tab, "Address List:"); + for (String addr : custAddressList) + Dbg.p(tab+1, addr); + Dbg.p(tab, "UNI Mac List:"); + for (String mac : uniHostMacList) + Dbg.p(tab+1, mac); + Dbg.p(tab, "UNI IP List:"); + for (String ip : uniHostIpList) + Dbg.p(tab+1, ip); + Dbg.p(tab, "cos: " + this.cos); + Dbg.p(tab, "Evc:" + this.evcId); +// if ( this.evcId != "unset") { // hacky +// EvcClient evcClient = new EvcClient(); +// Evc evc = evcClient.get(this.evcId); +// evc.dump(tab + 2); +// } + } + + public static void dumpList(List eplList) { dumpList(0, eplList); } + public static void dumpList(int tab, List eplList) { + int numSvc = 0; + Dbg.p("----- Epl List : [" + eplList.size() + "] elements"); + for (Epl curEpl : eplList) { + numSvc++; + Dbg.p(tab+1, ""); + curEpl.dump(tab+2); + } + } + + // Getters & Setters + public String getId() { return id; } + public void setId(String id) { this.id = id; } + + public long getNumCustLocations() { return numCustLocations; } + public void setNumCustLocations(long numCustLocations) { this.numCustLocations = numCustLocations; } + + public List getCustAddressList() { return custAddressList; } + public void setCustAddressList(List custAddressList) { this.custAddressList = custAddressList; } + + public List getUniHostMacList() { return uniHostMacList; } + public void setUniHostMacList(List uniHostMacList) { this.uniHostMacList = uniHostMacList; } + + + public List getUniHostIpList() { return uniHostIpList; } + public void setUniHostIpList(List uniHostIpList) { this.uniHostIpList = uniHostIpList; } + + public String getCos() { return cos; } + public void setCos(String cos) { this.cos = cos; } + + public String getEvcId() { return evcId; } + public void setEvcId(String evcId) { this.evcId = evcId; } +} diff --git a/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.java b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.java new file mode 100644 index 0000000..1142963 --- /dev/null +++ b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.java @@ -0,0 +1,21 @@ +package com.cablelabs.vcpe.svc.svcbase.repository; + +import com.cablelabs.vcpe.svc.svcbase.model.Epl; + +import java.util.List; + +/** + * Created by steve on 5/25/15. + */ +public interface EplRespository +{ + // TODO add exceptions + + Epl add(Epl epl); // returns null if already exists, otherwise returns stored epl + Epl get(String svcId); // returns null if not found, otherwise stored svc + Epl update(Epl epl); // returns null if did not exit, otherwise epl as it was previous to update (put in any case) + Epl delete(String svcId); // returns null if not found, otherwise svc as it was previous to delete + int count(); // number of Epl stored in the repo + public void dump(int tab); // print out contents of the repo + List getAll(); +} diff --git a/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.java b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.java new file mode 100644 index 0000000..af82c21 --- /dev/null +++ b/svc/svcbase/src/main/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.java @@ -0,0 +1,91 @@ +package com.cablelabs.vcpe.svc.svcbase.repository; + +import com.cablelabs.vcpe.common.Dbg; +import com.cablelabs.vcpe.svc.svcbase.model.Epl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Created by steve on 5/24/15. + */ + + +/* + Singleton that contains a hashmap which holds instances of Epl objects, indexed by CiS ID + */ + +public enum EplRespositoryInMem implements EplRespository { + INSTANCE; // Singleton + + private Map svcDB = new ConcurrentHashMap<>(); + + @Override + //-------------------------------------------------------- + public Epl add(Epl epl) + //-------------------------------------------------------- + { + if ( this.get(epl.getId()) != null ) { + return null; + } + svcDB.put(epl.getId(), epl); + return epl; + } + + @Override + //-------------------------------------------------------- + public Epl get(String svcId) { + return svcDB.get(svcId); + } + //-------------------------------------------------------- + + @Override + //-------------------------------------------------------- + public Epl update(Epl epl) + //-------------------------------------------------------- + { + // put returns null if epl did not exist, other returns epl as it stood prior to put + return svcDB.put(epl.getId(), epl); + } + + @Override + //-------------------------------------------------------- + public Epl delete(String svcId) + //-------------------------------------------------------- + { + // remove returns null if svc did not exist, other returns svc as it stood prior to remove + return svcDB.remove(svcId); + } + + @Override + //-------------------------------------------------------- + public int count() { + return svcDB.size(); + } + //-------------------------------------------------------- + + @Override + //-------------------------------------------------------- + public List getAll() + //-------------------------------------------------------- + { + List eplList = new ArrayList(svcDB.values()); + return eplList; + } + + @Override + //-------------------------------------------------------- + public void dump(int tab) + //-------------------------------------------------------- + { + Dbg.p(tab, "Epl Repo: " + svcDB.size() + " entrie(s)"); + int numSvc = 0; + for (Epl curEpl : svcDB.values()) { + numSvc++; + Dbg.p(tab+1, ""); + curEpl.dump(tab+2); + } + } +} diff --git a/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.java b/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.java new file mode 100644 index 0000000..f8950f9 --- /dev/null +++ b/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.java @@ -0,0 +1,150 @@ +package com.cablelabs.vcpe.svc.svcbase.client; + +import com.cablelabs.vcpe.common.Dbg; +import com.cablelabs.vcpe.cos.cosbase.client.CoSClient; +import com.cablelabs.vcpe.cos.cosbase.model.CoS; +import com.cablelabs.vcpe.svc.svcbase.model.Epl; + +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + + +/** + * Created by steve on 6/8/15. + */ +public class EplClientTest { + + @Test + public void testAll() throws Exception { + + // First, create a couple of CoS's to reference + CoS gold = new CoS(); + CoS silver = new CoS(); + CoS bronze = new CoS(); + + gold.setAllProps("gold", 100, 0.99, 17.43, 2.43, 0.01); + silver.setAllProps("silver", 50, 0.95, 27.43, 2.43, 0.02); + bronze.setAllProps("bronze", 25, 0.90, 37.43, 2.43, 0.03); + + CoSClient coSClient = new CoSClient(); + + gold = coSClient.create(gold); + assertNotNull(gold); + silver = coSClient.create(silver); + assertNotNull(silver); + bronze = coSClient.create(bronze); + assertNotNull(bronze); + + List locList1 = new ArrayList(); + locList1.add("1 MEF Dr, Honolulu HI, USA"); + locList1.add("1 MEF Dr, Boston MA, MAS"); + List uniList1 = new ArrayList(); + uniList1.add("11:AA:00:00:00:00"); + uniList1.add("11:BB:00:00:00:00"); + List ipList1 = new ArrayList(); + ipList1.add("192.168.1.1"); + ipList1.add("192.168.1.2"); + + List locList2 = new ArrayList(); + locList2.add("22 MEF Dr, Honolulu HI, USA"); + locList2.add("22 MEF Dr, Boston MA, MAS"); + List uniList2 = new ArrayList(); + uniList2.add("22:AA:00:00:00:00"); + uniList2.add("22:BB:00:00:00:00"); + List ipList2 = new ArrayList(); + ipList2.add("192.168.2.1"); + ipList2.add("192.168.2.2"); + + List locList3 = new ArrayList(); + locList3.add("33 MEF Dr, Honolulu HI, USA"); + locList3.add("33 MEF Dr, Boston MA, MAS"); + List uniList3 = new ArrayList(); + uniList3.add("33:AA:00:00:00:00"); + uniList3.add("33:BB:00:00:00:00"); + List ipList3 = new ArrayList(); + ipList3.add("192.168.3.1"); + ipList3.add("192.168.3.2"); + + Epl epl_1 = new Epl(); + epl_1.setAllProps("epl-1", 2, locList1, uniList1, ipList1, gold.getId(), "unset"); + + EplClient eplClient = new EplClient(); + Dbg.p(epl_1.getId()+" being created via eplmgr"); + epl_1.dump(1); + + + // need to capture returned EPL in case it was modified by svc layer during creation + epl_1 = eplClient.create(epl_1); + assertNotNull(epl_1); + + Epl retrievedEpl = eplClient.get(epl_1.getId()); + assertNotNull(retrievedEpl); + Dbg.p("epl just retrieved from Epl Service"); + retrievedEpl.dump(1); + retrievedEpl = null; + + epl_1.setCos(bronze.getId()); + Dbg.p("EPL["+ epl_1.getId()+ "] : about to be updated"); + epl_1.dump(1); + assertNotNull(eplClient.update(epl_1)); + retrievedEpl = eplClient.get(epl_1.getId()); + assertNotNull(retrievedEpl); + Dbg.p("EPL["+ epl_1.getId()+ "] : retrieved after the update"); + retrievedEpl.dump(1); + + Epl epl_2 = new Epl(); + epl_2.setAllProps("epl-2", 2, locList2, uniList2, ipList2, silver.getId(), "unset"); + + Epl epl_3 = new Epl(); + epl_3.setAllProps("epl-3", 2, locList3, uniList3, ipList3, bronze.getId(), "unset"); + + // need to capture returned EPL in case it was modified by svc layer during creation + epl_2 = eplClient.create(epl_2); + assertNotNull(epl_2); + epl_3 = eplClient.create(epl_3); + assertNotNull(epl_3); + + List eplList = eplClient.getAll(); + assertNotNull(eplList); + assertEquals(eplList.size(), 3); + + Epl.dumpList(eplList); + + eplClient.delete(epl_3.getId()); + eplList = eplClient.getAll(); + assertNotNull(eplList); + assertEquals(eplList.size(),2); + Epl.dumpList(eplList); + + eplClient.delete(epl_2.getId()); + eplList = eplClient.getAll(); + Epl.dumpList(eplList); + assertNotNull(eplList); + assertEquals(eplList.size(),1); + Epl.dumpList(eplList); + + eplClient.delete(epl_1.getId()); + eplList = eplClient.getAll(); + assertNotNull(eplList); + assertEquals(eplList.size(),0); + Epl.dumpList(eplList); + } + + @Test + public void testTestGet() throws Exception { + EplClient eplClient = new EplClient(); + Epl epl = eplClient.testGet(); + epl.dump();; + } + + @Test + public void testPing() throws Exception { + + EplClient eplClient = new EplClient(); + String resp = eplClient.ping(); + Dbg.p(resp); + } +} diff --git a/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.java b/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.java new file mode 100644 index 0000000..ff8c892 --- /dev/null +++ b/svc/svcbase/src/test/java/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.java @@ -0,0 +1,126 @@ +package com.cablelabs.vcpe.svc.svcbase.repository; + +import com.cablelabs.vcpe.cos.cosbase.model.CoS; +import com.cablelabs.vcpe.svc.svcbase.model.Epl; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by steve on 5/25/15. + */ +public class EplRepositoryTest +{ + + @Test + public void test() { + + // First, create a couple of CoS's to reference + CoS gold = new CoS(); + CoS silver = new CoS(); + CoS bronze = new CoS(); + + // id CIR/MBS avail delay jitter frameloss + gold.setAllProps("gold", 100, 0.99, 17.43, 2.43, 0.01); + silver.setAllProps("silver", 50, 0.95, 27.43, 2.43, 0.02); + bronze.setAllProps("bronze", 25, 0.90, 37.43, 2.43, 0.03); + + // lets add these to the + + List locList1 = new ArrayList(); + locList1.add("1111 MEF Dr, Honolulu HI, USA"); + locList1.add("2222 MEF Dr, Honolulu HI, USA"); + List uniList1 = new ArrayList(); + uniList1.add("11:11:11:11:11:11"); + uniList1.add("22:22:22:22:22:22"); + List ipList1 = new ArrayList(); + ipList1.add("192.168.1.1"); + ipList1.add("192.168.1.2"); + + + List locList2 = new ArrayList(); + locList2.add("1111 MEF Dr, Honolulu HI, USA"); + locList2.add("2222 MEF Dr, Boston MA, MAS"); + List uniList2 = new ArrayList(); + uniList2.add("11:11:11:11:11:11"); + uniList2.add("22:22:22:22:22:22"); + List ipList2 = new ArrayList(); + ipList2.add("192.168.2.1"); + ipList2.add("192.168.2.2"); + + List locList3 = new ArrayList(); + locList3.add("1111 MEF Dr, Honolulu HI, USA"); + locList3.add("2222 MEF Dr, Boston MA, MAS"); + locList3.add("3333 MEF Dr, Boulder CO, USA"); + List uniList3 = new ArrayList(); + uniList3.add("11:11:11:11:11:11"); + uniList3.add("22:22:22:22:22:22"); + List ipList3 = new ArrayList(); + ipList3.add("192.168.3.1"); + ipList3.add("192.168.3.2"); + + List locList4 = new ArrayList(); + locList4.add("1111 MEF Dr, Honolulu HI, USA"); + locList4.add("2222 MEF Dr, Boston MA, MAS"); + locList4.add("3333 MEF Dr, Boulder CO, USA"); + locList4.add("4444 MEF Dr, Los Angeles, CA, USA"); + List uniList4 = new ArrayList(); + uniList4.add("11:11:11:11:11:11"); + uniList4.add("22:22:22:22:22:22"); + uniList4.add("33:33:33:33:33:33"); + uniList4.add("44:44:44:44:44:44"); + List ipList4 = new ArrayList(); + ipList4.add("192.168.4.1"); + ipList4.add("192.168.4.2"); + + + + Epl epl_1 = new Epl(); + Epl epl_2 = new Epl(); + Epl epl_3 = new Epl(); + Epl epl_4 = new Epl(); + + epl_1.setAllProps("epl-1", 1, locList1, uniList1, ipList1, gold.getId(), "unset"); + epl_2.setAllProps("epl-2", 2, locList2, uniList2, ipList2, silver.getId(), "unset"); + epl_3.setAllProps("epl-3", 3, locList3, uniList3, ipList3, bronze.getId(), "unset"); + epl_4.setAllProps("epl-4", 4, locList4, uniList4, ipList4, gold.getId(), "unset"); + + EplRespository repo = EplRespositoryInMem.INSTANCE; + + assertNotNull(repo.add(epl_1)); + assertNotNull(repo.add(epl_2)); + assertNotNull(repo.add(epl_3)); + assertNull(repo.add(epl_3)); // duplicate + assertEquals(repo.count(), 3); + + assertNotNull(repo.get(epl_1.getId())); + assertNotNull(repo.get(epl_2.getId())); + assertNotNull(repo.get(epl_3.getId())); + + assertNotNull(repo.delete(epl_2.getId())); + assertNull(repo.delete(epl_2.getId())); + assertNull(repo.delete("not-in-repo")); + assertEquals(repo.count(), 2); + + assertEquals(repo.get(epl_1.getId()).getNumCustLocations(), 1); + assertNotEquals(repo.get(epl_3.getId()).getNumCustLocations(), 1); + + + assertNull(repo.update(epl_4)); // update non-existent cos + assertEquals(repo.count(), 3); + assertEquals(repo.get("epl-4").getCos(), gold.getId()); + + epl_4.setCos(silver.getId()); + assertNotNull(repo.update(epl_4)); // update existing svc, same object + assertEquals(repo.get(epl_4.getId()).getCos(), silver.getId()); + + Epl epl_4_2 = new Epl(); + epl_4_2.setAllProps("epl-4", 4, locList4, uniList4, ipList4, bronze.getId(), "unset"); + assertNotNull(repo.update(epl_4_2)); // update svc, new object + assertEquals(repo.get(epl_4_2.getId()).getNumCustLocations(), 4); + } +} diff --git a/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient$1.class b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient$1.class new file mode 100644 index 0000000..bee6861 Binary files /dev/null and b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient$1.class differ diff --git a/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient.class b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient.class new file mode 100644 index 0000000..04b7db4 Binary files /dev/null and b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/client/EplClient.class differ diff --git a/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/model/Epl.class b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/model/Epl.class new file mode 100644 index 0000000..853209c Binary files /dev/null and b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/model/Epl.class differ diff --git a/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.class b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.class new file mode 100644 index 0000000..8d0d203 Binary files /dev/null and b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespository.class differ diff --git a/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.class b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.class new file mode 100644 index 0000000..bd2e9ef Binary files /dev/null and b/svc/svcbase/target/classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRespositoryInMem.class differ diff --git a/svc/svcbase/target/maven-archiver/pom.properties b/svc/svcbase/target/maven-archiver/pom.properties new file mode 100644 index 0000000..e6fee0f --- /dev/null +++ b/svc/svcbase/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Aug 06 14:01:20 PDT 2015 +version=1.0-SNAPSHOT +groupId=com.cablelabs.vcpe +artifactId=svcbase diff --git a/svc/svcbase/target/svcbase.jar b/svc/svcbase/target/svcbase.jar new file mode 100644 index 0000000..d3ef79a Binary files /dev/null and b/svc/svcbase/target/svcbase.jar differ diff --git a/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.class b/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.class new file mode 100644 index 0000000..e0df6f5 Binary files /dev/null and b/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/client/EplClientTest.class differ diff --git a/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.class b/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.class new file mode 100644 index 0000000..74b4913 Binary files /dev/null and b/svc/svcbase/target/test-classes/com/cablelabs/vcpe/svc/svcbase/repository/EplRepositoryTest.class differ diff --git a/svc/svcmgr/pom.xml b/svc/svcmgr/pom.xml new file mode 100644 index 0000000..2751749 --- /dev/null +++ b/svc/svcmgr/pom.xml @@ -0,0 +1,33 @@ + + + + com.cablelabs.vcpe + svc + 1.0-SNAPSHOT + + + 4.0.0 + + com.cablelabs.vcpe + svcmgr + war + 1.0-SNAPSHOT + + + svcmgr + + + + + com.cablelabs.vcpe + svcbase + 1.0-SNAPSHOT + + + com.cablelabs.vcpe + evcbase + 1.0-SNAPSHOT + + + diff --git a/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.java b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.java new file mode 100644 index 0000000..69a5f44 --- /dev/null +++ b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.java @@ -0,0 +1,24 @@ +package com.cablelabs.vcpe.svc.svcmgr; + +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; +import javax.ws.rs.core.MultivaluedMap; +import java.io.IOException; + +// +// enable cross origin responses, otherwise we can't send rest requests from domain different than that of the server hosting our service +// + +public class CORSResponseFilter implements ContainerResponseFilter { + + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) + throws IOException { + + MultivaluedMap headers = responseContext.getHeaders(); + headers.add("Access-Control-Allow-Origin", "*"); + headers.add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + headers.add("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Codingpedia"); + } + +} diff --git a/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java new file mode 100644 index 0000000..7f7510d --- /dev/null +++ b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java @@ -0,0 +1,213 @@ +package com.cablelabs.vcpe.svc.svcmgr; + + +import com.cablelabs.vcpe.common.Dbg; +import com.cablelabs.vcpe.evc.evcbase.client.EvcClient; +import com.cablelabs.vcpe.svc.svcbase.model.Epl; +import com.cablelabs.vcpe.svc.svcbase.repository.EplRespositoryInMem; +import com.cablelabs.vcpe.evc.evcbase.model.Evc; + + +import javax.ws.rs.*; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + +/** + * Root resource (exposed at "svc/epl" path) + */ + +@Path("svc/epl") +public class EplService { + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + //-------------------------------------------------------- + public Response create(Epl epl) + //-------------------------------------------------------- + { + if ( epl == null) { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + Dbg.p("\nADDING [" + epl.getId() + "] to epl repo"); + + // + // Create an EVC + // + + Evc evcForEpl = new Evc(); + + // Uni IDs set at lower layers + List uniIdList = new ArrayList(); + uniIdList.add("unset"); + uniIdList.add("unset"); + + // Transfer EPLs mac list to EVC + List uniMacList = new ArrayList(); + if (epl.getUniHostMacList() != null && epl.getUniHostMacList().size() == 2) { + uniMacList.add(epl.getUniHostMacList().get(0) ); + uniMacList.add(epl.getUniHostMacList().get(1)); + } + else { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + // Transfer EPLs I{P list to EVC + List uniIpList = new ArrayList(); + if (epl.getUniHostIpList() != null && epl.getUniHostIpList().size() == 2) { + uniIpList.add(epl.getUniHostIpList().get(0) ); + uniIpList.add(epl.getUniHostIpList().get(1)); + } + else { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + // evc mgr will set perf props based on CoS. We need to set everything else + evcForEpl.setAllNonPerfProps( "unset", // set by lower layer (id) + Evc.EvcType.POINT_TO_POINT, // required for EPL (evcType) + 2, // required for EPL (maxUnis) + uniIdList, // created above + uniMacList, uniIpList, // passed in + Evc.FrameDelivery.UNCONDITIONAL, // required for EPL (unicastFrameDelivery) + Evc.FrameDelivery.UNCONDITIONAL, // required for EPL (multicastFrameDelivery) + Evc.FrameDelivery.UNCONDITIONAL, // required for EPL (broadcastFrameDelivery) + true, // required for EPL (ceVLanIdPreservation) + true, // required for EPL (ceVlanCosPreservation) + 1600, // hard coded, need to figure out source !! + epl.getCos()); + + // send create request to EVC mgr + EvcClient evcClient = new EvcClient(); + evcForEpl= evcClient.create(evcForEpl); + + // EVC Layer generates the ID, we need to capture it + epl.setEvcId(evcForEpl.getId()); + + // Now add the EPL to our local repo + EplRespositoryInMem.INSTANCE.add(epl); + EplRespositoryInMem.INSTANCE.dump(0); + return Response.ok().entity(epl).build(); + } + + @PUT + @Path("{eplId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + //-------------------------------------------------------- + public Response update(Epl epl) + //-------------------------------------------------------- + { + Dbg.p("\nUPDATING [" + epl.getId()+"]"); + + EplRespositoryInMem.INSTANCE.update(epl); + EplRespositoryInMem.INSTANCE.dump(0); + return Response.ok().entity(epl).build(); + } + + @GET + @Path("{eplId}") + @Produces(MediaType.APPLICATION_JSON) + //-------------------------------------------------------- + public Response get( @PathParam("eplId") String eplId ) + //-------------------------------------------------------- + { + if ( eplId == null) { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + Dbg.p("\nRETRIEVING ["+eplId+"]"); + Epl epl = EplRespositoryInMem.INSTANCE.get(eplId); + if (epl == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + epl.dump(1); + return Response.ok().entity(epl).build(); + } + + @GET + @Path("list") + @Produces(MediaType.APPLICATION_JSON) + //-------------------------------------------------------- + public Response eplList() + //-------------------------------------------------------- + + // get a list of all Epl objects + { + Dbg.p("\nEPL GET ALL:"); + List eplList = EplRespositoryInMem.INSTANCE.getAll(); + if (eplList == null ) + { + return Response.status(Response.Status.NOT_FOUND).build(); + } + return Response.ok().entity(new GenericEntity>(eplList) {}).build(); + } + + @DELETE + @Path("{eplId}") + //-------------------------------------------------------- + public Response delete(@PathParam("eplId") String eplId) + //-------------------------------------------------------- + { + if ( eplId == null) { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + // grab the full EPL so that we can get EVC ID to delete + Epl epl = EplRespositoryInMem.INSTANCE.get(eplId); + if (epl == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + String evcId = epl.getEvcId(); + + // Delete the EVC associated with the EPL being deleted + EvcClient evcClient = new EvcClient(); + evcClient.delete(evcId); + + Dbg.p("\nDELETE:" + eplId); + EplRespositoryInMem.INSTANCE.delete(eplId); + EplRespositoryInMem.INSTANCE.dump(0); + return Response.ok().build(); + } + + @GET + @Produces(MediaType.APPLICATION_JSON) + //-------------------------------------------------------- + public Epl testGet() + //-------------------------------------------------------- + // simple get to check out json format + + { + long numLocations = 2; + + List locList = new ArrayList(); + locList.add("1111 MEF Dr, Honolulu HI, USA"); + locList.add("2222 MEF Dr, Boston MA, MAS"); + + List uniList = new ArrayList(); + uniList.add("00:0a:95:9d:68:16"); + uniList.add("00:A0:C9:14:C8:29"); + + List ipList = new ArrayList(); + ipList.add("192.168.1.10"); + ipList.add("192.168.1.10"); + + Epl epl = new Epl(); + epl.setAllProps("epl-1", numLocations, locList, uniList, ipList, "gold", "unset"); + return epl; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + //-------------------------------------------------------- + public String ping() + //-------------------------------------------------------- + // simple ping to check connectivity + + { + Dbg.p("In Epl Service: ping test"); + return "... pingEpl reponse"; + } +} diff --git a/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.java b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.java new file mode 100644 index 0000000..5d92220 --- /dev/null +++ b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.java @@ -0,0 +1,18 @@ +package com.cablelabs.vcpe.svc.svcmgr; + +import org.glassfish.jersey.server.ResourceConfig; + +// +// In order to avoid CORS issues, register our CORS Response filter +// + +public class SvcJaxRsApplication extends ResourceConfig { + + /** + * Register JAX-RS application components. + */ + public SvcJaxRsApplication() { + packages("com.cablelabs.vcpe.cos.cosmgr"); + register(CORSResponseFilter.class); + } +} \ No newline at end of file diff --git a/svc/svcmgr/src/main/webapp/WEB-INF/web.xml b/svc/svcmgr/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..06f0b7c --- /dev/null +++ b/svc/svcmgr/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Jersey Web Application + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + com.cablelabs.vcpe.svc + + + javax.ws.rs.Application + com.cablelabs.vcpe.svc.svcmgr.SvcJaxRsApplication + + 1 + + + Jersey Web Application + /webapi/* + + diff --git a/svc/svcmgr/src/main/webapp/index.jsp b/svc/svcmgr/src/main/webapp/index.jsp new file mode 100644 index 0000000..a064b45 --- /dev/null +++ b/svc/svcmgr/src/main/webapp/index.jsp @@ -0,0 +1,8 @@ + + +

Jersey RESTful Web Application!

+

Jersey resource +

Visit Project Jersey website + for more information on Jersey! + + diff --git a/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class new file mode 100644 index 0000000..343c9df Binary files /dev/null and b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class differ diff --git a/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class new file mode 100644 index 0000000..957dcbb Binary files /dev/null and b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class differ diff --git a/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class new file mode 100644 index 0000000..1ca9218 Binary files /dev/null and b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class differ diff --git a/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class new file mode 100644 index 0000000..c8b5d87 Binary files /dev/null and b/svc/svcmgr/target/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class differ diff --git a/svc/svcmgr/target/maven-archiver/pom.properties b/svc/svcmgr/target/maven-archiver/pom.properties new file mode 100644 index 0000000..858608e --- /dev/null +++ b/svc/svcmgr/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Aug 06 14:01:20 PDT 2015 +version=1.0-SNAPSHOT +groupId=com.cablelabs.vcpe +artifactId=svcmgr diff --git a/svc/svcmgr/target/svcmgr.war b/svc/svcmgr/target/svcmgr.war new file mode 100644 index 0000000..507df06 Binary files /dev/null and b/svc/svcmgr/target/svcmgr.war differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class new file mode 100644 index 0000000..343c9df Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/CORSResponseFilter.class differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class new file mode 100644 index 0000000..957dcbb Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService$1.class differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class new file mode 100644 index 0000000..1ca9218 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/EplService.class differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class new file mode 100644 index 0000000..c8b5d87 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/classes/com/cablelabs/vcpe/svc/svcmgr/SvcJaxRsApplication.class differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/asm-all-repackaged-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/asm-all-repackaged-2.2.0-b14.jar new file mode 100644 index 0000000..9c1f40d Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/asm-all-repackaged-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/cglib-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/cglib-2.2.0-b14.jar new file mode 100644 index 0000000..7d6963b Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/cglib-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/common-1.0-SNAPSHOT.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/common-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..267b07a Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/common-1.0-SNAPSHOT.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/cosbase-1.0-SNAPSHOT.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/cosbase-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..d991659 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/cosbase-1.0-SNAPSHOT.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/evcbase-1.0-SNAPSHOT.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/evcbase-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..f4f5b3a Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/evcbase-1.0-SNAPSHOT.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/guava-14.0.1.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/guava-14.0.1.jar new file mode 100644 index 0000000..3a3d925 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/guava-14.0.1.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-api-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-api-2.2.0-b14.jar new file mode 100644 index 0000000..acec5bc Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-api-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-locator-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-locator-2.2.0-b14.jar new file mode 100644 index 0000000..fb2687f Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-locator-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-utils-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-utils-2.2.0-b14.jar new file mode 100644 index 0000000..2c8df43 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/hk2-utils-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.annotation-api-1.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.annotation-api-1.2.jar new file mode 100644 index 0000000..9ab39ff Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.annotation-api-1.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.inject-2.2.0-b14.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.inject-2.2.0-b14.jar new file mode 100644 index 0000000..21463e7 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.inject-2.2.0-b14.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.ws.rs-api-2.0.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.ws.rs-api-2.0.jar new file mode 100644 index 0000000..b7d364b Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/javax.ws.rs-api-2.0.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-client-2.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-client-2.2.jar new file mode 100644 index 0000000..cab47b0 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-client-2.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-common-2.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-common-2.2.jar new file mode 100644 index 0000000..55d27ed Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-common-2.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-container-servlet-core-2.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-container-servlet-core-2.2.jar new file mode 100644 index 0000000..e03b5f9 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-container-servlet-core-2.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-media-moxy-2.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-media-moxy-2.2.jar new file mode 100644 index 0000000..786290a Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-media-moxy-2.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-server-2.2.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-server-2.2.jar new file mode 100644 index 0000000..37b3410 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/jersey-server-2.2.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar new file mode 100644 index 0000000..cff0ef8 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar new file mode 100644 index 0000000..832e18e Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar new file mode 100644 index 0000000..01bb838 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar new file mode 100644 index 0000000..29a1057 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/osgi-resource-locator-1.0.1.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/osgi-resource-locator-1.0.1.jar new file mode 100644 index 0000000..bd6aa17 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/osgi-resource-locator-1.0.1.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/svcbase-1.0-SNAPSHOT.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/svcbase-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..d3ef79a Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/svcbase-1.0-SNAPSHOT.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/lib/validation-api-1.1.0.Final.jar b/svc/svcmgr/target/svcmgr/WEB-INF/lib/validation-api-1.1.0.Final.jar new file mode 100644 index 0000000..de85403 Binary files /dev/null and b/svc/svcmgr/target/svcmgr/WEB-INF/lib/validation-api-1.1.0.Final.jar differ diff --git a/svc/svcmgr/target/svcmgr/WEB-INF/web.xml b/svc/svcmgr/target/svcmgr/WEB-INF/web.xml new file mode 100644 index 0000000..06f0b7c --- /dev/null +++ b/svc/svcmgr/target/svcmgr/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Jersey Web Application + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + com.cablelabs.vcpe.svc + + + javax.ws.rs.Application + com.cablelabs.vcpe.svc.svcmgr.SvcJaxRsApplication + + 1 + + + Jersey Web Application + /webapi/* + + diff --git a/svc/svcmgr/target/svcmgr/index.jsp b/svc/svcmgr/target/svcmgr/index.jsp new file mode 100644 index 0000000..a064b45 --- /dev/null +++ b/svc/svcmgr/target/svcmgr/index.jsp @@ -0,0 +1,8 @@ + + +

Jersey RESTful Web Application!

+

Jersey resource +

Visit Project Jersey website + for more information on Jersey! + + -- cgit 1.2.3-korg