├── ml └── serve_tf_model │ ├── model-server │ ├── .attach_pid14326 │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── javahelps │ │ │ └── tensorflow │ │ │ └── moderserver │ │ │ └── ModelServer.java │ └── pom.xml │ └── tf_add_model │ └── saved_model.pb ├── wso2 ├── cep │ ├── client │ │ └── thrift │ │ │ └── python-client │ │ │ ├── gen-py │ │ │ ├── __init__.py │ │ │ ├── Data │ │ │ │ ├── __init__.py │ │ │ │ ├── ttypes.pyc │ │ │ │ ├── __init__.pyc │ │ │ │ └── constants.py │ │ │ ├── Exception │ │ │ │ ├── __init__.py │ │ │ │ ├── ttypes.pyc │ │ │ │ ├── __init__.pyc │ │ │ │ └── constants.py │ │ │ ├── ThriftEventTransmissionService │ │ │ │ ├── __init__.py │ │ │ │ ├── ttypes.pyc │ │ │ │ ├── __init__.pyc │ │ │ │ ├── ThriftEventTransmissionService.pyc │ │ │ │ ├── constants.py │ │ │ │ └── ttypes.py │ │ │ └── ThriftSecureEventTransmissionService │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── ttypes.pyc │ │ │ │ ├── ThriftSecureEventTransmissionService.pyc │ │ │ │ ├── constants.py │ │ │ │ └── ttypes.py │ │ │ ├── cep-artifacts │ │ │ ├── eventstreams │ │ │ │ └── com.javahelps.stream.Temperature_1.0.0.json │ │ │ ├── eventpublishers │ │ │ │ ├── com.javahelps.publisher.logger.Temperature.xml │ │ │ │ └── com.javahelps.publisher.thrift.Temperature.xml │ │ │ └── eventreceivers │ │ │ │ └── com.javahelps.receiver.Temperature.xml │ │ │ ├── PublisherClient.py │ │ │ ├── wso2-thrift │ │ │ ├── Exception.thrift │ │ │ └── Data.thrift │ │ │ ├── TCPServer.py │ │ │ └── SSLServer.py │ └── siddhi │ │ └── siddhidemo │ │ └── target │ │ └── classes │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── com.javahelps │ │ └── siddhidemo │ │ └── pom.properties └── carbon │ └── helloworld │ ├── com.javahelps.samplecarbon.ui │ ├── src │ │ └── main │ │ │ └── resources │ │ │ ├── com │ │ │ └── javahelps │ │ │ │ └── samplecarbon │ │ │ │ └── ui │ │ │ │ └── i18n │ │ │ │ └── Resources.properties │ │ │ ├── web │ │ │ └── samplecarbon │ │ │ │ └── images │ │ │ │ └── icon.png │ │ │ └── META-INF │ │ │ └── component.xml │ ├── .settings │ │ ├── org.eclipse.m2e.core.prefs │ │ └── org.eclipse.jdt.core.prefs │ └── .project │ ├── com.javahelps.samplecarbon.service │ ├── .settings │ │ ├── org.eclipse.m2e.core.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── javahelps │ │ │ │ └── samplecarbon │ │ │ │ └── service │ │ │ │ └── SampleService.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services.xml │ └── .project │ └── Scripts │ ├── create_structure.bat │ └── create_structure.sh ├── webservices ├── microservices │ ├── Hello-Service │ │ ├── .gitignore │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── javahelps │ │ │ │ └── service │ │ │ │ ├── Student.java │ │ │ │ └── Application.java │ │ └── dependency-reduced-pom.xml │ ├── msf4j-helloworld │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── javahelps │ │ │ └── service │ │ │ ├── Application.java │ │ │ └── HelloService.java │ ├── springboot │ │ └── mysql-rest-service │ │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── javahelps │ │ │ │ └── restservice │ │ │ │ ├── repository │ │ │ │ └── UserRepository.java │ │ │ │ └── Application.java │ │ │ └── resources │ │ │ └── application.properties │ └── javalin │ │ ├── student-crud │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── javahelps │ │ │ └── javalindemo │ │ │ └── studentcrud │ │ │ └── Main.java │ │ └── contact-us │ │ └── src │ │ └── main │ │ ├── resources │ │ └── web │ │ │ └── success.html │ │ └── java │ │ └── com │ │ └── javahelps │ │ └── javalindemo │ │ └── contactus │ │ └── Main.java ├── jersey │ ├── 2 │ │ └── Jersey Demo │ │ │ ├── .settings │ │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ │ ├── org.eclipse.wst.validation.prefs │ │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ │ ├── org.eclipse.m2e.core.prefs │ │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ ├── .jsdtscope │ │ │ └── org.eclipse.wst.common.component │ │ │ ├── WebContent │ │ │ ├── META-INF │ │ │ │ └── MANIFEST.MF │ │ │ └── WEB-INF │ │ │ │ └── web.xml │ │ │ ├── target │ │ │ └── m2e-wtp │ │ │ │ └── web-resources │ │ │ │ └── META-INF │ │ │ │ ├── MANIFEST.MF │ │ │ │ └── maven │ │ │ │ └── com.javahelps │ │ │ │ └── jerseydemo │ │ │ │ └── pom.properties │ │ │ └── src │ │ │ └── com │ │ │ └── javahelps │ │ │ └── jerseydemo │ │ │ ├── app │ │ │ └── HelloWorldApplication.java │ │ │ └── services │ │ │ └── HelloWorldService.java │ └── Jersey Demo │ │ ├── .settings │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ ├── org.eclipse.wst.validation.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── .jsdtscope │ │ └── org.eclipse.wst.common.component │ │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ │ ├── target │ │ └── m2e-wtp │ │ │ └── web-resources │ │ │ └── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ └── com.javahelps │ │ │ └── jerseydemo │ │ │ └── pom.properties │ │ └── src │ │ └── com │ │ └── javahelps │ │ └── jerseydemo │ │ └── HelloWorldService.java └── axis2 │ ├── helloworld-eclipse │ ├── Axis2Client │ │ ├── .settings │ │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ │ ├── org.eclipse.wst.validation.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ │ ├── org.eclipse.wst.common.component │ │ │ └── .jsdtscope │ │ ├── WebContent │ │ │ ├── WEB-INF │ │ │ │ ├── services │ │ │ │ │ ├── services.list │ │ │ │ │ └── version.aar │ │ │ │ ├── modules │ │ │ │ │ ├── modules.list │ │ │ │ │ ├── mex-1.7.1.mar │ │ │ │ │ ├── ping-1.7.1.mar │ │ │ │ │ ├── scripting-1.7.1.mar │ │ │ │ │ ├── addressing-1.7.1.mar │ │ │ │ │ ├── mtompolicy-1.7.1.mar │ │ │ │ │ └── soapmonitor-1.7.1.mar │ │ │ │ └── conf │ │ │ │ │ └── axis2.policy │ │ │ ├── META-INF │ │ │ │ └── MANIFEST.MF │ │ │ └── axis2-web │ │ │ │ ├── images │ │ │ │ ├── axis.gif │ │ │ │ ├── axis.jpg │ │ │ │ ├── axis_l.jpg │ │ │ │ └── asf-logo.gif │ │ │ │ ├── include │ │ │ │ ├── link-footer.inc │ │ │ │ └── adminfooter.jsp │ │ │ │ └── disengage.jsp │ │ ├── src │ │ │ └── com │ │ │ │ └── javahelps │ │ │ │ └── helloaxis │ │ │ │ └── Client.java │ │ └── .classpath │ └── HelloAxis2 │ │ ├── .settings │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ ├── org.eclipse.wst.validation.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ └── .jsdtscope │ │ ├── WebContent │ │ ├── WEB-INF │ │ │ ├── services │ │ │ │ ├── services.list │ │ │ │ ├── version.aar │ │ │ │ └── HelloService │ │ │ │ │ └── META-INF │ │ │ │ │ └── services.xml │ │ │ ├── modules │ │ │ │ ├── modules.list │ │ │ │ ├── mex-1.7.1.mar │ │ │ │ ├── ping-1.7.1.mar │ │ │ │ ├── addressing-1.7.1.mar │ │ │ │ ├── mtompolicy-1.7.1.mar │ │ │ │ ├── scripting-1.7.1.mar │ │ │ │ └── soapmonitor-1.7.1.mar │ │ │ └── conf │ │ │ │ └── axis2.policy │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── axis2-web │ │ │ ├── images │ │ │ ├── axis.gif │ │ │ ├── axis.jpg │ │ │ ├── asf-logo.gif │ │ │ └── axis_l.jpg │ │ │ ├── include │ │ │ ├── link-footer.inc │ │ │ └── adminfooter.jsp │ │ │ └── disengage.jsp │ │ ├── src │ │ └── com │ │ │ └── javahelps │ │ │ └── helloaxis │ │ │ └── HelloService.java │ │ └── .classpath │ └── helloworld │ ├── service │ ├── HelloService.java │ └── META-INF │ │ └── services.xml │ └── client │ └── Client.java ├── spark ├── 05 │ └── ActionMovies │ │ ├── project │ │ └── build.properties │ │ ├── build.sbt │ │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── javahelps │ │ └── spark │ │ └── ActionMovies.scala ├── 04 │ └── AverageMovieRatings │ │ ├── project │ │ └── build.properties │ │ └── build.sbt ├── 06 │ └── AverageMovieRatings │ │ ├── project │ │ └── build.properties │ │ └── build.sbt └── 01 │ └── Movie Ratings Counter │ ├── project │ └── build.properties │ ├── build.sbt │ └── src │ └── main │ └── scala │ └── com │ └── javahelps │ └── spark │ └── MovieRatingsCounter.scala ├── ocewcd └── Hello World │ ├── .settings │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.common.component │ └── .jsdtscope │ ├── WebContent │ ├── META-INF │ │ └── MANIFEST.MF │ └── index.html │ ├── .classpath │ └── .project ├── stripes └── Hello World │ ├── .tern-project │ ├── .settings │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.ws.service.policy.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.common.component │ └── .jsdtscope │ ├── WebContent │ ├── META-INF │ │ └── MANIFEST.MF │ └── WEB-INF │ │ └── jsp │ │ └── result.jsp │ ├── .classpath │ ├── src │ └── com │ │ └── javahelps │ │ └── stripes │ │ └── helloworld │ │ └── action │ │ └── TimeActionBean.java │ └── .project ├── designpatterns ├── bridge │ ├── v1 │ │ ├── Shape.java │ │ ├── Main.java │ │ ├── Square.java │ │ ├── Circle.java │ │ ├── SolidColorCircle.java │ │ ├── SolidColorSquare.java │ │ ├── GradientSquare.java │ │ └── GradientCircle.java │ └── v2 │ │ ├── Shape.java │ │ ├── Background.java │ │ ├── Main.java │ │ ├── SolidColor.java │ │ ├── Gradient.java │ │ ├── Square.java │ │ └── Circle.java ├── factory │ ├── v1 │ │ ├── com │ │ │ └── javahelps │ │ │ │ └── shapes │ │ │ │ ├── Shape.java │ │ │ │ ├── Square.java │ │ │ │ ├── Circle.java │ │ │ │ └── Rectangle.java │ │ └── ShapeClient.java │ └── v2 │ │ ├── com │ │ └── javahelps │ │ │ └── shapes │ │ │ ├── Shape.java │ │ │ ├── Square.java │ │ │ ├── Circle.java │ │ │ ├── Rectangle.java │ │ │ └── ShapeFactory.java │ │ └── ShapeClient.java └── prototype │ ├── Cell.java │ ├── Main.java │ └── Board.java ├── README.md ├── maven ├── manual │ └── Calculator │ │ ├── lib │ │ └── exp4j-0.4.8.jar │ │ ├── .project │ │ ├── src │ │ └── com │ │ │ └── javahelps │ │ │ └── calculator │ │ │ └── Calculator.java │ │ └── .classpath └── maven │ └── calculator │ ├── src │ └── main │ │ └── java │ │ └── com │ │ └── javahelps │ │ └── calculator │ │ └── Calculator.java │ └── pom.xml ├── cep └── wso2cep │ └── cepclient │ ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.jdt.core.prefs │ ├── target │ └── classes │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── com.javahelps │ │ └── cepclient │ │ └── pom.properties │ └── .project ├── hibernate ├── HibernateXML │ ├── .settings │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.hibernate.eclipse.console.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── target │ │ └── classes │ │ │ ├── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ │ └── com.javahelps │ │ │ │ └── HibernateXML │ │ │ │ └── pom.properties │ │ │ ├── log4j.properties │ │ │ ├── Student.hbm.xml │ │ │ └── hibernate.cfg.xml │ ├── resources │ │ ├── log4j.properties │ │ ├── Student.hbm.xml │ │ └── hibernate.cfg.xml │ ├── src │ │ └── com │ │ │ └── javahelps │ │ │ └── hibernate │ │ │ └── Student.java │ ├── .project │ └── .classpath └── HibernateAnnotation │ ├── .settings │ ├── org.eclipse.m2e.core.prefs │ ├── org.hibernate.eclipse.console.prefs │ └── org.eclipse.jdt.core.prefs │ ├── target │ └── classes │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── com.javahelps │ │ └── HibernateAnnotation │ │ └── pom.properties │ ├── .project │ ├── .classpath │ └── src │ └── com │ └── javahelps │ └── hibernate │ └── Student.java ├── Neo4j └── Neo4J OGM HelloWorld │ ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.jdt.core.prefs │ ├── target │ └── classes │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── com.javahelps │ │ └── Neo4JOGMHelloWorld │ │ ├── pom.properties │ │ └── pom.xml │ ├── .project │ ├── .classpath │ └── pom.xml ├── jpa └── helloworld │ └── hibernate │ ├── JPAHelloWorld │ ├── .settings │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.hibernate.eclipse.console.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── target │ │ └── classes │ │ │ ├── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ │ └── com.javahelps │ │ │ │ └── JPAHelloWorld │ │ │ │ └── pom.properties │ │ │ └── log4j.properties │ ├── resources │ │ └── log4j.properties │ ├── .project │ ├── .classpath │ └── src │ │ └── com │ │ └── javahelps │ │ └── jpa │ │ └── Student.java │ └── JPAWithHibernate5 │ ├── .settings │ ├── org.eclipse.m2e.core.prefs │ ├── org.hibernate.eclipse.console.prefs │ └── org.eclipse.jdt.core.prefs │ ├── target │ └── classes │ │ ├── META-INF │ │ ├── MANIFEST.MF │ │ ├── maven │ │ │ └── com.javahelps │ │ │ │ └── JPAWithHibernate5 │ │ │ │ └── pom.properties │ │ └── persistence.xml │ │ └── logback.xml │ └── src │ └── main │ ├── resources │ └── logback.xml │ └── java │ └── com │ └── javahelps │ └── jpa │ └── Student.java ├── defaultmethods ├── DefaultWithoutBody.java ├── DefaultInClass.java ├── OverrideToString.java ├── FinalDefaultMethod.java ├── StaticDefaultMethod.java ├── SynchronizedDefaultMethod.java ├── NonPublicDefaultMethod.java ├── OverrideDemo.java ├── DiamondProblem.java ├── DiamondSolutionOne.java ├── DiamondSolutionTwo.java ├── BookDemo.java └── SingleSales.java ├── objectorientedprogramming ├── polymorphism │ ├── BankAccountDemo │ │ ├── v1 │ │ │ ├── CurrentAccount.java │ │ │ ├── SavingsAccount.java │ │ │ ├── BankAccount.java │ │ │ └── BankDemo.java │ │ └── v2 │ │ │ ├── SavingsAccount.java │ │ │ ├── CurrentAccount.java │ │ │ ├── BankAccount.java │ │ │ └── BankDemo.java │ ├── CalculatorDemo │ │ ├── v1 │ │ │ └── CalculatorDemo.java │ │ ├── v2 │ │ │ └── CalculatorDemo.java │ │ ├── v4 │ │ │ └── CalculatorDemo.java │ │ └── v3 │ │ │ └── CalculatorDemo.java │ └── CovariantReturn.java ├── abstraction │ ├── v1 │ │ ├── Car.java │ │ ├── Motorbike.java │ │ ├── Vehicle.java │ │ └── VehicleDemo.java │ ├── AbstractWithPrivate.java │ ├── AbstractWithStatic.java │ ├── AbstractWithFinal.java │ ├── v2 │ │ ├── Vehicle.java │ │ ├── Car.java │ │ ├── Motorbike.java │ │ └── VehicleDemo.java │ └── v3 │ │ ├── Car.java │ │ ├── VehicleDemo.java │ │ ├── Motorbike.java │ │ └── Vehicle.java ├── encapsulation │ ├── v2.0 │ │ └── BookShop.java │ ├── v1.0 │ │ ├── BookShop.java │ │ └── Book.java │ ├── v1.1 │ │ ├── BookShop.java │ │ └── Book.java │ └── v1.2 │ │ ├── BookShop.java │ │ └── Book.java └── inheritance │ ├── v1.0 │ └── BookShop.java │ └── v2.0 │ ├── BookShop.java │ ├── Book.java │ └── Magazine.java ├── big-data └── orc-demo │ └── src │ └── main │ └── resources │ └── log4j.properties ├── lambdaexpression ├── LambdaThreadDemo.java ├── LambdaRuleFour.java ├── LambdaRuleThree.java ├── ThreadDemo.java ├── LambdaExercise.java ├── LambdaRuleFive.java ├── LambdaVariableScope.java ├── LambdaRuleSix.java ├── LambdaRuleTwo.java └── LambdaRuleOne.java ├── threads ├── ThreadA.java ├── ThreadB.java ├── ThreadDemo.java └── TimerDemo.java ├── trywithresources ├── TryWithResources.java ├── TryWithMultiResources.java ├── FileWriterDemo.java └── FileWriterIllegalAccessDemo.java ├── antlr └── antlr-demo │ └── src │ └── main │ ├── antlr4 │ └── com │ │ └── javahelps │ │ └── antlrdemo │ │ └── calculator │ │ └── Calculator.g4 │ └── java │ └── com │ └── javahelps │ └── antlrdemo │ └── calculator │ └── CalculatorVisitorImpl.java ├── threaddeadlock ├── Main.java ├── fixed │ ├── Main.java │ ├── Account.java │ └── Transaction.java ├── Account.java └── Transaction.java ├── interfaces ├── InterfaceFields.java ├── DownloadManager.java ├── PrintArray.java ├── Computer.java └── InterfaceMethods.java ├── stringimmutability ├── BestPractice.java ├── GarbageGenerator.java └── StringPool.java ├── .gitignore ├── synchronization ├── v1 │ └── ConcurrencyProblem.java ├── v2 │ └── ConcurrencyProblem.java └── v3 │ └── ConcurrencyProblem.java └── library └── PCAP-Parser └── pom.xml /ml/serve_tf_model/model-server/.attach_pid14326: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webservices/microservices/Hello-Service/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /spark/05/ActionMovies/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.2.8 -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /spark/04/AverageMovieRatings/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.2.8 -------------------------------------------------------------------------------- /spark/06/AverageMovieRatings/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.2.8 -------------------------------------------------------------------------------- /stripes/Hello World/.tern-project: -------------------------------------------------------------------------------- 1 | {"libs":["browser","ecma5"],"ide":{}} -------------------------------------------------------------------------------- /spark/01/Movie Ratings Counter/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.2.8 -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /designpatterns/bridge/v1/Shape.java: -------------------------------------------------------------------------------- 1 | public interface Shape { 2 | public void draw(); 3 | } -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Shape.java: -------------------------------------------------------------------------------- 1 | public interface Shape { 2 | public void draw(); 3 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Data/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ttypes', 'constants'] 2 | -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Background.java: -------------------------------------------------------------------------------- 1 | public interface Background { 2 | public void fill(); 3 | } -------------------------------------------------------------------------------- /ocewcd/Hello World/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /stripes/Hello World/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Exception/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ttypes', 'constants'] 2 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/services/services.list: -------------------------------------------------------------------------------- 1 | version.aar 2 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/services/services.list: -------------------------------------------------------------------------------- 1 | version.aar 2 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java-Helps-Java 2 | Java projects from Java Helps. 3 | For more details visit to www.javahelps.com 4 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /maven/manual/Calculator/lib/exp4j-0.4.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/maven/manual/Calculator/lib/exp4j-0.4.8.jar -------------------------------------------------------------------------------- /ml/serve_tf_model/tf_add_model/saved_model.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/ml/serve_tf_model/tf_add_model/saved_model.pb -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/src/main/resources/com/javahelps/samplecarbon/ui/i18n/Resources.properties: -------------------------------------------------------------------------------- 1 | order.menu= Sample Service -------------------------------------------------------------------------------- /designpatterns/factory/v1/com/javahelps/shapes/Shape.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | public interface Shape { 4 | public void draw(); 5 | } -------------------------------------------------------------------------------- /designpatterns/factory/v2/com/javahelps/shapes/Shape.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | public interface Shape { 4 | public void draw(); 5 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ttypes', 'constants', 'ThriftEventTransmissionService'] 2 | -------------------------------------------------------------------------------- /cep/wso2cep/cepclient/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.wst.ws.service.policy.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.wst.ws.service.policy.projectEnabled=false 3 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=120WebContent/axis2-web 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=120WebContent/axis2-web 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=HibernateXML 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ttypes', 'constants', 'ThriftSecureEventTransmissionService'] 2 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=HibernateAnnotation 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Data/ttypes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/Data/ttypes.pyc -------------------------------------------------------------------------------- /cep/wso2cep/cepclient/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_60 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_45 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=JPAHelloWorld 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Data/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/Data/__init__.pyc -------------------------------------------------------------------------------- /wso2/cep/siddhi/siddhidemo/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_77 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_60 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /spark/05/ActionMovies/build.sbt: -------------------------------------------------------------------------------- 1 | name := "ActionMovies" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.8" 6 | 7 | libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.0" -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Exception/ttypes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/Exception/ttypes.pyc -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_45 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=JPAWithHibernate5 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.service/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Exception/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/Exception/__init__.pyc -------------------------------------------------------------------------------- /defaultmethods/DefaultWithoutBody.java: -------------------------------------------------------------------------------- 1 | public interface DefaultWithoutBody { 2 | /* 3 | * Compile time error. 4 | * No method body for the default method. 5 | */ 6 | default void doStuff(); 7 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_45 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_102 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /spark/04/AverageMovieRatings/build.sbt: -------------------------------------------------------------------------------- 1 | name := "AverageMovieRatings" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.8" 6 | 7 | libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.0" -------------------------------------------------------------------------------- /spark/06/AverageMovieRatings/build.sbt: -------------------------------------------------------------------------------- 1 | name := "AverageMovieRatings" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.8" 6 | 7 | libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.0" -------------------------------------------------------------------------------- /spark/01/Movie Ratings Counter/build.sbt: -------------------------------------------------------------------------------- 1 | name := "Movie Ratings Counter" 2 | 3 | version := "0.1" 4 | 5 | scalaVersion := "2.12.8" 6 | 7 | libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.0" 8 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_45 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: gobinath 3 | Build-Jdk: 1.8.0_45 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/modules.list: -------------------------------------------------------------------------------- 1 | mtompolicy-1.7.1.mar 2 | mex-1.7.1.mar 3 | soapmonitor-1.7.1.mar 4 | ping-1.7.1.mar 5 | addressing-1.7.1.mar 6 | scripting-1.7.1.mar 7 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/modules.list: -------------------------------------------------------------------------------- 1 | mtompolicy-1.7.1.mar 2 | mex-1.7.1.mar 3 | soapmonitor-1.7.1.mar 4 | ping-1.7.1.mar 5 | addressing-1.7.1.mar 6 | scripting-1.7.1.mar 7 | -------------------------------------------------------------------------------- /ocewcd/Hello World/WebContent/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | Click Here 9 | 10 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis.gif -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis.jpg -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis.gif -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis.jpg -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/ttypes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/ttypes.pyc -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/services/version.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/services/version.aar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis_l.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/axis_l.jpg -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/mex-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/mex-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/services/version.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/services/version.aar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/asf-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/asf-logo.gif -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis_l.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/images/axis_l.jpg -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/__init__.pyc -------------------------------------------------------------------------------- /defaultmethods/DefaultInClass.java: -------------------------------------------------------------------------------- 1 | public class DefaultInClass { 2 | /* 3 | * Compile time error. 4 | * Cannot have default method inside a class. 5 | */ 6 | default void doStuff() { 7 | System.out.println("Hello world"); 8 | } 9 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/mex-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/mex-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/ping-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/ping-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/asf-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/images/asf-logo.gif -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/ping-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/ping-1.7.1.mar -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/__init__.pyc -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/ttypes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/ttypes.pyc -------------------------------------------------------------------------------- /defaultmethods/OverrideToString.java: -------------------------------------------------------------------------------- 1 | public interface OverrideToString { 2 | /* 3 | * Compile time error. 4 | * Cannot override any methods of java.lang.Object class. 5 | */ 6 | public default String toString() { 7 | return "Hello"; 8 | } 9 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/scripting-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/scripting-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/addressing-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/addressing-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/mtompolicy-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/mtompolicy-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/scripting-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/scripting-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/addressing-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/addressing-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/mtompolicy-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/mtompolicy-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/soapmonitor-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/modules/soapmonitor-1.7.1.mar -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/soapmonitor-1.7.1.mar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/modules/soapmonitor-1.7.1.mar -------------------------------------------------------------------------------- /defaultmethods/FinalDefaultMethod.java: -------------------------------------------------------------------------------- 1 | public interface FinalDefaultMethod { 2 | /* 3 | * Compile time error. 4 | * final and default cannot be used together. 5 | */ 6 | public final default void print() { 7 | System.out.println("Hello world"); 8 | } 9 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v1/CurrentAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * CurrentAccount allows to have negative balance. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class CurrentAccount extends BankAccount { 8 | 9 | } -------------------------------------------------------------------------------- /defaultmethods/StaticDefaultMethod.java: -------------------------------------------------------------------------------- 1 | public interface StaticDefaultMethod { 2 | /* 3 | * Compile time error. 4 | * static and default cannot be used together. 5 | */ 6 | public static default void print() { 7 | System.out.println("Hello world"); 8 | } 9 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v1/Car.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Car class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class Car { 8 | public void drive() { 9 | System.out.println("Use steering wheel"); 10 | } 11 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v1/SavingsAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SavingsAccount does not have any significant differences. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class SavingsAccount extends BankAccount { 8 | 9 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v2/SavingsAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SavingsAccount does not have any significant differences. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class SavingsAccount extends BankAccount { 8 | 9 | } -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/src/main/resources/web/samplecarbon/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/src/main/resources/web/samplecarbon/images/icon.png -------------------------------------------------------------------------------- /webservices/axis2/helloworld/service/HelloService.java: -------------------------------------------------------------------------------- 1 | public class HelloService { 2 | 3 | /** 4 | * This method will be the add operation of the web service. 5 | */ 6 | public int add(int x, int y) { 7 | int ans = x + y; 8 | return ans; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /big-data/orc-demo/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=ERROR, CA 2 | 3 | log4j.appender.CA=org.apache.log4j.ConsoleAppender 4 | 5 | log4j.appender.CA.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.pyc -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v1/Motorbike.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Motorbike class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class Motorbike { 8 | public void drive() { 9 | System.out.println("Use handlebars"); 10 | } 11 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/src/com/javahelps/helloaxis/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.helloaxis; 2 | 3 | public class HelloService { 4 | 5 | public String sayHello(String name) { 6 | return "Hello " + name; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld/service/META-INF/services.xml: -------------------------------------------------------------------------------- 1 | 2 | HelloService 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /defaultmethods/SynchronizedDefaultMethod.java: -------------------------------------------------------------------------------- 1 | public interface SynchronizedDefaultMethod { 2 | /* 3 | * Compile time error. 4 | * synchronized and default cannot be used together. 5 | */ 6 | public synchronized default void print() { 7 | System.out.println("Hello world"); 8 | } 9 | } -------------------------------------------------------------------------------- /wso2/carbon/helloworld/Scripts/create_structure.bat: -------------------------------------------------------------------------------- 1 | mkdir -p com.javahelps.samplecarbon.stub/src/main/java 2 | mkdir -p com.javahelps.samplecarbon.stub/src/main/resources 3 | mkdir -p com.javahelps.samplecarbon.stub/src/test/java 4 | mkdir -p com.javahelps.samplecarbon.stub/src/test/resources 5 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/Scripts/create_structure.sh: -------------------------------------------------------------------------------- 1 | mkdir -p com.javahelps.samplecarbon.stub/src/main/java 2 | mkdir -p com.javahelps.samplecarbon.stub/src/main/resources 3 | mkdir -p com.javahelps.samplecarbon.stub/src/test/java 4 | mkdir -p com.javahelps.samplecarbon.stub/src/test/resources 5 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Shape circle = new SolidColorCircle(7.0, "RED"); 4 | Shape square = new GradientSquare(10, "BLUE", "GREEN"); 5 | circle.draw(); 6 | square.draw(); 7 | } 8 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/ThriftSecureEventTransmissionService.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slgobinath/Java-Helps-Java/HEAD/wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/ThriftSecureEventTransmissionService.pyc -------------------------------------------------------------------------------- /cep/wso2cep/cepclient/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Shape circle = new Circle(7.0, new SolidColor("RED")); 4 | Shape square = new Square(10.0, new Gradient("BLUE", "GREEN")); 5 | circle.draw(); 6 | square.draw(); 7 | } 8 | } -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /lambdaexpression/LambdaThreadDemo.java: -------------------------------------------------------------------------------- 1 | public class LambdaThreadDemo { 2 | public static void main(String[] args) { 3 | // Runnable anonymous object 4 | Runnable runnable = () -> System.out.println("ID: " + Thread.currentThread().getId()); 5 | Thread thread = new Thread(runnable); 6 | thread.start(); 7 | } 8 | } -------------------------------------------------------------------------------- /threads/ThreadA.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample thread class by extending java.lang.Thread. 3 | * 4 | * @author L.Gobinath 5 | */ 6 | public class ThreadA extends Thread { 7 | @Override 8 | public void run() { 9 | for(int i = 0; i < 1000; i++) { 10 | System.out.println("Thread A: " + i); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /threads/ThreadB.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample thread class by implementing java.lang.Runnable. 3 | * 4 | * @author L.Gobinath 5 | */ 6 | public class ThreadB implements Runnable { 7 | @Override 8 | public void run() { 9 | for(int i = 0; i < 1000; i++) { 10 | System.out.println("Thread B: " + i); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.8 6 | -------------------------------------------------------------------------------- /designpatterns/bridge/v2/SolidColor.java: -------------------------------------------------------------------------------- 1 | public class SolidColor implements Background { 2 | private String color; 3 | 4 | public SolidColor(String color) { 5 | this.color = color; 6 | } 7 | 8 | @Override 9 | public void fill() { 10 | System.out.println("Fill with: " + color); 11 | } 12 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/AbstractWithPrivate.java: -------------------------------------------------------------------------------- 1 | /** 2 | * private and abstract cannot be used together. 3 | * WARNING: 4 | * Compile time error due to private abstract method. 5 | * 6 | * @author L.Gobinath 7 | */ 8 | public abstract class AbstractWithPrivate { 9 | private abstract void doStuff(); 10 | } -------------------------------------------------------------------------------- /cep/wso2cep/cepclient/target/classes/META-INF/maven/com.javahelps/cepclient/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Nov 26 20:42:43 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=cepclient 6 | m2e.projectLocation=/home/gobinath/Workspace/eclipse/cepclient 7 | artifactId=cepclient 8 | -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/AbstractWithStatic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * static and abstract cannot be used together. 3 | * WARNING: 4 | * Compile time error due to static abstract method. 5 | * 6 | * @author L.Gobinath 7 | */ 8 | public abstract class AbstractWithStatic { 9 | public static abstract void doStuff(); 10 | } -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/Square.java: -------------------------------------------------------------------------------- 1 | public abstract class Square implements Shape { 2 | private double width; 3 | 4 | public Square(double width) { 5 | this.width = width; 6 | } 7 | 8 | @Override 9 | public void draw() { 10 | System.out.println("Create a square with width: " + width); 11 | } 12 | } -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.service/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/Circle.java: -------------------------------------------------------------------------------- 1 | public abstract class Circle implements Shape { 2 | private double radius; 3 | 4 | public Circle(double radius) { 5 | this.radius = radius; 6 | } 7 | 8 | @Override 9 | public void draw() { 10 | System.out.println("Create a circle with radius: " + radius); 11 | } 12 | } -------------------------------------------------------------------------------- /wso2/cep/siddhi/siddhidemo/target/classes/META-INF/maven/com.javahelps/siddhidemo/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Tue Jul 19 14:22:04 IST 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=siddhidemo 6 | m2e.projectLocation=/home/gobinath/Workspace/eclipse/siddhidemo 7 | artifactId=siddhidemo 8 | -------------------------------------------------------------------------------- /designpatterns/factory/v2/com/javahelps/shapes/Square.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | class Square implements Shape { 4 | private int width; 5 | 6 | public Square(int width) { 7 | this.width = width; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Square"); 13 | } 14 | } -------------------------------------------------------------------------------- /hibernate/HibernateXML/target/classes/META-INF/maven/com.javahelps/HibernateXML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Jul 25 17:22:25 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=HibernateXML 6 | m2e.projectLocation=/home/gobinath/workspace/eclipse/HibernateXML 7 | artifactId=HibernateXML 8 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Data/constants.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | from ttypes import * 11 | 12 | -------------------------------------------------------------------------------- /designpatterns/factory/v1/com/javahelps/shapes/Square.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | public class Square implements Shape { 4 | private int width; 5 | 6 | public Square(int width) { 7 | this.width = width; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Square"); 13 | } 14 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/Exception/constants.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | from ttypes import * 11 | 12 | -------------------------------------------------------------------------------- /designpatterns/factory/v2/com/javahelps/shapes/Circle.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | class Circle implements Shape { 4 | private double radius; 5 | 6 | public Circle(double radius) { 7 | this.radius = radius; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Circle"); 13 | } 14 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/AbstractWithFinal.java: -------------------------------------------------------------------------------- 1 | /** 2 | * final and abstract cannot be used together. 3 | * WARNING: 4 | * Compile time error due to final abstract class and final abstract method. 5 | * 6 | * @author L.Gobinath 7 | */ 8 | public final abstract class AbstractWithFinal { 9 | public final abstract void doStuff(); 10 | } -------------------------------------------------------------------------------- /designpatterns/factory/v1/com/javahelps/shapes/Circle.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | public class Circle implements Shape { 4 | private double radius; 5 | 6 | public Circle(double radius) { 7 | this.radius = radius; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Circle"); 13 | } 14 | } -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/target/m2e-wtp/web-resources/META-INF/maven/com.javahelps/jerseydemo/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Fri Aug 14 09:57:47 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=Jersey Demo 6 | m2e.projectLocation=/home/gobinath/Workspace/eclipse/Jersey Demo 7 | artifactId=jerseydemo 8 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/target/m2e-wtp/web-resources/META-INF/maven/com.javahelps/jerseydemo/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Tue Jul 21 19:38:29 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=Jersey Demo 6 | m2e.projectLocation=/home/gobinath/workspace/eclipse/Jersey Demo 7 | artifactId=jerseydemo 8 | -------------------------------------------------------------------------------- /webservices/microservices/msf4j-helloworld/src/main/java/com/javahelps/service/Application.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.service; 2 | 3 | import org.wso2.msf4j.MicroservicesRunner; 4 | 5 | public class Application { 6 | 7 | public static void main(String[] args) { 8 | new MicroservicesRunner() 9 | .deploy(new HelloService()) 10 | .start(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/constants.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | from ttypes import * 11 | 12 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/target/classes/META-INF/maven/com.javahelps/Neo4JOGMHelloWorld/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Tue Oct 27 20:35:58 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=Neo4J OGM HelloWorld 6 | m2e.projectLocation=/home/gobinath/Workspace/eclipse/Neo4J OGM HelloWorld 7 | artifactId=Neo4JOGMHelloWorld 8 | -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleFour.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleFour { 2 | public static void main(String[] args) { 3 | Printable printable = x -> {System.out.println(x);}; 4 | doStuff(printable); 5 | } 6 | 7 | private static void doStuff(Printable printer) { 8 | printer.print("Hello"); 9 | } 10 | } 11 | 12 | interface Printable { 13 | public void print(String msg); 14 | } -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleThree.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleThree { 2 | public static void main(String[] args) { 3 | Printable printable = () -> {System.out.println("Hello world");}; 4 | doStuff(printable); 5 | } 6 | 7 | private static void doStuff(Printable printer) { 8 | printer.print(); 9 | } 10 | } 11 | 12 | interface Printable { 13 | public void print(); 14 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/constants.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | from ttypes import * 11 | 12 | -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/target/classes/META-INF/maven/com.javahelps/HibernateAnnotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Jul 30 22:06:19 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=HibernateAnnotation 6 | m2e.projectLocation=/home/gobinath/workspace/eclipse/HibernateAnnotation 7 | artifactId=HibernateAnnotation 8 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.service/src/main/java/com/javahelps/samplecarbon/service/SampleService.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.samplecarbon.service; 2 | 3 | public class SampleService { 4 | private static final String[] LANGUAGES = { "Java", "C++", "Python", "Go" }; 5 | 6 | public String[] getLanguages() { 7 | return LANGUAGES; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Direct to stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.Target=System.out 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n 6 | 7 | # Root logger option 8 | log4j.rootLogger=ERROR, stdout 9 | 10 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/target/classes/META-INF/maven/com.javahelps/JPAWithHibernate5/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Oct 09 19:28:14 IST 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=JPAWithHibernate5 6 | m2e.projectLocation=/home/gobinath/Workspace/eclipse/JPAWithHibernate5 7 | artifactId=JPAWithHibernate5 8 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Direct to stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.Target=System.out 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n 6 | 7 | # Root logger option 8 | log4j.rootLogger=ERROR, stdout 9 | 10 | -------------------------------------------------------------------------------- /lambdaexpression/ThreadDemo.java: -------------------------------------------------------------------------------- 1 | public class ThreadDemo { 2 | public static void main(String[] args) { 3 | // Runnable anonymous object 4 | Runnable runnable = new Runnable() { 5 | @Override 6 | public void run() { 7 | System.out.println("ID: " + Thread.currentThread().getId()); 8 | } 9 | }; 10 | Thread thread = new Thread(runnable); 11 | thread.start(); 12 | } 13 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v1/Vehicle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample abstract Vehicle class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public abstract class Vehicle { 8 | /** 9 | * Implementation of drive method is unknown for Vehicle. 10 | * Notice that the method is terminated with a semicolon. 11 | */ 12 | public abstract void drive(); 13 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v2/Vehicle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample abstract Vehicle class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public abstract class Vehicle { 8 | /** 9 | * Implementation of drive method is unknown for Vehicle. 10 | * Notice that the method is terminated with a semicolon. 11 | */ 12 | public abstract void drive(); 13 | } -------------------------------------------------------------------------------- /lambdaexpression/LambdaExercise.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LambdaExercise { 4 | public static void main(String[] args) { 5 | String[] array = {"Java", "C++", "Ruby", "Python"}; 6 | System.out.println("Unsorted: " + Arrays.toString(array)); 7 | Arrays.sort(array, (x, y) -> y.compareTo(x)); 8 | System.out.println("Reverse sorted: " + Arrays.toString(array)); 9 | } 10 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v2/CurrentAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * CurrentAccount allows to have negative balance. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class CurrentAccount extends BankAccount { 8 | /** 9 | * Overriding method. 10 | */ 11 | public boolean withdraw(double amount) { 12 | balance -= amount; 13 | return true; 14 | } 15 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/target/classes/META-INF/maven/com.javahelps/JPAHelloWorld/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Aug 08 16:18:04 IST 2015 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.javahelps 5 | m2e.projectName=JPAHelloWorld 6 | m2e.projectLocation=/home/gobinath/Workspace/git/Java-Helps-Java/jpa/helloworld/hibernate/JPAHelloWorld 7 | artifactId=JPAHelloWorld 8 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/SolidColorCircle.java: -------------------------------------------------------------------------------- 1 | public class SolidColorCircle extends Circle { 2 | private String color; 3 | 4 | public SolidColorCircle(double radius, String color) { 5 | super(radius); 6 | this.color = color; 7 | } 8 | 9 | @Override 10 | public void draw() { 11 | super.draw(); 12 | System.out.println("Fill with: " + color); 13 | } 14 | } -------------------------------------------------------------------------------- /designpatterns/bridge/v1/SolidColorSquare.java: -------------------------------------------------------------------------------- 1 | public class SolidColorSquare extends Square { 2 | private String color; 3 | 4 | public SolidColorSquare(double width, String color) { 5 | super(width); 6 | this.color = color; 7 | } 8 | 9 | @Override 10 | public void draw() { 11 | super.draw(); 12 | System.out.println("Fill with: " + color); 13 | } 14 | } -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleFive.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleFive { 2 | public static void main(String[] args) { 3 | Printable printable = (x, y) -> System.out.println(x + " : " + y); 4 | doStuff(printable); 5 | } 6 | 7 | private static void doStuff(Printable printer) { 8 | printer.print("Hello", 5); 9 | } 10 | } 11 | 12 | interface Printable { 13 | public void print(String msg, int count); 14 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Root logger option 2 | log4j.rootLogger=ERROR, stdout 3 | 4 | # Direct log messages to stdout 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.Target=System.out 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Root logger option 2 | log4j.rootLogger=ERROR, stdout 3 | 4 | # Direct log messages to stdout 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.Target=System.out 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -------------------------------------------------------------------------------- /lambdaexpression/LambdaVariableScope.java: -------------------------------------------------------------------------------- 1 | public class LambdaVariableScope { 2 | public static void main(String[] args) { 3 | String name = "Java Helps"; 4 | Thread validLambda = new Thread(() -> System.out.println(name)); 5 | /*Thread invalidLambda = new Thread(() -> { 6 | name = "Something else"; // Cannot change the value 7 | System.out.println(name); 8 | });*/ 9 | validLambda.start(); 10 | } 11 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/cep-artifacts/eventstreams/com.javahelps.stream.Temperature_1.0.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.javahelps.stream.Temperature", 3 | "version": "1.0.0", 4 | "nickName": "", 5 | "description": "", 6 | "payloadData": [ 7 | { 8 | "name": "location", 9 | "type": "STRING" 10 | }, 11 | { 12 | "name": "temp", 13 | "type": "INT" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v2/Car.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Car class is a subclass of Vehicle. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class Car extends Vehicle { 8 | /** 9 | * Car class is a non-abstract sub class of Vehicle. 10 | * Must override the drive method. 11 | */ 12 | public void drive() { 13 | System.out.println("Use steering wheel"); 14 | } 15 | } -------------------------------------------------------------------------------- /defaultmethods/NonPublicDefaultMethod.java: -------------------------------------------------------------------------------- 1 | public interface NonPublicDefaultMethod { 2 | /* 3 | * Compile time error. 4 | * Default method must be public. 5 | */ 6 | protected default void print() { 7 | System.out.println("Hello world"); 8 | } 9 | 10 | /** 11 | * No error. 12 | * Default methods are implicitly public. 13 | */ 14 | default void doStuff() { 15 | System.out.println("Default method"); 16 | } 17 | } -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Gradient.java: -------------------------------------------------------------------------------- 1 | public class Gradient implements Background { 2 | private String colorX; 3 | private String colorY; 4 | 5 | public Gradient(String colorX, String colorY) { 6 | this.colorX = colorX; 7 | this.colorY = colorY; 8 | } 9 | 10 | @Override 11 | public void fill() { 12 | System.out.println("Fill with: " + colorX + " & " + colorY); 13 | } 14 | } -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /trywithresources/TryWithResources.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | public class TryWithResources { 4 | public static void main(String[] args) { 5 | try (FileWriter writer = new FileWriter("sample.txt")) { 6 | writer.write("Hello world!"); 7 | } catch (IOException ex) { 8 | ex.printStackTrace(); 9 | } // No close statements 10 | // Cannot access writer here 11 | } 12 | } -------------------------------------------------------------------------------- /designpatterns/factory/v2/com/javahelps/shapes/Rectangle.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | class Rectangle implements Shape { 4 | private int width; 5 | private int height; 6 | 7 | public Rectangle(int width, int height) { 8 | this.width = width; 9 | this.height = height; 10 | } 11 | 12 | @Override 13 | public void draw() { 14 | System.out.println("Rectangle"); 15 | } 16 | } -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleSix.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleSix { 2 | public static void main(String[] args) { 3 | TaxCalculator calculator = x -> x * 0.02; 4 | doStuff(calculator); 5 | } 6 | 7 | private static void doStuff(TaxCalculator calc) { 8 | double tax = calc.calculate(100.00); 9 | System.out.println("TAX: " + tax); 10 | } 11 | } 12 | 13 | interface TaxCalculator { 14 | public double calculate(double amount); 15 | } -------------------------------------------------------------------------------- /designpatterns/factory/v1/com/javahelps/shapes/Rectangle.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | public class Rectangle implements Shape { 4 | private int width; 5 | private int height; 6 | 7 | public Rectangle(int width, int height) { 8 | this.width = width; 9 | this.height = height; 10 | } 11 | 12 | @Override 13 | public void draw() { 14 | System.out.println("Rectangle"); 15 | } 16 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v1/VehicleDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Vehicle class. 3 | * WARNING: 4 | * This class gives compile time error. 5 | * Cannot instantiate the abstract class. 6 | * 7 | * @version 1.0 8 | * @author L.Gobinath 9 | */ 10 | public class VehicleDemo { 11 | public static void main(String[] args) { 12 | Vehicle vehicle = new Vehicle(); // Compile time error 13 | } 14 | } -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/src/com/javahelps/jerseydemo/app/HelloWorldApplication.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.jerseydemo.app; 2 | 3 | import org.glassfish.jersey.server.ResourceConfig; 4 | 5 | public class HelloWorldApplication extends ResourceConfig { 6 | public HelloWorldApplication() { 7 | // Define the package which contains the service classes. 8 | packages("com.javahelps.jerseydemo.services"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /antlr/antlr-demo/src/main/antlr4/com/javahelps/antlrdemo/calculator/Calculator.g4: -------------------------------------------------------------------------------- 1 | 2 | grammar Calculator; 3 | 4 | 5 | operation 6 | : left=NUMBER operator='+' right=NUMBER 7 | | left=NUMBER operator='-' right=NUMBER 8 | | left=NUMBER operator='*' right=NUMBER 9 | | left=NUMBER operator='/' right=NUMBER 10 | ; 11 | 12 | NUMBER 13 | : ('0' .. '9') + ('.' ('0' .. '9') +)? 14 | ; 15 | 16 | WS : (' ' | '\t')+ -> channel(HIDDEN); -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleTwo.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleTwo { 2 | public static void main(String[] args) { 3 | Printable printable = (x, y) -> { 4 | for(int i = 1; i <= y; i++) { 5 | System.out.println(x); 6 | } 7 | }; 8 | doStuff(printable); 9 | } 10 | 11 | private static void doStuff(Printable printer) { 12 | printer.print("Hello", 5); 13 | } 14 | } 15 | 16 | interface Printable { 17 | public void print(String msg, int count); 18 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v2/Motorbike.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Motorbike class is a subclass of Vehicle. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class Motorbike extends Vehicle { 8 | /** 9 | * Motorbike class is a non-abstract sub class of Vehicle. 10 | * Must override the drive method. 11 | */ 12 | @Override 13 | public void drive() { 14 | System.out.println("Use handlebars"); 15 | } 16 | } -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Square.java: -------------------------------------------------------------------------------- 1 | public class Square implements Shape { 2 | private double width; 3 | private Background background; 4 | 5 | public Square(double width, Background background) { 6 | this.width = width; 7 | this.background = background; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Create a square with width: " + width); 13 | background.fill(); 14 | } 15 | } -------------------------------------------------------------------------------- /trywithresources/TryWithMultiResources.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | public class TryWithMultiResources { 4 | public static void main(String[] args) { 5 | // Notice the semicolons 6 | try (FileWriter fw = new FileWriter("sample.txt"); 7 | BufferedWriter writer = new BufferedWriter(fw);) { 8 | writer.write("Hello world!"); 9 | } catch (IOException ex) { 10 | ex.printStackTrace(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /designpatterns/bridge/v2/Circle.java: -------------------------------------------------------------------------------- 1 | public class Circle implements Shape { 2 | private double radius; 3 | private Background background; 4 | 5 | public Circle(double radius, Background background) { 6 | this.radius = radius; 7 | this.background = background; 8 | } 9 | 10 | @Override 11 | public void draw() { 12 | System.out.println("Create a circle with radius: " + radius); 13 | background.fill(); 14 | } 15 | } -------------------------------------------------------------------------------- /lambdaexpression/LambdaRuleOne.java: -------------------------------------------------------------------------------- 1 | public class LambdaRuleOne { 2 | public static void main(String[] args) { 3 | Printable printable = (String x, int y) -> { 4 | for(int i = 1; i <= y; i++) { 5 | System.out.println(x); 6 | } 7 | }; 8 | doStuff(printable); 9 | } 10 | 11 | private static void doStuff(Printable printer) { 12 | printer.print("Hello", 5); 13 | } 14 | } 15 | 16 | interface Printable { 17 | public void print(String msg, int count); 18 | } -------------------------------------------------------------------------------- /maven/manual/Calculator/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Calculator 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /maven/manual/Calculator/src/com/javahelps/calculator/Calculator.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.calculator; 2 | 3 | import net.objecthunter.exp4j.Expression; 4 | import net.objecthunter.exp4j.ExpressionBuilder; 5 | 6 | public class Calculator { 7 | 8 | public static void main(String[] args) { 9 | String exp = "2 + 3 * 5"; 10 | 11 | Expression expression = new ExpressionBuilder(exp).build(); 12 | double ans = expression.evaluate(); 13 | System.out.println(ans); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /maven/maven/calculator/src/main/java/com/javahelps/calculator/Calculator.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.calculator; 2 | 3 | import net.objecthunter.exp4j.Expression; 4 | import net.objecthunter.exp4j.ExpressionBuilder; 5 | 6 | public class Calculator { 7 | 8 | public static void main(String[] args) { 9 | String exp = "2 + 3 * 5"; 10 | 11 | Expression expression = new ExpressionBuilder(exp).build(); 12 | double ans = expression.evaluate(); 13 | System.out.println(ans); 14 | } 15 | } -------------------------------------------------------------------------------- /webservices/microservices/Hello-Service/src/main/java/com/javahelps/service/Student.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.service; 2 | 3 | public class Student { 4 | 5 | private String name; 6 | private int age; 7 | 8 | public String getName() { 9 | return name; 10 | } 11 | 12 | public void setName(String name) { 13 | this.name = name; 14 | } 15 | 16 | public int getAge() { 17 | return age; 18 | } 19 | 20 | public void setAge(int age) { 21 | this.age = age; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/cep-artifacts/eventpublishers/com.javahelps.publisher.logger.Temperature.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /threaddeadlock/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | final Account accA = new Account("Acc 1"); 4 | final Account accB = new Account("Acc 2"); 5 | accA.deposit(1000.00); 6 | accB.deposit(1000.00); 7 | 8 | Transaction t1 = new Transaction("T01", accA, accB, 100.00); 9 | Transaction t2 = new Transaction("T02", accB, accA, 500.00); 10 | 11 | t1.start(); 12 | t2.start(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /threads/ThreadDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample test class to start Threads. 3 | * 4 | * @author L.Gobinath 5 | */ 6 | public class ThreadDemo { 7 | public static void main(String[] args) { 8 | // Create thread objects 9 | Thread threadA = new ThreadA(); // Thread object 10 | Runnable runnable = new ThreadB(); // Runnable object 11 | Thread threadB = new Thread(runnable); // Helper thread object 12 | 13 | // Start the threads 14 | threadA.start(); 15 | threadB.start(); 16 | } 17 | } -------------------------------------------------------------------------------- /webservices/microservices/springboot/mysql-rest-service/src/main/java/com/javahelps/restservice/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.restservice.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.rest.core.annotation.RestResource; 5 | 6 | import com.javahelps.restservice.entity.User; 7 | 8 | @RestResource(exported = false) 9 | public interface UserRepository extends JpaRepository { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/GradientSquare.java: -------------------------------------------------------------------------------- 1 | public class GradientSquare extends Square { 2 | private String colorX; 3 | private String colorY; 4 | 5 | public GradientSquare(double width, String colorX, String colorY) { 6 | super(width); 7 | this.colorX = colorX; 8 | this.colorY = colorY; 9 | } 10 | 11 | @Override 12 | public void draw() { 13 | super.draw(); 14 | System.out.println("Fill with: " + colorX + " & " + colorY); 15 | } 16 | } -------------------------------------------------------------------------------- /threaddeadlock/fixed/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | final Account accA = new Account("Acc 1"); 4 | final Account accB = new Account("Acc 2"); 5 | accA.deposit(1000.00); 6 | accB.deposit(1000.00); 7 | 8 | Transaction t1 = new Transaction("T01", accA, accB, 100.00); 9 | Transaction t2 = new Transaction("T02", accB, accA, 500.00); 10 | 11 | t1.start(); 12 | t2.start(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /designpatterns/bridge/v1/GradientCircle.java: -------------------------------------------------------------------------------- 1 | public class GradientCircle extends Circle { 2 | private String colorX; 3 | private String colorY; 4 | 5 | public SolidColorCircle(double radius, String colorX, String colorY) { 6 | super(radius); 7 | this.colorX = colorX; 8 | this.colorY = colorY; 9 | } 10 | 11 | @Override 12 | public void draw() { 13 | super.draw(); 14 | System.out.println("Fill with: " + colorX + " & " + colorY); 15 | } 16 | } -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.8 9 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.8 9 | -------------------------------------------------------------------------------- /maven/manual/Calculator/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /designpatterns/factory/v1/ShapeClient.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | import com.javahelps.shapes.*; 3 | 4 | public class ShapeClient { 5 | public static void main(String[] args) { 6 | Random random = new Random(); 7 | Shape circle = new Circle(random.nextInt()); 8 | Shape square = new Square(random.nextInt()); 9 | Shape rectangle = new Rectangle(random.nextInt(), random.nextInt()); 10 | circle.draw(); 11 | square.draw(); 12 | rectangle.draw(); 13 | } 14 | } -------------------------------------------------------------------------------- /interfaces/InterfaceFields.java: -------------------------------------------------------------------------------- 1 | /** 2 | * All the variables declared in an interface are by default public, static and final. 3 | * 4 | * @author L.Gobinath 5 | */ 6 | public class InterfaceFields { 7 | public static void main(String[] args) { 8 | // Size.MIN_SIZE = 5; // Compile time error 9 | System.out.println(Size.MIN_SIZE); 10 | System.out.println(Size.MAX_SIZE); 11 | } 12 | } 13 | 14 | interface Size { 15 | int MIN_SIZE = 1; 16 | public static final int MAX_SIZE = 10; 17 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v3/Car.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Car class is a subclass of Vehicle. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class Car extends Vehicle { 8 | 9 | public Car() { 10 | super(4); // Call super class constructor 11 | } 12 | 13 | /** 14 | * Car class is a non-abstract sub class of Vehicle. 15 | * Must override the drive method. 16 | */ 17 | public void drive() { 18 | System.out.println("Use steering wheel"); 19 | } 20 | } -------------------------------------------------------------------------------- /designpatterns/factory/v2/ShapeClient.java: -------------------------------------------------------------------------------- 1 | import com.javahelps.shapes.*; 2 | 3 | public class ShapeClient { 4 | public static void main(String[] args) { 5 | ShapeFactory factory = new ShapeFactory(); 6 | Shape circle = factory.createShape(ShapeFactory.Type.CIRCLE); 7 | Shape square = factory.createShape(ShapeFactory.Type.SQUARE); 8 | Shape rectangle = factory.createShape(ShapeFactory.Type.RECTANGLE); 9 | circle.draw(); 10 | square.draw(); 11 | rectangle.draw(); 12 | } 13 | } -------------------------------------------------------------------------------- /defaultmethods/OverrideDemo.java: -------------------------------------------------------------------------------- 1 | public class OverrideDemo { 2 | public static void main(String[] args) { 3 | Note note = new Note("Hello world"); 4 | note.read(); 5 | } 6 | } 7 | 8 | interface Readable { 9 | default void read() { 10 | System.out.println("Read"); 11 | } 12 | } 13 | 14 | 15 | class Note implements Readable { 16 | private String content; 17 | 18 | public Note(String content) { 19 | this.content = content; 20 | } 21 | 22 | @Override 23 | public void read() { 24 | System.out.println(content); 25 | } 26 | } -------------------------------------------------------------------------------- /stringimmutability/BestPractice.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Modifying String object creates Garbage objects. 3 | * Java recommends to use either StringBuffer or StringBuilder. 4 | * 5 | * @author L.Gobinath 6 | */ 7 | public class BestPractice { 8 | public static void main(String[] args) { 9 | StringBuilder builder = new StringBuilder(); 10 | 11 | for (int i = 0; i < 10; i++) { 12 | builder.append(i); 13 | } 14 | String result = builder.toString(); 15 | System.out.println(result); 16 | } 17 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v2/VehicleDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Vehicle class. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class VehicleDemo { 8 | public static void main(String[] args) { 9 | Vehicle car = new Car(); 10 | Vehicle motorbike = new Motorbike(); 11 | doDrive(car); // Use steering wheel 12 | doDrive(motorbike); // Use handlebars 13 | } 14 | 15 | public static void doDrive(Vehicle vehicle) { 16 | vehicle.drive(); 17 | } 18 | } -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v3/VehicleDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Vehicle class. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class VehicleDemo { 8 | public static void main(String[] args) { 9 | Vehicle car = new Car(); 10 | Vehicle motorbike = new Motorbike(); 11 | doDrive(car); // Use steering wheel 12 | doDrive(motorbike); // Use handlebars 13 | } 14 | 15 | public static void doDrive(Vehicle vehicle) { 16 | vehicle.drive(); 17 | } 18 | } -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/src/com/javahelps/jerseydemo/HelloWorldService.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.jerseydemo; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.PathParam; 6 | import javax.ws.rs.core.Response; 7 | 8 | @Path("/sayhello") 9 | public class HelloWorldService { 10 | 11 | @GET 12 | @Path("/{name}") 13 | public Response sayHello(@PathParam("name") String msg) { 14 | String output = "Hello, " + msg + "!"; 15 | return Response.status(200).entity(output).build(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /stripes/Hello World/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v2.0/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.setTitle("Hamlet"); 11 | book.setAuthor("William Shakespeare"); 12 | book.setPrice(5.95); 13 | 14 | System.out.println("Title: " + book.getTitle()); 15 | System.out.println("Price: $" + book.getPrice()); 16 | book.sell(2); 17 | } 18 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | 24 | # Eclipse 25 | .classpath 26 | .project 27 | .settings/ 28 | 29 | # Intellij 30 | .idea/ 31 | *.iml 32 | *.iws 33 | 34 | # Maven 35 | log/ 36 | target/ 37 | .cache-tests 38 | .cache-main -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v3/Motorbike.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Motorbike class is a subclass of Vehicle. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class Motorbike extends Vehicle { 8 | 9 | public Motorbike() { 10 | super(2); // Call super class constructor 11 | } 12 | 13 | /** 14 | * Motorbike class is a non-abstract sub class of Vehicle. 15 | * Must override the drive method. 16 | */ 17 | @Override 18 | public void drive() { 19 | System.out.println("Use handlebars"); 20 | } 21 | } -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.0/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.title = "Hamlet"; 11 | book.author = "William Shakespeare"; 12 | book.price = -5.95; // A negative price! 13 | 14 | System.out.println("Title: " + book.title); 15 | System.out.println("Price: $" + book.price); 16 | book.sell(2); 17 | } 18 | } -------------------------------------------------------------------------------- /ocewcd/Hello World/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /stringimmutability/GarbageGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Modifying String object creates Garbage objects. 3 | * It is not recommended to modify a String object so many times. 4 | * This code is an example of bad practice in Java. 5 | * 6 | * @author L.Gobinath 7 | */ 8 | public class GarbageGenerator { 9 | public static void main(String[] args) { 10 | String result = ""; 11 | 12 | for (int i = 0; i < 10; i++) { 13 | // Every time creates a new object 14 | result += i; 15 | } 16 | System.out.println(result); 17 | } 18 | } -------------------------------------------------------------------------------- /stripes/Hello World/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.1/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * 4 | * @version 1.1 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.title = "Hamlet"; 11 | book.author = "William Shakespeare"; 12 | // Still directly assigning the value. 13 | // I am a rule breaker. 14 | book.price = -5.95; 15 | 16 | System.out.println("Title: " + book.title); 17 | System.out.println("Price: $" + book.price); 18 | book.sell(2); 19 | } 20 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/src/com/javahelps/jerseydemo/services/HelloWorldService.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.jerseydemo.services; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.PathParam; 6 | import javax.ws.rs.core.Response; 7 | 8 | @Path("/sayhello") 9 | public class HelloWorldService { 10 | 11 | @GET 12 | @Path("/{name}") 13 | public Response sayHello(@PathParam("name") String msg) { 14 | String output = "Hello, " + msg + "!"; 15 | return Response.status(200).entity(output).build(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /webservices/microservices/javalin/student-crud/src/main/java/com/javahelps/javalindemo/studentcrud/Main.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.javalindemo.studentcrud; 2 | 3 | import io.javalin.Javalin; 4 | 5 | import static io.javalin.apibuilder.ApiBuilder.crud; 6 | 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | 11 | Javalin app = Javalin.create() 12 | .enableCorsForAllOrigins() 13 | .start(8080); 14 | 15 | app.routes(() -> crud("/students/:student-id", new StudentController())); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/cep-artifacts/eventreceivers/com.javahelps.receiver.Temperature.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | false 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.0/Book.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Book class used to explain the encapsulation. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class Book { 8 | // Title of the book. 9 | String title; 10 | // Author of the book. 11 | String author; 12 | // Price of the book. 13 | double price; 14 | 15 | /** 16 | * Print the total amount for given quantity. 17 | * @param qty The quantity 18 | */ 19 | public void sell(int qty) { 20 | System.out.println("Total: $" + (qty * price)); 21 | } 22 | } -------------------------------------------------------------------------------- /threaddeadlock/Account.java: -------------------------------------------------------------------------------- 1 | public class Account { 2 | private final String name; 3 | private double balance; 4 | 5 | public Account(String name) { 6 | this.name = name; 7 | } 8 | 9 | public void withdraw(double amount) { 10 | this.balance -= amount; 11 | } 12 | 13 | public void deposit(double amount) { 14 | this.balance += amount; 15 | } 16 | 17 | public double getBalance() { 18 | return this.balance; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /threaddeadlock/fixed/Account.java: -------------------------------------------------------------------------------- 1 | public class Account { 2 | private final String name; 3 | private double balance; 4 | 5 | public Account(String name) { 6 | this.name = name; 7 | } 8 | 9 | public void withdraw(double amount) { 10 | this.balance -= amount; 11 | } 12 | 13 | public void deposit(double amount) { 14 | this.balance += amount; 15 | } 16 | 17 | public double getBalance() { 18 | return this.balance; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.2/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * 4 | * @version 1.2 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.title = "Hamlet"; 11 | book.author = "William Shakespeare"; 12 | book.setPrice(-5.95); // Error message 13 | book.setPrice(5.95); 14 | 15 | System.out.println("Title: " + book.title); 16 | // System.out.println("Price: $" + book.price); 17 | System.out.println("Price: $" + book.getPrice()); 18 | book.sell(2); 19 | } 20 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftEventTransmissionService/ttypes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | import Data.ttypes 11 | import Exception.ttypes 12 | 13 | 14 | from thrift.transport import TTransport 15 | from thrift.protocol import TBinaryProtocol, TProtocol 16 | try: 17 | from thrift.protocol import fastbinary 18 | except: 19 | fastbinary = None 20 | 21 | 22 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/gen-py/ThriftSecureEventTransmissionService/ttypes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.9.1) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TException, TApplicationException 10 | import Data.ttypes 11 | import Exception.ttypes 12 | 13 | 14 | from thrift.transport import TTransport 15 | from thrift.protocol import TBinaryProtocol, TProtocol 16 | try: 17 | from thrift.protocol import fastbinary 18 | except: 19 | fastbinary = None 20 | 21 | 22 | -------------------------------------------------------------------------------- /defaultmethods/DiamondProblem.java: -------------------------------------------------------------------------------- 1 | public class DiamondProblem { 2 | public static void main(String[] args) { 3 | A obj = new D(); 4 | obj.print(); 5 | } 6 | } 7 | 8 | interface A { 9 | default void print() { 10 | System.out.println("A"); 11 | } 12 | } 13 | 14 | interface B extends A { 15 | default void print() { 16 | System.out.println("B"); 17 | } 18 | } 19 | 20 | interface C extends A { 21 | default void print() { 22 | System.out.println("C"); 23 | } 24 | } 25 | /* 26 | * Compile time error. 27 | * Diamond problem since there is a clash in the print() methods. 28 | */ 29 | class D implements B, C { 30 | 31 | } -------------------------------------------------------------------------------- /stringimmutability/StringPool.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Same "Java" object is shared by both references. 3 | * 4 | * @author L.Gobinath 5 | */ 6 | public class StringPool { 7 | public static void main(String[] args) { 8 | String x = "Java"; 9 | String y = "Java"; 10 | 11 | System.out.println(x == y); //true 12 | System.out.println(x.toLowerCase()); // java 13 | System.out.println(x); // Java 14 | System.out.println(y); // Java 15 | x = x.toLowerCase(); // Update the reference 16 | System.out.println(x); // java 17 | System.out.println(y); // Java 18 | } 19 | } -------------------------------------------------------------------------------- /objectorientedprogramming/inheritance/v1.0/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.setTitle("Hamlet"); 11 | book.setAuthor("William Shakespeare"); 12 | book.setPrice(5.95); 13 | 14 | Magazine magazine = new Magazine(); 15 | magazine.setTitle("TIME"); 16 | magazine.setIssue("Feb. 2, 2015"); 17 | magazine.setPrice(0.58); 18 | 19 | book.sell(2); 20 | magazine.sell(52); 21 | } 22 | } -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /cep/wso2cep/cepclient/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | cepclient 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /defaultmethods/DiamondSolutionOne.java: -------------------------------------------------------------------------------- 1 | public class DiamondSolutionOne { 2 | public static void main(String[] args) { 3 | A obj = new D(); 4 | obj.print(); 5 | } 6 | } 7 | 8 | interface A { 9 | default void print() { 10 | System.out.println("A"); 11 | } 12 | } 13 | 14 | interface B extends A { 15 | default void print() { 16 | System.out.println("B"); 17 | } 18 | } 19 | 20 | interface C extends A { 21 | default void print() { 22 | System.out.println("C"); 23 | } 24 | } 25 | 26 | /* 27 | * The overridden method will get selected 28 | */ 29 | class D implements B, C { 30 | @Override 31 | public void print() { 32 | System.out.println("D"); 33 | } 34 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/services/HelloService/META-INF/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Please Type your service description here 4 | 5 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | com.javahelps.helloaxis.HelloService 15 | 16 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Neo4J OGM HelloWorld 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /objectorientedprogramming/abstraction/v3/Vehicle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample abstract Vehicle class with a constructor. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public abstract class Vehicle { 8 | private int noOfWheels; 9 | 10 | /** 11 | * Abstract class can have constructor. 12 | * @param noOfWheels Number of wheels of this Vehicle 13 | */ 14 | public Vehicle(int noOfWheels) { 15 | this.noOfWheels = noOfWheels; 16 | } 17 | 18 | /** 19 | * Implementation of drive method is unknown for Vehicle. 20 | * Notice that the method is terminated with a semicolon. 21 | */ 22 | public abstract void drive(); 23 | } -------------------------------------------------------------------------------- /objectorientedprogramming/inheritance/v2.0/BookShop.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for Book class. 3 | * There are no changes in this class. 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class BookShop { 8 | public static void main(String[] args) { 9 | Book book = new Book(); 10 | book.setTitle("Hamlet"); 11 | book.setAuthor("William Shakespeare"); 12 | book.setPrice(5.95); 13 | 14 | Magazine magazine = new Magazine(); 15 | magazine.setTitle("TIME"); 16 | magazine.setIssue("Feb. 2, 2015"); 17 | magazine.setPrice(0.58); 18 | 19 | book.sell(2); 20 | magazine.sell(52); 21 | } 22 | } -------------------------------------------------------------------------------- /designpatterns/prototype/Cell.java: -------------------------------------------------------------------------------- 1 | public class Cell implements Cloneable { 2 | private String color; 3 | 4 | public Cell(String color) { 5 | this.color = color; 6 | 7 | // Make it time consuming task. 8 | try { 9 | Thread.sleep(100); 10 | } catch (InterruptedException e) { 11 | } 12 | } 13 | 14 | public String getColor() { 15 | return color; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return color.substring(0, 1); 21 | } 22 | 23 | @Override 24 | public Object clone() { 25 | Object obj = null; 26 | try { 27 | obj = super.clone(); 28 | } catch (CloneNotSupportedException e) { 29 | e.printStackTrace(); 30 | } 31 | return obj; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /stripes/Hello World/WebContent/WEB-INF/jsp/result.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld"%> 3 | 4 | 5 | 6 | 7 | 8 | Hello World 9 | 10 | 11 |

Current time is: ${actionBean.time}

12 |
13 | 16 | Update the Time 17 | 18 | 19 | -------------------------------------------------------------------------------- /defaultmethods/DiamondSolutionTwo.java: -------------------------------------------------------------------------------- 1 | public class DiamondSolutionTwo { 2 | public static void main(String[] args) { 3 | A obj = new D(); 4 | obj.print(); 5 | } 6 | } 7 | 8 | interface A { 9 | default void print() { 10 | System.out.println("A"); 11 | } 12 | } 13 | 14 | interface B extends A { 15 | default void print() { 16 | System.out.println("B"); 17 | } 18 | } 19 | 20 | interface C extends A { 21 | default void print() { 22 | System.out.println("C"); 23 | } 24 | } 25 | 26 | class P { 27 | public void print() { 28 | System.out.println("P"); 29 | } 30 | } 31 | 32 | /* 33 | * Super class provides the implementation of print() method 34 | */ 35 | class D extends P implements B, C { 36 | 37 | } -------------------------------------------------------------------------------- /maven/maven/calculator/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.javahelps.calculator 6 | calculator 7 | 0.0.1-SNAPSHOT 8 | Calculator 9 | 10 | 11 | 12 | 13 | net.objecthunter 14 | exp4j 15 | 0.4.8 16 | 17 | 18 | -------------------------------------------------------------------------------- /objectorientedprogramming/inheritance/v2.0/Book.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Book class used to explain the encapsulation. 3 | * Book is a sub class of Publication. 4 | * 5 | * @version 2.0 6 | * @author L.Gobinath 7 | */ 8 | public class Book extends Publication { 9 | // Author of the book. 10 | private String author; 11 | 12 | /** 13 | * Get the author of the book. 14 | * @return The author of the book. 15 | */ 16 | public String getAuthor() { 17 | return this.author; 18 | } 19 | 20 | /** 21 | * Set the author of the book. 22 | * @param author The author of the book. 23 | */ 24 | public void setAuthor(String author) { 25 | this.author = author; 26 | } 27 | } -------------------------------------------------------------------------------- /webservices/microservices/springboot/mysql-rest-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Automatically update the database 2 | spring.jpa.hibernate.ddl-auto=update 3 | 4 | # The database connection URL 5 | spring.datasource.url=jdbc:mysql://localhost:3306/user_db?useSSL=false 6 | 7 | # Username 8 | spring.datasource.username=root 9 | 10 | # Password 11 | spring.datasource.password=root 12 | 13 | # Define the database platform 14 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect 15 | 16 | # Define the naming strategy 17 | spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy 18 | 19 | # Define the default schema 20 | spring.jpa.properties.hibernate.default_schema=schema -------------------------------------------------------------------------------- /webservices/axis2/helloworld/client/Client.java: -------------------------------------------------------------------------------- 1 | import org.apache.ws.axis2.*; 2 | 3 | public class Client { 4 | 5 | public static void main(String[] args) throws Exception { 6 | // Create the stub object 7 | HelloServiceStub stub = new HelloServiceStub(); 8 | 9 | // Create the request 10 | HelloServiceStub.Add request = new HelloServiceStub.Add(); 11 | 12 | // Set the parameters 13 | request.setArgs0(10); 14 | request.setArgs1(20); 15 | 16 | // Invoke the service 17 | HelloServiceStub.AddResponse response = stub.add(request); 18 | int ans = response.get_return(); // 10 + 20 = 30 19 | System.out.println("Response : " + ans); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /hibernate/HibernateXML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /objectorientedprogramming/inheritance/v2.0/Magazine.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Magazine class used to explain the inheritance. 3 | * Magazine is a sub class of Publication. 4 | * 5 | * @version 2.0 6 | * @author L.Gobinath 7 | */ 8 | public class Magazine extends Publication { 9 | // Author of the magazine. 10 | private String issue; 11 | 12 | /** 13 | * Get the issue of the magazine. 14 | * @return The issue of the magazine. 15 | */ 16 | public String getIssue() { 17 | return this.issue; 18 | } 19 | 20 | /** 21 | * Set the issue of the magazine. 22 | * @param issue The issue of the magazine. 23 | */ 24 | public void setIssue(String issue) { 25 | this.issue = issue; 26 | } 27 | } -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /designpatterns/factory/v2/com/javahelps/shapes/ShapeFactory.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.shapes; 2 | 3 | import java.util.Random; 4 | 5 | public class ShapeFactory { 6 | private Random random = new Random(); 7 | public enum Type { 8 | CIRCLE, SQUARE, RECTANGLE; 9 | } 10 | 11 | public Shape createShape(Type type) { 12 | Shape shape = null; 13 | switch (type) { 14 | case CIRCLE: 15 | shape = new Circle(random.nextInt()); 16 | break; 17 | case SQUARE: 18 | shape = new Square(random.nextInt()); 19 | break; 20 | case RECTANGLE: 21 | shape = new Rectangle(random.nextInt(), random.nextInt()); 22 | } 23 | return shape; 24 | } 25 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /threads/TimerDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class demonstrates a Timer which prints 'Hello world!' for every 2 seconds. 3 | * To terminate the application press Ctrl + C. 4 | * 5 | * @author L.Gobinath 6 | */ 7 | public class TimerDemo { 8 | public static void main(String[] args) { 9 | Runnable timer = new Timer(); 10 | Thread thread = new Thread(timer); 11 | thread.start(); 12 | } 13 | } 14 | 15 | class Timer implements Runnable { 16 | private final long INTERVAL = 2000; // 2 seconds 17 | @Override 18 | public void run() { 19 | while(true) { 20 | // Print the message 21 | System.out.println("Hello world!"); 22 | // Sleep for 2 seconds 23 | try { 24 | Thread.sleep(INTERVAL); 25 | } catch(InterruptedException ex) {} 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /webservices/microservices/javalin/contact-us/src/main/resources/web/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Thank You 6 | 7 | 25 | 26 | 27 |

Thank you for contacting us – we will get back to you soon!

28 | 29 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/PublisherClient.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from Publisher import Publisher 4 | 5 | CEP_SERVER_ADDRESS = '192.168.122.1' # IP address of the server. You can find it at the end of the CEP console 6 | SSL_PORT = 7711 # Thrift SSL port of the server 7 | TCP_PORT = 7611 # Thrift TCP port of the server 8 | USERNAME = 'admin' # Username 9 | PASSWORD = 'admin' # Passowrd 10 | 11 | publisher = Publisher(CEP_SERVER_ADDRESS, SSL_PORT, TCP_PORT) 12 | 13 | # Connect to server with username and password 14 | publisher.connect(USERNAME, PASSWORD) 15 | 16 | # Publish an event to the Temperature stream 17 | publisher.publish('com.javahelps.stream.Temperature:1.0.0', 'Kitchen', 56) 18 | 19 | # Disconnect 20 | publisher.disconnect() 21 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/src/com/javahelps/hibernate/Student.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.hibernate; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Student implements Serializable { 6 | private int id; 7 | private String name; 8 | private int age; 9 | 10 | public int getId() { 11 | return id; 12 | } 13 | 14 | public void setId(int id) { 15 | this.id = id; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | public int getAge() { 27 | return age; 28 | } 29 | 30 | public void setAge(int age) { 31 | this.age = age; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return id + "\t" + name + "\t" + age; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/CalculatorDemo/v1/CalculatorDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Calculator class to demonstrate Method Overloading. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class CalculatorDemo { 8 | public static void main(String[] args) { 9 | Calculator calc = new Calculator(); 10 | calc.addLong(10L, 30L); 11 | calc.addFloat(10.5f, 0.5f); 12 | } 13 | } 14 | 15 | class Calculator { 16 | public void addLong(long x, long y) { 17 | long result = x + y; 18 | System.out.println("Long addition: " + result); 19 | } 20 | 21 | public void addFloat(float x, float y) { 22 | float result = x + y; 23 | System.out.println("Float addition: " + result); 24 | } 25 | } -------------------------------------------------------------------------------- /trywithresources/FileWriterDemo.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | public class FileWriterDemo { 4 | public static void main(String[] args) { 5 | FileWriter writer = null; 6 | try { 7 | // Create a FileWriter object 8 | writer = new FileWriter("sample.txt"); 9 | writer.write("Hello world!"); 10 | } catch (IOException ex) { 11 | ex.printStackTrace(); 12 | } finally { 13 | // Check for null reference 14 | if (writer != null) { 15 | try { 16 | writer.close(); // Close the connection 17 | } catch (IOException ex) { 18 | ex.printStackTrace(); 19 | } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/src/com/javahelps/helloaxis/Client.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.helloaxis; 2 | 3 | public class Client { 4 | public static void main(String[] args) throws Exception { 5 | // Create the stub object 6 | HelloServiceStub stub = new HelloServiceStub(); 7 | 8 | // Create the request 9 | HelloServiceStub.SayHello request = new HelloServiceStub.SayHello(); 10 | 11 | // Set the parameters 12 | request.setName("Gobinath"); 13 | 14 | // Invoke the service 15 | HelloServiceStub.SayHelloResponse response = stub.sayHello(request); 16 | String res = response.get_return(); // Hello Gobinath 17 | System.out.println("Response : " + res); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/WEB-INF/conf/axis2.policy: -------------------------------------------------------------------------------- 1 | grant codeBase "file:${axis2.home}/lib/-" { 2 | permission java.io.FilePermission "${axis2.home}", "read,write"; 3 | permission java.io.FilePermission "${axis2.home}${file.separator}-", "read,write"; 4 | permission java.io.FilePermission "${java.io.tmpdir}", "read"; 5 | permission java.io.FilePermission "${java.io.tmpdir}${file.separator}-", "read,write,delete"; 6 | permission java.io.FilePermission "${java.home}${file.separator}lib${file.separator}wsdl.properties", "read"; 7 | permission java.net.SocketPermission "*", "resolve,connect,listen,accept"; 8 | permission java.lang.RuntimePermission "*"; 9 | permission java.util.PropertyPermission "*", "read"; 10 | }; 11 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/WEB-INF/conf/axis2.policy: -------------------------------------------------------------------------------- 1 | grant codeBase "file:${axis2.home}/lib/-" { 2 | permission java.io.FilePermission "${axis2.home}", "read,write"; 3 | permission java.io.FilePermission "${axis2.home}${file.separator}-", "read,write"; 4 | permission java.io.FilePermission "${java.io.tmpdir}", "read"; 5 | permission java.io.FilePermission "${java.io.tmpdir}${file.separator}-", "read,write,delete"; 6 | permission java.io.FilePermission "${java.home}${file.separator}lib${file.separator}wsdl.properties", "read"; 7 | permission java.net.SocketPermission "*", "resolve,connect,listen,accept"; 8 | permission java.lang.RuntimePermission "*"; 9 | permission java.util.PropertyPermission "*", "read"; 10 | }; 11 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.service/src/main/resources/META-INF/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | https 6 | 7 | 8 | com.javahelps.samplecarbon.service.SampleService 9 | 10 | 11 | 12 | true 13 | true 14 | /permission/protected/manage 15 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/src/main/resources/META-INF/component.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | order_menu 5 | order.menu 6 | com.javahelps.samplecarbon.ui.i18n.Resources 7 | manage_menu 8 | ../samplecarbon/index.jsp 9 | region1 10 | 50 11 | manage 12 | ../samplecarbon/images/icon.png 13 | /permission/protected/manage 14 | 15 | 16 | -------------------------------------------------------------------------------- /webservices/microservices/msf4j-helloworld/src/main/java/com/javahelps/service/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.service; 2 | 3 | import javax.ws.rs.DELETE; 4 | import javax.ws.rs.GET; 5 | import javax.ws.rs.POST; 6 | import javax.ws.rs.PUT; 7 | import javax.ws.rs.Path; 8 | 9 | @Path("/service") 10 | public class HelloService { 11 | 12 | @GET 13 | @Path("/") 14 | public String get() { 15 | System.out.println("GET invoked"); 16 | return "Hello from WSO2 MSF4J"; 17 | } 18 | 19 | @POST 20 | @Path("/") 21 | public void post() { 22 | System.out.println("POST invoked"); 23 | } 24 | 25 | @PUT 26 | @Path("/") 27 | public void put() { 28 | System.out.println("PUT invoked"); 29 | } 30 | 31 | @DELETE 32 | @Path("/") 33 | public void delete() { 34 | System.out.println("DELETE invoked"); 35 | } 36 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/wso2-thrift/Exception.thrift: -------------------------------------------------------------------------------- 1 | namespace java org.wso2.carbon.databridge.commons.thrift.exception 2 | 3 | exception ThriftStreamDefinitionException { 4 | 1: required string message 5 | } 6 | 7 | exception ThriftNoStreamDefinitionExistException { 8 | 1: required string message 9 | } 10 | 11 | exception ThriftDifferentStreamDefinitionAlreadyDefinedException { 12 | 1: required string message 13 | } 14 | 15 | exception ThriftMalformedStreamDefinitionException { 16 | 1: required string message 17 | } 18 | 19 | exception ThriftUndefinedEventTypeException { 20 | 1: required string message 21 | } 22 | exception ThriftSessionExpiredException { 23 | 1: required string message 24 | } 25 | 26 | exception ThriftAuthenticationException { 27 | 1: required string message 28 | } 29 | -------------------------------------------------------------------------------- /interfaces/DownloadManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample download manager program. 3 | * Interface is used to provide a port to unknown implementation. 4 | * 5 | * @author L.Gobinath 6 | */ 7 | public class DownloadManager { 8 | private OnDownloadListener listener; 9 | 10 | public void setListener(OnDownloadListener listener) { 11 | this.listener = listener; 12 | } 13 | 14 | public void start() { 15 | boolean completed = false; 16 | double percent = 0.0; 17 | while (!completed) { 18 | // download the file 19 | // increase the completed percentage 20 | if (listener != null) { 21 | listener.onDownload(percent); 22 | } 23 | } 24 | } 25 | } 26 | 27 | interface OnDownloadListener { 28 | void onDownload(double percent); 29 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v1/BankAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample class BankAccount which is used as the super class of CurrentAcoount and SavingsAccount. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BankAccount { 8 | private String name; 9 | protected double balance; 10 | 11 | public String getName() { 12 | return this.name; 13 | } 14 | 15 | public void setName(String name) { 16 | this.name = name; 17 | } 18 | 19 | public void deposite(double amount) { 20 | this.balance += amount; 21 | } 22 | 23 | public boolean withdraw(double amount) { 24 | if (balance > amount) { 25 | balance -= amount; 26 | return true; 27 | } else { 28 | return false; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v1/BankDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for BankAccounts. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BankDemo { 8 | public static void main(String[] args) { 9 | CurrentAccount c = new CurrentAccount(); 10 | SavingsAccount s = new SavingsAccount(); 11 | c.deposite(500.00); 12 | s.deposite(500.00); 13 | doWithdrawal(c); // Withdraw succeed. 14 | doWithdrawal(s); // Withdraw failed. 15 | } 16 | 17 | public static void doWithdrawal(BankAccount acc) { 18 | boolean result = acc.withdraw(1000.00); 19 | if (result) { 20 | System.out.println("Withdraw succeed."); 21 | } else { 22 | System.out.println("Withdraw failed."); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v2/BankAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample class BankAccount which is used as the super class of CurrentAcoount and SavingsAccount. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BankAccount { 8 | private String name; 9 | protected double balance; 10 | 11 | public String getName() { 12 | return this.name; 13 | } 14 | 15 | public void setName(String name) { 16 | this.name = name; 17 | } 18 | 19 | public void deposite(double amount) { 20 | this.balance += amount; 21 | } 22 | 23 | public boolean withdraw(double amount) { 24 | if (balance > amount) { 25 | balance -= amount; 26 | return true; 27 | } else { 28 | return false; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/BankAccountDemo/v2/BankDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Testing class for BankAccounts. 3 | * 4 | * @version 1.0 5 | * @author L.Gobinath 6 | */ 7 | public class BankDemo { 8 | public static void main(String[] args) { 9 | CurrentAccount c = new CurrentAccount(); 10 | SavingsAccount s = new SavingsAccount(); 11 | c.deposite(500.00); 12 | s.deposite(500.00); 13 | doWithdrawal(c); // Withdraw succeed. 14 | doWithdrawal(s); // Withdraw failed. 15 | } 16 | 17 | public static void doWithdrawal(BankAccount acc) { 18 | boolean result = acc.withdraw(1000.00); 19 | if (result) { 20 | System.out.println("Withdraw succeed."); 21 | } else { 22 | System.out.println("Withdraw failed."); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/wso2-thrift/Data.thrift: -------------------------------------------------------------------------------- 1 | namespace java org.wso2.carbon.databridge.commons.thrift.data 2 | 3 | enum ThriftAttributeType{ 4 | INT, 5 | LONG, 6 | FLOAT, 7 | DOUBLE, 8 | BOOL, 9 | STRING 10 | } 11 | 12 | struct ThriftAttribute{ 13 | 1: optional string name; 14 | 2: optional ThriftAttributeType attributeType; 15 | } 16 | 17 | struct ThriftEventBundle { 18 | 1: optional string sessionId; 19 | 2: optional i32 eventNum; 20 | 3: optional list intAttributeList; 21 | 4: optional list longAttributeList; 22 | 5: optional list doubleAttributeList; 23 | 6: optional list boolAttributeList; 24 | 7: optional list stringAttributeList; 25 | 8: optional map> arbitraryDataMapMap; 26 | } 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/CalculatorDemo/v2/CalculatorDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Calculator class to demonstrate Method Overloading. 3 | * 4 | * @version 2.0 5 | * @author L.Gobinath 6 | */ 7 | public class CalculatorDemo { 8 | public static void main(String[] args) { 9 | Calculator calc = new Calculator(); 10 | calc.add(10L, 30L); 11 | calc.add(10.5f, 0.5f); 12 | } 13 | } 14 | 15 | /** 16 | * Calculator class has two methods add(long, long) and add(float, float). 17 | */ 18 | class Calculator { 19 | public void add(long x, long y) { 20 | long result = x + y; 21 | System.out.println("Long addition: " + result); 22 | } 23 | 24 | public void add(float x, float y) { 25 | float result = x + y; 26 | System.out.println("Float addition: " + result); 27 | } 28 | } -------------------------------------------------------------------------------- /interfaces/PrintArray.java: -------------------------------------------------------------------------------- 1 | import java.util.StringJoiner; 2 | 3 | /** 4 | * Example utility interface with a static method. 5 | * You need Java 8 to compile and run this code. 6 | * Static methods in interfaces are introduced in Java 8. 7 | * The StringJoiner class also introduced in Java 8 to join Strings efficiently. 8 | * 9 | * @author L.Gobinath 10 | */ 11 | public class PrintArray { 12 | public static void main(String[] args) { 13 | String[] arr = {"Java", "C++", "C", "Python", "PHP"}; 14 | Printer.print(arr); 15 | } 16 | } 17 | 18 | interface Printer { 19 | public static void print(String[] array) { 20 | StringJoiner joiner = new StringJoiner(", ", "[", "]"); 21 | for (String str : array) { 22 | joiner.add(str); 23 | } 24 | System.out.println(joiner.toString()); 25 | } 26 | } -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.javahelps.samplecarbon.ui 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.sonarlint.eclipse.core.sonarlintBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.m2e.core.maven2Nature 27 | 28 | 29 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /wso2/carbon/helloworld/com.javahelps.samplecarbon.service/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.javahelps.samplecarbon.service 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.sonarlint.eclipse.core.sonarlintBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.m2e.core.maven2Nature 27 | 28 | 29 | -------------------------------------------------------------------------------- /webservices/microservices/Hello-Service/dependency-reduced-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | msf4j-service 5 | org.wso2.msf4j 6 | 2.0.0 7 | ../pom.xml/pom.xml 8 | 9 | 4.0.0 10 | com.javahelps 11 | Hello-Service 12 | WSO2 MSF4J Microservice 13 | 0.1-SNAPSHOT 14 | 15 | com.javahelps.service.Application 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /designpatterns/prototype/Main.java: -------------------------------------------------------------------------------- 1 | 2 | public class Main { 3 | 4 | public static void main(String[] args) { 5 | // Get the start time 6 | long startTime = System.currentTimeMillis(); 7 | 8 | Board chessBoard = new Board(); 9 | 10 | // Get the end time 11 | long endTime = System.currentTimeMillis(); 12 | 13 | System.out.println("Time taken to create a board: " + (endTime - startTime) + " millis"); 14 | 15 | // Print the board 16 | chessBoard.print(); 17 | 18 | System.out.println(); 19 | 20 | // Get the start time 21 | startTime = System.currentTimeMillis(); 22 | 23 | Board checkersBoard = (Board) chessBoard.clone(); 24 | 25 | // Get the end time 26 | endTime = System.currentTimeMillis(); 27 | 28 | System.out.println("Time taken to clone a board: " + (endTime - startTime) + " millis"); 29 | 30 | checkersBoard.print(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HibernateXML 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | org.hibernate.eclipse.console.hibernateBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.hibernate.eclipse.console.hibernateNature 28 | 29 | 30 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.1/Book.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Book class used to explain the encapsulation. 3 | * 4 | * @version 1.1 5 | * @author L.Gobinath 6 | */ 7 | public class Book { 8 | // Title of the book. 9 | String title; 10 | // Author of the book. 11 | String author; 12 | // Price of the book. 13 | double price; 14 | 15 | /** 16 | * Set the price. 17 | * @param price Price of the book. 18 | */ 19 | public void setPrice(double price) { 20 | if (price > 0) { 21 | this.price = price; 22 | } else { 23 | System.out.println("Invalid price"); 24 | } 25 | } 26 | 27 | /** 28 | * Print the total amount for given quantity. 29 | * @param qty The quantity 30 | */ 31 | public void sell(int qty) { 32 | System.out.println("Total: $" + (qty * price)); 33 | } 34 | } -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HibernateAnnotation 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | org.hibernate.eclipse.console.hibernateBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.hibernate.eclipse.console.hibernateNature 28 | 29 | 30 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JPAHelloWorld 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.hibernate.eclipse.console.hibernateBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.hibernate.eclipse.console.hibernateNature 28 | 29 | 30 | -------------------------------------------------------------------------------- /stripes/Hello World/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ocewcd/Hello World/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /interfaces/Computer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * In real world USB port is a point of interaction - Interface. 3 | * This code simulates the real world scenario using interface. 4 | * 5 | * @author L.Gobinath 6 | */ 7 | public class Computer { 8 | public static void main(String[] args) { 9 | Computer comp = new Computer(); 10 | } 11 | 12 | public void connect(USB usb) { 13 | usb.send(new byte[] {1}); // Send some data 14 | byte[] data = usb.receive(); // Receive some data 15 | // do something here 16 | } 17 | } 18 | 19 | interface USB { 20 | void send(byte[] data); 21 | 22 | byte[] receive(); 23 | } 24 | 25 | class Mouse implements USB { 26 | @Override 27 | public void send(byte[] data) { 28 | System.out.println("Connected"); 29 | } 30 | 31 | @Override 32 | public byte[] receive() { 33 | return new byte[] {120, 87}; 34 | } 35 | } -------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.javahelps 5 | Neo4JOGMHelloWorld 6 | 0.0.1-SNAPSHOT 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.3 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | org.neo4j 24 | neo4j-ogm 25 | 1.1.3 26 | 27 | 28 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /webservices/microservices/javalin/contact-us/src/main/java/com/javahelps/javalindemo/contactus/Main.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.javalindemo.contactus; 2 | 3 | import io.javalin.Javalin; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) { 8 | Javalin app = Javalin.create() 9 | .port(8080) 10 | .enableStaticFiles("web") 11 | .start(); 12 | 13 | app.post("/contact-us", ctx -> { 14 | String fullName = ctx.formParam("firstName") + " " + ctx.formParam("lastName"); 15 | String subject = ctx.formParam("subject"); 16 | String message = ctx.formParam("message"); 17 | System.out.println("Message received from " + fullName); 18 | System.out.println("Subject: " + subject); 19 | System.out.println(message); 20 | ctx.redirect("/success.html"); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/TCPServer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append('gen-py') 5 | from thrift.transport import TSocket 6 | from thrift.transport import TTransport 7 | from thrift.protocol import TBinaryProtocol 8 | from thrift.server import TServer 9 | from ServerHandler import ServerHandler 10 | from ThriftEventTransmissionService import ThriftEventTransmissionService 11 | 12 | SERVER_ADDRESS = 'localhost' 13 | SERVER_PORT = 8888 14 | 15 | handler = ServerHandler() 16 | processor = ThriftEventTransmissionService.Processor(handler) 17 | transport = TSocket.TServerSocket(SERVER_ADDRESS, SERVER_PORT) 18 | tfactory = TTransport.TBufferedTransportFactory() 19 | pfactory = TBinaryProtocol.TBinaryProtocolFactory() 20 | 21 | server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) 22 | 23 | print 'Starting TCP Server at ' + SERVER_ADDRESS + ':' + str(SERVER_PORT) 24 | 25 | server.serve() 26 | -------------------------------------------------------------------------------- /synchronization/v1/ConcurrencyProblem.java: -------------------------------------------------------------------------------- 1 | public class ConcurrencyProblem { 2 | static int[] array = {0}; 3 | 4 | public static void main(String[] args) throws InterruptedException { 5 | Thread a = new Thread() { 6 | public void run() { 7 | for(int i = 1; i <= 1000; i++) { 8 | increase(); 9 | } 10 | } 11 | }; 12 | 13 | Thread b = new Thread() { 14 | public void run() { 15 | for(int i = 1; i <= 1000; i++) { 16 | decrease(); 17 | } 18 | } 19 | }; 20 | 21 | a.start(); 22 | b.start(); 23 | a.join(); 24 | b.join(); 25 | System.out.println(array[0]); 26 | } 27 | 28 | public static void increase() { 29 | array[0]++; 30 | } 31 | 32 | public static void decrease() { 33 | array[0]--; 34 | } 35 | } -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/CalculatorDemo/v4/CalculatorDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Calculator class to demonstrate Method Overloading. 3 | * 4 | * @version 4.0 5 | * @author L.Gobinath 6 | */ 7 | public class CalculatorDemo { 8 | public static void main(String[] args) { 9 | Calculator calc = new Calculator(); 10 | // Passing two integer values 11 | calc.add(10, 30); // add(int, int) 12 | // Passing two long values 13 | calc.add(10L, 30L); // add(long, long) 14 | } 15 | } 16 | 17 | /** 18 | * Calculator class has two methods add(long, long) and add(int, int). 19 | */ 20 | class Calculator { 21 | public void add(long x, long y) { 22 | long result = x + y; 23 | System.out.println("Long addition: " + result); 24 | } 25 | 26 | public void add(int x, int y) { 27 | int result = x + y; 28 | System.out.println("Integer addition: " + result); 29 | } 30 | } -------------------------------------------------------------------------------- /library/PCAP-Parser/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.javahelps 5 | PCAP-Parser 6 | 0.0.1-SNAPSHOT 7 | 8 | 9 | 1.8 10 | 1.8 11 | 12 | 13 | 14 | 15 | io.pkts 16 | pkts-core 17 | 3.0.0 18 | jar 19 | 20 | 21 | 22 | io.pkts 23 | pkts-streams 24 | 3.0.0 25 | jar 26 | 27 | 28 | -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/CalculatorDemo/v3/CalculatorDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample Calculator class to demonstrate Method Overloading. 3 | * 4 | * @version 3.0 5 | * @author L.Gobinath 6 | */ 7 | public class CalculatorDemo { 8 | public static void main(String[] args) { 9 | Calculator calc = new Calculator(); 10 | // Passing two integer values 11 | calc.add(10, 30); // add(long, long) 12 | // Passing two long values 13 | calc.add(10L, 30L); // add(long, long) 14 | } 15 | } 16 | 17 | /** 18 | * Calculator class has two methods add(long, long) and add(float, float). 19 | */ 20 | class Calculator { 21 | public void add(long x, long y) { 22 | long result = x + y; 23 | System.out.println("Long addition: " + result); 24 | } 25 | 26 | public void add(float x, float y) { 27 | float result = x + y; 28 | System.out.println("Float addition: " + result); 29 | } 30 | } -------------------------------------------------------------------------------- /synchronization/v2/ConcurrencyProblem.java: -------------------------------------------------------------------------------- 1 | public class ConcurrencyProblem { 2 | static int[] array = {0}; 3 | 4 | public static void main(String[] args) throws InterruptedException { 5 | Thread a = new Thread() { 6 | public void run() { 7 | for(int i = 1; i <= 1000; i++) { 8 | increase(); 9 | } 10 | } 11 | }; 12 | 13 | Thread b = new Thread() { 14 | public void run() { 15 | for(int i = 1; i <= 1000; i++) { 16 | decrease(); 17 | } 18 | } 19 | }; 20 | 21 | a.start(); 22 | b.start(); 23 | a.join(); 24 | b.join(); 25 | System.out.println(array[0]); 26 | } 27 | 28 | public synchronized static void increase() { 29 | array[0]++; 30 | } 31 | 32 | public synchronized static void decrease() { 33 | array[0]--; 34 | } 35 | } -------------------------------------------------------------------------------- /interfaces/InterfaceMethods.java: -------------------------------------------------------------------------------- 1 | /** 2 | * An interface can have default methods and static methods. 3 | * Any other methods are public and abstract by default. 4 | * 5 | * @author L.Gobinath 6 | */ 7 | public class InterfaceMethods { 8 | public static void main(String[] args) { 9 | Super obj = new Base(); 10 | obj.print(); 11 | obj.doStuff(); 12 | Super.sayHello(); 13 | } 14 | } 15 | 16 | interface Super { 17 | /** 18 | * An abstract method. By default it is public and abstract. 19 | */ 20 | void print(); 21 | 22 | public default void doStuff() { 23 | System.out.println("Hello world"); 24 | } 25 | 26 | public static void sayHello() { 27 | System.out.println("Hello"); 28 | } 29 | } 30 | 31 | class Base implements Super { 32 | /** 33 | * Override the abstract method. 34 | */ 35 | @Override 36 | public void print() { 37 | System.out.println("Base"); 38 | } 39 | } -------------------------------------------------------------------------------- /Neo4j/Neo4J OGM HelloWorld/target/classes/META-INF/maven/com.javahelps/Neo4JOGMHelloWorld/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.javahelps 5 | Neo4JOGMHelloWorld 6 | 0.0.1-SNAPSHOT 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.3 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | org.neo4j 24 | neo4j-ogm 25 | 1.1.3 26 | 27 | 28 | -------------------------------------------------------------------------------- /defaultmethods/BookDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class BookDemo { 4 | public static void main(String[] args) { 5 | Book book = new Book(); 6 | book.add(new Chapter("Chapter 1")); 7 | book.add(new Chapter("Chapter 2")); 8 | book.add(new Chapter("Chapter 3")); 9 | for(Chapter ch : book) { 10 | System.out.println(ch); 11 | } 12 | } 13 | } 14 | 15 | class Book implements Iterable { 16 | private List chapters = new ArrayList<>(); 17 | 18 | public void add(Chapter chapter) { 19 | this.chapters.add(chapter); 20 | } 21 | 22 | @Override 23 | public Iterator iterator() { 24 | return chapters.iterator(); 25 | } 26 | } 27 | 28 | class Chapter { 29 | private String title; 30 | 31 | public Chapter(String title) { 32 | this.title = title; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return this.title; 38 | } 39 | } -------------------------------------------------------------------------------- /trywithresources/FileWriterIllegalAccessDemo.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | public class FileWriterIllegalAccessDemo { 4 | public static void main(String[] args) { 5 | FileWriter writer = null; 6 | try { 7 | // Create a FileWriter object 8 | writer = new FileWriter("sample.txt"); 9 | writer.write("Hello world!"); 10 | } catch (IOException ex) { 11 | ex.printStackTrace(); 12 | } finally { 13 | // Check for null reference 14 | if (writer != null) { 15 | try { 16 | writer.close(); // Close the connection 17 | } catch (IOException ex) { 18 | ex.printStackTrace(); 19 | } 20 | } 21 | } 22 | 23 | try { 24 | writer.write("End of file."); // IOException: Stream closed 25 | } catch (IOException ex) { 26 | ex.printStackTrace(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /defaultmethods/SingleSales.java: -------------------------------------------------------------------------------- 1 | public class SingleSales { 2 | public static void main(String[] args) { 3 | doStuff(new Pen(10.00)); 4 | doStuff(new Book(250.00, 5.00)); 5 | } 6 | 7 | public static void doStuff(Sellable item) { 8 | double income = item.sell(); 9 | System.out.println("Income: $" + income); 10 | } 11 | } 12 | 13 | interface Sellable { 14 | double sell(); 15 | } 16 | 17 | class Book implements Sellable { 18 | private double price; 19 | private double discount; 20 | 21 | public Book(double price, double discount) { 22 | this.price = price; 23 | this.discount = discount; 24 | } 25 | 26 | @Override 27 | public double sell() { 28 | return price - (price * discount / 100.00); 29 | } 30 | } 31 | 32 | class Pen implements Sellable { 33 | private double price; 34 | 35 | public Pen(double price) { 36 | this.price = price; 37 | } 38 | 39 | @Override 40 | public double sell() { 41 | return price; 42 | } 43 | } -------------------------------------------------------------------------------- /hibernate/HibernateXML/resources/Student.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /webservices/microservices/springboot/mysql-rest-service/src/main/java/com/javahelps/restservice/Application.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.restservice; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | import com.javahelps.restservice.entity.User; 9 | import com.javahelps.restservice.repository.UserRepository; 10 | 11 | @SpringBootApplication 12 | public class Application { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(Application.class, args); 16 | } 17 | 18 | @Bean 19 | protected CommandLineRunner init(final UserRepository userRepository) { 20 | 21 | return args -> { 22 | User user = new User(); 23 | user.setUsername("admin"); 24 | user.setPassword("admin"); 25 | user.setName("Administrator"); 26 | user.setEmail("admin@javahelps.com"); 27 | userRepository.save(user); 28 | 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/target/classes/Student.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /threaddeadlock/fixed/Transaction.java: -------------------------------------------------------------------------------- 1 | public class Transaction extends Thread { 2 | private final String id; 3 | private final Account from; 4 | private final Account to; 5 | private final double amount; 6 | 7 | public Transaction(String id, Account from, Account to, double amount) { 8 | this.id = id; 9 | this.from = from; 10 | this.to = to; 11 | this.amount = amount; 12 | } 13 | 14 | @Override 15 | public void run() { 16 | // Acquire the lock of Account 'from' 17 | synchronized (from) { 18 | from.withdraw(amount); 19 | try { 20 | Thread.sleep(500); 21 | } catch (InterruptedException e) { } 22 | } 23 | // Release the lock of Account 'from' 24 | // Acquire the lock of Account 'to' 25 | synchronized (to) { 26 | to.deposit(amount); 27 | } 28 | // Release the lock of Account 'to' 29 | System.out.println(amount + "is transfered from " + from + " to " + to); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spark/05/ActionMovies/src/main/scala/com/javahelps/spark/ActionMovies.scala: -------------------------------------------------------------------------------- 1 | package com.javahelps.spark 2 | 3 | import org.apache.log4j.{Level, Logger} 4 | import org.apache.spark.SparkContext 5 | 6 | object ActionMovies { 7 | 8 | def main(args: Array[String]): Unit = { 9 | Logger.getLogger("org").setLevel(Level.ERROR) 10 | 11 | val sc = new SparkContext("local[*]", "ActionMovies") 12 | 13 | // Read a text file 14 | var data = sc.textFile("/tmp/ml-latest-small/movies.csv") 15 | 16 | // Extract the first row which is the header 17 | val header = data.first(); 18 | 19 | // Filter out the header from the dataset 20 | data = data.filter(row => row != header) 21 | 22 | val result = data.map(row => row.split(',')) 23 | .map(fields => (fields(1), fields(2))) 24 | .flatMapValues(x => x.split('|')) 25 | .filter(x => x._2 == "Action") 26 | .map(x => x._1) 27 | .collect() 28 | 29 | result.sorted 30 | .foreach(println) 31 | } 32 | } -------------------------------------------------------------------------------- /designpatterns/prototype/Board.java: -------------------------------------------------------------------------------- 1 | public class Board implements Cloneable { 2 | public static final int NO_OF_ROWS = 8; 3 | public static final int NO_OF_COLUMNS = 8; 4 | 5 | private final Cell[][] board; 6 | 7 | public Board() { 8 | this.board = new Cell[NO_OF_ROWS][NO_OF_COLUMNS]; 9 | 10 | for (int row = NO_OF_ROWS - 1; row >= 0; row--) { 11 | for (int col = NO_OF_COLUMNS - 1; col >= 0; col--) { 12 | if ((row + col) % 2 == 0) { 13 | board[row][col] = new Cell("WHITE"); 14 | } else { 15 | board[row][col] = new Cell("BLACK"); 16 | } 17 | } 18 | } 19 | } 20 | 21 | public void print() { 22 | for (int row = 0; row < NO_OF_ROWS; row++) { 23 | for (int col = 0; col < NO_OF_COLUMNS; col++) { 24 | System.out.print(board[row][col] + " "); 25 | } 26 | System.out.println(); 27 | } 28 | } 29 | 30 | @Override 31 | public Object clone() { 32 | Object obj = null; 33 | try { 34 | obj = super.clone(); 35 | } catch (CloneNotSupportedException e) { 36 | e.printStackTrace(); 37 | } 38 | return obj; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /objectorientedprogramming/encapsulation/v1.2/Book.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Book class used to explain the encapsulation. 3 | * 4 | * @version 1.2 5 | * @author L.Gobinath 6 | */ 7 | public class Book { 8 | // Title of the book. 9 | String title; 10 | // Author of the book. 11 | String author; 12 | // Price of the book. 13 | private double price; 14 | 15 | /** 16 | * Set the price. 17 | * @param price Price of the book. 18 | */ 19 | public void setPrice(double price) { 20 | if (price > 0) { 21 | this.price = price; 22 | } else { 23 | System.out.println("Invalid price"); 24 | } 25 | } 26 | 27 | /** 28 | * Get the price. 29 | * @return Price of the book. 30 | */ 31 | public double getPrice() { 32 | return this.price; 33 | } 34 | 35 | /** 36 | * Print the total amount for given quantity. 37 | * @param qty The quantity 38 | */ 39 | public void sell(int qty) { 40 | System.out.println("Total: $" + (qty * price)); 41 | } 42 | } -------------------------------------------------------------------------------- /stripes/Hello World/src/com/javahelps/stripes/helloworld/action/TimeActionBean.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.stripes.helloworld.action; 2 | 3 | import java.util.Date; 4 | 5 | import net.sourceforge.stripes.action.ActionBean; 6 | import net.sourceforge.stripes.action.ActionBeanContext; 7 | import net.sourceforge.stripes.action.DefaultHandler; 8 | import net.sourceforge.stripes.action.ForwardResolution; 9 | import net.sourceforge.stripes.action.Resolution; 10 | 11 | public class TimeActionBean implements ActionBean { 12 | private static final String VIEW = "/WEB-INF/jsp/result.jsp"; 13 | private ActionBeanContext context; 14 | private Date time; 15 | 16 | @Override 17 | public ActionBeanContext getContext() { 18 | return this.context; 19 | } 20 | 21 | @Override 22 | public void setContext(ActionBeanContext ctx) { 23 | this.context = ctx; 24 | } 25 | 26 | public Date getTime() { 27 | return this.time; 28 | } 29 | 30 | @DefaultHandler 31 | public Resolution currentTime() { 32 | this.time = new Date(); 33 | return new ForwardResolution(VIEW); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /webservices/jersey/Jersey Demo/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Jersey Demo 7 | 8 | JerseyDemo 9 | 10 | com.sun.jersey.spi.container.servlet.ServletContainer 11 | 12 | 13 | com.sun.jersey.config.property.packages 14 | com.javahelps.jerseydemo 15 | 16 | 1 17 | 18 | 19 | 20 | 21 | JerseyDemo 22 | /* 23 | 24 | -------------------------------------------------------------------------------- /threaddeadlock/Transaction.java: -------------------------------------------------------------------------------- 1 | public class Transaction extends Thread { 2 | private final String id; 3 | private final Account from; 4 | private final Account to; 5 | private final double amount; 6 | 7 | public Transaction(String id, Account from, Account to, double amount) { 8 | this.id = id; 9 | this.from = from; 10 | this.to = to; 11 | this.amount = amount; 12 | } 13 | 14 | @Override 15 | public void run() { 16 | // Acquire the lock of Account 'from' 17 | synchronized (from) { 18 | from.withdraw(amount); 19 | try { 20 | Thread.sleep(500); 21 | } catch (InterruptedException e) { } 22 | 23 | // Acquire the lock of Account 'to' 24 | synchronized (to) { 25 | to.deposit(amount); 26 | } 27 | // Release the lock of Account 'to' 28 | } 29 | // Release the lock of Account 'from' 30 | System.out.println(amount + "is transfered from " + from + " to " + to); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ml/serve_tf_model/model-server/src/main/java/com/javahelps/tensorflow/moderserver/ModelServer.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.tensorflow.moderserver; 2 | 3 | import org.tensorflow.SavedModelBundle; 4 | import org.tensorflow.Session; 5 | import org.tensorflow.Tensor; 6 | import org.tensorflow.TensorFlowException; 7 | 8 | import java.util.List; 9 | 10 | public class ModelServer { 11 | 12 | public static void main(String[] args) { 13 | try (SavedModelBundle savedModelBundle = SavedModelBundle.load("/tmp/tf_add_model", "serve")) { 14 | 15 | try (Session session = savedModelBundle.session()) { 16 | Session.Runner runner = session.runner(); 17 | runner.feed("x", Tensor.create(10)); 18 | runner.feed("y", Tensor.create(20)); 19 | 20 | List> tensors = runner.fetch("ans").run(); 21 | System.out.println("Answer is: " + tensors.get(0).intValue()); 22 | } 23 | 24 | } catch (TensorFlowException ex) { 25 | ex.printStackTrace(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /objectorientedprogramming/polymorphism/CovariantReturn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Covariant return example. 3 | * Overriding method returns a subtype of overridden method's return type. 4 | * 5 | * @version 1.0 6 | * @author L.Gobinath 7 | */ 8 | public class CovariantReturn { 9 | public static void main(String[] args) { 10 | create(new CircleFactory()); 11 | } 12 | 13 | public static void create(ShapeFactory factory) { 14 | Shape shape = factory.getShape(); 15 | // Circle circle = factory.getShape(); // Compile time error 16 | shape.draw(); // Circle 17 | } 18 | } 19 | 20 | class Shape { 21 | public void draw() { 22 | System.out.println("Shape"); 23 | } 24 | } 25 | class Circle extends Shape { 26 | public void draw() { 27 | System.out.println("Circle"); 28 | } 29 | } 30 | 31 | class ShapeFactory { 32 | public Shape getShape() { 33 | return new Shape(); 34 | } 35 | } 36 | 37 | class CircleFactory extends ShapeFactory { 38 | public Circle getShape() { 39 | return new Circle(); 40 | } 41 | } -------------------------------------------------------------------------------- /webservices/jersey/2/Jersey Demo/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Jersey Demo 7 | 8 | 9 | 10 | JerseyDemo 11 | org.glassfish.jersey.servlet.ServletContainer 12 | 13 | 14 | javax.ws.rs.Application 15 | com.javahelps.jerseydemo.app.HelloWorldApplication 16 | 17 | 1 18 | 19 | 20 | 21 | 22 | JerseyDemo 23 | /* 24 | 25 | -------------------------------------------------------------------------------- /spark/01/Movie Ratings Counter/src/main/scala/com/javahelps/spark/MovieRatingsCounter.scala: -------------------------------------------------------------------------------- 1 | package com.javahelps.spark 2 | 3 | import org.apache.log4j.{Level, Logger} 4 | import org.apache.spark.SparkContext 5 | 6 | 7 | object MovieRatingsCounter { 8 | 9 | def main(args: Array[String]): Unit = { 10 | 11 | Logger.getLogger("org").setLevel(Level.ERROR) 12 | 13 | val sc = new SparkContext("local[*]", "MovieRatingsCounter") 14 | 15 | // Read a text file 16 | var data = sc.textFile("/tmp/ml-latest-small/ratings.csv") 17 | 18 | // Extract the first row which is the header 19 | val header = data.first(); 20 | 21 | // Filter out the header from the dataset 22 | data = data.filter(row => row != header) 23 | 24 | val result = data.map(line => line.split(',')(2).toFloat) // Extract rating from line as float 25 | .countByValue() // Count number of occurrences of each number 26 | 27 | // Sort and print the result 28 | result.toSeq 29 | .sorted 30 | .foreach(println) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/cep-artifacts/eventpublishers/com.javahelps.publisher.thrift.Temperature.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ssl://localhost:8988 8 | kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg= 9 | thrift 10 | 0 11 | non-blocking 12 | tcp://localhost:8888 13 | admin 14 | 15 | 16 | -------------------------------------------------------------------------------- /wso2/cep/client/thrift/python-client/SSLServer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import os 5 | sys.path.append('gen-py') 6 | from thrift.transport import TTransport 7 | from thrift.protocol import TBinaryProtocol 8 | from thrift.server import TServer 9 | from thrift.transport import TSSLSocket 10 | from ServerHandler import ServerHandler 11 | from ThriftSecureEventTransmissionService import ThriftSecureEventTransmissionService 12 | 13 | 14 | SERVER_ADDRESS = 'localhost' 15 | SERVER_PORT = 8988 16 | CERTIFICATE_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'server.pem') 17 | 18 | handler = ServerHandler() 19 | processor = ThriftSecureEventTransmissionService.Processor(handler) 20 | transport = TSSLSocket.TSSLServerSocket(SERVER_ADDRESS, SERVER_PORT, certfile=CERTIFICATE_FILE) 21 | tfactory = TTransport.TBufferedTransportFactory() 22 | pfactory = TBinaryProtocol.TBinaryProtocolFactory() 23 | 24 | server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) 25 | 26 | print 'Starting SSL Server at ' + SERVER_ADDRESS + ':' + str(SERVER_PORT) 27 | 28 | server.serve() 29 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/include/link-footer.inc: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 |
Back Home
-------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/include/link-footer.inc: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 |
Back Home
-------------------------------------------------------------------------------- /hibernate/HibernateAnnotation/src/com/javahelps/hibernate/Student.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.hibernate; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | @Entity 11 | @Table(name = "student") 12 | public class Student implements Serializable { 13 | @Id 14 | @Column(name = "student_id", unique = true) 15 | private int id; 16 | 17 | @Column(name = "student_name", nullable = false) 18 | private String name; 19 | 20 | @Column(name = "student_age", nullable = false) 21 | private int age; 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public int getAge() { 40 | return age; 41 | } 42 | 43 | public void setAge(int age) { 44 | this.age = age; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return id + "\t" + name + "\t" + age; 50 | } 51 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAHelloWorld/src/com/javahelps/jpa/Student.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.jpa; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | @Entity 11 | @Table(name = "student") 12 | public class Student implements Serializable { 13 | @Id 14 | @Column(name = "student_id", unique = true) 15 | private int id; 16 | 17 | @Column(name = "student_name", nullable = false) 18 | private String name; 19 | 20 | @Column(name = "student_age", nullable = false) 21 | private int age; 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public int getAge() { 40 | return age; 41 | } 42 | 43 | public void setAge(int age) { 44 | this.age = age; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return id + "\t" + name + "\t" + age; 50 | } 51 | } -------------------------------------------------------------------------------- /antlr/antlr-demo/src/main/java/com/javahelps/antlrdemo/calculator/CalculatorVisitorImpl.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.antlrdemo.calculator; 2 | 3 | public class CalculatorVisitorImpl extends CalculatorBaseVisitor { 4 | 5 | @Override 6 | public Double visitOperation(CalculatorParser.OperationContext ctx) { 7 | if (ctx.operator == null) { 8 | throw new UnsupportedOperationException("An operator of +, -, /, * is required to perform the operation"); 9 | } 10 | String operator = ctx.operator.getText(); 11 | double left = Double.parseDouble(ctx.left.getText()); 12 | double right = Double.parseDouble(ctx.right.getText()); 13 | 14 | switch (operator) { 15 | case "+": 16 | return left + right; 17 | case "-": 18 | return left - right; 19 | case "/": 20 | return left / right; 21 | case "*": 22 | return left * right; 23 | default: 24 | throw new UnsupportedOperationException("Calculator does not support " + operator); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/include/adminfooter.jsp: -------------------------------------------------------------------------------- 1 | 19 | <%@ page contentType="text/html;charset=iso-8859-1" language="java" %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/include/adminfooter.jsp: -------------------------------------------------------------------------------- 1 | 19 | <%@ page contentType="text/html;charset=iso-8859-1" language="java" %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/src/main/java/com/javahelps/jpa/Student.java: -------------------------------------------------------------------------------- 1 | package com.javahelps.jpa; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | @Entity 11 | @Table(name = "student") 12 | public class Student implements Serializable { 13 | @Id 14 | @Column(name = "student_id", unique = true) 15 | private int id; 16 | 17 | @Column(name = "student_name", nullable = false) 18 | private String name; 19 | 20 | @Column(name = "student_age", nullable = false) 21 | private int age; 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public int getAge() { 40 | return age; 41 | } 42 | 43 | public void setAge(int age) { 44 | this.age = age; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return id + "\t" + name + "\t" + age; 50 | } 51 | } -------------------------------------------------------------------------------- /jpa/helloworld/hibernate/JPAWithHibernate5/target/classes/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | org.hibernate.jpa.HibernatePersistenceProvider 8 | 9 | 10 | com.javahelps.jpa.Student 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /webservices/microservices/Hello-Service/src/main/java/com/javahelps/service/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.javahelps.service; 18 | 19 | import org.wso2.msf4j.MicroservicesRunner; 20 | 21 | /** 22 | * Application entry point. 23 | * 24 | * @since 0.1-SNAPSHOT 25 | */ 26 | public class Application { 27 | public static void main(String[] args) { 28 | new MicroservicesRunner() 29 | .deploy(new HelloService()) 30 | .start(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ml/serve_tf_model/model-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.javahelps.tensorflow 8 | model-server 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | org.apache.maven.plugins 14 | maven-compiler-plugin 15 | 16 | 11 17 | 11 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | org.tensorflow 26 | tensorflow 27 | 1.13.1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ocewcd/Hello World/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /stripes/Hello World/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/Axis2Client/WebContent/axis2-web/disengage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | ~ Licensed to the Apache Software Foundation (ASF) under one 3 | ~ or more contributor license agreements. See the NOTICE file 4 | ~ distributed with this work for additional information 5 | ~ regarding copyright ownership. The ASF licenses this file 6 | ~ to you under the Apache License, Version 2.0 (the 7 | ~ "License"); you may not use this file except in compliance 8 | ~ with the License. You may obtain a copy of the License at 9 | ~ 10 | ~ http://www.apache.org/licenses/LICENSE-2.0 11 | ~ 12 | ~ Unless required by applicable law or agreed to in writing, 13 | ~ software distributed under the License is distributed on an 14 | ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | ~ KIND, either express or implied. See the License for the 16 | ~ specific language governing permissions and limitations 17 | ~ under the License. 18 | --%> 19 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 20 | 21 | <%=request.getSession().getAttribute("status")%> 22 | -------------------------------------------------------------------------------- /webservices/axis2/helloworld-eclipse/HelloAxis2/WebContent/axis2-web/disengage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | ~ Licensed to the Apache Software Foundation (ASF) under one 3 | ~ or more contributor license agreements. See the NOTICE file 4 | ~ distributed with this work for additional information 5 | ~ regarding copyright ownership. The ASF licenses this file 6 | ~ to you under the Apache License, Version 2.0 (the 7 | ~ "License"); you may not use this file except in compliance 8 | ~ with the License. You may obtain a copy of the License at 9 | ~ 10 | ~ http://www.apache.org/licenses/LICENSE-2.0 11 | ~ 12 | ~ Unless required by applicable law or agreed to in writing, 13 | ~ software distributed under the License is distributed on an 14 | ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | ~ KIND, either express or implied. See the License for the 16 | ~ specific language governing permissions and limitations 17 | ~ under the License. 18 | --%> 19 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 20 | 21 | <%=request.getSession().getAttribute("status")%> 22 | -------------------------------------------------------------------------------- /hibernate/HibernateXML/resources/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | update 9 | 10 | com.mysql.jdbc.Driver 11 | 12 | org.hibernate.dialect.MySQLDialect 13 | 14 | jdbc:mysql://localhost:3306/javahelps 15 | 16 | root 17 | 18 | root 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /synchronization/v3/ConcurrencyProblem.java: -------------------------------------------------------------------------------- 1 | public class ConcurrencyProblem { 2 | static int[] array = {0}; 3 | 4 | public static void main(String[] args) throws InterruptedException { 5 | Thread a = new Thread() { 6 | public void run() { 7 | for (int i = 1; i <= 1000; i++) { 8 | increase(); 9 | } 10 | } 11 | }; 12 | 13 | Thread b = new Thread() { 14 | public void run() { 15 | for (int i = 1; i <= 1000; i++) { 16 | decrease(); 17 | } 18 | } 19 | }; 20 | 21 | a.start(); 22 | b.start(); 23 | a.join(); 24 | b.join(); 25 | System.out.println(array[0]); 26 | } 27 | 28 | public static void increase() { 29 | // Do something else 30 | synchronized (array) { 31 | array[0]++; 32 | } 33 | // Do something else 34 | } 35 | 36 | public static void decrease() { 37 | // Do something else 38 | synchronized (array) { 39 | array[0]--; 40 | } 41 | // Do something else 42 | } 43 | } -------------------------------------------------------------------------------- /hibernate/HibernateXML/target/classes/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | update 9 | 10 | com.mysql.jdbc.Driver 11 | 12 | org.hibernate.dialect.MySQLDialect 13 | 14 | jdbc:mysql://localhost:3306/javahelps 15 | 16 | root 17 | 18 | root 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------