From 67cf907f77812ff1ca7548395b68fe7156f2f1d5 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Mon, 12 Apr 2010 20:24:06 +0000 Subject: [PATCH] --- mythtv/ear/pom.xml | 49 ---- mythtv/monitor/pom.xml | 48 ---- .../java/org/wamblee/mythtv/Application.java | 84 ------- .../main/java/org/wamblee/mythtv/Channel.java | 100 -------- .../java/org/wamblee/mythtv/FileType.java | 27 --- .../org/wamblee/mythtv/LinkStructure.java | 219 ------------------ .../org/wamblee/mythtv/MythtvBeanFactory.java | 36 --- .../mythtv/MythtvHibernateMappings.java | 31 --- .../java/org/wamblee/mythtv/Recording.java | 186 --------------- .../org/wamblee/mythtv/RecordingDatabase.java | 59 ----- .../java/org/wamblee/mythtv/RecordingPk.java | 106 --------- .../org/wamblee/mythtv/ScheduleConfig.java | 39 ---- .../main/resources/META-INF/persistence.xml | 17 -- ...g.wamblee.mythtv.datasource.standalone.xml | 14 -- mythtv/pom.xml | 42 ---- mythtv/src/scripts/asconfig.sh | 11 - mythtv/timer/pom.xml | 30 --- .../org/wamblee/mythtv/timer/TimerBean.java | 90 ------- .../src/main/resources/META-INF/ejb-jar.xml | 21 -- .../main/resources/META-INF/sun-ejb-jar.xml | 17 -- mythtv/war/pom.xml | 51 ---- .../war/src/main/resources/Recording.hbm.xml | 22 -- .../war/src/main/resources/beanRefContext.xml | 19 -- .../org.wamblee.beanfactory.properties | 7 - .../org.wamblee.mythtv.application.xml | 67 ------ .../org.wamblee.mythtv.datasource.xml | 10 - .../org.wamblee.mythtv.hibernate.properties | 20 -- .../org.wamblee.mythtv.hibernate.xml | 28 --- .../resources/org.wamblee.mythtv.properties | 8 - .../org.wamblee.mythtv.properties.xml | 16 -- mythtv/war/src/webapp/META-INF/MANIFEST.MF | 3 - mythtv/war/src/webapp/WEB-INF/sun-web.xml | 13 -- mythtv/war/src/webapp/WEB-INF/web.xml | 30 --- pom.xml | 4 - 34 files changed, 1524 deletions(-) delete mode 100644 mythtv/ear/pom.xml delete mode 100644 mythtv/monitor/pom.xml delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/Application.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/Channel.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/FileType.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/LinkStructure.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvBeanFactory.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvHibernateMappings.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/Recording.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingDatabase.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java delete mode 100644 mythtv/monitor/src/main/java/org/wamblee/mythtv/ScheduleConfig.java delete mode 100644 mythtv/monitor/src/main/resources/META-INF/persistence.xml delete mode 100644 mythtv/monitor/src/test/resources/org.wamblee.mythtv.datasource.standalone.xml delete mode 100644 mythtv/pom.xml delete mode 100755 mythtv/src/scripts/asconfig.sh delete mode 100644 mythtv/timer/pom.xml delete mode 100644 mythtv/timer/src/main/java/org/wamblee/mythtv/timer/TimerBean.java delete mode 100644 mythtv/timer/src/main/resources/META-INF/ejb-jar.xml delete mode 100644 mythtv/timer/src/main/resources/META-INF/sun-ejb-jar.xml delete mode 100644 mythtv/war/pom.xml delete mode 100644 mythtv/war/src/main/resources/Recording.hbm.xml delete mode 100644 mythtv/war/src/main/resources/beanRefContext.xml delete mode 100644 mythtv/war/src/main/resources/org.wamblee.beanfactory.properties delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.application.xml delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.datasource.xml delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.properties delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.xml delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.properties delete mode 100644 mythtv/war/src/main/resources/org.wamblee.mythtv.properties.xml delete mode 100644 mythtv/war/src/webapp/META-INF/MANIFEST.MF delete mode 100644 mythtv/war/src/webapp/WEB-INF/sun-web.xml delete mode 100644 mythtv/war/src/webapp/WEB-INF/web.xml diff --git a/mythtv/ear/pom.xml b/mythtv/ear/pom.xml deleted file mode 100644 index bc778ed6..00000000 --- a/mythtv/ear/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - org.wamblee - wamblee-mythtv - 0.2-SNAPSHOT - - - 4.0.0 - org.wamblee - wamblee-mythtv-ear - ear - /mythtv/ear - http://wamblee.org - - - - org.wamblee - wamblee-mythtv-war - ${project.version} - war - - - org.wamblee - wamblee-mythtv-monitor - ${project.version} - - - org.wamblee - wamblee-mythtv-timer - ${project.version} - ejb - - - - - - - maven-ear-plugin - - lib/ - - - - - - diff --git a/mythtv/monitor/pom.xml b/mythtv/monitor/pom.xml deleted file mode 100644 index 56013fe9..00000000 --- a/mythtv/monitor/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - org.wamblee - wamblee-mythtv - 0.2-SNAPSHOT - - - 4.0.0 - org.wamblee - wamblee-mythtv-monitor - jar - /mythtv/monitor - http://wamblee.org - - - - org.wamblee - wamblee-support-general - 0.2-SNAPSHOT - - - org.wamblee - wamblee-support-spring - 0.2-SNAPSHOT - - - javax.servlet - servlet-api - - - javax.persistence - persistence-api - - - org.wamblee - wamblee-hibernate-jpa - 0.2-SNAPSHOT - - - javax - javaee-api - - - - diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Application.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/Application.java deleted file mode 100644 index 7cc13f87..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Application.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import javax.annotation.Resource; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Queue; -import javax.jms.Session; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wamblee.general.BeanKernel; - -/** - * - * - * @author Erik Brakkee - */ -public class Application implements ServletContextListener { - private static final Log LOG = LogFactory.getLog(Application.class); - - @Resource(name = "MythtvConnectionFactory") - private ConnectionFactory connectionFactory; - - @Resource(name = "MythtvTimer") - private Queue timerQueue; - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ - public void contextInitialized(ServletContextEvent arg0) { - LOG.info("initializing"); - - // Get application configuration. - ScheduleConfig config = BeanKernel.getBeanFactory().find( - ScheduleConfig.class); - - // Send object message to the timer with the timer interval. - try { - Connection connection = connectionFactory.createConnection(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - ObjectMessage msg = session.createObjectMessage(); - msg.setObject(config.getIntervalSeconds()); - MessageProducer producer = session.createProducer(timerQueue); - producer.send(msg); - LOG.info("Message sent"); - } catch (Exception e) { - LOG.fatal("Error sending message", e); - } - - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ - public void contextDestroyed(ServletContextEvent arg0) { - LOG.info("terminating"); - - // Empty. - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Channel.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/Channel.java deleted file mode 100644 index ca16f51a..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Channel.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * - * - * @author Erik Brakkee - */ -@Entity -@Table(name="channel") -public class Channel { - - private int _id; - - private String _name; - - protected Channel() { - // Empty - } - - /** - * @return the id - */ - @Id - @Column(name="chanid") - public int getId() { - return _id; - } - - /** - * @param aId the id to set - */ - public void setId(int aId) { - _id = aId; - } - - /** - * @return the name - */ - @Column(name="name") - public String getName() { - return _name; - } - - /** - * @param aName the name to set - */ - public void setName(String aName) { - _name = aName; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Channel(" + _id + "," + _name + ")"; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object aObj) { - if ( !(aObj instanceof Channel)) { - return false; - } - Channel recording = (Channel)aObj; - return _id == recording._id; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return _id; - } - -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/FileType.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/FileType.java deleted file mode 100644 index c0b076d5..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/FileType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -/** - * - * - * @author Erik Brakkee - */ -public enum FileType { - - MPG, AVI; -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/LinkStructure.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/LinkStructure.java deleted file mode 100644 index 4d3be364..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/LinkStructure.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wamblee.io.SimpleProcess; -import org.wamblee.io.DirectoryMonitor.Listener; - -/** - * Link structure. - * - * @author Erik Brakkee - */ -public class LinkStructure implements Listener { - - private static final Log LOG = LogFactory.getLog(LinkStructure.class); - - private String _monitorDir; - - private File _linkDir; - - private RecordingDatabase _database; - - private SimpleDateFormat _format; - - private Map _recordings; - - public LinkStructure(String aMonitorDir, File aLinkDir, - RecordingDatabase aDatabase) { - _monitorDir = aMonitorDir + "/"; - deleteDir(aLinkDir); - _linkDir = aLinkDir; - _database = aDatabase; - _format = new SimpleDateFormat("yyyy-MM-dd-HH:mm"); - _recordings = new HashMap(); - } - - private void deleteDir(File aFile) { - for (File file: aFile.listFiles()) { - if ( file.isDirectory()) { - deleteDir(file); - } - LOG.info("File deleted " + file + ": " + file.delete()); - } - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.io.DirectoryMonitor.Listener#fileChanged(java.io.File) - */ - public void fileChanged(File aFile) { - LOG.debug("file changed " + aFile); - - // Re-assess file type - Recording recording = _recordings.get(aFile); - LOG.info("Recording changed " + recording); - recording.setFilesize(aFile.length()); - _database.update(recording); - String dir = getDirectory(recording); - FileType type = getFileType(aFile); - String path = dir + "/" + getFilename(recording, type); - - if (exists(dir + "/" + getFilename(recording, type))) { - // Nothing to do. - } else { - mkdir(dir); - for (FileType t : FileType.values()) { - rmlink(dir + "/" + getFilename(recording, t)); - } - createSymLink(_monitorDir + aFile.getName(), dir + "/" - + getFilename(recording, type)); - } - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.io.DirectoryMonitor.Listener#fileCreated(java.io.File) - */ - public void fileCreated(File aFile) { - LOG.debug("file created " + aFile); - Recording recording = _database.findRecording(aFile.getName()); - if ( recording == null ) { - LOG.warn("Spurious recording which should not exist according to mythtv: " + aFile); - return; - } - _recordings.put(aFile, recording); - LOG.info("New recording detected " + aFile + " " - + recording); - - recording.setFilesize(aFile.length()); - _database.update(recording); - String dir = getDirectory(recording); - mkdir(dir); - createSymLink(_monitorDir + aFile.getName(), dir + "/" - + getFilename(recording, getFileType(aFile))); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.io.DirectoryMonitor.Listener#fileDeleted(java.io.File) - */ - public void fileDeleted(File aFile) { - LOG.debug("file deleted " + aFile); - Recording recording = _recordings.get(aFile); - _recordings.remove(recording); - // mythtv will remove the recording from its database itself. - LOG.info("recording deleted " + recording); - String dir = getDirectory(recording); - for (FileType t: FileType.values()) { - rmlink(dir + "/" + getFilename(recording, t)); - } - rmdir(dir); - } - - private String getDirectory(Recording aRecording) { - return aRecording.getTitle().replaceAll("/", "-"); - } - - private FileType getFileType(File aFile) { - SimpleProcess process = new SimpleProcess(new File(_monitorDir), new String[] { - "file", aFile.getName() }); - try { - process.run(); - if (process.getStdout().contains("RIFF")) { - return FileType.AVI; - } else { - return FileType.MPG; - } - } catch (IOException e) { - LOG.error("Determining filetype for " + aFile + " failed", e); - return FileType.MPG; - } - } - - private String getFilename(Recording aRecording, FileType aType) { - return (_format.format(aRecording.getProgstart()) + "-" - + aRecording.getSubtitle() + "-" - + aRecording.getChannel().getName() + "." - + aType.toString().toLowerCase()).replaceAll("/", "-"); - } - - private boolean exists(String aPath) { - LOG.debug("exists " + aPath); - return new File(_linkDir, aPath).exists(); - } - - private void rmlink(String aPath) { - LOG.debug("rmlink " + aPath); - File link = new File(_linkDir, aPath); - //if ( !link.exists()) { - // return; - // } - if (!link.delete()) { - LOG.warn("Delete failed: " + aPath); - } else { - LOG.info("Removed link " + link); - } - } - - private void mkdir(String aDir) { - LOG.debug("mkdir " + aDir); - File dir = new File(_linkDir, aDir); - if ( dir.isDirectory()) { - return; - } - if (!dir.mkdirs()) { - LOG.warn("Could not create directory path: " + aDir); - } else { - LOG.info("Created directory " + dir); - } - } - - private void rmdir(String aDir) { - LOG.debug("rmdir " + aDir); - File dir = new File(_linkDir, aDir); - if (!dir.delete()) { - LOG.warn("Directory not deleted (still recordings left): " + aDir); - } else { - LOG.info("Directory " + dir + " deleted."); - } - } - - private void createSymLink(String aTarget, String aSource) { - try { - SimpleProcess process = new SimpleProcess(_linkDir, new String[] { - "ln", aTarget, aSource }); - process.run(); - LOG.info("Created symlink " + aSource + " -> " + aTarget); - } catch (IOException e) { - LOG.error( - "Could not create symlink: " + aTarget + " <- " + aSource, - e); - } - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvBeanFactory.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvBeanFactory.java deleted file mode 100644 index 0334ad77..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvBeanFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2005 the original author or authors. - * - * Licensed 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.wamblee.mythtv; -import org.wamblee.general.spring.SpringBeanFactory; - - -/** - * Bean factory for the crawler application. - * - * @author Erik Brakkee - */ -public class MythtvBeanFactory extends SpringBeanFactory { - private static final String SELECTOR_NAME = "beanRefContext.xml"; - private static final String FACTORY_NAME = "mythtv"; - - /** - * Constructs the bean factory. - * - */ - public MythtvBeanFactory() { - super(SELECTOR_NAME, FACTORY_NAME); - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvHibernateMappings.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvHibernateMappings.java deleted file mode 100644 index 83b911ca..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/MythtvHibernateMappings.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import org.wamblee.persistence.hibernate.HibernateMappingFiles; - -/** - * - * - * @author Erik Brakkee - */ -public class MythtvHibernateMappings extends HibernateMappingFiles { - - public MythtvHibernateMappings() { - super(new String[] { "Channel.hbm.xml", "Recording.hbm.xml" }); - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Recording.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/Recording.java deleted file mode 100644 index c3ad6286..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/Recording.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; - -/** - * - * - * @author Erik Brakkee - */ -@Entity -@Table(name="recorded") -public class Recording implements Serializable { - - private RecordingPk _id; - - private String _basename; - - private Date _progstart; - - private String _title; - - private String _subtitle; - - private long _filesize; - - protected Recording() { - // Empty - } - - /** - * @return the id - */ - @EmbeddedId - public RecordingPk getId() { - return _id; - } - - /** - * @param aId the id to set - */ - public void setId(RecordingPk aId) { - _id = aId; - } - - /** - * @return the basename - */ - @Column(name="basename") - public String getBasename() { - return _basename; - } - - /** - * @param aBasename the basename to set - */ - public void setBasename(String aBasename) { - _basename = aBasename; - } - - /** - * @return the progstart - */ - @Column(name="progstart") - @Temporal(TemporalType.TIMESTAMP) - public Date getProgstart() { - return _progstart; - } - - /** - * @param aProgstart the progstart to set - */ - public void setProgstart(Date aProgstart) { - _progstart = aProgstart; - } - - @Transient - public Channel getChannel() { - return _id.getChannel(); - } - - @Transient - public Date getStarttime() { - return _id.getStartTime(); - } - - /** - * @return the title - */ - @Column(name="title") - public String getTitle() { - return _title; - } - - /** - * @param aTitle the title to set - */ - public void setTitle(String aTitle) { - _title = aTitle; - } - - /** - * @return the subtitle - */ - @Column(name="subtitle") - public String getSubtitle() { - return _subtitle; - } - - /** - * @param aSubtitle the subtitle to set - */ - public void setSubtitle(String aSubtitle) { - _subtitle = aSubtitle; - } - - /** - * @return the filesize - */ - @Column(name="filesize") - public long getFilesize() { - return _filesize; - } - - public void setFilesize(long aFilesize) { - _filesize = aFilesize; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Recording(" + _id + "," + _basename + "," + _progstart + "," + _title + "," + _subtitle + ")"; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object aObj) { - if ( !(aObj instanceof Recording)) { - return false; - } - Recording recording = (Recording)aObj; - return _id.equals(recording._id); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return _id.hashCode(); - } - -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingDatabase.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingDatabase.java deleted file mode 100644 index 6b9e5313..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingDatabase.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.Query; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * - * @author Erik Brakkee - */ -public class RecordingDatabase { - - private static final Log LOG = LogFactory.getLog(RecordingDatabase.class); - - private EntityManager _entityManager; - - public RecordingDatabase(EntityManager aEntityManager) { - _entityManager = aEntityManager; - } - - public Recording findRecording(final String aName) { - Query query = _entityManager.createQuery( - "select r from Recording r where r.basename = ?1"); - query.setParameter(1, aName); - List result = query.getResultList(); - if ( result.size() > 1 ) { - throw new RuntimeException("More than two recordings returned"); - } - if ( result.size() == 0 ) { - return null; - } - return result.get(0); - } - - public void update(Recording aRecording) { - _entityManager.merge(aRecording); - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java deleted file mode 100644 index 40ffd078..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -/** - * - * - * @author Erik Brakkee - */ -@Embeddable -public class RecordingPk implements Serializable { - public Channel _channel; - public Date _starttime; - - public RecordingPk() { - // Empty - } - - /** - * @return the channel - */ - @ManyToOne - @JoinColumn(name="chanid") - public Channel getChannel() { - return _channel; - } - - /** - * @param aChannel the channel to set - */ - public void setChannel(Channel aChannel) { - _channel = aChannel; - } - - /** - * @return the starttime - */ - @Column(name="starttime") - @Temporal(TemporalType.TIMESTAMP) - public Date getStartTime() { - return _starttime; - } - - /** - * @param aStarttime the starttime to set - */ - public void setStartTime(Date aStarttime) { - _starttime = aStarttime; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object aObj) { - if ( aObj == null ) { - return false; - } - if ( !(aObj instanceof RecordingPk)) { - return false; - } - RecordingPk pk = (RecordingPk) aObj; - return _channel.equals(pk._channel) && _starttime.equals(pk._starttime); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return _channel.hashCode() + _starttime.hashCode(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "pk(" + _channel + ", " + _starttime + ")"; - } -} diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/ScheduleConfig.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/ScheduleConfig.java deleted file mode 100644 index 920f6218..00000000 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/ScheduleConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv; - -/** - * - * - * @author Erik Brakkee - */ -public class ScheduleConfig { - - private int _intervalSeconds; - - public ScheduleConfig(int aIntervalSeconds) { - _intervalSeconds = aIntervalSeconds; - } - - /** - * @return the intervalSeconds - */ - public int getIntervalSeconds() { - return _intervalSeconds; - } - -} diff --git a/mythtv/monitor/src/main/resources/META-INF/persistence.xml b/mythtv/monitor/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index fc87ef01..00000000 --- a/mythtv/monitor/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - org.hibernate.ejb.HibernatePersistence - jdbc/mythtv - org.wamblee.mythtv.Channel - org.wamblee.mythtv.Recording - true - - - \ No newline at end of file diff --git a/mythtv/monitor/src/test/resources/org.wamblee.mythtv.datasource.standalone.xml b/mythtv/monitor/src/test/resources/org.wamblee.mythtv.datasource.standalone.xml deleted file mode 100644 index 1d6e8563..00000000 --- a/mythtv/monitor/src/test/resources/org.wamblee.mythtv.datasource.standalone.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://10.0.0.140/mythconverg - mythtv - mythtv - - - \ No newline at end of file diff --git a/mythtv/pom.xml b/mythtv/pom.xml deleted file mode 100644 index 2dcb4393..00000000 --- a/mythtv/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - org.wamblee - wamblee-utils - 0.2-SNAPSHOT - - - 4.0.0 - org.wamblee - wamblee-mythtv - pom - /mythtv - http://wamblee.org - - - monitor - war - timer - ear - - - - - - - - - org.apache.maven.plugins - maven-war-plugin - - ${basedir}/src/webapp/WEB-INF/web.xml - wamblee-mythtv - src/webapp - - - - - - diff --git a/mythtv/src/scripts/asconfig.sh b/mythtv/src/scripts/asconfig.sh deleted file mode 100755 index 12aa2a88..00000000 --- a/mythtv/src/scripts/asconfig.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/ksh - -USER="$1" -PASSWORD="$2" - -asadmin create-jms-resource --restype javax.jms.QueueConnectionFactory jms/MythtvConnectionFactory -asadmin create-jms-resource --restype javax.jms.Queue --property Name=Mythtv jms/MythtvTimer - -asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.ConnectionPoolDataSource --allownoncomponentcallers=true --property URL=jdbc\\:mysql\\://shikra/mythconverg:password=$PASSWORD:user=$USER Mythtv -asadmin create-jdbc-resource --connectionpoolid Mythtv jdbc/mythtv - diff --git a/mythtv/timer/pom.xml b/mythtv/timer/pom.xml deleted file mode 100644 index 0dc104a7..00000000 --- a/mythtv/timer/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - org.wamblee - wamblee-mythtv - 0.2-SNAPSHOT - - - 4.0.0 - org.wamblee - wamblee-mythtv-timer - jar - /mythtv/timer - http://wamblee.org - - - - org.wamblee - wamblee-mythtv-monitor - ${project.version} - - - javax - javaee-api - - - - diff --git a/mythtv/timer/src/main/java/org/wamblee/mythtv/timer/TimerBean.java b/mythtv/timer/src/main/java/org/wamblee/mythtv/timer/TimerBean.java deleted file mode 100644 index c2128530..00000000 --- a/mythtv/timer/src/main/java/org/wamblee/mythtv/timer/TimerBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed 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.wamblee.mythtv.timer; - -import java.util.Collection; - -import javax.annotation.Resource; -import javax.ejb.MessageDriven; -import javax.ejb.Timeout; -import javax.ejb.Timer; -import javax.ejb.TimerService; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; -import javax.ejb.TransactionManagement; -import javax.ejb.TransactionManagementType; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.ObjectMessage; -import javax.jms.StreamMessage; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wamblee.general.BeanKernel; -import org.wamblee.io.DirectoryMonitor; - -/** - * - * - * @author Erik Brakkee - */ -@MessageDriven(name = "TimerBean") -// Spring's JTA transaction manager does not work with container managed transactions -// because it uses the UserTransaction object which glassfish forbids. -@TransactionManagement(TransactionManagementType.BEAN) -public class TimerBean implements MessageListener { - - private static final Log LOG = LogFactory.getLog(TimerBean.class); - - @Resource - private TimerService _timerService; - - /** - * Initialization of the time interval. The initialization is done through a - * StreamMessage with a single integer containing the time interval to use. - */ - public void onMessage(Message aInitMessage) { - ObjectMessage msg = (ObjectMessage) aInitMessage; - try { - int interval = (Integer)msg.getObject(); - LOG.info("Initializing timer with interval " + interval + " seconds"); - for (Timer timer: (Collection)_timerService.getTimers()) { - LOG.info("Canceling old timers: " + timer); - timer.cancel(); - } - _timerService.createTimer(1000, interval*1000, null); - } catch (JMSException e) { - throw new RuntimeException(e.getMessage()); - } - } - - @Timeout - private void timeout(Timer aTimer) { - LOG.info("Timer expired!!!"); - try { - DirectoryMonitor monitor = BeanKernel.getBeanFactory().find( - DirectoryMonitor.class); - monitor.poll(); - } catch (Throwable t) { - LOG - .error( - "something terrible happend, ignoring it and hoping for the best", - t); - } - } -} diff --git a/mythtv/timer/src/main/resources/META-INF/ejb-jar.xml b/mythtv/timer/src/main/resources/META-INF/ejb-jar.xml deleted file mode 100644 index 10d313a6..00000000 --- a/mythtv/timer/src/main/resources/META-INF/ejb-jar.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - TimerBean - org.wamblee.mythtv.timer.TimerBean - javax.jms.MessageListener - javax.jms.Queue - InternalBootstrapQueue - - - - - InternalBootstrapQueue - - - diff --git a/mythtv/timer/src/main/resources/META-INF/sun-ejb-jar.xml b/mythtv/timer/src/main/resources/META-INF/sun-ejb-jar.xml deleted file mode 100644 index b0f373b5..00000000 --- a/mythtv/timer/src/main/resources/META-INF/sun-ejb-jar.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - TimerBean - jms/MythtvTimer - - - InternalBootstrapQueue - jms/MythtvTimer - - - - - \ No newline at end of file diff --git a/mythtv/war/pom.xml b/mythtv/war/pom.xml deleted file mode 100644 index a602a78c..00000000 --- a/mythtv/war/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - org.wamblee - wamblee-mythtv - 0.2-SNAPSHOT - - - 4.0.0 - org.wamblee - wamblee-mythtv-war - war - /mythtv/war - http://wamblee.org - - - - org.wamblee - wamblee-mythtv-monitor - ${project.version} - - - javax - javaee-api - - - - - - - org.apache.maven.plugins - maven-war-plugin - - ${basedir}/src/webapp/WEB-INF/web.xml - wamblee-mythtv - src/webapp - WEB-INF/lib/*.jar - - - true - lib - - - - - - - - diff --git a/mythtv/war/src/main/resources/Recording.hbm.xml b/mythtv/war/src/main/resources/Recording.hbm.xml deleted file mode 100644 index 6e52a541..00000000 --- a/mythtv/war/src/main/resources/Recording.hbm.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mythtv/war/src/main/resources/beanRefContext.xml b/mythtv/war/src/main/resources/beanRefContext.xml deleted file mode 100644 index 1bd48a62..00000000 --- a/mythtv/war/src/main/resources/beanRefContext.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - org.wamblee.mythtv.properties.xml - org.wamblee.mythtv.datasource.xml - org.wamblee.mythtv.hibernate.xml - org.wamblee.mythtv.application.xml - - - - - \ No newline at end of file diff --git a/mythtv/war/src/main/resources/org.wamblee.beanfactory.properties b/mythtv/war/src/main/resources/org.wamblee.beanfactory.properties deleted file mode 100644 index 4ffb2ece..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.beanfactory.properties +++ /dev/null @@ -1,7 +0,0 @@ - -############################################################################## -# Class name of the beanfactory used by the crawler application -############################################################################## - -org.wamblee.beanfactory.class=org.wamblee.mythtv.MythtvBeanFactory - diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.application.xml b/mythtv/war/src/main/resources/org.wamblee.mythtv.application.xml deleted file mode 100644 index 7b9e8c07..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.application.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - ${org.wamblee.mythtv.linkdir} - - - - - - ${org.wamblee.mythtv.monitordir} - - - - - - ^[a-zA-Z0-9-_]*.mpg$ - - - - - - - - - - - - - - - ${org.wamblee.mythtv.monitordir} - - - - - - - - - - - - - - - - - - - - - - - - - - ${org.wamblee.mythtv.pollinterval} - - - - diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.datasource.xml b/mythtv/war/src/main/resources/org.wamblee.mythtv.datasource.xml deleted file mode 100644 index 4f40b6d8..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.datasource.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.properties b/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.properties deleted file mode 100644 index 42491b2c..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.properties +++ /dev/null @@ -1,20 +0,0 @@ - -################################################################################### -# dialect -################################################################################### -hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect - -################################################################################### -# debugging settings: Log4j configuration can provide more detail. -################################################################################### -hibernate.show_sql=false - -################################################################################### -# hibernate cache provider -################################################################################### -hibernate.cache.provider=org.hibernate.cache.EhCacheProvider - -################################################################################### -# query cache -################################################################################### -hibernate.cache.use_query_cache=true \ No newline at end of file diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.xml b/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.xml deleted file mode 100644 index 29f176a8..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.hibernate.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - java:comp/env/persistence/mythtv - - - - - - - - - - - - PROPAGATION_REQUIRED - - - - - - diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.properties b/mythtv/war/src/main/resources/org.wamblee.mythtv.properties deleted file mode 100644 index 85f9a0e8..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.properties +++ /dev/null @@ -1,8 +0,0 @@ - -org.wamblee.mythtv.datasource=jdbc/mythtv -org.wamblee.mythtv.pollinterval=120 -org.wamblee.mythtv.monitordir=/data/vcr -org.wamblee.mythtv.linkdir=/data/vcr/links - -#org.wamblee.mythtv.monitordir=/ext/home/erik/java/workspace/utils/mythtv/testdata/input -#org.wamblee.mythtv.linkdir=/ext/home/erik/java/workspace/utils/mythtv/testdata/links diff --git a/mythtv/war/src/main/resources/org.wamblee.mythtv.properties.xml b/mythtv/war/src/main/resources/org.wamblee.mythtv.properties.xml deleted file mode 100644 index 32fa83cd..00000000 --- a/mythtv/war/src/main/resources/org.wamblee.mythtv.properties.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - org.wamblee.mythtv.hibernate.properties - org.wamblee.mythtv.properties - - - - \ No newline at end of file diff --git a/mythtv/war/src/webapp/META-INF/MANIFEST.MF b/mythtv/war/src/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e949512..00000000 --- a/mythtv/war/src/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/mythtv/war/src/webapp/WEB-INF/sun-web.xml b/mythtv/war/src/webapp/WEB-INF/sun-web.xml deleted file mode 100644 index fc82b5d6..00000000 --- a/mythtv/war/src/webapp/WEB-INF/sun-web.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - MythtvConnectionFactory - jms/MythtvConnectionFactory - - - \ No newline at end of file diff --git a/mythtv/war/src/webapp/WEB-INF/web.xml b/mythtv/war/src/webapp/WEB-INF/web.xml deleted file mode 100644 index efd70d09..00000000 --- a/mythtv/war/src/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - org.wamblee.mythtv.Application - - - - persistence/mythtv - - - - MythtvConnectionFactory - javax.jms.ConnectionFactory - Container - Shareable - - - - MythtvTimer - javax.jms.Queue - Produces - InternalBootstrapQueue - - - diff --git a/pom.xml b/pom.xml index 0a74bef9..30daf852 100644 --- a/pom.xml +++ b/pom.xml @@ -388,7 +388,6 @@ - org/wamblee/mythtv/**/*.class @@ -509,9 +508,6 @@ !wamblee.release - - mythtv - -- 2.31.1