Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 18, 2016
0 parents commit 104dbf0
Show file tree
Hide file tree
Showing 574 changed files with 12,928 additions and 0 deletions.
3 changes: 3 additions & 0 deletions BeginningJava8APIsExtensionsLibraries/applet.policy
@@ -0,0 +1,3 @@
grant {
permission java.security.AllPermission;
};
@@ -0,0 +1,9 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY AND SUBDIRECTORIES CONSTITUTE A DERBY ***
# *** DATABASE, WHICH INCLUDES THE DATA (USER AND SYSTEM) AND THE ***
# *** FILES NECESSARY FOR DATABASE RECOVERY. ***
# *** EDITING, ADDING, OR DELETING ANY OF THESE FILES MAY CAUSE DATA ***
# *** CORRUPTION AND LEAVE THE DATABASE IN A NON-RECOVERABLE STATE. ***
# *************************************************************************
Binary file not shown.
@@ -0,0 +1,8 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE RECOVERY ***
# *** SYSTEM. EDITING, ADDING, OR DELETING FILES IN THIS DIRECTORY ***
# *** WILL CAUSE THE DERBY RECOVERY SYSTEM TO FAIL, LEADING TO ***
# *** NON-RECOVERABLE CORRUPT DATABASES. ***
# *************************************************************************
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE TO STORE ***
# *** USER AND SYSTEM DATA. EDITING, ADDING, OR DELETING FILES IN THIS ***
# *** DIRECTORY WILL CORRUPT THE ASSOCIATED DERBY DATABASE AND MAKE ***
# *** IT NON-RECOVERABLE. ***
# *************************************************************************
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
#C:\kishori\books\Java_8\Apress\Beginning Java APIs, Extensions and Libraries\SourceCode\BeginningJava8APIsExtensionsLibraries\beginningJavaDB
# ********************************************************************
# *** Please do NOT edit this file. ***
# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
# ********************************************************************
#Wed Aug 06 21:13:18 CDT 2014
SysschemasIndex2Identifier=225
SyscolumnsIdentifier=144
SysconglomeratesIndex1Identifier=49
SysconglomeratesIdentifier=32
SyscolumnsIndex2Identifier=177
SysschemasIndex1Identifier=209
SysconglomeratesIndex3Identifier=81
SystablesIndex2Identifier=129
SyscolumnsIndex1Identifier=161
derby.serviceProtocol=org.apache.derby.database.Database
SysschemasIdentifier=192
derby.storage.propertiesId=16
SysconglomeratesIndex2Identifier=65
derby.serviceLocale=en_US
SystablesIdentifier=96
SystablesIndex1Identifier=113
#--- last line, don't put anything after this line ---
73 changes: 73 additions & 0 deletions BeginningJava8APIsExtensionsLibraries/build.xml
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="BeginningJava8APIsExtensionsLibraries" default="default" basedir=".">
<description>Builds, tests, and runs the project BeginningJava8APIsExtensionsLibraries.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BeginningJava8APIsExtensionsLibraries-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,4 @@
#Tue, 15 Jul 2014 22:52:46 -0500


C\:\\kishori\\books\\Java_8\\Apress\\Beginning\ Java\ APIs,\ Extensions\ and\ Libraries\\SourceCode\\BeginningJava8APIsExtensionsLibraries=
Empty file.
Empty file.
@@ -0,0 +1,50 @@
// hellojavafx.js

// Load Nashorn pre-defined scripts to import JavaFX specific classes and packages
load("fx:base.js")
load("fx:controls.js")
load("fx:graphics.js")

// Define the start() method of the JavaFX application class
function start(stage) {
var nameLbl = new Label("Enter your name:");
var nameFld = new TextField();
var msg = new Label();
msg.setStyle("-fx-text-fill: blue;");

// Create buttons
var sayHelloBtn = new Button("Say Hello");
var exitBtn = new Button("Exit");

// Add the event handler for the Say Hello button
sayHelloBtn.onAction = function() {
var name = nameFld.getText();
if (name.trim().length() > 0) {
msg.text = "Hello " + name;
}
else {
msg.text = "Hello there";
}
};

// Add the event handler for the Exit button
exitBtn.onAction = function() {
Platform.exit();
};

// Create the root node
var root = new VBox();

// Set the vertical spacing between children to 5px
root.spacing = 5;

// Add children to the root node
root.children.addAll(nameLbl, nameFld, msg, sayHelloBtn, exitBtn);

// Set the scene and title for the stage
stage.scene = new Scene(root, 350, 150);
stage.title = "Hello JavaFX from Nashorn";

// Show the stage
stage.show();
}
@@ -0,0 +1,2 @@
// Print a message
print('Hello from JavaScript!');
@@ -0,0 +1,11 @@
// heredoc.js
var str = <<EOF
This is a multi-line string.
Number of arguments passed to this
script is ${$ARG.length}
Arguments are ${$ARG}

Bye Heredoc!
EOF

print(str);
@@ -0,0 +1,2 @@
#The factory class for the JKScript engine
com.jdojo.script.JKScriptEngineFactory
Binary file not shown.
@@ -0,0 +1,6 @@
// nashornargstest.js
print("Number of arguments:" + arguments.length);
print("Arguments are ") ;
for(var i = 0; i < arguments.length; i++) {
print(arguments[i]);
}
@@ -0,0 +1,8 @@
// Print a message
print("Hello Nashorn!");

// Add two integers and print the value
var x = 10;
var y = 20;
var z = x + y;
print(x + " + " + y + " = " + z);
@@ -0,0 +1,3 @@
// simplestfxapp.js

$STAGE.scene = new javafx.scene.Scene(new javafx.scene.control.Label("Hello JavaFX Scripting"));
@@ -0,0 +1,16 @@
// stream.js
var list;
if (arguments.length == 0) {
list = [1, 2, 3, 4, 5];
}
else {
list = arguments;
}

print("List of numbers: " + list);

var sumOfSquaredOdds = list.filter(function(n) {return n % 2 == 1;})
.map(function(n) {return n * n;})
.reduce(function(sum, n) {return sum + n;}, 0);

print("Sum of the squares of odd numbers: " + sumOfSquaredOdds);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
com.jdojo.applet.ReadUserHomeApplet
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"/>
<title>Echo Request Method and Parameters</title>
</head>
<body>
<h1>URL Connection Test</h1>
<%
out.println("Request Method: " + request.getMethod());
out.println("<br/><br/>");
out.println("<u>List of Parameter Names and Values</u><br/>");
java.util.Enumeration paramNames =
request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
String paramValue = request.getParameter(paramName);
out.println("Name: " + paramName + ", Value: " +
paramValue);
out.println("<br/>");
}
%>
</body>
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
create procedure get_person_details(@person_id integer)
as
begin
select person_id, first_name, last_name, gender, dob, income
from person
where person_id = @person_id
end

@@ -0,0 +1,22 @@
create procedure give_raise(IN @person_id integer, IN @raise double,
OUT @old_income double, OUT @new_income double)
begin
select @old_income = null, @new_income = null;

if exists(select null from person where person_id = @person_id) then
select income into @old_income
from person
where person_id = @person_id;

if @old_income is null then
select 20000.00 into @new_income;
else
select @old_income * (1 + @raise/100) into @new_income;
end if;

update person
set income = @new_income
where person_id = @person_id;
end if;
end;

@@ -0,0 +1,10 @@
create table person (
person_id integer not null default null,
first_name varchar(20) not null default null,
last_name varchar(20) not null default null,
gender char(1) not null default null,
dob date null default null,
income double null default null ,
primary key (person_id)
);

@@ -0,0 +1,12 @@
create procedure get_person_details(in person_id_param int)
result sets 1
language sql
begin
declare c1 cursor with return for
select person_id, first_name, last_name, gender, dob, income
from person
where person_id = person_id_param;
open c1;
end
@

@@ -0,0 +1,33 @@
create procedure give_raise(IN person_id_param int,
IN raise_param double,
OUT old_income double,
OUT new_income double)
language sql
begin

declare person_count int;

set old_income = null;
set new_income = null;

select count(*) into person_count
from person
where person_id = person_id_param;

if person_count = 1 then
select income into old_income
from person
where person_id = person_id_param;

if old_income is null then
set new_income = 20000.00;
else
set new_income = old_income * (1 + raise_param/100) ;
end if;

update person
set income = new_income
where person_id = person_id_param;
end if;
end
@
@@ -0,0 +1,10 @@
create table person (
person_id integer not null ,
first_name varchar(20) not null ,
last_name varchar(20) not null ,
gender character (1) not null ,
dob date,
income double,
constraint pk_person_id primary key (person_id)
);

@@ -0,0 +1,8 @@
-- Command to create the stored procedure
CREATE PROCEDURE get_person_details(IN person_id integer)
PARAMETER STYLE JAVA
LANGUAGE JAVA
READS SQL DATA
DYNAMIC RESULT SETS 1
EXTERNAL NAME 'com.jdojo.jdbc.JavaDBGetPersonDetailsSp.getPersonDetails';

@@ -0,0 +1,7 @@
--Command to create a stored procedure
CREATE PROCEDURE give_raise(IN person_id integer, IN raise double, OUT old_income Double, OUT new_income Double)
PARAMETER STYLE JAVA
LANGUAGE JAVA
MODIFIES SQL DATA
EXTERNAL NAME 'com.jdojo.jdbc.JavaDBGiveRaiseSp.giveRaise';

0 comments on commit 104dbf0

Please sign in to comment.