From 5c98d4b72b0b261c8d81d0affe5c73e695ec9d44 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Tue, 16 Dec 2014 14:48:52 +0700 Subject: [PATCH 01/14] bikin project --- .gitignore | 6 + nbproject/ant-deploy.xml | 111 +++ nbproject/build-impl.xml | 1441 +++++++++++++++++++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/project.xml | 18 + src/conf/MANIFEST.MF | 2 + web/WEB-INF/web.xml | 24 + web/index.xhtml | 12 + 8 files changed, 1622 insertions(+) create mode 100644 .gitignore create mode 100644 nbproject/ant-deploy.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.xml create mode 100644 src/conf/MANIFEST.MF create mode 100644 web/WEB-INF/web.xml create mode 100644 web/index.xhtml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcdf490 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/build/ +/dist/ +/nbproject/project.properties +/nbproject/private +/build.xml +/nbproject/private/private.properties \ No newline at end of file diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 0000000..2d5f877 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..86f68fa --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1441 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..4dce024 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=268359da +build.xml.script.CRC32=8f798771 +build.xml.stylesheet.CRC32=651128d4@1.68.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=268359da +nbproject/build-impl.xml.script.CRC32=ea673f26 +nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..968a1f2 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.web.project + + + IF3110-03-Simple-Blog-Service + 1.6.5 + + + + + + + + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 0000000..c5e7c73 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/web/index.xhtml b/web/index.xhtml new file mode 100644 index 0000000..c70ee58 --- /dev/null +++ b/web/index.xhtml @@ -0,0 +1,12 @@ + + + + + Facelet Title + + + Hello from Facelets + + + From aaebc0574b882044b891ab910df483ff7da8dcb2 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Tue, 16 Dec 2014 15:24:19 +0700 Subject: [PATCH 02/14] ini --- .gitignore | 6 - build.xml | 71 ++++ catalog.xml | 4 + nbproject/genfiles.properties | 4 +- nbproject/jax-ws.xml | 7 + nbproject/private/private.properties | 7 + nbproject/private/private.xml | 9 + nbproject/project.properties | 90 ++++++ nbproject/project.xml | 1 + simpleblog.wsdl | 468 +++++++++++++++++++++++++++ 10 files changed, 659 insertions(+), 8 deletions(-) delete mode 100644 .gitignore create mode 100644 build.xml create mode 100644 catalog.xml create mode 100644 nbproject/jax-ws.xml create mode 100644 nbproject/private/private.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/project.properties create mode 100644 simpleblog.wsdl diff --git a/.gitignore b/.gitignore deleted file mode 100644 index dcdf490..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/build/ -/dist/ -/nbproject/project.properties -/nbproject/private -/build.xml -/nbproject/private/private.properties \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..332e1db --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project IF3110-03-Simple-Blog-Service. + + + diff --git a/catalog.xml b/catalog.xml new file mode 100644 index 0000000..f955c32 --- /dev/null +++ b/catalog.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 4dce024..a9d9fb5 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=268359da +build.xml.data.CRC32=055478b4 build.xml.script.CRC32=8f798771 build.xml.stylesheet.CRC32=651128d4@1.68.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=268359da +nbproject/build-impl.xml.data.CRC32=055478b4 nbproject/build-impl.xml.script.CRC32=ea673f26 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/jax-ws.xml b/nbproject/jax-ws.xml new file mode 100644 index 0000000..e5b479c --- /dev/null +++ b/nbproject/jax-ws.xml @@ -0,0 +1,7 @@ + + + + + + true + diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 0000000..cfd3be5 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,7 @@ +deploy.ant.properties.file=C:\\Users\\Mario\\AppData\\Roaming\\NetBeans\\8.0\\config\\GlassFishEE6\\Properties\\gfv3614672000.properties +j2ee.platform.is.jsr109=true +j2ee.server.domain=C:/Program Files/glassfish-4.0/glassfish/domains/domain1 +j2ee.server.home=C:/Program Files/glassfish-4.0/glassfish +j2ee.server.instance=[C:\\Program Files\\glassfish-4.0\\glassfish;C:\\Program Files\\glassfish-4.0\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848 +j2ee.server.middleware=C:/Program Files/glassfish-4.0 +user.properties.file=C:\\Users\\Mario\\AppData\\Roaming\\NetBeans\\8.0\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 0000000..caf7c4a --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,9 @@ + + + + + + file:/D:/STEI%20ITB/IF12/Semester%205/IF3110%20Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tugas%203/IF3110-03-Simple-Blog-Service/web/index.xhtml + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..e3dd352 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,90 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7-web +j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv3ee6 +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +no.dependencies=false +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=IF3110-03-Simple-Blog-Service.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml index 968a1f2..0b6ff2e 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -2,6 +2,7 @@ org.netbeans.modules.web.project + IF3110-03-Simple-Blog-Service 1.6.5 diff --git a/simpleblog.wsdl b/simpleblog.wsdl new file mode 100644 index 0000000..d8aa238 --- /dev/null +++ b/simpleblog.wsdl @@ -0,0 +1,468 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 9890f7f1e5084260cb39e747c4ae5d8e707a8474 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Tue, 16 Dec 2014 18:37:25 +0700 Subject: [PATCH 03/14] bikin web service --- .gitignore | 6 + nbproject/build-impl.xml | 3 +- nbproject/genfiles.properties | 7 +- nbproject/jax-ws.xml | 32 + nbproject/jaxws-build.xml | 49 + nbproject/project.xml | 6 +- simpleblog.wsdl | 863 +++++++++--------- .../simpleblog/wsdl/simpleblog.wsdl | 513 +++++++++++ src/java/paket/simpleblog.java | 82 ++ 9 files changed, 1147 insertions(+), 414 deletions(-) create mode 100644 .gitignore create mode 100644 nbproject/jaxws-build.xml create mode 100644 src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl create mode 100644 src/java/paket/simpleblog.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcdf490 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/build/ +/dist/ +/nbproject/project.properties +/nbproject/private +/build.xml +/nbproject/private/private.properties \ No newline at end of file diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 86f68fa..14e956f 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -18,6 +18,7 @@ --> + @@ -855,7 +856,7 @@ exists or setup the property manually. For example like this: - + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index a9d9fb5..ab2d786 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,9 @@ -build.xml.data.CRC32=055478b4 +build.xml.data.CRC32=2e68d076 build.xml.script.CRC32=8f798771 build.xml.stylesheet.CRC32=651128d4@1.68.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=055478b4 -nbproject/build-impl.xml.script.CRC32=ea673f26 +nbproject/build-impl.xml.data.CRC32=2e68d076 +nbproject/build-impl.xml.script.CRC32=2d68f85a nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 +nbproject/jaxws-build.xml.stylesheet.CRC32=6608c2cf diff --git a/nbproject/jax-ws.xml b/nbproject/jax-ws.xml index e5b479c..fb3cffe 100644 --- a/nbproject/jax-ws.xml +++ b/nbproject/jax-ws.xml @@ -1,6 +1,38 @@ + + paket.simpleblog + file:/D:/Project/GitHub/IF3110-03-Simple-Blog-Service/simpleblog.wsdl + simpleblog.wsdl + simpleblog + simpleblogPort + service + catalog.xml + false + + + extension + true + + + verbose + true + + + fork + false + + + xnocompile + true + + + xendorsed + true + + + true diff --git a/nbproject/jaxws-build.xml b/nbproject/jaxws-build.xml new file mode 100644 index 0000000..cc7b494 --- /dev/null +++ b/nbproject/jaxws-build.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.xml b/nbproject/project.xml index 0b6ff2e..96094b0 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -2,7 +2,11 @@ org.netbeans.modules.web.project - + + + + + IF3110-03-Simple-Blog-Service 1.6.5 diff --git a/simpleblog.wsdl b/simpleblog.wsdl index d8aa238..9ddbe0e 100644 --- a/simpleblog.wsdl +++ b/simpleblog.wsdl @@ -1,468 +1,513 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - + + + - - - + + + - - - + + + - - + + + - - - + + + - - - + + + - - - + + + - - - - - - + + + - - - + + + - - + + + - - + + + - - - - - - + + + - - + + + - - + + + - - + + + - - - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + - - - + + + + + - - - + + + + + - - - - - - - + + + + - - + + + + - - - - - - - + + + + + - - + + + + - - + + + + + + + + + + - - + + + + - - - - + + + + + - - + + + + + + + + + + - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + \ No newline at end of file diff --git a/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl b/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl new file mode 100644 index 0000000..9ddbe0e --- /dev/null +++ b/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl @@ -0,0 +1,513 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/java/paket/simpleblog.java b/src/java/paket/simpleblog.java new file mode 100644 index 0000000..15b8cf9 --- /dev/null +++ b/src/java/paket/simpleblog.java @@ -0,0 +1,82 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package paket; + +import javax.jws.WebService; + +/** + * + * @author Mario + */ +@WebService(serviceName = "simpleblog", portName = "simpleblogPort", endpointInterface = "service.Simpleblog", targetNamespace = "http://Service/", wsdlLocation = "WEB-INF/wsdl/simpleblog/simpleblog.wsdl") +public class simpleblog { + + public java.lang.Boolean addPost(java.lang.String judul, java.lang.String author, java.lang.String konten, java.lang.String tanggal) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean editUser(java.lang.String id, java.lang.String username, java.lang.String password, java.lang.String role, java.lang.String email) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.util.List listPost(java.lang.String postStatus) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean deletePost(java.lang.String id) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean addUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String role) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean restorePost(java.lang.String id) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean deleteUser(java.lang.String id) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean addComment(java.lang.String idPost, java.lang.String nama, java.lang.String email, java.lang.String komentar) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.util.List listUser() { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.util.List listComment(java.lang.String idPost) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean editPost(java.lang.String id, java.lang.String judul, java.lang.String author, java.lang.String konten, java.lang.String tanggal) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.util.List search(java.lang.String query) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + + public java.lang.Boolean publishPost(java.lang.String id) { + //TODO implement this method + throw new UnsupportedOperationException("Not implemented yet."); + } + +} From 8129f32a89be729056867a756111f61b5f03d813 Mon Sep 17 00:00:00 2001 From: runbow Date: Wed, 17 Dec 2014 11:31:32 +0700 Subject: [PATCH 04/14] maven project --- .gitignore | 6 - build.xml | 71 - catalog.xml | 4 - nb-configuration.xml | 18 + nbproject/ant-deploy.xml | 111 -- nbproject/build-impl.xml | 1442 ----------------- nbproject/genfiles.properties | 9 - nbproject/jax-ws.xml | 39 - nbproject/jaxws-build.xml | 49 - nbproject/private/private.properties | 7 - nbproject/private/private.xml | 9 - nbproject/project.properties | 90 - nbproject/project.xml | 23 - pom.xml | 76 + src/conf/MANIFEST.MF | 2 - .../simpleblog/wsdl/simpleblog.wsdl | 513 ------ src/java/paket/simpleblog.java | 82 - src/main/webapp/WEB-INF/beans.xml | 6 + src/main/webapp/index.html | 10 + web/WEB-INF/web.xml | 24 - web/index.xhtml | 12 - 21 files changed, 110 insertions(+), 2493 deletions(-) delete mode 100644 .gitignore delete mode 100644 build.xml delete mode 100644 catalog.xml create mode 100644 nb-configuration.xml delete mode 100644 nbproject/ant-deploy.xml delete mode 100644 nbproject/build-impl.xml delete mode 100644 nbproject/genfiles.properties delete mode 100644 nbproject/jax-ws.xml delete mode 100644 nbproject/jaxws-build.xml delete mode 100644 nbproject/private/private.properties delete mode 100644 nbproject/private/private.xml delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml create mode 100644 pom.xml delete mode 100644 src/conf/MANIFEST.MF delete mode 100644 src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl delete mode 100644 src/java/paket/simpleblog.java create mode 100644 src/main/webapp/WEB-INF/beans.xml create mode 100644 src/main/webapp/index.html delete mode 100644 web/WEB-INF/web.xml delete mode 100644 web/index.xhtml diff --git a/.gitignore b/.gitignore deleted file mode 100644 index dcdf490..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/build/ -/dist/ -/nbproject/project.properties -/nbproject/private -/build.xml -/nbproject/private/private.properties \ No newline at end of file diff --git a/build.xml b/build.xml deleted file mode 100644 index 332e1db..0000000 --- a/build.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project IF3110-03-Simple-Blog-Service. - - - diff --git a/catalog.xml b/catalog.xml deleted file mode 100644 index f955c32..0000000 --- a/catalog.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/nb-configuration.xml b/nb-configuration.xml new file mode 100644 index 0000000..2b89226 --- /dev/null +++ b/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + 1.7-web + + diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml deleted file mode 100644 index 2d5f877..0000000 --- a/nbproject/ant-deploy.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml deleted file mode 100644 index 14e956f..0000000 --- a/nbproject/build-impl.xml +++ /dev/null @@ -1,1442 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set build.web.dir - Must set build.generated.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.war - - - - - - - - - -The Java EE server classpath is not correctly set up - server home directory is missing. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Dj2ee.server.home=<app_server_installation_directory> - - -The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) -or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The libs.CopyLibs.classpath property is not set up. -This property must point to -org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part -of NetBeans IDE installation and is usually located at -<netbeans_installation>/java<version>/ant/extra folder. -Either open the project in the IDE and make sure CopyLibs library -exists or setup the property manually. For example like this: - ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.jsp.includes - - - - - - - - - - - - - - - - - - - - - - - - - - Must select a file in the IDE or set jsp.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. - - - Launching ${browse.url} - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties deleted file mode 100644 index ab2d786..0000000 --- a/nbproject/genfiles.properties +++ /dev/null @@ -1,9 +0,0 @@ -build.xml.data.CRC32=2e68d076 -build.xml.script.CRC32=8f798771 -build.xml.stylesheet.CRC32=651128d4@1.68.1.1 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=2e68d076 -nbproject/build-impl.xml.script.CRC32=2d68f85a -nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 -nbproject/jaxws-build.xml.stylesheet.CRC32=6608c2cf diff --git a/nbproject/jax-ws.xml b/nbproject/jax-ws.xml deleted file mode 100644 index fb3cffe..0000000 --- a/nbproject/jax-ws.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - paket.simpleblog - file:/D:/Project/GitHub/IF3110-03-Simple-Blog-Service/simpleblog.wsdl - simpleblog.wsdl - simpleblog - simpleblogPort - service - catalog.xml - false - - - extension - true - - - verbose - true - - - fork - false - - - xnocompile - true - - - xendorsed - true - - - - - - true - diff --git a/nbproject/jaxws-build.xml b/nbproject/jaxws-build.xml deleted file mode 100644 index cc7b494..0000000 --- a/nbproject/jaxws-build.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties deleted file mode 100644 index cfd3be5..0000000 --- a/nbproject/private/private.properties +++ /dev/null @@ -1,7 +0,0 @@ -deploy.ant.properties.file=C:\\Users\\Mario\\AppData\\Roaming\\NetBeans\\8.0\\config\\GlassFishEE6\\Properties\\gfv3614672000.properties -j2ee.platform.is.jsr109=true -j2ee.server.domain=C:/Program Files/glassfish-4.0/glassfish/domains/domain1 -j2ee.server.home=C:/Program Files/glassfish-4.0/glassfish -j2ee.server.instance=[C:\\Program Files\\glassfish-4.0\\glassfish;C:\\Program Files\\glassfish-4.0\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848 -j2ee.server.middleware=C:/Program Files/glassfish-4.0 -user.properties.file=C:\\Users\\Mario\\AppData\\Roaming\\NetBeans\\8.0\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml deleted file mode 100644 index caf7c4a..0000000 --- a/nbproject/private/private.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - file:/D:/STEI%20ITB/IF12/Semester%205/IF3110%20Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tugas%203/IF3110-03-Simple-Blog-Service/web/index.xhtml - - - diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index e3dd352..0000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,90 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=true -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets -build.classes.dir=${build.web.dir}/WEB-INF/classes -build.classes.excludes=**/*.java,**/*.form -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -build.web.dir=${build.dir}/web -build.web.excludes=${build.classes.excludes} -client.urlPart= -compile.jsps=false -conf.dir=${source.root}/conf -debug.classpath=${build.classes.dir}:${javac.classpath} -debug.test.classpath=\ - ${run.test.classpath} -display.browser=true -# Files to be excluded from distribution war -dist.archive.excludes= -dist.dir=dist -dist.ear.war=${dist.dir}/${war.ear.name} -dist.javadoc.dir=${dist.dir}/javadoc -dist.war=${dist.dir}/${war.name} -endorsed.classpath=\ - ${libs.javaee-endorsed-api-6.0.classpath} -excludes= -includes=** -j2ee.compile.on.save=true -j2ee.copy.static.files.on.save=true -j2ee.deploy.on.save=true -j2ee.platform=1.7-web -j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar -j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar -j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar -j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar -j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar -j2ee.platform.wsit.classpath= -j2ee.server.type=gfv3ee6 -jar.compress=false -javac.classpath= -# Space-separated list of extra javac options -javac.compilerargs= -javac.debug=true -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.preview=true -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -lib.dir=${web.docbase.dir}/WEB-INF/lib -no.dependencies=false -persistence.xml.dir=${conf.dir} -platform.active=default_platform -resource.dir=setup -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -# Space-separated list of JVM arguments used when running a class with a main method or a unit test -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): -runmain.jvmargs= -source.encoding=UTF-8 -source.root=src -src.dir=${source.root}/java -test.src.dir=test -war.content.additional= -war.ear.name=${war.name} -war.name=IF3110-03-Simple-Blog-Service.war -web.docbase.dir=web -webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index 96094b0..0000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - org.netbeans.modules.web.project - - - - - - - - IF3110-03-Simple-Blog-Service - 1.6.5 - - - - - - - - - - - diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6ee12b8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + com.mycompany + IF3110-03-Simple-Blog-Service + 1.0-SNAPSHOT + war + + IF3110-03-Simple-Blog-Service + + + ${project.build.directory}/endorsed + UTF-8 + + + + + javax + javaee-web-api + 7.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF deleted file mode 100644 index 59499bc..0000000 --- a/src/conf/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl b/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl deleted file mode 100644 index 9ddbe0e..0000000 --- a/src/conf/xml-resources/web-services/simpleblog/wsdl/simpleblog.wsdl +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/java/paket/simpleblog.java b/src/java/paket/simpleblog.java deleted file mode 100644 index 15b8cf9..0000000 --- a/src/java/paket/simpleblog.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package paket; - -import javax.jws.WebService; - -/** - * - * @author Mario - */ -@WebService(serviceName = "simpleblog", portName = "simpleblogPort", endpointInterface = "service.Simpleblog", targetNamespace = "http://Service/", wsdlLocation = "WEB-INF/wsdl/simpleblog/simpleblog.wsdl") -public class simpleblog { - - public java.lang.Boolean addPost(java.lang.String judul, java.lang.String author, java.lang.String konten, java.lang.String tanggal) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean editUser(java.lang.String id, java.lang.String username, java.lang.String password, java.lang.String role, java.lang.String email) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.util.List listPost(java.lang.String postStatus) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean deletePost(java.lang.String id) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean addUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String role) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean restorePost(java.lang.String id) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean deleteUser(java.lang.String id) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean addComment(java.lang.String idPost, java.lang.String nama, java.lang.String email, java.lang.String komentar) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.util.List listUser() { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.util.List listComment(java.lang.String idPost) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean editPost(java.lang.String id, java.lang.String judul, java.lang.String author, java.lang.String konten, java.lang.String tanggal) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.util.List search(java.lang.String query) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - - public java.lang.Boolean publishPost(java.lang.String id) { - //TODO implement this method - throw new UnsupportedOperationException("Not implemented yet."); - } - -} diff --git a/src/main/webapp/WEB-INF/beans.xml b/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..ba9b101 --- /dev/null +++ b/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html new file mode 100644 index 0000000..3368e9c --- /dev/null +++ b/src/main/webapp/index.html @@ -0,0 +1,10 @@ + + + + Start Page + + + +

Hello World!

+ + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml deleted file mode 100644 index c5e7c73..0000000 --- a/web/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - javax.faces.PROJECT_STAGE - Development - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - - 30 - - - - faces/index.xhtml - - diff --git a/web/index.xhtml b/web/index.xhtml deleted file mode 100644 index c70ee58..0000000 --- a/web/index.xhtml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Facelet Title - - - Hello from Facelets - - - From 0220e7dd83c8f29fa2d9f7cd679fbd16df884b76 Mon Sep 17 00:00:00 2001 From: runbow Date: Wed, 17 Dec 2014 12:17:02 +0700 Subject: [PATCH 05/14] wsdl --- .gitignore | 1 + pom.xml | 6 + simpleblog.wsdl | 2 +- src/jax-ws-catalog.xml | 4 + src/main/java/paket/simpleblog.java | 148 ++++++++ src/wsdl/simpleblog.wsdl | 513 ++++++++++++++++++++++++++++ 6 files changed, 673 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 src/jax-ws-catalog.xml create mode 100644 src/main/java/paket/simpleblog.java create mode 100644 src/wsdl/simpleblog.wsdl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6f89c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6ee12b8..cd457b4 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,12 @@ + + com.sun.xml.ws + webservices-rt + 1.4 + provided + javax javaee-web-api diff --git a/simpleblog.wsdl b/simpleblog.wsdl index 9ddbe0e..ed3546c 100644 --- a/simpleblog.wsdl +++ b/simpleblog.wsdl @@ -71,7 +71,7 @@ - + diff --git a/src/jax-ws-catalog.xml b/src/jax-ws-catalog.xml new file mode 100644 index 0000000..dc9ab3e --- /dev/null +++ b/src/jax-ws-catalog.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java new file mode 100644 index 0000000..3a1d3e5 --- /dev/null +++ b/src/main/java/paket/simpleblog.java @@ -0,0 +1,148 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package paket; + +import java.util.Formatter; +import javax.jws.WebService; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * + * @author TOSHIBA + */ +@WebService(serviceName = "simpleblog") +public class simpleblog { + + /** + * This is a sample web service operation + */ + @WebMethod(operationName = "hello") + public String hello(@WebParam(name = "name") String txt) { + return "Hello " + txt + " !"; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "listPost") + public String listPost() { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "deletePost") + public Boolean deletePost(@WebParam(name = "id") Integer id) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "publishPost") + public Boolean publishPost(@WebParam(name = "id") Integer id) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "addUser") + public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "role") String role) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "listUser") + public String listUser() { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "editUser") + public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nama") String nama, @WebParam(name = "role") String role, @WebParam(name = "email") String email) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "deleteUser") + public Boolean deleteUser(@WebParam(name = "id") Integer id) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "addComment") + public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "konten") String konten) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "listComment") + public String listComment() { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "deleteComment") + public Boolean deleteComment(@WebParam(name = "id") Integer id) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "search") + public String search(@WebParam(name = "query") String query) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "addPost") + public Boolean addPost(@WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") XMLGregorianCalendar tanggal) { + //TODO write your implementation code here: + return null; + } + + /** + * Web service operation + */ + @WebMethod(operationName = "editPost") + @RequestWrapper(className = "paket.editPost") + @ResponseWrapper(className = "paket.editPostResponse") + public Boolean editPost(@WebParam(name = "id") Integer id, @WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") XMLGregorianCalendar tanggal) { + //TODO write your implementation code here: + return null; + } +} diff --git a/src/wsdl/simpleblog.wsdl b/src/wsdl/simpleblog.wsdl new file mode 100644 index 0000000..459601f --- /dev/null +++ b/src/wsdl/simpleblog.wsdl @@ -0,0 +1,513 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 661ba0e8a78206496940327ac2c2367d4162ef6d Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Wed, 17 Dec 2014 13:40:30 +0700 Subject: [PATCH 06/14] adding dependency --- pom.xml | 5 +++++ src/main/java/paket/simpleblog.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index cd457b4..1f74b7f 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,11 @@ 7.0 provided + + com.firebase + firebase-client-jvm + 2.0.3 + diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index 3a1d3e5..70daea9 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -4,6 +4,7 @@ */ package paket; +import com.firebase.client.Firebase; import java.util.Formatter; import javax.jws.WebService; import javax.jws.WebMethod; @@ -19,6 +20,13 @@ @WebService(serviceName = "simpleblog") public class simpleblog { + private Firebase fbase; + String dbname = "https://sizzling-heat-3244.firebaseio.com/"; + + public simpleblog(){ + fbase = new Firebase(dbname); + } + /** * This is a sample web service operation */ From db3020217b750b797c6beb175d6f46f3fa71746c Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Wed, 17 Dec 2014 13:53:13 +0700 Subject: [PATCH 07/14] tambah kelas --- src/main/java/paket/Comment.java | 55 +++++++++++++++++++++++++ src/main/java/paket/Post.java | 64 +++++++++++++++++++++++++++++ src/main/java/paket/User.java | 57 +++++++++++++++++++++++++ src/main/java/paket/simpleblog.java | 8 ---- 4 files changed, 176 insertions(+), 8 deletions(-) create mode 100644 src/main/java/paket/Comment.java create mode 100644 src/main/java/paket/Post.java create mode 100644 src/main/java/paket/User.java diff --git a/src/main/java/paket/Comment.java b/src/main/java/paket/Comment.java new file mode 100644 index 0000000..3b16ed0 --- /dev/null +++ b/src/main/java/paket/Comment.java @@ -0,0 +1,55 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package paket; + +/** + * + * @author Mario + */ +public class Comment { + + String tanggal, konten, id, email, nama; + + public String getTanggal() { + return tanggal; + } + + public void setTanggal(String tanggal) { + this.tanggal = tanggal; + } + + public String getKonten() { + return konten; + } + + public void setKonten(String konten) { + this.konten = konten; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getNama() { + return nama; + } + + public void setNama(String nama) { + this.nama = nama; + } +} diff --git a/src/main/java/paket/Post.java b/src/main/java/paket/Post.java new file mode 100644 index 0000000..c621fe9 --- /dev/null +++ b/src/main/java/paket/Post.java @@ -0,0 +1,64 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package paket; + +/** + * + * @author Mario + */ +public class Post { + + String judul, tanggal, konten, id; + Boolean ispublished, del; + + public String getJudul() { + return judul; + } + + public void setJudul(String judul) { + this.judul = judul; + } + + public String getTanggal() { + return tanggal; + } + + public void setTanggal(String tanggal) { + this.tanggal = tanggal; + } + + public String getKonten() { + return konten; + } + + public void setKonten(String konten) { + this.konten = konten; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Boolean getIspublished() { + return ispublished; + } + + public void setIspublished(Boolean ispublished) { + this.ispublished = ispublished; + } + + public Boolean getDel() { + return del; + } + + public void setDel(Boolean del) { + this.del = del; + } +} diff --git a/src/main/java/paket/User.java b/src/main/java/paket/User.java new file mode 100644 index 0000000..8d535b8 --- /dev/null +++ b/src/main/java/paket/User.java @@ -0,0 +1,57 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package paket; + +/** + * + * @author Mario + */ +public class User { + + String nama, email, role, pass; + Integer id; + + public String getNama() { + return nama; + } + + public void setNama(String nama) { + this.nama = nama; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getPass() { + return pass; + } + + public void setPass(String pass) { + this.pass = pass; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index 70daea9..f9cc88c 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -27,14 +27,6 @@ public simpleblog(){ fbase = new Firebase(dbname); } - /** - * This is a sample web service operation - */ - @WebMethod(operationName = "hello") - public String hello(@WebParam(name = "name") String txt) { - return "Hello " + txt + " !"; - } - /** * Web service operation */ From 9a5103e5b8ab8583e2e1d90688e03e3a4ee6fbc5 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Wed, 17 Dec 2014 14:03:04 +0700 Subject: [PATCH 08/14] edit return value --- src/main/java/paket/simpleblog.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index f9cc88c..d048342 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -5,6 +5,7 @@ package paket; import com.firebase.client.Firebase; +import java.util.ArrayList; import java.util.Formatter; import javax.jws.WebService; import javax.jws.WebMethod; @@ -31,7 +32,7 @@ public simpleblog(){ * Web service operation */ @WebMethod(operationName = "listPost") - public String listPost() { + public ArrayList listPost() { //TODO write your implementation code here: return null; } @@ -67,7 +68,7 @@ public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "e * Web service operation */ @WebMethod(operationName = "listUser") - public String listUser() { + public ArrayList listUser() { //TODO write your implementation code here: return null; } @@ -103,7 +104,7 @@ public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = * Web service operation */ @WebMethod(operationName = "listComment") - public String listComment() { + public ArrayList listComment() { //TODO write your implementation code here: return null; } @@ -121,7 +122,7 @@ public Boolean deleteComment(@WebParam(name = "id") Integer id) { * Web service operation */ @WebMethod(operationName = "search") - public String search(@WebParam(name = "query") String query) { + public ArrayList search(@WebParam(name = "query") String query) { //TODO write your implementation code here: return null; } From 60744c1f7468ec2ae17c3d59081db6fdcb2ebc0b Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Wed, 17 Dec 2014 18:14:49 +0700 Subject: [PATCH 09/14] add some tag --- src/main/java/paket/simpleblog.java | 89 +++++++++++++++++++++++------ src/main/webapp/index.html | 10 ---- src/main/webapp/index.xhtml | 16 ++++++ 3 files changed, 89 insertions(+), 26 deletions(-) delete mode 100644 src/main/webapp/index.html create mode 100644 src/main/webapp/index.xhtml diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index d048342..0c05d71 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -7,6 +7,8 @@ import com.firebase.client.Firebase; import java.util.ArrayList; import java.util.Formatter; +import java.util.HashMap; +import java.util.Map; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; @@ -21,15 +23,16 @@ @WebService(serviceName = "simpleblog") public class simpleblog { - private Firebase fbase; + private final Firebase fbase; String dbname = "https://sizzling-heat-3244.firebaseio.com/"; - - public simpleblog(){ - fbase = new Firebase(dbname); + + public simpleblog() { + this.fbase = new Firebase(dbname); } - + /** * Web service operation + * @return */ @WebMethod(operationName = "listPost") public ArrayList listPost() { @@ -39,15 +42,20 @@ public ArrayList listPost() { /** * Web service operation + * @param id + * @return */ @WebMethod(operationName = "deletePost") public Boolean deletePost(@WebParam(name = "id") Integer id) { - //TODO write your implementation code here: - return null; + Firebase post = fbase.child("post").child(id.toString()); + post.removeValue(); + return true; } /** * Web service operation + * @param id + * @return */ @WebMethod(operationName = "publishPost") public Boolean publishPost(@WebParam(name = "id") Integer id) { @@ -57,15 +65,27 @@ public Boolean publishPost(@WebParam(name = "id") Integer id) { /** * Web service operation + * @param nama + * @param email + * @param role + * @param password + * @return */ @WebMethod(operationName = "addUser") - public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "role") String role) { - //TODO write your implementation code here: - return null; + public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "role") String role, @WebParam(name = "password") String password) { + Firebase users = fbase.child("user"); + HashMap newUser = new HashMap<>(); + newUser.put("nama", nama); + newUser.put("email", email); + newUser.put("role", role); + newUser.put("password", password); + users.push().setValue(newUser); + return true; } /** * Web service operation + * @return */ @WebMethod(operationName = "listUser") public ArrayList listUser() { @@ -75,6 +95,11 @@ public ArrayList listUser() { /** * Web service operation + * @param id + * @param nama + * @param role + * @param email + * @return */ @WebMethod(operationName = "editUser") public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nama") String nama, @WebParam(name = "role") String role, @WebParam(name = "email") String email) { @@ -84,6 +109,8 @@ public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nam /** * Web service operation + * @param id + * @return */ @WebMethod(operationName = "deleteUser") public Boolean deleteUser(@WebParam(name = "id") Integer id) { @@ -93,6 +120,10 @@ public Boolean deleteUser(@WebParam(name = "id") Integer id) { /** * Web service operation + * @param nama + * @param email + * @param konten + * @return */ @WebMethod(operationName = "addComment") public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "konten") String konten) { @@ -102,6 +133,7 @@ public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = /** * Web service operation + * @return */ @WebMethod(operationName = "listComment") public ArrayList listComment() { @@ -111,6 +143,8 @@ public ArrayList listComment() { /** * Web service operation + * @param id + * @return */ @WebMethod(operationName = "deleteComment") public Boolean deleteComment(@WebParam(name = "id") Integer id) { @@ -120,6 +154,8 @@ public Boolean deleteComment(@WebParam(name = "id") Integer id) { /** * Web service operation + * @param query + * @return */ @WebMethod(operationName = "search") public ArrayList search(@WebParam(name = "query") String query) { @@ -129,21 +165,42 @@ public ArrayList search(@WebParam(name = "query") String query) { /** * Web service operation + * @param judul + * @param konten + * @param tanggal + * @return */ @WebMethod(operationName = "addPost") - public Boolean addPost(@WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") XMLGregorianCalendar tanggal) { - //TODO write your implementation code here: - return null; + public Boolean addPost(@WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") String tanggal) { + Firebase posts = fbase.child("post"); + Map newPost = new HashMap<>(); + newPost.put("judul", judul); + newPost.put("konten", konten); + newPost.put("tanggal", tanggal); + newPost.put("published", false); + newPost.put("deleted", false); + posts.push().setValue(newPost); + return true; } /** * Web service operation + * @param id + * @param judul + * @param konten + * @param tanggal + * @return */ @WebMethod(operationName = "editPost") @RequestWrapper(className = "paket.editPost") @ResponseWrapper(className = "paket.editPostResponse") - public Boolean editPost(@WebParam(name = "id") Integer id, @WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") XMLGregorianCalendar tanggal) { - //TODO write your implementation code here: - return null; + public Boolean editPost(@WebParam(name = "id") Integer id, @WebParam(name = "judul") String judul, @WebParam(name = "konten") String konten, @WebParam(name = "tanggal") String tanggal) { + Firebase post = fbase.child("post").child(id.toString()); + Map newPost = new HashMap<>(); + newPost.put("judul", judul); + newPost.put("konten", konten); + newPost.put("tanggal", tanggal); + post.updateChildren(newPost); + return true; } } diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html deleted file mode 100644 index 3368e9c..0000000 --- a/src/main/webapp/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - Start Page - - - -

Hello World!

- - diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml new file mode 100644 index 0000000..a1c8f6f --- /dev/null +++ b/src/main/webapp/index.xhtml @@ -0,0 +1,16 @@ + + + + + + TODO supply a title + + + +
TODO write content
+ + From 32f7c34189557e842cccd5161c7d8d2f29978ae4 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Thu, 18 Dec 2014 03:44:55 +0700 Subject: [PATCH 10/14] setup --- {assets => old files/assets}/css/screen.css | 0 {assets => old files/assets}/img/favicon.ico | Bin {assets => old files/assets}/img/pre.png | Bin index.html => old files/index.html | 0 new_post.html => old files/new_post.html | 0 post.html => old files/post.html | 0 pom.xml | 54 ++ simpleblog.wsdl | 513 ------------------ .../chamerling/heroku/jetty/JettyServer.java | 39 ++ .../heroku/service/HelloService.java | 18 + .../heroku/service/HelloServiceImpl.java | 20 + src/main/webapp/WEB-INF/beans.xml | 32 +- src/main/webapp/WEB-INF/web.xml | 33 ++ src/main/webapp/index.xhtml | 16 - 14 files changed, 191 insertions(+), 534 deletions(-) rename {assets => old files/assets}/css/screen.css (100%) rename {assets => old files/assets}/img/favicon.ico (100%) rename {assets => old files/assets}/img/pre.png (100%) rename index.html => old files/index.html (100%) rename new_post.html => old files/new_post.html (100%) rename post.html => old files/post.html (100%) delete mode 100644 simpleblog.wsdl create mode 100644 src/main/java/org/chamerling/heroku/jetty/JettyServer.java create mode 100644 src/main/java/org/chamerling/heroku/service/HelloService.java create mode 100644 src/main/java/org/chamerling/heroku/service/HelloServiceImpl.java create mode 100644 src/main/webapp/WEB-INF/web.xml delete mode 100644 src/main/webapp/index.xhtml diff --git a/assets/css/screen.css b/old files/assets/css/screen.css similarity index 100% rename from assets/css/screen.css rename to old files/assets/css/screen.css diff --git a/assets/img/favicon.ico b/old files/assets/img/favicon.ico similarity index 100% rename from assets/img/favicon.ico rename to old files/assets/img/favicon.ico diff --git a/assets/img/pre.png b/old files/assets/img/pre.png similarity index 100% rename from assets/img/pre.png rename to old files/assets/img/pre.png diff --git a/index.html b/old files/index.html similarity index 100% rename from index.html rename to old files/index.html diff --git a/new_post.html b/old files/new_post.html similarity index 100% rename from new_post.html rename to old files/new_post.html diff --git a/post.html b/old files/post.html similarity index 100% rename from post.html rename to old files/post.html diff --git a/pom.xml b/pom.xml index 1f74b7f..b6be9f8 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,60 @@ firebase-client-jvm 2.0.3 + + org.eclipse.jetty + jetty-server + 8.0.0.RC0 + + + org.eclipse.jetty + jetty-webapp + 8.0.0.RC0 + + + org.apache.cxf + cxf-rt-frontend-jaxws + 2.4.2 + + + org.apache.cxf + cxf-rt-transports-http + 2.4.2 + + + com.sun.xml.bind + jaxb-impl + 2.2.4-1 + + + + org.apache.cxf + cxf-bundle-jaxrs + 2.4.2 + + + org.eclipse.jetty + jetty-security + + + org.eclipse.jetty + jetty-io + + + org.eclipse.jetty + jetty-util + + + org.eclipse.jetty + jetty-continuation + + + org.eclipse.jetty + jetty-http + + + + diff --git a/simpleblog.wsdl b/simpleblog.wsdl deleted file mode 100644 index ed3546c..0000000 --- a/simpleblog.wsdl +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/org/chamerling/heroku/jetty/JettyServer.java b/src/main/java/org/chamerling/heroku/jetty/JettyServer.java new file mode 100644 index 0000000..569a557 --- /dev/null +++ b/src/main/java/org/chamerling/heroku/jetty/JettyServer.java @@ -0,0 +1,39 @@ +package org.chamerling.heroku.jetty; + +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.webapp.WebAppContext; +public class JettyServer { + /** + * @param args + */ + public static void main(String[] args) throws Exception{ + String webappDirLocation = "src/main/webapp/"; + + //The port that we should run on can be set into an environment variable + //Look for that variable and default to 8080 if it isn't there. + String webPort = System.getenv("PORT"); + if(webPort == null || webPort.isEmpty()) { + webPort = "9191"; + } + + Server server = new Server(Integer.valueOf(webPort)); + WebAppContext root = new WebAppContext(); + + root.setContextPath("/"); + root.setDescriptor(webappDirLocation+"/WEB-INF/web.xml"); + root.setResourceBase(webappDirLocation); + + //Parent loader priority is a class loader setting that Jetty accepts. + //By default Jetty will behave like most web containers in that it will + //allow your application to replace non-server libraries that are part of the + //container. Setting parent loader priority to true changes this behavior. + //Read more here: http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading + root.setParentLoaderPriority(true); + + server.setHandler(root); + + server.start(); + server.join(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/chamerling/heroku/service/HelloService.java b/src/main/java/org/chamerling/heroku/service/HelloService.java new file mode 100644 index 0000000..9b99b8d --- /dev/null +++ b/src/main/java/org/chamerling/heroku/service/HelloService.java @@ -0,0 +1,18 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.chamerling.heroku.service; + +import javax.jws.WebService; + +/** + * @author chamerling + * + */ +@WebService +public interface HelloService { + + String sayHi(String input); +} \ No newline at end of file diff --git a/src/main/java/org/chamerling/heroku/service/HelloServiceImpl.java b/src/main/java/org/chamerling/heroku/service/HelloServiceImpl.java new file mode 100644 index 0000000..d4a041a --- /dev/null +++ b/src/main/java/org/chamerling/heroku/service/HelloServiceImpl.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.chamerling.heroku.service; + +/** + * @author chamerling + * + */ +public class HelloServiceImpl implements HelloService { + + @Override + public String sayHi(String input) { + System.out.println("Hello invoked : " + input); + return String.format("Hello '%s'", input); + } + +} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/beans.xml b/src/main/webapp/WEB-INF/beans.xml index ba9b101..6d081c1 100644 --- a/src/main/webapp/WEB-INF/beans.xml +++ b/src/main/webapp/WEB-INF/beans.xml @@ -1,6 +1,28 @@ - - + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..f3c7499 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,33 @@ + + + + + + + + contextConfigLocation + WEB-INF/beans.xml + + + + + org.springframework.web.context.ContextLoaderListener + + + + + CXFServlet + IF3110-II-29 SimpleBlog Service + + org.apache.cxf.transport.servlet.CXFServlet + + 1 + + + + CXFServlet + /* + + \ No newline at end of file diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml deleted file mode 100644 index a1c8f6f..0000000 --- a/src/main/webapp/index.xhtml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - TODO supply a title - - - -
TODO write content
- - From 5ca186adf812a5a2b1b867dbb4080af806803c34 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Thu, 18 Dec 2014 03:51:32 +0700 Subject: [PATCH 11/14] Procfile --- Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..31afc8d --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: sh target/bin/webapp \ No newline at end of file From 4542a77cb208faa4d07ce0602e1ab67b9c8cd85f Mon Sep 17 00:00:00 2001 From: runbow Date: Thu, 18 Dec 2014 20:51:04 +0700 Subject: [PATCH 12/14] bisa kirim data --- .gitignore | 3 +- nb-configuration.xml | 1 + pom.xml | 52 +- src/jax-ws-catalog.xml | 1 + src/main/java/paket/Post.java | 11 + src/main/java/paket/simpleblog.java | 102 +++- src/main/webapp/WEB-INF/glassfish-web.xml | 10 + .../simpleblog.wsdl | 523 ++++++++++++++++++ 8 files changed, 683 insertions(+), 20 deletions(-) create mode 100644 src/main/webapp/WEB-INF/glassfish-web.xml create mode 100644 src/wsdl/localhost_8080/IF3110-03-Simple-Blog-Service/simpleblog.wsdl diff --git a/.gitignore b/.gitignore index a6f89c2..25511a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/target/ \ No newline at end of file +/target/ +/new/IF3110-03-Simple-Blog-Service/nbproject/private/ \ No newline at end of file diff --git a/nb-configuration.xml b/nb-configuration.xml index 2b89226..00d593e 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -14,5 +14,6 @@ That way multiple projects can share the same settings (useful for formatting ru Any value defined here will override the pom.xml file value but is only applicable to the current project. --> 1.7-web + http://localhost:8080/IF3110-03-Simple-Blog-Service/simpleblog?wsdl diff --git a/pom.xml b/pom.xml index b6be9f8..5f6cc30 100644 --- a/pom.xml +++ b/pom.xml @@ -29,9 +29,14 @@ com.firebase - firebase-client-jvm + firebase-client-android 2.0.3 + + org.json + json + 20090211 + org.eclipse.jetty jetty-server @@ -108,6 +113,16 @@ 2.3 false + + + src + WEB-INF + + jax-ws-catalog.xml + wsdl/** + + + @@ -135,6 +150,41 @@ + + org.jvnet.jax-ws-commons + jaxws-maven-plugin + 2.2.1 + + + + wsimport + + + + localhost_8080/IF3110-03-Simple-Blog-Service/simpleblog.wsdl + + http://localhost:8080/IF3110-03-Simple-Blog-Service/simpleblog?wsdl + ${project.build.directory}/jaxws/stale/simpleblog.stale + + wsimport-generate-simpleblog + generate-sources + + + + + javax.xml + webservices-api + 1.4 + + + + ${project.build.directory}/generated-sources/jaxws-wsimport + true + true + true + ${basedir}/src/jax-ws-catalog.xml + +
diff --git a/src/jax-ws-catalog.xml b/src/jax-ws-catalog.xml index dc9ab3e..cb0d492 100644 --- a/src/jax-ws-catalog.xml +++ b/src/jax-ws-catalog.xml @@ -1,4 +1,5 @@ + \ No newline at end of file diff --git a/src/main/java/paket/Post.java b/src/main/java/paket/Post.java index c621fe9..68892ca 100644 --- a/src/main/java/paket/Post.java +++ b/src/main/java/paket/Post.java @@ -13,6 +13,17 @@ public class Post { String judul, tanggal, konten, id; Boolean ispublished, del; + +// Post(String id, String judul, String tanggal, String konten, boolean ispublished, boolean del) { +// throw new UnsupportedOperationException("Not supported yet."); +// //To change body of generated methods, choose Tools | Templates. +// this.id=id; +// this.judul=judul; +// this.tanggal=tanggal; +// this.konten=konten; +// this.ispublished=ispublished; +// this.del=del; +// } public String getJudul() { return judul; diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index 0c05d71..6e20000 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -5,16 +5,35 @@ package paket; import com.firebase.client.Firebase; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.text.ParseException; import java.util.ArrayList; import java.util.Formatter; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; +import org.apache.cxf.helpers.IOUtils; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +//import org.json.simple.JSONArray; +//import org.json.simple.JSONObject; +//import org.json.simple.parser.JSONParser; + /** * @@ -24,7 +43,7 @@ public class simpleblog { private final Firebase fbase; - String dbname = "https://sizzling-heat-3244.firebaseio.com/"; + String dbname = "https://boiling-torch-615.firebaseio.com/"; public simpleblog() { this.fbase = new Firebase(dbname); @@ -34,10 +53,33 @@ public simpleblog() { * Web service operation * @return */ + @WebMethod(operationName = "listPost") - public ArrayList listPost() { + public List listPost(@WebParam(name = "mode")String mode) throws IOException, ParseException, JSONException { //TODO write your implementation code here: - return null; + List list = new ArrayList(); + + try{ + URL url = new URL(fbase + "post.json"); + URLConnection connection = url.openConnection(); + JSONObject json = new JSONObject(IOUtils.toString(connection.getInputStream())); + + Iterator keys = json.keys(); + while (keys.hasNext()) { + JSONObject jsonPost = json.getJSONObject(keys.next()); + Post post = new Post(); + post.setId(jsonPost.getString("id")); + post.setJudul(jsonPost.getString("judul")); + post.setKonten(jsonPost.getString("konten")); + post.setTanggal(jsonPost.getString("tanggal")); + post.setIspublished(jsonPost.getBoolean("published")); + list.add(post); + } + }catch ( JSONException | IOException ex){ + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); + } + + return list; } /** @@ -80,6 +122,7 @@ public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "e newUser.put("role", role); newUser.put("password", password); users.push().setValue(newUser); + return true; } @@ -87,11 +130,11 @@ public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "e * Web service operation * @return */ - @WebMethod(operationName = "listUser") - public ArrayList listUser() { - //TODO write your implementation code here: - return null; - } +// @WebMethod(operationName = "listUser") +// public ArrayList listUser() { +// //TODO write your implementation code here: +// return null; +// } /** * Web service operation @@ -135,11 +178,11 @@ public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = * Web service operation * @return */ - @WebMethod(operationName = "listComment") - public ArrayList listComment() { - //TODO write your implementation code here: - return null; - } +// @WebMethod(operationName = "listComment") +// public ArrayList listComment() { +// //TODO write your implementation code here: +// return null; +// } /** * Web service operation @@ -157,11 +200,11 @@ public Boolean deleteComment(@WebParam(name = "id") Integer id) { * @param query * @return */ - @WebMethod(operationName = "search") - public ArrayList search(@WebParam(name = "query") String query) { - //TODO write your implementation code here: - return null; - } +// @WebMethod(operationName = "search") +// public ArrayList search(@WebParam(name = "query") String query) { +// //TODO write your implementation code here: +// return null; +// } /** * Web service operation @@ -203,4 +246,27 @@ public Boolean editPost(@WebParam(name = "id") Integer id, @WebParam(name = "jud post.updateChildren(newPost); return true; } + +// private JSONObject getJSONObject(String url) throws IOException, ParseException { +// JSONArray array = new JSONArray(); +// try { +// InputStream is = new URL(url).openStream(); +// BufferedReader br = new BufferedReader(new InputStreamReader(is)); +// String line = ""; +// String JSONString = ""; +// while((line = br.readLine()) != null) +// { +// JSONString += line; +// } +// JSONParser parser = new JSONParser(); +// Object obj = parser.parse(JSONString); +// array.add(obj); +// } catch (MalformedURLException ex) { +// System.out.println(ex.toString()); +// } catch (IOException ex) { +// System.out.println(ex.toString()); +// } +// JSONObject object = (JSONObject) array.get(0); +// return object; +// } } diff --git a/src/main/webapp/WEB-INF/glassfish-web.xml b/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..13e0059 --- /dev/null +++ b/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,10 @@ + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/src/wsdl/localhost_8080/IF3110-03-Simple-Blog-Service/simpleblog.wsdl b/src/wsdl/localhost_8080/IF3110-03-Simple-Blog-Service/simpleblog.wsdl new file mode 100644 index 0000000..d41e034 --- /dev/null +++ b/src/wsdl/localhost_8080/IF3110-03-Simple-Blog-Service/simpleblog.wsdl @@ -0,0 +1,523 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 7991d8305150d1884afb820f2c9dbbf465aa3886 Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Fri, 19 Dec 2014 02:01:02 +0700 Subject: [PATCH 13/14] method in simpleblog --- src/main/java/paket/Comment.java | 27 ++- src/main/java/paket/simpleblog.java | 297 +++++++++++++++++++++++----- 2 files changed, 264 insertions(+), 60 deletions(-) diff --git a/src/main/java/paket/Comment.java b/src/main/java/paket/Comment.java index 3b16ed0..c3d39c1 100644 --- a/src/main/java/paket/Comment.java +++ b/src/main/java/paket/Comment.java @@ -11,7 +11,24 @@ */ public class Comment { - String tanggal, konten, id, email, nama; + String tanggal, konten, email, nama; + Integer id, post_id; + + public Integer getPost_id() { + return post_id; + } + + public void setPost_id(Integer post_id) { + this.post_id = post_id; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } public String getTanggal() { return tanggal; @@ -29,14 +46,6 @@ public void setKonten(String konten) { this.konten = konten; } - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public String getEmail() { return email; } diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index 6e20000..66cdae9 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -13,7 +13,9 @@ import java.net.URL; import java.net.URLConnection; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Formatter; import java.util.HashMap; import java.util.Iterator; @@ -51,13 +53,17 @@ public simpleblog() { /** * Web service operation + * @param mode * @return + * @throws java.io.IOException + * @throws java.text.ParseException + * @throws org.codehaus.jettison.json.JSONException */ @WebMethod(operationName = "listPost") - public List listPost(@WebParam(name = "mode")String mode) throws IOException, ParseException, JSONException { + public List listPost() throws IOException, ParseException, JSONException { //TODO write your implementation code here: - List list = new ArrayList(); + List list = new ArrayList<>(); try{ URL url = new URL(fbase + "post.json"); @@ -89,8 +95,11 @@ public List listPost(@WebParam(name = "mode")String mode) throws IOExcepti */ @WebMethod(operationName = "deletePost") public Boolean deletePost(@WebParam(name = "id") Integer id) { - Firebase post = fbase.child("post").child(id.toString()); - post.removeValue(); + String key = getPostKey(id); + if (key == null) return false; + + // push ke firebase + fbase.child("post").child(key).child("published").setValue(-1, true); return true; } @@ -101,8 +110,13 @@ public Boolean deletePost(@WebParam(name = "id") Integer id) { */ @WebMethod(operationName = "publishPost") public Boolean publishPost(@WebParam(name = "id") Integer id) { - //TODO write your implementation code here: - return null; + String key = getPostKey(id); + if (key == null) return false; + + // push ke firebase + fbase.child("post").child(key).child("published").setValue(1, true); + + return true; } /** @@ -130,11 +144,32 @@ public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "e * Web service operation * @return */ -// @WebMethod(operationName = "listUser") -// public ArrayList listUser() { -// //TODO write your implementation code here: -// return null; -// } + @WebMethod(operationName = "listUser") + public List listUser() { + List list = new ArrayList<>(); + try { + URL url = new URL(fbase + "user" + ".json"); + URLConnection connection = url.openConnection(); + JSONObject json = new JSONObject(IOUtils.toString(connection.getInputStream())); + + Iterator keys = json.keys(); + while (keys.hasNext()) { + JSONObject jsonUser = json.getJSONObject(keys.next()); + User user = new User(); + user.setId(jsonUser.getInt("id")); + user.setNama(jsonUser.getString("username")); + user.setPass(jsonUser.getString("password")); + user.setEmail(jsonUser.getString("email")); + user.setRole(jsonUser.getString("role")); + list.add(user); + } + } catch (JSONException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } + return list; + } /** * Web service operation @@ -142,12 +177,26 @@ public Boolean addUser(@WebParam(name = "nama") String nama, @WebParam(name = "e * @param nama * @param role * @param email + * @param password * @return */ @WebMethod(operationName = "editUser") - public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nama") String nama, @WebParam(name = "role") String role, @WebParam(name = "email") String email) { - //TODO write your implementation code here: - return null; + public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nama") String nama, @WebParam(name = "role") String role, @WebParam(name = "email") String email, @WebParam(name = "password") String password) { + String key = getUserKey(id); + if (key == null) return false; + + // masukkan konten ke HashMap + Map map = new HashMap<>(); + map.put("id", id); + map.put("username", nama); + map.put("password", password); + map.put("email", email); + map.put("role", role); + + // push ke firebase + fbase.child("user").push().setValue(map, true); + + return true; } /** @@ -157,32 +206,74 @@ public Boolean editUser(@WebParam(name = "id") Integer id, @WebParam(name = "nam */ @WebMethod(operationName = "deleteUser") public Boolean deleteUser(@WebParam(name = "id") Integer id) { - //TODO write your implementation code here: - return null; + String key = getUserKey(id); + if (key == null) return false; + + // push ke firebase + fbase.child("user").child(key).removeValue(); + + return true; } /** * Web service operation + * @param postId * @param nama * @param email * @param konten * @return */ @WebMethod(operationName = "addComment") - public Boolean addComment(@WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "konten") String konten) { - //TODO write your implementation code here: - return null; + public Boolean addComment(@WebParam(name = "postId") String postId, @WebParam(name = "nama") String nama, @WebParam(name = "email") String email, @WebParam(name = "konten") String konten) { + Map map = new HashMap<>(); + map.put("id", getNewCommentId()); + map.put("postId", postId); + map.put("name", nama); + map.put("email", email); + map.put("content", konten); + map.put("time", (new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")).format(Calendar.getInstance().getTime()) + " UTC"); + + // push ke firebase + fbase.child("comment").push().setValue(map, true); + + return true; } /** * Web service operation + * @param postId * @return */ -// @WebMethod(operationName = "listComment") -// public ArrayList listComment() { -// //TODO write your implementation code here: -// return null; -// } + @WebMethod(operationName = "listComment") + public List listComment(Integer postId) { + List list = new ArrayList<>(); + try { + URL url = new URL(fbase + "comment" + ".json"); + URLConnection connection = url.openConnection(); + JSONObject json = new JSONObject(IOUtils.toString(connection.getInputStream())); + + Iterator keys = json.keys(); + while (keys.hasNext()) { + JSONObject jsonComment = json.getJSONObject(keys.next()); + Comment comment = new Comment(); + comment.setId(jsonComment.getInt("id")); + comment.setPost_id(jsonComment.getInt("postId")); + comment.setNama(jsonComment.getString("name")); + comment.setEmail(jsonComment.getString("email")); + comment.setKonten(jsonComment.getString("content")); + comment.setTanggal(jsonComment.getString("time")); + + if (comment.getPost_id() == postId) { + list.add(comment); + } + } + } catch (JSONException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } + return list; + } /** * Web service operation @@ -199,12 +290,31 @@ public Boolean deleteComment(@WebParam(name = "id") Integer id) { * Web service operation * @param query * @return + * @throws java.io.IOException + * @throws java.text.ParseException + * @throws org.codehaus.jettison.json.JSONException */ -// @WebMethod(operationName = "search") -// public ArrayList search(@WebParam(name = "query") String query) { -// //TODO write your implementation code here: -// return null; -// } + @WebMethod(operationName = "search") + public List search(@WebParam(name = "query") String query) throws IOException, ParseException, JSONException { + List allPost = listPost(); + List list = new ArrayList<>(); + + String[] token = query.toLowerCase().split(" \t\n\r"); + for (Post post : allPost) { + String text = post.getJudul().toLowerCase() + " " + post.getKonten().toLowerCase(); + boolean match = true; + for (String word : token) { + if (!text.contains(word)) { + match = false; + break; + } + } + if (match) { + list.add(post); + } + } + return list; + } /** * Web service operation @@ -247,26 +357,111 @@ public Boolean editPost(@WebParam(name = "id") Integer id, @WebParam(name = "jud return true; } -// private JSONObject getJSONObject(String url) throws IOException, ParseException { -// JSONArray array = new JSONArray(); -// try { -// InputStream is = new URL(url).openStream(); -// BufferedReader br = new BufferedReader(new InputStreamReader(is)); -// String line = ""; -// String JSONString = ""; -// while((line = br.readLine()) != null) -// { -// JSONString += line; -// } -// JSONParser parser = new JSONParser(); -// Object obj = parser.parse(JSONString); -// array.add(obj); -// } catch (MalformedURLException ex) { -// System.out.println(ex.toString()); -// } catch (IOException ex) { -// System.out.println(ex.toString()); -// } -// JSONObject object = (JSONObject) array.get(0); -// return object; -// } + /* Mengembalikan key dari post dengan id tertentu */ + private String getPostKey(Integer id) { + String key = null; + try { + URL url = new URL(fbase + "post" + ".json"); + URLConnection connection = url.openConnection(); + JSONObject json = new JSONObject(IOUtils.toString(connection.getInputStream())); + + Iterator keys = json.keys(); + while (keys.hasNext()) { + String currentKey = keys.next(); + if (json.getJSONObject(currentKey).getInt("id") == id) { + key = currentKey; + break; + } + } + } catch (JSONException ex) { + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); + } + return key; + } + + /* Mengembalikan key dari post dengan id tertentu */ + private String getUserKey(Integer id) { + String key = null; + try { + URL url = new URL(fbase + "post" + ".json"); + URLConnection connection = url.openConnection(); + JSONObject json = new JSONObject(IOUtils.toString(connection.getInputStream())); + + Iterator keys = json.keys(); + while (keys.hasNext()) { + String currentKey = keys.next(); + if (json.getJSONObject(currentKey).getInt("id") == id) { + key = currentKey; + break; + } + } + } catch (JSONException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + } + return key; + } + + /* Mengembalikan post id baru */ + private Integer getNewPostId() { + Integer id = 0; + try { + // retrieve value from firebase + URL url = new URL(fbase + "post_id_counter" + ".json"); + URLConnection connection = url.openConnection(); + id = Integer.parseInt(IOUtils.toString(connection.getInputStream())); + + // update id and update the value in firebase + id++; + fbase.child("post_id_counter").setValue(id); + } + catch (IOException e) { + // do nothing + e.printStackTrace(); + } + return id; + } + + /* Mengembalikan user id baru */ + private Integer getNewUserId() { + Integer id = 0; + try { + // retrieve value from firebase + URL url = new URL(fbase + "user_id_counter" + ".json"); + URLConnection connection = url.openConnection(); + id = Integer.parseInt(IOUtils.toString(connection.getInputStream())); + + // update id and update the value in firebase + id++; + fbase.child("user_id_counter").setValue(id); + } + catch (IOException e) { + // do nothing + e.printStackTrace(); + } + return id; + } + + /* Mengembalikan user id baru */ + private Integer getNewCommentId() { + Integer id = 0; + try { + // retrieve value from firebase + URL url = new URL(fbase + "comment_id_counter" + ".json"); + URLConnection connection = url.openConnection(); + id = Integer.parseInt(IOUtils.toString(connection.getInputStream())); + + // update id and update the value in firebase + id++; + fbase.child("comment_id_counter").setValue(id); + } + catch (IOException e) { + // do nothing + e.printStackTrace(); + } + return id; + } } From 0c8c2f24c4f9f15d08dc73ef2a61b9bd3e1f776c Mon Sep 17 00:00:00 2001 From: Mario Tressa Juzar Date: Fri, 19 Dec 2014 02:06:19 +0700 Subject: [PATCH 14/14] fix some --- src/main/java/paket/simpleblog.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/paket/simpleblog.java b/src/main/java/paket/simpleblog.java index 66cdae9..0361d28 100644 --- a/src/main/java/paket/simpleblog.java +++ b/src/main/java/paket/simpleblog.java @@ -164,9 +164,9 @@ public List listUser() { list.add(user); } } catch (JSONException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } return list; } @@ -268,9 +268,9 @@ public List listComment(Integer postId) { } } } catch (JSONException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } return list; } @@ -398,9 +398,9 @@ private String getUserKey(Integer id) { } } } catch (JSONException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { - Logger.getLogger(SimpleBlogServiceImplementation.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(simpleblog.class.getName()).log(Level.SEVERE, null, ex); } return key; }