<ant antfile="${project.PizzaService-lib}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
+ <ant antfile="${project.jshop-ee-lib}/build.xml" inheritall="false" target="jar">
+ <property name="deploy.on.save" value="false"/>
+ </ant>
</target>
<target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps">
<ant antfile="${project.PizzaService-lib}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
+ <ant antfile="${project.jshop-ee-lib}/build.xml" inheritall="false" target="jar">
+ <property name="deploy.on.save" value="false"/>
+ </ant>
</target>
<target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<copyfiles files="${file.reference.log4j-api-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.log4j-core-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.log4j-web-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${reference.jshop-ee-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<copyfiles files="${file.reference.log4j-api-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.log4j-core-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.log4j-web-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${reference.jshop-ee-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
-->
<target depends="init" name="deps-clean" unless="no.deps">
<ant antfile="${project.PizzaService-lib}/build.xml" inheritall="false" target="clean"/>
+ <ant antfile="${project.jshop-ee-lib}/build.xml" inheritall="false" target="clean"/>
</target>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
-build.xml.data.CRC32=1edfee4e
+build.xml.data.CRC32=e1e3912d
build.xml.script.CRC32=82213886
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=1edfee4e
-nbproject/build-impl.xml.script.CRC32=055d9dec
+nbproject/build-impl.xml.data.CRC32=e1e3912d
+nbproject/build-impl.xml.script.CRC32=c4215d75
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
${file.reference.gf-client.jar}:\
${file.reference.log4j-api-2.3.jar}:\
${file.reference.log4j-core-2.3.jar}:\
- ${file.reference.log4j-web-2.3.jar}
+ ${file.reference.log4j-web-2.3.jar}:\
+ ${reference.jshop-ee-lib.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.debug=true
lib.dir=${web.docbase.dir}/WEB-INF/lib
persistence.xml.dir=${conf.dir}
platform.active=default_platform
+project.jshop-ee-lib=../jshop-ee-lib
project.license=gpl30
project.PizzaService-lib=../pizzaservice-lib
+reference.jshop-ee-lib.jar=${project.jshop-ee-lib}/dist/jshop-ee-lib.jar
reference.PizzaService-lib.jar=${project.PizzaService-lib}/dist/PizzaService-lib.jar
resource.dir=setup
run.test.classpath=\
<file>${file.reference.log4j-web-2.3.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${reference.jshop-ee-lib.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
+ <reference>
+ <foreign-project>jshop-ee-lib</foreign-project>
+ <artifact-type>jar</artifact-type>
+ <script>build.xml</script>
+ <target>jar</target>
+ <clean-target>clean</clean-target>
+ <id>jar</id>
+ </reference>
</references>
</configuration>
</project>
*/
package org.mxchange.pizzaapplication.beans.basket;
+import java.rmi.RemoteException;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopeelib.beans.remote.basket.BasketSessionBeanRemote;
/**
* A bean for the basket
@Named("basket")
@SessionScoped
public class PizzaServiceBasketWebBean extends BaseFrameworkBean implements PizzaBasketWebBean {
+ /**
+ * Basket bean
+ */
+ @EJB
+ private final BasketSessionBeanRemote basket;
+
/**
* Serial number
*/
private static final long serialVersionUID = 5476347320198L;
+ /**
+ * Default constructor
+ *
+ * @throws javax.naming.NamingException If something happened?
+ */
+ public PizzaServiceBasketWebBean () throws NamingException {
+ // Get initial context
+ InitialContext context = new InitialContext();
+
+ // Try to lookup
+ this.basket = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
+ }
+
@Override
public boolean isEmpty () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ try {
+ // Call remote bean
+ return this.basket.isEmpty();
+ } catch (final RemoteException ex) {
+ // Continued to throw
+ throw new FacesException(ex);
+ }
}
@Override
package org.mxchange.pizzaapplication.beans.controller;
import java.io.IOException;
-import java.sql.SQLException;
+import java.rmi.RemoteException;
import java.util.Deque;
import java.util.Iterator;
import javax.annotation.PostConstruct;
public Iterator<Product> getAvailableProductsIterator () throws FacesException {
try {
return this.remote.getAvailableProductsIterator();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public Iterator<Product> getAllProductsIterator () throws FacesException {
try {
return this.remote.getAllProductsIterator();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public Deque<Product> getAvailableProducts () throws FacesException {
try {
return this.remote.getAvailableProducts();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public Deque<Product> getAllProducts () throws FacesException {
try {
return this.remote.getAllProducts();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public Iterator<Category> getAllCategoriesIterator () throws FacesException {
try {
return this.remote.getAllCategoriesIterator();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public Deque<Category> getAllCategories () throws FacesException {
try {
return this.remote.getAllCategories();
- } catch (final IOException | SQLException ex) {
+ } catch (final RemoteException ex) {
// Continue to throw
throw new FacesException(ex);
}
public void doAdminAddCategory (final Category category) throws FacesException {
try {
this.remote.doAdminAddCategory(category);
- } catch (final IOException | SQLException | CategoryTitleAlreadyUsedException ex) {
+ } catch (final IOException | CategoryTitleAlreadyUsedException ex) {
// Continue to throw
throw new FacesException(ex);
}
public void doAdminAddProduct (final Product product) throws FacesException {
try {
this.remote.doAdminAddProduct(product);
- } catch (final IOException | SQLException | ProductTitleAlreadyUsedException ex) {
+ } catch (final IOException | ProductTitleAlreadyUsedException ex) {
// Continue to throw
throw new FacesException(ex);
}
import java.text.MessageFormat;
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import javax.naming.InitialContext;
/**
* Remote bean
*/
- private final ShopDataBeanRemote remote;
+ @EJB
+ private final ShopDataBeanRemote data;
/**
* Default constructor
InitialContext context = new InitialContext();
// Try to lookup bean
- this.remote = (ShopDataBeanRemote) context.lookup("ejb/stateless-data");
+ this.data = (ShopDataBeanRemote) context.lookup("ejb/stateless-data"); //NOI18N
}
@Override
public Gender[] allGenders () {
// Trace message
- this.getLogger().trace("CALLED!");
+ this.getLogger().trace("CALLED!"); //NOI18N
// Return it
- return this.getRemote().allGenders();
+ return this.getData().allGenders();
}
@Override
// Init array
// TODO Call EJB here?
- List<Gender> genders = this.getRemote().selectableGenders();
+ List<Gender> genders = this.getData().selectableGenders();
// Trace message
this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
}
/**
- * @return the remote
+ * Getter for data remote bean
+ *
+ * @return data remote bean
*/
- private ShopDataBeanRemote getRemote () {
- return this.remote;
+ private ShopDataBeanRemote getData () {
+ return this.data;
}
@Override