You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ha...@apache.org on 2012/01/18 21:49:47 UTC

svn commit: r1233059 - in /labs/magnet/flux: ./ src/main/java/org/apache/labs/magnet/flux/ src/main/java/org/apache/labs/magnet/flux/model/

Author: hadrian
Date: Wed Jan 18 20:49:46 2012
New Revision: 1233059

URL: http://svn.apache.org/viewvc?rev=1233059&view=rev
Log:
Add model to webapp

Added:
    labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/
    labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/DefaultFluxService.java
    labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxModel.java
    labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxService.java
Modified:
    labs/magnet/flux/pom.xml
    labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/FluxApplication.java

Modified: labs/magnet/flux/pom.xml
URL: http://svn.apache.org/viewvc/labs/magnet/flux/pom.xml?rev=1233059&r1=1233058&r2=1233059&view=diff
==============================================================================
--- labs/magnet/flux/pom.xml (original)
+++ labs/magnet/flux/pom.xml Wed Jan 18 20:49:46 2012
@@ -35,6 +35,12 @@
   <name>Magnet :: Application :: Flux</name>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.labs.magnet</groupId>
+      <artifactId>core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
     <!--  Apache Wicket -->
     <dependency>
       <groupId>org.apache.wicket</groupId>

Modified: labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/FluxApplication.java
URL: http://svn.apache.org/viewvc/labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/FluxApplication.java?rev=1233059&r1=1233058&r2=1233059&view=diff
==============================================================================
--- labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/FluxApplication.java (original)
+++ labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/FluxApplication.java Wed Jan 18 20:49:46 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.labs.magnet.flux;
 
+import org.apache.labs.magnet.flux.model.DefaultFluxService;
+import org.apache.labs.magnet.flux.model.FluxService;
 import org.apache.labs.magnet.flux.session.FluxSession;
 import org.apache.labs.magnet.flux.session.SignIn;
 
@@ -26,6 +28,19 @@ import org.apache.wicket.markup.html.Web
 
 public class FluxApplication extends AuthenticatedWebApplication {
 
+	private static FluxService service;
+
+	@Override
+	public void init() {
+		super.init();
+		service = new DefaultFluxService();
+	}
+
+	@Override
+	public Class<? extends Page> getHomePage() {
+		return Index.class;
+	}
+	
 	@Override
 	protected Class<? extends WebPage> getSignInPageClass() {
 		return SignIn.class;
@@ -36,8 +51,7 @@ public class FluxApplication extends Aut
 		return FluxSession.class;
 	}
 
-	@Override
-	public Class<? extends Page> getHomePage() {
-		return Index.class;
+	public static FluxService getIssuesService() {
+		return service;
 	}
 }
\ No newline at end of file

Added: labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/DefaultFluxService.java
URL: http://svn.apache.org/viewvc/labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/DefaultFluxService.java?rev=1233059&view=auto
==============================================================================
--- labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/DefaultFluxService.java (added)
+++ labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/DefaultFluxService.java Wed Jan 18 20:49:46 2012
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.labs.magnet.flux.model;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.labs.magnet.bbs.Bulletin;
+
+public class DefaultFluxService implements FluxService {
+
+	private File issuesDirectory;
+
+    private static final FilenameFilter FILTER = new FilenameFilter() {
+        @Override
+        public boolean accept(File dir, String name) {
+            name = name.toLowerCase();
+            return name.endsWith(".xml");
+        }
+    };
+
+	public List<Bulletin> getIssues() {
+		return list(issuesDirectory.listFiles(FILTER));
+	}
+	
+	private List<Bulletin> list(File[] files) {
+		List<Bulletin> list = new ArrayList<Bulletin>();
+		list.add(new Bulletin("CAMEL-1234"));
+		return list;
+	}
+}
\ No newline at end of file

Added: labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxModel.java
URL: http://svn.apache.org/viewvc/labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxModel.java?rev=1233059&view=auto
==============================================================================
--- labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxModel.java (added)
+++ labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxModel.java Wed Jan 18 20:49:46 2012
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.labs.magnet.flux.model;
+
+import java.util.List;
+
+import org.apache.labs.magnet.bbs.Bulletin;
+import org.apache.labs.magnet.flux.FluxApplication;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class FluxModel extends LoadableDetachableModel<List<Bulletin>> {
+	private static final long serialVersionUID = 1L;
+
+    public FluxService getService() {
+    	return FluxApplication.getIssuesService();
+    }
+
+    @Override
+	protected List<Bulletin> load() {
+    	return getService().getIssues();
+	}
+}
\ No newline at end of file

Added: labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxService.java
URL: http://svn.apache.org/viewvc/labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxService.java?rev=1233059&view=auto
==============================================================================
--- labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxService.java (added)
+++ labs/magnet/flux/src/main/java/org/apache/labs/magnet/flux/model/FluxService.java Wed Jan 18 20:49:46 2012
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.labs.magnet.flux.model;
+
+import java.util.List;
+
+import org.apache.labs.magnet.bbs.Bulletin;
+
+public interface FluxService {
+
+	List<Bulletin> getIssues();
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org