-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created the first classes to add a book with very simple properties t…
…o start exploring appengine, need to start doing TDD
- Loading branch information
0 parents
commit 2c8b045
Showing
96 changed files
with
1,740 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.classpath | ||
.gwt/** | ||
.project | ||
.settings/** | ||
war/bookshelf/** | ||
war/WEB_INF/classes/** | ||
war/WEB-INF/appengine-generated/** | ||
war/WEB-INF/deploy/** |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig"> | ||
|
||
<persistence-manager-factory name="transactions-optional"> | ||
<property name="javax.jdo.PersistenceManagerFactoryClass" | ||
value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/> | ||
<property name="javax.jdo.option.ConnectionURL" value="appengine"/> | ||
<property name="javax.jdo.option.NontransactionalRead" value="true"/> | ||
<property name="javax.jdo.option.NontransactionalWrite" value="true"/> | ||
<property name="javax.jdo.option.RetainValues" value="true"/> | ||
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/> | ||
</persistence-manager-factory> | ||
</jdoconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# A default log4j configuration for log4j users. | ||
# | ||
# To use this configuration, deploy it into your application's WEB-INF/classes | ||
# directory. You are also encouraged to edit it as you like. | ||
|
||
|
||
log4j.rootLogger=DEBUG,A1 | ||
# Configure the console as our one appender | ||
log4j.appender.A1=org.apache.log4j.ConsoleAppender | ||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n | ||
|
||
# tighten logging on the DataNucleus Categories | ||
log4j.category.DataNucleus.JDO=WARN, A1 | ||
log4j.category.DataNucleus.Persistence=WARN, A1 | ||
log4j.category.DataNucleus.Cache=WARN, A1 | ||
log4j.category.DataNucleus.MetaData=WARN, A1 | ||
log4j.category.DataNucleus.General=WARN, A1 | ||
log4j.category.DataNucleus.Utility=WARN, A1 | ||
log4j.category.DataNucleus.Transaction=WARN, A1 | ||
log4j.category.DataNucleus.Datastore=WARN, A1 | ||
log4j.category.DataNucleus.ClassLoading=WARN, A1 | ||
log4j.category.DataNucleus.Plugin=WARN, A1 | ||
log4j.category.DataNucleus.ValueGeneration=WARN, A1 | ||
log4j.category.DataNucleus.Enhancer=WARN, A1 | ||
log4j.category.DataNucleus.SchemaTool=WARN, A1 | ||
|
||
log4j.logger.org.drea.server=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module | ||
rename-to='bookshelf'> | ||
<!-- Inherit the core Web Toolkit stuff. --> | ||
<inherits | ||
name='com.google.gwt.user.User' /> | ||
|
||
<!-- Inherit the default GWT style sheet. You can change --> | ||
<!-- the theme of your GWT application by uncommenting --> | ||
<!-- any one of the following lines. --> | ||
<inherits | ||
name='com.google.gwt.user.theme.clean.Clean' /> | ||
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> --> | ||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> | ||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> | ||
|
||
<!-- Other module inherits --> | ||
|
||
<inherits name="com.google.gwt.activity.Activity"></inherits> | ||
<inherits name="com.google.gwt.place.Place"></inherits> | ||
|
||
<!-- Specify the app entry point class. --> | ||
<entry-point | ||
class='org.drea.client.Bookshelf' /> | ||
|
||
<!-- Use ClientFactoryImpl by default --> | ||
<replace-with | ||
class="org.drea.client.ClientFactoryImpl"> | ||
<when-type-is | ||
class="org.drea.client.ClientFactory" /> | ||
</replace-with> | ||
|
||
<!-- Specify the paths for translatable code --> | ||
<source | ||
path='client' /> | ||
<source | ||
path='shared' /> | ||
|
||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.drea.client; | ||
|
||
import org.drea.client.place.AddBookPlace; | ||
import org.drea.client.place.mapper.AppActivityMapper; | ||
import org.drea.client.place.mapper.AppPlaceHistoryMapper; | ||
|
||
import com.google.gwt.activity.shared.ActivityManager; | ||
import com.google.gwt.activity.shared.ActivityMapper; | ||
import com.google.gwt.core.client.EntryPoint; | ||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.event.shared.EventBus; | ||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceController; | ||
import com.google.gwt.place.shared.PlaceHistoryHandler; | ||
import com.google.gwt.user.client.ui.RootPanel; | ||
import com.google.gwt.user.client.ui.SimplePanel; | ||
|
||
/** | ||
* Entry point classes define <code>onModuleLoad()</code>. | ||
*/ | ||
public class Bookshelf implements EntryPoint { | ||
|
||
private final ClientFactory clientFactory = GWT.create(ClientFactory.class); | ||
private SimplePanel appWidget = new SimplePanel(); | ||
private Place defaultPlace = new AddBookPlace(); | ||
|
||
/** | ||
* The message displayed to the user when the server cannot be reached or | ||
* returns an error. | ||
*/ | ||
private static final String SERVER_ERROR = "An error occurred while " | ||
+ "attempting to contact the server. Please check your network " | ||
+ "connection and try again."; | ||
|
||
|
||
/** | ||
* This is the entry point method. | ||
*/ | ||
public void onModuleLoad() { | ||
|
||
EventBus eventBus = clientFactory.getEventBus(); | ||
|
||
|
||
ActivityMapper activityMapper = new AppActivityMapper(clientFactory); | ||
ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); | ||
|
||
activityManager.setDisplay(appWidget); | ||
|
||
AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class); | ||
|
||
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); | ||
PlaceController placeController = clientFactory.getPlaceController(); | ||
|
||
historyHandler.register(placeController, eventBus, defaultPlace); | ||
|
||
RootPanel.get().add(appWidget); | ||
|
||
historyHandler.handleCurrentHistory(); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.drea.client; | ||
|
||
import org.drea.client.service.BooksServiceAsync; | ||
import org.drea.client.view.AddBookView; | ||
import org.drea.client.view.BookDetailsView; | ||
import org.drea.client.view.SearchBooksView; | ||
|
||
import com.google.gwt.event.shared.EventBus; | ||
import com.google.gwt.place.shared.PlaceController; | ||
|
||
public interface ClientFactory { | ||
EventBus getEventBus(); | ||
BooksServiceAsync getBooksService(); | ||
PlaceController getPlaceController(); | ||
|
||
BookDetailsView getBookDetailsView(); | ||
AddBookView getAddBookView(); | ||
SearchBooksView getSearchView(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.drea.client; | ||
|
||
import org.drea.client.service.BooksService; | ||
import org.drea.client.service.BooksServiceAsync; | ||
import org.drea.client.view.AddBookView; | ||
import org.drea.client.view.AddBookViewImpl; | ||
import org.drea.client.view.BookDetailsView; | ||
import org.drea.client.view.BookDetailsViewImpl; | ||
import org.drea.client.view.SearchBooksView; | ||
import org.drea.client.view.SearchBooksViewImpl; | ||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.event.shared.EventBus; | ||
import com.google.gwt.event.shared.SimpleEventBus; | ||
import com.google.gwt.place.shared.PlaceController; | ||
|
||
public class ClientFactoryImpl implements ClientFactory { | ||
|
||
private static BookDetailsView bookDetailsView = new BookDetailsViewImpl(); | ||
private static AddBookView addBookView = new AddBookViewImpl(); | ||
private static SearchBooksView searchBooksView = new SearchBooksViewImpl(); | ||
|
||
private static final EventBus eventBus = new SimpleEventBus(); | ||
private static final BooksServiceAsync booksService = (BooksServiceAsync) GWT.create(BooksService.class); | ||
private static final PlaceController placeController = new PlaceController(eventBus); | ||
|
||
@Override | ||
public BookDetailsView getBookDetailsView() { | ||
return bookDetailsView; | ||
} | ||
|
||
@Override | ||
public EventBus getEventBus() { | ||
return eventBus ; | ||
} | ||
|
||
@Override | ||
public BooksServiceAsync getBooksService() { | ||
return booksService; | ||
} | ||
|
||
@Override | ||
public AddBookView getAddBookView() { | ||
return addBookView; | ||
} | ||
|
||
@Override | ||
public PlaceController getPlaceController() { | ||
return placeController; | ||
} | ||
|
||
@Override | ||
public SearchBooksView getSearchView() { | ||
return searchBooksView; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.drea.client.place; | ||
|
||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceTokenizer; | ||
|
||
public class AddBookPlace extends Place { | ||
|
||
public AddBookPlace() { | ||
super(); | ||
} | ||
|
||
public static class Tokenizer implements PlaceTokenizer<AddBookPlace>{ | ||
|
||
@Override | ||
public AddBookPlace getPlace(String token) { | ||
return new AddBookPlace(); | ||
} | ||
|
||
@Override | ||
public String getToken(AddBookPlace place) { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.drea.client.place; | ||
|
||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceTokenizer; | ||
|
||
public class BookDetailsPlace extends Place { | ||
|
||
private String boolKey; | ||
|
||
public BookDetailsPlace(String token) { | ||
super(); | ||
this.boolKey = token; | ||
} | ||
|
||
public String getBoolKey() { | ||
return boolKey; | ||
} | ||
|
||
public static class Tokenizer implements PlaceTokenizer<BookDetailsPlace>{ | ||
|
||
@Override | ||
public BookDetailsPlace getPlace(String token) { | ||
return new BookDetailsPlace(token); | ||
} | ||
|
||
@Override | ||
public String getToken(BookDetailsPlace place) { | ||
return place.getBoolKey(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.drea.client.place; | ||
|
||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceTokenizer; | ||
|
||
public class EditBookPlace extends Place { | ||
|
||
private String bookKey; | ||
|
||
public EditBookPlace(String bookKey){ | ||
super(); | ||
this.bookKey = bookKey; | ||
} | ||
|
||
public String getBookKey() { | ||
return bookKey; | ||
} | ||
|
||
public class Tokenizer implements PlaceTokenizer<EditBookPlace> { | ||
|
||
@Override | ||
public EditBookPlace getPlace(String token) { | ||
return new EditBookPlace(token); | ||
} | ||
|
||
@Override | ||
public String getToken(EditBookPlace place) { | ||
return place.getBookKey(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.drea.client.place; | ||
|
||
import com.google.gwt.place.shared.Place; | ||
import com.google.gwt.place.shared.PlaceTokenizer; | ||
|
||
public class SearchPlace extends Place { | ||
|
||
public class Tokenizer implements PlaceTokenizer<SearchPlace>{ | ||
|
||
@Override | ||
public SearchPlace getPlace(String token) { | ||
return new SearchPlace(); | ||
} | ||
|
||
@Override | ||
public String getToken(SearchPlace place) { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.drea.client.place.mapper; | ||
|
||
import org.drea.client.ClientFactory; | ||
import org.drea.client.place.AddBookPlace; | ||
import org.drea.client.place.BookDetailsPlace; | ||
import org.drea.client.place.EditBookPlace; | ||
import org.drea.client.place.SearchPlace; | ||
import org.drea.client.presenter.AddBookPresenter; | ||
import org.drea.client.presenter.BookDetailsPresenter; | ||
import org.drea.client.presenter.SearchBookPresenter; | ||
|
||
import com.google.gwt.activity.shared.Activity; | ||
import com.google.gwt.activity.shared.ActivityMapper; | ||
import com.google.gwt.place.shared.Place; | ||
|
||
public class AppActivityMapper implements ActivityMapper { | ||
|
||
ClientFactory clientFactory; | ||
|
||
public AppActivityMapper(ClientFactory clientFactory) { | ||
super(); | ||
this.clientFactory = clientFactory; | ||
} | ||
|
||
@Override | ||
public Activity getActivity(Place place) { | ||
if(place instanceof BookDetailsPlace){ | ||
return new BookDetailsPresenter(clientFactory, (BookDetailsPlace)place); | ||
}else if (place instanceof AddBookPlace){ | ||
return new AddBookPresenter(clientFactory); | ||
}else if(place instanceof EditBookPlace){ | ||
return new AddBookPresenter(clientFactory,(EditBookPlace)place); | ||
}else if (place instanceof SearchPlace) { | ||
return new SearchBookPresenter(clientFactory); | ||
} | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.