Commit 76ed4c53 by tuomari

Lisätty tuomarin intrasofta insomnia XI:stä.

git-svn-id: https://dev.intra.insomnia.fi/svn/trunk@5 8cf89bec-f6a3-4178-919f-364fb3449fe5
1 parent d6f10450
Showing with 5925 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CamUploader</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.axdt.as3.imp.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.axdt.as3.imp.nature</nature>
</natures>
<linkedResources>
<link>
<name>logger</name>
<type>2</type>
<locationURI>logger</locationURI>
</link>
</linkedResources>
</projectDescription>
/**
* @author tuomari
*/
package fi.insomnia.camuploader {
import flash.media.Video;
import flash.media.Camera;
import flash.display.*;
import flash.text.*;
public class CAM extends Sprite {
public function CAM() {
var camera:Camera = Camera.getCamera();
camera.setQuality(0, 100);
camera.setMode(320,240,30,false);
var video:Video = video = new Video();
video.attachCamera(camera);
addChild(video);
}
}
}
\ No newline at end of file
/* AS3
Copyright 2007 Jonathan Marston
*/
package fi.insomnia.camuploader
{
/**
* Take a fileName, byteArray, and parameters object as input and return ByteArray post data suitable for a UrlRequest as output
*
* @see http://marstonstudio.com/?p=36
* @see http://www.w3.org/TR/html4/interact/forms.html
* @see http://www.jooce.com/blog/?p=143
* @see http://www.jooce.com/blog/wp%2Dcontent/uploads/2007/06/uploadFile.txt
* @see http://blog.je2050.de/2006/05/01/save-bytearray-to-file-with-php/
*
* @author Jonathan Marston
* @version 2007.08.19
*
* This work is licensed under a Creative Commons Attribution NonCommercial ShareAlike 3.0 License.
* @see http://creativecommons.org/licenses/by-nc-sa/3.0/
*
*/
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.ByteArray;
import flash.utils.Endian;
public class UploadPostHelper
{
//--------------------------------------
// PUBLIC METHODS
//--------------------------------------
/**
* Boundary used to break up different parts of the http POST body
*/
private static var _boundary:String = "";
/**
* Get the boundary for the post.
* Must be passed as part of the contentType of the UrlRequest
*/
public static function getBoundary():String {
if(_boundary.length == 0) {
for (var i:int = 0; i < 0x20; i++ ) {
_boundary += String.fromCharCode( int( 97 + Math.random() * 25 ) );
}
}
return _boundary;
}
/**
* Create post data to send in a UrlRequest
*/
public static function getPostData(fileName:String, byteArray:ByteArray, parameters:Object = null):ByteArray {
var i:int;
var bytes:String;
var postData:ByteArray = new ByteArray();
postData.endian = Endian.BIG_ENDIAN;
//add Filename to parameters
if(parameters == null) {
parameters = new Object();
}
parameters.Filename = fileName;
//add parameters to postData
for(var name:String in parameters) {
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Disposition: form-data; name="' + name + '"';
for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
postData = LINEBREAK(postData);
postData.writeUTFBytes(parameters[name]);
postData = LINEBREAK(postData);
}
//add Filedata to postData
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Disposition: form-data; name="Filedata"; filename="';
for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData.writeUTFBytes(fileName);
postData = QUOTATIONMARK(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Type: application/octet-stream';
for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
postData = LINEBREAK(postData);
postData.writeBytes(byteArray, 0, byteArray.length);
postData = LINEBREAK(postData);
//add upload filed to postData
postData = LINEBREAK(postData);
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Disposition: form-data; name="Upload"';
for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
postData = LINEBREAK(postData);
bytes = 'Submit Query';
for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
//closing boundary
postData = BOUNDARY(postData);
postData = DOUBLEDASH(postData);
return postData;
}
//--------------------------------------
// EVENT HANDLERS
//--------------------------------------
//--------------------------------------
// PRIVATE & PROTECTED INSTANCE METHODS
//--------------------------------------
/**
* Add a boundary to the PostData with leading doubledash
*/
private static function BOUNDARY(p:ByteArray):ByteArray {
var l:int = UploadPostHelper.getBoundary().length;
p = DOUBLEDASH(p);
for (var i:int = 0; i < l; i++ ) {
p.writeByte( _boundary.charCodeAt( i ) );
}
return p;
}
/**
* Add one linebreak
*/
private static function LINEBREAK(p:ByteArray):ByteArray {
p.writeShort(0x0d0a);
return p;
}
/**
* Add quotation mark
*/
private static function QUOTATIONMARK(p:ByteArray):ByteArray {
p.writeByte(0x22);
return p;
}
/**
* Add Double Dash
*/
private static function DOUBLEDASH(p:ByteArray):ByteArray {
p.writeShort(0x2d2d);
return p;
}
}
}
\ No newline at end of file
/**
* @author tuomari
*/
package fi.insomnia.camuploader {
import flash.display.*;
import flash.events.MouseEvent;
import flash.text.*;
import flash.media.Video;
import flash.media.Camera;
import flash.geom.Matrix;
import flash.utils.ByteArray;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.net.URLRequestMethod;
import flash.net.URLRequestHeader;
import flash.net.URLLoaderDataFormat;
import mx.graphics.codec.PNGEncoder;
import flash.display.StageScaleMode;
public class Uploader extends Sprite {
private var button:Sprite = new Sprite();
private var video:Video;
private var camera:Camera;
private var userid:String;
private var origin:String;
public function Uploader() {
// stage.scaleMode = StageScaleMode.NO_SCALE;
camera= Camera.getCamera();
camera.setQuality(0, 100);
camera.setMode(320,240,25,true);
video = new Video();
video.width = 320;
video.height = 240;
video.attachCamera(camera);
addChild(video);
button.graphics.clear();
button.graphics.beginFill(0xD4D4D4); // grey color
button.graphics.drawRoundRect(55, 250, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
button.graphics.endFill();
var textLabel:TextField = new TextField()
userid = this.root.loaderInfo.parameters["userid"]
origin = this.root.loaderInfo.parameters["origin"]
textLabel.text = "Ota kuva id: " + userid;
textLabel.x = 70;
textLabel.y = 255;
textLabel.selectable = false;
button.addEventListener(MouseEvent.CLICK, takeSnapshot);
button.addChild(textLabel)
addChild(button);
var overlay:Sprite = new Sprite();
overlay.graphics.clear();
overlay.graphics.beginFill(0xFFFFFF);
overlay.graphics.drawRect(160,0,320,240);
overlay.graphics.endFill();
addChild(overlay);
}
private function takeSnapshot(event:MouseEvent):void
{
var snapshot:BitmapData =new BitmapData(160,240);
snapshot.draw(video,new Matrix());
var naama : ByteArray = new PNGEncoder().encode( snapshot );
trace("Took snapshot!");
// set up the request & headers for the image upload;
var urlRequest : URLRequest = new URLRequest();
urlRequest.url = origin+ '/UploadServlet/' + userid;
urlRequest.contentType = 'multipart/form-data; boundary=' + UploadPostHelper.getBoundary();
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = UploadPostHelper.getPostData( 'image.png', naama );
urlRequest.requestHeaders.push( new URLRequestHeader( 'Cache-Control', 'no-cache' ) );
// create the image loader & send the image to the server;
var urlLoader : URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load( urlRequest );
trace("Image sent");
button.y = button.y+1;
video.attachCamera(null);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Desker</name>
<comment></comment>
<projects>
<project>DeskerBeans</project>
<project>InsomniaIntraWeb</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Desker">
<wb-resource deploy-path="/" source-path="/EarContent"/>
<dependent-module deploy-path="/" handle="module:/resource/DeskerBeans/DeskerBeans">
<dependent-object></dependent-object>
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/resource/InsomniaIntraWeb/InsomniaIntraWeb">
<dependent-object></dependent-object>
<dependency-type>uses</dependency-type>
</dependent-module>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish v3 Java EE 6 2"/>
<fixed facet="jst.ear"/>
<installed facet="jst.ear" version="5.0"/>
<installed facet="sun.facet" version="9"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="ejbModule"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes>
<attribute name="owner.project.facets" value="jst.java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6 2">
<attributes>
<attribute name="owner.project.facets" value="jst.ejb"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DeskerBeans</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Thu Oct 22 16:42:40 EEST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="DeskerBeans">
<wb-resource deploy-path="/" source-path="/ejbModule"/>
<property name="java-output-path"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish v3 Java EE 6 2"/>
<fixed facet="jst.ejb"/>
<fixed facet="jst.java"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.ejb" version="3.0"/>
<installed facet="sun.facet" version="9"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans/>
</sun-ejb-jar>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans/>
</sun-ejb-jar>
package fi.insomnia.intra.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.persistence.EntityManager;
import javax.persistence.Query;
public class EntityQuery<T> {
private String namedQuery;
private String countQuery;
private EntityManager em;
private int pagesize = 0;
private int page = 0;
private long resultsize = 0;
private Map<String, Object> parameters = new HashMap<String, Object>();
private EntityQuery(String namedQuery, String countQuery, EntityManager em) {
this.namedQuery = namedQuery;
this.countQuery = countQuery;
this.em = em;
}
@SuppressWarnings("unchecked")
public List<T> getItems(IPagingStatus paging) {
Query query = em.createNamedQuery(namedQuery);
Query count = null;
if (getPagesize() > 0) {
query.setFirstResult(getPage() * getPagesize());
query.setMaxResults(getPagesize());
count = em.createNamedQuery(countQuery);
}
for (Entry<String, Object> obj : parameters.entrySet()) {
query.setParameter(obj.getKey(), obj.getValue());
if (count != null) {
count.setParameter(obj.getKey(), obj.getValue());
}
}
List ret = query.getResultList();
resultsize = ret.size();
if (count != null) {
Object resultO = count.getSingleResult();
if (resultO instanceof Long) {
resultsize = ((Long) resultO);
} else if (resultO instanceof Integer) {
resultsize = ((Integer) resultO).longValue();
}
}
return ret;
}
public void addParameter(String name, Object value)
{
parameters.put(name, value);
}
public long getResultsize() {
return resultsize;
}
public void setPage(int page) {
this.page = page;
}
public int getPage() {
return page;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getPagesize() {
return pagesize;
}
}
package fi.insomnia.intra.dao;
import javax.persistence.EntityManager;
public interface ExternalEntityManagerFactory {
EntityManager getExternalEntity();
}
package fi.insomnia.intra.dao;
import javax.persistence.EntityManager;
import javax.persistence.Query;
public class FoodwaveDAO extends GenericDAO {
public FoodwaveDAO(EntityManager em) {
super(em);
}
@Override
public long getAllCount() {
Query q = this.getEntityManager().createNamedQuery("countAllFoodwaves");
return (Long) q.getSingleResult();
}
@Override
protected String getAllNamedQuery() {
return "findAllFoodwaves";
}
}
package fi.insomnia.intra.dao;
import java.lang.reflect.ParameterizedType;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.Query;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.db.BaseEntity;
public abstract class GenericDAO<T extends BaseEntity> implements IGenericDao<T> {
private EntityManager entityManager;
private Class<T> clazz;
private ExternalEntityManagerFactory entityManagerfactory;
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GenericDAO.class);
@SuppressWarnings("unchecked")
public GenericDAO(EntityManager em) {
super();
setEntityManager(em);
clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
}
protected GenericDAO(Class<T> clazz) {
super();
this.clazz = clazz;
// clazz = (Class<T>) ((ParameterizedType)
// getClass().getGenericSuperclass()).getActualTypeArguments()[0];
}
protected void setEntityManagerFactory(ExternalEntityManagerFactory emf) {
entityManagerfactory = emf;
}
protected EntityManager getEntityManager() {
EntityManager ret = entityManager;
if (entityManagerfactory != null) {
logger.debug("External entity manaer factory found. Returning entity from there");
ret = entityManagerfactory.getExternalEntity();
}
logger.debug("returning entityManager: {}", ret);
return ret;
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#load(java.math.BigInteger)
*/
public final T load(BigInteger id) throws EntityNotFoundException {
T entity = get(id);
if (entity == null) {
throw new EntityNotFoundException("entity " + clazz + "#" + id + " was not found");
}
return entity;
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#get(java.math.BigInteger)
*/
public final T get(BigInteger id) {
return (T) getEntityManager().find(clazz, id);
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#save(T)
*/
public void save(final T object) {
logger.debug("Saving object {}", object);
if (object.getId() != null) {
getEntityManager().merge(object);
} else {
getEntityManager().persist(object);
}
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#delete(T)
*/
public void delete(final T object) throws UnsupportedOperationException {
getEntityManager().remove(object);
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#refresh(T)
*/
public final void refresh(final T entity) {
getEntityManager().refresh(entity);
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#flushAndClear()
*/
public final void flushAndClear() {
getEntityManager().flush();
getEntityManager().clear();
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#delete(java.math.BigInteger)
*/
public void delete(BigInteger id) throws UnsupportedOperationException {
delete(load(id));
}
protected abstract String getAllNamedQuery();
public abstract long getAllCount();
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#getAllQuery()
*/
public Query getAllQuery() {
return getEntityManager().createNamedQuery(getAllNamedQuery());
}
public Query getAllCountQuery() {
return getEntityManager().createNamedQuery(getAllNamedQuery());
}
/*
* (non-Javadoc)
* @see fi.insomnia.intra.db.IGenericDao#getAll()
*/
@SuppressWarnings("unchecked")
public List<T> getAll() {
return getAllQuery().getResultList();
}
private void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
@SuppressWarnings("unchecked")
@Override
public List<T> getItems(IPagingStatus paging) {
Query q = getAllQuery();
long allCount = this.getAllCount();
return getPagination(paging, q, allCount);
}
protected List<T> getPagination(IPagingStatus paging, Query q, long allCount) {
paging.setTotalHits(allCount);
int firstresult = paging.getPagesize() * paging.getPage();
logger.info("Pagesize: {}, {}", paging.getPagesize(), firstresult);
q.setMaxResults(paging.getPagesize());
q.setFirstResult(firstresult);
List ret = q.getResultList();
logger.info("Retcount {}", ret.size());
return ret;
}
}
package fi.insomnia.intra.dao;
import java.util.Arrays;
import java.util.List;
import javax.persistence.EntityManager;
import fi.insomnia.intra.db.Usergroup;
public class GroupDAO extends GenericDAO<Usergroup> {
private static final String SORT = "name";
private static final List<String> FIELDS = Arrays.asList("name", "details");
public GroupDAO(EntityManager em) {
super(em);
}
protected GroupDAO() {
super(Usergroup.class);
}
@Override
protected String getAllNamedQuery() {
return "findAllGroups";
}
@Override
public long getAllCount() {
// TODO Auto-generated method stub
return 0;
}
}
package fi.insomnia.intra.dao;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.EntityNotFoundException;
import javax.persistence.Query;
import fi.insomnia.intra.db.BaseEntity;
public interface IGenericDao<T extends BaseEntity> {
T load(BigInteger id) throws EntityNotFoundException;
T get(BigInteger id);
void save(final T object);
void delete(final T object) throws UnsupportedOperationException;
void refresh(final T entity);
void flushAndClear();
void delete(BigInteger id) throws UnsupportedOperationException;
Query getAllQuery();
List<T> getAll();
List<T> getItems(IPagingStatus paging);
}
\ No newline at end of file
package fi.insomnia.intra.dao;
public interface IPagingStatus {
int getPagesize();
int getPage();
void setTotalHits(long allCount);
void next();
void prev();
}
package fi.insomnia.intra.dao;
import javax.persistence.EntityManager;
import fi.insomnia.intra.db.Place;
public class PlaceDAO extends GenericDAO<Place> {
public PlaceDAO(EntityManager em) {
super(em);
}
protected PlaceDAO() {
super(Place.class);
}
@Override
protected String getAllNamedQuery() {
return "findAllPlaces";
}
@Override
public long getAllCount() {
// TODO Auto-generated method stub
return 0;
}
}
package fi.insomnia.intra.dao;
import java.util.Arrays;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.db.User;
public class UserDAO extends GenericDAO<User> {
private static final Logger logger = LoggerFactory.getLogger(UserDAO.class);
private static final String SORT = "nick";
private static final List<String> FIELDS = Arrays.asList("nick", "name", "email", "address");
public UserDAO(EntityManager em) {
super(em);
}
protected UserDAO() {
super(User.class);
}
@Override
protected String getAllNamedQuery() {
return "findAllUsers";
}
public long getAllCount() {
Query q = getEntityManager().createNamedQuery("countAllUsers");
return getAllCount(q);
}
protected long getAllCount(Query q) {
Object ret = q.getSingleResult();
long retL = 0;
if (ret instanceof Long) {
retL = (Long) ret;
}
logger.info("Retcount: {}", retL);
return retL;
}
}
package fi.insomnia.intra.dao;
import javax.persistence.EntityManager;
import fi.insomnia.intra.db.UserImage;
public class UserImageDAO extends GenericDAO<UserImage> {
public UserImageDAO(EntityManager em) {
super(em);
}
protected UserImageDAO() {
super(UserImage.class);
}
@Override
protected String getAllNamedQuery() {
return "findAllUserImages";
}
@Override
public long getAllCount() {
// TODO Auto-generated method stub
return 0;
}
}
package fi.insomnia.intra.utilbeans;
import java.util.List;
import fi.insomnia.intra.dao.IPagingStatus;
import fi.insomnia.intra.db.BaseEntity;
public interface GenericItemDAOBean<T extends BaseEntity> {
List<T> getItems(IPagingStatus paging);
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import fi.insomnia.intra.dao.ExternalEntityManagerFactory;
import fi.insomnia.intra.dao.GroupDAO;
/**
* Session Bean implementation class GroupDaoBean
*/
@Stateless
public class GroupDaoBean extends GroupDAO implements GroupDaoBeanLocal, ExternalEntityManagerFactory {
@PersistenceContext(unitName="InsomniaIntraDB")
private EntityManager em;
/**
* Default constructor.
*/
public GroupDaoBean() {
super();
this.setEntityManagerFactory(this);
}
@Override
public EntityManager getExternalEntity() {
return em;
}
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Local;
import fi.insomnia.intra.dao.IGenericDao;
import fi.insomnia.intra.db.Usergroup;
@Local
public interface GroupDaoBeanLocal extends IGenericDao<Usergroup>{
}
package fi.insomnia.intra.utilbeans;
import fi.insomnia.intra.dao.IGenericDao;
import fi.insomnia.intra.db.UserImage;
public interface IUserImageDao extends IGenericDao<UserImage> {
}
package fi.insomnia.intra.utilbeans;
import java.math.BigDecimal;
public class PagingStatus {
private int pagesize;
private int page;
private long totalHits;
public PagingStatus(int defaultSize)
{
pagesize = defaultSize;
page = 0;
totalHits = 0;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getPagesize() {
return pagesize;
}
public void setPage(int page) {
this.page = page;
}
public int getPage() {
return page;
}
public void setTotalHits(long l) {
this.totalHits = l;
}
public long getTotalHits() {
return totalHits;
}
public long getTotalPages()
{
BigDecimal pages = new BigDecimal(totalHits).divide(new BigDecimal(pagesize),BigDecimal.ROUND_CEILING);
return pages.setScale(0, BigDecimal.ROUND_CEILING).longValue();
}
public void next()
{
if(page < getTotalPages())
{
++page;
}
}
public void prev()
{
if(page > 0)
{
--page;
}
}
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Local;
import fi.insomnia.intra.dao.IPagingStatus;
@Local
public interface UserBeanLocal {
String getUsername();
String getRemoteUser();
boolean ifGrantedRole(String role);
void createUser(String username, String randomString);
String createUserWithGeneratedPassword(String username);
IPagingStatus createPagingStatus(long pagesize);
}
package fi.insomnia.intra.utilbeans;
import java.math.BigInteger;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.dao.ExternalEntityManagerFactory;
import fi.insomnia.intra.dao.IPagingStatus;
import fi.insomnia.intra.dao.UserDAO;
import fi.insomnia.intra.db.User;
/**
* Session Bean implementation class UserDaoBeanLocal
*/
@Stateless(name="UserDaoBeanRemote")
public class UserDaoBean extends UserDAO implements UserDaoBeanLocal, ExternalEntityManagerFactory, UserDaoBeanRemote {
private static final Logger logger = LoggerFactory.getLogger(UserDaoBean.class);
@PersistenceContext(unitName = "InsomniaIntraDB")
private EntityManager em;
@EJB
private UserPropertiesBeanLocal userProperties;
/**
* Default constructor.
*/
public UserDaoBean() {
super();
this.setEntityManagerFactory(this);
}
@Override
public EntityManager getExternalEntity() {
logger.debug("getting external EntityManager from UserDAOBean: {}", em);
return em;
}
/*
* public List<User> searchUser(String search) { CompassPagingStatus stat =
* this.createPagingStatus(userProperties.getPageSize()); return
* this.getCompassSearcher().paginationQuery(stat, search); } public void
* indexDatabase() { CompassGps gps = EclipseLinkHelper.getCompassGps(em);
* gps.index(); }
*/
@Override
public void indexDatabase() {
// TODO Auto-generated method stub
}
@Override
public List<User> searchUser(String search) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<User> getSearchItems(String search, IPagingStatus status) {
Query find = em.createNamedQuery("findSearch");
Query count = em.createNamedQuery("countSearch");
String searchstr = "%" + search.trim() + "%";
find.setParameter("search", searchstr);
count.setParameter("search", searchstr);
BigInteger id = null;
try {
id = new BigInteger(search);
} catch (Throwable t) {
id = BigInteger.ZERO;
}
find.setParameter("searchId", id);
count.setParameter("searchId", id);
return this.getPagination(status, find, this.getAllCount(count));
}
@Override
public User findByTag(String tag) {
if (tag != null && !tag.trim().isEmpty()) {
Query q = em.createQuery("select Object(u) from User as u where tag = :tag");
q.setParameter("tag", tag);
return (User) q.getSingleResult();
}
return null;
}
@Override
public void foundTag(String name, String tag) {
logger.warn("Found name {}, tag {}", name, tag);
}
}
package fi.insomnia.intra.utilbeans;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.intra.dao.IGenericDao;
import fi.insomnia.intra.dao.IPagingStatus;
import fi.insomnia.intra.db.User;
@Local
public interface UserDaoBeanLocal extends IGenericDao<User> {
List<User> searchUser(String search);
void indexDatabase();
List<User> getSearchItems(String search, IPagingStatus status);
User findByTag(String tag);
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Remote;
@Remote
public interface UserDaoBeanRemote {
public void foundTag(String name, String tag);
}
package fi.insomnia.intra.utilbeans;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Encoder;
import fi.insomnia.intra.dao.ExternalEntityManagerFactory;
import fi.insomnia.intra.dao.UserImageDAO;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.db.UserImage;
/**
* Session Bean implementation class UserImageBean
*/
@Stateless
public class UserImageDaoBean extends UserImageDAO implements UserImageDaoBeanLocal, ExternalEntityManagerFactory {
@PersistenceContext(unitName = "InsomniaIntraDB")
private EntityManager em;
private static final Logger logger = LoggerFactory.getLogger(UserImageDaoBean.class);
@EJB
private UserDaoBeanLocal userbean;
/**
* Default constructor.
*/
public UserImageDaoBean() {
super();
this.setEntityManagerFactory(this);
}
@Override
public EntityManager getExternalEntity() {
return em;
}
@Override
public void createImage(User user, byte[] bs) {
UserImage img = new UserImage();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
new BASE64Encoder().encodeBuffer(bs, out);
img.setDefaultImage(true);
img.setImageData(out.toByteArray());
img.setOwner(user);
img.setMimetype("img/png");
logger.info("Persisting image");
em.persist(img);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package fi.insomnia.intra.utilbeans;
import java.math.BigInteger;
import javax.ejb.Local;
import fi.insomnia.intra.db.User;
@Local
public interface UserImageDaoBeanLocal extends IUserImageDao {
void createImage(User user, byte[] bs);
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Stateless;
/**
* Session Bean implementation class UserProperties
*/
@Stateless
public class UserPropertiesBean implements UserPropertiesBeanLocal {
/**
* Default constructor.
*/
public UserPropertiesBean() {
// TODO Auto-generated constructor stub
}
@Override
public int getPageSize() {
// TODO Auto-generated method stub
return 30;
}
}
package fi.insomnia.intra.utilbeans;
import javax.ejb.Local;
@Local
public interface UserPropertiesBeanLocal {
int getPageSize();
}
package test;
import javax.ejb.Stateless;
/**
* Session Bean implementation class Foo
*/
@Stateless
public class Foo implements FooLocal {
/**
* Default constructor.
*/
public Foo() {
// TODO Auto-generated constructor stub
}
}
package test;
import javax.ejb.Local;
@Local
public interface FooLocal {
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry exported="true" kind="lib" path="/Users/tuomari/workspace/InsomniaIntraEAR/EarContent/lib/compass-2.2.0.jar"/>
<classpathentry exported="true" kind="lib" path="/Users/tuomari/workspace/InsomniaIntraEAR/EarContent/lib/slf4j-api-1.5.8.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6 2">
<attributes>
<attribute name="owner.project.facets" value="jst.utility;#system#"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes>
<attribute name="owner.project.facets" value="jst.java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>InsomniaIntraDB</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Mon Jul 06 02:53:17 EEST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
#Sun Jul 05 20:30:33 EEST 2009
eclipse.preferences.version=1
org.eclipse.jpt.core.discoverAnnotatedClasses=true
org.eclipse.jpt.core.platform=eclipselink1_1
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="InsomniaIntraDB">
<wb-resource deploy-path="/" source-path="/src"/>
</wb-module>
</project-modules>
<root>
<facet id="jpt.jpa">
<node name="libprov">
<attribute name="provider-id" value="eclipselink-110-osgi-bundles-library-provider"/>
</node>
<node name="osgi-bundles-container">
<attribute name="bundles" value="javax.persistence:[1.0.0,2.0.0);org.eclipse.persistence.core:[1.1.0,2.0.0);org.eclipse.persistence.jpa:[1.1.0,2.0.0);org.eclipse.persistence.asm:[1.1.0,2.0.0);org.eclipse.persistence.antlr:[1.1.0,2.0.0)"/>
<attribute name="label" value="EclipseLink 1.1.x"/>
</node>
</facet>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish v3 Java EE 6 2"/>
<fixed facet="jpt.jpa"/>
<fixed facet="jst.java"/>
<fixed facet="jst.utility"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="jpt.jpa" version="1.0"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="InsomniaIntraDB">
<jta-data-source>jdbc/InsomniaIntraDb</jta-data-source>
<properties>
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="both" />
<property name="eclipselink.jdbc.cache-statements" value="false"/>
<property name="eclipselink.cache.type.default" value="NONE"/>
<property name="eclipselink.cache.shared.default" value="false"/>
<!-- property name="eclipselink.session.customizer"
value="org.compass.gps.device.jpa.embedded.eclipselink.CompassSessionCustomizer" />
<property name="compass.engine.connection" value="file:///var/lib/compass/InsomniaIntra"/>
-->
</properties>
</persistence-unit>
</persistence>
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="InsomniaIntraDB">
<jta-data-source>jdbc/InsomniaIntraDb</jta-data-source>
<properties>
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="both" />
<property name="eclipselink.jdbc.cache-statements" value="false"/>
<property name="eclipselink.cache.type.default" value="NONE"/>
<property name="eclipselink.cache.shared.default" value="false"/>
<!-- property name="eclipselink.session.customizer"
value="org.compass.gps.device.jpa.embedded.eclipselink.CompassSessionCustomizer" />
<property name="compass.engine.connection" value="file:///var/lib/compass/InsomniaIntra"/>
-->
</properties>
</persistence-unit>
</persistence>
package fi.insomnia.intra.db;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import org.compass.annotations.SearchableId;
/**
* Entity implementation class for Entity: BaseEntity
*
*/
@MappedSuperclass
public abstract class BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3753550744006430665L;
@Id
@SearchableId
@GeneratedValue(strategy = IDENTITY)
private BigInteger id;
@Version
@Column(nullable=false)
private long jpaVersionField;
public BaseEntity() {
super();
}
public BigInteger getId() {
return this.id;
}
public void setId(BigInteger id) {
this.id = id;
}
public long getJpaVersionField() {
return this.jpaVersionField;
}
public void setJpaVersionField(long jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
}
package fi.insomnia.intra.db;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import org.eclipse.persistence.annotations.Cache;
@Entity
@Cache(alwaysRefresh=true)
public class Discount extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = 6100697565643252782L;
private boolean active;
private String code;
@Column(length=3)
private int percent;
@Lob
private String details;
@OneToMany(mappedBy="code")
private List<Usergroup> groups;
@OneToMany(mappedBy="code")
private List<Usergroup> places;
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getPercent() {
return percent;
}
public void setPercent(int percent) {
this.percent = percent;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public void setGroups(List<Usergroup> groups) {
this.groups = groups;
}
public List<Usergroup> getGroups() {
return groups;
}
public void setPlaces(List<Usergroup> places) {
this.places = places;
}
public List<Usergroup> getPlaces() {
return places;
}
}
package fi.insomnia.intra.db;
import fi.insomnia.intra.db.BaseEntity;
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
import javax.persistence.*;
import static javax.persistence.TemporalType.TIMESTAMP;
/**
* Entity implementation class for Entity: Foodwave
*
*/
@Entity
@NamedQueries(value = { @NamedQuery(name = "findAllFoodwaves", query = "select f from Fooodwave f"),
@NamedQuery(name = "countAllFoodwaves", query = "select count(f) as ret from Fooodwave f") })
public class Foodwave extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
public Foodwave() {
super();
}
private String name;
private String description;
@Temporal(value=TIMESTAMP)
private Calendar time;
private boolean closed;
@OneToMany(mappedBy="wave")
private List<FoodwaveOrder> orders;
@ManyToMany(mappedBy = "waves")
private List<FoodwaveElement> elements;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Calendar getTime() {
return time;
}
public void setTime(Calendar time) {
this.time = time;
}
public boolean isClosed() {
return closed;
}
public void setClosed(boolean closed) {
this.closed = closed;
}
public List<FoodwaveOrder> getOrders() {
return orders;
}
public void setOrders(List<FoodwaveOrder> orders) {
this.orders = orders;
}
public List<FoodwaveElement> getElements() {
return elements;
}
public void setElements(List<FoodwaveElement> elements) {
this.elements = elements;
}
}
package fi.insomnia.intra.db;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@Entity
@NamedQueries(value = { @NamedQuery(name = "findFoowdaveElements", query = "select fe from Fooodwave fe"),
@NamedQuery(name = "countFoowdaveElements", query = "select count(fe) as ret from FoodwaveElement fe") })
public class FoodwaveElement extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = -6804142902657108657L;
private String name;
private String description;
@Column(precision = 10, scale = 2)
private BigDecimal price;
@ManyToMany
private List<Foodwave> waves;
@OneToMany(mappedBy="element")
private List<FoodwaveOrder> orders;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public List<Foodwave> getWaves() {
return waves;
}
public void setWaves(List<Foodwave> waves) {
this.waves = waves;
}
public List<FoodwaveOrder> getOrders() {
return orders;
}
public void setOrders(List<FoodwaveOrder> orders) {
this.orders = orders;
}
}
package fi.insomnia.intra.db;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
/**
* Entity implementation class for Entity: FoodwaveOrder
*
*/
@Entity
public class FoodwaveOrder extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
public FoodwaveOrder() {
super();
}
@ManyToOne
private Foodwave wave;
@ManyToOne
private User user;
private boolean paid;
@Column(precision = 10, scale = 2)
private BigDecimal price;
@ManyToOne
private FoodwaveElement element;
public Foodwave getWave() {
return wave;
}
public void setWave(Foodwave wave) {
this.wave = wave;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public boolean isPaid() {
return paid;
}
public void setPaid(boolean paid) {
this.paid = paid;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public FoodwaveElement getElement() {
return element;
}
public void setElement(FoodwaveElement element) {
this.element = element;
}
}
package fi.insomnia.intra.db;
import fi.insomnia.intra.db.BaseEntity;
import fi.insomnia.intra.db.Usergroup;
import fi.insomnia.intra.db.User;
import java.io.Serializable;
import java.lang.String;
import javax.persistence.*;
import org.eclipse.persistence.annotations.Cache;
/**
* Entity implementation class for Entity: Place
*
*/
@Entity
@Cache(alwaysRefresh=true)
@NamedQuery(name = "findAllPlaces", query = "select p from Place p")
public class Place extends BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5764729988681758345L;
@ManyToOne
private Usergroup group;
@ManyToOne
private User user;
private String place;
private int coordX;
private int coordY;
private int type;
@Lob
private String description;
@ManyToOne
private Discount code;
public Place() {
super();
}
public Usergroup getGroup() {
return this.group;
}
public void setGroup(Usergroup group) {
this.group = group;
}
public User getUser() {
return this.user;
}
public void setUser(User user) {
this.user = user;
}
public String getPlace() {
return this.place;
}
public void setPlace(String place) {
this.place = place;
}
public int getCoordX() {
return this.coordX;
}
public void setCoordX(int coordX) {
this.coordX = coordX;
}
public int getCoordY() {
return this.coordY;
}
public void setCoordY(int coordY) {
this.coordY = coordY;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setCode(Discount code) {
this.code = code;
}
public Discount getCode() {
return code;
}
public void setType(int type) {
this.type = type;
}
public int getType() {
return type;
}
}
package fi.insomnia.intra.db;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.math.BigDecimal;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
@Entity
public class ShopAction extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = -7348146332511985007L;
@ManyToOne
private ShopElement element;
@ManyToOne
private User shopper;
@Column(precision = 10, scale = 2)
private BigDecimal price;
private int count;
@Temporal(value = TIMESTAMP)
private Calendar time = Calendar.getInstance();
public ShopElement getElement() {
return element;
}
public void setElement(ShopElement element) {
this.element = element;
}
public User getShopper() {
return shopper;
}
public void setShopper(User shopper) {
this.shopper = shopper;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public void setTime(Calendar time) {
this.time = time;
}
public Calendar getTime() {
return time;
}
}
package fi.insomnia.intra.db;
import fi.insomnia.intra.db.BaseEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.*;
/**
* Entity implementation class for Entity: ShopElement
*
*/
@Entity
@NamedQueries(value = { @NamedQuery(name = "findShopElements", query = "select sh from ShopElement sh"),
@NamedQuery(name = "countShopElements", query = "select count(sh) as sh from ShopElement sh") })
public class ShopElement extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
public ShopElement() {
super();
}
private String name;
@Lob
private String description;
@Column(precision = 10, scale = 2)
private BigDecimal price;
@OneToMany(mappedBy="element")
private List<ShopAction> bought;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public List<ShopAction> getBought() {
return bought;
}
public void setBought(List<ShopAction> bought) {
this.bought = bought;
}
}
package fi.insomnia.intra.db;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import org.eclipse.persistence.annotations.Cache;
import static javax.persistence.TemporalType.TIMESTAMP;
@Entity
@Cache(alwaysRefresh=true)
public class Transactions extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = -6133145840969288475L;
@Temporal( value = TIMESTAMP)
private Date paydate;
private BigDecimal sum;
@Column(length=20)
private BigInteger reference;
@Column(length=100)
private String checksum;
@Column(length=100)
private String payer;
public Date getPaydate() {
return paydate;
}
public void setPaydate(Date paydate) {
this.paydate = paydate;
}
public BigDecimal getSum() {
return sum;
}
public void setSum(BigDecimal sum) {
this.sum = sum;
}
public BigInteger getReference() {
return reference;
}
public void setReference(BigInteger reference) {
this.reference = reference;
}
public String getChecksum() {
return checksum;
}
public void setChecksum(String checksum) {
this.checksum = checksum;
}
public String getPayer() {
return payer;
}
public void setPayer(String payer) {
this.payer = payer;
}
}
package fi.insomnia.intra.db;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.OneToMany;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableProperty;
import org.eclipse.persistence.annotations.Cache;
/**
* Entity implementation class for Entity: User
*
*/
@Entity
@Cache(alwaysRefresh=true)
@Searchable
@NamedQueries(value = { @NamedQuery(name = "findAllUsers", query = "select u from User u"),
@NamedQuery(name = "countAllUsers", query = "select count(u) as ret from User u"),
@NamedQuery(name = "findSearch", query = "select u from User u where u.name like :search or u.nick like :search or u.id = :searchId"),
@NamedQuery(name = "countSearch", query = "select count(u) as ret from User u where u.name like :search or u.nick like :search or u.id = :searchId"),})
public class User extends BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7553608322249007749L;
@Temporal(value = TemporalType.TIMESTAMP)
private Date created;
@Temporal(value = TemporalType.TIMESTAMP)
private Date edited;
@SearchableProperty
private String name;
private String password;
@SearchableProperty
private String nick;
@SearchableProperty
private String email;
@SearchableProperty
private String address;
@Column(length = 11)
private String zip;
private BigDecimal price;
private String town;
private String phone;
private Boolean female;
private Boolean paid;
private Boolean passive;
@OneToMany(mappedBy="shopper")
private List<ShopAction> shopHistory;
/*
* 11:09 <Femur> 0 konepaikka 11:09 <Femur> 1 vieras 11:09 <Femur> 2 vip
* 11:09 <Femur> 10 "core" org 11:09 <Femur> 11 org
*/
private int type;
@Column(length = 32)
private String discount;
@Column(length = 32)
private String code;
@Column(length = 4)
private Integer birthyear;
@OneToMany(mappedBy="user")
private List<FoodwaveOrder> orders;
@OneToMany(mappedBy = "leader")
private List<Usergroup> leaderInGroup;
@ManyToMany(mappedBy = "members")
private List<Usergroup> groups;
@OneToMany(mappedBy = "user")
private List<Place> places;
@OneToMany(mappedBy = "owner")
private List<UserImage> images;
public User() {
super();
}
public Date getCreated() {
return this.created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getEdited() {
return this.edited;
}
public void setEdited(Date edited) {
this.edited = edited;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNick() {
return this.nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTown() {
return this.town;
}
public void setTown(String town) {
this.town = town;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setLeaderInGroup(List<Usergroup> leaderInGroup) {
this.leaderInGroup = leaderInGroup;
}
public List<Usergroup> getLeaderInGroup() {
return leaderInGroup;
}
public void setGroups(List<Usergroup> groups) {
this.groups = groups;
}
public List<Usergroup> getGroups() {
return groups;
}
public void setPlaces(List<Place> places) {
this.places = places;
}
public List<Place> getPlaces() {
return places;
}
public void setImages(List<UserImage> images) {
this.images = images;
}
public List<UserImage> getImages() {
return images;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getZip() {
return zip;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getPrice() {
return price;
}
public void setType(int type) {
this.type = type;
}
public int getType() {
return type;
}
public void setDiscount(String discount) {
this.discount = discount;
}
public String getDiscount() {
return discount;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setBirthyear(Integer birthyear) {
this.birthyear = birthyear;
}
public Integer getBirthyear() {
return birthyear;
}
public void setFemale(Boolean female) {
this.female = female;
}
public Boolean getFemale() {
return female;
}
public void setPaid(Boolean paid) {
this.paid = paid;
}
public Boolean getPaid() {
return paid;
}
public void setPassive(Boolean passive) {
this.passive = passive;
}
public Boolean getPassive() {
return passive;
}
public void setShopHistory(List<ShopAction> shopHistory) {
this.shopHistory = shopHistory;
}
public List<ShopAction> getShopHistory() {
return shopHistory;
}
public void setOrders(List<FoodwaveOrder> orders) {
this.orders = orders;
}
public List<FoodwaveOrder> getOrders() {
return orders;
}
}
package fi.insomnia.intra.db;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import org.eclipse.persistence.annotations.Cache;
/**
* Entity implementation class for Entity: UserImage
*
*/
@Entity
@Cache(alwaysRefresh=true)
@NamedQuery(name = "findAllUserImages", query = "select ui from UserImage ui")
public class UserImage extends BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1945473863086498880L;
private String name;
@Lob
private String description;
private boolean defaultImage;
@ManyToOne
private User owner;
private String mimetype;
@Lob
private byte[] imageData;
public UserImage() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public void setOwner(User owner) {
this.owner = owner;
}
public User getOwner() {
return owner;
}
public void setDefaultImage(boolean defaultImage) {
this.defaultImage = defaultImage;
}
public boolean isDefaultImage() {
return defaultImage;
}
public void setImageData(byte[] imageData) {
this.imageData = imageData;
}
public byte[] getImageData() {
return imageData;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public String getMimetype() {
return mimetype;
}
}
package fi.insomnia.intra.db;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableProperty;
import org.eclipse.persistence.annotations.Cache;
/**
* Entity implementation class for Entity: Group
*
*/
@Entity
@Searchable
@Cache(alwaysRefresh=true)
@NamedQuery(name = "findAllGroups", query = "select g from Usergroup g")
public class Usergroup extends BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5354318106495161604L;
@Column(unique = true, nullable = false)
@SearchableProperty
private String name;
@Lob
@SearchableProperty
private String details;
@ManyToOne
private Discount code;
@ManyToOne
private User leader;
@ManyToMany
private List<User> members;
@OneToMany(mappedBy = "group")
private List<Place> places;
public Usergroup() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDetails() {
return this.details;
}
public void setDetails(String details) {
this.details = details;
}
public void setLeader(User leader) {
this.leader = leader;
}
public User getLeader() {
return leader;
}
public void setMembers(List<User> members) {
this.members = members;
}
public List<User> getMembers() {
return members;
}
public void setPlaces(List<Place> places) {
this.places = places;
}
public List<Place> getPlaces() {
return places;
}
public void setCode(Discount code) {
this.code = code;
}
public Discount getCode() {
return code;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="src" path="/InsomniaIntraDB"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6 2">
<attributes>
<attribute name="owner.project.facets" value="#system#;jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes>
<attribute name="owner.project.facets" value="jst.java"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="/DeskerBeans"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<pageflow:Pageflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pageflow="http://www.sybase.com/suade/pageflow" id="pf12468368703530" configfile="/InsomniaIntraWeb/WebContent/WEB-INF/faces-config.xml">
<nodes xsi:type="pageflow:PFPage" name="web/user/list" x="338" y="370" id="pf124706974139414" referenceLink="//@navigationRule.3/@navigationCase.0/@toViewId|" outlinks="pf124706974139415 pf124706974139417 pf12473073875190" inlinks="pf12470914612230" path="/web/user/list.jspx"/>
<nodes xsi:type="pageflow:PFPage" name="web/user/edit" x="122" y="370" id="pf124706974139418" referenceLink="//@navigationRule.3/@fromViewId|" outlinks="pf12470914612230" inlinks="pf124706974139415" path="/web/user/edit.jspx"/>
<nodes xsi:type="pageflow:PFPage" name="web/user/sayGoodbye" x="122" y="754" id="pf124706974139419" referenceLink="//@navigationRule.1/@navigationCase.0/@toViewId|" path="/web/user/sayGoodbye.jspx"/>
<nodes xsi:type="pageflow:PFPage" name="web/user/sayHello" x="554" y="178" id="pf124706974139420" referenceLink="//@navigationRule.2/@navigationCase.0/@toViewId|" inlinks="pf124706974139417" path="/web/user/sayHello.jspx"/>
<nodes xsi:type="pageflow:PFPage" name="web/user/edit.jsf" x="554" y="562" id="pf12473073875201" referenceLink="//@navigationRule.1/@navigationCase.0/@toViewId|" inlinks="pf12473073875190" path="/web/user/edit.jsf"/>
<links id="pf124706974139415" target="pf124706974139418" source="pf124706974139414" outcome="edit"/>
<links id="pf124706974139417" target="pf124706974139420" source="pf124706974139414" outcome="sayHello"/>
<links id="pf12470914612230" target="pf124706974139414" source="pf124706974139418" outcome="saved" fromaction="#{user.save}"/>
<links id="pf12473073875190" target="pf12473073875201" source="pf124706974139414" outcome="create"/>
</pageflow:Pageflow>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>InsomniaIntraWeb</name>
<comment></comment>
<projects>
<project>InsomniaRemoteRfid</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
#Sun Jul 05 23:29:20 EEST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="InsomniaIntraWeb">
<wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<dependent-module archiveName="InsomniaRemoteRfid.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/InsomniaRemoteRfid/InsomniaRemoteRfid">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="InsomniaIntraWeb"/>
<property name="java-output-path"/>
</wb-module>
</project-modules>
<root>
<facet id="jst.jsf">
<node name="libprov">
<attribute name="provider-id" value="jsf-no-op-library-provider"/>
</node>
</facet>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish v3 Java EE 6 2"/>
<fixed facet="jst.web"/>
<fixed facet="jst.java"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="sun.facet" version="9"/>
<installed facet="jst.jsf" version="1.2"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Manifest-Version: 1.0
Class-Path: lib/slf4j-api-1.5.8.jar
lib/slf4j-jdk14-1.5.8.jar
# To change this template, choose Tools | Templates
# and open the template in the editor.
Title=Pet Catalog
Next=Next
Previous=Prev
Name=Name
Photo=Photo
Price=Price
Description=Description
Seller=Seller's Location
email=Email
grant {
permission java.security.AllPermission;
};
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<resource-bundle>
<base-name>web.messages</base-name>
<var>msgs</var>
</resource-bundle>
</application>
</faces-config>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/InsomniaIntraWeb</context-root>
<security-role-mapping>
<role-name>admin</role-name>
<group-name>admin</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>manager</role-name>
<group-name>manager</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>user</role-name>
<group-name>user</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class java code.</description>
</property>
</jsp-config>
</sun-web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>InsomniaIntraWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>InsomniaIntraLdap</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/loginerr.jsf</form-error-page>
</form-login-config>
</login-config>
<error-page>
<exception-type>java.lang.SecurityException</exception-type>
<location>/login.html</location>
</error-page>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.resourceUpdateCheckPeriod</param-name>
<param-value>-1</param-value>
</context-param>
<context-param>
<description>
Set this flag to true if you want the JavaServer Faces
Reference Implementation to validate the XML in your
faces-config.xml resources against the DTD. Default
value is false.
</description>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>DisplayImage</display-name>
<servlet-name>DisplayImage</servlet-name>
<servlet-class>fi.insomnia.intra.DisplayImage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DisplayImage</servlet-name>
<url-pattern>/DisplayImage/*</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>ReaderListener</display-name>
<servlet-name>ReaderListener</servlet-name>
<servlet-class>fi.insomnia.intra.rfid.ReaderListenerStarter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReaderListener</servlet-name>
<url-pattern>/ReaderListener</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>UploadServlet</display-name>
<servlet-name>UploadServlet</servlet-name>
<servlet-class>fi.insomnia.intra.UploadServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UploadServlet</servlet-name>
<url-pattern>/UploadServlet/*</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>TagListener</display-name>
<servlet-name>TagListener</servlet-name>
<servlet-class>fi.insomnia.intra.TagListener</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TagListener</servlet-name>
<url-pattern>/TagListener</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GlassFish JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Varastomaatti - Pidetään varmaan se varasto kunnossa!</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="j_security_check">
<table>
<tr>
<td>Username:</td>
<td><input type="text" name="j_username" /></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="password" name="j_password" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ui="http://java.sun.com/JSF/Facelet"
version="2.0">
<ui:composition template="templates/default-template.jspx">
<ui:define name="body">
<form method="POST" action="j_security_check">
<input type="text" name="j_username" />
<input type="password" name="j_password" />
<input type="submit" name="submit" value="submit" />
</form>
</ui:define>
</ui:composition>
</jsp:root>
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" version="2.0">
<ui:composition template="/templates/default-template.jspx">
<ui:define name="body">
<form method="POST" action="j_security_check">
<input type="text" name="j_username" />
<input type="password" name="j_password" />
<input type="submit" name="submit" value="submit" />
</form>
</ui:define>
</ui:composition>
</jsp:root>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Pet Catalog</title>
</h:head>
<h:body>
<ui:composition template="/templates/default-template.xhtml">
<ui:define name="content">
Hello ${user.beanMessage }
Foobar
</ui:define>
</ui:composition>
asdasd
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title><ui:insert name="title">Default title</ui:insert></title>
<style type="text/css">
body {
background-color: #fefefe;
}
</style>
</head>
<body>
<div id="header">
<ui:insert name="header">
Header area. See comments below this line in the source.
<!-- include your header file or uncomment the include below and create header.xhtml in this directory -->
<!-- <ui:include src="header.xhtml"/> -->
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
Content area. See comments below this line in the source.
<!-- include your content file or uncomment the include below and create content.xhtml in this directory -->
<!-- <div> -->
<!-- <ui:include src="content.xhtml"/> -->
<!-- </div> -->
</ui:insert>
</div>
<div id="footer">
<ui:insert name="footer">
Footer area. See comments below this line in the source.
<!-- include your header file or uncomment the include below and create footer.xhtml in this directory -->
<!--<ui:include src="footer.xhtml"/> -->
</ui:insert>
</div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<div style="background-color:navy;width:100!;color:white"></div>!
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="width:100!;font-size:36px;line-height:48px;background-color:navy;color:white">My! Facelet Application</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Facelets: Number Guess Tutorial</title>
<style type="text/css">
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
</style>
</head>
<body>
<h1>
<ui:insert name="title">Default Title</ui:insert>
</h1>
<p>
<ui:insert name="body">Default Body</ui:insert>
</p>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/templates/default-template.xhtml">
<ui:define name="content">
<h:form styleClass="jsfcrud_list_form">
<h:inputText value="#{user.search}" />
<h:commandButton action="userlist" value="Search" />
<h:outputStylesheet name="css/styles.css" />
<h:outputText
value="Item #{catalog.pagingInfo.firstItem + 1} .. #{catalog.pagingInfo.lastItem} of #{catalog.pagingInfo.itemCount} " />
<h:commandButton action="#{user.prevpage}" value="#{msgs.Previous}" />
<h:commandButton action="#{user.nextpage}" value="#{msgs.Next}" />
Size: <h:outputText value="#{user.status.totalHits}" /> pages:<h:outputText
value="#{user.status.getTotalPages()} " />
<h:dataTable id="dt1" value="#{user.items}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="name" />
</f:facet>
<h:commandLink action="#{user.getDetail}" value="#{item.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="id" />
</f:facet>
<h:outputText value="#{item.id}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="nick" />
</f:facet>
<h:outputText value="#{item.nick}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="email" />
</f:facet>
<h:outputText value="#{item.email}"></h:outputText>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/templates/default-template.xhtml">
<ui:define name="content">
<h:form>
<h:outputStylesheet name="css/styles.css" />
<h:panelGrid columns="2" border="0">
<h:outputText value="#{msgs.Name}:" />
<h:outputText value="#{user.item.name}" title="Name" />
<h:outputText value="#{msgs.Description}:" />
<h:outputText value="#{user.item.nick}" title="Description" />
<h:outputText value="#{msgs.email}" />
<h:outputText value="#{user.item.email}" title="Email" />
</h:panelGrid>
<h:commandButton id="back" value="Back" action="#{user.back}" />
<h2>Usergroups</h2>
<h:dataTable id="usergroups" value="#{user.item.groups}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="name" />
</f:facet>
<h:outputText value="#{item.name}" />
</h:column>
<h:column>
<h2>Places</h2>
<h:dataTable id="places" value="#{item.places}" var="place">
<h:column>
<f:facet name="header">
<h:outputText value="place" />
</f:facet>
<h:outputText value="#{place.place}" />
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
<h2>Images</h2>
</h:form>
<h:dataTable id="images" value="#{user.item.images}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="Image" />
</f:facet>
<h:graphicImage height="100" url="/DisplayImage/#{item.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Image" />
</f:facet>
<h:outputLink target="imgwin"
value="#{facesContext.externalContext.request.contextPath}/DisplayImage/#{item.id}"> Show image</h:outputLink>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Card" />
</f:facet>
<h:outputLink target="_blank"
value="#{facesContext.externalContext.request.contextPath}/DisplayImage/#{item.id}/card">Show card</h:outputLink>
</h:column>
</h:dataTable>
<object width="400" height="400">
<param name="foo"
value="#{facesContext.externalContext.request.contextPath}/Uploader.swf?userid=#{user.item.id}&amp;origin=#{facesContext.externalContext.request.contextPath}">
<embed
src="#{facesContext.externalContext.request.contextPath}/Uploader.swf?userid=#{user.item.id}&amp;origin=#{facesContext.externalContext.request.contextPath}"
width="400" height="400"> </embed></param>
</object>
<h:form>
<h:commandButton action="#{user.reloadUser}" value="Refresh page" />
</h:form>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/templates/default-template.xhtml">
<ui:define name="content">
<h:form>
<h:outputStylesheet name="css/styles.css" />
<h:panelGrid columns="2" border="0">
<h:outputText value="#{msgs.Name}:" />
<h:outputText value="#{user.item.name}" title="Name" />
<h:outputText value="#{msgs.Description}:" />
<h:outputText value="#{user.item.nick}" title="Description" />
<h:outputText value="#{msgs.email}" />
<h:outputText value="#{user.item.email}" title="Email" />
</h:panelGrid>
<h:commandButton id="back" value="Back" action="#{user.back}" />
<h2>Usergroups</h2>
<h:dataTable id="usergroups" value="#{user.item.groups}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="name" />
</f:facet>
<h:outputText value="#{item.name}" />
</h:column>
<h:column>
<h2>Places</h2>
<h:dataTable id="places" value="#{item.places}" var="place">
<h:column>
<f:facet name="header">
<h:outputText value="place" />
</f:facet>
<h:outputText value="#{place.place}" />
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
<h2>Places</h2>
<h:dataTable id="userplaces" value="#{user.item.places}" var="place">
<h:column>
<f:facet name="header">
<h:outputText value="place" />
</f:facet>
<h:outputText value="#{place.place}" />
</h:column>
<h2>Images</h2>
</h:form>
<h:dataTable id="images" value="#{user.item.images}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="Image" />
</f:facet>
<h:graphicImage height="100" url="/DisplayImage/#{item.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Image" />
</f:facet>
<h:outputLink target="imgwin"
value="#{facesContext.externalContext.request.contextPath}/DisplayImage/#{item.id}"> Show image</h:outputLink>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Card" />
</f:facet>
<h:outputLink target="_blank"
value="#{facesContext.externalContext.request.contextPath}/DisplayImage/#{item.id}/card">Show card</h:outputLink>
</h:column>
</h:dataTable>
<object width="400" height="400">
<param name="foo"
value="#{facesContext.externalContext.request.contextPath}/Uploader.swf?userid=#{user.item.id}&amp;origin=#{facesContext.externalContext.request.contextPath}">
<embed
src="#{facesContext.externalContext.request.contextPath}/Uploader.swf?userid=#{user.item.id}&amp;origin=#{facesContext.externalContext.request.contextPath}"
width="400" height="400"> </embed></param>
</object>
<h:form>
<h:commandButton action="#{user.reloadUser}" value="Refresh page" />
</h:form>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/template/default-template.xhtml">
<ui:define name="content">
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/templates/default-template.xhtml">
<ui:define name="content">
<h:form styleClass="jsfcrud_list_form">
<h:inputText value="#{user.search}" />
<h:commandButton action="userlist" value="Search" />
<h:outputStylesheet name="css/styles.css" />
<h:outputText
value="Item #{catalog.pagingInfo.firstItem + 1} .. #{catalog.pagingInfo.lastItem} of #{catalog.pagingInfo.itemCount} " />
<h:commandButton action="#{user.prevpage}" value="#{msgs.Previous}" />
<h:commandButton action="#{user.nextpage}" value="#{msgs.Next}" />
Size: <h:outputText value="#{user.status.totalHits}" /> pages:<h:outputText
value="#{user.status.getTotalPages()} " />
<h:dataTable id="dt1" value="#{user.items}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="name" />
</f:facet>
<h:commandLink action="#{user.getDetail}" value="#{item.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="id" />
</f:facet>
<h:outputText value="#{item.id}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="nick" />
</f:facet>
<h:outputText value="#{item.nick}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="email" />
</f:facet>
<h:outputText value="#{item.email}"></h:outputText>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
<?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="InsomniaIntraWeb" default="default" basedir=".">
<description>Builds, tests, and runs the project InsomniaIntraWeb.</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-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<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.
Other way how to customize the build is by overriding existing main targets.
The target 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
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
<property name="deploy.context.root.argument" value="?contextroot=${sun-web-app.context-root}"/>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}?force=true?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- dist
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- cleanup
-->
<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="InsomniaIntraWeb-impl">
<import file="ant-deploy.xml"/>
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<target depends="dist,javadoc" description="Build whole project." name="default"/>
<!--
INITIALIZATION SECTION
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" if="dist.ear.dir" name="-do-ear-init"/>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<webproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
<webproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
<webproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
<webproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
<condition property="platform.javac" value="${platform.home}/bin/javac">
<equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
</condition>
<property name="platform.javac" value="${platform.javac.tmp}"/>
<webproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
<condition property="platform.java" value="${platform.home}/bin/java">
<equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
</condition>
<property name="platform.java" value="${platform.java.tmp}"/>
<webproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
<condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
<equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
</condition>
<property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
<fail unless="platform.home">Must set platform.home</fail>
<fail unless="platform.bootcp">Must set platform.bootcp</fail>
<fail unless="platform.java">Must set platform.java</fail>
<fail unless="platform.javac">Must set platform.javac</fail>
<fail if="platform.invalid">
The J2SE Platform is not correctly set up.
Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files.
Either open the project in the IDE and setup the Platform with the same name or add it manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used)
</fail>
<condition property="have.tests">
<or/>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<isfalse value="${javadoc.preview}"/>
</condition>
<property name="javac.compilerargs" value=""/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<condition property="no.dist.ear.dir">
<not>
<isset property="dist.ear.dir"/>
</not>
</condition>
<property name="build.web.excludes" value="${build.classes.excludes}"/>
<condition property="do.compile.jsps">
<istrue value="${compile.jsps}"/>
</condition>
<condition property="do.debug.server">
<or>
<not>
<isset property="debug.server"/>
</not>
<istrue value="${debug.server}"/>
<and>
<not>
<istrue value="${debug.server}"/>
</not>
<not>
<istrue value="${debug.client}"/>
</not>
</and>
</or>
</condition>
<condition property="do.debug.client">
<istrue value="${debug.client}"/>
</condition>
<condition property="do.display.browser">
<istrue value="${display.browser}"/>
</condition>
<condition property="do.display.browser.debug">
<and>
<isset property="do.display.browser"/>
<not>
<isset property="do.debug.client"/>
</not>
</and>
</condition>
<available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/>
<available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/>
<condition property="do.war.package.with.custom.manifest">
<isset property="has.custom.manifest"/>
</condition>
<condition property="do.war.package.without.custom.manifest">
<not>
<isset property="has.custom.manifest"/>
</not>
</condition>
<condition property="do.tmp.war.package.with.custom.manifest">
<and>
<isset property="has.custom.manifest"/>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<condition property="do.tmp.war.package.without.custom.manifest">
<and>
<not>
<isset property="has.custom.manifest"/>
</not>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<condition property="do.tmp.war.package">
<isfalse value="${directory.deployment.supported}"/>
</condition>
<property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/>
<condition else="" property="application.args.param" value="${application.args}">
<and>
<isset property="application.args"/>
<not>
<equals arg1="${application.args}" arg2="" trim="true"/>
</not>
</and>
</condition>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
<property name="runmain.jvmargs" value=""/>
</target>
<target depends="init" name="-init-cos" unless="deploy.on.save">
<condition property="deploy.on.save" value="true">
<istrue value="${j2ee.deploy.on.save}"/>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="build.web.dir">Must set build.web.dir</fail>
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.war">Must set dist.war</fail>
<fail unless="j2ee.platform.classpath">
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true">
<batchtest todir="${build.test.results.dir}"/>
<classpath>
<path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${runmain.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true" jvm="${platform.java}">
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="@{classpath}:${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjsdebug">
<macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${client.url}" name="webUrl"/>
<sequential>
<nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<bootclasspath>
<path path="${platform.bootcp}"/>
</bootclasspath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
<macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
<sequential>
<nbjpdaappreloaded/>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<exec executable="${platform.java}" outputproperty="version-output">
<arg value="-version"/>
</exec>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${application.args.param}" name="args"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true" jvm="${platform.java}">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg line="@{args}"/>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs" name="init"/>
<!--
COMPILATION SECTION
-->
<target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/>
<target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/>
<target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-copy-webdir">
<copy todir="${build.web.dir}">
<fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/>
</copy>
<copy todir="${build.web.dir}/WEB-INF">
<fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/>
</copy>
</target>
<target depends="init, deps-jar, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-persistence-xml, -copy-webdir, library-inclusion-in-archive,library-inclusion-in-manifest" if="have.sources" name="-do-compile">
<webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target if="has.custom.manifest" name="-copy-manifest">
<mkdir dir="${build.meta.inf.dir}"/>
<copy todir="${build.meta.inf.dir}">
<fileset dir="${conf.dir}" includes="MANIFEST.MF"/>
</copy>
</target>
<target if="has.persistence.xml" name="-copy-persistence-xml">
<mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/>
<copy todir="${build.web.dir}/WEB-INF/classes/META-INF">
<fileset dir="${persistence.xml.dir}" includes="persistence.xml"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps">
<mkdir dir="${build.generated.dir}/src"/>
<java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true">
<arg value="-uriroot"/>
<arg file="${basedir}/${build.web.dir}"/>
<arg value="-d"/>
<arg file="${basedir}/${build.generated.dir}/src"/>
<arg value="-die1"/>
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
<classpath path="${java.home}/../lib/tools.jar:${jspctask.classpath}:${jspcompilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
<webproject2:javac classpath="${j2ee.platform.classpath}:${build.classes.dir}:${jspcompilation.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/>
</target>
<target depends="compile" if="jsp.includes" name="-do-compile-single-jsp">
<fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail>
<mkdir dir="${build.generated.dir}/src"/>
<java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true">
<arg value="-uriroot"/>
<arg file="${basedir}/${build.web.dir}"/>
<arg value="-d"/>
<arg file="${basedir}/${build.generated.dir}/src"/>
<arg value="-die1"/>
<arg value="-jspc.files"/>
<arg path="${jsp.includes}"/>
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
<classpath path="${java.home}/../lib/tools.jar:${jspctask.classpath}:${jspcompilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
<webproject2:javac classpath="${j2ee.platform.classpath}:${build.classes.dir}:${jspcompilation.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src">
<customize>
<patternset includes="${javac.jsp.includes}"/>
</customize>
</webproject2:javac>
</target>
<target name="compile-single-jsp">
<fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail>
<antcall target="-do-compile-single-jsp"/>
</target>
<!--
DIST BUILDING SECTION
-->
<target name="-pre-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}">
<fileset dir="${build.web.dir}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
<fileset dir="${build.web.dir}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}">
<fileset dir="${build.web.dir}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
<fileset dir="${build.web.dir}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
<target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
<copyfiles files="${file.reference.commons-logging-1.1.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-logging-1.1.1.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.tomahawk-1.1.10-SNAPSHOT.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.tomahawk-1.1.10-SNAPSHOT.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-beanutils-1.7.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-beanutils-1.7.0.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-fileupload-1.2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-fileupload-1.2.1.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.el-impl-1.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.el-impl-1.0.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-el.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-el.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.el-api-1.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.el-api-1.0.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.jsf-facelets.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.jsf-facelets.jar" todir="${dist.ear.dir}"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Class-Path" value="${manifest.file.reference.commons-logging-1.1.1.jar} ${manifest.file.reference.tomahawk-1.1.10-SNAPSHOT.jar} ${manifest.file.reference.commons-beanutils-1.7.0.jar} ${manifest.file.reference.commons-fileupload-1.2.1.jar} ${manifest.file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar} ${manifest.file.reference.el-impl-1.0.jar} ${manifest.file.reference.commons-el.jar} ${manifest.file.reference.el-api-1.0.jar} ${manifest.file.reference.jsf-facelets.jar} "/>
</manifest>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
<copyfiles files="${file.reference.commons-logging-1.1.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.tomahawk-1.1.10-SNAPSHOT.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-beanutils-1.7.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-fileupload-1.2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.el-impl-1.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-el.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.el-api-1.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jsf-facelets.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist">
<dirname file="${dist.ear.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.web.dir}"/>
</jar>
</target>
<target name="-post-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/>
<target depends="init,-init-cos,compile,-pre-dist,do-ear-dist,-post-dist" description="Build distribution (WAR) to be packaged into an EAR." name="dist-ear"/>
<!--
EXECUTION SECTION
-->
<target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/>
<target name="-pre-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-post-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
</target>
<target name="-post-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
</target>
<target name="-run-deploy-am">
<!-- Task to deploy to the Access Manager runtime. -->
</target>
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy" name="run-deploy">
<nbjpdaappreloaded/>
</target>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.war}"/>
<property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="init,-pre-dist,dist,-post-dist" name="verify">
<nbverify file="${dist.war}"/>
</target>
<target depends="run-deploy,-init-display-browser,-display-browser-nb,-display-browser-cl" name="run-display-browser"/>
<target if="do.display.browser" name="-init-display-browser">
<condition property="do.display.browser.nb">
<isset property="netbeans.home"/>
</condition>
<condition property="do.display.browser.cl">
<isset property="deploy.ant.enabled"/>
</condition>
</target>
<target if="do.display.browser.nb" name="-display-browser-nb">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser.cl" name="-get-browser" unless="browser">
<condition property="browser" value="rundll32">
<os family="windows"/>
</condition>
<condition else="" property="browser.args" value="url.dll,FileProtocolHandler">
<os family="windows"/>
</condition>
<condition property="browser" value="/usr/bin/open">
<os family="mac"/>
</condition>
<property environment="env"/>
<condition property="browser" value="${env.BROWSER}">
<isset property="env.BROWSER"/>
</condition>
<condition property="browser" value="/usr/bin/firefox">
<available file="/usr/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/local/firefox/firefox">
<available file="/usr/local/firefox/firefox"/>
</condition>
<condition property="browser" value="/usr/bin/mozilla">
<available file="/usr/bin/mozilla"/>
</condition>
<condition property="browser" value="/usr/local/mozilla/mozilla">
<available file="/usr/local/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/firefox/firefox">
<available file="/usr/sfw/lib/firefox/firefox"/>
</condition>
<condition property="browser" value="/opt/csw/bin/firefox">
<available file="/opt/csw/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/mozilla/mozilla">
<available file="/usr/sfw/lib/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/opt/csw/bin/mozilla">
<available file="/opt/csw/bin/mozilla"/>
</condition>
</target>
<target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl">
<fail unless="browser">
Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
</fail>
<property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/>
<echo>Launching ${browse.url}</echo>
<exec executable="${browser}" spawn="true">
<arg line="${browser.args} ${browse.url}"/>
</exec>
</target>
<target depends="init,-init-cos,compile-single" name="run-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<webproject1:java classname="${run.class}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
</target>
<!--
DEBUGGING SECTION
-->
<target depends="init,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" description="Debug project in IDE." if="netbeans.home" name="debug">
<nbstartserver debugmode="true"/>
<antcall target="connect-debugger"/>
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/>
<antcall target="debug-display-browser"/>
<antcall target="connect-client-debugger"/>
</target>
<target if="do.debug.server" name="connect-debugger" unless="is.debugged">
<nbjpdaconnect address="${jpda.address}" host="${jpda.host}" name="${name}" transport="${jpda.transport}">
<classpath>
<path path="${debug.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<sourcepath>
<path path="${web.docbase.dir}"/>
</sourcepath>
<bootclasspath>
<path path="${platform.bootcp}"/>
</bootclasspath>
</nbjpdaconnect>
</target>
<target if="do.display.browser.debug" name="debug-display-browser">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.debug.client" name="connect-client-debugger">
<webproject1:nbjsdebugstart webUrl="${client.url}"/>
</target>
<target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
</target>
<target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
<target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
<webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
</target>
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<webproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<webproject1:debug classname="${debug.class}"/>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<webproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
JAVADOC SECTION
-->
<target depends="init" name="javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
JUNIT COMPILATION SECTION
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
<webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir=""/>
<copy todir="${build.test.classes.dir}"/>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir=""/>
<copy todir="${build.test.classes.dir}"/>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
JUNIT EXECUTION SECTION
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<webproject2:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<webproject2:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
JUNIT DEBUGGING SECTION
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<!-- must exist, otherwise the XML formatter would fail -->
<mkdir dir="${build.test.results.dir}"/>
<webproject1:debug args="${test.class}" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</webproject1:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<webproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
CLEANUP SECTION
-->
<target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps"/>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="build.dir.to.clean" value="${build.web.dir}"/>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.dir.to.clean}/WEB-INF/lib"/>
</delete>
<delete dir="${build.dir}"/>
<available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/>
<delete dir="${dist.dir}"/>
</target>
<target depends="do-clean" if="status.clean-failed" name="check-clean">
<echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/>
<echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" description="Clean build products." name="clean-ear"/>
</project>
build.xml.data.CRC32=a64371c8
build.xml.script.CRC32=f704cd2a
build.xml.stylesheet.CRC32=c0ebde35@1.15.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=a64371c8
nbproject/build-impl.xml.script.CRC32=20d7dd89
nbproject/build-impl.xml.stylesheet.CRC32=8ab4467e@1.15.1.1
deploy.ant.properties.file=/Users/tuomari/.netbeans/6.7/gfv3-1237965009.properties
j2ee.platform.classpath=/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.annotation.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.jms.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.resource.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.servlet.jsp.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.enterprise.deploy.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.management.j2ee.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.transaction.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.security.auth.message.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.servlet.jsp.jstl.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.ejb.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.servlet.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/endorsed/webservices-api-osgi.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.security.jacc.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.persistence.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/javax.mail.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/jsr311-api.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/webservices-osgi.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/jaxb-osgi.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/jstl-impl.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/jsf-impl.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/jsf-api.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/bean-validator.jar:/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish/modules/webbeans-osgi-bundle.jar
j2ee.server.instance=[/Users/tuomari/javajutut/glassFish_v3_netbeans/glassfish]deployer:gfv3ee6:localhost:4848
javac.debug=false
user.properties.file=/Users/tuomari/.netbeans/6.7/build.properties
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>
auxiliary.org-netbeans-modules-projectimport-eclipse-core.key=src=src;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/commons-el.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/el-api-1.0.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/el-impl-1.0.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/jsf-facelets.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/tomahawk-1.1.10-SNAPSHOT.jar;file=/Users/tuomari/workspace/InsomniaIntraWeb/WebContent/WEB-INF/lib/tomahawk-sandbox-1.1.9-SNAPSHOT.jar;jre=JDK 1.6;output=build/classes;web=/WebContent;context=InsomniaIntraWeb;
auxiliary.org-netbeans-modules-projectimport-eclipse-core.project=.
auxiliary.org-netbeans-modules-projectimport-eclipse-core.timestamp=1246846251000
auxiliary.org-netbeans-modules-projectimport-eclipse-core.workspace=..
build.classes.dir=${build.web.dir}/WEB-INF/classes
build.classes.excludes=**/*.java,**/*.form
build.dir=nbbuild
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
build.web.dir=${build.dir}/web
build.web.excludes=${build.classes.excludes}
client.urlPart=
compile.jsps=false
conf.dir=conf
debug.classpath=${build.classes.dir}:${javac.classpath}
debug.test.classpath=\
${run.test.classpath}
display.browser=true
dist.dir=dist
dist.ear.war=${dist.dir}/${war.ear.name}
dist.javadoc.dir=${dist.dir}/javadoc
dist.war=${dist.dir}/${war.name}
excludes=
file.reference.commons-beanutils-1.7.0.jar=WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar
file.reference.commons-el.jar=WebContent/WEB-INF/lib/commons-el.jar
file.reference.commons-fileupload-1.2.1.jar=WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar
file.reference.commons-logging-1.1.1.jar=WebContent/WEB-INF/lib/commons-logging-1.1.1.jar
file.reference.el-api-1.0.jar=WebContent/WEB-INF/lib/el-api-1.0.jar
file.reference.el-impl-1.0.jar=WebContent/WEB-INF/lib/el-impl-1.0.jar
file.reference.InsomniaIntraWeb-src=src
file.reference.jsf-facelets.jar=WebContent/WEB-INF/lib/jsf-facelets.jar
file.reference.tomahawk-1.1.10-SNAPSHOT.jar=WebContent/WEB-INF/lib/tomahawk-1.1.10-SNAPSHOT.jar
file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar=WebContent/WEB-INF/lib/tomahawk-sandbox-1.1.9-SNAPSHOT.jar
includes=**
j2ee.deploy.on.save=true
j2ee.platform=1.5
j2ee.server.type=gfv3ee6
jar.compress=false
java.source.based=true
javac.classpath=\
${file.reference.commons-logging-1.1.1.jar}:\
${file.reference.tomahawk-1.1.10-SNAPSHOT.jar}:\
${file.reference.commons-beanutils-1.7.0.jar}:\
${file.reference.commons-fileupload-1.2.1.jar}:\
${file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar}:\
${file.reference.el-impl-1.0.jar}:\
${file.reference.commons-el.jar}:\
${file.reference.el-api-1.0.jar}:\
${file.reference.jsf-facelets.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true
javac.deprecation=false
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.preview=true
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jspcompilation.classpath=${jspc.classpath}:${javac.classpath}
lib.dir=WebContent/WEB-INF/lib
no.dependencies=false
persistence.xml.dir=${conf.dir}
platform.active=JDK_1.61
resource.dir=setup
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
runmain.jvmargs=
source.encoding=UTF-8
source.root=.
src.dir=${file.reference.InsomniaIntraWeb-src}
test.src.dir=
war.content.additional=
war.ear.name=InsomniaIntraWeb.war
war.name=InsomniaIntraWeb.war
web.docbase.dir=WebContent
webinf.dir=WebContent/WEB-INF
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>InsomniaIntraWeb</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<explicit-platform explicit-source-supported="true"/>
<web-module-libraries>
<library>
<file>${file.reference.commons-logging-1.1.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.tomahawk-1.1.10-SNAPSHOT.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.commons-beanutils-1.7.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.commons-fileupload-1.2.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.tomahawk-sandbox-1.1.9-SNAPSHOT.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.el-impl-1.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.commons-el.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.el-api-1.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.jsf-facelets.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir" name="src"/>
</source-roots>
<test-roots/>
</data>
</configuration>
</project>
package fi.insomnia.intra;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Date;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Decoder;
import fi.insomnia.intra.db.UserImage;
import fi.insomnia.intra.helpers.OverlayImages;
import fi.insomnia.intra.utilbeans.UserImageDaoBeanLocal;
public class DisplayImage extends HttpServlet {
private static final Logger logger = LoggerFactory.getLogger(DisplayImage.class);
/**
*
*/
private static final long serialVersionUID = -5738231939522197714L;
@EJB
private UserImageDaoBeanLocal userbean;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// PrintWriter pw = response.getWriter();
try {
String rawResourcePath = request.getPathInfo();
logger.info("respath2 : {}", rawResourcePath);
String[] paths = rawResourcePath.trim().split("/");
logger.info("paths length: {}", paths.length);
boolean card = false;
if (paths.length >= 3 && paths[2].equals("card")) {
card = true;
} else if (paths.length != 2 || paths[1].trim().isEmpty()) {
return;
}
BigInteger picId = null;
try {
picId = new BigInteger(paths[1].trim());
} catch (Throwable t) {
logger.warn("Could not parse as int: {}", paths[1]);
}
logger.info("PicId2: {}", picId);
if (picId == null) {
return;
}
UserImage pic = userbean.get(picId);
byte[] imgstream = null;
if (card) {
imgstream = OverlayImages.overlay(pic);
} else {
imgstream = new BASE64Decoder().decodeBuffer(new ByteArrayInputStream(pic.getImageData()));
}
File ofile = new File("/mnt/nas/tulostuskuvat/"+ picId +"_"+new Date().getTime() + ".png" );
FileOutputStream ofstream = new FileOutputStream(ofile);
ofstream.write(imgstream);
ofstream.close();
// int len = imgstream.length;
// byte[] rb = new byte[len];
// int index = imgstream.read(rb, 0, len);
// logger.info("index" + index);
response.setContentType("image/png");
response.getOutputStream().write(imgstream, 0, imgstream.length);
response.getOutputStream().flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package fi.insomnia.intra;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Servlet implementation class TagListener
*/
public class TagListener extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TagListener() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
private static final Logger logger = LoggerFactory.getLogger(TagListener.class);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String rawResourcePath = request.getPathInfo();
logger.info("respath2 : {}", rawResourcePath);
String[] paths = rawResourcePath.trim().split("/");
logger.info("paths length: {}", paths.length);
boolean card = false;
if (paths.length != 3) {
return;
}
String name = paths[1];
String tag = paths[2];
logger.info("Got tag, {}, {}", name, tag);
}
}
package fi.insomnia.intra;
import java.io.IOException;
import java.math.BigInteger;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Encoder;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.utilbeans.UserDaoBeanLocal;
import fi.insomnia.intra.utilbeans.UserImageDaoBeanLocal;
/**
* Servlet implementation class UploadServlet
*/
public class UploadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UploadServlet() {
super();
// TODO Auto-generated constructor stub
}
private static final Logger logger = LoggerFactory.getLogger(UploadServlet.class);
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
@EJB
private UserImageDaoBeanLocal imagebean;
@EJB
private UserDaoBeanLocal userbean;
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String rawResourcePath = request.getPathInfo();
logger.info("respath2 : {}", rawResourcePath);
String[] paths = rawResourcePath.trim().split("/");
logger.info("paths length: {}", paths.length);
if (paths.length != 2 || paths[1].trim().isEmpty()) {
return;
}
BigInteger userId = new BigInteger(paths[1].trim());
logger.info("Uploadinfg for user {}", userId);
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
try {
List /* FileItem */items = upload.parseRequest(request);
for (Object ti : items) {
if (ti instanceof DiskFileItem) {
DiskFileItem fi = (DiskFileItem) ti;
if (fi.getName() != null && fi.getName().equals("image.png")) {
logger.info("finding user for userId: {}",userId);
User user = userbean.load(userId);
imagebean.createImage(user, fi.get());
}
}
logger.info("Downloaded object {}", ti.getClass());
}
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package fi.insomnia.intra.helpers;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import javax.imageio.ImageIO;
import sun.misc.BASE64Decoder;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.db.UserImage;
public class OverlayImages {
private static final String path = "/var/insomnia/kortti_";
private static final String suffix = "_2009.jpg";
private static final String vierailija = path + "vierailija" + suffix;
private static final String pro = path + "pro" + suffix;
private static final String pelaaja = path + "pelaaja" + suffix;
private static final String org = path + "organisaattori" + suffix;
private static final String robo = path + "robosota" + suffix;
public static byte[] overlay(UserImage usr) {
// ByteArrayInputStream bi = new
// ByteArrayInputStream(img.getImageData());
User owner = usr.getOwner();
String name = "";
String nick = "";
try {
name = new String(owner.getName().getBytes("ISO-8859-1"), "UTF-8");
nick = new String(owner.getNick().getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String pohja = null;
switch (owner.getType()) {
case 1:
pohja = vierailija;
break;
case 2:
pohja = pro;
break;
case 10:
pohja = org;
break;
case 11:
pohja = org;
break;
default:
pohja = pelaaja;
break;
}
try {
byte[] naamabytes = new BASE64Decoder().decodeBuffer(new ByteArrayInputStream(usr.getImageData()));
ByteArrayInputStream naamastream = new ByteArrayInputStream(naamabytes);
BufferedImage face = ImageIO.read(naamastream);
BufferedImage org = ImageIO.read(new File(pohja));
BufferedImage image3 = new BufferedImage(638, 1011, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image3.createGraphics();
// g.drawImage(org, AffineTransform.getScaleInstance(0.31, 0.31), null);
g.drawImage(org, 0, 0,638,1011,null);
// g.drawImage(face, AffineTransform.getScaleInstance(0.31, 0.31), null);
g.drawImage(face, 310, 340, 280, 425, null);
g.setFont(new Font("Arial Black", Font.BOLD, 70));
g.drawString(nick, 595 - g.getFontMetrics().charsWidth(nick.toCharArray(), 0, nick.length()), 840);
g.setFont(new Font("Arial", Font.BOLD, 35));
g.drawString(name, 595 - g.getFontMetrics().charsWidth(name.toCharArray(), 0, name.length()), 890);
g.drawString(owner.getId().toString(), 60, 948);
g.dispose();
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
ImageIO.write(image3, "png", ostr);
return ostr.toByteArray();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static void main(String[] asd) {
// new OverlayImages().overlay();
}
}
package fi.insomnia.intra.rfid;
import java.util.Calendar;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RandomTestReader extends TagContainer {
private static final Logger logger = LoggerFactory.getLogger(RandomTestReader.class);
private Timer timer;
private Random rng;
public RandomTestReader() {
super("Random Reader for testing");
timer = new Timer();
rng = new Random(Calendar.getInstance().getTimeInMillis());
timer.schedule(new TimerTask() {
@Override
public void run() {
try{
rndUser();
}catch(IllegalStateException e)
{
logger.warn("Shutting down RandomReader because exception",e);
timer.cancel();
}
}
}, 5000L, 5000L);
}
private void rndUser() {
String tag = null;
if (rng.nextInt(3) == 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 16; ++i) {
sb.append(rng.nextInt(9));
}
tag = sb.toString();
} else {
long next = rng.nextInt(200) + 2;
}
this.foundTag(tag);
}
}
package fi.insomnia.intra.rfid;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.ExportException;
import java.rmi.server.UnicastRemoteObject;
import javax.ejb.EJB;
import javax.servlet.http.HttpServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.streamparty.remoterfid.RemoteRfidClient;
import fi.insomnia.intra.utilbeans.UserDaoBeanLocal;
/**
* Servlet implementation class ReaderListenerStarter
*/
public class ReaderListenerStarter extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(ReaderListenerStarter.class);
private Registry registry;
/**
* @see HttpServlet#HttpServlet()
*/
public ReaderListenerStarter() {
super();
}
public void destroy() {
try {
logger.info("Destroying ReaderListener: {}", this);
registry.unbind(RemoteRfidClient.REMOTE_DESCRIPTOR);
} catch (AccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
super.destroy();
}
}
public void init() {
// create the registry and bind the name and object,
Remote remoteStub = null;
try {
remoteStub = UnicastRemoteObject.exportObject(RemoteReaderListener.getInstance(), 0);
// Registry registry =
// LocateRegistry.getRegistry(RemoteRfidClient.RMI_PORT);
try {
registry = LocateRegistry.createRegistry(RemoteRfidClient.RMI_PORT);
logger.info("Started Ovetin RMI server ");
} catch (ExportException e) {
registry = LocateRegistry.getRegistry(RemoteRfidClient.RMI_PORT);
}
registry.bind(RemoteRfidClient.REMOTE_DESCRIPTOR, remoteStub);
} catch (AccessException e) {
logger.warn("Error while starting remote registry", e);
} catch (RemoteException e) {
logger.warn("Error while starting remote registry", e);
} catch (AlreadyBoundException e) {
logger.warn("Error while starting remote registry", e);
if (registry != null && remoteStub != null) {
try {
registry.rebind(RemoteRfidClient.REMOTE_DESCRIPTOR, remoteStub);
} catch (AccessException e1) {
logger.warn("Error while rebinding remote registry", e);
} catch (RemoteException e1) {
logger.warn("Error while rebinding remote registry", e);
}
}
}
}
}
package fi.insomnia.intra.rfid;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.streamparty.remoterfid.RemoteRfidClient;
public class RemoteReaderListener implements RemoteRfidClient {
/**
*
*/
private static final long serialVersionUID = 1785119007184319317L;
private static RemoteReaderListener self = null;
private static final Logger logger = LoggerFactory.getLogger(RemoteReaderListener.class);
private Map<String, TagContainer> tags;
// private RemoteRfidClient mylocal;
private RemoteReaderListener() {
super();
tags = Collections.synchronizedMap(new HashMap<String, TagContainer>());
// RandomTestReader tr = new RandomTestReader();
// tags.put(tr.getName(), tr );
}
public static RemoteReaderListener getInstance() {
if (self == null) {
getNewInstance();
}
return self;
}
private synchronized static void getNewInstance() {
if (self == null) {
self = new RemoteReaderListener();
logger.info("Created new RemoteReaderListener instance");
}
}
@Override
public void foundTag(String name, String tag) throws RemoteException {
TagContainer tagCont = getTagContainer(name);
tagCont.foundTag(tag);
}
public TagContainer getTagContainer(String name) {
TagContainer tagCont = tags.get(name);
if (tagCont == null) {
synchronized (tags) {
tagCont = tags.get(name);
if (tagCont == null) {
logger.info("Created new Tag container for name {}", name);
tagCont = new TagContainer(name);
tags.put(name, tagCont);
}
}
}
return tagCont;
}
public Collection<TagContainer> getReaders()
{
return tags.values();
}
}
package fi.insomnia.intra.rfid;
import java.util.Calendar;
import java.util.Vector;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.db.User;
public class TagContainer {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TagContainer.class);
private String name;
private Calendar lastSeen;
private Vector<TagInstance> seen;
private static final int historySize = 10;
private static final long WAIT_FOR_TAG_TIMEOUT = 4000;
public TagContainer(String name) {
this.name = name;
lastSeen = Calendar.getInstance();
seen = new Vector<TagInstance>();
}
public String getName() {
return name;
}
public Calendar getLastSeen() {
return lastSeen;
}
public void foundTag(String tag) {
if (tag == null || tag.isEmpty()) {
return;
}
synchronized (seen) {
TagInstance lastSeenTag;
if (seen.size() > 0) {
lastSeenTag = seen.lastElement();
if (lastSeenTag != null && tag.equals(lastSeenTag.getTag())) {
seen.lastElement().updateSeen();
lastSeen = Calendar.getInstance();
return;
}
}
TagInstance tagInst = new TagInstance(tag);
seen.add(tagInst);
if (seen.size() > historySize) {
seen.remove(seen.firstElement());
}
}
lastSeen = Calendar.getInstance();
}
public Vector<TagInstance> getSeen() {
return seen;
}
public TagInstance waitForNextTag() {
Calendar started = Calendar.getInstance();
Calendar now = Calendar.getInstance();
while (now.getTimeInMillis() - started.getTimeInMillis() < WAIT_FOR_TAG_TIMEOUT) {
if (lastSeen.after(started)) {
TagInstance ret = seen.lastElement();
logger.debug("Next tag found! {}", ret.getTag());
return ret;
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.info("Next tag waiting interrupted", e);
}
now = Calendar.getInstance();
}
return null;
}
public void assocTagToUser(String tag, User user) {
for (int i = seen.size() - 1; i >= 0; --i) {
TagInstance tagInst = seen.get(i);
if (tagInst.getTag().equals(tag)) {
tagInst.setUser(user);
return;
}
}
}
}
package fi.insomnia.intra.rfid;
import java.util.Calendar;
import javax.ejb.EJB;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.utilbeans.UserDaoBeanLocal;
public class TagInstance {
private User user;
private String tag;
private Calendar seen;
private StringBuilder eventBuffer;
private InitialContext cont;
private static final Logger logger = LoggerFactory.getLogger(TagInstance.class);
public TagInstance(String foundTag) {
super();
try {
cont = new InitialContext();
} catch (NamingException e) {
logger.warn("Error creating initial context");
}
eventBuffer = new StringBuilder();
tag = foundTag;
UserDaoBeanLocal bean = getBean();
if(bean != null)
{
user = bean.findByTag(tag);
}
seen = Calendar.getInstance();
}
private UserDaoBeanLocal getBean() {
Object ret = null;
try {
ret = cont.lookup("java:global/Desker/DeskerBeans/UserDaoBean!fi.insomnia.intra.utilbeans.UserDaoBeanLocal");
} catch (NamingException e) {
logger.warn("Error looking up UserDaoBean");
}
logger.info("looked up userbean {}", ret);
return (UserDaoBeanLocal) ret;
}
public void updateSeen() {
seen = Calendar.getInstance();
}
public boolean isAssociated() {
return (user != null);
}
public User getUser() {
return user;
}
public String getTag() {
return tag;
}
public Calendar getSeen() {
return seen;
}
public String getEvents() {
return eventBuffer.toString();
}
public void setUser(User user2) {
user = user2;
}
}
package fi.insomnia.intra.web;
import java.util.List;
import javax.ejb.EJB;
import fi.insomnia.intra.dao.IPagingStatus;
import fi.insomnia.intra.db.BaseEntity;
import fi.insomnia.intra.utilbeans.GenericItemDAOBean;
import fi.insomnia.intra.utilbeans.UserPropertiesBeanLocal;
public abstract class GenericEntityController<T extends BaseEntity> {
@EJB
private UserPropertiesBeanLocal propertiesbean;
private List<T> items;
protected abstract GenericItemDAOBean<T> getItemBean();
public GenericEntityController() {
}
public List<T> getItems() {
if (items == null) {
items = getItemBean().getItems(getPagingStatus());
}
return items;
}
protected abstract IPagingStatus getPagingStatus();
public UserPropertiesBeanLocal getPropertiesbean() {
return propertiesbean;
}
}
package fi.insomnia.intra.web;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PageController {
private static final Logger logger = LoggerFactory.getLogger(PageController.class);
public String logout()
{
Object request = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if(request == null || request instanceof HttpServletRequest)
{
logger.debug("Invalidating session context for user {}",FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName());
HttpServletRequest httpReq = (HttpServletRequest)request;
httpReq.getSession().invalidate();
return "success";
}
return "error";
}
}
package fi.insomnia.intra.web;
import java.math.BigDecimal;
import org.apache.catalina.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.dao.IPagingStatus;
public class PagingStatus implements IPagingStatus {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(PagingStatus.class);
private int pagesize;
private int page;
private long totalHits;
public PagingStatus(int defaultSize) {
pagesize = defaultSize;
page = 0;
totalHits = 0;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getPagesize() {
return pagesize;
}
public void setPage(int page) {
this.page = page;
}
public int getPage() {
return page;
}
public void setTotalHits(long l) {
this.totalHits = l;
}
public long getTotalHits() {
return totalHits;
}
public long getTotalPages() {
BigDecimal pages = new BigDecimal(totalHits).divide(new BigDecimal(pagesize), BigDecimal.ROUND_CEILING);
return pages.setScale(0, BigDecimal.ROUND_CEILING).longValue();
}
public void next() {
if (page < getTotalPages()) {
++page;
} else {
page = (int) (getTotalPages() - 1);
}
logger.info("page is now {}", page);
}
public void prev() {
if (page > 0) {
--page;
} else {
page = 0;
}
}
}
package fi.insomnia.intra.web;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SecurityController {
private Set<String> revokeList = Collections.synchronizedSet(new HashSet<String>());
private static final Logger logger = LoggerFactory.getLogger(SecurityController.class);
protected ExternalContext getContext()
{
return FacesContext.getCurrentInstance().getExternalContext();
}
public String getAuthType()
{
return getContext().getAuthType();
}
public String getUsername()
{
return getContext().getRemoteUser();
}
public boolean isUserInRole(String role)
{
if(revokeList.contains(role))
{
logger.debug("RevokeList contained role {}, returning false..");
return false;
}
return getContext().isUserInRole(role);
}
public void resetRevokeList()
{
revokeList.clear();
}
public void addRevokeList(String role)
{
revokeList.add(role);
}
public void removeRevokeList(String role)
{
revokeList.remove(role);
}
}
package fi.insomnia.intra.web;
import java.util.Random;
import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.dao.IPagingStatus;
/**
* Session Bean implementation class UserBean
*/
@Stateless
@DeclareRoles(value={"admin","user","manager"})
public class UserBean {
@Resource
private SessionContext ctx;
private static final Logger logger = LoggerFactory.getLogger(UserBean.class);
/**
* Default constructor.
*/
public UserBean() {
// TODO Auto-generated constructor stub
}
public String getUsername()
{
return "User "+ctx.getCallerPrincipal().getName()+"in role admin: " + ctx.isCallerInRole("admin");
}
public String getRemoteUser() {
return ctx.getCallerPrincipal().getName();
}
public boolean ifGrantedRole(String role) {
return ctx.isCallerInRole(role);
}
private static final int GENERATED_PASSWORD_LENGTH = 10;
private static final String VALID_PASSWORD_CHARS="";
private static final String SPECIALCHARS = "!%&|/;:?.,+-_()[]{}#@*";
private static final String LOWERCASECHARS = "abcdefghjklmnpqrstuvwxyz";
private static final String UPPERCASECHARS = "ABCDEFGHJKLMNPQRSTUVWXYZ";
private static final String NUMERALCHARS = "0123456789";
public String createUserWithGeneratedPassword(String username)
{
return "";
}
public static String getRandomString(int count)
{
int visibleChars = VALID_PASSWORD_CHARS.length();
logger.debug("Visble chars: {}",visibleChars);
Random rng = new Random();
StringBuilder strBuild = new StringBuilder();
while(strBuild.length() < count)
{
String selectedStringroup;
switch(rng.nextInt(7))
{
case 0:
case 5:
selectedStringroup = NUMERALCHARS;
break;
case 1:
case 4:
selectedStringroup = UPPERCASECHARS;
break;
case 2:
case 3:
selectedStringroup = LOWERCASECHARS;
break;
case 6:
selectedStringroup = SPECIALCHARS;
break;
default:
selectedStringroup = "";
}
strBuild.append(selectedStringroup.charAt( rng.nextInt(selectedStringroup.length() )));
}
logger.debug("Random string: " + strBuild.toString());
return strBuild.toString();
}
}
package fi.insomnia.intra.web;
import java.math.BigInteger;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIParameter;
import javax.faces.event.ActionEvent;
import javax.faces.model.ListDataModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.dao.IPagingStatus;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.utilbeans.UserDaoBeanLocal;
import fi.insomnia.intra.utilbeans.UserPropertiesBeanLocal;
@ManagedBean(name="userTest")
@SessionScoped
public class UserController {
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
@EJB
private UserDaoBeanLocal userDao;
@EJB
private UserBean userBean;
@EJB
private UserPropertiesBeanLocal propertiesbean;
private IPagingStatus paging;
public UserController()
{
paging = new PagingStatus(propertiesbean.getPageSize());
}
private User user = new User();
public String getTestUserbean()
{
userBean.createUserWithGeneratedPassword("Tuomarin_testi");
return "Success";
}
public ListDataModel<User> getUsers()
{
List<User> list = userDao.getAll();
for(User u: list)
{
logger.info("Got User entity: " + u.getId());
}
return new ListDataModel<User>(list);
}
public String getGenerateEntry()
{
logger.info("Generating new user!");
int size = userDao.getAll().size();
logger.debug("Found {} users ",size);
User initUser = new User();
initUser.setName("generatedUser"+size);
initUser.setEmail("tuomari@iki.fi" + size);
logger.debug("Persisting user");
userDao.save(initUser);
return "generated!";
}
public String edit()
{
return "edit";
}
public String save()
{
logger.debug("saving user object {}", user);
userDao.save(user);
return "saved";
}
public void setUser(User user) {
this.user = user;
}
public User getUser() {
return user;
}
public void userIdListener(ActionEvent event)
{
UIParameter component = (UIParameter) event.getComponent().findComponent("userId");
BigInteger id = (BigInteger) component.getValue();
logger.debug("UserId listener with userId: {}",id );
user = userDao.get(id);
}
public void initCreate()
{
logger.debug("Initializing create and creating new User object");
user = new User();
}
public String getBeanMessage()
{
return "beanmessage test 1";
}
public void setPaging(IPagingStatus paging) {
this.paging = paging;
}
public IPagingStatus getPaging() {
return paging;
}
}
package fi.insomnia.intra.web;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.ListDataModel;
import org.slf4j.LoggerFactory;
import fi.insomnia.intra.db.User;
import fi.insomnia.intra.utilbeans.UserDaoBeanLocal;
@ManagedBean(name = "user")
@SessionScoped
public class UserMB {
@EJB
private UserDaoBeanLocal userBean;
private String search;
private PagingStatus status;
private org.slf4j.Logger logger = LoggerFactory.getLogger(UserMB.class);
private ListDataModel<User> items;
private User item;
public ListDataModel<User> getItems() {
if (items == null) {
if (status == null) {
status = new PagingStatus(20);
}
List<User> list = null;
if (search == null || search.isEmpty()) {
list = userBean.getItems(status);
} else {
list = userBean.getSearchItems(search, status);
}
setItems(new ListDataModel<User>(list));
// results = userBean.searchUser(search);
}
return items;
}
public String getDetail() {
setItem(items.getRowData());
return "detail";
}
public String nextpage() {
items = null;
status.next();
return "userlist";
}
public String prevpage() {
items = null;
status.prev();
return "userlist";
}
public String getBeanMessage() {
userBean.indexDatabase();
return "FOobar123123";
}
public void setStatus(PagingStatus status) {
this.status = status;
}
public PagingStatus getStatus() {
if (status == null) {
getItems();
}
return status;
}
public void setItems(ListDataModel<User> items) {
this.items = items;
}
public void setItem(User item) {
this.item = item;
}
public User getItem() {
return item;
}
public void setSearch(String search) {
if (search == null) {
return;
}
search = search.trim();
if (this.search == null || !this.search.equals(search)) {
items = null;
status = null;
}
this.search = search;
}
public String getSearch() {
return search;
}
public String reloadUser() {
item = userBean.get(item.getId());
return "detail";
}
public String back() {
item = null;
status = null;
items = null;
search = null;
return "userlist";
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!