Andy Moncsek avatar Andy Moncsek committed c32db6d

update to b82

Comments (0)

Files changed (13)

JacpFXWebsocketChatClient/src/main/java/org/jacp/twitter/decoders/MessageDecoder.java

 
 import javax.websocket.DecodeException;
 import javax.websocket.Decoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 15:32
  * To change this template use File | Settings | File Templates.
  */
-public class MessageDecoder extends Decoder.Adapter implements Decoder.Binary<Message> {
+public class MessageDecoder implements Decoder.Binary<Message> {
     @Override
     public Message decode(ByteBuffer byteBuffer) throws DecodeException {
         return (Message) SerializationUtils.deserialize(byteBuffer.array());  //To change body of implemented methods use File | Settings | File Templates.
         if (message == null) return false;
         return message instanceof Message;
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }
 
 

JacpFXWebsocketChatClient/src/main/java/org/jacp/twitter/encoders/ChatMessageEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 10:14
  * To change this template use File | Settings | File Templates.
  */
-public class ChatMessageEncoder extends Encoder.Adapter implements Encoder.Binary<ChatMessage> {
+public class ChatMessageEncoder implements Encoder.Binary<ChatMessage> {
     @Override
     public ByteBuffer encode(ChatMessage message) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(message));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

JacpFXWebsocketChatClient/src/main/java/org/jacp/twitter/encoders/ClientLoginEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 09:50
  * To change this template use File | Settings | File Templates.
  */
-public class ClientLoginEncoder extends Encoder.Adapter implements Encoder.Binary<LoginMessage> {
+public class ClientLoginEncoder  implements Encoder.Binary<LoginMessage> {
     @Override
     public ByteBuffer encode(LoginMessage loginMessage) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(loginMessage));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

JavaClient/src/main/java/org/jacp/twitter/ChatMessageDecoder.java

 
 import javax.websocket.DecodeException;
 import javax.websocket.Decoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 15:32
  * To change this template use File | Settings | File Templates.
  */
-public class ChatMessageDecoder extends Decoder.Adapter implements Decoder.Binary<ChatMessage> {
+public class ChatMessageDecoder  implements Decoder.Binary<ChatMessage> {
     @Override
     public ChatMessage decode(ByteBuffer byteBuffer) throws DecodeException {
         return (ChatMessage) SerializationUtils.deserialize(byteBuffer.array());  //To change body of implemented methods use File | Settings | File Templates.
         if (message == null) return false;
         return message.getType().equals(MessageType.MESSAGE);
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }
 
 

JavaClient/src/main/java/org/jacp/twitter/ChatMessageEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 10:14
  * To change this template use File | Settings | File Templates.
  */
-public class ChatMessageEncoder extends Encoder.Adapter implements Encoder.Binary<ChatMessage> {
+public class ChatMessageEncoder implements Encoder.Binary<ChatMessage> {
     @Override
     public ByteBuffer encode(ChatMessage message) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(message));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

JavaClient/src/main/java/org/jacp/twitter/ClientAddUserDecoder.java

 
 import javax.websocket.DecodeException;
 import javax.websocket.Decoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 22:11
  * To change this template use File | Settings | File Templates.
  */
-public class ClientAddUserDecoder extends Decoder.Adapter implements Decoder.Binary<UserAddMessage> {
+public class ClientAddUserDecoder implements Decoder.Binary<UserAddMessage> {
     @Override
     public UserAddMessage decode(ByteBuffer byteBuffer) throws DecodeException {
         return (UserAddMessage) SerializationUtils.deserialize(byteBuffer.array());  //To change body of implemented methods use File | Settings | File Templates.
         if (message == null) return false;
         return message.getType().equals(MessageType.ADD_USER);
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }
 
 

JavaClient/src/main/java/org/jacp/twitter/ClientLoginEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 09:50
  * To change this template use File | Settings | File Templates.
  */
-public class ClientLoginEncoder  extends Encoder.Adapter implements Encoder.Binary<LoginMessage> {
+public class ClientLoginEncoder implements Encoder.Binary<LoginMessage> {
     @Override
     public ByteBuffer encode(LoginMessage loginMessage) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(loginMessage));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

WebClient-NOSQL/src/main/java/org/jacp/beans/TwitterAccessBean.java

     @EJB(mappedName = "TwitterRepository")
     private TwitterRepositoryRemote repo;
 
-    List<TweetQuery> getAllAvailableTweetQueries(){
+    public List<TweetQuery> getAllAvailableTweetQueries(){
         return repo.getAllAvailableTweetQueries();
     }
 
-    List<TwitterResult> getTwitterResultsByQuery(TweetQuery tQuery){
+    public List<TwitterResult> getTwitterResultsByQuery(TweetQuery tQuery){
         return repo.getTwitterResultsByQuery(tQuery);
     }
 
-    List<TwitterResult> getAllTwitterResults(){
+    public List<TwitterResult> getAllTwitterResults(){
         return repo.getAllTwitterResults();
     }
 }

WebClient-NOSQL/src/main/java/org/jacp/endpoints/TwitterEndpoint.java

+/*
+ * Copyright (c) 2013, Andy Moncsek, inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ *    following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ *    the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ *    Neither the name of Andy Moncsek, inc. nor the names of its contributors may be used to endorse or
+ *    promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.jacp.endpoints;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: Andy Moncsek
+ * Date: 20.03.13
+ * Time: 21:26
+ * To change this template use File | Settings | File Templates.
+ */
+
+import org.jacp.beans.TwitterAccessBean;
+import org.jacp.jee.nosql.entity.TweetQuery;
+
+import javax.inject.Inject;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+import java.util.List;
+import java.util.logging.Logger;
+
+@ServerEndpoint(value = "/twitterEndpoint")
+public class TwitterEndpoint {
+    final static Logger logger = Logger.getLogger(TwitterEndpoint.class.getName());
+    @Inject
+    private TwitterAccessBean repo;
+
+    @OnOpen
+    public void init(Session s) {
+        logger.info("############Someone connected..." + s.getId() + "  socket: " + repo);
+        List<TweetQuery> result = repo.getAllAvailableTweetQueries();
+        for(TweetQuery q: result) {
+            logger.info("Tweet: "+q.getQuery());
+        }
+    }
+}

WebClient-Websocket/src/main/java/org/jacp/beans/websocket/chat/decoder/MessageDecoder.java

 
 import javax.websocket.DecodeException;
 import javax.websocket.Decoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 15:32
  * To change this template use File | Settings | File Templates.
  */
-public class MessageDecoder extends Decoder.Adapter implements Decoder.Binary<Message> {
+public class MessageDecoder implements Decoder.Binary<Message> {
     @Override
     public Message decode(ByteBuffer byteBuffer) throws DecodeException {
         return (Message) SerializationUtils.deserialize(byteBuffer.array());  //To change body of implemented methods use File | Settings | File Templates.
         if (message == null) return false;
         return message instanceof Message;
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }
 
 

WebClient-Websocket/src/main/java/org/jacp/beans/websocket/chat/encoder/ChatMessageEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 09:40
  * To change this template use File | Settings | File Templates.
  */
-public class ChatMessageEncoder extends Encoder.Adapter implements Encoder.Binary<ChatMessage> {
+public class ChatMessageEncoder implements Encoder.Binary<ChatMessage> {
     @Override
     public ByteBuffer encode(ChatMessage message) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(message));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

WebClient-Websocket/src/main/java/org/jacp/beans/websocket/chat/encoder/UserAddMessageEncoder.java

 
 import javax.websocket.EncodeException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import java.nio.ByteBuffer;
 
 /**
  * Time: 12:51
  * To change this template use File | Settings | File Templates.
  */
-public class UserAddMessageEncoder extends Encoder.Adapter implements Encoder.Binary<UserAddMessage> {
+public class UserAddMessageEncoder implements Encoder.Binary<UserAddMessage> {
     @Override
     public ByteBuffer encode(UserAddMessage userAddMessage) throws EncodeException {
         return ByteBuffer.wrap(SerializationUtils.serialize(userAddMessage));
     }
+
+    @Override
+    public void init(EndpointConfig endpointConfig) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void destroy() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }
     </modules>
     <properties>
         <javax.persistence.version>2.0.0</javax.persistence.version>
-        <jee.version>7.0-b80</jee.version>
-        <glassfish.version>4.0-b80</glassfish.version>
-        <jersey.version>2.0-m13-2</jersey.version>
+        <jee.version>7.0-b82</jee.version>
+        <glassfish.version>4.0-b82</glassfish.version>
+        <jersey.version>2.0-rc1</jersey.version>
         <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
         <junit.version>4.11</junit.version>
-        <tyrusWebsocket.version>1.0-b13</tyrusWebsocket.version>
+        <tyrusWebsocket.version>1.0-b14</tyrusWebsocket.version>
         <!-- <tyrusWebsocket.version>1.0-SNAPSHOT</tyrusWebsocket.version> -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <javafx.version>2.2</javafx.version>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.