diff options
Diffstat (limited to 'sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java')
4 files changed, 189 insertions, 0 deletions
diff --git a/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java new file mode 100644 index 0000000000..5f225462c9 --- /dev/null +++ b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java @@ -0,0 +1,39 @@ +/* + * 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 launch; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +public class Launch { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + String contribution = ContributionLocationHelper.getContributionLocation(Launch.class); + Node node = NodeFactory.newInstance().createNode("person.composite", new Contribution("test", contribution)); + node.start(); + System.out.println("person.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + node.stop(); + System.out.println(); + } +} diff --git a/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java new file mode 100644 index 0000000000..23df63588f --- /dev/null +++ b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java @@ -0,0 +1,82 @@ +/* + * 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 services; + +public class Person implements java.io.Serializable { + + private Integer id; + private String firstName; + private String lastName; + private String longitude; + private String latitude; + private String description; + + public Person() { + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getFirstName() { + return this.firstName; + } + + public String getLastName() { + return this.lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getLongatude() { + return this.longitude; + } + + public void setLongatude(String longatude) { + this.longitude = longatude; + } + + public String getLatitude() { + return this.latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public Integer getID() { + return this.id; + } + + public void setID(Integer id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java new file mode 100644 index 0000000000..9c547697ce --- /dev/null +++ b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java @@ -0,0 +1,28 @@ +/* + * 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 services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface PersonService { + void createPerson(Person person); + Person[] get(); +} diff --git a/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java new file mode 100644 index 0000000000..7a4e294264 --- /dev/null +++ b/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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 services; + +import java.util.ArrayList; +import java.util.List; + +public class PersonServiceImpl implements PersonService { + private List<Person> persons = new ArrayList<Person>(); + + @Override + public void createPerson(Person person) { + System.out.println("adding person " + person.getFirstName()); + persons.add(person); + + } + + public Person[] get() { + Person[] catalogArray = new Person[persons.size()]; + persons.toArray(catalogArray); + return catalogArray; + } +} |